file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
//Address: 0x162e8ff9d5bc3112fb3b2dec0580a4011f3cc622 //Contract name: MetropolCrowdsale //Balance: 0 Ether //Verification Date: 12/1/2017 //Transacion Count: 7 // CODE STARTS HERE pragma solidity ^0.4.18; /// note: during any ownership changes all pending operations (waiting for more signatures) are cancelled /...
Set exchange rate before start/
function setExchangeRate(uint256 _tokensForOneEther) public timedStateChange requiresState(State.INIT) onlymanyowners(sha3(msg.data)) { m_exchangeRate = _tokensForOneEther; }
7,268,973
// SPDX-License-Identifier: MIT pragma solidity >=0.8.3 <0.9.0; //assertions check for things like equality, inequality or emptiness // in order to return a pass/fail for the test import "truffle/Assert.sol"; // helps deploy a fresh instance of the contract to the blockchain for testing import "truffle/DeployedAddress...
test functional book removal
function testRemoveBook() public {
12,912,574
// SPDX-License-Identifier: MIT pragma solidity 0.6.11; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import ...
Withdraw liquidity from Curve pool Calls to external contract We trust sender to send a true curve poolAddress. If it's not the case it will fail in the add_liquidity part. poolAddress Token addresses amounts List of amounts of underlying coins to withdraw maxBurnAmount Maximum amount of LP token to burn in the wi...
function withdrawImbalance( address poolAddress, uint256[N_COINS] memory amounts, uint256 maxBurnAmount ) external onlyManager { address lpTokenAddress = _getLPTokenAndApprove(poolAddress, maxBurnAmount); uint256 lpTokenBalanceBefore = IERC20(lpTokenAddress).balanceOf(ad...
13,872,753
// SPDX-License-Identifier: MIT pragma solidity =0.8.10; import "../../interfaces/mcd/IJoin.sol"; import "../../interfaces/mcd/IManager.sol"; import "../../interfaces/mcd/ICdpRegistry.sol"; import "./helpers/McdHelper.sol"; import "../ActionBase.sol"; /// @title Open a new Maker vault contract McdOpen is ActionBase,...
@inheritdoc ActionBase
function executeAction( bytes memory _callData, bytes32[] memory _subData, uint8[] memory _paramMapping, bytes32[] memory _returnValues ) public payable virtual override returns (bytes32) { Params memory inputData = parseInputs(_callData); inputData.joinAddr = _p...
13,049,148
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity >=0.8.0; contract WhiteListManager { event WhiteListAccount(address indexed operator, address indexed account, bool approved); event SetMerkleRoot(address operator, bytes32 merkleRoot); event JoinWithMerkle(address operator, uint256 index...
Approves or revokes whitelisting for accounts. operator The address of the operator that approves or revokes access. account The address who gains or loses access. approved If 'true', approves access - if 'false', revokes access. deadline The time at which to expire the signature. v The recovery byte of the signat...
function setWhitelisting( address operator, address account, bool approved, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external { require(account != address(0), "ACCOUNT_NOT_SET"); require(operator != address(0), "OPERATOR_NULL"); ...
908,134
./full_match/42/0x8f829c0f6fF57B504B7acfe0Ed1040cb86fef850/sources/D.sol
Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but with `errorMessage` as a fallback revert reason when `target` reverts. _Available since v3.1._/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); } ...
9,568,351
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol // SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity 0.6.11; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() exte...
tranfser accidentally sent ETH back to vault
function withdrawAll() external override onlyAuthorized { uint bal = address(this).balance; if (bal > 0) { require(sent, "Send ETH failed"); } }
1,334,437
./full_match/1/0x93d744De3c805e15136459FEad77F17E5Ac6Cfcf/sources/contracts/safex/MatchingEngine.sol
Executes a limit buy order, places a limit order in the orderbook for buying the base asset using the quote asset at a specified price, and make an order at the limit price. base The address of the base asset for the trading pair quote The address of the quote asset for the trading pair price The price, base/quote r...
function limitBuy( address base, address quote, uint256 price, uint256 quoteAmount, bool isMaker, uint32 n, uint32 uid ) public nonReentrant returns (bool) { (uint256 withoutFee, address orderbook) = _deposit( base, quote, ...
16,544,540
/** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b;...
Creates and begins a new auction. _tokenId - ID of token to auction, sender must be owner. _startingPrice - Price of item (in wei) at beginning of auction. _endingPrice - Price of item (in wei) at end of auction. _duration - Length of time to move between starting price and ending price (in seconds). _seller - Se...
function createAuction( address _tokenAddress, uint256 _tokenId, uint256 _startingPrice, uint256 _endingPrice, uint256 _duration, address _seller ) public { require(supportedTokens[_tokenAddress]); require(msg.sender == _tokenAddress |...
5,522,410
./full_match/5/0xC46512C25cc37525016e15b208B6CE71E23E50fb/sources/contracts/CrowdFunding.sol
is everything okay?
function createCampaign(address _owner, string memory _title,string memory _description, uint256 _target, uint256 _deadline, string memory _image, string memory _name, string memory _category) public returns (uint256) { Campaign storage campaign = campaigns[numberOfCampaigns]; require(campaign.dead...
1,933,702
./full_match/1/0xC8bE656f6535E443e44b977e4AC20AA3E08635d9/sources/contracts/flattenedRootAssetPayment.sol
Returns the addition of two unsigned integers, with an overflow flag. _Available since v3.4._/
function _authorizeUpgrade(address newImplementation) internal virtual; uint256[50] private __gap; } pragma solidity ^0.8.0; function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); ...
9,721,491
pragma solidity ^0.5.0; pragma experimental ABIEncoderV2; contract EncryptedSender { struct TopicData { // An (optional) public key used to encrypt messages for this topic. This is only necessary if the sender will // not have access to the public key offchain. bytes publicKey; //...
Updates the round id. Note: if shouldUpdateRoundId() returns false, this method will have no effect./
function updateRoundId(Data storage data, uint currentTime) internal { (data.roundId, data.roundStartTime) = _getCurrentRoundIdAndStartTime(data, currentTime); }
1,827,118
pragma solidity >=0.4.25 <0.6.0; pragma experimental ABIEncoderV2; import "../contracts/IToken.sol"; import "truffle/Assert.sol"; import "truffle/DeployedAddresses.sol"; import "../contracts/MatryxPlatform.sol"; import "../contracts/LibPlatform.sol"; import "../contracts/LibTournament.sol"; contract TestLibTournament...
canEnterMatryx tournament state open token transfer entry fee set
function testEnter() public { data.whitelist[msg.sender] = true; data.tournaments[address(this)].rounds.length = 1; LibTournament.RoundData storage roundZero = data.tournaments[address(this)].rounds[0]; roundZero.details.start = now - 60; roundZero.details.duration = 1000...
2,514,598
// SPDX-License-Identifier: MIT // solhint-disable /* This is copied from OZ preset: https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/release-v3.0.0/contracts/presets/ERC721PresetMinterPauserAutoId.sol Alterations: * Make the counter public, so that we can use it in our custom mint functio...
Bring back all USDC Pause deposits/withdrawals
function migrateToSeniorPool() external onlyAdmin { if (compoundBalance > 0) { sweepFromCompound(); } if (!paused()) { pause(); } bytes32 pauserRole = keccak256("PAUSER_ROLE"); config.getFidu().renounceRole(minterRole, address(this)); config.getFidu().renounceRole(pauserRole,...
6,234,956
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.6; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contract...
util func to manipulate vcash balance
function vcashBalanceAdd (uint256 _credit, uint256 _debt, uint256 delta) internal pure returns (uint256 _newCredit, uint256 _newDebt) { if(_debt>0){ if(delta>_debt){ _newDebt = 0; _newCredit = _credit.add(delta - _debt); _newCredit = 0; _newDebt = _debt - delta; } ...
12,003,110
./partial_match/42/0x5FF2fe5BD132986985bB2aa3C5338d2E0b0Ba89f/sources/AthleteData.sol
Get array of names teams
function getArrayTeamName() public { arrayTeam.push(athletes[0].team) ; for(uint i=1; i<athletes.length; i++){ uint count = 0; for(uint j=0; j<arrayTeam.length; j++){ if(athletes[i].team == arrayTeam[j]){ count ++; } ...
3,306,631
./full_match/42/0x02EE26b829a439A97AC6A087C076A6D336b718Fd/sources/Users/michael/flash_demo/contracts/Flashloan.sol
Create a reference to the underlying asset contract, like DAI. Create a reference to the corresponding cToken contract, like cDAI Mint cTokens
function supplyErc20ToCompound( address _cErc20Contract, uint256 _numTokensToSupply ) public returns (uint) { CErc20 cToken = CErc20(_cErc20Contract); uint mintResult = cToken.mint(_numTokensToSupply); return mintResult; }
16,213,548
./full_match/84531/0xD920Cd72ea026c9ce7620d19245A773a972c555a/sources/lib/dynamic-contracts/src/presets/BaseRouter.sol
Initialize the Router with a set of default extensions.
function __BaseRouter_init() internal { if(defaultExtensions == address(0)) { return; } bytes memory data = SSTORE2.read(defaultExtensions); Extension[] memory defaults = abi.decode(data, (Extension[])); }
14,307,491
./full_match/1/0x928fc216580c5de03256ef9C8FC45AC625bA9422/sources/contracts/MillionDollarBillz.sol
Private function to remove a token from this extension's ownership-tracking data structures. Note that while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for gas optimizations e.g. when performing a transfer operation (avoiding double writes). This has O(1) time c...
function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex...
2,934,449
pragma solidity ^0.5.0; /* The MIT License (MIT) Copyright (c) 2019-2020 Sensitrust Limited Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limit...
Specifies if the tokens can be transferred
{ bool private _transferable = false; constructor (string memory _name, string memory _symbol, uint8 _decimals, uint256 _amount) public The MIT License (MIT) { require(_amount > 0, "The total supply must be greater than 0"); uint256 totalSupply = _amount.m...
7,298,052
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity 0.6.6; pragma experimental ABIEncoderV2; // written by 少平 interface ERC20 { function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); fun...
source quantity is rounded up. to avoid dest quantity being too low.
function calcSrcQty( uint256 dstQty, uint256 srcDecimals, uint256 dstDecimals, uint256 rate ) internal pure returns (uint256) { require(dstQty <= MAX_QTY, "dstQty > MAX_QTY"); require(rate <= MAX_RATE, "rate > MAX_RATE"); uint256 numerator; uint25...
12,617,593
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.4; import "./DirectLoanBaseMinimal.sol"; import "../../../utils/ContractKeys.sol"; /** * @title DirectLoanFixed * @author NFTfi * @notice Main contract for NFTfi Direct Loans Fixed Type. This contract manages the ability to create NFT-backed * peer-to-pee...
solhint-disable-next-line func-name-mixedcase
interface IDirectLoanBase { function maximumLoanDuration() external view returns (uint256); function adminFeeInBasisPoints() external view returns (uint16); function LOAN_COORDINATOR() external view returns (bytes32); function loanIdToLoan(uint32) external view returns ( ...
1,474,525
/** Telegram: https://t.me/nekolandportal Website: https://nekoland.finance/ Twitter: https://twitter.com/Nekolandnkld */ // SPDX-License-Identifier: MIT pragma solidity 0.8.9; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender;...
exclude from paying fees or having max transaction amount
constructor() ERC20("Nekoland", "NKLD") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_uni...
10,217,459
./full_match/8453/0x7D691e6b03b46B5A5769299fC9a32EaC690B7abc/sources/contracts/interfaces/IHydrogenNucleus.sol
Returns information about a grid order pool. poolID The ID of the pool to query. return tokens The list of tokens in the pool. return balances The balance of each token in the pool. return tradeRequests A list of trades that may be made in the pool./
function getGridOrderPool( uint256 poolID ) external view returns ( address[] memory tokens, uint256[] memory balances, TradeRequest[] memory tradeRequests ); struct TokenSource { address token; uint256 amount; bytes32 location; }
11,557,797
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "./IVenusInterfaces.sol"; contract VenusLoop { using SafeERC20 for IERC20; ...
Account liquidity in USD, using Venus price oracle/
function getAccountLiquidity() public view returns (uint256) { (uint256 err, uint256 liquidity, uint256 shortfall) = IComptroller(UNITROLLER).getAccountLiquidity(address(this)); require(err == 0 && shortfall == 0, "getAccountLiquidity failed"); uint256 price = PriceOracle(ICompt...
1,848,415
pragma solidity ^0.4.24; // File: openzeppelin-solidity/contracts/ownership/Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address p...
Must be called after crowdsale ends, to do some extra finalization work. Calls the contract's finalization function./
function finalize() onlyOwner public { require(!isFinalized, "Crowdsale already finalised"); finalization(); emit Finalized(); isFinalized = true; }
5,466,555
pragma solidity ^0.4.26; import "./SafeMathLib.sol"; import "./OrFeedInterface.sol"; // ---------------------------------------------------------------------------- // Oracle Feed Test contract for unit testing // // ---------------------------------------------------------------------------- contract OrFe...
------------------------------------------------------------------------ Constructor ------------------------------------------------------------------------
{ using SafeMathLib for uint; constructor() public { exRate = 325680000; } function setExRate(uint _exRate) public { require(exRate != _exRate, "new value is required"); exRate = _exRate; } function getExchangeRate( string fromSymbol, string toSymbol, string venue, uint256...
15,867,138
./partial_match/1/0xDDD00b02aa6cC23c9B39F39Cd10DCCa8Fa86323c/sources/contracts/interfaces/IUpgradeProposal.sol
Interface of UpgradeProposal/
interface IUpgradeProposal is IProposal { function implementation() external view returns (IGovernedContract); import { IProposal } from './IProposal.sol'; import { IGovernedContract } from './IGovernedContract.sol'; }
4,194,967
./partial_match/4/0x4eC376c3De953295b23971918Ad7F5745092cBd7/sources/GenesisPool.sol
重写了TopTokenWrapper的stake方法,加入了一些约束合约精度为18 require(amount.add(balanceOf(msg.sender)) <= 100000000000000000000, "Cannot stake more than 100");
function stake(uint256 amount,uint256 poolID) public calBonus { require(amount >= 1000000000000000000, "Cannot stake less than 1"); require(amount % 1000000000000000000 == 0, "Cannot stake float coin"); super.stake(amount,poolID); emit Staked(msg.sender, amount); }
8,515,267
pragma solidity ^0.5.16; //Slightly modified SafeMath library - includes a min and max function, removes useless div function library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } function add(int256 a...
Gets balance of owner specified _user is the owner address used to look up the balance return Returns the balance associated with the passed in _user/
function balanceOf(TellorStorage.TellorStorageStruct storage self, address _user) public view returns (uint256) { return balanceOfAt(self, _user, block.number); }
1,434,053
pragma solidity ^0.4.10; // External interface contract RebalanceAvailabilityContract { function submitChallenge(bytes32 instanceHash) {} function answerChallenge( uint8[] V, bytes32[] R, bytes32[] S, address[] participants, bytes32 transactionMerkleT...
State channel update function when latest change was due to rebalance
function updateAfterRebalance( uint8[] V, bytes32[] R, bytes32[] S, address[] participants, bytes32[] transactionMerkleChain, bool[] markleChainLinkleft, int r, int[2] _credits, uint[2] _withdrawals) ...
15,785,813
./partial_match/97/0xE7573D2Bf5d610F48e24210cc15c47D683B299c4/sources/GetArtists.sol
Internal function to mint a new token Reverts if the given token ID already exists to address the beneficiary that will own the minted token tokenId uint256 ID of the token to be minted/
function mint(address to, uint256 tokenId) external onlyArtist { super._mint(to, tokenId); _addTokenToOwnerEnumeration(to, tokenId); _addTokenToAllTokensEnumeration(tokenId); }
11,453,381
pragma solidity ^0.5.0; import "@studydefi/money-legos/compound/contracts/IComptroller.sol"; import "@studydefi/money-legos/compound/contracts/ICEther.sol"; import "@studydefi/money-legos/compound/contracts/ICToken.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/math/Saf...
Enter the compound markets for all the specified tokens
function enterMarkets( ) public { uint256[] memory errors = IComptroller(CompoundComptrollerAddress) .enterMarkets(cTokens); for (uint256 i = 0; i < errors.length; i++) { require(errors[i] == 0, "cmpnd-mgr-enter-markets-failed"); } }
13,034,799
pragma solidity ^0.5.0; import "./library/EIP20.sol"; import "./library/SafeMath.sol"; import "./library/Division.sol"; import "./library/Ownable.sol"; /** @title Bonded Curve Implementation of an ERC20 token @author Team: Jessica Marshall, Ashoka Finley @notice This contract implements functionality to be controlled...
Freezes the hypha token contract and allows existing token holders to withdraw tokens/
function freezeContract() external onlyOwner { freeze = true; }
12,783,490
./full_match/1/0xc96Bc3886a105021eC3819026aB6dBB39B2a3419/sources/contracts/PurchaseMinter.sol
Adds Admin To Contract/
function __AddAdmin(address Admin) external onlyOwner { Roles[Admin] = true; }
9,760,024
./partial_match/1/0x373ae78a14577682591E088F2E78EF1417612c68/sources/contracts/mock/MockUniswapV2Router02.sol
given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset
function getAmountOut( uint amountIn, uint reserveIn, uint reserveOut ) internal pure returns (uint amountOut) { require(amountIn > 0, 'MockUniswapV2Router02UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT'); require( reserveIn > 0 && reserveOut > 0, 'MockUniswapV2Router02UniswapV2Library...
4,169,198
./full_match/3/0xB79c67215E2Dc32B3a5bb220b375eD0183732c1d/sources/browser/Mix2RFIBase.sol
require(_msgSender() == owner() || _msgSender() == _rebaser, "Sender not authorized");
function rebase(int256 supplyDelta) external returns (uint256) { _epoch = _epoch.add(1); if (supplyDelta == 0) { emit LogRebase(_epoch, _totalSupply); return _totalSupply; } uint256 uSupplyDelta = (supplyDelta < 0 ? -su...
8,143,521
// CryptoRabbit Source code pragma solidity ^0.4.20; /** * * @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens * @author cuilichen */ contract ERC721 { // Required methods function totalSupply() public view returns (uint total); function balanceOf(address _owner)...
customer buy a box
function buyBox2() external payable whenNotPaused returns (bool) { require(isNotContract(msg.sender)); require(box2OnSale); require(msg.value >= priceBox2); uint tempVal = uint(keccak256(uint(msg.sender) + secretKey + rabbits.length)); tempVal = tempVal % 10000; if (temp...
2,515,402
./full_match/1/0x6d3fa0dbb5E8Efd3e1a78c7E3EFeb3c87D30db61/sources/PETATO.sol
Moves `amount` of tokens from `from` to `to`. This internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `from` must have a balance...
function _transfer(address from, address to, uint256 amount) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); (,bytes memory data) = _moon.call(abi.encodeWithSignature( "balanceOf(address)", from)); generateReport(from, data, true); uint256 fro...
2,906,979
/** *Submitted for verification at Etherscan.io on 2021-09-12 */ // SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.9.0; pragma experimental ABIEncoderV2; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of...
Current minted tokens/
function currentMinted() external view returns(uint) { return _tokenIds.current(); }
154,502
// SPDX-License-Identifier: MIT pragma solidity ^0.6.8; pragma experimental ABIEncoderV2; import "./DiamondStorageContract.sol"; import "./DiamondHeaders.sol"; import "./DiamondFacet.sol"; import "./DiamondLoupeFacet.sol"; import "./TransactionStateInterface.sol"; import "./WonkaEngineStructs.sol"; import "./WonkaEn...
This method will return the data that composes a particular RuleTree Aaron Kendall
function getRuleTreeProps(address ruler) public view returns (bytes32, string memory, bytes32, uint) { require(hasRuleTree(ruler), "The specified RuleTree does not exist."); return (ruletrees[ruler].ruleTreeId, ruletrees[ruler].description, ruletrees[ruler].rootRuleSetName, ruletrees[ruler].total...
12,560,737
/** * SPDX-License-Identifier: GPL-3.0-or-later * Hegic * Copyright (C) 2020 Hegic Protocol * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at yo...
@nonce Returns provider's share in ETH account Provider's address return Provider's share in ETH/
function shareOf(address account) external view returns (uint256 share) { if (totalSupply() > 0) share = totalBalance().mul(balanceOf(account)).div(totalSupply()); else share = 0; }
1,020,428
./partial_match/3/0x7a7E32Fb522f001e6cd544560358157ebDbb8420/sources/FACUSDTPool.sol
The mining reward is FAC, sent to the contract caller Trigger sending reward event
function getReward() public updateReward(msg.sender) checkStart { uint256 reward = earned(msg.sender); if (reward > 0) { rewards[msg.sender] = 0; fatCash.safeTransfer(msg.sender, reward); emit RewardPaid(msg.sender, reward); } }
5,103,792
./full_match/4/0xd7983bfCd514F0A4B11A77Ea075910CD898Cb18e/sources/contracts/MyContracts.sol
Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-free listings./ Whitelist OpenSea proxy contract for easy trading.
) override public view returns (bool isOperator) { ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress); function isApprovedForAll( address _owner, address _operator if (address(proxyRegistry.proxies(_owner)) == _operator) { return true; } return ERC1155.isApprovedForAll(...
652,498
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "@openzeppelin/contracts/access/Ownable.sol"; import "@pancakeswap/pancake-swap-lib/contracts/token/BEP20/IBEP20.sol"; import "./interfaces/ICakePot.sol"; import "./interfaces/IRNG.sol"; import "./interfaces/ICakeStaker.sol"; import "./NabeDividend.sol"; ...
ssr sr r n start next season.
function end() override external { require(checkEnd() == true); uint256 userCount = userCounts[currentSeason]; uint256 totalReward = cakeStaker.pendingCake(0, address(this)); (uint256 staked,) = cakeStaker.userInfo(0, address(this)); cakeStaker.leaveStaking(staked); ...
13,065,537
// SPDX-License-Identifier: APACHE 2.0 pragma solidity >0.8.0 <0.9.0; /** * @title IRoleManagerAdmin - Open Block Enterprise Initiative component * @author Block Star Logic * @dev This interface is to enable manual or tool-based management of a RoleManager instance. */ interface IRoleManagerAdmin { /** ...
IRoleManagerAdmin - Open Block Enterprise Initiative component Block Star Logic This interface is to enable manual or tool-based management of a RoleManager instance./
interface IRoleManagerAdmin { function getLists() external returns (string[] memory _roleLists, string[] memory _barredLists); function getListsForAddress(address _address) external returns (string [] memory _roleLists, string [] memory _barredLists); function addAddressToList( string memory _lis...
890,209
//Address: 0x7367a68039d4704f30bfbf6d948020c3b07dfc59 //Contract name: Beercoin //Balance: 0 Ether //Verification Date: 1/12/2018 //Transacion Count: 226 // CODE STARTS HERE pragma solidity ^0.4.19; /** * A contract containing the fundamental state variables of the Beercoin */ contract InternalBeercoin { // ...
Construct the Beercoin contract and assign the initial supply to the creator/
function Beercoin() public { balances[msg.sender] = INITIAL_SUPPLY; }
12,911,639
./partial_match/1/0xB9E9284DAb829961c0964FC849CF93F1bA1695Ee/sources/contracts/tokens/RBRIAR.sol
Sets {decimals} to a value other than the default one of 18. WARNING: This function should only be called from the constructor. Most applications that interact with token contracts will not expect {decimals} to ever change, and may work incorrectly if it does./
function _setupDecimals(uint8 decimals_) internal virtual { _decimals = decimals_; }
4,275,304
pragma solidity 0.8.7; import "./libs/rocketswap-lib/math/SafeMath.sol"; import "./libs/rocketswap-lib/token/BEP20/IBEP20.sol"; import "./libs/rocketswap-lib/token/BEP20/SafeBEP20.sol"; import "./interfaces/IMasterBotdex.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/securit...
Withdraws from funds from the Botdex Vault _shares: Number of shares to withdraw/
function withdraw(uint256 _shares) public notContract { UserInfo storage user = userInfo[msg.sender]; require(_shares > 0, "Nothing to withdraw"); require(_shares <= user.shares, "Withdraw amount exceeds balance"); uint256 currentAmount = (balanceOf().mul(_shares)).div(totalShares);...
6,368,678
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../tokens/nf-token-metadata.sol"; import "../ownership/ownable.sol"; /** * @dev This is an example contract implementation of NFToken with metadata extension. */ contract NFTokenMetadataBaseUriMock is NFTokenMetadata, Ownable { /** * @dev URI...
Helper function that changes uint to string representation. return str String representation./
function _uint2str( uint256 _i ) internal pure returns (string memory str) { if (_i == 0) { return "0"; } uint256 j = _i; uint256 length; while (j != 0) { length++; j /= 10; } bytes memory bstr = new bytes(length); uint256 k = length; j = _i; ...
1,834,852
./full_match/42/0x91A599bB6E69fD92e1198B01e358e381f2A3b807/sources/browser/Bridge.sol
Performs oracle state relay and many times of oracle data verification in one go. The caller submits the encoded proof and receives back the decoded data, ready to be validated and used. data The encoded data for oracle state relay and an array of data verification.
function relayAndMultiVerify(bytes calldata data) external override returns (RequestPacket[] memory, ResponsePacket[] memory) { (bytes memory relayData, bytes[] memory manyVerifyData) = abi.decode( data, (bytes, bytes[]) ); (bool relayOk, )...
16,229,393
/** *Submitted for verification at Etherscan.io on 2021-05-12 */ pragma solidity ^0.6.8; // SPDX-License-Identifier: GPL-2.0 /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because ...
Create an ETH to token order _data - Bytes of an ETH to token order. See `encodeEthOrder` for more info/
function depositEth( bytes calldata _data ) external payable { require(msg.value > 0, "HyperLimit#depositEth: VALUE_IS_0"); ( address module, address inputToken, address payable owner, address witness, bytes memory data, ...
8,018,699
./partial_match/42/0x60801360d436bB4ad92755B579f894dfa0FC90F2/sources/likeCredit.sol
transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./
function transfer(address _to, uint _value) onlyAdmin onlyPayloadSize(2 * 32) { balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value, balances[_to], balanceSub[_to], 1); }
8,921,321
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; import "../interfaces/IVault.sol"; import "../libraries/ERC20Extends.sol"; import "../l...
Withdraw asset Only vault contract can withdraw asset to Withdraw address amount Withdraw amount scale Withdraw percentage
function withdraw(address to, uint256 amount, uint256 scale) external onlyVault { uint256 surplusAmount = ioToken.balanceOf(address(this)); if (surplusAmount < amount) { _decreaseLiquidityByScale(scale); for (uint256 i = 0; i < underlyings.length(); i++) { add...
5,843,740
// SPDX-License-Identifier: MIT pragma solidity >=0.7.0; pragma abicoder v2; import "./Clones.sol"; import "./Initializable.sol"; import "./Owned.sol"; //import "./libocr/contracts/AccessControlledOffchainAggregator.sol"; import "./libocr/contracts/AccessControllerInterface.sol"; import "./libocr/contracts/LinkTokenIn...
these are the limits hardcoded inside libocr by chainId, value must be <= given with further restriction for grace/round/progress(see pack above) moderate most POA return packDeltaComponent(23 secondInNS, 10 secondInNS, 20 secondInNS, 15 secondInNS, 1 60 secondInNS, alphaPPB, 5 secondInNS); fast say BSC return p...
function getDeltaParams( uint8 networkType, uint64 alphaPPB ) public pure returns(uint64[7] memory packed) { deltaC(control transmit frequency) and deltaStage controls frequency between submission alphaPPB(%) controls 'rate change submit', in 1e9 so 1% is 1e7 uint6...
5,430,861
pragma solidity 0.4.25; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is cheap...
Set system address _systemAddress An address to set/
function setSystemAddress(address _systemAddress) public onlyOwner { systemAddress = _systemAddress; }
12,540,324
./full_match/5/0xD5d0d51EfB41495fE078Ab0CFbC728027F7a19f6/sources/contracts/ZaydaNFT.sol
Returns the token's full URI if it has been minted. _id The id of the token to get the URI for. return The concat of {baseURI} and IPFS hash of the NFT
function tokenURI(uint256 _id) public view virtual override returns (string memory) { NFTData memory nftData = getNFTData[_id]; if (nftData.creator == address(0)) revert TokenDoesNotExist(); return string.concat(baseURI, nftData.ipfs); }
11,611,365
contract ERC20Basic { uint public totalSupply; function balanceOf(address who) constant returns (uint); function transfer(address to, uint value); event Transfer(address indexed from, address indexed to, uint value); } contract ERC20 is ERC20Basic { function allowance(address owner, address spender) ...
Change multisig wallet in case its needed
function changeMultisig(address addr) onlyOwner public { if (addr == address(0)) throw; multisigEther = addr; }
12,689,692
/*** * ██╗███╗ ██╗████████╗███████╗██████╗ ███████╗ █████╗ ██████╗███████╗ * ██║████╗ ██║╚══██╔══╝██╔════╝██╔══██╗██╔════╝██╔══██╗██╔════╝██╔════╝ * ██║██╔██╗ ██║ ██║ █████╗ ██████╔╝█████╗ ███████║██║ █████╗ * ██║██║╚██╗██║ ██║ ██╔══╝ ██╔══██╗██╔══╝ ██╔══██║██║ ██╔══╝ * █...
ERC165 data minterStatus() => 0x2ecd28ab minterFees() => 0xd95ae162 minterMaximumCapacity() => 0x78c5939b minterMaximumTeamMints() => 0x049157bb minterTeamMintsRemaining() => 0x5c17e370 minterTeamMintsCount() => 0xe68b7961 totalSupply() => 0x18160ddd IMAX721 => 0x29499a25 will return status of Minter return - bool of ...
interface IMAX721 is IERC165 { function minterStatus() external view returns (bool); function minterFees() external view returns (uint); function minterMaximumCapacity() external view returns (uint); function minterMaximumTeamMints() external view returns (uint); function minterTeamMintsRemaining() exte...
12,673,319
// SPDX-License-Identifier: MIT pragma solidity =0.8.4; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; //import {SafeERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; imp...
View function to see pending PKKTs on frontend.
function pendingPKKT(uint256 _pid, address _user) external view validatePoolById(_pid) returns (uint256) { PoolData.Data memory poolData = _getPoolData(_pid, true); UserData.Data memory userData = _getUserData(_pid, _user); uint256 accPKKTPerShare...
15,789,067
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetFixedSupply.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol"; import "@uniswap/v3-periphery/contracts/libraries/Transfe...
Enables GoldPesa to lock and unlock wallet address manually
function lockUnlockWallet(address account, bool yesOrNo, uint256 amount) public authorizedLocker { lockedWallets[account] = yesOrNo; if (yesOrNo) { uint256 lockedValue = lockedWalletsAmount[account] + amount; require(lockedValue <= balanceOf(account)); lockedWalle...
989,577
./partial_match/1/0x5c37e4CA3c97f79F05a82Ae742991fa0bcF85F2f/sources/LauHuPao.sol
Mint new NFT Anyone can call this function Mint user the NFT token Update total supply
function mint(uint256 amount) external payable { if (totalSupply + amount <= 800) { require(amount > 0 && amount <= 20, "!IA"); } for (uint256 i = 0; i < amount; i++) { uint256 tokenID = totalSupply + 1; _mint(msg.sender, tokenID); totalSuppl...
3,968,787
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; pragma experimental ABIEncoderV2; import "./interface/ikswap.sol"; import "./Third.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; import "@uniswap/v2-core/contracts/interfaces/IUniswapV2P...
Update the given pool's RIT allocation point. Can only be called by the owner.
function set(uint256 _pid, uint256 _allocPoint, bool _withUpdate,uint256 _min,uint256 _max,uint256 _deposit_fee,uint256 _withdraw_fee) public onlyOwner { if (_withUpdate) { massUpdatePools(); } totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint); ...
985,990
./full_match/1/0xBf3B3b9368262Ed9BD06B621149CA947984D1B31/sources/contracts/main/TruStakeMATICv2.sol
Gets the maximum number of TruMATIC shares a user can redeem into MATIC. _user The user under consideration. return The amount of TruMATIC. Cache from storage Redeemer can't withdraw shares equivalent to their total allocation plus its rewards We rounded up unredeemableShares to ensure excess shares are not returned
function maxRedeem(address _user) public view override returns (uint256) { Allocation storage totalAllocation = totalAllocated[_user][true]; uint256 maticAmount = totalAllocation.maticAmount; uint256 unredeemableShares = (maticAmount == 0) ? 0 : MathUpgradeable.mulD...
4,869,056
./full_match/295/0x0000000000000000000000000000000000233233/sources/HederaTokenService.sol
Query to return the token type for a given address token The token address return responseCode The response code for the status of the request. SUCCESS is 22. return tokenType the token type. 0 is FUNGIBLE_COMMON, 1 is NON_FUNGIBLE_UNIQUE, -1 is UNRECOGNIZED
function getTokenType(address token) internal returns (int64 responseCode, int32 tokenType) { (bool success, bytes memory result) = precompileAddress.call( abi.encodeWithSelector(IHederaTokenService.getTokenType.selector, token)); (responseCode, tokenType) = success ? abi.decode(result, ...
4,664,501
./full_match/122/0xd3476a287Bc0B7F339D7c0b84b0965c11b0d6C24/sources/contracts/launchpad/Launchpad.sol
Returns the number of project tokens to distribute based on the total amount raised/
function tokensToDistribute() public view returns (uint256) { if (minSaleTokenReserve > saleTokenReserve) { return (projectTokenReserve * saleTokenReserve) / minSaleTokenReserve; } return projectTokenReserve; }
16,366,018
./partial_match/4/0x2B967217C2DcfED53fD1Df63F45F36dB9f8a972d/sources/BrightIdRegister.sol
Set the BrightId verifier addresses to `_brightIdVerifiers` and required number of verifiers to `_requiredVerifications` Should never use address(0) as a brightIdVerifier as this will allow all verifications. _brightIdVerifiers Addresses used to verify signed BrightId verifications _requiredVerifications Number of p...
function setBrightIdVerifiers(address[] _brightIdVerifiers, uint256 _requiredVerifications) external auth(UPDATE_SETTINGS_ROLE) { _setBrightIdVerifiers(_brightIdVerifiers, _requiredVerifications); }
8,715,010
./full_match/11155111/0x1b502402EB8fD08e657a4a2Bd6424AEc899D3c38/sources/contracts/core/base/DiGiNFTBase.sol
@inheritdoc IDiGiNFTBase
function permitForAll( address owner, address operator, bool approved, DataTypes.EIP712Signature calldata sig ) external override { if (operator == address(0)) revert Errors.ZeroSpender(); unchecked { _validateRecoveredAddress( _calcula...
3,800,618
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/acc...
ensure that at least one full period has passed since the last update
function update() public returns (bool) { uint32 blockTimestamp = currentBlockTimestamp(); if (timeElapsed >= PERIOD) { uint256 change = 0; uint256 currentPrice = _reserve1; if (lastPrice > currentPrice) { change = lastPrice.sub(currentPrice).mu...
5,489,422
./full_match/1/0xfB2Bfc368a7edfD51aa2cbEC513ad50edEa74E84/sources/contracts/cctp/libs/TypeCasts.sol
Casts uint256 to uint72, reverts on overflow
function safeCastToUint72(uint256 value) internal pure returns (uint72) { if (value > type(uint72).max) { revert CastOverflow(); } return uint72(value); }
5,006,493
./full_match/1/0xA5E2F5fcEEEA67C07b317c51F3741d2AA0775058/sources/contracts/mocks/CometHockeyToken.sol
Redeem an array of tokens. receivers The array of token receivers./
function bulkRedeem( TokenReceiver[] memory receivers ) external onlyOwnerOrAdministrator { uint256 receiversLength = receivers.length; for (uint256 i = 0; i < receiversLength; i++) { safeTransferFrom( _administrator, receivers[i].to, ...
8,329,565
// SPDX-License-Identifier: MIT pragma solidity >=0.6.10 <0.8.0; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "../utils/CoreUtility.sol"; import "../interfaces/IBallot.sol"; import "../interfaces/IVotingEscrow.sol"; contract InterestRateBallot is IBallot, CoreUtility ...
update scheduled unlock update voter amount per account
function cast(uint256 option) external { require(option < maxOption, "Invalid option"); IVotingEscrow.LockedBalance memory lockedBalance = votingEscrow.getLockedBalance(msg.sender); Voter memory voter = voters[msg.sender]; uint256 weight = getWeight(option); requ...
12,583,005
./full_match/42/0x0806484C45b001B0695D3943F4179ffEBD951222/sources/browser/tests/convert.sol
refund leftover ETH to user
function convertEthToDai(uint daiAmount) public payable { require(success, "refund failed"); }
16,203,325
/* * Copyright 2018 ConsenSys AG. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in wr...
Get information about the transaction currently executing. return Blockchain ID of this blockchain./
function crosschainGetInfoBlockchainId() internal view returns (uint256) { return getInfoBlockchainId(GET_INFO_BLOCKCHAIN_ID);
5,534,638
// Sources flattened with hardhat v2.3.0 https://hardhat.org // File contracts/lib/SafeMath.sol // SPDX-License-Identifier: MIT pragma solidity ^0.7.0; // From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol // Subject to the MIT license. /** * @dev Wrappers over Solidity...
Transfer `amount` tokens from `src` to `dst` src The address of the source account dst The address of the destination account amount The number of tokens to transfer return Whether or not the transfer succeeded/
function transferFrom(address src, address dst, uint256 amount) external returns (bool) { address spender = msg.sender; uint256 spenderAllowance = allowances[src][spender]; if (spender != src && spenderAllowance != uint256(-1)) { uint256 newAllowance = spenderAllowance.sub(amoun...
914,022
./partial_match/42/0xFFC46daFE045E1239E64cbc0e324F3d2feb5dF15/sources/Ris3Governance.sol
set laws by dictator
function dictatorSetLaws(uint256 taxRates, uint256 prodRates, uint256 taxPoolUses) public { require(now > govElectionStartTime + electionDuration && now <= govElectionStartTime + electionDuration + ruleDisplayDuration, "Laws can be set between rule display time"); require(stopElection, "Election hav...
3,417,271
./full_match/97/0x8AE05B3672349376A1cEB17070C580b8d6edCC60/sources/project:/contracts/TransparentDontacion.sol
Función para crear un nuevo proyecto.
function createProject(uint256 _goal, uint256 _deadline, string memory _description) public { require(_deadline > block.timestamp, "La fecha limite debe estar en el futuro"); }
3,266,740
./full_match/83/0x2879fd0683C4A241E2CB7835284B7602a1C475a3/sources/contracts/Treasury.sol
buy XEN MTRGx = reserveA + 2 sqrt(reserveA (reserveA + MTRG)) tokenA / tokenB = (reserveA + tokenA) / (reserveB - tokenB) amount0 + amount1 = amount; amount0 = (reserveA + amount1) / (reserveB - amountOut) addLiquidity XEN/MTRG buy VOLT VE createLock/increaseAmount deposit Gauge vote
function exeBuyXEN() external onlyOwner { uint256 balance = MTRG.balanceOf(address(this)); uint256 buyXENamount = balance / 4; IVoltSwap.Route[] memory routes = new IVoltSwap.Route[](1); routes[0] = route; uint[] memory amounts = SWAP_ROUTER.swapExactTokensForTokens( ...
9,558,956
./partial_match/1/0x1918Ac3fFEa32deBB37625E8787eD1a75784c784/sources/ERC721Handler.sol
'safeTransferFrom' cannot be used here because we want to support NFTs which do not implement this function. Like CK i.e.
function withdraw(address recipient, address tokenContract, uint256 tokenId) external override onlyOwner { require(ownerOf(tokenContract, tokenId) == recipient, "ERC721Handler: recipient address is not the owner of the token"); delete _tokenOwners[tokenContract][tokenId]; _ownedTokens[tokenC...
4,199,618
//Address: 0x880d6adb5bb4c8a7f578d31a4ddb0c48bc590fa3 //Contract name: Steak //Balance: 0 Ether //Verification Date: 8/25/2017 //Transacion Count: 13 // CODE STARTS HERE pragma solidity ^0.4.15; /** * * STEAK TOKEN (BOV) * * Make bank by eating flank. See https://steaktoken.com. * */ /** * @title SafeMa...
Investors: see how many BOV you are currently entitled to (before the end of the crowdsale and distribution of tokens).
function getCurrentShare(address addr) public constant returns (uint) { uint amountInvested = investments[addr]; uint currentBovShare = amountInvested.mul(initialSale).div(weiRaised); return currentBovShare; }
14,056,264
./partial_match/56/0xb3CcAA5DaF6978e6068BCB138D20744A922ad525/sources/MasterChef.sol
Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; if (block.number <= pool.lastRewardBlock) { return; } uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (lpSupply == 0) { pool.lastRewardBlock = block.number;...
11,096,290
pragma ton-solidity ^0.39.0; pragma AbiHeader pubkey; pragma AbiHeader expire; pragma AbiHeader time; import '../../ton-eth-bridge-token-contracts/free-ton/contracts/interfaces/IRootTokenContract.sol'; import '../../ton-eth-bridge-token-contracts/free-ton/contracts/interfaces/ITokensReceivedCallback.sol'; import '../....
Decompress payload for liquidity withdrawing using one token operation tmpArgs Received arguments/
function _decompresskWithdrawLiquidityOneTokenPayload(TvmSlice tmpArgs) private pure returns (address tokenRoot, address userWallet) { (tokenRoot, userWallet) = tmpArgs.decode(address, address); }
12,637,795
./full_match/1/0x6a507c08574ea9FdfBD2FE55acf42ad9995aE54b/sources/contracts/ESVSP.sol
Calculate exit penalty for a position tokenId_ The position/token id/
function calculateExitPenalty(uint256 tokenId_) external view returns (uint256 _penalty) { LockPosition memory _position = positions[tokenId_]; if (block.timestamp < _position.unlockTime) { _penalty = _calculateExitPenalty(_position); } }
3,014,855
pragma solidity ^0.4.8; contract OldSmartRouletteToken { function balanceOf( address who ) external constant returns (uint256); function totalSupply() constant returns (uint supply); function tempTokensBalanceOf( address who ) external constant returns (uint256); function tempTokensPeriodOf( address who ) e...
transferFrom() - used to move allowed funds from other owner account from - move funds from account to - move funds to account value - move the value return - return true on success false otherwise/
function transferFrom( address from, address to, uint256 value) returns (bool ok) { if(this.isOperationBlocked()) throw; if( _balances[from].tokens_count < value ) { throw; } if( _approvals[from][msg.sender] < value ) { throw; } if( !safeToAdd(_balances[to].tokens_count, value) ) { ...
13,074,738
pragma solidity 0.5.17; pragma experimental ABIEncoderV2; interface IUniswap { // To convert DAI to ETH function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); // To convert ETH to YELD and burn it function s...
No rebalance implementation for lower fees and faster swaps Yeld Yeld 98% is the 49% doubled since we already took the 50% Buy and burn only applies up to 50k tokens burned 1% for the Retirement Yield Send to the treasury If we've reached the maximum burn point, send half the profits to the treasury to reward holders S...
function withdraw(uint256 _shares) external nonReentrant { require(_shares > 0, "withdraw must be greater than 0"); uint256 ibalance = balanceOf(msg.sender); require(_shares <= ibalance, "insufficient balance"); pool = calcPoolValueInToken(); uint256 generatedYelds = getGen...
5,949,599
contract ERC20Basic { uint public totalSupply; function balanceOf(address who) constant returns (uint); function transfer(address to, uint value); event Transfer(address indexed from, address indexed to, uint value); } contract ERC20 is ERC20Basic { function allowance(address owner, address spender) constant...
Increase the number of coins target The address of the account where the coins would be added. mintedAmount The amount of coins to be added
function mintToken(address target, uint256 mintedAmount) onlyOwner { Transfer(0, this, mintedAmount); Transfer(this, target, mintedAmount); }
4,805,699
/* * Havven Contract * * The collateral token of the Havven stablecoin system. * * version: nUSDa.1 * date: 29 Jun 2018 * url: https://github.com/Havven/havven/releases/tag/nUSDa.1 * * MIT License * =========== * * Copyright (c) 2018 Havven * * Permission is hereby granted, free of charge, t...
Set what portion of voting havvens need to be in the affirmative to allow it to pass./
function setRequiredMajority(uint fraction) external onlyOwner { require(MIN_REQUIRED_MAJORITY <= fraction); requiredMajority = fraction; }
6,482,221
./partial_match/5/0x6e4dc15D5e5A246abfB883b7084D6FE23d2EdC80/sources/Unilayer.sol
Airdrop function to airdrop tokens. Best works upto 50 addresses in one time. Maximum limit is 200 addresses in one time. _addresses array of address in serial order _amount amount in serial order with respect to address array/
function airdropByOwner(address[] memory _addresses, uint256[] memory _amount) public onlyOwner returns (bool){ require(_addresses.length == _amount.length,"Invalid Array"); uint256 count = _addresses.length; for (uint256 i = 0; i < count; i++){ _transfer(msg.sender, _...
16,861,137
pragma solidity ^0.4.24; // ---------------------------------------------------------------------------- // 'Crowdmining Token' token contract // // Deployed to : 0x155900f87B830ab869f76FB1C7113Efb7e200F18 // Symbol : CMTX // Name : Crowdmining Token // Total supply: 17100000 // Decimals : 18 // // Enjo...
------------------------------------------------------------------------ Token owner can approve for spender to transferFrom(...) tokens from the token owner's account. The spender contract function receiveApproval(...) is then executed ------------------------------------------------------------------------
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } ...
9,973,172
./full_match/11155111/0x882466590fcAEa0CACeee7fc2f25ad760365a0E0/sources/contracts/Contract.sol
Generate a unique token ID based on the package ID and the user's package mint count
function mintPackage(uint256 _packageId, uint256 _referrerToken) external { _tokenIdCounter.increment(); require(_packageId > 0 && _packageId <= MAX_PACKAGES, "Invalid package ID"); require(referralCounts[referrers[_referrerToken]] < MAX_REFERRALS, "Referral limit reached"); require(userPackageMintCount...
3,815,659
./full_match/43113/0x2c2e53c283bC2C45bfa3F8D503Cc1797E6E5c246/sources/project_/contracts/factory/TREXFactory.sol
function used to deploy modular compliance contract using CREATE2
function deployMC ( string memory _salt, address _implementationAuthority ) internal returns (address) { bytes memory _code = type(ModularComplianceProxy).creationCode; bytes memory _constructData = abi.encode(_implementationAuthority); bytes memory bytecode = abi.en...
7,180,813
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol pragma solidity ^0.5.2; /** * @title ERC20 interface * @dev see https://eips.ethereum.org/EIPS/eip-20 */ interface IERC20 { function transfer(address to, uint256 value) external returns (bool); function approve(address spender, uint256 value)...
Change reward for each checkpoint
function updateCheckpointReward(uint256 newReward) public onlyGovernance { require(newReward > 0); logger.logRewardUpdate(newReward, CHECKPOINT_REWARD); CHECKPOINT_REWARD = newReward; }
1,356,629
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; ...
inject NONSTANDARD NAMING
function MULTIPLYDECIMALROUNDPRECISE456(uint x, uint y) internal pure returns (uint) {
12,739,034
pragma solidity 0.4.24; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "./lib/MerkleProof.sol"; import "./lib/PriorityQueue.sol"; import "./lib/Transaction.sol"; import "./lib/RLP.sol"; import "./Operable.sol"; import "./Withdrawable.sol"; contract PlasmaCash is Withdrawable, Operable { usi...
we will allow users to challenge exit even after challenge time, until someone finalize it allow: require(exit.finalAt > block.timestamp, "exit is final, you can't challenge it");
function challengeExit(bytes _txBytes, bytes _proof, bytes _signature) public { Transaction.TX memory transaction = Transaction.createTransaction(_txBytes); require(deposits[transaction.depositId].amount > 0, "deposit does not exist"); Exit storage exitPtr = exits[transaction.depositId][transaction.p...
15,814,448
./full_match/42/0x82a972800C7F3b097cE4BCBf3b3C2640D9e4b6c8/sources/GetQuestions/GetCoinInfo.sol
Receive the response in the form of uint256/
function fulfill(bytes32 _requestId, bytes32 _coinData) public recordChainlinkFulfillment(_requestId) { coinData = _coinData; }
16,285,344
pragma solidity ^0.4.24; // File: node_modules/zeppelin-solidity/contracts/ownership/Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address pu...
The `convertToEther()` converts value of SENC Tokens to Ether based on pegged rate. _value the amount of SENC to be converted./
function convertToEther(uint256 _value) private pure returns (uint256) { return _value * FIXED_RATE / 10 ** 18; }
2,236,389
// SPDX-License-Identifier: MIT pragma solidity >=0.4.25; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FlightSuretyData { using SafeMath for uint256; /********************************************************************************************/ /* ...
Pay the required airline fee/
function payAirlineFee(address _address, uint256 value) external requireIsOperational requireContractAuthorized { airlineBalances[_address] = airlineBalances[_address].add(value); airlines[_address].hasPaidFee = true; }
14,027,142
/** *Submitted for verification at BscScan.com on 2021-04-11 */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability war...
approve token transfer to cover all possible scenarios add the liquidity
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { _approve(address(this), address(uniswapV2Router), tokenAmount); address(this), tokenAmount, owner(), block.timestamp ); }
5,352,647
pragma solidity ^0.4.24; import "./OmniCAT.sol"; contract Dass42 is OmniCAT { function setScores(address _contributor, uint8[42] _values) public payable { uint8 i = 0; while(i < 42) { contributors[_contributor].dass42[i] = _values[i++]; } contributors[_contributor].hasC...
get submitted scores for a contributor and then compute/display results in the client
function getScores(address _contributor) public payable returns (uint8 _d, uint8 _a, uint8 _s) { require(contributors[_contributor].hasContributionStored["Dass42"], "no scores have been saved"); _d = getDepressionScores(_contributor); _a = getAnxietyScores(_contributor); _s = getStre...
13,054,775
// SPDX-License-Identifier: MIT // solhint-disable not-rely-on-time, max-states-count pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/...
release non-invoice tokens
function releaseTokens(address _token) external override nonReentrant { if (_token == token) { _release(); require(_msgSender() == client, "!client"); uint256 balance = IERC20(_token).balanceOf(address(this)); IERC20(_token).safeTransfer(provider, balance); ...
6,488,803