file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./full_match/5/0xbC249A1D91DbD54CEEfBBdC66e01FC515FA3980c/sources/src/contracts/facilitators/aave/tokens/GhoAToken.sol
Transfers the underlying asset to `target`. It performs a mint of GHO on behalf of the `target` Used by the Pool to transfer assets in borrow(), withdraw() and flashLoan() target The recipient of the underlying amount The amount getting transferred/
function transferUnderlyingTo(address target, uint256 amount) external virtual override onlyPool { IGhoToken(_underlyingAsset).mint(target, amount); }
7,037,069
// SPDX-License-Identifier: MIT pragma solidity 0.8.1; import "./IlluviumPoolBase.sol"; /** * @title Illuvium Core Pool * * @notice Core pools represent permanent pools like ILV or ILV/ETH Pair pool, * core pools allow staking for arbitrary periods of time up to 1 year * * @dev See IlluviumPoolBase for m...
Gets the balance of a particular address ERC20 `function balanceOf(address _owner) public view returns (uint256 balance)` _owner the address to query the the balance for return balance an amount of tokens owned by the address specified/ read the balance and return
function balanceOf(address _owner) public view returns (uint256 balance) { return tokenBalances[_owner]; }
898,504
/** *Submitted for verification at Etherscan.io on 2021-02-05 */ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.6.8; /* * @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 ...
This function must be called when the ENS Manager contract is replaced and the address of the new Manager should be provided. _newOwner The address of the new ENS manager that will manage the root node./
function changeRootNodeOwner(address _newOwner) external override onlyOwner { ensRegistry.setOwner(rootNode, _newOwner); emit RootNodeOwnerChange(rootNode, _newOwner); }
2,352,762
pragma solidity ^0.5.17; interface IERC20 { function TOTALSUPPLY313() external view returns (uint); //inject NONSTANDARD NAMING function BALANCEOF488(address account) external v...
inject NONSTANDARD NAMING
function DIV198(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
13,006,496
./full_match/137/0x03aB6c074373e7957e07bF3FEb0629E5323a464B/sources/contracts/CourseContract.sol
Teacher can also boot student which sends student's stake to multisig.
function bootStudent(address _account) external onlyRole(TEACHER){ require(hasRole(STUDENT, _account),"Address is not enrolled :/"); _revokeRole(STUDENT, _account); require(success, "Failed to boot >:("); factory.updateBoot(_account, studentStake); emit DropOut(_account); ...
3,775,644
pragma solidity ^0.4.18; import "./TokenInterface.sol"; import "./ClientInterface.sol"; import "./SafeMath.sol"; /** @title DCourt Arbitration contract @author Ihab McShea Nour Haridy */ contract DCArbitration { using SafeMath for uint256; DCTInterface DCToken; /* Variables */ uint256 ro...
/ rounds[(block.number.sub(genesisBlock)).div(blocksPerRound)].roundWeight = roundWeights[(block.number.sub(genesisBlock)).roundWeight.div(blocksPerRound)].add(cases[_caseID].voteWeight);
function finalize(uint256 _caseID) public onlyWhenOwner returns(bool finalized){ require(block.number > cases[_caseID].block + cases[_caseID].trialDuration + votingPeriod + unlockingPeriod); require(cases[_caseID].decided == false); bool verdict = cases[_caseID].ayes > cases[_caseID].naye...
14,087,313
// // %(/************/#& // (**, ,**/# // %/*, **(& // (*, //% // %*, /( // (* ,************************/ /*% // // /( ...
main function, which accept new investments and do dividends payouts if you send 0 ETH to this function, you will receive your dividends ensure that payment not from contract if contract is on restarting phase - do some work before restart if it is currently preEntrance phase
function() payable public { if (isContract()) { revert(); } if (pause) { doRestart(); return; } if (0 == msg.value) { return; } if (preEntrance.isActive()) { require(preEntrance.isMember(msg.send...
13,062,339
// Sources flattened with hardhat v2.3.0 https://hardhat.org // File contracts/shared/interfaces/IDiamondCut.sol // SPDX-License-Identifier: MIT pragma solidity 0.8.1; /******************************************************************************\ * Author: Nick Mudge <nick@perfectabstractions.com> (https://twitter...
Need to ensure there is no overflow of _ghst33% to burn address17% to Pixelcraft wallet40% to rarity farming rewards10% to DAO Using 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF as burn address. GHST token contract does not allow transferring to address(0) address: https:etherscan.io/address/0x3F382DbD960E3a9bbCeaE22651E...
function purchase(address _from, uint256 _ghst) internal { AppStorage storage s = LibAppStorage.diamondStorage(); uint256 burnShare = (_ghst * 33) / 100; uint256 companyShare = (_ghst * 17) / 100; uint256 rarityFarmShare = (_ghst * 2) / 5; uint256 daoShare = (_ghst - burnS...
2,501,947
// File: contracts/interfaces/IRoyaltySharing.sol /// @title Interface for IRoyaltySharing. pragma solidity 0.8.6; interface IRoyaltySharing { //TODO: event DefineEvents(); function deposit( uint256 creators, uint256 project, uint256 rewards ) external payable; } // File: @ope...
Since all the membership cards are the same, they all point to the same image.
function tokenURI(uint256) public view override returns (string memory) { string memory baseURI = _baseURI(); if (bytes(baseURI).length > 0) { return string(abi.encodePacked(baseURI, Strings.toString(1))); } return ""; }
14,570,814
// SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; // NOTE for debugging only import 'hardhat/console.sol'; // NOTE // Consider storing a board as an N by M matrix of uint256 // values only. Any operation will modify this map instead // of storing info to create the map on demand. In other words, // mov...
strip everything but the cell type
function _isWalkable(uint256 _terrain) internal pure returns (bool) { _terrain &= 0x0f; if (_terrain == CELL_CORRIDOR || _terrain == CELL_DOOR) { return true; } return false; }
1,055,543
./full_match/1/0x57E91a1E8a97864417c49418276D4B17b202123e/sources/contracts/codes/N721Card.sol
Implementing the ERC-2981 royaltyInfo() function
function royaltyInfo(uint256 tokenId, uint256 salePrice) external view override returns (address receiver, uint256 royaltyAmount) { return (SYS_ADDRESS, salePrice * royaltyPercent / 10000); }
16,412,658
/** * Created on 2018-06-05 16:37 * @summary: Our NFT Minting Contract which inherits ERC721 capability from LSNFT * @author: Fazri Zubair & Farhan Khwaja */ pragma solidity ^0.4.23; pragma solidity ^0.4.23; /* NFT Metadata Schema { "title": "Asset Metadata", "type": "object", "properties": { ...
Gets the token ID at a given index of all the tokens in this contract Reverts if the index is greater or equal to the total number of tokens _index uint256 representing the index to be accessed of the tokens list return uint256 token ID at the given index of the tokens list/
function tokenByIndex(uint256 _index) public view returns (uint256) { require (_index < totalSupply()); return allTokens[_index]; }
7,722,416
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // >>>>>>>>>> !IMPORTANT! <<<<<<<<<<< // this is an invalid token sale contract which requrie more gas with each allocation, why though ? // i managed to fix the above by performing checks on mapping instead of array import "@openzeppelin/contracts/access/Ownabl...
Setups and starts the sale. minimumAllocationValue Minimum allocation value. maximumAllocationValue Maximum allocation value. totalAllocationsLimitValue Total allocations limit. closingAllocationsRemainderValue Remaining amount of allocations allowing to close sale before reaching total allocations limit./
function startSale( uint256 minimumAllocationValue, uint256 maximumAllocationValue, uint256 totalAllocationsLimitValue, uint256 closingAllocationsRemainderValue ) public onlyOwner { require(!_wasStarted, "PresalePublic: Sale was already started"); _closingAllocationsRemainder = closingAlloc...
983,032
./full_match/80001/0xD4b7bd77B3a04c4000387dBF711040f23C31Ef4b/sources/contracts/ERC721A.sol
Internal function to invoke {IERC721Receiver-onERC721Received} on a target 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 optional data to send along with the call return bool w...
) private returns (bool) { function _approve( address to, uint256 tokenId, address owner } function _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data try IERC721Receiver(to).onERC721Received(_msg...
5,568,985
pragma solidity ^0.4.13; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) public constant returns (uint256); function transfer(address to, uint256 value...
this is a seperate function so user could query it before crowdsale starts
function contributorCap(address contributor) constant returns (uint) { return list.getCap(contributor); }
12,633,516
./partial_match/1/0x36888C29a7DcF91D3102a5B3E515bd355cBf75d4/sources/contracts/SpreadSheet.sol
Set the Merkle root of the BOTS -> SHEET transition Merkle tree. Emits a {SetTransitionMerkleRoot} event. Requirements: - The caller must be the owner. newTransitionMerkleRoot The new transition Merkle root.
function setTransitionMerkleRoot(bytes32 newTransitionMerkleRoot) external onlyOwner { transitionMerkleRoot = newTransitionMerkleRoot; emit SetTransitionMerkleRoot(newTransitionMerkleRoot); }
3,982,119
// SPDX-License-Identifier: MIT pragma solidity 0.8.0; import "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/cont...
Mints fBTCB+ with BTCB. _amount Amount of BTCB used to mint fBTCB+/
function mintFBTCBPlus(uint256 _amount) public { require(_amount > 0, "zero amount"); IERC20Upgradeable(BTCB).safeTransferFrom(msg.sender, address(this), _amount); IForTubeBank(FORTUBE_BANK).deposit(BTCB, _amount); uint256 _fbtcb = IERC20Upgradeable(FORTUBE_BTCB).balanceOf(...
5,536,490
./partial_match/1/0xa22cf004eD5105608b39c48bE688BD9B9026a046/sources/FeePool.sol
A function that lets you easily convert an amount in a source currency to an amount in the destination currency sourceCurrencyKey The currency the amount is specified in sourceAmount The source amount, specified in UNIT base destinationCurrencyKey The destination currency/ If there's no change in the currency, then ...
function effectiveValue(bytes4 sourceCurrencyKey, uint sourceAmount, bytes4 destinationCurrencyKey) public view rateNotStale(sourceCurrencyKey) rateNotStale(destinationCurrencyKey) returns (uint) { if (sourceCurrencyKey == destinationCurrencyKey) return sourceAmou...
4,057,242
./full_match/11155111/0xbb15f061FA7070C8CbB1584A25997D7A06bc732f/sources/project_/contracts/Raffle.sol
when is the winner supposed to be picked? This is the function that the ChainLink Automation nodes call to see if it is time to perform an upkeep. The following should be true for this to return true: 1. The time interval has passed between raffle runs 2. The raffle is in the OPEN state. 3. The contract has ETH. 4. T...
function checkUpkeep (bytes memory /* checkData */) public view returns (bool upkeepNeeded, bytes memory /* performData */) { bool timeHasPassed = (block.timestamp - s_lastTimeStamp) >= i_interval; bool isOpen = s_raffleState == RaffleState.OPEN; bool hasBalance = address(this).balance > 0; bool hasPl...
3,823,759
pragma solidity 0.4.19; contract ERC20Interface { function transfer(address to, uint256 value) public returns (bool); function transferFrom(address from, address to, uint256 value) public returns (bool); function balanceOf(address who) public view returns (uint256); } /* 1. Contract is initiated by storin...
A set of functions to get required variables /
function balanceOf(address who) public view returns (uint256 balance) { return deposits[who].balance; }
6,632,981
// SPDX-License-Identifier: MIT pragma solidity >=0.8.3; import '@openzeppelin/contracts/utils/math/SafeMath.sol'; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import "./ShtfiToken.sol"; ...
Update reward variables for all farms. Be careful of gas spending!
function massUpdateFarms() public { uint256 length = farmInfo.length; for (uint256 pid = 0; pid < length; ++pid) { updateFarm(pid); } }
7,290,108
pragma solidity ^0.4.22; // File: contracts/ERC20Interface.sol // https://github.com/ethereum/EIPs/issues/20 interface ERC20 { function totalSupply() external view returns (uint supply); function balanceOf(address _owner) external view returns (uint balance); function transfer(address _to, uint _v...
should be called off chain with as much gas as needed get an array of all suppliers return An array of all suppliers
function getSuppliers() public view returns(SupplierInterface[]) { return suppliers; }
1,064,867
pragma solidity ^0.4.24; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws wh...
`onlyController` changes the location that ether is sent _newVaultAddress The address that will receive the ether sent to this/
function setVault(address _newVaultAddress) public onlyController { vaultAddress = _newVaultAddress; }
15,345,992
// SPDX-License-Identifier: MIT pragma solidity 0.8.0; import "./owned.sol"; import "./StopTheWarOnDrugs.sol"; import "./context.sol"; import "./address-utils.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; contract SWDMarketPlace is Owned, Context, Initializable{ using Add...
Mints a new NFT. This is an internal function which should be called from user-implemented external mint function. Its purpose is to show and properly initialize data structures when using this implementation. _to The address that will own the minted NFT. _tokenId of the NFT to be minted by the_msgSender()./
function _mint( address _to, uint256 _tokenId ) internal virtual { require(_to != address(0), ZERO_ADDRESS); require(idToOwner[_tokenId] == address(0), NFT_ALREADY_EXISTS); _addNFToken(_to, _tokenId); if (_to.isContract()) { bytes4 retval = ERC721TokenReceiver(_to).onER...
5,804,301
/** The software and documentation available in this repository (the "Software") is protected by copyright law and accessible pursuant to the license set forth below. Copyright © 2019 Staked Securely, Inc. All rights reserved. Permission is hereby granted, free of charge, to any person or organizatio...
Implemented to receive ERC721 tokens. Main use case is for users to burn and withdraw their RAYT and withdraw the underlying value. It clears it's associated token data, burns the RAYT, and transfers the capital + yield Must return hash of the function signature for tx to be valid. from - The ...
function onERC721Received ( address /*operator*/, address from, uint256 tokenId, bytes /*data*/ ) public notDeprecated returns(bytes4) { bytes32 convertedTokenId = bytes32(tokenId); if ( (IRAYToken(_storage.getContractAd...
15,852,841
./partial_match/3/0xB205ed9d4822C48748194e2Aa8EdCf53d2eB6e84/sources/PPToken.sol
------------------------------------------------------------------------ Transfer the balance from token owner's account to to account - Owner's account must have sufficient balance to transfer - 0 value transfers are allowed ------------------------------------------------------------------------require(_value > 0, 'V...
function transfer(address to, uint tokens) public override returns (bool success) { require(balances[msg.sender] >= tokens, 'Insufficient balance'); balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, t...
5,194,494
./partial_match/1/0x81677c261019760859c44bC7D8a70F8C4DbB388e/sources/CrossDelegate.sol
revoke storeman debt storageData Cross storage data xHash hash of HTLC random number
function srcDebtRevoke(CrossTypes.Data storage storageData, bytes32 xHash) external { storageData.htlcTxData.revokeDebtTx(xHash, HTLCTxLib.TxStatus.AssetLocked); bytes32 srcSmgID; bytes32 destSmgID; (srcSmgID, destSmgID) = storageData.htlcTxData.getDebtTx(xHash); ...
3,920,920
./full_match/1/0xffdAe6724380828178EA290444116BcF5d56cF3D/sources/contracts/EricOrb.sol
Returns if a response to a trigger exists, based on the timestamp of the response being non-zero. triggerId_ ID of a trigger to which to check the existance of a response of. return bool If a response to a trigger exists or not./
function _responseExists(uint256 triggerId_) internal view returns (bool) { if (responses[triggerId_].timestamp != 0) { return true; } return false; }
4,995,420
pragma solidity ^0.4.23; import "openzeppelin-solidity/contracts/access/rbac/RBAC.sol"; contract NAutoblock is RBAC{ string constant AUTOBLK_ROLE = "autoblocker"; constructor() public {} modifier onlyAutoblockers() { require(isAutoblocker(msg.sender), "Autoblocker rights required."); _;...
Allows autoblockers to add people to the autoblocker list. _toAdd The address to be added to autoblocker list./
function addToAutoblockers(address _toAdd) public { require(!isAutoblocker(_toAdd), "Address is autoblocker already"); addRole(_toAdd,AUTOBLK_ROLE); }
913,360
pragma solidity ^0.5.5; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high l...
Withdraw all available tokens./
function withdrawEPool() public whenNotPaused nonReentrant returns (bool) { UserSp storage eStakingPool = users[_msgSender()].ePool; require(eStakingPool.staked > 0 != eStakingPool.earned > 0, "Not available"); if (eStakingPool.earned > 0) { _vault.transferToken(moon, _msgSender(...
6,159,423
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // si...
Returns to normal state. Requirements: - The contract must be paused./
function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); }
11,733,670
pragma solidity 0.6.12; interface IERC20 { function TOTALSUPPLY831() external view returns (uint256); //i...
inject NONSTANDARD NAMING
function LOG714(address p0, address p1, string memory p2) internal view {
14,087,724
pragma solidity ^0.4.24; contract ExchangeCash { address owner; constructor() public { owner = msg.sender; } uint fee = 10;// 1% enum S { Inited, Rejected, Cancelled,Done } enum T { Station, Customer } struct Exchange { address stationOwner; address customer; ...
get handshake balance by hid
function getBalance(uint hid) public constant returns(uint){ Exchange storage p = ex[hid]; return p.escrow; }
13,000,879
./full_match/3/0xc96c8c47CFcA7D013e551aB16a89E11bDB8701c0/sources/browser/5ive/FiveBuckToken.sol
Mints the amount of Token to the Owner-address (Only callable from the owner)
function mint(uint256 amount) public { require(msg.sender == owner()); _mint(owner(), amount); }
8,149,637
pragma experimental ABIEncoderV2; pragma solidity ^0.6.6; import "./interfaces/SafeMathUpgradeable.sol"; import "./interfaces/IERC20MetadataUpgradeable.sol"; import "./interfaces/SafeERC20Upgradeable.sol"; import "./interfaces/AddressUpgradeable.sol"; import "./interfaces/ReentrancyGuardUpgradeable.sol"; import "./int...
Interface for the optional metadata functions from the ERC20 standard. _Available since v4.1._/
interface IERC20MetadataUpgradeable is IERC20Upgradeable { function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); function mint(address account, uint256 amount) external; function burn(uin...
10,058,922
/** *Submitted for verification at Etherscan.io on 2021-09-20 */ pragma solidity 0.8.4; /* * @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 suc...
Remove wallet from whitelist Removed wallets still remain in `_whitelistedUsers` array/
function removeWhitelist(address[] memory accounts) external onlyOperator whenNotPaused { for (uint256 i = 0; i < accounts.length; i++) { require(accounts[i] != address(0), "IDOSale: ZERO_ADDRESS"); if (whitelist[accounts[i]]) { whitelist[accounts[i]] = false; ...
6,732,758
pragma solidity ^0.4.24; /* CKBC // Cinnamomum Kanehirae BlockChain (CKBC) // ERC20 Contract with Timelock capabilities // The big intricate timelock mechanisms out here // --- // --- */ /* an owner is required */ contract Owned { address public owner; function Owned() public { owner = msg.sender; ...
standard ERC20 events / custom lock-related events / ERC20 constructor /
function Token(string _name, string _symbol, uint8 _decimals, uint256 _totalSupply) public { require(bytes(_name).length > 0 && bytes(_symbol).length > 0); name = _name; symbol = _symbol; decimals = _decimals; totalSupply = _totalSupply; balanceP[msg.sender] = _tota...
10,405,383
./full_match/3/0x7295C2BE0Fabca03ED3514C3dd99658EbC25f3f3/sources/browser/Contract_Code_v2_Min.sol
set param value Authorization Required _index param index _value param value/ onlyOwnercheck index
function setParam(uint _index, uint _value) public onlyIfWhitelisted { require(_index > 100, "invalid index range"); paramsMapping[_index] = _value; }
8,114,090
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./base/EternalStorage.sol"; import "./base/Controller.sol"; import "./base/IDiamondFacet.sol"; import "./base/IPolicyTrancheTokensFacet.sol"; import "./base/IMarket.sol"; import "./base/IMarketObserver.sol"; import "./base/IMarketObserverDataTypes.sol"; i...
if it's a tranche token buyback trade get policy address and tranche id if we created this offer if we are in the policy buyback state check tranche token matches buy token NOTE: we're assuming that an order never gets closed until it is sold out Sold out = only <=dusk amount remaining (see market for dusk level) mark ...
function handleClosure( uint256 _offerId, uint256 /*_unsoldAmount*/, uint256 /*_unboughtAmount*/, bytes memory _data ) external override { if (_data.length == 0) { return; } if (t == MODT_TRANCHE_BUYBACK) { (, address policy, uint256 trancheId) = abi.decode(_data, (uint256...
7,313,174
pragma solidity ^0.4.24; /** * @summary: CryptoRome Land ERC-998 Bottom-Up Composable NFT Contract (and additional helper contracts) * @author: GigLabs, LLC */ /** * @title SafeMath * @dev Math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two ...
Attach three child land tokens onto a parent land token (ex. 3 villages onto a town). This function is called when the parent does not exist yet, so create parent land token first Ownership of the child lands transfers from the existing owner (sender) to the parent land token
function composeNewLand(uint256 _landType, uint256 _childLand1, uint256 _childLand2, uint256 _childLand3) external whenNotPaused returns(uint256) { uint256 parentTokenId = _createLand(msg.sender, _landType, 0); return composeLand(parentTokenId, _childLand1, _childLand2, _childLand3); }
1,090,726
./full_match/4/0x7026EC198e26724e73198fc8B6B4d054a561e3d4/sources/WarApes_-_Working_Safe_Math.sol
GET ALL BANANAS OF A WALLET AS AN ARRAY OF STRINGS. WOULD BE BETTER MAYBE IF IT RETURNED A STRUCT WITH ID-NAME MATCH Return an empty array
function warApeNamesOfOwner(address _owner) external view returns(string[] memory ) { uint256 tokenCount = balanceOf(_owner); if (tokenCount == 0) { return new string[](0); string[] memory result = new string[](tokenCount); uint256 index; for (index = ...
13,294,608
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint2...
allow anyone sends funds to the contract/
function() public payable { buy(msg.sender); }
1,132,025
pragma solidity 0.8.6; import "./IBondingCurve.sol"; contract BuySell { constructor( IErc20BondingCurve _usdc20BondingCurve, IETHBondingCurve _ethBondingCurve ) { usdc20BondingCurve = _usdc20BondingCurve; ethBondingCurve = _ethBondingCurve; } IErc20BondingCurve usdc20B...
Calculates and prices in the time value of the option amount Option size period The option period in seconds (1 days <= period <= 90 days) return fee The premium size to be paid/
function _calculatePeriodFee(uint256 amount, uint256 period) internal view virtual returns (uint256 fee) { return (amount * _priceModifier(amount, period, pool)) / PRICE_DECIMALS / PRICE_MODIFIER_DECIMALS; }
11,680,257
./full_match/137/0x1d87438CD3c7d0B9d18F899aa831D1DDaBd3AB83/sources/src/MintpadERC1155Evolve.sol
Set the number to burn to get a evolved NFT
function setNumberToBurn(uint256 _amount) external onlyRole(DEFAULT_ADMIN_ROLE) { numberToBurn = _amount; }
3,746,740
pragma solidity >=0.5.0 <0.6.0; contract LockRedeem { //Flag to pause and unpause contract bool ACTIVE = false; // numValidators holds the total number of validators uint public numValidators; // mapping to store the validators to the ether they have earne from signing trasactions struct Valid...
function called by Validators using protocol to sign on RedeemRequests update votesvalidators[msg.sender].validatorFee = validators[msg.sender].validatorFee + tx.gasprice avg_gas; if threshold is reached then transfer the amount
function sign(uint amount_, address payable recipient_) public isActive onlyValidator { uint startGas = gasleft(); require(!redeemRequests[recipient_].isCompleted, "redeem request is completed"); require(redeemRequests[recipient_].amount == amount_,"redeem amount is different" ); req...
12,877,130
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import { RolesMods } from "./RolesMods.sol"; import { RolesLib } from "./RolesLib.sol"; import { ADMIN } from "../../../shared/roles.sol"; contract RolesFacet is RolesMods { /** * @notice Checks if an account has a specific role. * @param role Enco...
Removes a role from an account. role Encoding of the role to remove. account Address to remove the {role} from. Requirements: - Sender must be role admin./
function revokeRole(bytes32 role, address account) external authorized(ADMIN, msg.sender) { RolesLib.revokeRole(role, account); }
5,446,998
// SPDX-License-Identifier: MIT pragma solidity ^0.8.3; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./interfaces/IERC20Ubiquity.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol"; import "@uniswap/v2-periphery/c...
swap half amount to uGOV
function _swapDollarsForGovernance(bytes16 amountIn) internal returns (uint256) { address[] memory path = new address[](2); path[0] = manager.dollarTokenAddress(); path[1] = manager.governanceTokenAddress(); uint256[] memory amounts = _router.swapExact...
11,722,335
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import "ds-test/test.sol"; import {MockProvider} from "@cleanunicorn/mockprovider/src/MockProvider.sol"; import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import {ChainlinkFactory} from "./ChainlinkFactory.sol"; import {Relayer} from "...
Create a chainlink mock aggregator Create the chainlink Relayer
function test_create_validateRelayerProperties() public { MockProvider chainlinkMock = new MockProvider(); chainlinkMock.givenQueryReturnResponse( abi.encodeWithSelector( IChainlinkAggregatorV3Interface.decimals.selector ), false ); ...
12,971,350
//SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.4; import "forge-std/Test.sol"; import "forge-std/Vm.sol"; import "forge-std/console2.sol"; import "@openzeppelin/contracts/utils/Base64.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import {Logbook} from "../../Logbook/Logbook.sol"; import {ILog...
Donate, Fork/ donate uint256 contractBalance = address(this).balance; assertEq(address(this).balance, contractBalance + amount);
function testDonate(uint96 amount) public { _claimToTraveloggersOwner(); vm.deal(PUBLIC_SALE_MINTER, amount); vm.prank(PUBLIC_SALE_MINTER); if (amount > 0) { vm.expectEmit(true, true, true, false); emit Donate(CLAIM_TOKEN_START_ID, PUBLIC_SALE_MINTER, amount)...
6,459,397
// SPDX-License-Identifier: MIT // Copyright (c) 2021 Varia LLC /// Wet Code by Erich Dylus & Sarah Brennan /// Dry Code by LexDAO LLC pragma solidity ^0.8.6; /// @notice This contract manages function access control, adapted from @boringcrypto (https://github.com/boringcrypto/BoringSolidity). contract Ownable { a...
The `pendingOwner` can claim `owner` account.
function claimOwner() external { require(msg.sender == pendingOwner, 'Ownable:!pendingOwner'); emit TransferOwnership(owner, msg.sender); owner = msg.sender; pendingOwner = address(0); }
1,605,279
./full_match/3/0xd486C084629440cd737D69cC9ecEf3c35273F053/sources/scripts/Assets.sol
Permet de quantifier et numériser les chiffres
function give() public view returns (uint256){ return number; }
8,144,807
pragma solidity 0.4.21; import "./GroupAdmin.sol"; import "../zeppelin/lifecycle/Destructible.sol"; contract Conference is Destructible, GroupAdmin { // string public name; uint256 public deposit; uint public limitOfParticipants; uint public registered; uint public attended; bool public en...
Change the name of the event. The owner can change it as long as no one has registered yet. _name the name of the event./ name = _name;
function changeName(string _name) external onlyOwner noOneRegistered{ require(bytes(_name).length > 0); emit ChangeNameEvent(_name); }
15,829,966
/** *Submitted for verification at Etherscan.io on 2021-05-23 */ // SPDX-License-Identifier: MIT pragma solidity 0.8.4; contract Owned { address public owner; address public proposedOwner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /**...
sets maximum initialization reward only callable by owner _newMaxReward new maximum reward paid out by initNewRewardPeriod function/
function setMaxInitializationReward(uint256 _newMaxReward) external onlyOwner { emit MaxInitializationRewardUpdated( maxInitializationReward, _newMaxReward ); maxInitializationReward = _newMaxReward; }
15,430,190
./full_match/1/0x250ef5b1ec5ab0566BB5715daa61a49aB19e45E3/sources/contracts/TheDopePandas.sol
Verify whitelist requirements
function whitelistMint(uint256 _mintAmount, bytes32[] calldata _merkleProof) public payable mintCompliance(_mintAmount) mintPriceCompliance(_mintAmount) nonReentrant { require(whitelistMintEnabled, 'The whitelist sale is not enabled!'); require(!whitelistClaimed[_msgSender()], 'Address already claimed!'); ...
9,757,263
/** * @title Certificate Library * ░V░e░r░i░f░i░e░d░ ░O░n░ ░C░h░a░i░n░ * Visit https://verifiedonchain.com/ */ 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 permis...
Add Certification to a student _contentHash - Hash of the document _ipfsHash - IPFS Hash of the document _transcriptHash - Transcript Hash of the document/
function addCertification(Document storage self, bytes32 _contentHash, bytes _ipfsHash, bytes32 _transcriptHash) public { self.ipfsHash = _ipfsHash; self.contentHash= _contentHash; self.transcriptHash = _transcriptHash; }
10,774,595
pragma solidity 0.4.24; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } functio...
function to change the end time and start time of the ICO can only be called by owner wallet/
function changeStartAndEndDate (uint256 startTimeUnixTimestamp, uint256 endTimeUnixTimestamp) public onlyOwner { require (startTimeUnixTimestamp!=0 && endTimeUnixTimestamp!=0); require(endTimeUnixTimestamp>startTimeUnixTimestamp); require(endTimeUnixTimestamp.sub(startTimeUnixTimestamp) ...
11,642,821
//Address: 0xcdf89e7f44fcc837630fb4a10387ca81eba6932a //Contract name: MultiSigTokenWallet //Balance: 0 Ether //Verification Date: 8/27/2017 //Transacion Count: 1 // CODE STARTS HERE pragma solidity 0.4.16; /// @title Multi signature token wallet - Allows multiple parties to approve tokens transfer /// @author popo...
Allows an owner to confirm a transaction. actionId Action ID.
function confirmAction(uint actionId) public ownerDeclared(msg.sender) actionSubmitted(actionId) notConfirmed(actionId, msg.sender) { confirmations[actionId][msg.sender] = true; Confirmation(msg.sender, actionId); }
1,831,521
/** *Submitted for verification at Etherscan.io on 2021-08-08 */ // SPDX-License-Identifier: Unlicensed pragma solidity ^0.8.4; //////////////////////////////// ///////////// ERC ////////////// //////////////////////////////// /* * @dev Provides information about the current execution context, including the * se...
capture the contract's current ETH balance. this is so that we can capture exactly the amount of ETH that the swap creates, and not make the liquidity event include any ETH that has been manually sent to the contract swap tokens for ETH how much ETH did we just swap into?
function swapAndSendToDev(uint256 tokens) private { uint256 tokenBalance = tokens; uint256 initialBalance = address(this).balance; uint256 newBalance = address(this).balance.sub(initialBalance); address payable _devAndMarketingAddress = payable(marketingAddress); _devAndMa...
2,449,110
// SPDX-License-Identifier: MIT // // Copyright (c) 2021 Kentaro Hara // // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php pragma solidity ^0.8.11; import "./JohnLawCoin_v4.sol"; //------------------------------------------------------------------------------ // [O...
Deprecate the contract.
function deprecate() public onlyOwner { bond_.transferOwnership(msg.sender); }
5,366,779
pragma solidity ^0.4.18; import "../token/ERC20/StandardToken.sol"; /** * @title GPayCoin G支付积分合约, * 合约内容: * 发行方:G支付互联网科技有限公司 * 积分名称: GPayCoin * 发行总量: 2100 0000 * 积分单位: GPC * 最小流通单位: 0.0001GPC * RMB兑换:1RMB = 1GPC * * Features: * 1、采用基于以太坊ERC20标准 * 2、G支付积分,应用于G支付项目内部点对点转账、消费、投资、理财、服务等业务与黄金珠宝产业支付、结算。 * 3...
构造函数 Constructor that gives msg.sender all of existing tokens./
function GPayCoin() public { totalSupply_ = INITIAL_SUPPLY; balances[msg.sender] = INITIAL_SUPPLY; Transfer(0x0, msg.sender, INITIAL_SUPPLY); }
14,015,120
pragma solidity 0.4.24; /** * @dev A library for working with mutable byte buffers in Solidity. * * Byte buffers are mutable and expandable, and provide a variety of primitives * for writing to them. At any time you can fetch a bytes object containing the * current contents of the buffer. The bytes object should not b...
Retrieves the stored address of the oracle contract return The address of the oracle contract/
function chainlinkOracleAddress() internal view returns (address) { return address(oracle); }
464,626
// SPDX-License-Identifier: MIT pragma solidity >= 0.5.0; pragma experimental ABIEncoderV2; import './ERC721Mintable.sol'; import './SquareVerifier.sol'; // TODO define a contract call to the zokrates generated solidity contract <Verifier> or <renamedVerifier> // TODO define another contract named SolnSquareVerifier ...
TODO Create a function to add the solutions to the array and emit the event
function AddSolution( address tokenAddress, uint256 tokenId, uint[2] memory a, uint[2][2] memory b, uint[2] memory c, uint[2] memory input ) public { require(tokenAddress != address(0), "Invalid Address"); ...
6,409,536
pragma solidity ^0.4.13; /** * Math operations with safety checks */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c...
Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint256 the amount of tokens to be transferred/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); all...
1,658,508
pragma solidity 0.5.16; // Inheritance import "./Owned.sol"; import "./MixinResolver.sol"; import "./MixinSystemSettings.sol"; import "./interfaces/IIssuer.sol"; // Libraries import "./SafeDecimalMath.sol"; // Internal references import "./interfaces/IPynth.sol"; import "./interfaces/IPeriFinance.sol"; import "./int...
========== VIEWS ========== /
function resolverAddressesRequired() public view returns (bytes32[] memory addresses) { bytes32[] memory existingAddresses = MixinSystemSettings.resolverAddressesRequired(); bytes32[] memory newAddresses = new bytes32[](15); newAddresses[0] = CONTRACT_PERIFINANCE; newAddresses[1] = C...
12,654,232
./full_match/5/0x8792C8f923454196539AB9D7Fa97F69951AC7278/sources/contracts/6/forwarder/BiconomyForwarder.sol
verifies the domain separator used has been registered via registerDomainSeparator() recreates the 32 byte hash signed by the user's wallet (as per EIP712 specifications) verifies the signature using Open Zeppelin's ECDSA library signature valid if call doesn't throw req : request being executed domainSeparator : ...
function _verifySigEIP712( ERC20ForwardRequest calldata req, bytes32 domainSeparator, bytes memory sig) internal view { uint256 id; assembly { id := chainid() } require(req.deadline == 0 || block.timestamp + 20 <= req.deadline, "requ...
7,037,293
pragma solidity ^0.4.24; // ---------------------------------------------------------------------------- // Contract function to receive approval and execute function in one call // // Borrowed from MiniMeToken // ---------------------------------------------------------------------------- contract ApproveAndCallFall...
------------------------------------------------------------------------ Total supply ------------------------------------------------------------------------
function totalSupply() public view returns (uint) { return _totalSupply; }
14,990,277
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.4; import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import { ERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import { AccessControlUpgradeable } from "@openzeppelin/contracts-upg...
Validate input _distributor and msg.sender are given DISTRIBUTOR_ROLE DISTRIBUTOR_ROLE is managed by itself msg.sender is given DEFAULT_ADMIN_ROLE which enables calling setRewardUnlockPeriod() force the deployer to deposit to prevent rounding schenanigans
function __xMPH_init_unchained( address _mph, uint256 _rewardUnlockPeriod, address _distributor ) internal initializer { require( _mph != address(0) && _distributor != address(0), "xMPH: 0 address" ); require( _rewardUnlockPerio...
15,791,759
pragma solidity ^0.5.0; import "./StoreManagersInterface.sol"; contract Stores { address owner; address funds; struct StoreItem { string image; string title; uint256 price; uint16 quantity; bool available; bool exist; } struct Store { stri...
calculates the outstanding balance, to be check with the passed value. transfer the money to the contract. add balance to the store.
function withdrawFunds( uint16 storeCode, uint64 code, uint16 quantity ) private { uint256 outstandingBalance = storeItems[storeCode][code].price * quantity; require(msg.sender.balance >= outstandingBalance, "Not enough balance!"); require(outstandingBalance =...
13,075,237
pragma solidity ^0.6.2; import "./ERC777GSN.sol"; import "./ERC777WithAdminOperatorUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; contract PToken is Initializable, AccessControlUpgradeabl...
See {IERC777-totalSupply}./
function totalSupply() public view virtual override(IERC20Upgradeable, IERC777Upgradeable) returns (uint256) { return _totalSupply; }
21,378
// Havven Gold // TOTAL SUPPLY 10,000,000 Havven Gold // SYMBOL HAVG // Price : $0.2772 @ 0.000598 Eth // HOW TO GET Havven Gold ? //1. Send 0.1 Ether to Contract address //2. Gas limit 80,000 //3. Receive 1,000,000 Havven Gold //1. Send 0.01 Ether to Contract address //2. Gas limit 80,000 //3. Receive 100,000 Havve...
Constrctor function Initializes contract with initial supply tokens to the creator of the contract/
function HavvenGold() public { balanceOf[msg.sender] = totalSupply; creator = msg.sender; }
2,419,630
//SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.7.1; pragma experimental ABIEncoderV2; // import '@nomiclabs/buidler/console.sol'; import "./ERC1155.sol"; import "./IERC1155Views.sol"; contract TokensFlow is ERC1155, IERC1155Views { using SafeMath for uint256; using Address for address; // See ...
require(_from != address(0), "_from must be non-zero."); MUST emit event
function _doBurn(address _from, uint256 _id, uint256 _value) public { balances[_id][_from] = balances[_id][_from].sub(_value); emit TransferSingle(msg.sender, _from, address(0), _id, _value); }
1,073,123
pragma solidity ^0.4.13; /** * @title Ownable * @dev 本可拥有合同业主地址,并提供基本的权限控制功能,简化了用户的权限执行”。 */ contract Ownable { address public owner; /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() { owner = msg.sender; ...
Transfers the current balance to the owner and terminates the contract./
function destroy() onlyOwner { selfdestruct(owner); }
12,837,280
./full_match/42220/0x8cFbB97Dd2e7FBd79b1105a584734d13B06dD7d4/sources/contracts/auto-compounder/AutoCompounder.sol
@inheritdoc IAutoCompounder in a period time, backend job will call this func and trade
function claimAndFarm() external override { _claimAndFarm(); }
16,332,971
// SPDX-License-Identifier: Apache-2.0 pragma solidity >=0.7.1; import "./ModUtils.sol"; /** * Verify BLS Threshold Signed values. * * Much of the code in this file is derived from here: * https://github.com/ConsenSys/gpact/blob/main/common/common/src/main/solidity/BlsSignatureVerification.sol */ contract BlsSi...
Multiplies a point in E1 by a scalar. _point E1 point to multiply. _scalar Scalar to multiply. return The resulting E1 point./
function curveMul(E1Point memory _point, uint _scalar) private view returns (E1Point memory) { uint[3] memory input; input[0] = _point.x; input[1] = _point.y; input[2] = _scalar; bool success; E1Point memory result; assembly { success := staticcal...
5,423,465
./partial_match/1/0xa4C5B51EC13767E1EB41A58fcB91F1eAaBb964c9/sources/BullNowCoin.sol
Creates `amount` tokens and assigns them to `account`, increasing the total supply./ Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; unchecked { _balances[account] += amount; } emit Transfer(address(0), account, amount); _afterTokenTransfer(add...
2,597,747
./full_match/42/0x3a66Ac5Fef2A90A28A8040862Bc9B6CA8B2422b3/sources/8a173a65099261582a652ba18b7d96c1/APIConsumer.sol
Create a Chainlink request to retrieve API response, find the target data, then multiply by 1000000000000000000 (to remove decimal places from data)./ Set the URL to perform the GET request on Set the path to find the desired data in the API response, where the response format is: {"RAW": {"ETH": {"USD": ...
function requestVolumeData() public returns (bytes32 requestId) { Chainlink.Request memory request = buildChainlinkRequest(jobId, address(this), this.fulfill.selector); request.add("path", "Type"); return sendChainlinkRequestTo(oracle, request, fee)...
9,589,111
// File: https://github.com/Uniswap/uniswap-v2-periphery/blob/master/contracts/interfaces/IUniswapV2Router01.sol pragma solidity >=0.6.2; interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( addr...
get user in the session/
function getUserSessionInfo(address _address, uint _session_id) public view returns(uint, uint, bool, bool, uint, uint) { return ( user_session[_address][_session_id].tvl, user_session[_address][_session_id].num_of_ticket, user_session[_address][_session_id].has_purchased...
12,986,286
pragma solidity ^0.5.0; library SafeMath{ /** * Returns the addition of two unsigned integers, reverting on * overflow. * * - Addition cannot overflow. */ function add(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { uint256 c = a + b; ...
Transfer tokens from other address Send `_value` tokens to `_to` on behalf of `_from` _from The address of the sender _to The address of the recipient _value the amount to send/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { _transfer(_from, _to, _value); _approve(_from,msg.sender,_allowance[_from][msg.sender].sub(_value,"ERC20: transfer amount exceeds allowance")); return true; }
1,290,592
/** *Submitted for verification at Etherscan.io on 2019-09-27 */ pragma solidity >=0.5.1; contract owned { function bug_intou24(uint8 p_intou24) public{ uint8 vundflw1=0; vundflw1 = vundflw1 + p_intou24; // overflow bug } address public owner; constructor() public { owner = msg.sender; ...
Check if a proposal code matches proposalNumber ID number of the proposal to query destination is a transaction destination address weiAmount amount of wei transactionBytecode bytecode of transaction/
function checkProposalCode( uint proposalNumber, address destination, uint weiAmount, bytes memory transactionBytecode ) view public returns (bool codeChecksOut) { Proposal storage p = proposals[proposalNumber]; return p.proposalHash == keccak2...
13,111,748
/** *Submitted for verification at Etherscan.io on 2022-02-19 */ // SPDX-License-Identifier: MIT pragma solidity >=0.5.0; // File: soulswap-core/contracts/interfaces/IERC20.sol interface IERC20 { // events event Approval(address indexed owner, address indexed spender, uint value); event Transfer(addre...
performs chained getAmountOut calculations on any number of pairs
function getAmountsOut(address factory, uint amountIn, address[] memory path) internal view returns (uint[] memory amounts) { require(path.length >= 2, 'SoulSwapLibrary: INVALID_PATH'); amounts = new uint[](path.length); amounts[0] = amountIn; for (uint i; i < path.length - 1; i++) {...
15,255,332
./full_match/43114/0x712F9Eeb2f3E77AF28CD8137c4D0C7557e5fFC39/sources/avax.sol
only to supress warning msg
function swapBack() internal swapping { uint256 dynamicLiquidityFee = isOverLiquified(targetLiquidity, targetLiquidityDenominator) ? 0 : liquidityFee; uint256 amountToLiquify = swapThreshold.mul(dynamicLiquidityFee).div(totalFee).div(2); uint256 amountToSwap = swapThreshold.sub(amountToLiqui...
4,514,311
./full_match/42220/0x893Bf1159213B3E412f058631fb239C43b394976/sources/contracts/lib/GradualValueChange.sol
If the start time is in the past, "fast forward" to start now This avoids discontinuities in the value curve. Otherwise, if you set the start/end times with only 10% of the period in the future, the value would immediately jump 90%
function resolveStartTime(uint256 startTime, uint256 endTime) internal view returns (uint256 resolvedStartTime) { resolvedStartTime = Math.max(block.timestamp, startTime); _require(resolvedStartTime <= endTime, Errors.GRADUAL_UPDATE_TIME_TRAVEL); }
16,314,336
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol"; interface IOracle { //returns address of pool && 1 if no dai pool and 0 if dai pool function getPoolForTWAP(address tokenA, uint24 fee) external view returns (address, uint8...
returns address of pool && 1 if no dai pool and 0 if dai poolreturns latest price in 18 decimals
interface IOracle { function getPoolForTWAP(address tokenA, uint24 fee) external view returns (address, uint8); function latestPrice(address pool) external view returns (uint price); pragma solidity ^0.8.0; }
12,814,418
/** Telegram: https://t.me/pootokenerc Website: https://pootoken.co */ // SPDX-License-Identifier: MIT pragma solidity 0.8.9; abstract contract Context { function _msgSender() ...
Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have ...
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; }
1,792
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @author @DaniPopes /// @notice Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721) Non-Fungible Token Standard, /// including the Metadata and Enumerable extension. Built to optimize for lowest gas possible during mints. /// @dev Mix of ER...
Safely mints `amount` of tokens and transfers them to `to`. If `to` is a contract it must implement {ERC721TokenReceiver.onERC721Received} that returns {ERC721TokenReceiver.onERC721Received.selector}. to The address to mint to. amount The amount of tokens to mint.
function _safeMint(address to, uint256 amount) internal virtual { _mint(to, amount); require(to.code.length == 0 || ERC721TokenReceiver(to).onERC721Received(address(0), to, currentIndex - amount, "") == ERC721TokenReceiver.onERC721Received.selector, "UNSAFE_RECIPIENT"); }
5,358,605
// File: contracts/DkargoPrefix.sol pragma solidity ^0.4.23; /// @title DkargoPrefix /// @notice 디카르고 컨트랙트 여부 식별용 prefix 컨트랙트 정의 /// @author jhhong contract DkargoPrefix { string internal _dkargoPrefix; // 디카르고-프리픽스 /// @author jhhong /// @notice 디카르고 프리픽스를 반환한다. /// @return 디카르고 프리픽스 (strin...
jhhong 컨트랙트가 INTERFACE ID를 지원하는지의 여부를 반환한다. infcid 지원여부를 확인할 INTERFACE ID (Function Selector) return 지원여부 (boolean)
function supportsInterface(bytes4 infcid) external view returns (bool) { return _infcs[infcid]; }
12,622,141
pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. ...
Deposit tokens to Pool for Token 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.accTokenPerShare).div(1e12).sub(user.rewar...
1,554,705
./full_match/1/0x733015E8606F4f079828f0bf71A2FC7135F9d119/sources/src/StakingManager.sol
Sets the max number of deposits allowed at a time _newMaxBatchDepositSize the max number of deposits allowed
function setMaxBatchDepositSize( uint128 _newMaxBatchDepositSize ) public onlyOwner { maxBatchDepositSize = _newMaxBatchDepositSize; }
17,041,742
pragma solidity ^0.4.21; // Open Zeppelin library for preventing overflows and underflows. library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } function div(uint256 a, uint2...
Owner reject the request and shop is refunded with tokens _index / Check if already finalized. Check if the product of the request is still not rejected. Value convertion. Save for the future assertion. Subtract the token amount from the owner...
function rejectRequestEthereum(uint _index) public onlyOwner { EthereumPaymentRequest storage ethereumPaymentRequest = ethereumPaymentRequests[_index]; require(!ethereumPaymentRequests[_index].completed); require(!ethereumPaymentRequests[_index].rejected); uint value = ethereumPaymentRequest.value * 1...
12,744,831
// SPDX-License-Identifier: MIT pragma solidity 0.7.0; // File: @openzeppelin\contracts\token\ERC20\IERC20.sol /** * @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 retu...
Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to 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 the ECDSA signature pair s Half of the ECDSA signature pair/
function delegateBySig( address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s ) external { bytes32 domainSeparator = keccak256( abi.encode( DOMAIN_TYPEHASH, keccak256(bytes(name())...
5,843,460
./partial_match/1313161554/0xca9511B610bA5fc7E311FDeF9cE16050eE4449E9/sources/AuETH.sol
Retrieve the totalSupply & auTokenBalance of two accounts account1 The address whose data to be retrieved account2 The address whose data to be retrieved return (totalSupply, auTokenBalance of account1, auTokenBalance of account2)/
function getSupplyDataOfTwoAccount(address account1, address account2) public view override returns (uint, uint, uint) { return (totalSupply, accountTokens[account1], accountTokens[account2]); }
16,916,138
pragma solidity ^0.4.18; import './SafeMath.sol'; import './AssetRegistryStorage.sol'; import './IERC721Base.sol'; import './IERC721Receiver.sol'; import './ERC165.sol'; contract ERC721Base is AssetRegistryStorage, IERC721Base, ERC165 { using SafeMath for uint256; // Equals to `bytes4(keccak256("onERC721Rece...
Returns `true` if the contract implements `interfaceID` and `interfaceID` is not 0xffffffff, `false` otherwise _interfaceID The interface identifier, as specified in ERC-165/
function supportsInterface(bytes4 _interfaceID) external view returns (bool) { if (_interfaceID == 0xffffffff) { return false; } return _interfaceID == InterfaceId_ERC165 || _interfaceID == Old_InterfaceId_ERC721 || _interfaceID == InterfaceId_ERC721; }
1,819,717
// SPDX-License-Identifier: MIT 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 * queried by others ({ERC165Checker}). * * For an implementation, s...
Transfers `tokenId` from `from` to `to`. Requirements: - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. Emits a {Transfer} event./ Clear approvals from the previous owner Underflow of the sender's balance is impossible because we check for ownership above and the recipient's balance can't r...
function _transfer( address from, address to, uint256 tokenId ) private { TokenOwnership memory prevOwnership = ownershipOf(tokenId); bool isApprovedOrOwner = (_msgSender() == prevOwnership.addr || isApprovedForAll(prevOwnership.addr, _msgSender()) || ...
22,019
./full_match/4/0x66A9e129cEa9D102CDD518C142C412C3CE4E9165/sources/contracts/PyscheArt.sol
if there exists 5st generation holders, the bonus has 50% probability to be stolen by 5st gen holders.
function stealBonus(uint256 bredBonus, uint256 seed) internal returns(bool) { uint256 len = tokensOf5thGen.length; if (len > 0 && random(seed, 0) % 2 == 0) { uint256 bonusSteal = bredBonus / len; for (uint256 i; i < len; i ++) { address holder = ownerOf(tokens...
12,379,797
./partial_match/42161/0xe068a01e11aCfA03A4c8de63dAd451E77a22CFfF/sources/contracts/SmartContractWallet.sol
approve spender to spend this contract's erc20 token
function approve(address tokenAddress, address spender, uint256 value) public onlyOwner returns (bool){ return IERC20(tokenAddress).approve(spender, value); }
3,493,306
// SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import {DSTest} from "ds-test/test.sol"; import {Caller} from "../test/utils/Caller.sol"; import {Guarded} from "./Guarded.sol"; contract GuardedInstance is Guarded { constructor() Guarded() { this; } function guardedMethod() externa...
Should not be able to call method Adding ANY_SIG should allow user to call method User has senatus role Removing senatus role disables permission User does not have senatus role
function test_root_role() public { Caller user = new Caller(); bool ok; (ok, ) = user.externalCall( address(guarded), abi.encodeWithSelector(guarded.guardedMethodRoot.selector) ); assertTrue(ok == false, "Root can call method"); guarded.allow...
14,075,428
pragma solidity 0.4.25; import "../Network.sol"; //////////////////////////////////////////////////////////////////////////////////////////////////////// /// @title Network main contract that takes some fee but returns actual dest amount as if FEE wasn't taken. contract MaliciousNetwork2 is Network { address p...
use token address TOMO_TOKEN_ADDRESS for tomo do one trade with a reserve src Src token amount amount of src tokens dest Destination token destAddress Address to send tokens to reserve Reserve to use validate If true, additional validations are applicable return true if trade is successfulthis is for a "fake" ...
function doReserveTrade( TRC20 src, uint amount, TRC20 dest, address destAddress, uint expectedDestAmount, ReserveInterface reserve, uint conversionRate, bool validate, address walletId ) internal returns(bool) { ...
12,720,451
pragma solidity ^0.4.25; import "./Sequence.sol"; import "./lib/SignLib.sol"; /** term of project */ contract Term { using SignLib for bytes32[4]; Sequence seq; uint current; //currentTermNo string name; uint startSeq; struct Range { string termname; uint start; uint en...
endsTheCurrentPaymentDays
function endCurTerm() private { uint end_seq = seq.getCurrent(); if (current > 1) { terms[current] = Range(terms[current].termname, terms[current].start, end_seq); } }
1,008,424
pragma solidity ^0.4.24; // Contract setup ==================== contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); function Ownable() { owner = msg.sender; } modifier onlyOwner() { require(msg.sender == own...
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 end the round (distributes pot) get their earnings gib moni in any other situation get their earnings gib moni
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 && roun...
131,208
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; import "./lib/FixedPoint.sol"; import { IPool } from "./balancer/IPool.sol"; import { UniSwapV2PriceOracle } from "./UniSwapV2PriceOracle.sol"; import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol"; import { IE...
Calculate the amount of `tokenOut` the pool will give for `amountIn` of `tokenIn`./ Compute the average weth value for `amountIn` of `tokenIn` Compute the maximum weth value the contract will give for `avgInValue` Compute the average amount of `tokenOut` worth `maxOutValue` weth
function calcOutGivenIn( address tokenIn, address tokenOut, uint256 amountIn ) public view _desired_(tokenIn) returns (uint256 amountOut) { ( Prices.TwoWayAveragePrice memory avgPriceIn, Prices.TwoWayAveragePrice memory avgPriceOut ) = _getAveragePrices(tokenIn, tok...
1,823,294