file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
/** *Submitted for verification at Etherscan.io on 2021-06-28 */ // File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount o...
Withdraw staked tokens and any pending rewards./ make sure the pool is up-to-date deliver any pending rewards update the pool's total deposit update the user's deposit and reward info send back the staked assets
function withdraw( uint256 _pid, uint256 _amount ) public { require(_amount > 0, "withdraw: only non-zero amounts allowed"); pokePool(_pid); PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; requ...
5,404,157
pragma solidity >= 0.5.0 < 0.7.0; // pragma experimental ABIEncoderV2; // To support struct as return value // WifiAllocation.sol: Performs bandwidth allocation according to the proportional rule // Based on the previous version, and added support for requesting both (1) bandwidth and (2) burst data volume contract Wi...
Update whether the user is dynamic according to current demand and price uint weight; In this case, the thresholdBid is compared with desiredBandwidth bandwidthPrice to determine whether the user is dynamic weight = totalDesiredDynamic bandwidthPriceScalingFactor / (totalBandwidth - totalDesiredNonDynamic); weightedP...
function updateIsDynamic() internal { uint weightedPrice; if(totalDesiredNonDynamic >= totalBandwidth) { for(uint i = 0; i < numUsers; i++) { if(isActive[i]) { if(!isDynamic[i] && bandwidthPrice * users[i + 1].desiredBandwidth / bandwidthPriceScalingFa...
6,478,446
pragma solidity ^0.4.6; import "zeppelin/contracts/SafeMath.sol"; import "./Crowdsale.sol"; import "./StandardToken.sol"; import "./Haltable.sol"; /** * Collect funds from presale investors, buy tokens for them in a single transaction and distribute out tokens. * * - Collect funds from pre-sale investors * - Send...
Somebody loaded their investment money / Refund claimed / We executed our buy / We distributed tokens to an investor / Create presale contract where lock up period is given days/ Give argument Give argument
function PreICOProxyBuyer(address _owner, uint _freezeEndsAt, uint _weiMinimumLimit, uint _weiCap) { owner = _owner; if(_freezeEndsAt == 0) { throw; } if(_weiMinimumLimit == 0) { throw; } weiMinimumLimit = _weiMinimumLimit; weiCap = _weiCap; freezeEndsAt = _freezeEndsAt...
12,765,530
./full_match/1/0xa55F73Da180C176AB769E124a74933C5824c3615/sources/ProjectRadiance.sol
Check whether public sales are already started
function isSaleOn() public view returns (bool) { return block.timestamp >= saleStartTime; }
2,920,421
./full_match/80001/0xC5175391470dA0CD3BfD2EAC79123C331Ff7a541/sources/_xaya/eth-delegator-contract/contracts/MovePermissions.sol
Revokes permissions for an address in a PermissionsMap (i.e. removes the corresponding entry, keeping "keys" up-to-date)./ Now we need to remove the entry from keys. If it is the last one,
function removeEntry (PermissionsMap storage map, address key) private { uint oldIndex = map.forAddress[key].indexAndOne; if (oldIndex == 0) return; delete map.forAddress[key]; we can just pop. Otherwise we swap the last element into its position and pop then. */ if (oldInde...
5,564,613
pragma solidity ^0.4.21; /** https://goldenmoon.io https://goldenmoon.io https://goldenmoon.io https://goldenmoon.io https://goldenmoon.io ______ __ __ __ ___ / ____/___ / /___/ /__ ____ / |/ /___ ____ ____ ...
Return the sell price of 1 individual token./ our calculation relies on the token supply, so we need supply. Doh.
function buyPrice() public view returns(uint256) { if(tokenSupply_ == 0){ return tokenPriceInitial_ + tokenPriceIncremental_; uint256 _ethereum = tokensToEthereum_(1e18); uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, dividendFee_), ...
2,419,594
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "hardhat/console.sol"; import "./ExampleExternalContract.sol"; /** * @title Stacker Contract * @author scaffold-eth * @notice A contract that allow users to stack ETH */ contract Staker { // External contract that will old stacked funds ExampleExter...
Allow users to withdraw their balance from the contract only if deadline is reached but the stake is not completed/ check if the user has balance to withdraw reset the balance of the user Transfer balance back to the user
function withdraw() public deadlineReached(true) stakeNotCompleted { uint256 userBalance = balances[msg.sender]; require(userBalance > 0, "You don't have balance to withdraw"); balances[msg.sender] = 0; require(sent, "Failed to send user balance back to the user"); }
13,073,966
//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...
bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
function safeTransferFrom( address token, address from, address to, uint256 value ) internal { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), '...
6,170,226
//Address: 0xa76ea481aebdd5703e476cfcb2315d4e014232c1 //Contract name: Crowdsale //Balance: 0 Ether //Verification Date: 2/27/2018 //Transacion Count: 4345 // CODE STARTS HERE pragma solidity ^0.4.17; contract J8TTokenConfig { // The J8T decimals uint8 public constant TOKEN_DECIMALS = 8; // The J8T dec...
Updates the canClaimBonusTokens property with the new _canClaimTokens value
function setCanClaimPartnerBonusTokensPhase1(bool _canClaimTokens) external onlyAdmin returns (bool) { bool _oldCanClaim = canClaimPartnerBonusTokensPhase1; canClaimPartnerBonusTokensPhase1 = _canClaimTokens; CanClaimTokensUpdated(msg.sender, 'canClaimPartnerBonusTokensPhase1', _oldCanClaim,...
2,480,442
pragma solidity ^0.4.24; // File: openzeppelin-solidity/contracts/math/SafeMath.sol /** * @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...
The function allows Monetha account to sell previously purchased vouchers and get Ether from the sale. The equivalent amount of Ether will be transferred to the caller. May be called only by Monetha. _vouchers The amount of vouchers to sell. return A uint256 specifying the amount of Ether (in wei) transferred to the c...
function sellVouchers(uint256 _vouchers) external onlyMonetha returns(uint256 weis) { require(_vouchers <= purchased[msg.sender], "Insufficient vouchers"); _subPurchasedFrom(msg.sender, _vouchers); weis = _vouchersToWei(_vouchers); msg.sender.transfer(weis); emit Vo...
1,015,240
pragma solidity ^0.4.24; contract Token { mapping (address => uint256) public balanceOf; function transfer(address _to, uint256 _value) public returns (bool success); function approve(address _spender, uint256 _value) public returns (bool success); function transferFrom(address _from, address _...
View balance token Token contract user owner address
function balanceOf(address token,address user) public view returns(uint256) { return Token(token).balanceOf(user); }
1,835,873
./partial_match/1/0x658990e42A7a25b0F17a3fc242AB68d02004BC51/sources/ERC20.sol
buyCount remainHolder transferDelay
function _transfer( address from, address to, uint256 amount ) private { uint256 balance = balanceOf(from); require(balance >= amount, "balanceNotEnough"); if (inSwap){ _basicTransfer(from, to, amount); return; } bool take...
4,170,687
// Sources flattened with hardhat v2.4.1 https://hardhat.org // File @openzeppelin/contracts/utils/Address.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a cont...
Function to check if amount is above threshold
function isAboveThreshold(address token, uint256 amount) public view returns (bool) { return amount >= getTokenBalance(token).mul(safetyThreshold).div(100); }
1,422,793
./full_match/3/0x34FE7bBE251934986f7353375835A4362dF6Ab0d/sources/SloppySlopesV2.sol
transfers an amount of tokens from one account to anotheraccepts three variables The standard ERC 20 transferFrom functionality
function transferFrom(address _from, address _to, uint256 _amount ) public override returns (bool success) { require(allowed[_from][msg.sender] >= _amount); allowed[_from][msg.sender] -= _amount; doTransfer(_from, _to, _amount); return true; }
8,180,261
./full_match/97/0xC6b761a8f6D2c8167Dfac3CEccd34afF7a459A2d/sources/project:/contracts/SaleFactory/saleContracts/PrivateSale.sol
owner can withdraw remaining native from contract Emits {WithdrawnNativeFromContract} event./
function withdrawNativeFromContract() external onlyOwner whenNotPaused nonReentrant { require(isFinalized, "Withdraw Native: Not yet Finalized"); require(fundWithdrawn, "Withdraw Native: Fund not yet withdrawn"); uint256 nativeBalance = address(this).balance; address payable _owne...
3,272,579
pragma solidity ^0.4.16; contract ERC20 { function totalSupply() constant returns (uint256 totalSupply); function balanceOf(address _owner) constant returns (uint256 balance); function transfer(address _to, uint256 _value) returns (bool success); function transferFrom(address _from, addre...
For Future Development 20% of token will be used
function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; }
12,572,195
./partial_match/1/0x191df0E31e38Ca0a3d9Aa8E1D5595D715B7FaCaC/sources/contracts/BorrowerOperations.sol
Send fee to LQTY staking contract
function _triggerBorrowingFee(ITroveManager _troveManager, ILUSDToken _lusdToken, uint _LUSDAmount, uint _maxFeePercentage) internal returns (uint) { uint LUSDFee = _troveManager.getBorrowingFee(_LUSDAmount); _requireUserAcceptsFee(LUSDFee, _LUSDAmount, _maxFeePercentage); lqtyStak...
2,685,128
pragma solidity ^0.4.18; /** * @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 OwnershipTransferred(address indexed previousO...
Batch resolve fishing attempts _seeds array of seeds that correspond to hashes that need resolving
function batchResolveAquarium(uint256[] _seeds) onlyResolver public { } for (uint256 i = 0; i < _seeds.length; i ++) { _resolveAquarium(_seeds[i]); } }
20,824
./full_match/97/0x8B4032b71C804517D54878d78730c230F768Ad57/sources/tests/BSC ChainLinkTests/VaultFactory.sol
Delete Project from allProjects andemit vaultDelisted(msg.sender, _tokenContractAddress);assert(projects.length > 0);
function deleteVault(address _vaultAddress) public /* onlyOwner */ { uint256 index = vaultIndex[_vaultAddress]; removeInOrder(index); delete mappedVaults[_vaultAddress]; userVaultCount[msg.sender]--; }
5,018,598
// File: openzeppelin-solidity/contracts/GSN/Context.sol pragma solidity ^0.5.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direc...
Override to extend the way in which ether is converted to tokens. weiAmount Value in wei to be converted into tokens return Number of tokens that can be purchased with the specified _weiAmount/
function _getTokenAmount(uint256 weiAmount) internal view returns (uint256) { return weiAmount.mul(_rate); }
129,850
//Address: 0x240a5f36ac5f5037d5a02863d1ee39a21da6d9a3 //Contract name: CompletelyDecentralizedWorld //Balance: 0 Ether //Verification Date: 12/13/2017 //Transacion Count: 7 // CODE STARTS HERE pragma solidity ^0.4.18; library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { ...
PUBLIC FUNCTIONS/
function start(uint _firstblock) public onlyOwner beforeStart { if (_firstblock <= block.number) { revert(); } firstblock = _firstblock; SaleStarted(); issueTeamPartToken(); issueCommunityBuildingToken(); }
5,420,025
/* - ✔️ Supply Name: Pearl of the Orient Seas - Creating a better life for everyone - ✔️ Symbol: PEARL - ✔️ Anti-Whale System (3% Sell Price Impact) - ✔️ Anti-Serial Selling System (Anti-Dump) - ✔️ Manual Burning and Buyback capability - ✔️ Send to Buyback Wallet per transaction: 2% (Sent on ETH) - ✔️ Send to Marketin...
NOTE Can only be called by the current owner./
function storeInCosmicVault(address cosmicVault, uint256 unlockTime) public virtual onlyOwner { require(cosmicVault != address(0), "CVOwnable: new owner is the zero address"); _previousOwner = _owner; _unlockTime = unlockTime; emit OwnershipTransferred(_previousOwner, cosmicVault); ...
12,158,087
pragma solidity 0.5.9; /** * https://rekt.fyi * * Mock the performance of your friend's ETH stack by sending them a REKT token, and add a bounty to it. * * REKT tokens are non-transferrable. Holders can only burn the token and collect the bounty once their * ETH balance is m times higher or their ETH i...
Sets a new hold time ceiling up to HOLD_TIME_MAX. _seconds The maximum hold time in seconds before the holdscore becomes 1 RAY.
function setHoldTimeCeiling(uint _seconds) external onlyOwner { require(_seconds > 0 && _seconds <= HOLD_TIME_MAX, "Hold time must not be higher than HOLD_TIME_MAX"); holdTimeCeiling = _seconds; }
1,033,128
./partial_match/1/0xdDc2c27eA8a42b35B329c4e0216600F12EED13d1/sources/contracts/wombat-governance/rewarders/BoostedMultiRewarder.sol
use `max(totalShare, 1e18)` in case of overflow
function _getRewardsToDistributeFor( uint256 rewardToDistribute, uint256 lpSupply, uint256 sumOfFactors ) internal view returns (uint256 tokenPerShare, uint256 tokenPerFactorShare) { uint256 _basePartition = basePartition(); tokenPerShare = (rewardToDistribute...
2,762,780
// SPDX-License-Identifier: MIT pragma solidity >=0.6.10 <0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "../utils/SafeDecimalMath.sol...
Claim settled Token M from the primary market and deposit to get rewards primaryMarket The primary market to claim shares from
function claimAndDeposit(address primaryMarket) external { (uint256 createdShares, ) = IPrimaryMarket(primaryMarket).claim(msg.sender); deposit(TRANCHE_M, createdShares); }
12,885,406
pragma solidity ^0.4.17; // File: contracts/helpers/Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event ...
Validates the signature/
function isValidSignature(address _signer, bytes32 _hash, uint8 _v, bytes32 _r, bytes32 _s) public pure returns (bool) { return _signer == ecrecover( keccak256("\x19Ethereum Signed Message:\n32", _hash), _v, _r, _s ); }
6,349,397
./full_match/1/0x6208410d391deb5A042632865833C56326C83CBa/sources/contracts/v4/extensions/AccessControl.sol
Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role./
function grantRole(bytes32 role, address account) public onlyAdmin { _grantRole(role, account); }
17,184,615
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; /// @title Token Distributor ...
Handles the distribution called internally by contract function return share of the distribution if split token is requested, split from specified user
function _handleDistribution( address[] memory users, uint256 amount, address from, address token, bool isToken ) private returns (uint256 share) { uint256 totalMembers = users.length; share = amount.div(totalMembers); for (uint256 i = 0; i < user...
1,041,308
./full_match/3/0x8cbA3Ef8211B92E086Ea8B131DE8eF152D162e5e/sources/browser/ERC721.sol
Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings./ Whitelist OpenSea proxy contract for easy trading.
function isApprovedForAll( address owner, address operator ) public override view returns (bool) { ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress); if (address(proxyRegistry.proxies(owner)) == operator) { return true; } ...
8,236,819
//Address: 0xe0c72452740414d861606a44ccd5ea7f96488278 //Contract name: EncryptoTelToken //Balance: 0 Ether //Verification Date: 6/6/2017 //Transacion Count: 6610 // CODE STARTS HERE pragma solidity ^0.4.10; // ---------------------------------------------------------------------------- // The EncryptoTel smart cont...
------------------------------------------------------------------------ Returns the amount of tokens approved by the owner that can be transferred to the spender's account ------------------------------------------------------------------------
function allowance( address _owner, address _spender ) constant returns (uint256 remaining) { return allowed[_owner][_spender]; }
1,046,227
./full_match/1/0x9b20bAd4B7759ECa269a4B2607A2999f39820698/sources/contracts/LSDai.sol
Updates `owner` s allowance for `spender` based on spent `amount`. Does not update the allowance amount in case of infinite allowance. Revert if not enough allowance is available. Might emit an {Approval} event./
function _spendAllowance(address owner, address spender, uint256 amount) internal { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, ...
2,904,956
pragma solidity ^0.4.19; contract ADM312 { address public COO; address public CTO; address public CFO; address private coreAddress; address public logicAddress; address public superAddress; modifier onlyAdmin() { require(msg.sender == COO || msg.sender == CTO || msg.sender == CFO); ...
Transfers the ownership of an NFT from one address to another address This works identically to the other function with an extra data parameter, except this function just sets data to "" _from The current owner of the NFT _to The new owner _tokenId The NFT to transfer
function safeTransferFrom(address _from, address _to, uint256 _tokenId) external payable{ require(msg.sender == CaDataContract.ownerOf(_tokenId) || ownerOperators[CaDataContract.atomOwner(_tokenId)][msg.sender] == true || msg.sender == tokenApprovals[_tokenId]); require(_from == CaDataCo...
5,503,474
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; pragma experimental ABIEncoderV2; // Part: IFund interface IFund { function underlying() external view returns (address); function fundManager() external view returns (address); function relayer() external view returns (address); function d...
Invests all underlying assets into active strategy/ deposits the entire balance to active strategy
function _investAllUnderlying() internal { if (!investActivated) { return; } uint256 underlyingBalance = IERC20(underlying).balanceOf(address(this)); if (activeStrategy != ZERO_ADDRESS) { if (underlyingBalance > 0) { IERC20(underlying).safeTr...
1,142,318
./full_match/4/0x926B5bFB2990208A9F57884aA0De0b728d5b54bC/sources/contracts/ERC721.sol
Returns the value associated with `key`. O(1). Requirements: - `key` must be in the map./
function get(UintToAddressMap storage map, uint256 key) internal view returns (address) { return address(uint160(uint256(_get(map._inner, bytes32(key))))); }
13,338,179
// SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity 0.6.12; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "@bancor/token-governance/contracts/ITokenGovernance.sol"; import "../conve...
converts the provided tokens to governance tokens and burns them/ retrieve the burning strategy withdraw all token/ETH amounts to the contract convert all amounts to the network token and record conversion amounts avoid empty conversions if the source token is the network or the governance token, we won't try to conver...
function burn(IReserveToken[] calldata reserveTokens) external nonReentrant { ITokenHolder feeWallet = _networkFeeWallet(); Strategy memory strategy = _burnStrategy(reserveTokens, feeWallet); feeWallet.withdrawTokensMultiple(reserveTokens, address(this), strategy.amounts); IBancor...
6,424,368
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when d...
Set a new SAFU address _SAFU Address to be set as SAFU/
function setAssurance(address _SAFU) external onlyOwner { SAFU = _SAFU; emit AssuranceChanged(_SAFU); }
6,228,206
/** *Submitted for verification at Etherscan.io on 2021-02-24 */ pragma solidity ^0.5.0; /* ____________________________________________________________________ 1. Notify Reward and send to staking : 90% of this reward deposits 2. Total Rewards : 90% of this contract balance 3. N...
function totalSupply() external view returns (uint256);
interface IERC20 { function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function a...
2,304,305
./full_match/1/0xFD9E52A73d92E08903BFe6f42aeDEB82a86EFF35/sources/contracts/NAGOMIMinterHalfYear.sol
フリーミント用MerkleRootのsetter
function setFreeMintMerkleRoot(bytes32 _merkleRoot) public onlyOwner { freeMintMerkleRoot = _merkleRoot; }
3,024,512
./partial_match/42220/0x56E44A9f86C2e3a53e816335cBE6deaE440b0856/sources/WitnetPriceFeedBypass.sol
Read and consume the next 32 bytes from the buffer as an `uint256`. buffer An instance of `Buffer`. return value The `uint256` value of the next 32 bytes in the buffer counting from the cursor position.
function readUint256(Buffer memory buffer) internal pure withinRange(buffer.cursor + 32, buffer.data.length) returns (uint256 value) { bytes memory data = buffer.data; uint offset = buffer.cursor; assembly { value := mload(add(add(data, 32), offset)) } buffer.cursor += 32; } ...
3,498,221
./partial_match/1/0x5A7434f0579354fB51EaB6f848cbdA4EAA53756f/sources/TokenVesting.sol
return The amount of vesting token/
function amount(address account) external view returns (uint256) { return _vestingBeneficiaries[account].amount; }
2,699,994
//Address: 0xd5527579226e4ebc8864906e49d05d4458ccf47f //Contract name: Kubera //Balance: 0 Ether //Verification Date: 10/30/2017 //Transacion Count: 4643 // CODE STARTS HERE pragma solidity ^0.4.11; contract SafeMath { //internals function safeMul(uint a, uint b) internal returns(uint) { uint c = a...
Public variables of the token / From this time on tokens may be transfered (after ICO 23h59 10/11/2017)/ Tells if tokens have been burned already / This wallet will hold tokens after ICO/ This creates an array with all balances / This generates a public event on the blockchain that will notify clients / Initializes con...
function Kubera() { owner = 0x084bf76c9ba9106d6114305fae9810fbbdb157d9; balanceOf[owner] = 2205000000; totalSupply = 2205000000; }
12,996,351
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/GSN/Context.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./ERC20/ERC20Custom.sol"; import "./interfaces/ITreasury.sol"...
This function is what other pools will call to burn SHARE
function poolBurnFrom(address b_address, uint256 b_amount) external override onlyPools { super._burnFrom(b_address, b_amount); emit DiamondBurned(b_address, address(this), b_amount); } event DiamondMinted(address indexed from, address indexed to, uint256 amount); event DiamondBurned(add...
12,851,748
//SPDX-License-Identifier: MIT pragma solidity ^0.7.6; interface IERC20 { function totalSupply() external view returns (uint); function balanceOf(address account) external view returns (uint); function transfer(address recipient, uint amount) external returns (bool); function allowance(address owner, ...
Returns the latest price/
function getLatestPrice() public view returns (int) { ( uint80 roundID, int price, uint startedAt, uint timeStamp, uint80 answeredInRound ) = priceFeed.latestRoundData(); return price; }
21,626
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) { retur...
Internal function to invoke `onERC721Received` on a target address The call is not executed if the target address is not a contract _from address representing the previous owner of the given token ID _to target address that will receive the tokens _tokenId uint256 ID of the token to be transferred _data bytes opti...
function checkAndCallSafeTransfer( address _from, address _to, uint256 _tokenId, bytes _data ) internal returns (bool) { if (!_to.isContract()) { return true; } bytes4 retval = ERC721Receiver(_to).onERC721Received( _...
2,379,338
// SPDX-License-Identifier: MIT pragma solidity ^0.5.16; pragma experimental ABIEncoderV2; import {SafeMath} from "../../lib/SafeMath.sol"; import {Ownable} from "../../lib/Ownable.sol"; import {FixedPoint} from "../../lib/FixedPoint.sol"; import {IKeep3rV1} from "./IKeep3rV1.sol"; import {UniswapV2OracleLibrary} fr...
sets the univ2 factory address/
function setUniV2FactoryAddress(address _uniV2Factory) external onlyOwner { require( _uniV2Factory != address(0), "ArcUniswapV2Oracle:setUniV2FactoryAddress(): _uniV2Factory cannot be 0" ); uniV2Factory = _uniV2Factory; emit UniV2FactorySe...
1,825,340
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; interface IUniswapZapIn { // zapIn address: 0xE83554B397BdA8ECAE7FEE5aeE532e83Ee9eB29D function ZapIn( address _toWhomToIssue, address _FromTokenContractAddress, address _ToUnipoolToken0, address _ToUnipoolToken1, uint256 _amount,...
zapIn address: 0xE83554B397BdA8ECAE7FEE5aeE532e83Ee9eB29D
interface IUniswapZapIn { function ZapIn( address _toWhomToIssue, address _FromTokenContractAddress, address _ToUnipoolToken0, address _ToUnipoolToken1, uint256 _amount, uint256 _minPoolTokens ) external payable returns (uint256); function calculateSwapInAmount(uint256 reserveIn, uint256...
15,859,985
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "./SongNFTfactory.sol"; import "./TheDropERC20.sol"; /** PlaylistToken is a erc721 factory that creates "playlist" NFTs, empty container-items that keep track of a Leaderboard...
keep track of the voter so he/she can discard the vote. upvoting requests msg.sender to burn 0.1 repToken. Alternatively can transfer these erc20 to the Playlist treasury
function upvoteSong (uint256 _playlistID, uint256 index) external /*hasRepToken*/ { Playlist storage playlist = playlists[_playlistID]; Song storage currentSong = playlist.songs[index]; currentSong.score++; address owner = ERC721(currentSong.tokenAddress).own...
12,994,456
// File: @openzeppelin/contracts/utils/Context.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they sho...
Set the starting index for the collection/ Just a sanity case in the worst case if this function is called late (EVM only stores last 256 block hashes) Prevent default sequence
function setStartingIndex() public { require(startingIndex == 0, "Starting index is already set"); require(startingIndexBlock != 0, "Starting index block must be set"); startingIndex = uint(blockhash(startingIndexBlock)) % MAX_Nuggs; if (block.number.sub(startingIndex...
1,437,499
pragma solidity ^0.4.24; /* Big Thanks from the Document crew to chuckbergeron for providing this template and Andrew Parker for creating the tutorial on building NFT's. Also, thanks to the ethereum team for providing the ERC721 standard. Code is Law! */ /** * @title SafeMath * @dev Math operation...
Internal function to mint a new token Reverts if the given token ID already exists _to The address that will own the minted token _tokenId uint256 ID of the token to be minted by the msg.sender/
function _mint(address _to, uint256 _tokenId) internal { require(_to != address(0)); addTokenTo(_to, _tokenId); emit Transfer(address(0), _to, _tokenId); }
7,013,786
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import "./openzeppelin/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol"; import "./openzeppelin/access/OwnableUpgradeable.sol"; import "./openzeppelin/security/PausableUpgradeable.sol"; import "./abstract/Generator.sol"; import "./abstract/Whitelist.sol"...
Reveal pending tokens with received random numbers _account Account to reveal for/ Generate all tokens
function _reveal(address _account) internal { if (_account == address(0)) revert InvalidAccount(); Mint memory mint = pendingMints[_account]; if (mint.base == 0) revert AcountHasNoPendingMint(_account); if (mint.random.length == 0) revert RevealNotReady(); delete pendingMints[_account]; for (uint256 i; i <...
6,147,345
./full_match/1/0x2fC246149B4B8d7bcEF6188A10AF1791380227f1/sources/src/StarterPack/StarterPackV1.sol
Get current StarterPack prices return prices Array of prices
function getStarterPackPrices() external view returns (uint256[] memory prices) { return _starterPackPrices; }
8,434,663
// SPDX-License-Identifier: MIT pragma solidity ^0.8.6; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/utils/Address.sol"; interface Decimals { ...
pool data view functions state modifying functions
interface IIronSwap { event AddLiquidity( address indexed provider, uint256[] tokenAmounts, uint256[] fees, uint256 invariant, uint256 tokenSupply ); event TokenExchange( address indexed buyer, uint256 soldId, uint256 tokensSold, uint2...
13,069,901
//Address: 0xc99f359f73626e475ee86caab459a4b34ae93fea //Contract name: DungeonTokenAuction //Balance: 0 Ether //Verification Date: 3/10/2018 //Transacion Count: 9 // CODE STARTS HERE pragma solidity ^0.4.19; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization co...
Checks if a given address is the current owner of a particular token. _claimant The address we are validating against. _tokenId Token ID/
function _owns(address _claimant, uint _tokenId) internal view returns (bool) { return tokenIdToOwner[_tokenId] == _claimant; }
1,793,787
/** Copyright 2019 PoolTogether LLC This file is part of PoolTogether. PoolTogether 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 under version 3 of the License. PoolTogether is distributed in the hope that it...
Transfers tokens from the cToken contract to the sender. Updates the accounted balance./ Update the total of this contract Withdraw from Compound and transfer
function _withdraw(uint256 _amount) internal { require(_amount > 0, "withdrawal is not greater than zero"); accountedBalance = accountedBalance.sub(_amount); require(cToken.redeemUnderlying(_amount) == 0, "could not redeem from compound"); require(token().transfer(msg.sender, _amount), "could not tr...
930,197
./full_match/1/0x73d6B1EF5227EA7f97426a9ADE2b9006eb88eE5D/sources/contracts/token/MRANDMRSWOJAK.sol
Returns the symbol of the token, usually a shorter version of the name./
function symbol() public view returns (string memory) { return _symbol; }
2,991,236
// SPDX-License-Identifier: GPLv2 pragma solidity 0.6.12; import "@openzeppelin/contracts/math/SafeMath.sol"; import "../DigitalaxAccessControls.sol"; import "./interfaces/IERC20.sol"; import "../oracle/IDigitalaxMonaOracle.sol"; import "../EIP2771/BaseRelayRecipient.sol"; import "@openzeppelin/contracts/utils/Reentr...
allows for the recovery of incorrect ERC20 tokens sent to contract/ Cannot recover the staking token or the rewards token require( tokenAddress != address(monaToken), "Cannot withdraw the rewards token" );
function reclaimERC20( address _tokenAddress, uint256 _tokenAmount ) external { require( accessControls.hasAdminRole(_msgSender()), "DigitalaxRewardsV2.reclaimERC20: Sender must be admin" ); IERC20(_tokenAddress).transfer(_msgSender(), ...
5,545,726
./full_match/80001/0x75AfbEf84bF6FF8Cafe08872Db2CB77cabebF53f/sources/phopox.sol
Update burnPercent by the previous dev.
function getBurnPercent() external view returns (uint256){ return burnPercent; }
840,420
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.6.12; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./IDetailedERC20.sol"; /// Interface for all Vault Adapter implementations. interface IVaultAdapter { /// @dev Gets the token that the adapter accepts. function token() external view ret...
Interface for all Vault Adapter implementations.
interface IVaultAdapter { function token() external view returns (IDetailedERC20); function totalValue() external view returns (uint256); function deposit(uint256 _amount) external; function withdraw(address _recipient, uint256 _amount) external; pragma solidity ^0.6.12; }
7,269,319
./partial_match/1/0x9391B14dB2d43687Ea1f6E546390ED4b20766c46/sources/contracts/lib/Bytes32Set.sol
Check if a key exists in the Set. self A Set struct key A key to look for. return bool True if the key exists in the Set, otherwise false./
function exists(Set storage self, bytes32 key) internal view returns (bool) { if (self.keyList.length == 0) return false; return self.keyList[self.keyPointers[key]] == key; }
3,560,127
pragma solidity ^0.5.16; import "./CToken.sol"; import "./CTokenNoInterest.sol"; import "./ERC3156FlashLenderInterface.sol"; import "./ERC3156FlashBorrowerInterface.sol"; /** * @title Cream's CCollateralCapErc20 Contract * @notice CTokens which wrap an EIP-20 underlying with collateral cap * @author Cream */ cont...
User supplies assets into the market and receives cTokens in exchange Assumes interest has already been accrued up to the current block minter The address of the account which is supplying the assets mintAmount The amount of the underlying asset to supply isNative The amount is in native or not return (uint, uint) ...
function mintFresh( address minter, uint256 mintAmount, bool isNative ) internal returns (uint256, uint256) { initializeAccountCollateralTokens(minter); uint256 allowed = comptroller.mintAllowed(address(this), minter, mintAmount); if (allowed != 0) { ...
6,292,233
// SPDX-License-Identifier: MIT /** * @title Rock Paper Scissors Lizard Spock * @author Clément Lesaege - <clement@lesaege.com> */ /* This program is free software. It comes without any warranty, to the extent permitted by applicable law. You can redistribute it and/or modify it under the terms of the Do What Th...
To be called by j2 and provided stake. _c2 The move submitted by j2./
function play(Move _c2) payable public { c2=_c2; lastAction=block.timestamp; }
12,812,423
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 ...
Transfers control of the contract to a newOwner. _newOwner The address to transfer ownership to./
function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; }
2,150,279
./full_match/10/0xacDC0755137Bd4B1b148802a927CEA137e08B45b/sources/contracts/plugins/Crafter/CrafterMint.sol
Must be recipe creator Used to withdraw recipe outputs. Reverse logic as deposit(). withdrawAmount How many times the craft outputs should be withdrawn/ Requires Decrease craftableAmount (check-effects)Pop tokenIds from end of array
function withdraw(uint96 withdrawAmount) external onlyOwner { require(withdrawAmount > 0, 'CrafterTransfer: withdrawAmount cannot be 0!'); require(withdrawAmount <= craftableAmount, 'CrafterTransfer: Not enough resources!'); craftableAmount -= withdrawAmount; for (uint256 i = 0; i ...
3,780,288
pragma solidity 0.5.12; import "../MVNTokenCore.sol"; contract MVNTokenCoreMock is MVNTokenCore { constructor( address transitAccount ) public MVNTokenCore(transitAccount) { } function onlyGatewayMock() public view onlyGateway { // sol...
Causes a compilation error if super._unpause is not internal
function _unpause( address account ) internal { super._unpause(account); }
6,379,882
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 asser...
Check if `_childId` is a child TAO of `_taoId` _taoId The TAO ID to be checked _childId The child TAO ID to check return true if yes. Otherwise return false./
function isChild(address _taoId, address _childId) public view returns (bool) { require (isExist(_taoId) && isExist(_childId)); Family storage _family = families[_taoId]; Family memory _childFamily = families[_childId]; uint256 _childInternalId = _family.childInternalIdLookup[_childId]; return ( _childInt...
10,007,399
// BK Ok - Recent version pragma solidity ^0.4.11; // ---------------------------------------------------------------------------- // Dao.Casino Crowdsale Token Contract // // Enjoy. (c) BokkyPooBah / Bok Consulting Pty Ltd for Dao.Casino 2017 // The MIT Licence. // ----------------------------------------------------...
BK Ok - Propose ownership transfer
function transferOwnership(address _newOwner) onlyOwner { newOwner = _newOwner; }
7,879,878
./partial_match/222000222/0x40C4A5Ad0C2a3213C0c3D47eE077849cbE7A24a0/sources/contracts/collections/NFTify721.sol
Handle mint request Requirement: - caller must be owner or controller/
function mint( address account, uint256 id, bytes memory data ) public { require( _msgSender() == controller || _msgSender() == owner(), "NFTify721: only owner or controller" ); _safeMint(account, id, data); }
16,909,842
./partial_match/1/0x89bc08BA00f135d608bc335f6B33D7a9ABCC98aF/sources/contracts/LoanCore.sol
Returns the LoanData struct for the specified loan ID. loanId The ID of the given loan. return loanData The struct containing loan state and terms./
function getLoan(uint256 loanId) external view override returns (LoanLibrary.LoanData memory loanData) { return loans[loanId]; }
15,886,952
pragma solidity ^0.4.24; /** * @title SafeMath * @dev Math operations with safety checks that revert on error */ library SafeMath { int256 constant private INT256_MIN = -2**255; /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint256 a, uint256 b)...
check an account's status return bool/
function CheckStatus(address account) public view returns (bool) { require(account != address(0)); bool currentStatus = status[account]; return currentStatus; }
15,792,462
./full_match/137/0x9D006610b7F491aaCd03449D13020Ca99f62A661/sources/contracts/vdfyn.sol
Leave the lair. Claim back your QUICK.
function leave(uint256 _dQuickAmount) external { uint256 totalDQuick = totalSupply(); uint256 quickAmount = _dQuickAmount.mul(quick.balanceOf(address(this))).div(totalDQuick); _burn(msg.sender, _dQuickAmount); quick.transfer(msg.sender, quickAmount); }
4,724,798
./partial_match/1/0x9e376F30D4e47Cc4f792BfC682caeb5dc76155f7/sources/MarketCreationRewards.sol
function to calculate user incentive for market creation _createdBy Address of market creator _gasCosumed Gas consumed by the transaction till now _marketId Index of market/Adding buffer gas for below calculations
function calculateMarketCreationIncentive(address _createdBy, uint256 _gasCosumed, uint64 _marketId) external onlyInternal { _checkIfCreatorStaked(_createdBy, _marketId); marketCreationRewardUserData[_createdBy].marketsCreated.push(_marketId); uint256 gasUsedTotal; gasUsedTotal = _gasCosumed...
15,474,625
/** ▓▓▌ ▓▓ ▐▓▓ ▓▓▓▓▓▓▓▓▓▓▌▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▄ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▌▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓ ▓▓▓▓▓▓▓▀ ▐▓▓▓▓▓▓ ▐▓▓▓▓▓ ▓▓▓▓▓▓ ▓▓▓▓▓ ▐▓▓▓▓▓▌ ▐▓▓▓▓▓▓ ▓▓▓▓▓▓▄▄▓▓▓▓▓▓▓▀ ▐▓▓▓▓▓▓▄▄▄▄ ▓▓▓▓▓▓▄▄▄▄ ▐▓▓▓▓▓▌ ...
Remove the lock of `creator`. If no lock present, do nothing. Not the last lock, so we need to move the last lock into the emptied position.
function releaseLock( LockSet storage self, address _creator ) internal { uint256 positionPlusOne = self.positions[_creator]; if (positionPlusOne != 0) { uint256 lockCount = self.locks.length; if (positionPlusOne != lockCount) { Lock memory...
12,847,213
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/AccessControl.sol"; contract Authorizeable is AccessControl { bytes32 public constant MODERATOR_ROLE = keccak256("MODERATOR_ROLE"); constructor (){ _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); _setu...
Order must be listed and not be expired. /
function validateOrderParameters(Order memory order, bytes32 hash_) internal view returns (bool) { if (order.listingTime > block.timestamp || (order.expirationTime != 0 && order.expirationTime <= block.timestamp)) { return false; } return true; } ...
13,121,238
./full_match/5/0x56fAa0936951344e2DcBB2faD6348DeA04c967de/sources/contracts/MvM.sol
setter function to pause/start level one mint
function setCanMintL1(bool _pauseMintL1) public onlyOwner { pauseMintL1 = _pauseMintL1; }
1,923,974
./partial_match/42/0xAE311d0b6302606F4927940158Aba7a2dbd22553/sources/DisposableGovernance.sol
Calls the Oraclize Query to close a given Claim after a given period of time. id Claim Id to be closed time Time (in seconds) after which Claims assessment voting needs to be closed
function closeClaimsOraclise(uint id, uint time) external onlyInternal { bytes32 myid = _oraclizeQuery(4, time, "URL", "", 3000000); _saveApiDetails(myid, "CLA", id); }
3,432,858
// SPDX-License-Identifier: MIT pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; // File: node_modules\witnet-solidity-bridge\contracts\interfaces\IWitnetRequestBoardEvents.sol /// @title Witnet Request Board emitting events interface. /// @author The Witnet Foundation. interface IWitnetRequestBoardE...
File: contracts\interfaces\IWitmonAdmin.sol Witty Creatures 2.0 Token only-owner interface. Otherplane Labs, 2021.
interface IWitmonAdmin { function setDecorator(IWitmonDecorator _decorator) external; function setParameters( address _signator, uint8[] calldata _percentileMarks, uint256 _expirationBlocks ) external; function stopBatching() external payable; function startHatching() exte...
6,983,722
pragma solidity ^0.4.22; contract createInConstructor { Test2 test2; constructor() { test2 = new Test2(); } function add(int a, int b) returns(int){ //Simply add the two arguments and return return a+b; } } contract Test2 { constructor() { Test3 test3 = new Test3(); } fu...
Simply add the two arguments and return
function substract(int a, int b) returns(int){
1,810,739
./full_match/137/0x1F5BCC2239649A698D89952959900492d8c41678/sources/home/roel/work/stamkracht/dutchdefi/src/contracts/Strategies/MaticAaveStrategy.sol
Repeatedly supplies and borrows {want} following the configured {borrowRate} and {borrowDepth} _amount amount of {want} to leverage/
function _leverage(uint256 _amount) internal { for (uint i = 0; i < borrowDepth; i++) { ILendingPool(lendingPool).deposit(want, _amount, address(this), 0); _amount = _amount.mul(borrowRate).div(100); ILendingPool(lendingPool).borrow(want, _amount, INTEREST_RATE_MODE, 0, ...
3,763,705
pragma solidity 0.6.2; pragma experimental ABIEncoderV2; import 'RLP.sol'; import 'StorageStructure.sol'; /// @title CertiÐApp Smart Contract /// @author Soham Zemse from The EraSwap Team /// @notice This contract accepts certificates signed by multiple authorised signers contract CertiDApp is StorageStructure { us...
return number of bytes until the data
function _payloadOffset(uint memPtr) private pure returns (uint) { uint byte0; assembly { byte0 := byte(0, mload(memPtr)) } if (byte0 < STRING_SHORT_START) return 0; else if (byte0 < STRING_LONG_START || (byte0 >= LIST_SHORT_START && byte0 < LIST_LONG_START)) return 1; ret...
6,458,758
./full_match/5/0x213816e69A21320D086a40Af97A5151445e8bFDE/sources/contracts/DeedRenting.sol
returns true if the address can manage Deed Provisioning/
function isProvisioningManager( address _address, uint256 _deedId ) public view override returns (bool) { for (uint i = 0; i < leases[_deedId].length;i++) { uint256 leaseId = leases[_deedId][i]; DeedLease storage lease = deedLeases...
7,060,080
./full_match/80001/0xD98b30b1C64524fDA9Cc427d61871264620281eA/sources/Aviculture.sol
See {IERC1155-safeTransferFrom}./
function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) public payable virtual override { require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: caller is not owner nor...
5,648,888
./partial_match/1/0x4F1982dcbB37021eA9F8Ed5dFa1C5a4b73f92665/sources/contracts/proxy/ForwardTarget.sol
Storage initialization of cloned contract This is used to initialize the storage of the forwarded contract, and should (typically) copy or repeat any work that would normally be done in the constructor of the proxied contract. Implementations of ForwardTarget should override this function, and chain to super.initialize...
function initialize(address _self) public virtual onlyConstruction { address _implAddress = address(ForwardTarget(_self).implementation()); require( _implAddress != address(0), "initialization failure: nothing to implement" ); setImplementation(_implAddress); ...
15,925,949
./full_match/1/0x820A4AeeDA79fD49b82dA730cdA9B952FB649D39/sources/contracts/EtherFreakers.sol
Birth a new freaker, given enough energy. to Recipient's address/ Roughly pick species 0 (1x) -> fortune / offense 1 (2x) -> fortune / defense 2 (2x) -> fortune / agility 3 (3x) -> offense / defense 4 (3x) -> defense / offense 5 (4x) -> agility / offense 6 (4x) -> agility / defense ...
function birthTo(address payable to) payable public { uint256 middle = middlePrice(); require(msg.value > middle * 1005 / 1000, "Not enough energy"); uint128 freakerId = numTokens++; uint8 speciesDie = uint8(_randomishIntLessThan("species", 20)); uint8 species = ( ...
3,066,549
/** *Submitted for verification at Etherscan.io on 2020-11-01 */ 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); /*...
Transferring is white-listed to specific minter addresses for now./
function transferFrom( address from, address to, uint256 amount ) public onlyCanTransfer returns (bool) { require( amount <= _balances[from], "ToshiCash: Cannot transfer more than balance" ); _balances[from] = _balances[from].sub(amount); ...
518,513
./full_match/1/0x2ee2bf09A6e559047D26df6F690435E746072e73/sources/browser/rooktest.sol
This interfaces defines the functions of the KeeperDAO liquidity pool that our contract needs to know about. The only function we need is the borrow function, which allows us to take flash loans from the liquidity pool.
interface LiquidityPool { function borrow( address _token, uint256 _amount, bytes calldata _data ) external; }
2,922,320
./full_match/42220/0x6ea01ea80FeB4313C3329e6e9fcA751CCb2cF323/sources/out/ManagedPoolFactory_flat.sol
Interface for ExternalWeightedMath, a contract-wrapper for Weighted Math, Joins and Exits./
interface IExternalWeightedMath { function calculateInvariant(uint256[] memory normalizedWeights, uint256[] memory balances) external pure returns (uint256); function calcOutGivenIn( uint256 balanceIn, uint256 weightIn, uint256 balanceOut, uint256 weightO...
16,352,655
./full_match/4/0xA1Ca72cC58E97F5b25785A05BDdC2CcA6736175D/sources/SnakesHaveLegs.sol
From The HashMarks https:etherscan.io/address/0xc2c747e0f7004f9e8817db2ca4997657a7746928codeF7L612
function validateName(string memory str) public pure returns (bool){ bytes memory b = bytes(str); if(b.length < 1) return false; bytes1 lastChar = b[0]; for(uint i; i<b.length; i++){ bytes1 char = b[i]; if( ) return false; ...
701,740
// SPDX-License-Identifier: Apache-2.0 pragma solidity >=0.4.22 <0.9.0; interface IEthLocker { function initDispatcher(address targetAddr) external; function lockEth(uint256 amount, string memory accountId) external; function unlockEth(bytes memory proofData, uint64 proofBlockHeight) external; funct...
In case of loss For investments Rewards
interface IEthLocker { function initDispatcher(address targetAddr) external; function lockEth(uint256 amount, string memory accountId) external; function unlockEth(bytes memory proofData, uint64 proofBlockHeight) external; function burnResult(bytes memory proofData, uint64 proofBlockHeight) external ...
12,665,532
./partial_match/1/0x48b95265749775310B77418Ff6f9675396ABE1e8/sources/@yield-protocol/yieldspace-tv/src/Pool/Pool.sol
/ Buy base with fyToken. The trader needs to have transferred in the necessary amount of fyTokens in advance. to Wallet receiving the base being bought. baseOut Amount of base being bought that will be deposited in `to` wallet. max This has been deprecated and was left in for backwards compatibility. return fyTokenI...
function buyBase( address to, uint128 baseOut, uint128 max ) external virtual override returns (uint128 fyTokenIn) { uint128 fyTokenBalance = _getFYTokenBalance(); Cache memory cache = _getCache(); uint128 sharesOut = _wrapPreview(baseOut).u128(); fyToken...
4,008,286
./partial_match/1/0xF2d93df6fB89e51756d915004211a0a29755BB2b/sources/Include.sol
Contract initializer. called once by the factory at time of deployment/
function __Governable_init_unchained(address governor_) virtual internal initializer { governor = governor_; emit GovernorshipTransferred(address(0), governor); }
10,999,747
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import '@openzeppelin/cont...
calculate rewards for given token id tokenID the token id to calculate for/
function calculateRewards(uint256 tokenID) public view returns (uint256) { require(stakes[tokenID].lastClaimedBlock != 0, "token not staked"); uint256 rewards; uint256 blocksPassed; uint128 lastClaimedBlock = stakes[tokenID].lastClaimedBlock; uint256 from; uint256 ...
550,770
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.9; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract AOC01 is ERC20 { constructor(uint256 initialSupply) ERC20("AdventOfCode01", "AOC01") { _mint(msg.sender, initialSupply); } function decimals() public pure override returns (uint8...
Burns all coins in the users wallet then solves part 1 of AOC 2021 Day 1 based on the input data and mints the respective amount of coints for the user./
function part1(uint256[] memory input) public { _burn(msg.sender, balanceOf(msg.sender)); uint256 solution = 0; uint256 i; for (i = 1; i < input.length; i++) { if (input[i] > input[i - 1]) { solution = solution + 1; } } _mint(msg.sender, solution); }
6,398,726
./partial_match/1/0xe0ce4a91f9EbA6539947ec2Ef8Fe92cE4aB3D272/sources/Vaulted.sol
Get the trusted balance of a particular account (the account's trust). Only the account with a trusted balance greater than cipher (0) can claim from its trust. _account The address of the account for which to retrieve the trust/
function account(address _account) public view returns (uint256) { return _vault.trust[_account]; }
4,190,941
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be *...
Returns the pending withdrawal amount for the phunk sale /
function getPendingWithdrawal() external view returns (uint pendingWithdrawal) { return pendingWithdrawals[msg.sender]; }
14,931,872
//SPDX-License-Identifier: WTFPL pragma solidity ^0.7.6; import "hardhat/console.sol"; contract ZMSToken { // public modifier makes a variable readable from outside the contract. string public name = "Zymosis Boozing Society Token"; string public symbol = "ZMS"; // fixed amount of tokens uint256 ...
check that the transaction sender has enough tokens, otherwise reverts
function transfer(address _to, uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value, "NOT_ENOUGH_TOKENS"); balanceOf[msg.sender] -= _value; balanceOf[_to] += _value; emit Transfer(msg.sender, _to, _value); return true; }
15,836,670
pragma solidity ^0.4.23; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/AddressUtils.sol"; import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; import "./ERC721HoldingsBasic.sol"; /** * @title Holdings of ERC-721 Non-Fungible Token Standard, basic im...
Gets the owner of token with ID at sepcific origin _id ID to query the existance of _origin address of the holder's origin return owner address currently marked as the owner/
function _ownerOf(uint256 _id, address _origin) internal view returns (address) { require(_origin != address(0)); return ERC721(_origin).ownerOf(_id); }
12,729,798
pragma solidity 0.4.26; import "./ISovrynSwapNetwork.sol"; import "./IConversionPathFinder.sol"; import "./converter/interfaces/IConverter.sol"; import "./converter/interfaces/IConverterAnchor.sol"; import "./converter/interfaces/ISovrynSwapFormula.sol"; import "./utility/ContractRegistryClient.sol"; import "./utility/...
validates msg.value and prepares the conversion source token for the conversion _sourceToken source token of the first conversion step _anchor converter anchor of the first conversion step _amount amount to convert from, in the source token/ ETH validate msg.value EtherToken converter - deposit the ETH int...
function handleSourceToken( IERC20Token _sourceToken, IConverterAnchor _anchor, uint256 _amount ) private { IConverter firstConverter = IConverter(_anchor.owner()); bool isNewerConverter = isV28OrHigherConverter(firstConverter); if (msg.value > 0) { require(msg.value == _amount, "ERR_ETH_AMOUNT_MISMAT...
12,943,192
./full_match/40/0x34bc1b87f60e0a30c0e24FD7Abada70436c71406/sources/contracts/interfaces/IWrapToken.sol
Interface for WrapToken
interface IWrapToken is IERC20 { function originToken() external view returns(address); function depositAllowance(address owner, address spender) external view returns (uint256); function depositApprove(address spender, uint256 amount) external; function depositFrom(address from, address to, uint...
9,551,859
./partial_match/1/0x5f1F5b4BFAa78E4e1F8063b71E96656bAF965Db7/sources/KongEntropyDirectMint.sol
primaryPublicKeyHash Hash of the primary public key. tertiaryPublicKeyX The x-coordinate of the tertiary public key. tertiaryPublicKeyY The y-coordinate of the tertiary public key. to Recipient. blockNumber Block number of the signed blockhash. rs The array co...
function submitEntropy( bytes32 primaryPublicKeyHash, uint256 tertiaryPublicKeyX, uint256 tertiaryPublicKeyY, address to, uint256 blockNumber, uint256[2] memory rs ) public { bytes32 tertiaryPublicKeyHash = RegisterInterface(_regAddress).getTe...
15,523,972
/** * Copyright 2017-2020, bZeroX, LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0. */ pragma solidity 0.5.17; pragma experimental ABIEncoderV2; import "../core/State.sol"; import "../events/ProtocolSettingsEvents.sol"; import "../openzeppelin/SafeERC20.sol"; import "../mixins/ProtocolTo...
The owner calls this function to deposit protocol tokens. amount The tokens of fees to send. /
function depositProtocolToken(uint256 amount) external onlyOwner whenNotPaused { protocolTokenHeld = protocolTokenHeld.add(amount); IERC20(protocolTokenAddress).safeTransferFrom(msg.sender, address(this), amount);
1,801,171