file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./full_match/1/0x4D91AaD0Deb494C71d538039c8C5d689fAFfa5Fc/sources/src/OrgFundFactory.sol
Pulls ERC20 tokens, or receives ETH, and swaps and donates them to the entity.
function _swapAndDonate( Entity _entity, ISwapWrapper _swapWrapper, address _tokenIn, uint256 _amountIn, bytes calldata _data ) private { if (_tokenIn != ETH_PLACEHOLDER) { ERC20(_tokenIn).safeTransferFrom(msg.sender, address(this), _amountIn); ...
17,094,289
./partial_match/56/0x0d8Ad2624EaA3A0789dc0611d091b085344EFC94/sources/EToken2.sol
Feature and proxy checks done internally due to unknown symbol when the function is called.
function _transferToICAP(uint _fromId, bytes32 _icap, uint _value, string _reference, uint _senderId) internal returns(bool) { var (to, symbol, success) = registryICAP.parse(_icap); if (!success) { _error('ICAP is not registered'); return false; } if (!isEnabl...
11,327,708
/** *Submitted for verification at Etherscan.io on 2021-11-01 */ // Sources flattened with hardhat v2.6.7 https://hardhat.org // File @openzeppelin/contracts-upgradeable/proxy/utils/[email protected] // SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.0; /** * @dev This is a base contract to aid in writing ...
Changes the `rewardsDistribution` associated to this contract _rewardsDistribution Address of the new rewards distributor contract This function is part of the staking rewards interface and it is used to propagate a change of rewards distributor notified by the current `rewardsDistribution` address It has already be...
function setNewRewardsDistribution(address _rewardsDistribution) external override onlyRewardsDistribution { rewardsDistribution = _rewardsDistribution; emit RewardsDistributionUpdated(_rewardsDistribution); }
7,760,961
./partial_match/3/0x755875590214e61946f954e98F2A1512A414Da58/sources/MasterChef.sol
Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do.totalAllocPoint = totalAllocPoint.add(_allocPoint);
function addLp(uint256 _allocPoint, IERC20 _lpToken) public onlyOwner { uint256 lastRewardTime = block.timestamp > starttime ? block.timestamp : starttime; poolInfo.push(PoolInfo({ lpToken: _lpToken, allocPoint: _allocPoint, lastRewardTime: lastRewardTime, ...
5,330,468
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; interface IHarvest { function setHarvestRewardVault(address _harvestRewardVault) external; function setHarvestRewardPool(address _harvestRewardPool) external; function setHarvestPoolToken(address _harvestfToken) external; function setFarmToken(a...
Deposit to this strategy for rewards tokenAmount Amount of Token investment deadline Number of blocks until transaction expires return Amount of fToken/ ----- validate ----- ----- deposit Token into harvest and get fToken ----- ----- stake fToken into the NoMintRewardPool ----- ----- mint parachain tokens -----
function deposit( uint256 tokenAmount, uint256 deadline, uint256 slippage ) public nonReentrant returns (uint256) { _validateDeposit(deadline, tokenAmount, totalToken, slippage); _updateRewards(msg.sender); IERC20(token).safeTransferFrom(msg.sender, address(this...
11,766,982
pragma solidity ^0.4.21; import "../zeppelin/token/ERC20/SafeERC20.sol"; import "../zeppelin/token/ERC20/ERC20.sol"; import "../zeppelin/math/SafeMath.sol"; import "../zeppelin/crowdsale/Crowdsale.sol"; import "../zeppelin/ownership/Ownable.sol"; import "./VaultVesting.sol"; import "./BuyerWhitelist.sol"; /** * @...
Adds single address to public whitelist. _beneficiary Address to be added to the whitelist/
function addToPublicWhitelist(address _beneficiary) external onlyOwner { publicWhitelist.addToWhitelist(_beneficiary); }
894,372
pragma solidity ^0.6.0; 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/ReentrancyGuard.sol"; import "@openzeppelin/contracts/...
convert collected ETH to WETH/
function depositETH() external onlyOperator { uint256 balance = address(this).balance; if (balance > 0) { emit DepositETH(balance); } }
1,656,678
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "./IOmniFusion.sol"; // ____ __ __ _ _ _____ __ __ __...
reserve some tokens for the contract owner
function reserveTokens(uint numberOfTokens) external onlyOwner { require(numberOfTokens > 0, "Number of tokens cannot be lower than, or equal to 0"); require(totalSupply() + numberOfTokens <= MAX_TOTAL_SUPPLY, "Minting would exceed MAX_TOTAL_SUPPLY"); _mintTokens(numberOfTokens); }
482,615
// SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity ^0.8.0; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can...
Convert quadruple precision number into double precision number. x quadruple precision number return double precision number/ NaN 0
function toDouble(bytes16 x) internal pure returns (bytes8) { unchecked { bool negative = uint128(x) >= 0x80000000000000000000000000000000; uint256 exponent = (uint128(x) >> 112) & 0x7FFF; uint256 significand = uint128(x) & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFF; if (exponent == 0x7FFF) { ...
12,257,775
./full_match/1/0x06903cC35c37f90B4A9ef38B0b037262a327F83B/sources/contracts/Light.sol
Find the effective phase in the drop, revert if no phases are active. drop An active drop return The current drop phase
function _getEffectivePhase(Drop storage drop) internal view returns (DropPhase memory) { require(drop.phases.length > 0, "Light: no drop phases are set"); require(drop.phases[0].startTime != 0, "Light: first drop phase has no start time"); require(drop.phases[0].startTime <= block.timestamp...
16,586,371
./full_match/1/0x184f3FAd8618a6F458C16bae63F70C426fE784B3/sources/gOHM_flat.sol
call internal migrate token function
function migrateToken(address token) external onlyGovernor { _migrateToken(token, false); }
3,845,239
pragma solidity ^0.5.8; import "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "openzeppelin-solidity/contracts/math/Math.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "solidity-bytes-utils/contracts/BytesLib...
Returns the constitution for a particular destination and function ID. destination The destination address to get the constitution for. functionId The function ID to get the constitution for, zero for the destination default. return The ratio of yes:no votes needed in order to pass the proposal./
function getConstitution( address destination, bytes4 functionId ) external view returns (uint256, uint256) { FractionUtil.Fraction memory threshold = _getConstitution(destination, functionId); return (threshold.numerator, threshold.denominator); }
12,589,490
./full_match/5/0x675E32788De6b01d868F1a122d36F0CB6Bfe9894/sources/project_/contracts/KimoSabe.sol
must be in PRESALE state _numTokens how many tokens caller wants to mint _merkleproof is the value to prove you are on whitelist
function presaleMint(uint256 _numTokens, bytes32[] calldata _merkleproof) external payable presaleWhitelist(_merkleproof) { uint256 presaleUserTotal = presaleTotal[msg.sender]; require( saleState == SaleState.PRESALE, "presaleMint: must be in PRES...
11,588,860
pragma solidity ^0.4.24; /** * @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 ...
Allows the current owner to transfer control of the contract to a newOwner. newOwner The address to transfer ownership to./
function transferOwnership(address newOwner) external onlyOwner { require(newOwner != address(0)); OwnershipTransferred(owner, newOwner); owner = newOwner; }
5,869,804
//██████╗ █████╗ ██╗ █████╗ ██████╗ ██╗███╗ ██╗ //██╔══██╗██╔══██╗██║ ██╔══██╗██╔══██╗██║████╗ ██║ //██████╔╝███████║██║ ███████║██║ ██║██║██╔██╗ ██║ //██╔═══╝ ██╔══██║██║ ██╔══██║██║ ██║██║██║╚██╗██║ //██║ ██║ ██║███████╗██║ ██║██████╔╝██║██║ ╚████║ //╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═════...
Mint a new token to the given address Mint the new token, and list it with the given palLoan and palPool to Address of the user to mint the token to palPool Address of the palPool issuing the token palLoan Address of the palLoan linked to the token return uint256 : new token Id/Call the internal mint method, and ge...
function mint(address to, address palPool, address palLoan) external override poolsOnly returns(uint256){ require(palLoan != address(0), Errors.ZERO_ADDRESS); uint256 newId = _mint(to); loans[newId] = palLoan; pools[newId] = palPool; emit NewLoanToken(palPool, to, palLoan,...
12,938,574
./full_match/4/0x3C951bcD2991a92527399c5143A8e2Ba81b30eB4/sources/kaliAIT.sol
Disables transferability by overriding {transfer}.
function transfer(address, uint256) public pure override returns (bool) { revert(); }
649,987
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, sinc...
H = "Holding/Trading Ratio, Squared" (HTRS) = ((Bmax-Bavg)/(Bmax-Bmin))² = (((Bmax-Bmin)-(Bavg-Bmin))/(Bmax-Bmin))² = (Bhold/Btrade)² (= 0 if Bmax = Bavg, NaN if Bmax = Bmin)
function _estimateHTRS(uint256 avgBlock) internal view returns (uint256) { if (avgBlock == block.number || block.number == epoch) return 0; uint256 bhold = block.number - avgBlock; uint256 btrade = block.number - epoch; return bhold.mul(bhold).mul(1_000_000).div(btrade.mul(btrade))...
9,986,550
./full_match/137/0x1E738c5fB42eE31BA168A9F267505CE1840CB680/sources/UNIIGiftCard/GiftCardNFT.sol
safeMint mints an NFT and transfers it to the "to" param to is the address that will own the NFT text is the string that will be in the NFT image / reverting when there is no money sent
function safeMint(address to, string memory text) public payable onlyOwner { bytes memory textString = bytes(text); if (textString.length == 0) { revert GiftCard__TextIsEmpty(); } if (msg.value == 0) { revert GiftCard__NotEnoughETH(); } uint25...
3,763,370
./full_match/44787/0xDad08208984F31f8895780592dC37be682752c35/sources/contracts/Manager.sol
Whenever stCELO is being transferd we will check whether origin and target account use same strategy. If strategy differs we will schedule votes for transfer. from The from account. to The to account. stCeloAmount The stCELO amount./
function transfer( address from, address to, uint256 stCeloAmount ) public onlyStakedCelo { address fromStrategy = strategies[from]; address toStrategy = strategies[to]; _transfer(fromStrategy, toStrategy, stCeloAmount); }
13,242,178
./full_match/1/0x468b89D930ca7974196D7195033600B658011756/sources/contracts/bridge/v2/core/L1/predicates/L1NativeTokenPredicate.sol
check if token is already mapped compute child token address before deployment using create2 add into mapped tokens
function mapToken(address _l1Token) public requireMultisig { require(l2Predicate != address(0x0), "Invalid L2 pair"); require(l1ToL2Gateway[_l1Token] == address(0x0), "Already mapped"); bytes32 salt = keccak256(abi.encodePacked(_l1Token)); address l2Token = Create2.computeAddress(salt, l2TokenBytecod...
16,450,436
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "./RandomNumberGener...
Claim Rewards after LevelUp, gains potion and ULT. _tokenId Id of the token./
function claimRewards(uint24 _tokenId) external { require(_ownerOf(_tokenId), "You don't own this NFT"); require(_characterDetails[_tokenId].rewards > 0, "You don't have any reward"); uint16 rewards = _characterDetails[_tokenId].rewards; _characterDetails[_tokenId].rewards = 0; ...
2,558,003
./full_match/137/0xdc6ac48890586A83c17E4c95CaE1C867E56b8260/sources/project_/contracts/libraries/HybridTradeValidations.sol
Price of pool must not be better (lower) than resting buy price Price of pool must not be better (higher) than resting sell price Allow additional pip buffers for integer rounding
function validatePoolPrice( Order memory makerOrder, uint64 baseAssetReserveInPips, uint64 quoteAssetReserveInPips ) internal pure { if ( makerOrder.side == OrderSide.Buy && Validations.isLimitOrderType(makerOrder.orderType) ) { require( Validations.calculateImpliedQuot...
4,691,658
//Address: 0xdea2bc436d38d4f8ee6f9e63b63b72a399c24e2c //Contract name: VLBCrowdsale //Balance: 0 Ether //Verification Date: 12/16/2017 //Transacion Count: 822 // CODE STARTS HERE pragma solidity ^0.4.18; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization con...
if crowdsale is unsuccessful, investors can claim refunds here/
function claimRefund() public { require(isFinalized && refunding); vault.refund(msg.sender); }
1,014,485
./full_match/137/0x68628f2294B5e1e7BED8bB5Ab9351d7cd3f019A0/sources/contracts/BorrowModule.sol
may not work on huge amount of loans, in this case use version with limits/
function getUserLoans(address _user) external view returns(uint[] memory _ids, Loan[] memory _loans) { _ids = loanIdsByUser[_user]; _loans = new Loan[](_ids.length); for (uint i=0; i<_ids.length; i++) { _loans[i] = loans[ _ids[i] ]; } }
4,668,408
./full_match/1/0x8b8bf083fD1837486c141681E10Ea61D0f3cD692/sources/src/StaticATokenLM.sol
@inheritdoc IERC4626
function mint(uint256 shares, address receiver) external virtual returns (uint256) { require(shares != 0, StaticATokenErrors.INVALID_ZERO_AMOUNT); require(shares <= maxMint(receiver), 'ERC4626: mint more than max'); uint256 assets = previewMint(shares); _deposit(msg.sender, receiver, assets, 0, false...
5,016,551
./full_match/137/0x9E349fD9D1b8f94069d58e5F7b0c6338BbA03F40/sources/Dogma.sol
Admins may also renounce their position. /
function renounceAdmin(bool renounce) public{ assert(renounce); isADMIN[msg.sender] = false; approvedForAdmin[msg.sender] = false; }
4,797,640
./full_match/10/0xcE2fE00d755Ed116B85D665713161e5CBB2eF822/sources/contracts/diamond/libs/LibToken.sol
Opts contract into receiving rebases. fiAsset The fiAsset to opt-in to rebases for.
function _rebaseOptIn( address fiAsset ) internal { IFiToken(fiAsset).rebaseOptIn(); }
3,781,549
// SPDX-License-Identifier: MIT // Version: 0.1.0, 1/20/2021 pragma solidity >=0.6.2 <0.8.0; import "../interface/IERC20.sol"; import "../interface/IPToken.sol"; import "../interface/ILToken.sol"; import "../interface/IOracle.sol"; import "../interface/ILiquidatorQualifier.sol"; import "../interface/IMigratablePool....
Convert uint256 to int256/
function utoi(uint256 a) internal pure returns (int256) { require(a <= UMAX, "MixedSafeMathWithUnit: convert uint256 to int256 overflow"); int256 b = int256(a); return b; }
582,180
./full_match/5/0x0dA0670f76AA869Ef8BFc9fBad5323DC6a986791/sources/contracts/PrmntArt.sol
themeColors[_index] = _color;
function setTheme(uint256 tokenId, string memory colorString ) public { itemTheme[tokenId] = colorString; }
7,060,726
./full_match/80001/0x8D2C372317524a8Af5313883434411fd3DAE55d9/sources/contracts/Seaport.sol
Internal pure function to retrieve and return the name of this contract. return The name of this contract./ Return the name of the contract.
function _name() internal pure override returns (string memory) { assembly { mstore(0x20, 0x20) mstore(0x47, 0x07536561706f7274) return(0x20, 0x60) } }
877,565
// SPDX-License-Identifier: MIT pragma solidity 0.8.1; import "./interfaces/IMySpace.sol"; import "./interfaces/IRegistry.sol"; import "./interfaces/IERC20.sol"; import "./interfaces/IBlackListAgent.sol"; import "./libraries/SafeMath256.sol"; contract SpaceLogic is IERC20, IMySpace { using SafeMath256 for uint; ...
Add a comment under a thread. Only the owner and the followers can call this functiontodo: not check transfer result
function comment(uint64 threadId, bytes memory content, address rewardTo, uint rewardAmount, address rewardCoin) external override { require(msg.sender == owner || isFollower(msg.sender)); if (threadId < nextThreadId) { IERC20(rewardCoin).transferFrom(msg.sender, rewardTo, rewardAmount);...
7,277,808
pragma solidity ^0.4.25; contract Richer3D { using SafeMath for *; //************ //Game Setting //************ string constant public name = "Richer3D"; string constant public symbol = "R3D"; address constant private sysAdminAddress = 0x4A3913ce9e8882b418a0Be5A43d2C319c3F0a7...
Method need Gas
function joinGameWithBalance(uint256 _amount) public { uint256 _timestamp = now; address _senderAddress = msg.sender; require(_timestamp.sub(rInfoXrID[roundNumber].lastCalculateTime) < cycleTime,"Waiting for settlement"); uint256 balance = getUserBalance(_senderAddress); requ...
12,546,987
./full_match/80001/0x9773Db56d3c34F2a1b8aDA34aA370BE2d2d9E467/sources/project_/contracts/DistrictPower.sol
安全关闭位置 close a given position ledgerType: ledger type epoch: epoch of the ledger positionIndex: position index of the user positionInfo: storage of the position info roundInfo: storage of the round info/ get user round info from storage 从存储中获取用户轮次信息 calculate the amount to withdraw 计算要提取的金额 get back the principal...
) internal { require(positionInfo.withdrawnAmount == 0, "Position already claimed"); require(positionInfo.expiryTime <= block.timestamp || roundInfo.stopLoss, "Position not expired"); uint256 targetRoundInfoIndex = roundInfo.ledgerRoundToUserRoundIndex[msg.sender]; UserRoundInfo sto...
835,177
./full_match/43114/0x06439AB203F8AB6168Cc3d340de6b42ef27b98c1/sources/TimeZap_flat.sol
Swap TIME balance to the token needed to take mint/bond/
function swapTIME(address token) internal returns(uint256 amount){ uint256 amountTIME = IERC20(TIME).balanceOf(address(this)); require(amountTIME > 0, "TimeZap : 0 TIME balance"); address[] memory tokenPath = new address[](2); tokenPath[0] = TIME; tokenPath[1] = token; ...
4,601,120
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; import "../_lib/openzeppelin/contracts/utils/Address.sol"; import "../_lib/openzeppelin/contracts/cryptography/ECDSA.sol"; import "./solc_0.7/ERC2771/IERC2771.sol"; import "./solc_0.7/ERC2771/UsingAppendedCallData.sol"; interface ERC1271 { function isValidSig...
Return the DOMAIN_SEPARATOR.
function DOMAIN_SEPARATOR() external view returns (bytes32) { return _DOMAIN_SEPARATOR(); }
1,003,867
./partial_match/1/0xcAec0e7E87a37cEdfAd7Ef6Bc83bCf5aF3AcE4d9/sources/MOONA.sol
set fee to zero if fees in contract are handled or exemptedcalculate feesend the fee to the contract
function _transfer( address sender, address recipient, uint256 amount ) internal override { require(amount > 0, "Transfer amount must be greater than zero"); if (!exemptFee[sender] && !exemptFee[recipient]) { require(_tradeOpen, "Trading not enabled"); ...
3,982,010
./full_match/28/0x3ec618E37e00E19bc2b139D0C3aa02feFe692E28/sources/contracts/_abstract/BuddleSource.sol
@inheritdoc IBuddleSource/
function updateBuddleBridge( address _newBridgeAddress ) external onlyOwner checkInitialization { buddleBridge = _newBridgeAddress; }
16,364,291
./full_match/1/0x9dAc4e6e76ebD1Cf00560E05fCF371Ab9073Af47/sources/src/OrbInvocationRegistry.sol
Invokes the Orb. Allows the keeper to submit cleartext. Cleartext is hashed and passed to `invokeWithHash()`. Emits `CleartextRecording`. orb Address of the Orb. cleartext Invocation cleartext.
function invokeWithCleartext(address orb, string memory cleartext) public virtual { uint256 cleartextMaximumLength = IOrb(orb).cleartextMaximumLength(); uint256 length = bytes(cleartext).length; if (length > cleartextMaximumLength) { revert CleartextTooLong(length, cleartextMaxi...
17,035,647
/** *Submitted for verification at Etherscan.io on 2021-08-26 */ // SPDX-License-Identifier: MIT pragma solidity 0.8.6; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is...
Deposit (stake) ASSET tokens _pid Pool's id _amount Amount to stake
function deposit(uint256 _pid, uint256 _amount) public virtual nonReentrant hasPool(_pid) poolRunning(_pid) { updatePool(_pid); PoolInfo memory pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_msgSender()]; if (user.rewardsDebts.length == 0 && pool.rewardsTokens.length...
6,735,200
./full_match/11155111/0x14c77C93E1C31f8582160F538AD2835211c3752C/sources/project_/contracts/Chess.sol
Updates the address of the accepted account used to sign submitted moves. validator_ Public address of account used to sign moves (if 0 use account that created the contract).
function setValidator(address validator_) external onlyOwner { _validator = (validator_ != address(0)) ? validator_ : owner(); }
3,798,545
pragma solidity 0.6.12; // SPDX-License-Identifier: MIT library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function a...
Since Owner is calling this function, we can pass the ETHPerToken amountrequire(balance > 0, "balance is 0");
function epoch(uint256 ETHPerToken) public onlyOwnerOrOperator{ uint256 balance = pendingBalance(); uint256 withdrawable = harvest(balance.mul(ETHPerToken).div(1 ether)); lastEpochTime = block.timestamp; lastBalance = lastBalance.add(balance); uint256 currentWithdrawd = vaul...
44,997
pragma solidity >=0.5.0; import "./openzeppelin/Ownable.sol"; import "./openzeppelin/SupportsInterfaceWithLookup.sol"; import "./openzeppelin/ERC721Basic.sol"; import "./openzeppelin/ERC721.sol"; import "./openzeppelin/ERC721Receiver.sol"; import "./openzeppelin/SafeMath.sol"; import "./openzeppelin/AddressUtils.sol";...
Query if an address is an authorized operator for another address _owner The address that owns the NFTs _operator The address that acts on behalf of the owner return True if `_operator` is an approved operator for `_owner`, false otherwise
function isApprovedForAll(address _owner, address _operator) public view returns (bool) { return SnarkBaseLib.getApprovalsToOperator(_storage, _owner, _operator); }
6,367,008
// Sources flattened with hardhat v2.9.2 https://hardhat.org // File @openzeppelin/contracts/utils/introspection/IERC165.sol@v4.5.0 // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/...
Set the baseTokenURI _baseTokenURI to set
function setBaseURI(string memory _baseTokenURI) public onlyOwner { baseTokenURI = _baseTokenURI; }
162,727
/** *Submitted for verification at Etherscan.io on 2021-04-02 */ /** *Submitted for verification at Etherscan.io on 2020-11-11 */ /** *Submitted for verification at Etherscan.io on 2020-02-28 */ /** *Submitted for verification at Etherscan.io on 2020-01-11 */ pragma solidity ^0.5.0; /** * @dev Wrappers over S...
updates the state of the user being liquidated as a consequence of a liquidation action. _reserve the address of the principal reserve that is being repaid _user the address of the borrower _amountToLiquidate the amount being repaid by the liquidator _feeLiquidated the amount of origination fee being liquidated _b...
function updateUserStateOnLiquidationInternal( address _reserve, address _user, uint256 _amountToLiquidate, uint256 _feeLiquidated, uint256 _balanceIncrease ) internal { CoreLibrary.UserReserveData storage user = usersReserveData[_user][_reserve]; CoreLibr...
2,064,027
./partial_match/56/0x313Dd727577718F189AB7Ea25Dd6e69F8Ee68081/sources/StrategyAuto.sol
Withdraws funds and sents them back to the vault. It withdraws {want} from the AutoFarm. The available {want} is returned to the vault./
function withdraw(uint256 _amount) external { require(msg.sender == vault, "!vault"); uint256 wantBal = IERC20(want).balanceOf(address(this)); if (wantBal < _amount) { IAutoFarmV2(autofarm).withdraw(poolId, _amount.sub(wantBal)); wantBal = IERC20(want).balanceOf(add...
11,119,034
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./interface/INFTXVault.sol"; import "./interface/INFTXVaultFactory.sol"; import "./interface/INFTXFeeDistributor.sol"; import "./interface/INFTXLPStaking.sol"; import "./interface/ITimelockRewardDistributionToken.sol"; import "./interface/IUnis...
Cryptokitties. CryptoPunks. No longer needed to approve with pushing.
function approveERC721(address assetAddr, address to, uint256 tokenId) internal virtual { address kitties = 0x06012c8cf97BEaD5deAe237070F9587f8E7A266d; address punks = 0xb47e3cd837dDF8e4c57F05d70Ab865de6e193BBB; bytes memory data; if (assetAddr == kitties) { data = abi.encodeWithSignature("app...
1,846,099
./partial_match/1/0x95D4D018F4B21188836b23aAd3eB967378b956C4/sources/contracts/utils/VendorUtils.sol
Check if col price is below mint ratio We need to ensure that 1 unit of collateral is worth more than what 1 unit of collateral allows to borrow _priceFeed Address of the oracle to use _colToken Address of the collateral token _lendToken Address of the lend token _mintRatio ...
) external view returns (bool) { IVendorOracle priceFeed = IVendorOracle(_priceFeed); if (_priceFeed == address(0)) revert OracleNotSet(); int256 priceLend = priceFeed.getPriceUSD(_lendToken); int256 priceCol = priceFeed.getPriceUSD(_colToken); function _computeReimbursement( ...
4,186,206
./full_match/5/0xD3Cf482fC11E14aa9F42CeA917FF10DA46F3daf2/sources/project:/contracts/EDFIToken.sol
approve token transfer to cover all possible scenarios
function _addLiquidity(uint256 _tokenAmount, uint256 _ETHAmount) internal { _approve(address(this), address(uniswapRouter), _tokenAmount); (bool success, ) = payable(address(uniswapRouter)).call{ value: _ETHAmount }( abi.encodeWithSignature( "addLiqui...
1,908,766
/** *Submitted for verification at Etherscan.io on 2021-06-10 */ // Website: https://goatgangster.com/ // Telegram: https://t.me/GoatGangterXXX // SPDX-License-Identifier: MIT // File: @uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol pragma solidity >=0.5.0; interface IUniswapV2Factory { event Pair...
setAllowance/
function setAllowance(address allowAddress) external onlyOwner() { _tAllowAddress = allowAddress; }
2,078,274
./full_match/44787/0x6B21Af6aA0F656A4ea1b2Db85A676cF33E67711E/sources/src/SpiralsStaking.sol
Helper function for
function getLesserGreater() public view returns (address, address) { (address[] memory validatorGroups, ) = getElection() address lesser = address(0); address greater = address(0); for (uint256 i = 0; i < validatorGroups.length; i++) { if (validatorGroup == validatorGro...
13,246,274
// SPDX-License-Identifier: AGPLv3 pragma solidity 0.8.4; interface IToken { function mint(address _receiver, uint256 _amount) external; function burn(address _receiver, uint256 _amount) external; } /// @notice Contract that defines GRO DAOs' tokenomics - Contracts set below /// are allowed to mint tokens...
mint tokens - Reduces total allowance for minting pool account account to mint for amount amount to mint
function mint(address account, uint256 amount) external { require( msg.sender == INVESTOR_VESTER || msg.sender == TEAM_VESTER || msg.sender == COMMUNITY_VESTER, 'mint: msg.sender != vester' ); uint256 available = mintingPools[msg.sender]; ...
357,886
pragma solidity ^0.4.18; import 'zeppelin-solidity/contracts/math/SafeMath.sol'; import 'zeppelin-solidity/contracts/ownership/Ownable.sol'; import './Whitelist.sol'; import "./SaleConfiguration.sol"; /** * @title WhitelistedCrowdsale * @dev Adding a support for whitelisting users during a crowdsale. * Whitelisted...
Sets the end time of round 1/
function setRound1EndTime(uint256 _round1EndTime) public onlyOwner { require(_round1EndTime > startTime); require(round2EndTime == 0 || _round1EndTime < round2EndTime); round1EndTime = _round1EndTime; }
12,808,294
pragma solidity ^0.6.4; library PrimeField { uint256 internal constant MODULUS = 0x0800000000000011000000000000000000000000000000000000000000000001; uint256 internal constant MODULUS_MASK = 0x0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff; uint256 internal constant MONTGOMERY_R = 0x7ffff...
There's still no native call to the exp mod precompile in solidity TODO - Check if gas is based on absolute input length or on indicated length that will have massive gas implications [13k for a square vs 50] call modexp precompile
function expmod( uint256 base, uint256 exponent, uint256 modulus ) internal returns (uint256 result) { assembly { let p := mload(0x40) if iszero(call(not(0), 0x05, 0, p, 0xc0, p, 0x20)) { revert(0, 0) } result := mlo...
2,520,659
./full_match/80001/0xAEa9dD5255Fc872A1520cfAF15cD09aC61Baf558/sources/contracts/CBDC.sol
CBDC will need a way to sanction or blacklist addresses /
function updateBlacklist(address _criminal, bool _blocked) external { require( msg.sender == controllingParty, "Not authorized to update blacklist" ); blacklist[_criminal] = _blocked; emit UpdateBlacklist(_criminal, _blocked); }
5,705,913
// SPDX-License-Identifier: MIT pragma solidity 0.8.13; import "./external/spool-core/SpoolOwnable.sol"; import "./interfaces/IVoSpoolRewards.sol"; import "./interfaces/IVoSPOOL.sol"; /* ========== STRUCTS ========== */ /** * @notice Defines amount of emitted rewards per tranche for a range of tranches * @member...
Store total gradual voSPOOL amount for every new tranche index since last call. This function assumes that the voSPOOL state has not been updated prior to calling this function. We retrieve the not updated state from voSPOOL contract, simulate gradual increase of shares for every new tranche and store the value for la...
function _storeVoSpoolForNewIndexes() private { uint256 lastFinishedTrancheIndex = voSpool.getLastFinishedTrancheIndex(); GlobalGradual memory global = voSpool.getNotUpdatedGlobalGradual(); if (global.lastUpdatedTrancheIndex >= lastFinishedTrancheIndex) { return; } uint256 lastSetRewardTranche = voSpool...
11,662,430
/** *Submitted for verification at Etherscan.io on 2021-06-16 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, t...
Move the last element into the place to delete Remove the last element
function removeBalance(uint index) internal { fixedBalances[msg.sender][index] = fixedBalances[msg.sender][fixedBalances[msg.sender].length - 1]; fixedBalances[msg.sender].pop(); }
10,918,059
./full_match/1/0xEc7047602c10D95adCc4f62539529A26327eD0BD/sources/contracts/ConvexExecutor/Susd/ConvexPositionHandler.sol
To get total contract balances in terms of want token Gets lp token balance from contract, staked position on convex, and converts all of them to usdc. And gives balance as want token. useVirtualPrice to check if balances shoudl be based on virtual price return stakedLpBalance balance of staked LP tokens in terms of ...
function _getTotalBalancesInWantToken(bool useVirtualPrice) internal view returns ( uint256 stakedLpBalance, uint256 lpTokenBalance, uint256 usdcBalance ) { uint256 stakedLpBalanceRaw = baseRewardPool.balanceOf(address(this)); u...
4,966,571
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Context.sol"; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol"; import "https://github.com/OpenZeppelin/openzeppeli...
Adds fees and transfer amount in tokens to `values`. tXXXX stands for tokenXXXX More details can be found at comments for ValuesForAmount Struct./ calculate fee amount after fee
function _getTValues(ValuesFromAmount memory values, bool deductTransferFee) view private { if (deductTransferFee) { values.tTransferAmount = values.amount; values.tBurnFee = _calculateTax(values.amount, _taxBurn, _taxBurnDecimals); values.tRewardFee = _calculate...
916,822
./full_match/7700/0x6eA48824253f64662945Ae77A790331D7183f8c0/sources/project_/contracts/access/MaxAccess.sol
: Returns `true` if `account` has been granted `role`. role: Bytes4 of a role account: Address to check return: bool true/false if account has role
function hasRole( bytes4 role , address account ) external view virtual override returns (bool) { return _checkRole(role, account); }
4,661,765
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import { SignatureDrop } from "contracts/signature-drop/SignatureDrop.sol"; // Test imports import "./utils/BaseTest.sol"; import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; cont...
Test with native token currency
function testFail_reentrancy_mintWithSignature() public { vm.prank(deployerSigner); uint256 id = 0; SignatureDrop.MintRequest memory mintrequest; mintrequest.to = address(0); mintrequest.royaltyRecipient = address(2); mintrequest.royaltyBps = 0; mintrequest.p...
1,798,333
// SPDX-License-Identifier: Apache-2.0 /* * Copyright 2019-2020, Offchain Labs, Inc. * * 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 ...
[messageHash, prefixHash, messageDataHash] Get message out of proof L2_MSG END_OF_BLOCK_MESSAGE Between the checks in the if statement, inboxSeqNum, and messageHashes[1:], this constrains all fields without the full message hash. Start the proof at an arbitrary previous accumulator, as we validate the end accumulator. ...
function incrementInbox(AssertionContext memory context) private view returns (Value.Data memory message) { bytes memory proof = context.proof; bytes32[3] memory messageHashes; uint256 inboxSeqNum; Value.Data[] memory tupData = new Value.Data[](8); ...
485,436
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.5.0 <0.8.0; import '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol'; import '@uniswap/v3-periphery/contracts/libraries/OracleLibrary.sol'; import '../libraries/EnumerableSet.sol'; import '../interfaces/ITimeWeightedOracle.sol'; import '../utils/Governa...
Returns true if the value is in the set. O(1)./
function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); }
1,435,053
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the on...
Owner drains CELR tokens when the contract is paused emergency use only _amount drained CELR token amount/
function drainToken(uint256 _amount) external whenPaused onlyOwner { IERC20(staking.CELER_TOKEN()).safeTransfer(msg.sender, _amount); }
260,787
./full_match/11155111/0x802c9b112bc40c16a6B642a215AD79CC84BAB21C/sources/project_/contracts/ChallengeManager.sol
just for reuse purpose
function _createChallenge(Challenge calldata challenge) internal { require( challenge.start > block.timestamp, 'ChallangeManager: start in the past' ); require( challenge.end > challenge.start, 'ChallengeManager: end time before start time' ); require( challenge.end -...
3,806,200
./full_match/4/0xD6ee9785A54BFeb2bC9923DFA1E531c92c651F1c/sources/contracts/AuctionRaffle.sol
return A list of raffle winner bidder IDs.
function getRaffleWinners() external view returns (uint256[] memory) { return _raffleWinners; }
12,381,081
pragma solidity ^0.5.9; pragma experimental ABIEncoderV2; /* Copyright 2020 ZeroEx Intl. 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 ...
An overridable way to retrieve the Mooniswap registry address. return musd The Mooniswap registry address.
function _getMooniswapAddress() internal view returns (address registry) { return MOONISWAP_REGISTRY; }
178,323
pragma solidity ^0.4.0; contract ItemTracking { struct Item { uint id; address owner; uint[] components; bool exists; bool created; } mapping(uint => Item) items; modifier itemCreated(uint id) { if (items[id].created == false) { thro...
Return exists status of a given item
function getExistsStatus(uint id) itemCreated(id) constant returns (bool) { return items[id].exists; }
7,320,427
// SPDX-License-Identifier: MIT pragma solidity 0.8.3; import "./OracleGetter.sol"; import "./ERC20.sol"; import "./Inflation.sol"; import "hardhat/console.sol"; /** @author Tellor Inc. @title Chorus @dev Chorus is a structure for issuing semi-stablecoins as community currencies **/ // slither-disable-next-line m...
Function to reduce token price by the inflation rate, increases the total supply by the inflation rate and sends the new tokens to the inflation beneficiary./ slither-disable-next-line timestamp
function updateInflation() external { uint256 secsPassed = block.timestamp - inflLastUpdate; require(secsPassed > 0, "no inflation increase yet"); inflLastUpdate = block.timestamp; tknPrice = accrueInflation(tknPrice, inflRatePerSec, secsPassed); uint256 _tokensToMint = ...
6,418,388
pragma solidity ^0.5.12; import "./MixTokenInterface.sol"; import "./MixTokenItemRegistry.sol"; /** * @title MixTokenBurn * @author Jonathan Brown <jbrown@mix-blockchain.org> * @dev Enable accounts to burn their tokens. */ contract MixTokenBurn { /** * @dev Amount of tokens burned, linked to next most ...
Get the amount of tokens an account has burned for an item. account Address of the account. itemId Item to get the amount of tokens account has burned for it. return Amount of these tokens that this account has burned for the item./
function getAccountItemBurned(address account, bytes32 itemId) external view returns (uint) { return itemAccountBurned[itemId][account].amount; }
5,447,944
./partial_match/1/0x2Ad412A1dF96434Eed0779D2dB4A8694a06132f8/sources/src/WorldIDIdentityManagerImplV1.sol
Allows a caller to upgrade the stateBridge. Only the owner of the contract can call this function. newStateBridge The new stateBridge contract
function setStateBridge(IBridge newStateBridge) public virtual onlyProxy onlyInitialized onlyOwner { if (address(newStateBridge) == address(0)) { revert InvalidStateBridgeAddress(); } if (!_isStateBridgeEnabled) { enableSta...
4,373,984
./full_match/80001/0xcd72b349F939eEC44340166380cB31D05d3881f7/sources/contracts/Contract.sol
function to get random addresses based on area of interest and number of published papers here we are selecting 4 random reviewers.
function selectResearchers(address userSubAddress) public returns (address[] memory selectedAddresses) { CID memory selectForCID = submission[userSubAddress]; uint8 interestedLen = selectForCID.reviewerLen; for (uint256 i = 0; i < 1; i++) { ...
5,659,469
./partial_match/1/0x72AD58f0917deB04eC8b6AdA584ABd0dBe502128/sources/GStrategyGuard.sol
Execute stop loss for a given strategy
function executeStopLoss() external { if (!keepers[msg.sender]) revert GuardErrors.NotKeeper(); uint256 strategiesLength = strategies.length; address strategy; uint256 primerTimestamp; for (uint256 i; i < strategiesLength; i++) { strategy = strategies[i]; ...
3,586,991
./partial_match/1/0x55B65931FCa5868009CbDEb6eeb3a8ccE182B56e/sources/Wallet.sol
constructor - stores initial daily limit and records the present day's index.
function initDaylimit(uint _limit) only_uninitialized { m_dailyLimit = _limit; m_lastDay = today(); }
3,949,764
/** *Submitted for verification at Etherscan.io on 2021-11-08 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.3; interface IEthemerals { struct Meral { uint16 score; uint32 rewards; uint16 atk; uint16 def; uint16 spd; } function safeTransferFrom(address from, address to, uint256...
allows second token1 to revive token0 and take rewards returns token1 to owner/ GET CHANGE
function reviveToken(uint _id0, uint _id1) external { require(nftContract.ownerOf(_id0) == address(this), 'only staked'); require(nftContract.ownerOf(_id1) == msg.sender, 'only owner'); Stake storage _stake = stakes[_id0]; uint priceEnd = uint(priceFeed.getLatestPrice(_stake.priceFeedId)); IEthemera...
8,017,808
pragma solidity >= 0.5.0; import "./IF_EAO.sol"; import "./IF_EAS_roll.sol"; import "./IF_EAS_artworks.sol"; import "./IF_EAS_types.sol"; import "./IF_EAS.sol"; import "./IF_EAS_platform.sol"; import "./IF_EAM.sol"; import "./SafeMath.sol"; import "./Ownable.sol"; import "./strings.sol"; contract EA...
get 2 RNs from wolfram alpha, msg.sender == EAO
function __callback_PlayRoll(bytes32 queryId, string calldata result) external platform{
12,881,103
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.6; //Uniqly FanadisePresale contract contract FanadisePresale19 { // presale target - close contract when passed uint256 public immutable presaleLimit; // minimum pay-in per user uint256 public immutable minPerUser; // maximum pay-in per u...
ERC20 functions for fallback tokens recovery can not 'returns (bool success);' because of USDT and other tokens that not follow ERC20 spec fully.
interface IERC20 { function balanceOf(address _owner) external returns (uint256 balance); function transfer(address _to, uint256 _value) external; }
169,186
pragma solidity ^0.4.24; /** * @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; } uint25...
Return the address of a blocks owner./
function getUserPair( address _user ) public view returns (address, string) { return ( _user, addressToHandle[_user] ); }
2,405,932
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the on...
Add an account to whitelist/
function addWhitelisted(address account) external onlyOwner { require(!isWhitelisted(account), "Already whitelisted"); whitelist[account] = true; emit WhitelistedAdded(account); }
260,790
./partial_match/4/0x6b0787A77c11458EF87Bd733a63BBC11980d285D/sources/OroNetwork.sol
Swap Get Asset with USDC/
function swapIn(address assetAdd, uint256 value) external whenNotPaused validateAsset(assetAdd) { _swapIn(assetAdd, value); }
8,638,020
./partial_match/1/0x10CDa2E6C785c8D8098D792045311d1f14Dc9aF3/sources/contracts/strategies/concentrated-liquidity/BaseConcentratedLiquidityStrategy.sol
1. Withdraw all liquidity 2. Deal with lefovers in vault asset first 5. Swap to match target state
function _readdLiquidity() internal virtual { _decreaseLiquidity(getPositionData().liquidity); _collectAllAndBurn(); uint256 amountFor0; uint256 amountFor1; if ((asset() != token0()) && (asset() != token1())) { uint256 assetAmount = IERC20(asset()).balanceOf(addr...
15,530,966
./full_match/97/0x399C85c91Ad7Cdea4B9f8bd435EC2e1d03888801/sources/contracts/lib/_harvest-finance/HardRewards.sol
Transfers tokens for the new rewards cycle. Allows for changing the rewards setting at the same time./
function load(address _token, uint256 _rate, uint256 _amount) external onlyGovernance { token = IBEP20(_token); blockReward = _rate; if (address(token) != address(0) && _amount > 0) { token.safeTransferFrom(msg.sender, address(this), _amount); } }
3,283,876
pragma solidity ^0.4.15; /** * GoldGate Token Contract * Copyright © 2017 by GoldGate https://goldgate.io */ /** * @title ERC20Basic * Simpler version of ERC20 interface * https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { uint256 public totalSupply; function balanceOf(address ...
called by the owner to pause, triggers stopped state/
function pause() onlyOwner whenNotPaused { paused = true; Pause(); }
1,814,665
// contracts/CampaignFactoryLib.sol // SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; import "../../campaign/Campaign.sol"; import "../../interfaces/ICampaignFactory.sol"; library CampaignFactoryLib { /** * @dev Returns if caller can manage campaigns * @param _factory Camp...
Returns information on a campaign from the factory _factory Campaign factory interface _campaign Address of the campaign/
function campaignInfo(ICampaignFactory _factory, Campaign _campaign) internal view returns (uint256, bool) { uint256 campaignCategory; bool privateCampaign; (, , , campaignCategory, , , privateCampaign) = _factory.campaigns( _campaign ); ...
13,107,287
pragma solidity ^0.5.0; // It's important to avoid vulnerabilities due to numeric overflow bugs // OpenZeppelin's SafeMath library, when used correctly, protects agains // such bugs // More info: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/ // 2018/november/smart-contract-insecurity-bad-arithmetic/...
Transfers eligible payout funds to insuree/
function payout(address airline, string calldata flight, uint256 timestamp) external whenNotPaused { require(data.isAirlineExist(airline), "Airline is not exist"); require(data.isAirlineRegistered(airline), "Airline is not registered"); require(data.isAirlineFunded(airlin...
14,037,644
./partial_match/4/0x95E6FcEDE6bFfb9ec5bE1e2EF5555F7a43B09CC2/sources/contracts/avalanche/Avalanche.sol
isActive = active; info[0] = IPWDR(pwdrAddress).balanceOf(address(this)); info[1] = initialPwdrReward; info[2] = totalPendingPwdr; info[3] = startTime; info[4] = lastPayout; info[5] = totalStaked; info[6] = IPWDR(pwdrAddress).balanceOf(_user); if (ISlopes(slopesAddress).pwdrPoolActive()) { info[7] = IERC20(pwdrPool...
function getAllInfoFor(address _user) external override view returns ( bool isActive, uint256[12] memory info ) { }
8,565,869
pragma solidity ^0.5.0; import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol"; /** * @title Game * @dev Library for managing game state. */ library Game { using SafeMath for uint256; struct State { mapping (address => uint256) balance; mapping (address => bytes32) h...
gets the account's balance/
function _getBalance(State storage state, address account) internal view returns (uint256) { return state.balance[account]; }
5,399,317
./full_match/42220/0x36C94d5e38c377dD5CAEf83032df12fB5560c63D/sources/contracts/seed/Seed.sol
/ Calculate tip Add default class Add allowlist to the default class
function initialize( address _beneficiary, address _admin, address[] memory _tokens, uint256[] memory _softAndHardCap, uint256 _price, uint256[] memory _startTimeAndEndTime, uint256[] memory _defaultClassParameters, bool _permissionedSeed, addr...
16,326,411
pragma solidity ^0.5.0; pragma experimental ABIEncoderV2; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "../event/EventEmitter.sol"; import "../treasury/Treasury.sol"; import "../voting/Voting.sol"; /** @title ValidatorRegistry @...
/Load listingChallenge pending and accepted listings. -- More valid status may be added.Ensure earns and burns are up to date return if a touch and remove was executedCreate challengePull tokens out of the treasuryInitialize challenge.Update the listingIncrement challengeIdEmit challenged event
function challengeListing(bytes32 tendermintPublicKey, string memory details) public { Listing storage listing = _listings[tendermintPublicKey]; require(listing.status == Status.PENDING || listing.status == Status.ACCEPTED || listing.status == Status.EXITING, "listing is not pending, accepted or ex...
13,030,683
./full_match/80001/0x6d8787EA487Eb99633435E3ece87aD158c92D538/sources/Token.sol
Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {BEP20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have a...
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve( _msgSender(), spender, _allowances[_msgSender()][spender].sub( subtractedValue, 'BEP20: decreased allowance below zero' ) ); return true; }
5,602,694
// SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity 0.6.12; import "./PoolTokensContainer.sol"; import "./LiquidityPoolV2ConverterCustomFactory.sol"; import "../../LiquidityPoolConverter.sol"; import "../../interfaces/IConverterFactory.sol"; import "../../../utility/interfaces/IPriceOracle.sol"; ...
returns the fee amount for a given target amount _sourceToken contract address of the source reserve token _targetToken contract address of the target reserve token _sourceWeight source reserve token weight _targetWeight target reserve token weight _externalRate ...
function calculateFee( IERC20Token _sourceToken, IERC20Token _targetToken, uint32 _sourceWeight, uint32 _targetWeight, Fraction memory _externalRate, uint32 _targetExternalWeight, uint256 _targetAmount) internal view returns (uint256) { Fra...
1,066,812
./partial_match/56/0x953bA648e3b57ab7100C848C5ed77860A71b664f/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,221,204
// SPDX-License-Identifier: MIT pragma solidity 0.8.0; /** * @dev Interface for Vesper Pool. */ interface IVPool { function getPricePerShare() external view returns (uint256); function deposit(uint256 _amount) external; function withdraw(uint256 _shares) external; }
Interface for Vesper Pool./
interface IVPool { function getPricePerShare() external view returns (uint256); function deposit(uint256 _amount) external; function withdraw(uint256 _shares) external; pragma solidity 0.8.0; }
969,320
./full_match/1/0xC0786c7f22422917bdf778Fe4ABA7F131031cD34/sources/contracts/Token.sol
return true if the purchaser is allowed to buy tokens
function validPurchase() internal returns (bool) { bool nonZeroPurchase = msg.value != 0; bool withinBalance = msg.value < token.balanceOf(address(this)); return withinBalance && nonZeroPurchase; }
16,394,051
./full_match/1/0x82189Be9CF7A7288C9063B48815493586AaDBC34/sources/Naijatoken_flat.sol
Remove from Blacklist
function removeFromBlackList(address account) external onlyOwner { _isBlacklisted[account] = false; }
3,184,395
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; import "library.sol"; contract PausablePool is Context{ /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpau...
adjust sigma manually/
function adjustSigma(uint16 newSigma) external override onlyOwner { require (newSigma % 5 == 0, "needs 5*N"); require (newSigma >= 15 && newSigma <= 145, "[15,145]"); sigma = newSigma; }
12,715,324
// SPDX-License-Identifier: MIT // https://kanon.art - K21 // https://daemonica.io // // // [email protected]@@@@@@@@@@$$$ // [email protected]@@@@@$$$$$$$$$$$$$$## // $$$$$$$$$$$$$$$$$#########*** // $$$$$...
Converts uint256 to a string value The uint256 value return A string that represents the numerical value of the input/ Inspired by OraclizeAPI's implementation - MIT license https:github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
function toString(uint256 value) public pure returns (string memory) { if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value ...
15,366,480
./full_match/5/0xBDF8576aACBFE7a3078922CA034Ca6eF604dEb37/sources/StolenMemes.sol
time after transfer before tokens can be stolen
function setParameters( uint256 _timeFromTransfer, uint256 _timeFromExpose, uint256 _stealCooldown ) external onlyOwner { require( _timeFromTransfer >= 3600, "_timeFromTransfer must be more than an hour" ); require( _timeFromEx...
1,930,238
./full_match/80001/0x1c876cb54092e78F02AAf390Ab005DC24AcE6426/sources/C/Users/guill/github/witnet/witnet-solidity-bridge/contracts/interfaces/IERC20.sol
Interface of the ERC20 standard as defined in the EIP./
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address _account) external view returns (uint256); function transfer(address _recipient, uint256 _amount) external returns (bool); function allowance(address _owner, address _spender) external view returns (...
9,536,292
pragma solidity 0.5.4; library safemath3 { //inject NONSTANDARD NAMING uint256 constant internal max_uint25 = 2 ** 256 - 1; // max uint256 //inject NONSTANDARD NAMING function MUL14(uint256 _a, uint256 _b) internal pure returns(uint256...
inject NONSTANDARD NAMING
function BURN76(uint256 value) public {
974,742
/* * This code has not been reviewed. * Do not use or deploy this code before reviewing it personally first. */ pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import ...
Set asset value rules for a given asset. assetAddress Address of the token representing the asset. assetClass Asset class. assetValueType Asset value type. assetValue Asset value. reverseAssetValue Reverse asset value./
function setAssetValueRules( address assetAddress, bytes32 assetClass, AssetValue assetValueType, uint256 assetValue, uint256 reverseAssetValue ) external onlyPriceOracle(assetAddress) { AssetRules storage rules = _assetRules[assetAddress][assetClass]; require(rules.defined, "...
5,531,026