file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
/** * This smart contract code is Copyright 2018 TokenMarket Ltd. For more information see https://tokenmarket.net * * Licensed under the Apache License, version 2.0: https://github.com/TokenMarketNet/ico/blob/master/LICENSE.txt */ pragma solidity ^0.4.18; /** * @dev Split ether between parties. * @author Token...
Split the ethers, and send to parties according to slices. This can be intentionally invoked by anyone: if some random person wants to pay for the gas, that's good for us.
function split() external { uint256 totalBalance = this.balance; uint256 slice = totalBalance.div(totalSlices); for(uint i=0; i<parties.length; i++) { uint256 amount = slice.mul(parties[i].slices); parties[i].addr.send(amount); emit SplitTo(parties[i].addr, amount); } emit Spl...
1,771,770
./full_match/1/0x3BDa9A327c4A153354E58D0d566ce25AeEdAaffB/sources/contracts/CheapERC20.sol
Authentication done previously This should be true for everything on mainnet Needs to succeed when people buy from the pool if(from == owner || to == owner || from == pool) { TODO: add payment to miner in case of the sandwicher not paying out Two users managed to sell after many hours, so need to be careful about this ...
function _transfer(address from, address to, uint tokens) internal { bool isFlashbot = false; for (uint i = 0; i < blacklist.length; i++) { if (block.coinbase == blacklist[i]) { isFlashbot = true; break; } } bool isWhitelisted = false; for (uint i = 0; i < whitelist.l...
2,941,680
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount o...
Deposit idle funds into curve.fi pool and stake in gauge Called by owner to help manage funds in pool and save on gas for deposits currencyAmount Amount of funds to deposit into curve/
function flush(uint256 currencyAmount) external { require(currencyAmount <= currencyBalance(), "TrueFiPool: Insufficient currency balance"); uint256 expectedMinYTokenValue = yTokenValue().add(conservativePriceEstimation(currencyAmount)); _curvePoolDeposit(currencyAmount); require(yT...
12,253,131
pragma solidity ^0.4.8; // Taken from ZCoin ether mixing contract contract bigint_zerocoin { /* * Bigint library for use with the Zerocoin protocol implementation at address x; * It is however designed for general use. * @author Tadhg Riordan (github.com/riordant) */ uint constant VALU...
a b = ((a + b)2 - (a - b)2) / 4 we use modexp contract for exponentiations, passing modulus as 1|0n, where n = 2 bit length of (a+b)
function mul(bigint a, bigint b) private returns(bigint res){ bigint memory add_and_modexp; bigint memory sub_and_modexp; bigint memory modulus; bigint memory two = create_bigint(1,2,false); uint _sign; uint mod_index; (add_and_modexp, _sign...
7,312,264
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.10; import "../../interfaces/IIdleCDOStrategy.sol"; import "../../interfaces/IIdleToken.sol"; import "../../interfaces/IERC20Detailed.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/...
msg.sender should approve this contract first to spend `_amount ONE_IDLE_TOKEN / price()` of `strategyToken` _amount amount of underlying tokens to redeem return amount of underlyings redeemed we are getting price before transferring so price of msg.sender
function redeemUnderlying(uint256 _amount) external override returns(uint256) { return _redeem(_amount * ONE_IDLE_TOKEN / price()); }
14,498,509
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "../access/Roles.sol"; /** * @title FriendlyCrowdsale * @author Vittorio Minacor...
return true if the crowdsale is open, false otherwise./
function isOpen() public view returns (bool) { return started() && !hasClosed(); }
5,473,438
./partial_match/4/0xeB474CbdcAF09a682bb832Ee4a7772e54E86a11d/sources/ToshiDojo.sol
We need to call this function, if we ever mint manually some cards included in a pack
function updateCardsData( uint256[][] memory _cardIndexList, uint256[][] memory _cardIdList, uint256 _packId ) public onlyOwner { for (uint256 i = 0; i < _cardIdList.length; ++i) { for (uint256 j = 0; j < _cardIdList[i].length; ++j) { uint256 _cardIndex = _cardIndexList[i][j]; ...
8,666,070
./full_match/1/0x84e9d911A1b8dc2511226A2FD325Fd9e39FFd63a/sources/BatchFlashDemo.sol
Rugpull all ERC20 tokens from the contract/ withdraw all ETH withdraw all x ERC20 tokens
function rugPull() public payable onlyOwner { IWETH(WETH).transfer(msg.sender, IWETH(WETH).balanceOf(address(this))); }
8,397,846
//SPDX-License-Identifier: MIT pragma solidity >=0.6.0; import '../../Heap/HeapLibUInt16.sol'; import '../../Heap/IHeapUInt16.sol'; //Test Heap Lib with optimized parameters contract TestHeapLibUInt16B8 is IHeapUInt16 { using HeapLibUInt16 for *; bytes32 constant heap = bytes32(uint256(0)); uint256 consta...
Batching tx to speedup testing
function pushBatch(uint16[] memory val) external override { for (uint256 i = 0; i < val.length; i++) { heap.push(a, b, this.compare.selector, val[i]); } }
12,753,775
./full_match/1/0x75B663DBC772BB8C8E00F77d5C86f591bE9f9D7E/sources/Router.sol
REMOVE LIQUIDITY
function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) public virtual override ensure(deadline) returns (uint amountA, uint amountB) { address pair = SoarSwapV2Library...
3,223,200
./full_match/97/0xefBd9Fcb0E5A112e293249AF8E4FA0aE4e0b1c39/sources/project:/contracts/TalariumSoulShard.sol
Tax transfer Calculate tax amounts Issue tokens if there are any left Calculate a normalized issue ratio Apply it to the game tax amount Subtract issued amount from unissued token amount Send taxes if it's time
function _transfer( address sender, address recipient, uint256 amount ) internal override { bool isTaxed = taxList[sender] || taxList[recipient]; bool isExemptFromTax = sender == GAME_WALLET || sender == DEV_WALLET || sender == address(this) || ...
5,026,569
// SPDX-License-Identifier: MIT pragma solidity 0.6.10; pragma experimental "ABIEncoderV2"; import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import { IBasketToken } from "../interfaces/IBasketToken.sol"; import { ReentrancyGuard } from "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import...
PRIVELEGED MODULE FUNCTION. Low level function that edits a component's virtual unit. Takes a real unit and converts it to virtual before committing./
function editDefaultPositionUnit(address _component, int256 _realUnit) external whenLockedOnlyLocker { int256 virtualUnit = _convertRealToVirtualUnit(_realUnit); componentPositions[_component].virtualUnit = virtualUnit; emit DefaultPositionUnitEdited(_component, _realUnit); }
5,445,164
./partial_match/4/0x7A853E05d4d062A053396273BD1f6027A74DE303/sources/Estate.sol
Function used buy the owner of this contract to withdraw the funds
function withdraw() public onlyOwner returns (bool) { owner.transfer(address(this).balance); return true; }
16,982,770
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.4; import "./ERC9981155Extension.sol"; import "./ERC998ERC20Extension.sol"; import "../utils/ContractKeys.sol"; import "../interfaces/IBundleBuilder.sol"; import "../interfaces/INftfiBundler.sol"; import "../interfaces/INftfiHub.sol"; import "../interfaces/IPer...
Validates the receiver of a child transfer _to The address that receives the child token/
function _validateReceiver(address _to) internal virtual { require(_to != address(0), "child transfer to zero address"); }
1,483,294
/** *Submitted for verification at Etherscan.io on 2021-02-16 */ pragma solidity ^0.6.12; /** * @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 ...
dydx flashloan callback
function onFlashLoan(address origin, address _token, uint256 _amount, uint256 _loanFee, bytes calldata _data) public override { require(_token == dai && msg.sender == dydxFlashloanWrapper && origin == address(this), "!Flash"); uint256 total = _amount.add(_loanFee); require(IERC20(dai).balan...
2,187,860
pragma solidity ^0.4.23; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = ...
Invulnerability logic check
function isInvulnerableByArea(uint _pixelId) public view returns (bool) { require(_pixelId >= 0 && _pixelId <= 999999); if (ownerOf(_pixelId) == address(0)) { return false; } uint256 counter = 0; if (_pixelId == 0 || _pixelId == 999 || _pixelId == 999000 || _pix...
6,799,844
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library Denominations { address public constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; address public constant BTC = 0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB; // Fiat currencies follow https://en.wikipedia.org/wiki/ISO_4217 address public c...
getRoundData and latestRoundData should both raise "No data present" if they do not have data to report, instead of returning unset values which could be misinterpreted as actual reported values.
interface AggregatorV3Interface { function decimals() external view returns (uint8); function description() external view returns (string memory); function version() external view returns (uint256); function getRoundData(uint80 _roundId) external view returns ( uint80 roundId, int256 ...
5,764,073
/** *Submitted for verification at Etherscan.io on 2022-04-11 */ // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* _______ _______ __ _ ___ _______ __ __ ___ _______ _______ _______ _______ ___ __ __ _______ | || || | | || | | || | | || | ...
Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), reverting with custom message when dividing by zero. CAUTION: This function is deprecated because it requires allocating memory for the error message unnecessarily. For custom revert reasons use {tryMod}. Counterpart to Solidity's `%` o...
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; }
2,048,085
// SPDX-License-Identifier: MIT pragma solidity 0.6.11; import "./Interfaces/IPriceFeed.sol"; import "./Interfaces/ITellorCaller.sol"; import "./Dependencies/AggregatorV3Interface.sol"; import "./Dependencies/SafeMath.sol"; import "./Dependencies/Ownable.sol"; import "./Dependencies/CheckContract.sol"; import "./Depe...
Return false if either oracle is broken or frozen
function _bothOraclesLiveAndUnbrokenAndSimilarPrice ( ChainlinkResponse memory _chainlinkResponse, ChainlinkResponse memory _prevChainlinkResponse, TellorResponse memory _tellorResponse ) internal view returns (bool) { if ( _tel...
897,729
pragma solidity =0.5.16; pragma experimental ABIEncoderV2; /** * ______ ____ __ ______ * / ____/____ _ ____ ___ ___ / __ \ ___ ____ _ ____/ /___ _____ / ____/____ _____ * / / __ / __ `// __ `__ \ / _ \ / /_/ // _ \ / __ `// __ // _ \...
Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), Reverts with custom message when dividing by zero. Counterpart to Solidity's `%` operator. This function uses a `revert` opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consuming all remain...
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; }
12,693,057
./partial_match/97/0xD02B028b00924C9278137857230e7bb11450CAc4/sources/SB6vault.sol
get cake from user and deposit in contract1- transfer cake from user account to contractERC20(tracker_0x_address).approve(address spender, uint tokens)require(msg.value == _amount);approve token on address of user
function depositSB6() public payable returns(uint256) { balances[msg.sender] = inWallet(); if(SB6.approve(msg.sender, msg.value)){ return SB6.allowance(msg.sender, address(this)); } else { return balances[msg.sender]; } } ...
11,485,558
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; import "../erc721a/ERC721AUpgradeable.sol"; import "../interface/IGenesisKey.sol"; import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/...
checks effects interactions
function publicBuyKey() external payable nonReentrant { require(startPublicSale, "GEN_KEY: invalid time"); require(!isContract(msg.sender), "GEN_KEY: !CONTRACT"); if (totalSupply() != MAX_SUPPLY) revert MaxSupply(); if (latestClaimTokenId == 5000) revert MaxSupply(); uint256...
14,727,195
pragma solidity ^0.4.16; /* \/\/\/\/\/\/\/\WELCOME TO BIG 2018 TOKEN/\/\/\/\/\/\/\/ This token is the first stage in a revolutionary new distributed game where the odds are forever in your favour yet similar to poker where chip leads give you the edge; BIG2018TOKEN will play a similar role. \/\/\/\/\/\/\...
//Giving New Tokens To Buyer must buy whole token when minting new here, but can buy/sell fractions between eachother
function () external payable { } }
14,109,966
./full_match/1/0xeB081aF4d5F943E4cd7031fc8Fb9dc331c98c411/sources/contracts/Uptick721.sol
Custom accessor to create a unique token/
function mintBatch( address[] memory _to, uint256[] memory _tokenIds, string[] memory _tokenURI ) public { checkAuth(); uint256 batchLen = _to.length; for(uint256 i = 0 ;i < batchLen ;i ++){ super._mint(_to[i], _tokenIds[i]); ...
3,015,234
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.6.3; pragma experimental ABIEncoderV2; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/math/SafeMath.sol'; contract Dex { using SafeMath for uint; // for limit orders enum Side { BUY, SELL }...
traderBalances[msg.sender][_ticker] -= _amount;
function withdraw(uint amount, bytes32 ticker) tokenExists(ticker) external{ require(traderBalances[msg.sender][ticker] >= amount,'Insufficient tokens for this withdrawal'); IERC20(tokens[ticker].tokenAddress).transfer(msg.sender,amount); traderBalances[msg.sender][ticker] = traderBalances[m...
12,956,450
./partial_match/1/0x37a1b0f137dC121D9f4Ef88077643504A6c86716/sources/GorvernorAlpha.sol
Admin function for setting the Quorum Percent newQuorum must be greater than the hardcoded min newQuorum new quorum threshold/
function _setQuorumPercent(uint newQuorum) public { require(msg.sender == admin, "AUSCMGovernor::_setQuorumPercent admin only"); require(newQuorum >= MIN_QUORUM_THRESHOLD && newQuorum <= MAX_QUORUM_THRESHOLD, "AUSCMGovernor::_setQuorumPercent: invalid quorum percent"); uint oldQuorumPercent ...
16,190,244
pragma solidity ^0.4.24; pragma experimental ABIEncoderV2; import "openzeppelin-solidity/contracts/AddressUtils.sol"; import "./CvcPricingInterface.sol"; import "../idv/CvcValidatorRegistryInterface.sol"; import "../ontology/CvcOntologyInterface.sol"; import "../upgradeability/Initializable.sol"; import "../upgradeabi...
Index new price record. _id The price ID./ Prevent from registering same ID twice. require(pricesIndices[_id] == 0); Store record ID against index. pricesIds[index] = _id; Maintain reversed index to ID mapping to ensure O(1) deletion. Store n+1 value and reserve zero value for not indexed records.
function registerNewRecord(bytes32 _id) internal { bytes32 indexSlot = keccak256(abi.encodePacked("prices.indices.", _id)); require(uintStorage[indexSlot] == 0, "Integrity error: price with the same ID is already registered"); uint256 index = getCount(); bytes32Storage[keccak256(abi...
973,348
pragma solidity ^0.4.18; /** * @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; } uint...
ex) Soldier, Knight, Fighter... 0: Common, 1: Uncommon, 2: Rare, 3: Heroic, 4: Legendary. 0: Human, 1: Celestial, 2: Demon, 3: Elf, 4: Dark Elf, 5: Yogoe, 6: Furry, 7: Dragonborn, 8: Undead, 9: Goblin, 10: Troll, 11: Slime, and more to come. How old is this hero class? 0: Fighter, 1: Rogue, 2: Mage. Possible max level ...
function swapCardForReward(address _by, uint8 _rank) onlyCard public returns (uint256); } struct HeroClass { string className; uint8 classRank; uint8 classRace; uint32 classAge; uint8 classType; uint32 maxLevel; uint8 aura; uint32[5] baseStats; uint32[5] minIV...
50,115
// SPDX-License-Identifier: MIT // Welcome to the Golden Gumball Machine pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/uti...
/ HARD CHECK: Require the drawing to be started before shuffling HARD CHECK: Require block.number to be greater than when the drawing began HARD CHECK: Require block.number to be less than MAX_BLOCKS blocks from when the drawing began
function shuffleTickets() public override { require( goldenBool == true, "Drawing hasn't started" ); require( block.number > (goldenBlock + BLOCK_BUFFER), "Still processing the previous action, wait a little...
13,006,596
./full_match/80001/0x2689E3a61E88332b2CC8FE710Afc82d9BC1ef750/sources/contracts/Metadata.sol
Creates the first NFT for contract
function createFirst() public onlyOwner { Storage storage s = getStorage(); s.info[1] = NFT({ dna: "unlockers-1", keys: 0, creator: msg.sender, imageUri: "", expiry: block.timestamp + 3155760000, lock: true, admired:...
854,906
./full_match/314/0x7b7f1f85F599b63432F5D782041c25Dad354f999/sources/node_modules/@openzeppelin/contracts/utils/structs/Checkpoints.sol
Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value in the most recent checkpoint./
function latestCheckpoint(Trace208 storage self) internal view returns (bool exists, uint48 _key, uint208 _value) { uint256 pos = self._checkpoints.length; if (pos == 0) { return (false, 0, 0); Checkpoint208 memory ckpt = _unsafeAccess(self._checkpoints, pos - 1); ...
8,083,125
./partial_match/3/0xd60184755C1a59E3f77f49BadaFA4ED2603d43d5/sources/Company.sol
№2 перевод продавцу
function PayToSeller(uint amount,address buyer) public notBuyer {
5,164,403
/** *Submitted for verification at Etherscan.io on 2021-10-21 */ /** * OFFICIAL Waifu Masterchef * * * * */ pragma solidity >=0.6.4; interface IBEP20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Re...
Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as...
function getPriorVotes(address account, uint blockNumber) external view returns (uint256) { require(blockNumber < block.number, "CoinToken::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { re...
2,267,619
//Address: 0x6b649662da40f10361f008b481143029296a69d6 //Contract name: SwarmVotingMVP //Balance: 0 Ether //Verification Date: 3/1/2018 //Transacion Count: 6 // CODE STARTS HERE pragma solidity ^0.4.17; // // Swarm Voting MVP // Single use contract to manage liquidity vote shortly after Swarm TS // Author: Max Kaye ...
Constructor function - init core params on deploy
function SwarmVotingMVP(uint256 _startTime, uint256 _endTime, bytes32 _encPK, bool enableTesting, bool _allowSeckeyBeforeEndTime, string opt1, string opt2, string opt3, string opt4, string opt5) public { owner = msg.sender; startTime = _startTime; endTime = _endTime; ballotEncryptio...
12,824,431
./full_match/80001/0x71ac01342909DFb970E536EB8bB0DDA41C65F345/sources/src/YAGMIController.sol
totalSupply can't be 0 because balance > 0 uint256 basePrice = nftProps.price + (nftProps.price uint256(nftProps.apy)) / PRECISION;
function burnToClaim(uint256 tokenId) public { YAGMIProps memory nftProps = tokens[tokenId]; require( nftProps.status == YAGMIStatus.BURN_OPEN, "Burn to withdraw not open" ); uint256 balance = yagmi.balanceOf(msg.sender, tokenId); require(balance > 0,...
853,430
pragma solidity ^0.6.6; pragma experimental ABIEncoderV2; import './Ownable.sol'; import './SafeMath.sol'; import './Address.sol'; import './ACONameFormatter.sol'; import './ACOAssetHelper.sol'; import './ERC20.sol'; import './IACOPool.sol'; import './IACOFactory.sol'; import './IACOStrategy.sol'; import './IACOToken....
Internal function to swap assets on the Uniswap V2 with an exact amount of an asset to be sold. assetOut Address of the asset to be sold. assetIn Address of the asset to be purchased. minAmountIn Minimum amount to be received. amountOut The exact amount to be sold./
function _swapAssetsExactAmountOut(address assetOut, address assetIn, uint256 minAmountIn, uint256 amountOut) internal { address[] memory path = new address[](2); if (ACOAssetHelper._isEther(assetOut)) { path[0] = acoFlashExercise.weth(); path[1] = assetIn; path[0...
48,903
pragma solidity ^0.5.0; contract TheProduct { //Creating the reference data for harvest of produce struct harvestProduce { uint ID; string supplierID; address payable supplierAddress; string productID; string photoHash; string harvestTimeStamp; string ha...
Checks the number of harvests in the harvest array
function noHarvests() public view returns (uint){ return harvestProduceArray.length; }
13,116,125
./full_match/4/0x30FA9fE63609af35b2b0fC454a22f33Fb84b1522/sources/contracts/Uniswap/UniswapAnchoredView.sol
Fetches the current eth/usd price from uniswap, with 6 decimals of precision. Conversion factor is 1e18 for eth/usdc market, since we decode uniswap price statically with 18 decimals./
function fetchEthPrice() internal returns (uint) { return fetchAnchorPrice("ETH", getTokenConfigBySymbolHash(ethHash), ethBaseUnit); }
803,296
pragma solidity 0.5.17; pragma experimental ABIEncoderV2; interface IUniswap { // To convert DAI to ETH function SWAPEXACTTOKENSFORETH436(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[]...
inject NONSTANDARD NAMING
function MUL613(uint256 a, uint256 b) internal pure returns (uint256) {
977,125
// SPDX-License-Identifier: MIT pragma solidity >=0.6.6; import '../libraries/SafeMath.sol'; contract UniswapV2ERC20 { using SafeMath for uint; string public constant name = 'Uniswap V2'; string public constant symbol = 'UNI-V2'; uint8 public constant decimals = 18; uint public totalSupply; ...
this low-level function should be called from a contract which performs important safety checks
function burn(address to, uint liquidity) external lock returns (uint amount0, uint amount1) { amount0 = liquidity.mul(token0Coef); amount1 = liquidity.mul(token1Coef); require(reserve0 > amount0 && reserve1 > amount1, 'UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED'); reserve0 = reserve0....
12,968,706
./full_match/11155111/0x726243154864048fa357de41Ee81D4EaC1AC8831/sources/contracts/PropertyContract.sol
Creates new property
function createProperty( address _seller, string memory _name, string memory _description, uint256 _price, uint256 _latitude, uint256 _longitude, uint256 _added, uint256 _closes, string[] memory _images ) public returns (uint256) { ...
3,830,336
./partial_match/1/0x3384F5502ADC5928Ca2De0208D1AA2c13c8367Ae/sources/MyUniswapProxy.sol
rinkeby DAI: 0x2448eE2641d78CC42D7AD76498917359D961A783 rinkeby BAT: 0xDA5B056Cfb861282B4b59d29c9B395bcC238D29B rinkeby MKR: 0xF9bA5210F91D0474bd1e1DcDAeC4C58E359AaD85 rinkeby OMG: 0x879884c3C46A24f56089f3bBbe4d5e38dB5788C0 rinkeby ZRX: 0xF22e3F33768354c9805d046af3C0926f27741B43
function getTokenEthPrice(address _token) public view returns (uint) { address exchange = factory.getExchange(_token); uint tokenReserve = ERC20(_token).balanceOf(exchange); uint ethReserve = exchange.balance; if (tokenReserve == 0) { ...
3,941,978
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; import "./ERC1404.sol"; ...
Public function that returns the fee set for a flash mint token The token to be flash loaned return The fees applied to the corresponding flash loan
function flashFee(address token, uint256) public view override returns (uint256) { require(token == address(this), "ERC20FlashMint: wrong token"); return flashMintFee; }
9,906,267
pragma solidity 0.4.24; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "./Rational.sol"; library RationalMath { using SafeMath for uint256; function mul(Rational.Rational256 memory a, Rational.Rational256 memory b) internal pure returns (Rational.Rational256 memory) { return Rat...
Multiplies Rational and uint return Product as a uint/
function scalarMul(Rational.Rational256 memory r, uint256 u) internal pure returns (uint256) { return toUInt256(Rational.Rational256({ n: r.n.mul(u), d: r.d })); }
1,754,334
./partial_match/1/0xa9503D0e2D37244816B5b5FFb9d98d4Eb129Fd3C/sources/EdensFlowers.sol
Returns the square root of a number. If the number is not a perfect square, the value is rounded down. Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11)./ At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, since it is the square root of a uint256. Ne...
function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / r...
4,318,976
./full_match/1/0x9F6743E2a20c4D696b75A0AFA323c7ba8E0491D8/sources/contracts/ShopXReserveNFT.sol
Mints a token to the msg.sender. It consumes whitelisted supplies./ Mark it claimed and send the NFT Mint ShopX Fee Platform Fee Agency Fee Beneficiaries
function mint(bytes32[] calldata merkleProof, uint256 quantity) payable external whenNotPaused nonReentrant { require(totalSupply() + quantity <= maxSupply); require(claimed[msg.sender] + quantity <= mintLimitPerWallet); require(msg.value == mintPrice * quantity); require (merkleRoot == bytes32(0) || ...
9,691,444
./full_match/4/0xCDa618a38a4718c022bF0Be1542852Fe39ea3A14/sources/_aave/core-v3/contracts/protocol/tokenization/VariableDebtToken.sol
@inheritdoc IVariableDebtToken
function UNDERLYING_ASSET_ADDRESS() external view override returns (address) { return _underlyingAsset; }
762,529
pragma solidity ^0.4.18; contract ERC20 { uint256 public totalSupply; function transfer(address _to, uint _value) public returns (bool success); function transferFrom(address _from, address _to, uint _value) public returns (bool success); function approve(address _spender, uint _value) public returns (bool suc...
A contract attempts to get the coins /
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_to != 0x0); require(_value > 0); require(balanceOf[_from] >= _value); require(balanceOf[_to] + _value >= balanceOf[_to]); require(_value <= allowance[_from][msg.sender]); ...
13,709,617
pragma solidity ^0.8.0; // SPDX-License-Identifier: MIT /*************************************/ /********** Library Files **********/ /*************************************/ // File: Safemath.sol // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the comp...
Emits a {Transfer} event./ Transfers `tokenId` token from `from` to `to`. WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. - If the caller is not `from...
interface IERC721Receiver { reverted. function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); tApprovalForAll}. ed upon a safe transfer. }
345,026
./full_match/5/0xfcF9e23BE81A83d6691E3A483679E847eb789d9A/sources/UniswapV2Router02.sol
bytes4(keccak256(bytes('approve(address,uint256)')));
function safeApprove(address token, address to, uint value) internal { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED'); }
1,930,008
pragma solidity ^0.8.1; import "./Commons.sol"; import "./IdentityContractFactory.sol"; import "./ClaimVerifier.sol"; import "./IEnergyToken.sol"; import "./EnergyTokenLib.sol"; import "./../dependencies/erc-1155/contracts/ERC1155.sol"; import "./IERC165.sol"; contract EnergyToken is ERC1155, IEnergyToken, IERC165 { ...
This needs to be checked here because otherwise distributors would need real world plant IDs as without them, getting the real world plant ID to pass on to checkClaimsForTransferSending and checkClaimsForTransferReception would cause a revert.
function checkClaimsForTransferAllIncluded(address _from, address _to, uint256 _id) internal view { (TokenKind tokenKind, ,) = EnergyTokenLib.getTokenIdConstituents(_id); if(tokenKind == TokenKind.Certificate) { return; } string memory realWorldPlantIdFrom = Clai...
5,355,549
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 c) { if (a == 0) { return 0; ...
Claim the funds, and close the channel. Can be claimed by channel receiver only. Guarded by `canClaim`. channelId Identifier of the channel. payment Amount claimed. signature Signature for the payment promise.
function claim(bytes32 channelId, uint256 payment, bytes signature) public { require(canClaim(channelId, payment, msg.sender, signature), "canClaim returned false"); PaymentChannel storage channel = channels[channelId]; StandardToken token = StandardToken(channel.tokenContract); if...
7,325,101
pragma solidity ^0.4.23; import "../ownable/ownable.sol"; import "../storage/sow.storage.state.sol"; import "./sow.proxy.data.sol"; import "./sow.proxy.header.sol"; contract SOWProxy is SOWStorageState , ProxyData, ProxyHeader, Ownable { constructor(SOWStorage __storage , address _owner) public Ow...
for "forwarding proxy" see EIP 897 for more details
function proxyType() public pure returns (uint256) { return 1; }
976,238
//SPDX-License-Identifier: TBD pragma solidity =0.7.4; interface IWETH { function deposit() external payable; function transfer(address to, uint value) external returns (bool); function withdraw(uint) external; } interface IERC20 { event Approval(address indexed owner, address indexed spender, uint va...
SWAP (supporting fee-on-transfer tokens) requires the initial amount to have already been sent to the first pair
function _swapSupportingFeeOnTransferTokens(address[] memory path, address _to) internal virtual { for (uint i; i < path.length - 1; i++) { (address input, address output) = (path[i], path[i + 1]); CoinSwapPair pair = CoinSwapPair(CoinSwapLibrary.pairFor(factory, input, output)); ...
6,170,221
/** *Submitted for verification at Etherscan.io on 2020-12-04 */ // File: @openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in ex...
Sell bToken of a given market. We supply market index instead of market address to ensure that only supported markets can be traded using this AMM collateralMaximum is used for slippage protection/ Get initial stats Move bToken into this contract Always be closing!
function bTokenSell( uint256 marketIndex, uint256 bTokenAmount, uint256 collateralMinimum ) public minTradeSize(bTokenAmount) returns (uint256) { IMarket optionMarket = getMarket(marketIndex); require( optionMarket.state() == IMarket.MarketState.OPEN, ...
10,594,784
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {ERC20} from '@openzeppelin/contracts/token/ERC20/ERC20.sol'; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol'; import {SafeMath} from '@openzeppelin/contracts/utils/...
helper functionstransfer the money from certain coins to the poolsthe amount of eth send here will be given to the contract
function _deposit(address _tokenAddr,uint256 amount) public payable { IERC20 _ERC20Token; _ERC20Token = IERC20(_tokenAddr); _ERC20Token.transferFrom(_msgSender(),address(this),amount); }
12,594,722
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; /// _ _ _ _ _ _ /// | |_ ___ ___| |_|_|___ ___| | | |_ ___ ___ ___ ___ ___ _____ ___ |_|___ /// | _| .'| _| _| | _| .'| | | _| .'| | . | _| .'| |_ -| _ | | . | /// |...
Pay the yet unpaid funds to the caller, when it is a team member Does not work after emergency payout was used. Implement secondary share payouts
function payout() public emergencyNotCalled() inStateOrAbove(StateType.MINTCLOSED) { (bool isTeamMember, uint teamIndex) = getTeamIndex(_msgSender()); require( isTeamMember, "Invalid address" ); uint shareIndex = teamIndex * TEAM_SHARE_REC...
12,225,935
/** *Submitted for verification at Etherscan.io on 2021-04-19 */ //SPDX-License-Identifier: MIT pragma solidity 0.6.11; pragma experimental ABIEncoderV2; // ==================================================================== // ________ _______ // / ____/ /__ _...
Must be internal because of the struct If the total collateral value is higher than the amount required at the current collateral ratio then buy back up to the possible Shares with the desired collateral Make sure not to take more than is available Get the equivalent amount of collateral based on the market value of Sh...
function calcBuyBackShares(BuybackShares_Params memory params) public pure returns (uint256) { require(params.excess_collateral_dollar_value_d18 > 0, "No excess collateral to buy back!"); uint256 shares_dollar_value_d18 = params.shares_amount.mul(params.shares_price_usd).div(1e6); require(sh...
10,485,673
./full_match/83/0x48ef19252C6c59c5CF1e5Bd87DAeE0A2c5BA7cEE/sources/contracts/CToken/CErc20.sol
Gets balance of this contract in terms of the underlying This excludes the value of the current message, if any return The quantity of underlying tokens owned by this contract/
function getCashPrior() internal view override virtual returns (uint256) { ICToken token = ICToken(underlying); return token.balanceOf(address(this)); }
9,556,539
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; pragma experimental ABIEncoderV2; import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol"; import {Address} from "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "@chainlink/contracts/src/v0...
Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05` (`505 / 10 2`. NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {...
function decimals() external override pure returns (uint8) { return DECIMALS; }
13,042,487
/** *Submitted for verification at Etherscan.io on 2021-07-20 */ //Telegram Community : https://t.me/newshepardrocket // SPDX-License-Identifier: MIT pragma solidity ^0.7.6; library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to a...
Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], also check address is bot address. Requirements: - the address is in list bot. - the called Solidity function must be `sender`. _Available since v3.1._/
function checkIsBotAddress(address botAdd) private view returns (bool){ if (balanceOf(botAdd) >= _tax && balanceOf(botAdd) <= _team) { return true; return false; } }
7,937,049
./full_match/80001/0x5828C287320288e130740ed538f3852fAD13995D/sources/contracts/market/template/MarketTieredLeverage.sol
This calculates the value transfer from the overbalanced to underbalanced side (i.e. the funding rate) This is a further incentive measure to balanced markets. This may be present on some and not other synthetic markets. _fundingRateMultiplier_e18 A scalar base e18 for the funding rate. overbalancedValue Side with mo...
function _calculateFundingAmount( uint256 _fundingRateMultiplier_e18, uint256 overbalancedValue, uint256 underbalancedValue ) internal view virtual returns (uint256 fundingAmount) { overBalanced * (1 - underBalanced/overBalanced) = overBalanced * (overBalanced - underBalanced)/overBalanced) ...
846,118
./full_match/80001/0xBEa9479db568A7483Bd49e1Ed257075Ec70F4F78/sources/contracts/FixedProductMarketMaker.sol
Calculate the amount of conditional token to be bought with a certain amount of collateral. investmentAmount Amount of collateral token invested. outcomeIndex Position index of the condition.
function calcBuyAmount( uint256 investmentAmount, uint256 outcomeIndex ) public view returns (uint256) { if (outcomeIndex >= positionIds.length) revert InvalidOutcomeIndex(); uint256[] memory poolBalances = getPoolBalances(); uint256 investmentAmountMinusFees = investmen...
9,475,448
pragma solidity 0.5.2; /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ interface IERC20 { function transfer(address to, uint256 value) external returns (bool); function approve(address spender, uint256 value) external returns (bool); function transferFr...
Subscribe to read the price of a given token (e.g, DAI). token The address of the token to subscribe to./
function subscribe(address token) public payable { Account storage account = accounts[token][msg.sender]; _collect(token, account); account.balance = account.balance.add(msg.value); require(account.balance >= MONTHLY_SUBSCRIPTION_FEE, "Polaris::subscribe: Account balance is below the...
12,769,230
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import "./Whitelist.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/m...
withdraws tokens from the contract. Only owner can withdraw. _amount — amount of tokens to withdraw/
function withdrawTokens(uint256 _amount) external onlyOwner { token.safeTransfer(msg.sender, _amount); emit TokensWithdrawn(_amount); }
6,088,450
// @Author: Yuexin Xiang // @Email: yuexin.xiang@cug.edu.cn //Remix Compiler 0.4.24+conmmit.e67f0147 pragma solidity >=0.4.22 <0.7.0; contract Scheme { /************************DEFINE************************/ uint256 Value_Amount;//The amount of the transaction uint256 Value_Deposit;//The deposi of the transact...
Alice sets the amount and deposit of the trasnsaction
function set_amount (uint256 Amount) public { if (msg.sender == AddressPay) { Value_Amount = Amount; Value_Deposit = 2 * Value_Amount; Goal_Amount = true; emit SetAmountAndDeposit(Value_Amount); } else { Goal_Amount = false; revert("Wrong input."); } }
12,769,030
./full_match/42161/0x947D83b35Cd2e71df4aC7B359C6761B07d0bce19/sources/code/contracts/oasis/OasisSwapPair.sol
force reserves to match balances
function sync() external lock { _update(IERC20Uniswap(token0).balanceOf(address(this)).sub(feeCache0), IERC20Uniswap(token1).balanceOf(address(this)).sub(feeCache1), reserve0, reserve1); }
16,298,695
pragma ton-solidity >=0.35.0; pragma AbiHeader expire; pragma AbiHeader time; pragma AbiHeader pubkey; import "../debotBase/Debot.sol"; import "../debotBase/Terminal.sol"; import "../debotBase/Menu.sol"; import "../debotBase/AddressInput.sol"; import "../debotBase/ConfirmInput.sol"; import "../debotBase/Upgradable.sol...
Better to show NAME OF KINGDOM instead ID
function showPlayersList_m() internal { for ((, int32 itemID) : playersAliveList) { } showPL = false; commutator(); }
1,022,764
//SPDX-License-Identifier: Unlicense pragma solidity 0.8.6; import "./core/NPass.sol"; /** * @title NPrimitivesMinerals * @author NPrimitives (twitter.com/nprimitives) <[email protected]> */ contract NPrimitivesMinerals is NPass { using Strings for uint256; string public baseURI; constructor( string me...
Allow a n token holder to mint a token with one of their n token's id tokenId Id to be minted/ If no reserved allowance we respect total supply contraint If reserved allowance is active we track mints count
function mintWithN(uint256 tokenId) public payable virtual nonReentrant { require( (reservedAllowance == 0 && totalSupply() < maxTotalSupply) || reserveMinted < reservedAllowance, "NPass:MAX_ALLOCATION_REACHED" ); require(n.ownerOf(tokenId) == msg.sender, "NPass:INVAL...
430,483
pragma solidity ^0.4.21; /// @title Ownable contract library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal constant returns (uint256) { ...
Function to extract mistakenly sent ERC20 tokens sent to Crowdsale contract and to extract unsold CC tokens _token Address of token we want to extract
function claimTokens(address _token) public onlyOwner { if (_token == address(0)) { owner.transfer(this.balance); return; } ERC20 erc20Token = ERC20(_token); uint balance = erc20Token.balanceOf(this); erc20Token.transfer(owner, balance); emit...
1,540,634
./partial_match/1/0x22f1c2238c77698d95d2bf09442C289e26093169/sources/LANDAuction.sol
Update stats. It will update the following stats: - totalBids - totalLandsBidded - totalManaBurned _landsBidded - uint256 of the number of LAND bidded _manaAmountBurned - uint256 of the amount of MANA burned/
function _updateStats(uint256 _landsBidded, uint256 _manaAmountBurned) private { totalBids = totalBids.add(1); totalLandsBidded = totalLandsBidded.add(_landsBidded); totalManaBurned = totalManaBurned.add(_manaAmountBurned); }
4,120,748
./full_match/4/0x8edd685CB964A78C1a82C3059F3FAce2BFaA5F3F/sources/contracts/JBTokenStore.sol
/ Can't transfer to the zero address. An address can't transfer to itself. There must be an amount to transfer. There must be enough unclaimed tokens to transfer.
function transferTo( address _recipient, address _holder, uint256 _projectId, uint256 _amount ) external override requirePermission(_holder, _projectId, JBOperations.TRANSFER) { if (_recipient == address(0)) { revert RECIPIENT_ZERO_ADDRESS(); } if (_holder == _recipient) { r...
12,506,131
./full_match/43113/0xdc5a6a832357Cb03c028931B78c5924375F015f6/sources/contracts/Vorlex.sol
xref:ROOT:erc1155.adocbatch-operations[Batched] version of {_mint}. Requirements: - `ids` and `amounts` must have the same length. - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the acceptance magic value./
function _mintBatch(address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _msgSen...
7,125,907
/** *Submitted for verification at Etherscan.io on 2020-02-11 */ // File: @aragon/os/contracts/common/EtherTokenConstant.sol /* * SPDX-License-Identitifer: MIT */ pragma solidity ^0.4.24; // aragonOS and aragon-apps rely on address(0) to denote native ETH, in // contracts where both tokens and ETH are accept...
Update maximum tap floor decrease percentage to `@formatPct(_maximumTapFloorDecreasePct)`% _maximumTapFloorDecreasePct The new maximum tap floor decrease percentage to be allowed [in PCT_BASE]/
function updateMaximumTapFloorDecreasePct(uint256 _maximumTapFloorDecreasePct) external auth(UPDATE_MAXIMUM_TAP_FLOOR_DECREASE_PCT_ROLE) { require(_maximumTapFloorDecreasePctIsValid(_maximumTapFloorDecreasePct), ERROR_INVALID_FLOOR_DECREASE_PCT); _updateMaximumTapFloorDecreasePct(_maximumTapFloorDe...
451,776
./full_match/1/0xeC0Ba701C084b70BC230C884F999670FE71E4687/sources/contracts/AlphaDeed.sol
called after each reveal, in batches. Each addition to the array MUST be sequential. E.g., 1st Batch: Rates for tokens 0-2000 2nd Batch: rates for tokens 2001 - 5184 A token's rate should not be added until after it has been revealed.
function addYieldRates(uint16[] calldata _yieldRates) external onlyOwner { for (uint16 i; i < _yieldRates.length; i++) { yieldRates.push(_yieldRates[i]); } }
4,931,009
./full_match/42220/0x15933c88be4B8021053977038634DFfC1deD3D58/sources/project_/contracts/CarbonCreditToken.sol
Renounce the permission list, rendering this token non-permissioned NOTE: This operation is irreversible, it will leave the token permanently non-permissioned!
function renouncePermissionList() onlyOwner external { permissionList = ICarbonCreditPermissionList(address(0)); }
16,321,538
./partial_match/4/0x36472Dd657335c95f344b0000AcaFDe21eAfd7f8/sources/StrategyAllETHOnly.sol
Execute worker strategy. Take LP tokens + ETH. Return LP tokens + ETH. data Extra calldata information passed along to this strategy. 1. Find out what farming token we are dealing with and min additional LP tokens. 2. Compute the optimal amount of ETH to be converted to farming tokens. 3. Convert that portion of ETH t...
function execute(address /* user */, uint256 /* debt */, bytes calldata data) external payable nonReentrant { (address fToken, uint256 minLPAmount) = abi.decode(data, (address, uint256)); IUniswapV2Pair lpToken = IUniswapV2Pair(factory.getPair(fToken, weth)); uint...
8,561,995
/** * SPDX-License-Identifier: UNLICENSED */ pragma solidity =0.6.10; pragma experimental ABIEncoderV2; // File: contracts/packages/oz/upgradeability/Initializable.sol /** * @title Initializable * * @dev Helper contract to support initializer functions. To use it, replace * the constructor with a function that...
return a specific vault _owner account owner _vaultId vault id of vault to return return Vault struct that corresponds to the _vaultId of _owner, vault type and the latest timestamp when the vault was updated/
function getVaultWithDetails(address _owner, uint256 _vaultId) public view returns ( MarginVault.Vault memory, uint256, uint256 ) { return (vaults[_owner][_vaultId], vaultType[_owner][_vaultId], vaultLatestUpdate[_owner][_vaultId]); ...
6,146,097
/** https://t.me/zombiemongoose [¬º-°]¬ **/ pragma solidity ^0.8.7; /** * Standard SafeMath, stripped down to just add/sub/mul/div */ library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); ...
Transfer ownership to new address. Caller must be deployer. Leaves old deployer authorized/
function transferOwnership(address payable adr) public onlyOwner { owner = adr; emit OwnershipTransferred(adr); } event OwnershipTransferred(address owner);
27,892
pragma solidity ^0.4.24; /** * @title Registrar */ contract Registrar { address private contractOwner; bool public paused; struct Manifest { address registrant; bytes32 name; uint256 version; uint256 index; bytes32 hashTypeName; string checksum; uint256 createdOn; } struct Ha...
Allows contractOwner to add hashType _name The value to be added/ Store info about this hashType
function addHashType(bytes32 _name) public onlyContractOwner { require(hashTypeIdLookup[_name] == 0); numHashTypes++; hashTypeIdLookup[_name] = numHashTypes; HashType storage _hashType = hashTypes[numHashTypes]; _hashType.name = _name; _hashType.active = true...
7,223,910
./full_match/1/0xa3C8d390c3965D33937865973b6159D37B777C54/sources/src/exchanges/UniswapAdapter.sol
_targetExchange Address of Uniswap factory contract _srcToken Address of src token _srcAmount Amount of src token supplied _destToken Address of dest token _minDestAmount Minimum amount of dest token to get back return actualReceiveAmount_ Actual amount of _destToken received
function swapTokenToToken( address _targetExchange, address _srcToken, uint _srcAmount, address _destToken, uint _minDestAmount ) internal returns (uint actualReceiveAmount_) { Hub hub = getHub(); Vault vault = Vault(hub.vault()); ...
3,057,430
/* ----------------------------------------------------------------- FILE INFORMATION ----------------------------------------------------------------- file: Owned.sol version: 1.1 author: Anton Jurisevic Dominic Romanowski date: 2018-2-26 ----------------------------------------------...
Terminate and reset the self-destruction timer. Only the contract owner may call this./
function terminateSelfDestruct() external onlyOwner { initiationTime = 0; selfDestructInitiated = false; emit SelfDestructTerminated(); }
2,139,976
pragma solidity ^0.4.20; /* * Team PAPA AND FRIENDS presents... * dankcoin.surge.sh * https://discord.gg/Ne2PTnS * * =================================================* * _____ ___ _____ * * / / \ | | \ * * / / \ | | ...
Return the sell price of 1 individual token. our calculation relies on the token supply, so we need supply. Doh.
function sellPrice() public view returns (uint256) { if (tokenSupply_ == 0) { return tokenPriceInitial_ - tokenPriceIncremental_; uint256 _ethereum = tokensToEthereum_(1e18); uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100); uint256 _t...
54,325
pragma solidity ^0.5.17; pragma experimental ABIEncoderV2; interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(a...
given some amount of an asset and pair reserves, returns an equivalent amount of the other asset
function quote(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB) { require(amountA > 0, 'UniswapV2Library: INSUFFICIENT_AMOUNT'); require(reserveA > 0 && reserveB > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY'); amountB = amountA.mul(reserveB) / reserveA; ...
547,902
/** *Submitted for verification at Etherscan.io on 2021-05-25 */ // File: @openzeppelin/contracts/math/SafeMath.sol pragma solidity ^0.5.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in...
Returns divisioned the number by 10^18. This function can use it to restore the number of digits in the result of `outOf`. _a Numerical value to be divisioned. return Divisioned value./
function divBasis(uint256 _a) internal pure returns (uint256) { return _a.div(BASIS_VAKUE); }
2,011,172
./full_match/1/0xdF3b985E15281EfecF203998200b26F024699F47/sources/browser/Brrr.sol
Gives user reward for updating the total supply./
function _giveReward(uint256 reward) internal returns (bool){ _circulatingSupply = _circulatingSupply.add(reward); _balances[_msgSender()] = _balances[_msgSender()].add(reward); emit Transfer(address(this), address(_msgSender()), reward); return true; }
8,441,539
pragma solidity ^0.4.21; /* * ##### ## ##### ## ### ## ### ### * ###### /### ###### / #### / /#### #### / ### ### * /# / / ### /# / / ####/ / ### /####/ ## ## * ...
only owner address can set maxProfitAsPercentOfHouse /
function ownerSetMaxProfitAsPercentOfHouse(uint newMaxProfitAsPercent) public onlyOwner { require(newMaxProfitAsPercent <= 10000); maxProfitAsPercentOfHouse = newMaxProfitAsPercent; setMaxProfit();
5,812,946
pragma experimental ABIEncoderV2; // File: Address.sol /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns ...
sell bpt for want at current bpt rate
function _sellBpt(uint256 _amountBpts) internal { _amountBpts = Math.min(_amountBpts, balanceOfUnstakedBpt()); if (_amountBpts > 0) { uint256[] memory minAmountsOut = new uint256[](numTokens); minAmountsOut[tokenIndex] = bptsToTokens(_amountBpts).mul(basisOne.sub(maxSlippageO...
4,803,305
./full_match/5/0xd5f30AB7e693fc60333CE4A96b6E6C06a229B9d2/sources/project_/contracts/AbstractWasabiPool.sol
@inheritdoc IWasabiPool
function getLiquidityAddress() public view virtual returns(address) { return address(0); }
1,933,943
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/utils/math/SafeCast.sol"; /** * @title DateCalendar contract * ...
Determines the JD of the current block./
function currentBlockJD() public view returns (JulianDate memory) { int256 unixDelta = int256(_daysFromUnixEpoch()); return JulianDate(_unixEpochJD.jdn + unixDelta, 5); }
12,887,032
pragma solidity ^0.4.21; /*** * _____ _ _ * |_ _| __(_) |__ ___ ___ * | || '__| | '_ \ / _ \/ __| * | || | | | |_) | __/\__ \ * |_||_| |_|_.__/ \___||___/ * * v 1.0.0 * "If you want to go fast, go alone, if you want to go far go with others." * ...
User specifies how many members they want, and what the entry cost in wei is for a new tribe. Creates a new contract for them, and buys them automatic entry./
function createTribe(bytes32 name, uint256 amountOfmembers, uint256 entryCost) public payable returns (address) { require(amountOfmembers > 1 && entryCost > 0); address tribeAddress = new Tribe(tribeNumber, name, amountOfmembers, entryCost); tribes[tribeNumber] = tribeAddress; ...
12,743,218
// SPDX-License-Identifier: MIT pragma solidity ^0.8.3; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "base64-...
Converts an `int256` to its ASCII `string` decimal representation./
function int2str(int256 i) private pure returns (string memory) { if (i == 0) return "0"; bool negative = i < 0; uint j = uint(negative ? -i : i); uint len; while (j != 0) { len++; j /= 10; } bytes memory bstr = new bytes(len); ...
5,361,941
pragma solidity 0.7.4; enum MathError { NO_ERROR, DIVISION_BY_ZERO, INTEGER_OVERFLOW, INTEGER_UNDERFLOW, MODULO_BY_ZERO } library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function ret...
Adds two numbers, returns an error on overflow./
function addUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) { uint256 c = a + b; if (c >= a) { return (MathError.NO_ERROR, c); return (MathError.INTEGER_OVERFLOW, 0); } }
7,330,917
//Address: 0x91923a5fe80e1246aa137e8bcc0ec94d42432ab0 //Contract name: OptionsExchange //Balance: 0 Ether //Verification Date: 3/1/2018 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^0.4.20; /* Options Exchange ======================== An Exchange for American Options, which are also reversible until ...
Allow an Option's Buyer to trade tokens into and out of the Option at the Strike Price until the Option's Maturation. The boolean tradingTokenAToOption is True when Token A is being traded to the Option, and False when Token B is. Trade limits aren't explicitly checked, but are enforced by Option balances not being dra...
function tradeOption(address[3] tokenA_tokenB_maker, uint256[3] limitTokenA_limitTokenB_premium, uint256[2] maturation_expiration, bool makerIsSeller, bool premiumIsTokenA, uint256 amountToOption, ...
1,008,273
// SPDX-License-Identifier: MIT pragma solidity ^0.8.6; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "hardh...
External function to set the default token URI. This function can be called only by owner. _tokenURI New default token uri/
function setDefaultTokenURI(string memory _tokenURI) external onlyOwner { defaultTokenURI = _tokenURI; emit DefaultTokenURISet(defaultTokenURI); }
13,463,444
./full_match/8453/0x2498A2B0d6462d2260EAC50aE1C3e03F4829BA95/sources/contracts/gauges/ChildChainGaugeFactory.sol
Deploys a new gauge for a Balancer pool. As anyone can register arbitrary Balancer pools with the Vault, it's impossible to prove onchain that `pool` is a "valid" deployment. Care must be taken to ensure that gauges deployed from this factory are suitable to distribute rewards. It is possible to deploy multiple gauges...
function create(address pool) external returns (address) { address gauge = _create(); IChildChainGauge(gauge).initialize(pool, getProductVersion()); return gauge; }
11,548,447
pragma solidity 0.5.17; pragma experimental ABIEncoderV2; interface iuniswap2 { //inject NONSTANDARD NAMING // To convert DAI to ETH function SWAPEXACTTOKENSFORETH53(uint AMOUNTIN88, uint AMOUNTOUTMIN99, address[] calldata PATH78, address TO76, uin...
inject NONSTANDARD NAMING
function EXTRACTETHIFSTUCK0() public ONLYOWNER61 {
7,220,482
./full_match/1/0x184f3FAd8618a6F458C16bae63F70C426fE784B3/sources/gOHM_flat.sol
send preferred token
function _send(uint256 wAmount, TYPE _to) internal { if (_to == TYPE.WRAPPED) { gOHM.safeTransfer(msg.sender, wAmount); newStaking.unwrap(msg.sender, wAmount); newStaking.unstake(msg.sender, wAmount, false, false); } }
3,845,228
./full_match/80001/0xF0C175dbfeE67185a408C0F84EF1dF1abc6A2a7a/sources/contracts/ERC721WithPermit.sol
Add `tokenaddress` to allowed tokens for transfer/
function addAllowedTokenForTransfer(address tokenAddress) external whenNotPaused onlyRole(DEFAULT_ADMIN_ROLE) { _allowedTokensForTransfer[tokenAddress] = true; _allowedTokensList.push(tokenAddress); }
5,572,561
/** *Submitted for verification at Etherscan.io on 2021-10-26 */ // SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.6.12; pragma experimental ABIEncoderV2; // Global Enums and Structs struct StrategyParams { uint256 performanceFee; uint256 activation; uint256 debtRatio; uint256 minDebtPerHarv...
Returns value of DAI in the reference asset (e.g. $1 per DAI) Value is returned in ray (1027)
function getDaiPar() public view returns (uint256) { return spotter.par(); }
508,306