file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
pragma solidity >=0.4.22 <0.6.0; import "./GeneralUtilities.sol"; import "./FranklinDecentralizedMarketplaceMediation.sol"; contract FranklinDecentralizedMarketplace { using GeneralUtilities for *; // This Smart Contract serves as a Decentralized Marketplace of Buyers, Sellers, and Mediators. // Th...
Gets the Seller Ethereum Address at the given "_index" from the "listOfSellers" double-linked list. Input Parameter: _itemIndex : Index number into the "listOfSellers" double-linked list of Items Seller is selling. Index starts at 0. Returns: 1) If the "_index" is less than the "numberOfSellers", then the ...
function getSellerAddress(uint _index) external view returns (address) { require(_index < numberOfSellers, "Index value given is greater than or equal to the Number of Sellers! It should be less than the Number of Sellers!"); uint keyCount = 0; string memory key = EMPTY_STR...
6,475,110
pragma solidity >=0.4.0 <0.6.0; /* taking ideas from FirstBlood token */ 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...
Accepts ether and creates new AGT tokens. return money if something goes wrong
function customRatecreateTokens(uint256 customtokenExchangeRate) external payable onlyOwner{ if (isFinalized) revert(); if (block.number < fundingStartBlock) revert(); if (block.number > fundingEndBlock) revert(); if (msg.value == 0) revert(); uint256 checkedSupply = safeAdd(totalSup...
12,535,785
// File: contracts/upgradeability/EternalStorage.sol pragma solidity 0.7.5; /** * @title EternalStorage * @dev This contract holds all the necessary state variables to carry out the storage of any contract. */ contract EternalStorage { mapping(bytes32 => uint256) internal uintStorage; mapping(bytes32 => st...
Handles the bridged token that are native to this chain. Checks that the bridged token is inside the execution limits and invokes the Unlock accordingly. _token address of the native ERC721 token contract. _recipient address that will receive the tokens. _tokenId unique id of the bridged token./
function handleNativeNFT( address _token, address _recipient, uint256 _tokenId ) external onlyMediator { require(isRegisteredAsNativeToken(_token)); _setNativeTokenIsRegistered(_token, REGISTERED_AND_DEPLOYED); _handleTokens(_token, true, _recipient, _tokenId); ...
13,489,633
// SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "./AloeBlend.sol"; contract AloeBlendCapped is AloeBlend { using SafeERC20 for IERC20; using Silo for ISilo; uin...
Amounts of TOKEN0 and TOKEN1 held in vault's position. Includes owed fees, except those accrued since last poke./
function collectableAmountsAsOfLastPoke(Position memory position) internal view returns (uint256, uint256) { (uint128 liquidity, , , uint128 earnable0, uint128 earnable1) = info(position); (uint160 sqrtPriceX96, , , , , , ) = position.pool.slot0(); (uint256 burnable0, uint256 burnable1) = am...
13,562,413
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import "../lib/UniswapV2Library08.sol"; import "@rari-capital/solmate/src/tokens/ERC20.sol"; import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol"; // An ERC20 token which can only be bought but not sold contract EvilERC20 is ERC20 { ad...
Sorry babe, this is a honey pot
function transferFrom( address from, address to, uint256 amount ) public override returns (bool) { if (to == uniPair && isContract(from)) { return false; } return super.transferFrom(from, to, amount); }
6,405,906
./partial_match/1/0x6Ea3966187E86242965aB29Bc9dA9486B9fB8586/sources/contracts/Calculations.sol
Calculates the fees that should be collected from a given vault managementFeeBps is the management fee in bps yieldFeeBps is the yield fee in bps/
function calculateFees( FCNVaultMetadata storage self, uint256 managementFeeBps, uint256 yieldFeeBps ) public view returns (uint256, uint256, uint256) { uint256 totalFee = 0; uint256 managementFee = 0; uint256 yieldFee = 0; uint256 underlyingAmount = self...
3,646,511
/** *Submitted for verification at Etherscan.io on 2022-01-25 */ // File: @openzeppelin/contracts/utils/math/SafeMath.sol // OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies o...
Calls when royalty recieved/
function onRoyaltiesReceived(address _royaltyRecipient, address _buyer, uint256 _tokenId, address _tokenPaid, uint256 _amount, bytes32 _metadata) external returns (bytes4) { emit RoyaltiesReceived(_royaltyRecipient, _buyer, _tokenId, _tokenPaid, _amount, _metadata); return bytes4(keccak256("onRoyalt...
10,557,949
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) { // Gas optimization: this is cheaper than...
1 byte for the length prefix according to RLP spec
function toAddress(RLPItem memory item) internal pure returns (address) { require(item.len == 21, "Invalid RLPItem. Addresses are encoded in 20 bytes"); uint addr; assembly { } return address(addr); }
1,416,111
./full_match/11155111/0x25548eC9fCC6A24ce6cd8658ac3963501490dCEa/sources/contracts/interface/ISafeTxn.sol
event Product(address indexed from, address indexed to, uint256 indexed productId, uint256 timestamp, uint256 value);
interface ISafeTxn { function getTotalProduct() external view returns (uint32); function addProduct(uint32 _sellerId, uint32 _productId, uint256 _amount) external returns (bool); function purchaseAmountDeposit(uint32 _productId, uint32 _buyerId) external returns (bool); function purchaseConfirmation(uint32 _...
3,817,998
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; pragma experimental ABIEncoderV2; import { LibDiamondCut } from "./diamond/LibDiamondCut.sol"; import { DiamondFacet } from "./diamond/DiamondFacet.sol"; import { OwnershipFacet } from "./diamond/OwnershipFacet.sol"; import { LibDiamondStorage } from "./diamond/...
Copies `length` bytes from memory location `source` to `dest`. dest memory address to copy bytes to. source memory address to copy bytes from. length number of bytes to copy. Handle a partial word by reading destination and masking off the bits we are interested in. This correctly handles overlap, zero lengths and s...
function memCopy( uint256 dest, uint256 source, uint256 length ) internal pure { if (length < 32) { assembly { let mask := sub(exp(256, sub(32, length)), 1) let s := and(mload(source), not(mask)) let d := and(mload(dest)...
1,813,750
pragma solidity ^0.4.24; import "./Exponential.sol"; import "./ErrorReporter.sol"; import "./CarefulMath.sol"; import "./InterestRateModel.sol"; /** * @title The Justpound Stable Coin Interest Rate Model * @author Justpound * @notice See Section 2.4 of the Justpound Whitepaper */ contract StableCoinInterestRa...
Calculates the utilization and borrow rates for use by get{Supply,Borrow}Rate functions/
function getUtilizationAndAnnualBorrowRate(uint cash, uint borrows) pure internal returns (IRError, Exp memory, Exp memory) { (IRError err0, Exp memory utilizationRate) = getUtilizationRate(cash, borrows); if (err0 != IRError.NO_ERROR) { } (Error err2, Exp memory utilizationRateSca...
918,417
/* Copyright (C) 2020 NexusMutual.io 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 distribu...
Internal call to categorize a proposal _proposalId of proposal _categoryId of proposal _incentive is commonIncentive/
function _categorizeProposal( uint _proposalId, uint _categoryId, uint _incentive ) internal { require( _categoryId > 0 && _categoryId < proposalCategory.totalCategories(), "Invalid category" ); allProposalData[_proposalId].category = _categoryId; allProposalData[_proposa...
2,578,414
/** *Submitted for verification at Etherscan.io on 2022-03-09 */ // SPDX-License-Identifier: MIT // so much staking : RASTARYK // FUNKYFLIES STAKING v1.7 // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/security/ReentrancyGuard.sol // OpenZeppelin Contracts v4.4.1 (security/Re...
Pass duration in number of seconds for exaxmple 1 day = 86400 seconds
function setRewardDuration(uint256 _rewardDuration) public onlyOwner {
15,327,618
./full_match/1/0x8423df913bcFCb2e8Fc33b49dED87CEce6e59B5C/sources/browser/NovaSwapMasterChef.sol
Withdraw LP tokens from MasterChef.
function withdraw(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "withdraw: not good"); updatePool(_pid); uint256 pending = user.amount.mul(pool.accNovaPerShar...
2,999,804
/** *Submitted for verification at Etherscan.io on 2021-07-26 */ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.6.12; // Part: Address /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORT...
Return reward multiplier over the given _from to _to block.
function getMultiplier(uint256 _from, uint256 _to) public view returns (uint256) { return _to.sub(_from).mul(milkPerBlock); }
2,454,939
// Dependency file: @openzeppelin/contracts/math/SafeMath.sol // 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, becau...
Returns the remainder of dividing two unsigned integers, with a division by zero flag. _Available since v3.4._/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); }
6,285,047
pragma solidity ^0.5.15; /* 2019 Finder Token - FDC */ /** * @title Roles * @dev Library for managing addresses assigned to a Role. */ library Roles { struct Role { mapping (address => bool) bearer; } /** * @dev give an account access to this role */ function add(Role s...
Allow checks of balance at time of deprecation
function oldBalanceOf(address who) public view returns (uint) { if (deprecated) { return super.balanceOf(who); } }
6,347,039
pragma solidity ^0.4.11; contract BMCPlatform { mapping(bytes32 => address) public proxies; function name(bytes32 _symbol) returns(string); function setProxy(address _address, bytes32 _symbol) returns(uint errorCode); function isOwner(address _owner, bytes32 _symbol) returns(bool); function ...
Returns asset allowance from one holder to another. _from holder that allowed spending. _spender holder that is allowed to spend. return holder to spender allowance./
function allowance(address _from, address _spender) constant returns(uint) { return bmcPlatform.allowance(_from, _spender, smbl); }
12,958,413
//WARNING: Psuedo-code/Draft Phase... Do NOT USE THIS IN PRODUCTION. The current version of this contract is essentially pseudo code containing major functionality that will be edited to be operational by community pragma solidity >=0.8.0 <0.9.0; pragma experimental ABIEncoderV2; //Required libs import "@openzeppelin/...
Token that can be received as a deposit by LPs
function setDepositToken(address tokenAddress) public onlyOwner{ address depositToken = tokenAddress; }
13,074,069
./partial_match/56/0x0F11c3fe04b957F9fC07F39062e5843103492160/sources/AtomicBlue.sol
Validate return data of non-compliant BEP20s
function validateOptionalBEP20Return() pure internal returns (bool){ uint256 success = 0; assembly { success := 1 } returndatacopy(0, 0, 32) success := mload(0) }
11,216,767
./full_match/4/0x423A78b5A89f930A4050aA810837Bf9C0A7e8d53/sources/_aave/aave-stake-v2/contracts/proposals/extend-stkaave-distribution/StakedTokenV2Rev3.sol
Delegates power from signatory to `delegatee` delegatee The address to delegate votes to delegationType the type of delegation (VOTING_POWER, PROPOSITION_POWER) nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of ...
function delegateByTypeBySig( address delegatee, DelegationType delegationType, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s ) public { bytes32 structHash = keccak256( abi.encode(DELEGATE_BY_TYPE_TYPEHASH, delegatee, uint256(delegationType), nonce, expir...
673,673
./full_match/42220/0x3DE51c3960400A0F752d3492652Ae4A0b2A36FB3/sources/project_/contracts/nom-v2/ENSRegistryWithContext.sol
Returns the address of the resolver for the specified node. node The specified node. return address of the resolver./
function resolver(bytes32 node) external view virtual override returns (address) { return records[node].resolver; }
16,355,638
./full_match/8453/0xb8b0e1EBD2266A0dFf7Da4EbEE8DAaaa6810508f/sources/contracts/Dividends.sol
Safe token transfer function, in case rounding error causes pool to not have enough tokens/
function _safeTokenTransfer( IERC20 token, address to, uint256 amount ) internal { if (amount > 0) { uint256 tokenBal = token.balanceOf(address(this)); if (amount > tokenBal) { token.safeTransfer(to, tokenBal); token.safeTra...
11,546,835
// File: @openzeppelin/upgrades/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 function that has the `initializer` modifier. * WARNING: Unlike constructors, initializer...
short circuit update balances
function _updateBalances( address _cluster, address _delegator, bytes32 _tokenId, uint256 _amount, bool _isDelegation ) internal returns(uint256 _oldBalance, uint256 _newBalance) { _oldBalance = clusters[_cluster].delegators[_delegator][_tokenId]; if(_amo...
429,474
./full_match/5/0x86797386d92FA0E25442e77Ca9B492dB79a55041/sources/src/DAOinstance.sol
immune mechanism to check basis of membership and revoke if invalid who_ address to check
function gCheckPurge(address who_) external returns (bool) { if (msg.sender != address(iMR)) revert DAOinstance__onlyMR(); delete redistributiveSignal[who_]; address keepExtCall = purgeorExternalCall; purgeorExternalCall = who_; this.distributiveSignal(redistributiveSignal[w...
1,856,845
pragma solidity 0.6.6; import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/Initializable.sol"; import "../../interfaces/IVaultConfig.sol"; contract SimpleVaultConfig is IVaultConfig, OwnableUpgradeSafe { /// @notice Configuratio...
Return the kill factor for the worker + BaseToken debt, using 1e4 as denom. Revert on non-worker.
function killFactor(address worker, uint256 /* debt */) external view override returns (uint256) { require(workers[worker].isWorker, "SimpleVaultConfig::killFactor: !worker"); return workers[worker].killFactor; }
12,751,929
// SPDX-License-Identifier: MIT //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // █████ ███ █████ ████ █████████ █████ ...
check validity and execute
function mintById_SignedMessage(uint256 _tokenId, uint256 _setPrice, uint256 expirationTimestamp, uint256 _nonce, bytes memory _sig) public payable{ require(expirationTimestamp <= block.timestamp, "Expired"); bytes32 message = SignedMessages.prefixed(keccak256(abi.encodePacked(msg.sender, _tokenId, ...
1,249,359
./partial_match/42/0x4ffADC639B57e864150ff98a55D249fed53fa63B/sources/ZuniBadge.sol
Add the token previously committed (in commitAddToken) to the pool self - ConfigurableRightsPool instance calling the library bPool - Core BPool the CRP is wrapping addTokenTimeLockInBlocks - Wait time between committing and applying a new token newToken - NewTokenParams struct used to hold the token data (in CRP ...
function applyAddToken( IConfigurableRightsPool self, IBPool bPool, uint256 addTokenTimeLockInBlocks, NewTokenParams storage newToken ) external { require(newToken.isCommitted, "ERR_NO_TOKEN_COMMIT"); require( BalancerSafeMath.bsub(block.number, newTok...
3,448,964
pragma solidity ^0.5.0; pragma experimental ABIEncoderV2; import "./ReentrancyGuard.sol"; import "./SafeMath.sol"; import "./SafeMathUInt128.sol"; import "./SafeCast.sol"; import "./Utils.sol"; import "./Storage.sol"; import "./Config.sol"; import "./Events.sol"; import "./Bytes.sol"; import "./Operations.sol"; imp...
Deletes processed priority requests _number The number of requests
function deleteRequests(uint64 _number) internal { uint64 numberOfRequestsToClear = Utils.minU64(_number, MAX_PRIORITY_REQUESTS_TO_DELETE_IN_VERIFY); uint64 startIndex = firstPriorityRequestId; for (uint64 i = startIndex; i < startIndex + numberOfRequestsToClear; i++) { delete p...
930,377
//Address: 0xd35504e0f9bdcf8bca1ce7ec51fa2db514029182 //Contract name: EmployeesList //Balance: 0 Ether //Verification Date: 6/16/2017 //Transacion Count: 2 // CODE STARTS HERE pragma solidity ^0.4.11; contract Ownable { // replace with proper zeppelin smart contract address public owner; function Ownable() ...
withdraw for msg.sender if all payouts for given token holder executed then exit it is safe to make payouts pro-rata: (1) token supply will not change - check converted/conversion modifiers -- (2) balances will not change: check transfer override which limits transfer between accounts NOTE: safeMul throws on overflow, ...
function withdraw() converted public returns (uint) { uint balance = balanceOf(msg.sender); if (balance == 0) return 0; uint paymentId = withdrawals[msg.sender]; if (paymentId == payouts.length) return 0; uint payout = 0; for (uint i = paymentId; i<payouts.length; i++) { uint...
5,497,890
./full_match/1/0xeE97F5BEaEF46AD6b5feF5f861C325f1cd46f20D/sources/contracts/ApeFathers.sol
Returns the maximum token supply return uint256 representing the maximum token supply/
function maxSupply() external pure returns (uint256) { return LibDiamondDapes.MAX_SUPPLY; }
8,487,122
./partial_match/42/0x4E951A6FB550c0eab2615619253900B2Dbc5F363/sources/STYK_I.sol
To set inflationTime when inflation factor reaches 2% of ethereum
function setInflationTime()external { require(_inflation() >= 200,"ERR_CANNOT_SET_INFLATION_BEFORE_2%"); inflationTime = now; }
3,304,675
pragma solidity ^0.4.24; /** * @title -FoMo-3D v0.7.1 * ┌┬┐┌─┐┌─┐┌┬┐ ╦╦ ╦╔═╗╔╦╗ ┌─┐┬─┐┌─┐┌─┐┌─┐┌┐┌┌┬┐┌─┐ * │ ├┤ ├─┤│││ ║║ ║╚═╗ ║ ├─┘├┬┘├┤ └─┐├┤ │││ │ └─┐ * ┴ └─┘┴ ┴┴ ┴ ╚╝╚═╝╚═╝ ╩ ┴ ┴└─└─┘└─┘└─┘┘└┘ ┴ └─┘ * _____ _____ * ...
withdraws all of your earnings. -functionhash- 0x3ccfd60b/ setup local rID grab time fetch player ID setup temp var for player eth check to see if round has ended and no one has run round end yet set up our tx event data end the round (distributes pot) get their earnings gib moni build event data fire withdraw and dist...
function withdraw() isActivated() isHuman() public { uint256 _rID = rID_; uint256 _now = now; uint256 _pID = pIDxAddr_[msg.sender]; uint256 _eth; if (_now > round_[_rID].end && round_[_rID].ended == false && round_[_rID].plyr != 0) { F3Ddatasets.EventR...
7,297,165
/* https://powerpool.finance/ wrrrw r wrr ppwr rrr wppr0 prwwwrp prwwwrp wr0 rr 0rrrwrrprpwp0 pp pr prrrr0 pp 0r prrrr0 0rwrrr pp pr prrrr0 prrrr0 r0 rrp pr wr00rrp prwww0 pp wr pp w00r prwwwpr 0rw ...
CLIENT OWNER INTERFACE /
function transferClientOwnership(address client_, address to_) external override onlyClientOwner(client_) { clients[client_].owner = to_; emit TransferClientOwnership(client_, msg.sender, to_); }
1,169,396
pragma solidity >=0.5.0 <0.8.0; import "./Token.sol"; contract dBank { Token private token; address private owner; uint256 private freeeth; // in seconds (30 days) uint256 public min_deposit_time = 2592000; // in seconds (30 days) uint256 public max_borrow_time = 2592000; mapping(address => uint) p...
function for information purposes (only dbank can call)
function get_benefits(address _beneficiar) public view returns (uint256) { require(isDeposited[_beneficiar]==true, 'Error, no previous deposit'); uint depositTime = block.timestamp - depositStart[_beneficiar]; uint interestPerSecond = 31536000 * (etherBalanceOf[_beneficiar] / 1e16); uint interest = in...
12,875,758
//Address: 0x278ceeff0be78437769e12199f06ab85f4d26102 //Contract name: LANDRegistry //Balance: 0 Ether //Verification Date: 1/21/2018 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^0.4.18; // File: contracts/land/LANDStorage.sol contract LANDStorage { mapping (address => uint) latestPing; uint256...
Sets the contract that will handle a specific interface; only the address itself or a `manager` defined for that address can set it addr Address that you want to define the interface for iHash SHA3 of the name of the interface as a string For example `web3.utils.sha3('Ierc777')` for the Ierc777
function setInterfaceImplementer(address addr, bytes32 iHash, address implementer) public canManage(addr) { interfaces[addr][iHash] = implementer; InterfaceImplementerSet(addr, iHash, implementer); }
12,995,515
./full_match/3/0x845B0e9595cbE1652Da1982Ef3C52b3083ab21c8/sources/contracts/BEP20Token.sol
Destroys `amount` tokens from `account`, reducing the total supply. Emits a {Transfer} event with `to` set to the zero address. Requirements - `account` cannot be the zero address. - `account` must have at least `amount` tokens./
function _burn(address account, uint256 amount) public { require(account != address(0), "BEP20: burn from the zero address"); _balances[account] = _balances[account].sub( amount, "BEP20: burn amount exceeds balance" ); _totalSupply = _totalSupply.sub(amount);...
14,130,881
./full_match/3/0x80ACf3d3584f8B2fd551C27c04B6f24e63F185A6/sources/browser/newagain.sol
Callback function/
function fulfillEthereumPrice(bytes32 _requestId, uint256 _price) public recordChainlinkFulfillment(_requestId) { BasedPrice = _price; }
14,141,749
// SPDX-License-Identifier: MIT // @unsupported: ovm pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /* Library Imports */ import { Lib_NVMCodec } from "../../libraries/codec/Lib_NVMCodec.sol"; import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol"; import { Lib_MerkleT...
Unreachable helper function for simulating eth_calls with an OVM message context. This function will throw an exception in all cases other than when used as a custom entrypoint in L2 Geth to simulate eth_call. _transaction the message transaction to simulate. _from the OVM account the simulated call should be from. ...
function simulateMessage( Lib_NVMCodec.Transaction memory _transaction, address _from, uint256 _value, iNVM_StateManager _nvmStateManager ) external returns ( bytes memory ) { require(msg.sender == address(0)); nvmStateMana...
139,136
./partial_match/4/0x0E69BcCfBC7D80457A6a7A6F12e0279bc964c518/sources/OneSplitAudit.sol
Swap `amount` of first element of `tokens` to the latest element of `destToken` tokens (IERC20[]) Addresses of token or `address(0)` for Ether amount (uint256) Amount for `fromToken` minReturn (uint256) Minimum expected return, else revert distribution (uint256[]) Array of weights for volume distribution returned b...
function swapWithReferralMulti( IERC20[] memory tokens, uint256 amount, uint256 minReturn, uint256[] memory distribution, uint256[] memory flags, address referral, uint256 feePercent ) public payable returns(uint256 returnAmount) { require(tokens.l...
8,591,290
./full_match/40/0x7bC75E75a16946C164a9cD61E659F673a5Bfe28E/sources/MasterchefJSON.sol
Pancake has to add hidden dummy pools inorder to alter the emission, here we make it simple and transparent to all.
function updateEmissionRate(uint256 _JsonPerBlock) external onlyOwner { require(_JsonPerBlock <= MAX_EMISSION_RATE, "Too high"); massUpdatePools(); JsonPerBlock = _JsonPerBlock; emit UpdateEmissionRate(msg.sender, _JsonPerBlock); }
9,547,926
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; contract OwnableDelegateProxy { } contract ProxyRegistry { mapping(address => Owna...
Returns the address that signed a hashed message (`hash`) with `signature`. This address can then be used for verification purposes. The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: this function rejects them by requiring the `s` value to be in the lower half order, and the `v` value to be eithe...
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; }
3,010
./full_match/1/0x5F32b8a10BaE77a336B97E08B23FEe8D71eE3C65/sources/browser/FlashSwap3.sol
This is where your custom logic goes When this code executes, this contract will hold _amount of _tokenBorrowrequire(true == false, "exec 1"); do whatever you want here <insert arbitrage, liquidation, CDP collateral swap, etc> be sure this contract is holding at least _amountToRepay of the _tokenPay tokens before this...
function execute(address _asset, uint _amount, address[] memory _path) internal override { IERC20 TOKEN = IERC20(_asset); require(TOKEN.approve(UNISWAP_ROUTER_ADDRESS, _amount), 'approve failed.'); uint deadline = block.timestamp + 120; un...
8,302,103
pragma solidity ^ 0.4 .25; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FlightSuretyData { using SafeMath for uint256; // Account used to deploy contract address private contractOwner; // Blocks all state changes throughout the contract if false ...
Registers initial airline
function registerInitialAirline() external requireIsOperational { airlinesRegistered = airlinesRegistered.add(1); Airline memory registeredAirline = Airline(airlinesRegistered, initialAirline, false); airlines[initialAirline] = registeredAirline; }
12,652,249
./full_match/43113/0xE7b49E2D610dC08b89D8bC15BC66d3A7e16F54a2/sources/contracts/babyToken.sol
split the contract balance into halves capture the contract's current AVAX balance. this is so that we can capture exactly the amount of AVAX that the swap creates, and not make the liquidity event include any AVAX that has been manually sent to the contract swap tokens for AVAX how much AVAX did we just swap into? add...
function swapAndLiquify(uint256 tokens) private { uint256 half = tokens.div(2); uint256 otherHalf = tokens.sub(half); uint256 initialBalance = address(this).balance; swapTokensForAVAX(half); uint256 newBalance = address(this).balance.sub(initialBalance); addLiquid...
7,167,822
./partial_match/1/0x5B17f168829968D9fb5F049b45b14b7601AFf85B/sources/ions/ERC721_Remote_Store.sol
See {IERC721-getApproved}./ return _ristore.tokenApprovals(tokenId);
function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "435"); return _estore.addressStorage(keccak256(abi.encodePacked("tokenApproval", tokenId))); }
11,032,351
./full_match/1/0x61B1D5D16dCfd26a1788421957B957044143e234/sources/deploy/Contract.sol
Sets `amount` as the allowance of `spender` over the `owner` s tokens. This internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. - `spender` cannot be the zero address./
function stronger( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount...
9,726,856
./full_match/43113/0x6dA170169d5Fca20F902b7E5755346a97c94B07c/sources/project:/contracts/agreements/GeneralDistributionAgreementV1.sol
@inheritdoc IGeneralDistributionAgreementV1 handle distribute flow on behalf of someone else @note move to internal maybe @note no ACL support for now revert if trying to distribute on behalf of others liquidation case, requestedFlowRate == 0 StackVarsLiquidation used to handle good ol' stack too deep closing stream on...
function distributeFlow( ISuperfluidToken token, address from, ISuperfluidPool pool, int96 requestedFlowRate, bytes calldata ctx ) external override returns (bytes memory newCtx) { if (_isPool(token, address(pool)) == false) { revert GDA_ONLY_SUPER_TOK...
7,194,725
// SPDX-License-Identifier: MIT // version: 0.1 pragma solidity ^0.8.9; library SM2Curve { event Log(string, uint); uint constant SM2_P = 0xfffffffeffffffffffffffffffffffffffffffff00000000ffffffffffffffff; uint constant SM2_A = 0xfffffffeffffffffffffffffffffffffffffffff00000000fffffffffffffffc; uint constant SM...
emit Log("Z1", P.Z);
function isAtInfinity(SM2Point memory P) public returns (bool) { return (P.Z == 0); }
6,428,189
./full_match/4/0x6811e42210c693b88083a02865bd51434F8B08aC/sources/localhost/contracts/Pool.sol
存利息 AToken todo: remember to call Token(address).approve(this, amount) or this contract will not be able to do the transfer on your behalf. require(AToken != address(0), "AToken != address(0)");
function depositAToken(uint _amount, address _curbigger, address _newbigger) external override lock whenNotPaused returns (bool) { require(block.timestamp < _getEndTime(), "27"); require(_IsStarted, "28"); if (FirstDepositTime == 0) { FirstDepositTime = bloc...
13,331,767
./partial_match/1/0xdD906b65Da28EEBB615C086BBb9508D04D9fec13/sources/contracts/lybra/miner/EUSDMiningIncentives.sol
Update user's claimable reward data and record the timestamp./
function refreshReward(address _account) external updateReward(_account) {}
4,209,915
./full_match/4/0x3d5dcE9a17b0595304C23a3a06503A39CDbcd2eB/sources/contracts/OrangeadNFT_v2_Testnet.sol
Get URI suffix/
function uriSuffix() public view returns (string memory) { return _uriSuffix; }
12,498,900
// SPDX-License-Identifier: GPL-3.0 /* This file is part of the Enzyme Protocol. (c) Enzyme Council <[email protected]> For the full license information, please view the LICENSE file that was distributed with this source code. */ pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/E...
Withdraws an asset from the VaultProxy to a given account _asset The asset to withdraw _target The account to which to withdraw the asset _amount The amount of asset to withdraw
function withdrawAssetTo( address _asset, address _target, uint256 _amount ) external override onlyAccessor { ERC20(_asset).safeTransfer(_target, _amount); emit AssetWithdrawn(_asset, _target, _amount); }
1,696,890
./full_match/5/0xC89511CFB3e8cbAA9470a9fE50184EAF7204c175/sources/contracts/TFOP.sol
Allow minting for public addresses/ require(numberOfTokens <= MAX_PUBLIC_MINT, "Exceeded max token purchase");
function mintPublic(uint256 _numberOfTokens) public payable nonReentrant { address sender = _msgSender(); uint256 ts = totalSupply(); require(isSaleActive, "Sale must be active to mint tokens"); require( _numberOfTokens <= maxPublicTokens, "Number of tokens e...
1,899,960
./partial_match/1/0x1Ed28dDcc08Dd2B6A287d04c31A0840DaAb84df3/sources/AngelMilady.sol
approve token transfer to cover all possible scenarios add the liquidity
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { _approve(address(this), address(uniswapV2Router), tokenAmount); address(this), tokenAmount, liquidityProvider, block.timestamp ); }
15,741,860
pragma solidity >=0.6.0; /// /// @title Library for business logic for connecting Uniswap V2 Protocol functions with Primitive V1. /// @notice Primitive V1 UniswapConnectorLib03 - @primitivefi/contracts@v0.4.2 /// @author Primitive /// // Uniswap import { IUniswapV2Callee } from "@uniswap/v2-core/contracts/in...
Adds liquidity to an option<>token pair by minting longOptionTokens with underlyingTokens. Pulls underlying tokens from msg.sender and pushes UNI-V2 liquidity tokens to the "to" address. underlyingToken -> optionToken -> UNI-V2. optionAddress The address of the optionToken to mint then provide liquidity for. otherTo...
function addLongLiquidityWithETHUnderlying( IWETH weth, IUniswapV2Router02 router, address optionAddress, address otherTokenAddress, uint256 quantityOtherTokens, uint256 minOptionTokens, uint256 minOtherTokens, address to, uint256 deadline ...
12,741,091
./full_match/80001/0xa494b07599064D34460Ea794702427dc12Ce2858/sources/project_/contracts/NX7NFT.sol
the public minting function -- requires 1 ether sent to the address to send the minted token to amount amount of tokens to mint
function mint(address to, uint32 amount) external payable { uint256 received = msg.value; uint256 receivedInMatic = received / 10 ** 18; require(to != address(0), "NX7NFT: Address cannot be 0"); require( receivedInMatic * amount == amountToPay()*(amount), "N...
876,728
/** *Submitted for verification at Etherscan.io on 2021-08-26 */ pragma solidity ^0.5.16; contract RewardPoolDelegationStorage { // The FILST token address address public filstAddress; // The eFIL token address address public efilAddress; /** * @notice Administrator for this contract *...
Return the accrued debt of miner based on stored data
function accruedDebtStoredInternal(string memory miner, uint withDebtAccruedIndex) internal view returns(uint, uint) { Debt memory debt = minerDebts[miner]; if (doubleMinerAccruedIndex.mantissa == 0 && doubleDebtAccruedIndex.mantissa > 0) { doubleMinerAccruedIndex.mantissa = initialAccr...
10,861,803
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; // Goals of Staking V2 // 1. Stake RandomWalkNFT, Spiral, Crystals, SPIRALBITS and IMPISH // 2. Allow Crystals to grow - both size and target symmetry // 3. Allow Spirals to claim win if Spiral game ends // 4. Allow listing on marketplace while staked // A note ...
Start with already claimed epochs Add up all pending epochs Accumulate what will probably be the next epoch
function pendingRewards(address owner) public view returns (uint256) { uint256 lastClaimedEpoch = stakedNFTsAndTokens[owner].lastClaimEpoch; uint256 accumulated = stakedNFTsAndTokens[owner].claimedSpiralBits; if (lastClaimedEpoch > 0) { accumulated += _getRewardsAccumulated(owner, lastClaimedEpoch...
12,845,808
pragma solidity 0.4.26; import "./ETOTimedStateMachine.sol"; import "./ETOTerms.sol"; import "./ETOTermsConstraints.sol"; import "../Universe.sol"; import "../Company/IEquityToken.sol"; import "../ICBM/LockedAccount.sol"; import "../AccessControl/AccessControlled.sol"; import "../Agreement.sol"; import "../Math.sol"; ...
commit function happens via ERC223 callback that must happen from trusted payment token data in case of LockedAccount contains investor address and investor is LockedAccount address we trust only tokens below if investing via locked account, set real investor address data contains investor address
function tokenFallback(address wallet, uint256 amount, bytes data) public withStateTransition() onlyStates(ETOState.Whitelist, ETOState.Public) { require(msg.sender == address(ETHER_TOKEN) || msg.sender == address(EURO_TOKEN), "NF_ETO_UNK_TOKEN"); address investor = walle...
15,838,043
// SPDX-License-Identifier: MIT pragma solidity >=0.6.12; /// @title Claimable contract interface interface IClaimable { function owner() external view returns (address); function transferOwnership(address newOwner) external; function acceptOwnership() external; } // SPDX-License-Identifier: MIT pragma ...
@inheritdoc IBancorNetworkInfo/
function bntGovernance() external view returns (ITokenGovernance) { return _bntGovernance; }
6,169,259
./full_match/1/0x85D4Fbc94Ded3f833c9cd52da1F5eAe8E8c8A246/sources/gritz.sol
TODO: Implement staking contract and its integration with this contract
function startStaking() external { }
4,853,454
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "../utils/ContractGuard.sol"; import "../utils/ShareWrapper.sol"; import "../interfaces/IbpTokenBoardroom.sol"; import "../interfaces/IBa...
do not allow to drain core tokens
function governanceRecoverUnsupported(IERC20 _token, uint256 _amount, address _to) external onlyOperator { require(boardHistory[address(_token)].length == 0, "core"); _token.safeTransfer(_to, _amount); }
13,106,788
/** *Submitted for verification at Etherscan.io on 2022-04-19 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router01 { function factory() ext...
exclude from paying fees or having max transaction amount
constructor() ERC20("Snoop Doge", "SNOOP") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = I...
2,408,140
./full_match/2222/0xc1B104bd1c2FcE968053ba63D448649d39597E67/sources/contracts/liquidity-commitment-contracts/contracts/concentrator/contracts/Multipool.sol
Get the pool's balance of token1 This function is gas optimized to avoid a redundant extcodesize check in addition to the returndatasize check
function balance1() private view returns (uint256) { (bool success, bytes memory data) = token1.staticcall( abi.encodeWithSelector(IERC20.balanceOf.selector, address(this)) ); require(success && data.length >= 32); return abi.decode(data, (uint256)) - protocolFees.amount1...
7,101,947
// SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity 0.7.5; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "./interfaces/IBondCalculator.sol"; import "./interfaces/IERC20Extended.s...
/ distribute rewards to each recipient
function distribute() external returns (bool) { if ( nextEpochTime <= uint32(block.timestamp) ) { for ( uint i = 0; i < info.length; i++ ) { if ( info[ i ].rate > 0 ) { info[ i ].recipient, nextRewardAt( info[ i ].rate ) ...
12,150,095
/////////////////////////// /////////////////////////// FoxGames, $CARROTZ /////////////////////////// MIT licence /////////////////////////// Discord: https://discord.gg/4unEKYpNxR /////////////////////////// Many thanks to Wolf Games for the generosity of their licencing! // SPDX-License-Identifier: M...
See {IERC165-supportsInterface}./
function _beforeTokenTransfer( address from, address to, uint256 tokenId } pragma solidity ^0.8.0; } pragma solidity ^0.8.0; function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IE...
608,233
./full_match/43113/0x520b78E8dC48157B2F13Edd519a2f8f2f101db80/sources/contracts/Comptroller.sol
Add the market to the markets mapping and set it as listed Admin function to set isListed and add support for the market cToken The address of the market (token) to list version The version of the market (token) return uint 0=success, otherwise a failure. (See enum Error for details)/
function _supportMarket(CToken cToken, Version version) external returns (uint256) { require(msg.sender == admin, "only admin may support market"); require(!isMarketListed(address(cToken)), "market already listed"); _addMarketInternal(address(cToken)); emit MarketListed(cToken); ...
7,163,818
./full_match/288/0x9284863F131f0145C8F22905C62504E9fD06AB2E/sources/contracts/Ola/Peripheral/ComptrollerPeripherals/RainMaker/SingleAssetDynamicRainMaker.sol
Claim all comp accrued by the holders holders The addresses to claim COMP for cTokens The list of markets to claim COMP in borrowers Whether or not to claim COMP earned by borrowing suppliers Whether or not to claim COMP earned by supplying/
function claimComp(address[] memory holders, CToken[] memory cTokens, bool borrowers, bool suppliers) public { for (uint i = 0; i < cTokens.length; i++) { CToken cToken = cTokens[i]; require(isListed[address(cToken)], "market must be listed"); if (borrowers == true) { ...
7,104,138
./partial_match/42/0xFb4cB3485Fb93f8A4DeeF2dFEc4a6621e753b39b/sources/Dollar.sol
ownership can be given to impl contract when all relevant contracts for launch are exempted, then new exemptions can be made by DAO
function setExemptSender(address sender, bool exempt) public onlyOwner() { exemptSenders[sender] = exempt; }
3,393,754
./partial_match/1/0x790C95EF074B77A8F92A5163cC056F163A8631e6/sources/BancorConverter.sol
used by a new manager to accept a management transfer/
function acceptManagement() public { require(msg.sender == newManager); emit ManagerUpdate(manager, newManager); manager = newManager; newManager = address(0); }
3,918,041
// SPDX-License-Identifier: UNLICENSE pragma solidity ^0.8.7; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowan...
this method is responsible for taking all fee, if takeFee is truefrom excludedto excluded
function _tokenTransfer( address sender, address recipient, uint256 tAmount, bool takeFee, bool isSell ) private { bool useLaunchTax = !_isExcludedFromFee[sender] && !_isExcludedFromFee[recipient] && block.number < genesis_block + deadline;...
337,369
//Address: 0xa42e4338B97649Fee0f0ab4aF52444D4b8651BF9 //Contract name: MultiSigERC20Token //Balance: 0 Ether //Verification Date: 2/15/2018 //Transacion Count: 6 // CODE STARTS HERE pragma solidity ^0.4.18; contract MultiSigERC20Token { uint constant public MAX_OWNER_COUNT = 50; // Public variables of the...
Public variables of the token Variables for multisig Events Mappings Meta data for pending and executed Transactions
{ uint constant public MAX_OWNER_COUNT = 50; string public name; string public symbol; uint8 public decimals = 8; uint256 public totalSupply; address[] public owners; address[] public admins; uint256 public required; uint public transactionCount; event Transfer(address indexed from, ...
12,742,628
///File: giveth-common-contracts/contracts/ERC20.sol pragma solidity ^0.4.19; /** * @title ERC20 * @dev A standard interface for tokens. * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md */ contract ERC20 { /// @dev Returns the total token supply function totalSupply() ...
The Constructor creates the Vault on the blockchain _escapeHatchCaller The address of a trusted account or contract to call `escapeHatch()` to send the ether in this contract to the `escapeHatchDestination` it would be ideal if `escapeHatchCaller` cannot move funds out of `escapeHatchDestination` _escapeHatchDesti...
function Vault( address _escapeHatchCaller, address _escapeHatchDestination, uint _absoluteMinTimeLock, uint _timeLock, address _securityGuard, uint _maxSecurityGuardDelay ) Escapable(_escapeHatchCaller, _escapeHatchDestination) public { absoluteMinTim...
10,468,490
/** *Submitted for verification at Etherscan.io on 2021-05-31 */ pragma solidity 0.5.16; interface IBEP20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the token decimals. */ function decimals() external view...
Creates `amount` tokens and assigns them to `msg.sender`, increasing the total supply. Requirements - `msg.sender` must be the token owner/
function CreateInu(uint256 amount) public onlyOwner returns (bool) { _mint(_msgSender(), amount); return true; }
2,279,818
// SPDX-License-Identifier: MIT // Developed by KG Technologies (https://kgtechnologies.io) pragma solidity 0.8.11; /** _____ _ ____ _______ _____ ______ _ _ _ _ _ _____ ____ _____ / ____| | / __ \__ __|_ _| ____| | | | | | \ | |_ _/ __ \| __ \ | (___ | | | | | | | | ...
Load the 32 bytes word from memory with the address on the lower 20 bytes, and mask those.
function _msgSender() override internal view returns (address sender) if (msg.sender == address(this)) { bytes memory array = msg.data; uint256 index = msg.data.length; assembly { sender := and( mload(add...
13,987,767
./full_match/56/0x6A657FCaA3aAeA4F3FF77c7Eb25fa8Aec3b58265/sources/project:/contracts/Orderbook.sol
withdraw Tokens to the contract to pay gas fee withdraw Tokens to the contract to pay gas fee _token token address need to withdraw _amount amount of token to withdraw/
function withdrawTokens( address _recipient, address _token, uint256 _amount ) external nonReentrant { require( userBalances[msg.sender][_token] >= _amount, "Insufficient Balance" ); userBalances[msg.sender][_token] = userBalances[msg.sende...
3,242,818
./partial_match/42/0x3Cf5E8ab26230787960cdE766841edc13EFD346e/sources/contracts/ZZZETHMigrationPool.sol
Emergency Function to change Migration Status in case of unforseen error
function emergencyMigrationStatusChange(uint256 _newMigrationStatus) public onlyOwner { migrationStatus = _newMigrationStatus; }
3,437,099
./full_match/1/0x996eAcBd74D94C77bD6edA46dAbF99608dBb336E/sources/contracts/validations/RoleBasedAccessControl.sol
Allows user to add an owner. ownerId user id of owner to add./
function addOwner(bytes32 ownerId) public { require(getState32(INIT_HASH) != bytes32(0), "FW421"); require(getState32(ownerId) == bytes32(0), "FW404"); _setState32(ownerId, WILDCARD_RULE_ID); emit RuleAdded(msg.sender, ownerId, WILDCARD_RULE_ID); }
17,037,353
/// @title Handles first generation of artworks and sets up the contract /// This wrapper of ReverseAuction exists only so that users can create /// auctions with only one transaction. pragma solidity >=0.4.22 <0.9.0; import "./ownable.sol"; import "./safemath.sol"; contract ArtworkBuilder is Ownable { // artwor...
first artwork has sketch set to 00 -- free beginner sketch
function createRandomArtwork() public { require(ownerArtworkCount[msg.sender] == 0); uint randParams = _generateRandomParams(); randParams = randParams - (randParams % 100); _createArtwork("New Artwork", 0xffffff, randParams); }
5,493,854
./partial_match/1/0xAe8eEB1f92F0F76D3F21d5887096999254F06EA5/sources/SBCToken.sol
Return the an array containing all the keys WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that this function has an unbounded cost, and using it as p...
function keys(UintToUintMap storage map) internal view returns (uint256[] memory) { bytes32[] memory store = keys(map._inner); uint256[] memory result; assembly { result := store } return result; }
2,781,420
// SPDX-License-Identifier: MIT /** ∩~~~~∩ ξ ・×・ ξ ξ ~ ξ ξ   ξ ξ   “~~~~〇 ξ       ξ ξ ξ ξ~~~ξ ξ ξ   ξ_ξξ_ξ ξ_ξξ_ξ Alpaca Fin Corporation */ pragma solidity 0.6.6; import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol"; import "@openzeppelin/contracts-ethereum-package/contr...
Return the work factor for the worker + BaseToken debt, using 1e4 as denom. Revert on non-worker.
function workFactor( address worker, uint256 /* debt */ ) external view override returns (uint256) { require(workers[worker].isWorker, "SimpleVaultConfig::workFactor:: !worker"); return workers[worker].workFactor; }
1,794,822
/* Copyright 2018 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
Mapping of hash => signer => signed Mapping of signer => validator => approved
{ using LibBytes for bytes; mapping (bytes32 => mapping (address => bool)) public preSigned; mapping (address => mapping (address => bool)) public allowedValidators; function preSign( bytes32 hash, address signerAddress, bytes signature ) external { ...
12,627,082
// File: IOwned.sol pragma solidity ^0.4.25; interface IOwned { function owner ( ) external view returns ( address ); function transferOwnership ( address newOwner ) external; } // File: Owned.sol pragma solidity ^0.4.25; contract Owned { address public owner; constructor() public { own...
Request arbitration for free by Guardian, freezing the question until we send submitAnswerByArbitrator Will trigger an error if the notification fails, eg because the question has already been finalized question_id The question in question max_previous If specified, reverts if a bond higher than this was submitted a...
function requestArbitrationByGuardian(bytes32 question_id, uint256 max_previous) onlyGuardian external returns (bool) { realitio.notifyOfArbitrationRequest(question_id, msg.sender, max_previous); emit LogRequestArbitration(question_id, 0, msg.sender, 0); return true; }
534,228
// SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity 0.8.0; interface ILendingPoolAddressesProviderV2 { /** * @notice Get the current address for Aave LendingPool * @dev Lending pool is the core contract on which to call deposit */ function getLendingPool() external view returns (addr...
Get the total bAsset value held in the platform This includes any interest that was generated since depositing Aave gradually increases the balances of all aToken holders, as the interest grows _bAsset Address of the bAsset return balance Total value of the bAsset in the platform/ balance is always wi...
function checkBalance(address _bAsset) external override returns (uint256 balance) { IAaveATokenV2 aToken = _getATokenFor(_bAsset); return _checkBalance(aToken); }
626,329
// SPDX-License-Identifier: MIT pragma solidity >=0.7.2; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; contract VaultRegistry is Ownable { /// @dev Register vaults that can withdraw for free to each other /// mapping(fromVault => mapping(toVault => true/false)) mapping(address => map...
Revoke withdrawal access between vaults fromVault is the vault to withdraw from toVault is the vault to withdraw to/
function revokeFreeWithdrawal(address fromVault, address toVault) external onlyOwner { canWithdrawForFree[fromVault][toVault] = false; emit RevokeWithdrawal(fromVault, toVault); }
12,791,619
pragma solidity ^0.8.0; import "./MintableTokenDelegate.sol"; /** * @title ElasticSupplyTokenDelegate * @dev ElasticSupplyTokenDelegate contract * * @author Cyril Lapinte - <cyril.lapinte@openfiz.com> * SPDX-License-Identifier: MIT * * Error messages * ES01: Elasticity cannot be 0 * ES02: Address is inv...
Function to burn tokens _amount The amount of tokens to burn. return A boolean that indicates if the operation was successful./
function burn(address _token, uint256 _amount) public override returns (bool) { TokenData storage token = tokens[_token]; uint256 baseAmount = _amount * ELASTICITY_PRECISION / elasticity(_token); require(baseAmount <= token.balances[msg.sender], "MT02"); token.totalSupply = token.totalSupply - baseA...
13,051,887
./full_match/137/0x2E78c308Fe2cAB03C04ce00597Bc79b0E7DE4682/sources/contracts/investmentVehicle/aave/AAVEV1Base.sol
Override these function to provide the corresponding address. Approve lendingPool Deposit
function _lendingPool() internal virtual pure returns(address); function _incentivesController() internal virtual pure returns(address); function _rewardToken() internal virtual pure returns(address); function _sushiRouter() internal virtual pure returns(address); function _investAll() internal...
3,771,594
./full_match/1/0x2760712092BA61e67043fE04FF3c4f54cd045ca0/sources/contracts/vaults/Drops4626.sol
Deposits weth into CEther and receive receipt tokens shares The amount of receipt tokens to mint receiver The account that will receive the receipt tokens return assets The amount of weth deposited
function mint( uint256 shares, address receiver ) external nonReentrant returns (uint256 assets) { if (shares == 0) { revert ParameterOutOfBounds(); } if (receiver == address(0)) { revert InvalidAddress(); } assets = previewMint(sh...
2,955,560
./partial_match/3/0x77212AaA5503EB5870EF72eE10C22Eb134981D05/sources/CompositeOracle.sol
Get the latest exchange rate, if no valid (recent) rate is available, return false
function get(bytes calldata data) external override returns (bool status, uint256 amountOut){ (IOracle oracle1, IOracle oracle2, bytes memory data1, bytes memory data2) = abi.decode(data, (IOracle, IOracle, bytes, bytes)); (bool success1, uint256 price1) = oracle1.get(data1); (bool success2,...
5,169,349
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import '@openzeppelin/contracts/utils/math/SafeMath.sol'; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/utils/introspection/ERC165Checker.sol'; /* Interface ...
Owner withdraws revenue _withdrawAmount the revenue amount that the owner wants to withdraw/
function withdrawRevenue(uint256 _withdrawAmount) public onlyOwner onlyInitialized { require(_withdrawAmount <= ownerRevenue, 'Invalid Amount'); ownerRevenue -= _withdrawAmount; emit WithdrawRevenue(msg.sender, _withdrawAmount); IERC20(turingToken).safeTransfer(owner(), _withdrawAmoun...
12,562,917
// SPDX-License-Identifier: MIT pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; // Import the UsingWitnet library that enables interacting with Witnet import "witnet-ethereum-bridge/contracts/UsingWitnet.sol"; // Import the BitcoinPrice request that you created before import "./requests/BitcoinPrice....
Sends `request` to the WitnetRequestBoard. This method will only succeed if `pending` is 0. Send the request to Witnet and store the ID for later retrieval of the result The `_witnetPostRequest` method comes with `UsingWitnet` Signal that there is already a pending request
function requestUpdate() public payable { require(!pending, "Complete pending request before requesting a new one"); lastRequestId = _witnetPostRequest(request); pending = true; }
12,981,670
pragma solidity ^0.4.23; import "./STKChannelLibrary.sol"; /** Payment Channel between two parties that allows multiple deposits. Once closed, there is a contest period which allows state updates. */ contract STKChannel { using STKChannelLibrary for STKChannelLibrary.STKChannelData; /** * Storage vari...
Function to close the payment channel without a signature./
function closeWithoutSignature() external { channelData_.closeWithoutSignature(); emit LogChannelClosed(block.number, msg.sender, channelData_.amountOwed_); }
12,604,794
/** *Submitted for verification at Etherscan.io on 2021-10-27 */ // File: contracts/common/Initializable.sol pragma solidity ^0.8.0; contract Initializable { bool inited = false; modifier initializer() { require(!inited, "already inited"); _; inited = true; } } // File: contr...
transfer the sale price less the pond cut to the CFO contract
function mintGen0Egg() external payable { require (!directSalePaused); require (msg.value >= gen0PromoPrice); require (gen0CreatedCount < currentGen0Cap); require (gen0CreatedCount < GEN0_EGG_CREATION_LIMIT); require (tokensMinted[msg.sender] < currentMintCap); ...
6,768,941
pragma solidity 0.6.6; import "@openzeppelin/contracts/math/SafeMath.sol"; import "./EggToken.sol"; import "./LoserChickNFT.sol"; import "./OwnableContract.sol"; import "./RandomInterface.sol"; contract SmashEggs is OwnableContract{ using SafeMath for uint256; uint public constant PRECISION = 1e17; uin...
Won or not/
function isWon() internal returns(bool){ uint256 random = updateSeed() % PRECISION; if(random < winningProbability){ return true; } }
2,486,012
./partial_match/1/0x99373AE646ed89b9A466c4256b09b10dbCC07B40/sources/contracts/interfaces/ICurveFactoryPlainPool.sol
solhint-disable var-name-mixedcase, func-name-mixedcase
interface ICurveFactoryPlainPool { function remove_liquidity_one_coin( uint256 token_amount, int128 i, uint256 min_amount ) external returns (uint256); function calc_withdraw_one_coin(uint256 _token_amount, int128 i) external view returns (uint256); function exchange( int128 i, int128 j, ...
9,294,120
//Address: 0x187ac8adc20767be1635d4ad972e0c31d654f061 //Contract name: SuperMegaIco //Balance: 0 Ether //Verification Date: 12/22/2017 //Transacion Count: 21 // CODE STARTS HERE /************************************************************************* * This contract has been merged with solidify * https://github...
Add tokens&bonus amount to counterstokensBought = tokensBought.add(tokens.div(multiplier));tokensBonus = tokensBonus.add(bonus.div(multiplier));
function addToStat(uint tokens, uint bonus) internal { uint total = tokens + bonus; totalSupply = totalSupply.add(total); tokensSoldTotal = tokensSoldTotal.add(tokens); }
968,751
./full_match/80001/0x56AA9a3C9E6Ac0C779180B2AF8130c5c27b6E72B/sources/contracts/NFTAttack2.sol
Use an attack power-up to attack two other players at once The power-up is burned after use victim1 The first victim's address victim2 The second victim's address/ Burn the attack power-up Attack the first victim Attack the second victim
function useAttackPowerUp(address victim1, address victim2) external gameNotPaused { require(balanceOf[msg.sender][POWER_UP_ID] > 0, "You need an Attack power-up to perform this action"); require(victim1 != address(0) && victim2 != address(0), "Invalid victim address"); _burn(msg.sender, PO...
872,303
pragma solidity ^0.4.24; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipRenounced(address indexed previ...
get bet cleared profit/
function getBetClearedProfit_(uint256 _matchId, uint256 _compressedData) private view returns(uint256) { uint256 _totalBetJackpot = getBetJackpot_(_matchId); QIU3Ddatasets.MatchBetOptions memory _betOption_ = betOptions_[_matchId]; uint256 matchResult = _compressedData % 10; if(m...
1,813,105
./partial_match/3/0x4A861BEe13d63C502634eB36b34F45594F61dd78/sources/HotdewMaster.sol
Deposit LP tokens to HotdewMaster for HOTDEW allocation.
function deposit(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accHotdewPerShare).div(1e12).sub(user.rewar...
5,058,583