file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint25...
Fallback function Called whenever anyone sends funds to the contract/
function () payable { require(!token.lockOf(msg.sender) && !crowdsaleClosed && stage<2 && msg.value >= 1 * (1 ether)/10); if(stage==1 && (now < presaleEndTime.add(countdownDuration) || amountRaisedPreSale+amountRaisedICO+msg.value > hardCap)) { throw; } uint amount = msg....
14,117,497
// SPDX-License-Identifier: AGPL-3.0-only /* Bounty.sol - SKALE Manager Copyright (C) 2020-Present SKALE Labs @author Dmytro Stebaiev SKALE Manager is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Softw...
Returns the first delegation month./
function getFirstDelegationMonth(address holder, uint validatorId) external view returns(uint) { return _firstDelegationMonth[holder].byValidator[validatorId]; }
401,338
pragma solidity ^0.4.11; import './IMiniMeToken.sol'; import './Ownable.sol'; contract gasStation is Ownable { // track used fillup hashes mapping(bytes32=>bool) usedhashes; address public tokenreceiver; address public franchisee; event NewHash(bytes32 h,address token_address, address gastankaddress, uint tak...
exchange by server ( hash signed by client ) claim tokens send ETH (gas) invalidate this deal's hash
function pushFill(address _token_address, uint _valid_until, uint _random, uint _take, uint _give, address gastankclient, uint8 _v, bytes32 _r, bytes32 _s) onlyOwner { bytes32 hash = sha256(_token_address, this, gastankclient, _take, _give, _valid_until, _random); NewHash(hash, _token_address, this, _take, _give...
5,541,427
// SPDX-License-Identifier: Unlicense // Developed by EasyChain Blockchain Development Team (easychain.tech) // pragma solidity ^0.8.4; import "./api/IAgent.sol"; import "./api/ITokens.sol"; import "./common/BerezkaOracleClient.sol"; import "./common/BerezkaDaoManager.sol"; import "./common/BerezkaStableCoinManager.so...
Removes possible tokens (stableconins) to use _whitelisted - list of stableconins to use
function removeWhitelistTokens(address[] memory _whitelisted) public onlyOwner { for (uint256 i = 0; i < _whitelisted.length; i++) { whitelist[_whitelisted[i]] = false; } }
14,438,195
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import '@openzeppelin/contracts/token/ERC721/ERC721.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import '@openzeppelin/contracts/utils/math/SafeMath.sol'; interface IAstraMetadata...
Public sale by ETH minting function The sender must be a wallet Reservetions must come first Expired claims Calculate current index for minting Reassign used tickets To the moon
function claim() external payable { require(msg.sender == tx.origin, 'Not a wallet!'); require(ReserveSaleMapping[msg.sender] > ClaimedSaleMapping[msg.sender], 'Already claimed!'); require(ReserveTimestampMapping[msg.sender] + CLAIM_TIMEOUT > block.timestamp, 'Expired claims!'); uin...
10,306,676
./partial_match/56/0xB6eFf04f4502968A513abC1055b2329a3775673D/sources/MasterChef.sol
Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do.
function add(uint256 _allocPoint, IBEP20 _lpToken, uint16 _depositFeeBP, bool _withUpdate) public onlyOwner { require(_depositFeeBP <= 10000, "add: invalid deposit fee basis points"); if (_withUpdate) { massUpdatePools(); } uint256 lastRewardBlock = block.number > startBl...
11,219,489
./full_match/80001/0xb4f3ACAaB34D7c16655A752a3fb7FFC795036120/sources/contracts/uNiFTswap-V1-core/contracts/libraries/uNiFTswapV1Library.sol
require(reserve0 > 0 && reserve1 > 0, 'uNiFTswapV1Library: INSUFFICIENT_LIQUIDITY');
function getAmount2Out(address _token01In, address pair) internal view returns (uint _amount2Out) { (address token0, address token1,, uint basePrice) = IuNiFTswapV1Pair(pair).getPairContents(); (uint reserve0, uint reserve1, uint reserve2) = getReserves(pair); uint newReserve2; ...
5,549,598
./full_match/222000222/0xdf19C1Ee9c3438401B6C8CFE1E4C5885351F569f/sources/contracts/SmartChef.sol
Return reward multiplier over the given _from to _to time. _from: time to start _to: time to finish/
function _getMultiplier(uint256 _from, uint256 _to) internal view returns (uint256) { if (_to <= bonusEndTime) { return _to.sub(_from); return 0; return bonusEndTime.sub(_from); } }
13,222,114
./full_match/1/0xcc0e844B8Dc6562044A1088157BdDd99D3bdd3C3/sources/contracts/KannaBadges.sol
Creates `amount` tokens of token type `id`, and assigns them to `to`. Emits a {TransferSingle} event with `from` set to the zero address. Requirements: - the caller must have a minter role. - the token `id` must be registered./
function mint(address to, uint16 id, uint256 amount) public onlyRole(MINTER_ROLE) tokenExists(id) { _mint(to, id, amount, ""); }
4,931,247
./full_match/4/0x11a4c2D3426CaFb5c519d830764Cf91f23a4A89F/sources/contracts/GameItems.sol
0x2FfaB573734ABd0D013242A42a27f7cCb0A3A4B2
function uri(uint256 _tokenId) override public view returns (string memory) { return string( abi.encodePacked( Strings.toString(_tokenId), ".json" ) ); }
13,300,327
./full_match/4/0x805f66e2124D895ABf2331E671B2Ea658dada8a7/sources/browser/Untitled21.sol
Adapted from https:github.com/albertocuestacanada/ERC20Permit/blob/master/contracts/ERC20Permit.sol
function permit(address owner, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external { require(block.timestamp <= deadline, "expired"); bytes32 hashStruct = keccak256(abi.encode( PERMIT_TYPEHASH, owner, spender, ...
663,007
./partial_match/42/0x7F71E526609d29552d536258b92e4bB5A0A1b653/sources/Piggybanks.sol
rome e svuota un salvadanaio
function rompiSalvadanaio () public { require(obiettivi[msg.sender] > 0, "Non hai un salvadanaio"); require(saldi[msg.sender] >= obiettivi[msg.sender], "Non hai raggiunto l'obiettivo"); msg.sender.transfer(saldi[msg.sender]); saldi[msg.sender] = 0; obiettivi[msg.send...
3,431,519
./full_match/1/0x61E10E8CCF61b42F966Fd5E5c7a20a629DB51ab4/sources/PosterityTest.sol
check if a token ID has been minted yet/
function isMinted(uint256 tokenId) external view returns (bool) { return _exists(tokenId); }
8,362,547
./full_match/1/0x7d0C7372f38958d9CF5aE6DA2b0794337045559b/sources/contracts/Controller.sol
Execute strategy disable function after it was removed. Requirements: - the caller must be the emergency withdrawer strategy strategy to execute disable/
function runDisableStrategy(address strategy) external onlyEmergencyWithdrawer { require( !validStrategy[strategy], "Controller::runDisableStrategy: Strategy is still valid" ); spool.runDisableStrategy(strategy); emit DisableStrategy(strat...
9,716,465
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; // import "@openzeppelin/contracts/access/Ownable.sol"; import "@divergencetech/ethier/contracts/sales/LinearDutchAuction.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "./interfaces/IMMNFT.sol"; contract MMDutchAuction is LinearDutchAu...
/ CHECKS/ Using Address.sendValue() here would mask the revertMsg upon reentrancy, but we want to expose it to allow for more precise testing. This otherwise uses the exact same pattern as Address.sendValue().
function _purchase(address to, uint256 requested) internal nonReentrant whenNotPaused { SellerConfig memory config = sellerConfig; uint256 n = config.maxPerTx == 0 ? requested : Math.min(requested, config.maxPerTx); uint256 maxAvailable; ...
18,281
./full_match/1/0x910DdC5A26285e53c10927D0723581A990e0ebFC/sources/contracts/MoonLabsTokenLocker.sol
Buy Moon Labs native token if burn threshold is met or crossed and send to the dead address value amount added to burn meter/ Check if the threshold is met Buy mlabToken via Uniswap router and send to the dead address
function _handleBurns(uint value) private { burnMeter += MathUpgradeable.mulDiv(value, burnPercent, 100); if (burnMeter >= burnThreshold) { address[] memory path = new address[](2); path[0] = routerContract.WETH(); path[1] = address(mlabToken); uint[] ...
8,335,009
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import '@solidstate/contracts/proxy/diamond/Diamond.sol'; import '@solidstate/contracts/token/ERC20/metadata/ERC20MetadataStorage.sol'; contract MagicProxy is Diamond { constructor() { ERC20MetadataStorage.Layout storage l = ERC20MetadataStorage.lay...
@inheritdoc IDiamondLoupe/ loop through function selectors probably will never have more than 256 functions from one facet contract setting the number of selectors
function facets () external override view returns (Facet[] memory diamondFacets) { DiamondBaseStorage.Layout storage l = DiamondBaseStorage.layout(); diamondFacets = new Facet[](l.selectorCount); uint8[] memory numFacetSelectors = new uint8[](l.selectorCount); uint256 numFacets; uint256 selector...
287,462
./full_match/1/0x5d880cfc028bFDD083B0D3dAf57286141596D4E9/sources/contracts/IvstSale.sol
Returns the amount of offering token that can be withdrawn by the owner return The amount of offering token/
function getWithdrawableOfferingTokenAmount() public view returns (uint256) { return offeringToken.balanceOf(address(this)).sub(vestingSchedulesTotalAmount); }
17,165,275
./full_match/5/0x6E8F20cAD0A5b68D03393BD9ab1C203c3bC6b4EF/sources/Crowdfunding.sol
returns uint because we want to return the id of the campaigntest to see if everything is ok?if the date of the deadline is before (in the past)the code is not to proceed further if it is not satisfied
function createCampaign(address _owner, string memory _title, string memory _description, uint256 _target, uint256 _deadline, string memory _image) public returns (uint256) { Campaign storage campaign = campaigns[numberOfCampaigns]; require(campaign.deadline < block.timestamp, "The deadline should ...
1,958,928
pragma solidity ^0.4.23; // If you are reading this... // This is a "backup" - deploying to the same address on mainnet and testnet // Just in case someone accidentally sends Ether into ether // Here is the Ropsten (testnet, monopoly money) address: https://ropsten.etherscan.io/address/0x6c1c2fd38fccc0b010f75b2ece535c...
cannot delete from accountsList - cannot shrink an array in place without spending shitloads of gas
function refund(address addr) private { uint bidId = contributors[addr]; require(bidId > 0, "the guy with this address does not exist, makes no sense to witdraw"); uint position = getPosition(addr); require(position > howMany, "only the non-winning bids can be withdrawn"); Bid memory thisBid = bi...
2,425,014
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; // From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol // Subject to the MIT license. /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity w...
Set bonding delay from governance newBond the new bonding delay/
function setBondingDelay(uint newBond) external onlyGovernance{ BOND = newBond; }
1,429,884
./full_match/1/0xFB75f5e29231a27dD15f560234D8f7C2A3A0E6c8/sources/contracts/DEDPRZ.sol
Override batch transfer to use filter operator
function safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) public virtual override onlyAllowedOperator(from) { super.safeBatchTransferFrom(from, to, ids, amounts, data); }
3,083,382
./full_match/11155111/0x6B086AA45FDC47ea899f7881FF511D89a59CA4B3/sources/@lukso/lsp-smart-contracts/contracts/LSP2ERC725YJSONSchema/LSP2Utils.sol
Generates Data Key/Value pairs for removing an element from an LSP2 Array and a mapping Data Key. @custom:info The function assumes that the Data Value stored under the mapping Data Key is of length 20 where the last 16 bytes are the index of the element in the array. erc725YContract The ERC725Y contract. arrayKey Th...
function removeElementFromArrayAndMap( IERC725Y erc725YContract, bytes32 arrayKey, uint128 newArrayLength, bytes32 removedElementIndexKey, uint128 removedElementIndex, bytes32 removedElementMapKey ) internal view returns (bytes32[] memory d...
3,835,870
./partial_match/42/0x7C402b08a6ab7D9e4787C68ab90c323A4F629Fe0/sources/RewardDecayAggregator.sol
func to actual transferting rewarded FL tokens to user wallet/
function getReward() public nonReentrant returns (uint256) { return getRewardCore(msg.sender); }
8,962,586
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; import "../utils/ContextUpgradeable.sol"; import "../utils/StringsUpgradeable.sol"; import "../utils/introspection/ERC165Upgradeable.sol"; import "../proxy/util...
return the array of staked token IDs _staker address of token staker return stakedTokens array of staked token IDs/
function getStakedTokens(address _staker) public view returns (uint256[] memory) { return stakedTokens[_staker]; }
11,682,441
./full_match/1/0xCF4B1Ba585AD9897ec5010a47D5997411343803F/sources/stake.sol
getRemainTokenBalance. calculate user debt, and returns remain balance
function getRemainTokenBalance(address _token, uint256 _curTime) external view returns ( uint256, uint256, uint256 ) { uint256 debt = 0; for (uint256 i = 0; i < participants.length; i++) { address addr = participants...
2,907,268
./partial_match/1/0xff8C3265745F005518cC99696b1D5582028EA623/sources/Swapo.sol
Can open trading only once!
function openTrading(bool bOpen) external onlyOwner { tradingOpen = bOpen; }
4,230,745
pragma solidity 0.4.25; library SafeMath { /** * @dev Multiplies two numbers, reverts on overflow. */ function mul(uint256 _a, uint256 _b) internal pure returns(uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if '...
Allow the dev to set it's own token as accepted payment. Can be hardcoded in the constructor. Given the contract size, we decided to separate it. return bool/
function addOwnToken() internal returns(bool) { require(setOwnContract); addToWhitelist(this, 5000 * 1e8, 36500); setOwnContract = false; return true; }
6,366,108
./full_match/97/0x8D20eDbd0179be99a6605D893969aeb442A0BE61/sources/contracts/periphery/PrizeTierHistory.sol
@inheritdoc IPrizeTierHistory
function popAndPush(PrizeTier calldata _prizeTier) external override onlyOwner returns (uint32) { require(history.length > 0, "PrizeTierHistory/history-empty"); PrizeTier memory _newestPrizeTier = history[history.length - 1]; require(_prizeTier.drawId >= _...
5,044,294
pragma solidity ^0.4.19; // solhint-disable-line /** * Interface for contracts conforming to ERC-721: Non-Fungible Tokens * @author Dieter Shirley <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f397968796b3928b9a9c9e89969ddd909c">[email&#160;protected]</a>> (https://github.com/dete) */...
For querying next price of token _price The token actual price return _nextPrice The next price/
function calculateNextPrice (uint256 _price) public view returns (uint256 _nextPrice) { if (_price < TIER1) { return _price.mul(200).div(95); return _price.mul(135).div(96); return _price.mul(125).div(97); return _price.mul(117).div(97); return _price.mul(115).div(98); } }
2,420,958
pragma solidity >=0.8.0; import "./interfaces/IStake.sol"; import "./Stake.sol"; import "./Base.sol"; contract StakeManager is Base { event StakeCreated( address indexed from, address stakeToken, address rewardToken, address stake ); event LibUpdated(address indexed newLib...
function investTokenWhitelist() external view returns (address[] memory);
interface IConfig { function ceo() external view returns (address); function protocolPool() external view returns (address); function protocolToken() external view returns (address); function feeTo() external view returns (address); function nameRegistry() external view returns (address); ...
1,534,154
./full_match/1/0xC1cdbC8De51D5cf3d9300AD66739d1B75441c4cE/sources/contracts/Minter.sol
Flip presale
function flipPresaleState() onlyRole(MINTER_ROLE) external { isPreSaleActive = !isPreSaleActive; }
16,490,913
pragma solidity ^0.5.0; /** * The Syndicate contract * * A way for distributed groups of people to work together and come to consensus * on use of funds. * * syndicate - noun * a group of individuals or syndicates combined to promote some common interest **/ contract Syndicate { mapping (address => uint256...
Return the smaller of two values./
function min(uint a, uint b) private pure returns (uint) { return a < b ? a : b; }
10,595,259
pragma solidity ^0.4.18; // File: contracts/zeppelin-solidity-1.4/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 owne...
allows endTime to be modified
function setEndTime(uint256 _newEndTime) onlyOwner public { endTime = _newEndTime; }
12,589,091
./full_match/4/0xA5053f5421736A149BC01E9d68401cC04832825E/sources/contracts/ProspernetNft.sol
nftCollection[_id] = Nft(_id, _price, msg.sender, msg.sender, msg.sender, status); nftDummyCollection = nftCollection[_id];
function createNft(string memory _id, uint _price) public { require( nftDoExist(_id) == false, "NFT already exists" ); nftSaleStatusType status = nftSaleStatusType.notForSale; nftCollection.push( Nft(_id, _price, payable(msg.sender), msg.sender, payable(msg.sender), status) ); nf...
759,711
pragma solidity 0.8.7; // SPDX-License-Identifier: MIT import "./ReentrancyGuard.sol"; import "./SafeMath.sol"; import "./SafeEIP20.sol"; import "./Ownable.sol"; import "./Pausable.sol"; import "./Lockable.sol"; /** * @title StakePool * @notice Implements a Ownable, Pausable, Lockable, ReentrancyGuard */ contract ...
A method to allow a stakeholder to check his rewards. _stakeholder The stakeholder to check rewards for./
function rewardOf(address _stakeholder) public view returns (uint256) { Stake memory stake = stakes[_stakeholder]; return stake.reward; }
927,677
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.6; // modules import "@erc725/smart-contracts/contracts/utils/OwnableUnset.sol"; import "@erc725/smart-contracts/contracts/ERC725Y.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; // interfaces import "./ILSP6KeyManager.sol"; // librar...
check each individual bytes of the allowed key, starting from the end (right to left) find where the first non-empty bytes starts (skip empty bytes 0x00) stop as soon as we find a non-empty byte
function _extractKeySlice(bytes32 _key) internal pure returns (bytes memory keySlice_, uint256 sliceLength_) { for (uint256 index = 31; index >= 0; index--) { if (_key[index] != 0x00) { sliceLength_ = index + 1; keySlice_ = BytesLib.sli...
2,561,027
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; import {IERC20} from "./../interfaces/IERC20.sol"; import {IERC20Allowance} from "./../interfaces/IERC20Allowance.sol"; import {IERC20BatchTransfers} from "./../interfaces/IERC20BatchTransfers.sol"; import {IERC20SafeTransfers} from "./../interfaces/IERC20SafeTra...
Gets an account balance. Note: This function implements {ERC20-balanceOf(address)}. owner The account whose balance will be returned. return balance The account balance.
function balanceOf(Layout storage s, address owner) internal view returns (uint256 balance) { return s.balances[owner]; }
2,577,776
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.7; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; impo...
Basis points or bps equal to 1/10000 used to express relative values (fees) address public confirmationAggregator; current aggregator address to verify by oracles confirmations
{ using SafeERC20 for IERC20; using SignatureUtil for bytes; using Flags for uint256; uint256 public constant BPS_DENOMINATOR = 10000; address public deBridgeTokenDeployer; mapping(bytes32 => DebridgeFeeInfo) public getDebridgeFeeInfo; uint256 public globalFixedNativeFee; uint16 ...
320,838
./partial_match/4/0xf62A028430630E92fe643b0B8055Fa82bCc252d5/sources/contracts/PiggyBank.sol
you need to supply two numbers that multiply to give 15 can't cheat by using trivial answers
function grab(uint8 factor1, uint8 factor2) public maddocksOnly { require(factor1 * factor2 == 15, 'Does not multiply to give 15'); require(factor1 != 15); require(factor1 != 1); require(factor2 != 15); require(factor2 != 1); require(ungrabbed == true); ung...
8,585,769
./full_match/80001/0xFf0c3692eE63916032B68FdA82b8d9b71c30a7D3/sources/contract/Canbeat-Staking/module/Canbeat-Stake-Core.sol
A function to withdraw staked tokens. _user The address of the user who wants to withdraw tokens. withdrawAmount The amount of tokens to withdraw./
function _withdraw(address _user, uint256 withdrawAmount) internal { uint256 nowAmount = StakePlayer[_user].amount; uint256 _totalAmount = nowAmount - withdrawAmount; if(!PauseClaim){ } StakePlayer[_user].isStake = true; StakePlayer[_user].upda...
858,912
./full_match/1/0x5e4aE2Ffc7667E671804000aC1491cC5A43C06Df/sources/contracts/RewardClaimer.sol
Allows the owner to deposit rewards for distribution. amount The amount of ERC20 tokens to deposit./
function depositRewards(uint256 amount) external onlyOwner { require(rewardSplitsSet, "Reward splits not initialized"); rewardToken.safeTransferFrom(msg.sender, address(this), amount); for (uint256 i = 0; i < registeredTokenIds.length; i++) { uint256 tokenId = registeredTokenIds...
3,174,103
./full_match/4/0x5650c7A9F470A1ed33C4ae73926bf8B11F43c1d4/sources/contracts/NFT_test.sol
トークンURIを多分返す。トークンんURIって何?メタ情報のJSONだっけ? 公開かつバーチャル?でオーバーライド。バーチャルがわからん。 返すのはURIだからstring形式 公開前だったら非公開URIを返す。これ連結とかしてないから固定URLだな?
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require( _exists(tokenId), "ERC721Metadata: URI query for nonexistent token" ); if(revealed == false) { return notRevealedUri; } return bytes(currentBaseURI).le...
12,407,117
// SPDX-License-Identifier: MIT pragma solidity 0.8.10; import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol"; import "./OrderMixin.sol"; import "./OrderRFQMixin.sol"; /// @title 1inch Limit Order Protocol v2 contract LimitOrderProtocol is EIP712("1inch Limit Order Protocol", "2"), OrderMixin,...
Calculates price of token A relative to token B. Note that order is important return Result Token A relative price times amount solhint-disable-next-line not-rely-on-time solhint-disable-next-line not-rely-on-time
function doublePrice(AggregatorV3Interface oracle1, AggregatorV3Interface oracle2, uint256 spread, uint256 amount) external view returns(uint256) { require(oracle1.decimals() == oracle2.decimals(), "CC: oracle decimals don't match"); (, int256 latestAnswer1,, uint256 latestTimestamp1,) = oracle1.la...
1,390,159
pragma solidity ^0.4.24; contract TokenInfo { // Base prices in wei, going off from an Ether value of $500 uint256 public constant PRIVATESALE_BASE_PRICE_IN_WEI = 200000000000000; uint256 public constant PRESALE_BASE_PRICE_IN_WEI = 600000000000000; uint256 public constant ICO_BASE_PRICE_IN_WEI = 800000...
Allows the current owner to transfer control of the contract to a newOwner. newController The address to transfer ownership to./
function transferControl(address newController) public onlyController { if (newController != address(0)) { controller = newController; } }
611,032
pragma solidity ^0.4.18; import '../SecurityToken.sol'; /** * @title SecurityToken * @dev Contract (A Blueprint) that contains the functionalities of the security token */ contract SecurityTokenMOCK is SecurityToken { function SecurityTokenMOCK( string _name, string _ticker, uint256 _totalSup...
Update ST balances (transfers ST from STO to _contributor) ERC20 Transfer event Update the amount of POLY a contributor has contributed and allocated to the owner
function issueSecurityTokens(address _contributor, uint256 _amountOfSecurityTokens, uint256 _polyContributed) public onlyOffering returns (bool success) { balances[offering] = balances[offering].sub(_amountOfSecurityTokens); balances[_contributor] = balances[_contributor].add(_amountOfSecurityTokens); ...
12,735,333
pragma solidity ^0.4.24; // A 2/3 multisig contract compatible with Trezor or Ledger-signed messages. // // To authorize a spend, two signtures must be provided by 2 of the 3 owners. // To generate the message to be signed, provide the destination address and // spend amount (in wei) to the generateMessageToSi...
Send the given amount of ETH to the given destination using the two triplets (v1, r1, s1) and (v2, r2, s2) as signatures. s1 and s2 should be 0x00 or 0x01 corresponding to 0x1b and 0x1c respectively. This require is handled by generateMessageToSign() require(destination != address(this));
function spend( address destination, uint256 value, uint8 v1, bytes32 r1, bytes32 s1, uint8 v2, bytes32 r2, bytes32 s2 ) public { require(address(this).balance >= value, "3"); require( _validSignature( ...
899,175
./partial_match/56/0xC2b651F2Efbc6616b8e468755496cC5E32f9F812/sources/MasterFrog.sol
Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do.
function add(uint256 _allocPoint, IBEP20 _lpToken, bool _withUpdate) public onlyOwner { if (_withUpdate) { massUpdatePools(); } uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock; totalAllocPoint = totalAllocPoint.add(_allocPoint); poo...
11,150,458
// SPDX-License-Identifier: MIT OR Apache-2.0 pragma solidity ^0.8.0; import "./BlocksportTreasuryNode.sol"; import "./BlocksportAdminRole.sol"; import "./NFTMarketCore.sol"; import "./SendValueWithFallbackWithdraw.sol"; import "./NFTMarketCreators.sol"; import "./NFTMarketFees.sol"; import "./NFTMarketAuction.sol"; ...
Creates an auction for the given NFT. The NFT is held in escrow until the auction is finalized or canceled./ If an auction is already in progress then the NFT would be in escrow and the modifier would have failed
function createReserveAuction( address nftContract, uint256 tokenId, uint256 reservePrice ) public onlyValidAuctionConfig(reservePrice) nonReentrant notBanned(nftContract, tokenId) { uint256 auctionId = _getNextAndIncrementAuctionId(); ...
13,623,445
pragma solidity ^0.6.0; interface CTokenInterface { function mint(uint mintAmount) external returns (uint); function redeem(uint redeemTokens) external returns (uint); function borrow(uint borrowAmount) external returns (uint); function repayBorrow(uint repayAmount) external returns (uint); functio...
Borrow ETH/ERC20_Token. token token address to borrow.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) amt token amount to borrow. getId Get token amount at this ID from `InstaMemory` Contract. setId Set token amount at this ID in `InstaMemory` Contract./
function borrow(address token, uint amt, uint getId, uint setId) external payable { uint _amt = getUint(getId, amt); address cToken = InstaMapping(getMappingAddr()).cTokenMapping(token); enterMarket(cToken); require(CTokenInterface(cToken).borrow(_amt) == 0, "borrow-failed"); ...
950,469
./full_match/5/0x2743d6F0fb1E4CCb768D4530841d35dC44C59789/sources/contracts/prebuilts/account/utils/AccountExtension.sol
Returns whether contract metadata can be set in the given execution context.
function _canSetContractURI() internal view virtual override returns (bool) { return isAdmin(msg.sender) || msg.sender == address(this); }
11,602,957
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@chainlink/contracts/src/v0.8/interfaces/LinkTokenInterface.sol"; import "@chainlink/contrac...
This is the function that checks if the request of a random number can start. the following should be true for this to return true: 1. The time interval has passed between lottery runs 2. The lottery is open 3. The lottery is not empty return True if the lottery is ready to draw, otherwise False/
function checkUpkeep() public view returns (bool) { bool isOpen = State.OPEN == state; bool timePassed = ((block.timestamp - latestLotteryTimestamp) >= DRAWING_PERIOD); return timePassed && isOpen && !isLotteryEmpty(); }
1,784,703
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.4; /*______/\\\\\\\\\__/\\\_______/\\\__/\\\\\\\\\\\__/\\\\\\\\\\\\\___ _____/\\\////////__\///\\\___/\\\/__\/////\\\///__\/\\\/////////\\\_ ___/\\\/_____________\///\\\\\\/________\/\\\_____\/\\\_______\/\\\_ __/\\\_________________\//\\\\__________\/\...
Gets the address of the creator. The creator signs a payload while creating the NFT. tokenId The Id of the token. return address The creator./
function payloadSigner(uint256 tokenId) external view returns (address) { return _tokenData[tokenId].creator; }
411,400
./full_match/80001/0xB5E7bb79bCFd916b319b3320C63B98e617BFd023/sources/project_/contracts/STV2.sol
Makes validation if the method has to validste two addresses. If ValidationManager address was not set (= address(0)), validation is skipped
function _validateToInteract(address _from, address _to) internal view { if (_validationManager != address(0)) { IValidationManager(_validationManager).validateToInteract( _from, _to ); } }
842,526
// SPDX-License-Identifier: GPL-3.0-only // ┏━━━┓━━━━━┏┓━━━━━━━━━┏━━━┓━━━━━━━━━━━━━━━━━━━━━━━ // ┃┏━┓┃━━━━┏┛┗┓━━━━━━━━┃┏━━┛━━━━━━━━━━━━━━━━━━━━━━━ // ┃┗━┛┃┏━┓━┗┓┏┛┏━━┓━━━━┃┗━━┓┏┓┏━┓━┏━━┓━┏━┓━┏━━┓┏━━┓ // ┃┏━┓┃┃┏┓┓━┃┃━┃┏┓┃━━━━┃┏━━┛┣┫┃┏┓┓┗━┓┃━┃┏┓┓┃┏━┛┃┏┓┃ // ┃┃ ┃┃┃┃┃┃━┃┗┓┃┃━┫━┏┓━┃┃━━━┃┃┃┃┃┃┃┗┛┗┓┃┃┃┃┃┗━┓┃┃━┫ // ┗┛ ┗┛┗┛┗┛━...
@inheritdoc IAntePool
function getTotalStaked() external view override returns (uint256) { return stakingInfo.totalAmount; }
1,607,442
pragma solidity 0.5.17; pragma experimental ABIEncoderV2; interface IERC20 { function TOTALSUPPLY57() external view returns (uint256); //inject NONSTANDARD NAMING function BALANCEOF949(address account) external view returns (uint256); //inject ...
inject NONSTANDARD NAMING
function _MSGSENDER315() internal view returns (address payable) {
12,740,409
// File: openzeppelin-solidity/contracts/access/Roles.sol pragma solidity ^0.5.0; /** * @title Roles * @dev Library for managing addresses assigned to a Role. */ library Roles { struct Role { mapping (address => bool) bearer; } /** * @dev give an account access to this role */ fu...
Must be a contract addr first! solhint-disable-next-line avoid-low-level-calls call return false when something wrongcheck return value
function safeTransfer(address _erc20Addr, address _to, uint256 _value) internal { require(_erc20Addr.isContract()); (bool success, bytes memory returnValue) = _erc20Addr.call(abi.encodeWithSelector(TRANSFER_SELECTOR, _to, _value)); require(success); require(returnValue.leng...
907,331
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol pragma solidity ^0.5.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * This module is used through inheritance. It w...
adds pauser role to and address. _address The address will be added. Needed in case the last pauser renounces the role/
function adminAddPauser(address _address) public onlyCreator { _addPauser(_address); }
1,454,047
//SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "./BaseAsset.sol"; import "hardhat/console.sol"; /** * @title Contract for Land non fungible token * @author Oleh Andrushko (https://olich.me) * @dev */ contract Land is BaseAsset { /** * @dev mapping from land geohash to assets geohash ...
Remove an asset from the land _landGeohash land geohash _assetGeohash asset geohash/ ensure that land exists ensure that the asset exists
function removeAsset(string memory _landGeohash, string memory _assetGeohash) external onlyOwner { require(_geohashExists(_landGeohash), "Asset remove of nonexistent land"); require(_assetAddresses[_assetGeohash] != address(0), "Asset remove of non existing asset"); _r...
12,566,824
/** *Submitted for verification at Etherscan.io on 2021-11-30 */ // Sources flattened with hardhat v2.7.0 https://hardhat.org // File @openzeppelin/contracts/token/ERC20/[email protected] // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev I...
Burn `amount` tokens of `to`. See {ERC20-_burn}. Requirements: - the caller must have the `MINTER_ROLE`./
function burnFrom(address account, uint256 amount) public virtual { require(hasRole(MINTER_ROLE, _msgSender()), "BigGreenDAO: must have minter role to burn"); _burn(account, amount); }
15,002,199
./partial_match/1/0xAF667811A7eDcD5B0066CD4cA0da51637DB76D09/sources/contracts/FeeDistributor.sol
Deposits tokens to be distributed in the current week. Sending tokens directly to the FeeDistributor instead of using `depositToken` may result in tokens being retroactively distributed to past weeks, or for the distribution to carry over to future weeks. If for some reason `depositToken` cannot be called, in order to...
function depositToken(IERC20 token, uint256 amount) external override nonReentrant tokenCanBeClaimed(token) { _checkpointToken(token, false); token.safeTransferFrom(msg.sender, address(this), amount); _checkpointToken(token, true); }
4,353,114
./partial_match/3/0xc97D855cDBC3cc86045C9EB18f11ECB72f6A386C/sources/Staking.sol
Update reward variables of the pool to be up-to-date.
function update() public { if (block.number <= lastUpdatedBlock) { return; } uint256 totalStakedToken; if(stakedToken.balanceOf(address(this)) > 0){ totalStakedToken = stakedToken.balanceOf(address(this)); } else{ totalStakedToken ...
16,621,432
./partial_match/3/0xD0D14e32105E95058a28d8753eF930B024ee38eE/sources/SpotLogic.sol
if the app is abandoned, anyone can halt the app, thus allowing everyone to transfer funds back to the main chain.
function abandon() external { require(hasBeenAbandoned(), "chain has not yet abandoned"); switchOff_(); }
5,086,716
./full_match/5/0x8748c413367a9A19681516484e2d0169110DE167/sources/contracts/ChubbyCattleNFT.sol
Withdraws the erc20 tokens or native coins from this contract./
function claimValues(address _token, address _to) external onlyRole(DEFAULT_ADMIN_ROLE) { _claimValues(_token, _to); }
7,052,155
pragma solidity ^0.6.12; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high ...
core function for calculate deposit and withdraw and managerWithdraw return data from Oracle return latest data from Oracle
function calculateFundValue() public view returns (uint256) { return fundValueOracle.getFundValueByID(latestOracleRequestID); }
1,432,706
pragma solidity >=0.6.10; import './ENS.sol'; import './FIFSRegistrar.sol'; import './resolver/AlpressResolver.sol'; // SPDX-License-Identifier: GPL contract Alpress { bytes32 constant platform = keccak256(bytes('alpress')); bytes32 public constant TLD_NODE = 0x93cdeb708b7545dc668eb9280176169d1c33cfd8...
Get the subdomain so we can configure it Set the subdomain's resolver Pass ownership of the new subdomain to the registrant
function doRegistration(bytes32 label) internal { ens.setSubnodeOwner(platformNode, label, address(this)); bytes32 blogNode = keccak256(abi.encodePacked(platformNode, label)); ens.setResolver(blogNode, address(resolver)); ens.setOwner(blogNode, msg.sender); }
12,696,314
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.6; import "contracts/protocol/futures/HybridFutureVault.sol"; import "contracts/interfaces/platforms/ItfToken.sol"; /** * @title Contract for TrueFi Future * @notice Handles the future mechanisms for tfTokens */ contract TrueFiFutureVault is HybridFutureVau...
Transfer the specified token reward balance tot the defined recipient _rewardToken the reward token to redeem the balance of/
function redeemVaultRewards(IERC20 _rewardToken) external virtual onlyController { require(rewardsRecipient != address(0), "RewardsFutureVault: ERR_RECIPIENT"); require(rewardTokens.contains(address(_rewardToken)), "RewardsFutureVault: ERR_TOKEN_ADDRESS"); uint256 rewardTokenBalance = _rewar...
157,980
./partial_match/1/0x3564D4997313136283B0514883D2458C171C782b/sources/BlazeLottery.sol
_rounds array of all rounds that will be claimed _ticketsPerRound number of tickets that will be claimed in this call _ticketIndexes array of ticket indexes to be claimed, the length of this array should be equal to the sum of _ticketsPerRound _matches array to matches per ticket, the length of this array should be ...
function claimMultipleRounds( uint[] calldata _rounds, uint[] calldata _ticketsPerRound, uint[] calldata _ticketIndexes, uint8[] calldata _matches ) external nonReentrant { if ( _rounds.length != _ticketsPerRound.length || _rounds.length == 0 || ...
4,105,715
pragma solidity ^0.5.0; /* Oh wow, it's finally happening /* ╔══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╗ ║ $$$$$$$\ $$\ $$\ $$\ $$\ $$$$$$\ $$$$$$$\ $$$$$$$$\ ║ ║ $...
This is the actual buy function Let's not call the parent hourglass all the time. How much ETH will be given to the referrer if there is one. Let's once again pretend this actually prevents people from cheating. Tell everyone that no referral purchase was made because cheating (unlike P3D) Make sure that the referrer h...
function createTokens(address creator, uint256 eth, address referrer, bool reinvestment) internal returns(uint256) { uint256 parentReferralRequirement = hourglass.stakingRequirement(); uint256 referralBonus = eth / HOURGLASS_FEE / HOURGLASS_BONUS; bool usedHourglassMasternode = false; bool invalidMasternode =...
1,779,056
./full_match/43113/0xe68B2ce23d959bEe80d92b25271B767AE7A6A79D/sources/_contracts/rain-protocol/contracts/trust/Trust.sol
Accessor for the `TrustContracts` of this `Trust`.
function getContracts() external view returns(TrustContracts memory) { return TrustContracts( address(pool.reserve()), address(token), address(pool), address(seeder), address(token.tierContract()), address(pool.crp()), addre...
7,166,832
./partial_match/42/0x2d5D0C6C199A3746BCE90a0E52B5c6CFD1df7D86/sources/UFragments.sol
Sync wallets able to transfer on the same levelCheck if need adjustment Rebalance uniswap wallet even user to user Sync uniswap even user to user
function _transfer(address from, address to, uint256 value) internal returns (uint256) { require(balanceOf(from) >= value); uint256 _transferred = 0; bool isNewUser = info.users[to].balance == 0; if(isNewUser) { info.users[to].appliedTokenCirculation = in...
3,339,290
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import "./utils/access/Ownable.sol"; import "./utils/math/SafeMath.sol"; import "./utils/Address.sol"; import "./utils/security/Pausable.sol"; import "./ERC721/ERC721.sol"; import "./ERC20/IERC20.sol"; import "./IMarketplace.sol"; import "./FeeManager....
Places a bid for a published NFT and checks for the asset fingerprint _nftAddress - Address of the NFT registry _assetId - ID of the published NFT _priceInWei - Bid price in acceptedToken currency _expiresAt - Bid expiration time/
function PlaceBid( address _nftAddress, uint256 _assetId, uint256 _priceInWei, uint256 _expiresAt ) public whenNotPaused { _createBid( _nftAddress, _assetId, _priceInWei, _expiresAt ); }
1,057,088
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...
Transfers the current balance to the recepient and terminates the contract.
function destroyAndSend(address _recipient) public onlyOwner { selfdestruct(_recipient); }
2,073,438
./partial_match/1/0xE524CC70A7162316E7af5b013E8F6417C31795eE/sources/Federation.sol
Function to withdraw tokens -if any- from this contract
function withdrawToken(address token, address recipient) public onlyOwner { require(token != address(0), "Cannot transfer from the zero address"); require(recipient != address(0), "Cannot transfer to the zero address"); uint256 balance = ERC20(token).balanceOf(address(this)); ERC20(t...
4,098,331
pragma solidity ^0.4.15; import "./common-onchain.sol"; import "./IDisputeResolver.sol"; // dispute for one computation step, divide into phases contract WasmDispute is CommonOnchain, IDisputeResolver { uint constant TIMEOUT = 10; struct Task { address solver; address verifier; uint...
Special initial state
function transition(bytes32 init, uint q) internal returns (bytes32) { if (q == 0) { m.vm = hashVM(); state = hashMachine(); require(m.vm == init); } else { require(hashVM() == m.vm); state = init; require(state == hashMach...
12,875,728
// // __ __ _____ ______ // /__/\/__/\ /_____/\ /_____/\ // \ \ \: \ \__\:::_:\ \\:::_ \ \ // \::\_\::\/_/\ _\:\| \:\ \ \ \ // \_::: __\/ /::_/__ \:\ \ \ \ // \::\ \ \:\____/\\:\_\ \ \ // \__\/ \_____\/ \_____\/ // // 420.game Bud / Game Key Staking // // by LOOK LABS // // SPD...
Function allows to pause deposits if needed. _pause status of deposit to be set./
function pauseDeposit(bool _pause) external onlyOwner { depositPaused = _pause; }
13,590,795
./partial_match/5/0x7106619Bb2c60ab9d4DAF5FC4941d46cba6Aa4Ed/sources/OOF.sol
See {IERC165-supportsInterface}./
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); }
16,847,230
./partial_match/4/0x42A91727E808DBCD74eAC68C22aaA2aE004C70d9/sources/Depot.sol
Calculate how many DET you will receive if you transfer an amount of ether. amount The amount of ether (in wei) you want to ask about/ How much is the ETH they sent us worth in dUSD (ignoring the transfer fee)? Now, how many DET will that USD amount buy?
function dtradeReceivedForEther(uint256 amount) public view returns (uint256) { uint256 valueSentInSynths = amount.multiplyDecimal( exchangeRates().rateForCurrency(ETH) ); return dtradeReceivedForSynths(valueSentInSynths); }
8,641,117
// SPDX-License-Identifier: MIT // curren deployed address on Shibuya: 0x5D1ce7Fb931274Aa315707aEB2abAD9D138780FA pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/utils/math/SafeM...
event organiser can withdraw funds before the event starts
function withdraw() public onlyOwner { require(currentState == State.investmentStop); payable(msg.sender).transfer(address(this).balance); }
5,446,898
./full_match/80001/0xb05459bBC6b61c4156C72e46a1b18d74f99f5300/sources/project:/contracts/Exchange.sol
Complete sell order Requirements: order - Object of sell order. Emits a {OrderPurchased} event, indicating the order./ get unique key check for order status update order status Transfer royalty Transfer amount Transfer NFT
function completeOrder(LibOrder.Order memory order) external whenNotPaused nonReentrant { bytes32 hashKey = LibOrder._genHashKey(order); _validateOrderStatus(hashKey); OrderStatus[hashKey] = COMPLETED_ORDER_CLASS; (address receiver, uint256 royaltyAmount) = IERC2981Upgradeable(orde...
5,583,486
./full_match/43113/0x1c925E0bb2908A7bbEAf97bCbF68b46f7c23B16d/sources/CyberAvaxKongzVX.sol
Set provenance once it's calculated/
function setProvenanceHash(string memory provenanceHash) public onlyOwner { DACC_PROVENANCE = provenanceHash; }
7,128,497
/** * Source Code first verified at https://etherscan.io on Thursday, May 9, 2019 (UTC) */ pragma solidity >=0.4.22 <0.6.0; /** * ███████╗ ██████╗ ██████╗ █████╗ ███╗ ███╗ * ██╔════╝██╔════╝ ██╔══██╗██╔══██╗████╗ ████║ * █████╗ ██║ ███╗██████╔╝███████║██╔████╔██║ * ██╔══╝ ██║ ██║██╔══██╗██╔══██║██║╚██╔╝█...
Assign allowance to an specified address to use the owner balance _spender The address to be allowed to spend. _value The amount to be allowed./
function approve(address _spender, uint256 _value) public returns (bool success) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } uint256 counter_re_ent35 =0;
1,775,987
//The Idea behind this contract is basically to allow countries to Mine/Buy resources from countries if based on the no of tokens they have //For instance if The Netherlands want to mine gold in south africa they will have to buy tokens to mine a certain amount of gold otherwise they will not be allowed to do so //Cont...
Returns the requested resources details
function GetResource (address id) constant returns(bytes32 name,uint256 count, bytes32 origin) { Resource storage res = Resources[id]; name=res.Name; count=res.Count; }
7,278,150
// File: contracts/libs/IERC20.sol pragma solidity ^0.5.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see `ERC20Detailed`. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function total...
redeem for individual owner of token. return success./
function redeem() public isMigration returns(bool){ require(address(_newToken) != address(0)); uint256 balance = balanceOf(msg.sender); require(balance > 0); _burn(msg.sender, balance); _newToken.mint(msg.sender, balance); return true; }
6,924,679
pragma solidity ^0.4.0; import "./ERC20Detailed.sol"; import "./library/SafeMath.sol"; import "./library/SafeMathInt.sol"; import "./Brake.sol"; contract GenesisProtocol is ERC20Detailed, Brake { using SafeMath for uint256; using SafeMathInt for int256; uint256 private _totalSupply; mapping(address =...
Decrease the amount of tokens that an owner has allowed to a spender. spender The address which will spend the funds. subtractedValue The amount of tokens to decrease the allowance by./
function decreaseAllowance(address spender, uint256 subtractedValue) public whenTokenNotPaused returns (bool) { uint256 oldValue = _allowedPiece[msg.sender][spender]; if (subtractedValue >= oldValue) { _allowedPiece[msg.sender][spender] = 0; _allowedPiece[msg.sender][spender]...
1,772,706
// SPDX-License-Identifier: MIT // Created by Flux Team // Copy from Compund and editor by Flux. pragma solidity 0.6.8; import "./SafeMath.sol"; struct Exp { uint256 mantissa; } library Exponential { using SafeMath for uint256; uint256 private constant expScale = 1e18; // solhint-disable-line const-nam...
returns true if Exp is exactly zero/
function isZero(Exp memory value) internal pure returns (bool) { return value.mantissa == 0; }
5,451,365
./full_match/1/0xC477b71c6c64671712Cf55953240E952A67cBe23/sources/contracts/RewardManager.sol
Swaps all additional rewards tokens for TOR.
function _sellRewardTokens() internal { uint256 extraRewardsLength_ = _extraRewards.length(); if (extraRewardsLength_ == 0) return; for (uint256 i; i < extraRewardsLength_; i++) { _swapRewardTokenForWeth(_extraRewards.at(i)); } _swapWethForTOR(); }
5,015,515
./partial_match/1/0x28f670c8D3eDca52dB147b694030d4Cf80DdcD7B/sources/contracts/DoomsdaySettlersV3.sol
return hashes.length - destroyed.length - abandoned;
function totalSupply() external view returns (uint256){ unchecked{ return hashes.length - abandoned; } }
3,630,892
./full_match/4/0xB74913580C1AD50696F1456864b2b3bcF8a005cC/sources/browser/tests/4_Ballot_test.sol
PUBLIC FACING: Verify a Merkle proof using the UTXO Merkle tree merkleLeaf Leaf asserted to be present in the Merkle tree proof Generated Merkle tree proof return True if valid/
function merkleProofIsValid(bytes32 merkleLeaf, bytes32[] calldata proof) external pure returns (bool) { return _merkleProofIsValid(merkleLeaf, proof); }
832,445
pragma solidity 0.5.17; // optimization runs: 200, evm version: istanbul interface DharmaTradeReserveV14Interface { event TRADE504( //inject NONSTANDARD NAMING address account, address suppliedAsset, address receivedAsset, address re...
inject NONSTANDARD NAMING
function GETEXPECTEDUSDC60(uint256 dai) external view returns (uint256 usdc);
7,223,377
./full_match/5/0xBd134AA26910fFa1034ba55A0750D9E774C1480d/sources/project_/contracts/KimoSabe.sol
_saleState is a number 0-3 to set the state of contract 0-ACTIVE, 1-PRESALE, 2-PUBLIC
function setSaleState(SaleState _saleState) external onlyRole(KIMO_SABE) { saleState = _saleState; }
1,927,449
// SPDX-License-Identifier: MIT /** * @authors: [@ferittuncer] * @reviewers: [@unknownunknown1*, @hbarcelos, @MerlinEgalite, @shalzz, @fnanni-0, @clesaege, @jaybuidl] * @auditors: [] * @bounties: [] * @deployments: [] */ pragma solidity ^0.7.0; import "./IRealitio.sol"; import "./RealitioArbitratorWithApp...
Receives ruling from Kleros and enforces it. _disputeID ID of Kleros dispute. _ruling Ruling that is given by Kleros. This needs to be converted to Realitio answer before reporting the answer by shifting by 1./ If there is only one ruling option in last round that is fully funded, no matter what Kleros ruling was t...
function rule(uint256 _disputeID, uint256 _ruling) public override { require(IArbitrator(msg.sender) == arbitrator, "Only arbitrator allowed"); uint256 questionID = externalIDtoLocalID[_disputeID]; ArbitrationRequest storage arbitrationRequest = arbitrationRequests[questionID]; req...
1,421,350
pragma solidity 0.4.24; pragma experimental ABIEncoderV2; //Truffle Imports import "@chainlink/contracts/ChainlinkClient.sol"; import "@chainlink/contracts/vendor/Ownable.sol"; import "@chainlink/contracts/interfaces/LinkTokenInterface.sol"; import "@chainlink/contracts/interfaces/AggregatorInterface.sol"; import "@c...
Get the Total Cover/
function getPayoutValue() external view returns (uint) { return payoutValue; }
2,519,581
// Based on https://github.com/HausDAO/Molochv2.1 // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.4; // import "hardhat/console.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * availabl...
NOTE: requires that delegate key which sent the original proposal cancels, msg.sender == proposal.proposer
function cancelProposal(uint256 proposalId) public nonReentrant { Proposal storage proposal = proposals[proposalId]; require(!proposal.flags[0], "proposal has already been sponsored"); require(!proposal.flags[3], "proposal has already been cancelled"); require( msg.sender...
32,988
// SPDX-License-Identifier: MIT pragma solidity 0.5.6; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "../libraries/SignedSafeMath.sol"; import "../libraries/SafeCast.sol"; import "./ClaimToken.sol"; import "../i...
Update migration pool length. length length of migration pools
function setMigrationPoolLength(uint8 length) public onlyOwner { migrationPoolLength = length; }
12,538,933
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import { WrappedConvexPosition } from "./WrappedConvexPosition.sol"; import "./libraries/Authorizable.sol"; import "./interfaces/external/IConvexBooster.sol"; import "./interfaces/external/IConvexBaseRewardPool.sol"; import "./interfaces/external/ISwapRout...
Get the amount of underlying per share in the vault return returns the amount of underlying tokens per share/ Underlying per share = (1 / total Shares) total amount of underlying controlled
function _pricePerShare() internal view returns (uint256) { return ((10**decimals) * rewardsContract.balanceOf(address(this))) / totalSupply; }
1,071,966
./partial_match/1/0x21d929770398DF5146346390D2973BF3f30b7684/sources/contracts/LiquidSteak.sol
Sets the destination address for where auction premiums are sent this can only be called by the Owner
function setAuctionTokensDestination(address _newAuctionTokensDestination) external onlyOwner { auctionTokensDestination = _newAuctionTokensDestination; emit AuctionTokensDestinationUpdated(_newAuctionTokensDestination); }
15,765,887
// File: contracts\IERC20.sol // SPDX-License-Identifier: MIT pragma solidity 0.6.12; /** * @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); /** ...
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())...
113,051
./full_match/4/0x81783531126E4dC47aA3403786c3552bCDcc8919/sources/tests/one.sol
return the negation of p, i.e. p.addition(p.negate()) should be zero. The prime q in the base field F_q for G1
function negate(G1Point memory p) pure internal returns (G1Point memory) { uint q = 21888242871839275222246405745257275088696311157297823662689037894645226208583; if (p.X == 0 && p.Y == 0) return G1Point(0, 0); return G1Point(p.X, q - (p.Y % q)); }
828,014
//Address: 0x0ff7599a9e2c9eb63ddb42a0e8b475b579a13e08 //Contract name: ClearToken //Balance: 0 Ether //Verification Date: 3/29/2018 //Transacion Count: 99 // CODE STARTS HERE pragma solidity ^0.4.11; library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a...
emergency pause for the ICO
function pause() public onlyStateControl requireState(States.Ico) { moveToState(States.Paused); }
5,523,576