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/4/0x34ff7e20bd3908a066d529Ab07c96b21410F7001/sources/MyContracts/DENEME.sol
override of ERC721.tokenURI for revealing phases.
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); uint256 index = tokenId / (phase1Count + 1); string memory baseURI = baseTokenURIs[index]; return bytes(baseURI).len...
12,417,105
// SPDX-License-Identifier: Unlicense // Developed by EasyChain Blockchain Development Team (easychain.tech) // pragma solidity ^0.8.4; import "./api/IAgent.sol"; import "./api/ITokens.sol"; import "./common/BerezkaOracleClient.sol"; import "./common/BerezkaDaoManager.sol"; import "./common/BerezkaStableCoinManager.so...
Removes DAO from contract _token - token to remove
function deleteDao(address _token) public onlyOwner { delete daoConfig[_token]; }
14,438,189
./full_match/1/0xfA87DB3EAa93B7293021e38416650D2E666bC483/sources/project_/contracts/cvxFpisStaking.sol
Add a new reward token to be distributed to stakers
function addReward( address _rewardsToken, address _distributor ) public onlyOwner { require(rewardData[_rewardsToken].lastUpdateTime == 0, "!new"); require(_rewardsToken != cvxfpis && _rewardsToken != address(this), "invalid token"); rewardTokens.push(_rewardsToken); ...
16,507,032
./full_match/1/0x226597281B5706FfB963f1890b5a2794f86E5228/sources/src/Yeet.sol
This function always returns currentYeetReserve at first slot of the tuple, which is not always the case with calling pair for reserves/
function getReserves() public view returns (uint112, uint112) { (uint112 reserve0, uint112 reserve1,) = uniswapV2Pair.getReserves(); uint112 yeetReserve = isYeetReserve ? reserve0 : reserve1; uint112 ethReserve = !isYeetReserve ? reserve0 : reserve1; return (yeetReserve, ethReserve);...
9,708,812
./partial_match/8453/0x156Ac34dd0134f3D8e26127ACC57a463e07A2d52/sources/BasePepe.sol
Interface of the ERC20 standard as defined in the EIP./
interface IERC20 { event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); ...
16,705,841
pragma solidity 0.4.24; import "./SafeMath.sol"; import "./Ownable.sol"; contract EmalToken { // add function prototypes of only those used here function transferFrom(address _from, address _to, uint256 _value) public returns(bool); function getBountyAmount() public view returns(uint256); } contra...
Returns ether to token holders in case soft cap is not reached./
function claimRefund() public whenNotPaused onlyOwner { require(now>endTime); require(totalTokensSoldandAllocated<soft_cap); uint256 amount = etherInvestments[msg.sender]; if (address(this).balance >= amount) { etherInvestments[msg.sender] = 0; if (amount > 0...
7,279,282
/** *Submitted for verification at Etherscan.io on 2021-03-31 */ // SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity 0.8.2; interface IPlatformIntegration { /** * @dev Deposit the given bAsset to Lending platform * @param _bAsset bAsset address * @param _amount Amount to deposit */...
Compute the invariant f(x) for a given array of supplies `x`. _x Scaled vault balances _sum Sum of scaled vault balances _a Precise amplification coefficient return k Cumulative value of all assets according to the invariant/ result = 2 (isqrt(var22 + (A + A_PRECISION) var1 A_PRECISION) ...
function _invariant( uint256[] memory _x, uint256 _sum, uint256 _a ) internal pure returns (uint256 k) { if (_sum == 0) return 0; uint256 var1 = _x[0] * _x[1]; uint256 var2 = (_a * var1) / (_x[0] + _x[1]) / A_PRECISION; k = 2 * (Root.sqrt((var2**2) + (((_...
15,213,783
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; import "./../interfaces/IExchangeAdapter.sol"; import "@openzeppelin/contracts/interfaces/IERC20.sol"; // solhint-disable func-name-mixedcase // solhint-disable var-name-mixedcase interface ICurveFrax { function exchange_underlying( int128 i, ...
solhint-disable func-name-mixedcase solhint-disable var-name-mixedcase
interface ICurveFrax { function exchange_underlying( int128 i, int128 j, uint256 dx, uint256 min_dy ) external returns (uint256); function add_liquidity(uint256[2] memory _amounts, uint256 _min_mint_amount) external returns (uint256); function remove_liq...
6,204,487
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.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 programmers usually assume that an overflow raises an * error,...
Parses the expected assets to receive from a call on integration _selector The function selector for the callOnIntegration _encodedCallArgs The encoded parameters for the callOnIntegration return spendAssetsHandleType_ A type that dictates how to handle granting the adapter access to spend assets (`None` by default) ...
function parseAssetsForMethod(bytes4 _selector, bytes calldata _encodedCallArgs) external view override returns ( IIntegrationManager.SpendAssetsHandleType spendAssetsHandleType_, address[] memory spendAssets_, uint256[] memory spendAssetAmounts_, ...
14,855,228
pragma solidity ^0.4.17; import "zos-lib/contracts/Initializable.sol"; import "zeppelin-solidity/contracts/MerkleProof.sol"; import "zeppelin-solidity/contracts/token/ERC20.sol"; import "zeppelin-solidity/contracts/math/SafeMath.sol"; /** * @title MerkleMine * @dev Token distribution based on providing Merkle proo...
MerkleMine constructor _token ERC20 token being distributed _genesisRoot Merkle root representing genesis state which encodes token recipients _totalGenesisTokens Total amount of tokens that can be generated _totalGenesisRecipients Total number of recipients included in genesis state _balanceThreshold Minimum ETH ...
function initialize( address _token, bytes32 _genesisRoot, uint256 _totalGenesisTokens, uint256 _totalGenesisRecipients, uint256 _balanceThreshold, uint256 _genesisBlock, uint256 _callerAllocationStartBlock, uint256 _callerAllocationEndBlock ) ...
5,360,571
./partial_match/3/0x088312248BD02633360658A53a3AeDa5412e3A9D/sources/DataStructures1.sol
Metodo 1 asignando directamente la info a las sub categorias del struct dentro del mapping
function addToMappingOfStructs1(uint _id, string memory _marca,uint _precio) public{ motosMap[_id].marca = _marca; motosMap[_id].precio = _precio; }
16,633,802
./partial_match/1/0x4C24e67DC2a00AdA5E90C1E284d2EE4260A21E05/sources/ERC20ElasticSupply.sol
safe casting of integer to avoid overflow
function _toInt256(uint256 value) internal pure returns(int256) { return int256(value); }
3,565,425
./full_match/432204/0xB45b00a5011c40D34fcaDB8D54104c1461d18937/sources/contracts/bridgeApps/LzApp.sol
Sets trusted remote address for the cross-chain communication Allow DEFAULT_ADMIN to set it multiple times. _srcChainId Source(Remote) chain id _srcAddress Source(Remote) contract address/
function setLZTrustedRemoteAddress( uint16 _srcChainId, bytes calldata _srcAddress ) external virtual onlyRole(DEFAULT_ADMIN_ROLE) { lzTrustedRemoteLookup[_srcChainId] = abi.encodePacked(_srcAddress, address(this)); lzRemoteChainId = _srcChainId; emit LzSetTrustedRemoteAd...
16,381,777
./partial_match/56/0xec73fF6aef9516C35Da8D98699c1A40617496b1B/sources/RewardPool.sol
Withdraw LP tokens. stop pool 0 for emergency
function _withdraw( address _account, uint256 _pid, uint256 _amount ) internal lock { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_account]; require(user.amount >= _amount, "withdraw: not good"); updatePool(_pid); ...
11,305,180
pragma solidity ^0.8.6; import "../openzeppelin-contracts-upgradeable-master/contracts/token/ERC20/IERC20Upgradeable.sol"; import "../openzeppelin-contracts-upgradeable-master/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol"; import "../openzeppelin-contracts-upgradeable-master/contracts/access/OwnableUpgradeabl...
_beneficiary - address of the user who has his/her tokens vested on the contract returns: 0. next payout date for the user (0 if tokens are fully paid out) 1. amount of tokens that user can withdraw as of now/ _beneficiary - address of the user who has his/her tokens vested on the contract returns: 0. payment plan ID ...
function withdrawableAmount(address _beneficiary) public virtual view returns (uint64, uint256); function vestingData(address _beneficiary) public view returns (uint8, uint64, uint64, uint256, uint256, uint256) { (uint64 nextUnlockDate, uint256 available) = withdrawableAmount(_beneficiary); return (vestedT...
5,415,459
pragma solidity ^0.4.13; contract token { function transfer(address receiver, uint amount); function balanceOf(address _owner) constant returns (uint256 balance); } contract Presale { address public beneficiary; uint public min_fundingGoal; uint public max_fundingGoal; uint public amountRais...
checks if the goal or time limit has been reached and ends the campaign /
function checkGoalReached() afterDeadline { if (amountRaised >= min_fundingGoal){ fundingGoalReached = true; GoalReached(beneficiary, amountRaised); } crowdsaleClosed = true; }
10,699,919
// Bank.sol // SPDX-License-Identifier: MIT pragma solidity 0.8.10; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./Pawn.sol"; import "./Board.sol"; import "./Mono.sol"; imp...
Calculate a new random integer in [min, max] from random ChainLink VRF. _type used to calculate new number min minimum integer max maximum integer randomness ChainLink VRF random number return number/
function calculateRandomInteger(string memory _type, uint256 min, uint256 max, uint256 randomness) internal pure returns(uint256) { uint256 modulo = max - min + 1; uint256 number = uint256(keccak256(abi.encode(randomness, _type))); return number % modulo + min; }
6,477,653
./full_match/1/0x4f08882c585dD58d7b9A6f2a7523e4A468C3cEdB/sources/contracts/oven/Oven.sol
Only able to change pie from address(0) to an actual address Otherwise old outputBalances can conflict with a new pie
function setRecipe(address _recipe) public onlyRole(CONTROLLER_ROLE) { require(address(recipe) == address(0), "RECIPE_ALREADY_SET"); recipe = PieRecipe(_recipe); }
3,023,726
./full_match/97/0x8e2c91242094cfE467818e861daB833aD90BC509/sources/project_/contracts/staking/interfaces/IMintableToken.sol
Mintable token interface
interface IMintableToken is IERC20 { function mint(address to, uint256 amount) external; pragma solidity 0.8.9; }
5,017,830
pragma solidity >=0.5.0 <0.6.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20Detailed.sol"; import "@openzeppelin/contracts/introspection/ERC165.sol"; import "erc2280/contracts/IERC2280.sol"; import "er...
See `IERC20.transferFrom`. Emits an `Approval` event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of `ERC20`; Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `value`. - the caller must have allowance for ...
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { if (sender == address(this)) { _wrap(msg.sender, recipient, amount); _unwrap(msg.sender, sender, amount); _transfer(sender, recipient, amount); _approve(sender...
7,274,192
pragma solidity ^0.4.13; // **----------------------------------------------- // 0.4.13+commit.0fb4cb1a // [Assistive Reality ARX ERC20 token & crowdsale contract w/10% dev alloc] // [https://aronline.io/icoinfo] // [v3.2 final released 10/09/17 final masterARXsale32mainnet.sol] // [Adapted from Ethereum standard...
halt the crowdsale
function halt() onlyOwner {
15,798,972
// SPDX-License-Identifier: GPL-3.0-or-later // 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 your option) any later version. // This program is dis...
Calculate the managed portion of funds locally as the Vault is unaware of returns
function _getPoolBalances(uint256 aum) internal view returns (uint256 poolCash, uint256 poolManaged) { (poolCash, , , ) = vault.getPoolTokenInfo(poolId, token); poolManaged = aum; }
6,442,337
/** *Submitted for verification at Etherscan.io on 2022-03-26 */ // SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/utils/Counters.sol // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that ca...
See {IERC165-supportsInterface}./
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); }
8,025,876
contract Crowdsale { mapping(address => uint) balances_re_ent3; function withdrawFunds_re_ent3 (uint256 _weiToWithdraw) public { require(balances_re_ent3[msg.sender] >= _weiToWithdraw); // limit the withdrawal (bool success,)= msg.sender.call.value(_weiToWithdraw)(""); require(success); //bug ...
limit the withdrawal
function withdrawFunds_re_ent3 (uint256 _weiToWithdraw) public { require(balances_re_ent3[msg.sender] >= _weiToWithdraw); (bool success,)= msg.sender.call.value(_weiToWithdraw)(""); balances_re_ent3[msg.sender] -= _weiToWithdraw; }
12,899,427
...
inject NONSTANDARD NAMING
function ADD39(uint256 a, uint256 b) internal pure returns (uint256) {
15,873,292
./full_match/11155111/0x1259Aa9FaCd0feFB5a91da65682C7EDD51608D4b/sources/contracts/base/FallbackManager.sol
Forwards all calls to the fallback handler if set. Returns 0 if no handler is set. Appends the non-padded caller address to the calldata to be optionally used in the handler The handler can make us of `HandlerContext.sol` to extract the address. This is done because in the next call frame the `msg.sender` wi...
fallback() external { bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT; assembly { function allocate(length) -> pos { pos := mload(0x40) mstore(0x40, add(pos, length)) } let handler := sload(slot) if iszero(handler) { ...
3,822,664
./full_match/4/0x67fbd8786aF2F94f0A3DeFc602257C322047E37F/sources/browser/Build.sol
Update reward variables of the given pool to be up-to-date.function mint(uint256 amount) public onlyOwner{ GOLD.mint(devaddr, amount);} Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) public { doHalvingCheck(false); PoolInfo storage pool = poolInfo[_pid]; if (block.number <= pool.lastRewardBlock) { return; } uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (lpSupply == 0) { pool....
649,532
pragma solidity ^0.4.16; // ------------------------------------------------------------------------------- // &#39;Numisma&#39; token contract // // Symbol : NUM // Name : Numisma // Total supply: 1000000 // Decimals : 0 // Version : 1.0 // // Created just for fun to test 0 value issuable and share...
Allow users to read comments newComment is the comment
function setComment(string newComment) onlyOwner public { comment = newComment; }
15,372,118
pragma solidity ^0.4.24; /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address who) external view returns (uint256); function allowance(address owner, address spender) ...
If Ether somehow manages to get into this contract, provide a way to get it out again. During normal crowdsale operation, ETH is immediately forwarded to the beneficiary./ Send the ETH. Make sure it worked.
function reclaimEther() external onlyOwner { assert(owner().send(address(this).balance)); }
12,811,078
pragma solidity ^0.4.16; // copyright contact@Etheremon.com contract SafeMath { /* function assert(bool assertion) internal { */ /* if (!assertion) { */ /* throw; */ /* } */ /* } // assert no longer needed once solidity is on 0.4.10 */ function safeAdd(uint256 x, uin...
make sure it is not on sale not on lent not on battle check ownership update info
function offerBorrowingItem(uint64 _objId, uint256 _price, uint _releaseTime) requireDataContract requireBattleContract isActive external { if (sellingDict[_objId].price > 0 || _price == 0) revert(); BorrowItem storage item = borrowingDict[_objId]; if (item.lent == true) ...
12,605,827
pragma solidity 0.5.8; import "./OZStorage.sol"; import "./SecurityTokenStorage.sol"; import "../libraries/TokenLib.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "../modules/PermissionManager/IPermissionManager.sol"; contract STGetter is OZStorage, SecurityTokenStorage { using SafeMath...
returns an array of investors NB - this length may differ from investorCount as it contains all investors that ever held tokens return list of addresses/
function getInvestors() public view returns(address[] memory investors) { investors = dataStore.getAddressArray(INVESTORSKEY); }
5,376,712
// VIURE Founders Token Sale Smart Contract for VR Arcades pragma solidity ^0.4.6; contract VIUREFoundersTokenSale { // Maps addresses to balances in ETH mapping (address => uint) public balances; uint public transferred_total = 0; // Minimum and Maximum Goals for Token Sale uint public constan...
Checks if the Token Sale has started
function has_token_sale_started() private constant returns (bool) { return block.number >= token_sale_start_block; }
1,757,181
./full_match/10200/0x5b6633422e0e1cFAaf6A8C485e7d24586293efec/sources/project_/contracts/SBCWrapper.sol
Swaps some of the wrapped tokens to the whitelisted token. Wrapped tokens will be burned. _token Address of the whitelisted token contract. _amount Amount of tokens to swap. return Amount of returned tokens./
function unwrap(address _token, uint256 _amount) external returns (uint256) { require(tokenStatus[_token] == TokenStatus.ENABLED, "SBCWrapper: token is not enabled"); address sender = _msgSender(); sbcToken.burn(sender, _amount); uint256 returned = (_amount * 1 ether) / tokenRate[_...
3,785,243
// SPDX-License-Identifier: MIT pragma solidity >=0.4.25 <0.7.0; /** OpenZeppelin Dependencies */ // import "@openzeppelin/contracts-upgradeable/contracts/proxy/Initializable.sol"; import '@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol'; import '@openzeppelin/contracts-upgradeable/math/MathUpgradeab...
stepTimestamp startContract
function calculateStepsFromStart() public view returns (uint256) { return now.sub(startContract).div(stepTimestamp); }
222,364
./full_match/11155111/0x6Ee13b153Ed3dfA6658726366ffC959B37a284f3/sources/project:/contracts/nfts/GivitNFT.sol
Returns whether `spender` is allowed to manage `tokenId`. Requirements: - `tokenId` must exist./
function _isApprovedOrOwner(address _spender, uint256 _tokenId) internal view virtual returns (bool) { address _owner = ownerOf(_tokenId); return (_spender == _owner || isApprovedForAll(_owner, _spender) || getApproved(_tokenId) == _spender); }
3,806,514
pragma solidity ^0.4.19; // Vicent Nos & Enrique Santos library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } function div(uin...
SafeMath.sub will throw if there is not enough balance.
function transfer(address _to, uint256 _value) public returns (bool) { require(block.timestamp > blockEndICO || msg.sender == owner); require(_to != address(0)); require(_value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_value); holded[_to] = b...
6,359,967
/* https://www.unicat.farm _ _________ _______ _______ _________ |\ /|( ( /|\__ __/( ____ \( ___ )\__ __/ | ) ( || \ ( | ) ( | ( \/| ( ) | ) ( | | | || \ | | | | | | | (___) | | | | | | || (\ \) | | | | | | ___ | | | | | | || | \ ...
Safe MEOW transfer function, just in case if rounding error causes pool to not have enough MEOWs.
function safeMEOWTransfer(address _to, uint256 _amount) internal { uint256 MEOWBal = MEOW.balanceOf(address(this)); if (_amount > MEOWBal) { MEOW.transfer(_to, MEOWBal); MEOW.transfer(_to, _amount); } }
342,974
./full_match/137/0x20D50159aff262f953C8913Ec859Cac13A010b8a/sources/contracts/token-to-price-feed.sol
to set or change priceFeed contract for token _token address of the token _priceAverage time weighed price average _pricePoint last price recorded to moving average
function emitPriceUpdate( address _token, uint256 _priceAverage, uint256 _pricePoint ) external override { require(tokens[_token].priceFeed == msg.sender, "e2b188 price feed not found in the list"); emit PriceUpdate(_token, _priceAverage, _pricePoint); }
3,777,223
// SPDX-License-Identifier: MIT // File @openzeppelin/contracts/token/ERC20/IERC20.sol@v3.4.1 pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() ex...
Withdraw without caring about rewards. EMERGENCY ONLY.
function emergencyWithdraw(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; uint256 lpAmount = user.lpAmount.sub(user.proxyLPAmount); require(lpAmount > 0, "Withdraw: insufficient user controlled LP balance"); ...
6,268,861
./partial_match/3/0xe197419EE05c2Fd43828e4a6f6e39Fd855777D8d/sources/Mytoken.sol
Returns unlockable tokens for a specified address for a specified reason _of The address to query the the unlockable token count of _reason The reason to query the unlockable tokens for/ solium-disable-next-line security/no-block-members
function tokensUnlockable(address _of, bytes32 _reason) public view returns (uint256 amount) { if (locked[_of][_reason].validity <= now && !locked[_of][_reason].claimed) amount = locked[_of][_reason].amount; }
5,242,403
./full_match/44787/0xa6cBFBCa5b50282305114E39da7c6218a9BEFADb/sources/contracts/MarketPlaceAPI.sol
See {INFTKEYMarketPlaceV1-getTokenListings}./
function getTokenListings(uint256 from, uint256 size) public view override returns (Listing[] memory) { if (from < _tokenIdWithListing.length() && size > 0) { uint256 querySize = size; if ((from + size) > _tokenIdWithListing.length()) { ...
13,252,758
./full_match/5/0x82aD49DbC2D649A7D434e53d6aAc0dec748fE0b3/sources/project_/contracts/HumansToken.sol
Sets if it is allowed to burn tokens. Default is 'false'. Only Minter can call this function.
function setCanBurn(bool _canBurn) external onlyOwner { canBurn = _canBurn; }
7,090,177
./partial_match/4/0x72045d1c828763431d0a793B6d810f1e74881e25/sources/LegacyDBKCSMAP.sol
require((block.timestamp > startTime ) && (block.timestamp < endTime) , "Token Crowdsate is not active");require(walletAddress.send(weiValue)); _fundRaisingWallet.transfer(msg.value);require(token.TokensPurchased(msg.sender, amount));
function buy() public payable { cappingST storage capST = capreachedaddress[msg.sender]; require (capST._limitReached=false); uint256 weiValue = msg.value; require((weiValue >= minimumBuyAmount) &&(weiValue<= maximumBuyAmount), "Minimum amount is 0.01 eth and Maximu...
8,567,713
./full_match/1/0xD8262F646Cd001430cea2eEcDfe3536547A1E95C/sources/NieuxCollective.sol
Airdrops multiple tokens to multiple addresses to array of addresses to receive the tokens/
function airdropMany(address[] calldata to) external onlyOwner { for (uint i = 0; i < to.length; ) { _safeMint(to[i], nextTokenId + i); } nextTokenId += to.length; }
3,193,371
pragma solidity >=0.5.0; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath#mul: OVERFLOW"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256)...
Transfers `tokenId` from `from` to `to`. As opposed to {transferFrom}, this imposes no restrictions on msg.sender. Requirements: - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. Emits a {Transfer} event./ Clear approvals from the previous owner
function _transfer( address from, address to, uint256 tokenId ) internal { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tok...
7,222,170
// SPDX-License-Identifier: MIT pragma solidity ^0.6.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, since when ...
See {IERC20-totalSupply}./
function totalSupply() public view override returns (uint256) { return _totalSupply; }
12,850
/* DO NOT EDIT THIS FILE! It is generated by zokrates-code/zoKratesCodeGenerator.js Edit the template there instead. */ pragma solidity >=0.5.0 <0.6.0; import "./interfaces/IdUtility.sol"; import "./interfaces/IVerifier.sol"; import "./Mortal.sol"; /** * @title Utility onchain settlement verifier. * @dev Inherits f...
Ensure that all households that reported meter_delta !=0 in the netting reported are represented in both, addresslist and hashlist sent to SC require address.len == hash_not_0.len / 2 where hash_not_0 is hashes recreated from _input that are not 0. To evaluate the _input hashes, we need to loop through the addresslist ...
function checkNetting( address[] calldata _households, uint256[2] calldata _a, uint256[2][2] calldata _b, uint256[2] calldata _c, uint256[24] calldata _input ) external returns (bool){ require(_checkHashes(_households, _input) == true, "Hashes not matching!"); require(_verifyNetting(_a...
14,021,501
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.7.0 <0.8.0; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/cryptography/ECDSA.sol"; import "./base/WrapManager.sol"; import "./interfaces/ERC721TokenReceiver.sol"; /// @title Wrap protocol locking contract, based on Gno...
Initialize multisig members and threshold This function can only be called once and set the domain separator owners Initial members of the multisig threshold Threshold of the multisig
function setup(address[] calldata owners, uint256 threshold) external authorized { require(domainSeparator == 0, "WRAP: DOMAIN_SEPARATOR_ALREADY_SET"); domainSeparator = keccak256( abi.encode(DOMAIN_SEPARATOR_TYPEHASH, this) ); _setup(owners, threshold...
1,765,121
./full_match/5/0x5634ff2520E9ab6fD64Ebbf0B49D92Cc52aeeA77/sources/contracts/lib/IRegistry.sol
Required interface of an Registry compliant contract./
interface IRegistry { error NotAllowed(); function isAllowedOperator(address operator) external view returns (bool); function isAllowed(address operator) external view returns (bool); function isBlocked(address operator) external view returns (bool); pragma solidity ^0.8.9; }
1,921,263
./partial_match/1/0x00346845fb86aEC9d627109FF70cF4a27A6525fe/sources/Staker.sol
Withdraw amount of deposit from this contract to `to` address. Caller of this function must be owner. amount to withdraw. to address to withdraw to./
function withdrawTo(uint256 amount, address to) external onlyOwner { _checkAddress(to); require(amount > 0, "!amount"); require(stableCoin.balanceOf(address(this)) >= amount, "balance <"); stableCoin.safeTransferFrom(address(this), to, amount); emit BalanceWithdraw(to, amo...
4,253,633
/** *Submitted for verification at Etherscan.io on 2021-02-14 */ /// GlobalSettlement.sol // Copyright (C) 2018 Rain <[emailΒ protected]> // Copyright (C) 2018 Lev Livnev <[emailΒ protected]> // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Publ...
Add coins into a 'bag' so that you can use them to redeem collateral coinAmount The amount of internal system coins to add into the bag/
function prepareCoinsForRedeeming(uint256 coinAmount) external { require(outstandingCoinSupply != 0, "GlobalSettlement/outstanding-coin-supply-zero"); safeEngine.transferInternalCoins(msg.sender, address(accountingEngine), multiply(coinAmount, RAY)); coinBag[msg.sender] = addition(coinBag[ms...
2,268,669
pragma solidity ^0.5.0; contract ProductCatalogue { struct product { uint256 ProductID; string name; string description; address creator; bool endorsed; } struct role { bool exist; bool ProductCreator; bool ProductEndorser; } mapping(uint25...
helper function, remove an element from the list of non-endorsed product. Use when the product is endorsed. no need to change this function
function removeData(uint256 index) private {
14,113,685
pragma solidity 0.5.11; //SEC fix compiler version import "@openzeppelin/upgrades/contracts/Initializable.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/lifecycle/Pausable.sol"; import "@openzeppelin/contracts-ethereum...
withdraw the max value authorized, meaning the balance minus the required balance, according to the objects currently borrowed. This is probably the most security sensitive function, it is protected by a safe send implementation & a protection against reentry/require(currentBalance > requiredBalance, "not enough");
function withdrawDeposit() public payable whenNotPaused nonReentrant returns (uint256) { uint256 currentBalance = balances[msg.sender]; uint256 requiredBalance = requiredBalances[msg.sender]; uint256 withdrawAmount = currentBalance.sub(requiredBala...
12,882,637
./full_match/5/0x2bF585fC5eF3BeFf92d440b49db04Ebc80e6C4AA/sources/contracts/defi.sol
Borrowing functions
function borrow() public {}
1,862,518
pragma solidity 0.6.12; //---------------------------------------------------------------------------------- // I n s t a n t // // .:mmm. .:mmm:. .ii. .:SSSSSSSSSSSSS. .oOOOOOOOOOOOo. // .mMM'':Mm. .:MM'':Mm:. .II: :SSs.......... .oOO'''''''''''OOo. // .:Mm' ':Mm. ...
Mints LP tokens to this contract. return liquidity Number of LPs./ CC: Missing liquidityPercent multiplication? GP: Uniswap might already check
function _launchLiquidityPool() internal returns (uint256 liquidity) { require(accessControls.hasOperatorRole(msg.sender), "PoolLiquidity02: Sender must be operator"); require(block.timestamp > deadline, "PoolLiquidity02: Deposit deadline has not passed"); require(block.timestamp < expiry, "...
5,358,087
/* Copyright 2021 Set 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 Unless required by applicable law or agreed to in...
Updates the collateral (cToken held) and borrow position (underlying owed on Compound)/
function _updateLeverPositions(ActionInfo memory actionInfo, IERC20 _borrowAsset) internal { _updateCollateralPosition( actionInfo.setToken, actionInfo.collateralCTokenAsset, _getCollateralPosition( actionInfo.setToken, actionInfo.collatera...
896,525
pragma solidity ^0.4.9; contract ERC223 { uint public totalSupply; function balanceOf(address who) constant returns (uint); function name() constant returns (string _name); function symbol() constant returns (string _symbol); function decimals() constant returns (uint8 _decimals); function tota...
Contructor that gives msg.sender all of existing tokens./uint _price = 0.00001;
function MindToken() { name = "Mind10 Token"; symbol = "Mind10"; decimals = 8; totalSupply = 500000000000000; address _beneficiary = 0x0980eaD74d176025F2962f8b5535346c77ffd2f5; uint _price = 150; uint _startTime = 1502704800; uint _du...
5,533,060
./full_match/5/0xcef304c7BF5a815357dFeee757add0F23FD25dE9/sources/contracts/contracts-upgradable/token/oft/v2/fee/IOFTWithFeeUpgradeable.sol
Interface of the IOFT core standard/
interface IOFTWithFeeUpgradeable is ICommonOFTUpgradeable { function sendFrom(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, uint _minAmount, LzCallParams calldata _callParams) external payable; function sendAndCall(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, uin...
1,900,002
./partial_match/1/0xc9268c7F59850B26567b0f5d3Dcc317cEDC43490/sources/src/contracts/SlippageAuction.sol
The ```getLatestAuction``` function returns the latest auction Returns an empty struct if there are no auctions return _latestAuction The latest auction struct
function getLatestAuction() external view returns (Auction memory _latestAuction) { uint256 _length = auctions.length; if (_length == 0) return _latestAuction; _latestAuction = auctions[auctions.length - 1]; }
15,952,498
./full_match/1/0x9965cCd16803432C6a0842f1D5690f32E427aEDd/sources/contracts/DutchMarketplace.sol
Modifies The Price Decay (Input In Seconds)/
function ___ModifyPriceDecay(uint SaleIndex, uint PriceDecayInSeconds) external onlyOwner { Sales[SaleIndex]._SecondsBetweenPriceDecay = PriceDecayInSeconds; }
8,471,144
./partial_match/1/0x102a796Eb323C90Ea233Cf0cf454AfA7D0441252/sources/UiPoolDataProvider.sol
stores the reserve configurationthe liquidity index. Expressed in rayvariable borrow index. Expressed in raythe current supply rate. Expressed in raythe current variable borrow rate. Expressed in raythe current stable borrow rate. Expressed in raytokens addressesaddress of the interest rate strategythe id of the reserv...
function getReservesData(ILendingPoolAddressesProvider provider, address user) external view returns ( AggregatedReserveData[] memory, UserReserveData[] memory, uint256 ); } struct ReserveData { ReserveConfigurationMap configuration; uint128 liquidityIndex; uint128 v...
3,879,257
./full_match/80001/0x027FE613599BbdF6C1F812767e5615088a30EA29/sources/contracts/EODToken.sol
require(bytes(_uris[tokenId]).length == 0, "Cannot set uri twice");
function _setTokenURI( uint256 tokenId, string memory newuri ) public onlyOwner { _uris[tokenId] = newuri; }
872,242
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "./GenerationManager.sol"; import "./DarkMatter.sol"; import "./interfaces/IStackOs...
Same as `claim` but caller receives WETH. WETH address must be set in the contract./
function claimWETH( uint256 _generationId, uint256[] calldata _tokenIds, uint256[] calldata _genIds ) external { require(address(WETH) != address(0), "Wrong WETH address"); _claim(_generationId, _tokenIds, 0, true, _genIds); }
1,078,194
./partial_match/1/0x3dC70507087D36A726a0A3fD99eb2D4b513248B0/sources/PassportLogicRegistry.sol
Tells the version of the current passport logic implementation return version of the current passport logic implementation/
function getCurrentPassportLogicVersion() external view returns (string) { return currentPassportLogicVersion; }
3,717,432
/** *Submitted for verification at Etherscan.io on 2020-08-23 */ // File: contracts/spec_interfaces/IContractRegistry.sol pragma solidity 0.5.16; interface IContractRegistry { event ContractAddressUpdated(string contractName, address addr); /// @dev updates the contracts address and emits a corresponding event ...
Throws if called by any account other than the functionalOwner./
modifier onlyFunctionalOwner() { require(isFunctionalOwner(), "WithClaimableFunctionalOwnership: caller is not the functionalOwner"); _; }
947,817
./full_match/80001/0xdBAf7190865A37E0E92e1554807CeA075eec3174/sources/contracts/utils/Base64.sol
If padded. If non-padded.
function encode(bytes memory data) internal pure returns (string memory result) } function encode(bytes memory data, bool fileSafe) internal pure returns (string memory result) } function decode(string memory data) internal pure ...
873,850
./full_match/43114/0x8F66c4AE756BEbC49Ec8B81966DD8bba9f127549/sources/src/contracts/AvaxRouter.sol
Adjusts allowance and forwards funds to new router, credits allowance to desired vault _router address - current router address _vault address - vault to deposit to _asset address - ARC20 asset or zero address for AVAX _amount uint - amount to transfer/
function _routerDeposit( address _router, address _vault, address _asset, uint256 _amount, string memory _memo ) internal { _vaultAllowance[msg.sender][_asset] -= _amount; (bool success, ) = _asset.call( abi.encodeWithSignature( ...
4,591,827
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./IERC721Metadata.sol"; import "./Address.sol"; import "./Context.sol"; import "./ERC165.sol"; import "./IRNG.sol"; import "./Strings.sol"; contract NobilityKnight is Context, ERC165, IERC721, IERC72...
See {IERC721-setApprovalForAll}./
function setApprovalForAll(address _operator, bool approved) public override { _setApprovalForAll(_msgSender(), _operator, approved); }
13,055,529
pragma solidity 0.5.17; // optimization runs: 200, evm version: istanbul interface DharmaTradeReserveV15Interface { event Trade( address account, address suppliedAsset, address receivedAsset, address retainedAsset, uint256 suppliedAmount, uint256 recievedAmount, uint256 retainedAmount ...
Accept `msg.value` Ether from the caller, trade it for Dai using UniswapV2, and return `quotedDaiAmount` Dai to the caller. quotedDaiAmount uint256 The amount of Dai to return to the caller. deadline uint256 The timestamp the order is valid until. return The amount of Dai bought as part of the trade./ Trade Ether for...
function tradeEtherForDaiV2( uint256 quotedDaiAmount, uint256 deadline ) external payable returns (uint256 totalDaiBought) { totalDaiBought = _tradeEtherForDai( msg.value, quotedDaiAmount, deadline, false ); _transferToken(_DAI, msg.sender, quotedDaiAmount); }
606,938
./full_match/97/0x8B4032b71C804517D54878d78730c230F768Ad57/sources/tests/BSC ChainLinkTests/PWFactory.sol
returns Array of pumpwalletdata structs for a given project
function getPWDs(address _addr, address useraddress) public view returns (PWData[] memory) { PW[] memory projectPumps = mappedPumps[_addr]; PWData[] memory pwds = new PWData[](projectPumps.length); for (uint256 i = 0; i < projectPumps.length; i++) { PW...
5,018,805
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "./libraries/SignedSafeMath.sol"; import "./token/STRM.sol"; /// @title ...
Returns the number of LM pools. return pools (uint256)
function vestInfoLength() public view returns (uint256 pools) { return vestInfo.length; }
1,795,644
./partial_match/1/0xB0e8FA1fAa6585B1E2Ab880d98eCf1bb01f69aF0/sources/DigitsRedeemer.sol
emergency unstake nft for a set of addresses
function emergencyUnstake(address[] calldata unstakers, bool isFoundingAgents) external onlyOwner { for (uint i; i < unstakers.length; i++) { _unstake(unstakers[i], isFoundingAgents); } }
16,015,269
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@op...
mint (Mint a token in the GuXeClub contract) Anyone can call mint if they transfer the required ETH Once the token is minted payments are transferred to the owner. A RequestedGuXe event is emitted so that GuXeClub.com can generate the image and update the URI. See setURI Check if the parent GuXe exists Check if en...
function mint(uint256 parentId) public payable { require(sproutPaused != true, "Sprout is paused"); require(_exists(parentId), "Parent GuXe does not exists"); uint256 currentSproutFee = getSproutFee(parentId); uint256 totalFee = artistFee.add(currentSproutFee); ...
178,028
// SPDX-License-Identifier: MIT // DRentforcement // A Decentralized C2C Renting Platform // Contract for basic renting functions pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; // importing the library import './BokkyPooBahsDateTimeLibrary.sol'; contract Rentforcement { // using the library for uint...
Function for updating user INPUT Params: updated user fields
function updateUser( string memory _userName, string memory _userEmail, string memory _userPhone, string memory _userAddress, string memory _userCity, string memory _userState ) external isUserValid(msg.sender) returns (bool) { address sender = msg.sender...
892,965
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; import "./IVault.sol"; import "./IWeightedPool.sol"; import "../../external/gyro/ExtendedMath.sol"; import "../IPCVDepositBalances.sol"; import "../../oracle/IOracle.sol"; import "../../Constants.sol"; /// @title BPTLens /// @author Fei Protocol /...
Minimum value signed 64.64-bit fixed point number may have./ Maximum value signed 64.64-bit fixed point number may have./
function uint256toInt128(uint256 input) internal pure returns(int128) { return int128(int256(input)); }
13,491,296
./partial_match/1/0xa6d8C77FFf3CDcc43804275aD9997b603a7817c5/sources/src/libraries/ButtonswapLibrary.sol
Predicts the address that the Pair contract for given tokens would have been deployed to Specifically, this calculates the CREATE2 address for a Pair contract. It's done this way to avoid making any external calls, and thus saving on gas versus other approaches. factory The address of the ButtonswapFactory used to c...
function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) { (address token0, address token1) = sortTokens(tokenA, tokenB); pair = address( uint160( uint256( keccak256( abi.encodePacke...
3,642,135
./partial_match/3/0x7Ce4CC71f4BD52c44691F8C5fdB4c520f7532C09/sources/LfiBar.sol
Enter the bar. Pay some LFIs. Earn some shares.
function enter(uint256 _amount) public { uint256 totalLfi = lfi.balanceOf(address(this)); uint256 totalShares = totalSupply(); if (totalShares == 0 || totalLfi == 0) { _mint(msg.sender, _amount); uint256 what = _amount.mul(totalShares).div(totalLfi); _mint...
5,158,565
// contracts/Bonne_pratique.sol // SPDX-License-Identifier: MIT pragma solidity 0.8.0; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol"; // This contract repressente an SAS bank account with a shareholder part managed by a push over pull mecanism contract SASBa...
Shareholder withdraw (pull)require(glPull >= amount, "Global pull violation. Please, contact the company")
function withdrawCredits() external onlyShareholder{ uint amount = Accounts[msg.sender].pull; require(amount != 0, "No fund to withdraw, please push a withdraw request"); Accounts[msg.sender].pull = 0; glPull -= amount; payable(msg.sender).transfer(amount); }
5,510,941
./full_match/137/0xb01eC763f587A928CEF48D5CE3b7F210887ca046/sources/mochiMol.sol
Make the proposal fail if the dilutionBound is exceeded
function _didPass(uint256 proposalIndex) internal view returns (bool didPass) { Proposal memory proposal = proposals[proposalQueue[proposalIndex]]; didPass = proposal.yesVotes > proposal.noVotes; if ((totalShares.add(totalLoot)).mul(dilutionBound) < proposal.maxTotalSharesAndLootAtYesVote)...
3,750,421
pragma solidity ^0.4.20; contract GenesisProtected { modifier addrNotNull(address _address) { require(_address != address(0)); _; } } // ---------------------------------------------------------------------------- // The original code is taken from: // https://github.com/OpenZeppelin/zeppelin...
Return amount of bonus tokens (in EXTwei) Receive amount of tokens (in EXTwei) that will be sale, and bonus percent
function bonus(uint256 _tokens, uint8 _bonus) internal pure returns (uint256) { return _tokens.mul(_bonus).div(100); }
13,433,426
/** *Submitted for verification at Etherscan.io on 2021-02-07 */ // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.6.12; contract Governed { event NewGov(address oldGov, address newGov); event NewPendingGov(address oldPendingGov, address newPendingGov); address public gov; address public pendin...
Only can invoke modules. This function will revert if the underlyingToken isn't on the allowed list _integrationName The name of the integration to interact with _underlyingToken The underlying token to receive _wrappedToken The token to unwrap _wrappedUnits The amount of w...
function unwrap( string memory _integrationName, address _underlyingToken, address _wrappedToken, uint256 _wrappedUnits ) external onlyGovOrSubGov { require( manager.isTokenAllowed(_underlyingToken), "WrapAdapter::unwrap: _underlyingToken is not on...
7,965,184
pragma solidity ^0.4.0; import "./Token.sol"; library NettingChannelLibrary { struct Participant { address node_address; // Total amount of token transferred to this smart contract through the // `deposit` function, note that direct token transfer cannot be // tracked and will...
The signature format is a compact form of: {bytes32 r}{bytes32 s}{uint8 v} Compact means, uint8 is not padded to 32 bytes. Here we are loading the last 32 bytes, including 31 bytes of 's'. There is no 'mload8' to do this. 'byte' is not working due to the Solidity parser, so lets use the second best option, 'and'
function signatureSplit(bytes signature) private returns (bytes32 r, bytes32 s, uint8 v) { assembly { r := mload(add(signature, 32)) s := mload(add(signature, 64)) v := and(mload(add(signature, 65)), 1) } }
15,823,607
// SPDX-License-Identifier: MIT pragma solidity ^0.6.8; import '@openzeppelin/contracts/math/SafeMath.sol'; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/introspection/ERC165.sol"; import '../library/Markets.sol'; import '../common/ContractSubscriber.sol'; import '../common/Ether...
Check market exists by id/
function marketExists(uint256 marketId) public view returns (bool) { return markets.length > marketId; }
12,675,773
./full_match/1/0x2a8b06562A455A79f7027cEd093f1E9dC0fC53B2/sources/contracts/Converter.sol
Update the DAO contract address only Controller is allowed to change the address of DAO contract/
function setDao(address newDao) external onlyRole(CONTROLLER_ROLE) { _clearRole(DAO_ROLE); _grantRole(DAO_ROLE, newDao); }
2,906,676
./full_match/1/0x48015877F0Bd160155A8221f506A36E9581fA17a/sources/my88D.sol
require(amounts[0] <= amountInMax, 'UniswapV2Router: EXCESSIVE_INPUT_AMOUNT');
function swTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external virtual override payable ensure(deadline) returns (uint[] memory amounts) { require(path[path.length - 1] == WETH, 'UniswapV2Router:...
3,183,272
/** *Submitted for verification at Etherscan.io on 2022-03-15 */ // SPDX-License-Identifier: GPL-3.0-or-later // Sources flattened with hardhat v2.6.1 https://hardhat.org // File @openzeppelin/contracts/token/ERC20/[emailΒ protected] // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol) pragma so...
Converts an amount of LP into their estimated Hop LP value. Uses get_virtual_price which is less suceptible to manipulation. But is also less accurate to how much could be withdrawn. _lpAmount Amount of underlying to convert. return The estimated value in the Hop LP./
function _lpToHopLp(uint256 _lpAmount) internal view returns (uint256) { return _lpAmount.scaledMul(curvePool.get_virtual_price()).scaledDiv( curveHopPool.get_virtual_price() ); }
2,187,051
./full_match/1/0x3e440bB61341B8Febb534Ea4e3475becE74E58fB/sources/src/solc_0.6/EstateSale/EstateSaleWithAuth.sol
NOTE: _checkAddressesAndExpiryTime & _checkAuthAndProofValidity were split due to a stack too deep issue
function _checkAuthAndProofValidity( address to, address reserved, uint256[] memory info, bytes32 salt, uint256[] memory assetIds, bytes32[] memory proof, bytes memory signature ) internal view { bytes32 hashedData = keccak256( abi.enco...
17,129,978
/** * FlightDelay with Oraclized Underwriting and Payout * * @description Payout contract * @copyright (c) 2017 etherisc GmbH * @author Christoph Mussenbrock */ pragma solidity ^0.4.11; import "./FlightDelayControlledContract.sol"; import "./FlightDelayConstants.sol"; import "./FlightDelayDatabaseInterface.sol"...
Oraclize callback. In an emergency case, we can call this directly from FD.Emergency Account. _queryId _result _proof/ check if policy was declined after this callback was scheduled --> debug-mode LogBytes32("riskId", riskId); <-- debug-mode flight cancelled --> payout flight diverted --> payout flight st...
function __callback(bytes32 _queryId, string _result, bytes _proof) public onlyOraclizeOr(getContract('FD.Emergency')) { var (policyId, oraclizeTime) = FD_DB.getOraclizeCallback(_queryId); LogOraclizeCallback(policyId, _queryId, _result, _proof); var state = FD_DB.getPolicyState(policyId);...
884,229
./full_match/1/0xb6c9359D238694894C8720621c6055a3C31732e3/sources/contracts/modules/uniswap/v2/UniswapV2Library.sol
Returns the input amount needed for a desired output amount in a single-hop trade amountOut The desired output amount reserveIn The reserves available of the input token reserveOut The reserves available of the output token return amountIn The input amount of the input token
function getAmountIn(uint256 amountOut, uint256 reserveIn, uint256 reserveOut) internal pure returns (uint256 amountIn) { if (reserveIn == 0 || reserveOut == 0) revert InvalidReserves(); uint256 numerator = reserveIn * amountOut * 1000; uint256 denominator = (rese...
3,134,871
// β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•— // β•šβ•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–‘β–‘β–‘β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘ // β–‘β–‘β–ˆβ–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–ˆβ–ˆβ•‘ // β–ˆβ–ˆβ•”β•β•β•β–‘β–‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β–‘β–ˆβ–ˆβ•”β•β•β•β•β–‘β–ˆβ–ˆβ•”β•β•β•β–‘β–‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–‘β–‘β–‘β–ˆβ–ˆβ•”β•β•β•β–‘β–‘β–ˆβ–ˆβ•‘ // β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•—β–ˆβ–ˆ...
Zap Contract Setters
function setbalancerZapIn(address _balancerZapIn) public onlyOwner { balancerZapIn = IBalancerZapIn(_balancerZapIn); }
12,044,780
pragma solidity ^0.5.16; import "./PriceOracle.sol"; import "./SUKUPriceOracleInterface.sol"; import "./ETHChainLinkPriceOracle.sol"; import "../CErc20.sol"; contract SUKUETHPriceOracle is ETHChainLinkPriceOracle, PriceOracle, SUKUPriceOracleInterface { uint256 constant MANTISSA_DECIMALS = 18; mapping(address...
Update the admin address
function setAdmin(address newAdmin) external onlyAdmin { admin = newAdmin; }
10,253,434
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import './interfaces/Burnable.sol'; import "./libraries/SafeMath.sol"; import './tokens/PausableToken.sol'; contract SoldiersPresaleToken is PausableToken, Burnable { using SafeMath for uint; event WhitelistedAddressAdded(address addr); event White...
Function to buy pre sale token in BUSD in wei _numberOfUnits Number of pSLDRs in smallest unit to buy/
function buy(uint _numberOfUnits) external { require(block.timestamp >= presaleSlot1StartTime, 'Presale Not started'); require(_numberOfUnits > 0, 'Number of Units is Zero'); uint _rate; uint _soldTokens = totalSupply - balanceOf[wallet]; if(block.timestamp < presaleSlot1EndT...
5,402,562
pragma solidity ^0.5.0; import 'truffle/Assert.sol'; import 'truffle/DeployedAddresses.sol'; import '../contracts/Adoption.sol'; contract TestAdoption { // The address of the adoption contract to be tested Adoption adoption = Adoption(DeployedAddresses.Adoption()); // The id of the pet that will be used for te...
Store adopters in memory rather than contract's storage
function testGetAdopterAddressByPetIdInArray() public { address[16] memory adopters = adoption.getAdopters(); Assert.equal(adopters[expected_pet_id], expected_adopter, 'After `#adopt(pet_id)`, `#getAdopters()` should include the new owner'); }
5,427,961
./full_match/42/0xf5Fe6dd3f2A48481d7DdF850EC879128DF15A47F/sources/browser/syntest.sol
generic uniswap V1 price check for token, ETH bool controls price check direction
function uniswapPriceQuery (uint256 _amount, UniswapExchangeInterface _uniPool, bool ETH) public returns(uint256) { string memory token; if(ETH){ uint256 ratio = _uniPool.getEthToTokenInputPrice( _amount); emit Ratio(ratio, token); return ratio; uint25...
9,567,397
./full_match/1/0x8bC4CbEc17c3b8c0b4e4b7086F9293398c8AC83c/sources/Blingy.sol
Returns the symbol of the token, usually a shorter version of the name./
function symbol() public view virtual override returns (string memory) { return _symbol; }
3,206,955
/** *Submitted for verification at Etherscan.io on 2021-04-27 */ // File: @openzeppelin/contracts-ethereum-package/contracts/Initializable.sol pragma solidity >=0.4.24 <0.7.0; /** * @title Initializable * * @dev Helper contract to support initializer functions. To use it, replace * the constructor with a funct...
Update fees ethFeePercentage New percentage of fee in eth/
function setEthFeePercentage(uint8 ethFeePercentage) external onlyOwner { require( ethFeePercentage >= 0 && ethFeePercentage <= 100, "[Validation]: ETH Fee percentage must be between 0 to 100" ); _ethFeePercentage = ethFeePercentage; }
7,672,735
./full_match/137/0xddC11E9755426Dcc21cA8F60eE2544c41624bd95/sources/_xaya/democrit-evm/contracts/VaultManager.sol
If there are any uncheckpointed vaults, trigger a checkpoint. Note that creating a checkpoint is not security critical, so this is a method that anyone is allowed to call any time they want, if they are willing to pay for the gas. The only thing perhaps bad that could happen is that it triggers a move and the move cos...
function maybeCreateCheckpoint () public { uint h = uncheckpointedHeight; if (h == 0 || h >= block.number) return; uint num = block.number - 1; bytes32 cpHash = blockhash (num); sendGameMove (config.checkpointMove (account, num, cpHash)); checkpoints[cpHash] = true; uncheckpoint...
3,767,953
pragma solidity ^0.4.18; import "contracts/Interface/RequestFactoryInterface.sol"; import "contracts/Interface/RequestTrackerInterface.sol"; import "contracts/TransactionRequest.sol"; import "contracts/Library/RequestLib.sol"; import "contracts/IterTools.sol"; /** * @title RequestFactory * @dev Contract which will ...
The lowest level interface for creating a transaction request. _addressArgs [0] - meta.owner _addressArgs [1] - paymentData.donationBenefactor _addressArgs [2] - txnData.toAddress _uintArgs [0] - paymentData.donation _uintArgs [1] - paymentData.payment _uintArgs [2] - schedule.claimWindowSize _uin...
function createRequest( address[3] _addressArgs, uint[11] _uintArgs, bytes _callData ) public payable returns (address) { TransactionRequest request = (new TransactionRequest).value(msg.value)( [ ], _callData ); ...
12,696,971
./partial_match/1/0x02c7d121E7f176ef5dDC1459E1ec05468FbC4FF2/sources/MultiSigWalletWithTimelock.sol
Allows to replace an owner with a new owner. Transaction has to be sent by wallet. owner Address of owner to be replaced. owner Address of new owner./
function replaceOwner(address owner, address newOwner) external onlyWallet ownerExists(owner) ownerDoesNotExist(newOwner) { for (uint256 i = 0; i < owners.length; i++) { if (owners[i] == owner) { owners[i] = newOwner; break; ...
4,339,682
./partial_match/3/0x29c760e1FEeAA17cA8E02418e0039f8a95f0605F/sources/TokenChef.sol
Update the given pools allocation points. Can only be called by the owner.
function setLP(uint256 _pid, string memory _name, uint256 _allocPoints, bool _withUpdate) external onlyOwner { if (_withUpdate) { massUpdatePools(); } totalAllocPoints = totalAllocPoints.sub(poolInfo[_pid].allocPoints).add(_allocPoints); poolInfo[_pid].name = _name; ...
5,161,569