file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "./open-zeppelin/interfaces/IERC20.sol"; import "./open-zeppelin/libraries/SafeERC20.sol"; import "./open-zeppelin/utils/Ownable.sol"; import "./open-zeppelin/utils/Pausable.sol"; import "./open-zeppelin/utils/ReentrancyGuard.sol"; import "./interfaces/IV...
Updates the minimum delegation time newMinDelegationTime New minimum deelgation time (in seconds)/
function setMinDelegationTime(uint256 newMinDelegationTime) external onlyOwner { require(newMinDelegationTime > 0); minDelegationTime = newMinDelegationTime; }
1,765,283
./partial_match/1/0xf978e146DC26391C5A47052A89F8ef4fb301482E/sources/@interplanetary-lab/smart-contracts/contracts/ERC1155Upgradeable/ERC1155RoundsUpgradeable.sol
Mint the `amount` of tokens with the signature of the round validator. Requirements: - Round must have a validator - Total minted for the user during this round must be less than `maxMint`. - `sig` must be signed by the validator of the wave and contains all information to check. - `payloadExpiration` must be less tha...
function _privateRoundMint( address to, uint256 roundId, uint256 amount, uint256 maxMint, uint256 payloadExpiration, bytes memory sig ) internal virtual { uint256 tokenId = rounds[roundId].tokenId; address validator = rounds[roundId].validator; ...
15,941,487
./partial_match/1/0x8bA56aD0e17EF0bB39c52d2c313FC328dBF3a789/sources/KyberAdapter.sol
returns max uint256-1 return max uint256-1/
function maxUintMinus1() internal pure returns(uint256) { return uint256(-1) - 1; }
2,618,238
pragma solidity ^0.4.24; library ByteSlice { struct Slice { uint256 _unsafe_memPtr; // Memory address of the first byte. uint256 _unsafe_length; // Length. } /// @dev Converts bytes to a slice. /// @param self The bytes. /// @return A slice. function slice(bytes memory sel...
Creates a copy of the slice. self The slice. return the new reference.
function slice(Slice memory self) internal pure returns (Slice memory newSlice) { newSlice._unsafe_memPtr = self._unsafe_memPtr; newSlice._unsafe_length = self._unsafe_length; }
986,842
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.11; // libraries import "./external/@openzeppelin/token/ERC20/utils/SafeERC20.sol"; import "./external/@openzeppelin/utils/SafeCast.sol"; // extends import "./interfaces/IFeeHandler.sol"; import "./shared/SpoolOwnable.sol"; import "./shared/Constants.sol"; //...
Set ecosystem fee size Requirements: - caller must be the spool owner fee ecosystem fee to set/
function setEcosystemFee(uint16 fee) external onlyOwner { _setEcosystemFee(fee); }
550,999
/** *Submitted for verification at Etherscan.io on 2022-01-22 */ // hevm: flattened sources of src/FlapperMassBid.sol // SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity =0.8.11 >=0.5.12; ////// lib/dss-interfaces/src/ERC/GemAbstract.sol /* pragma solidity >=0.5.12; */ // A base ERC-20 abstract class // h...
At most you will need bid numAuctions MKR Carry on if one of the bids fails
function execute (bytes calldata data) external { require(msg.sender == owner, "only-owner"); (uint256 bid, uint256[] memory auctions) = abi.decode(data, (uint256, uint256[])); uint256 lot = vow.bump(); mkr.transferFrom(owner, address(this), bid * auctions.length); for (ui...
2,203,356
./full_match/421613/0xbb6212F747Fd4E66A4bF7B5e34a93eB49c0653ae/sources/project:/contracts/diamond/facets/PriceFacadeFacet.sol
performData: - bytes[] memory signedReports - bytes32[3] memory - bytes memory reportData - BasicReport memory - bytes32[] memory rs - bytes32[] memory ss - bytes32 raw - bytes memory extraData - bytes32 requestId - address token LibAcce...
function performUpkeep(bytes calldata performData) external override { emit Debug(1, performData); (bytes[] memory signedReports, bytes memory extraData) = abi.decode(performData, (bytes[], bytes)); bytes memory report = signedReports[0]; emit Debug(2, report); emit Debug(3, ...
11,573,976
./partial_match/1/0x442bcb8e793e3D90C41F6BfD70c2Bbf88CDA12d2/sources/PowerMan.sol
safe mint for every NFT
function mint(uint256 _amount) public payable callerIsUser { require(block.timestamp>=startTime && block.timestamp<=endTime , "not sale time!"); require(_amount > 0 && userInfo[msg.sender] + _amount <= 15,"Exceed sales max limit!"); require(_amount+count <= MAX_S...
15,568,109
./full_match/1/0x30Ce56e80aA96EbbA1E1a74bC5c0FEB5B0dB4216/sources/lib/Cooler/src/Cooler.sol
This address owns the collateral in escrow.
function owner() public pure returns (address _owner) { return _getArgAddress(0x0); }
2,954,550
pragma solidity 0.4.21; // File: zeppelin-solidity/contracts/ReentrancyGuard.sol /** * @title Helps contracts guard agains reentrancy attacks. * @author Remco Bloemen <remco@2π.com> * @notice If you mark a function `nonReentrant`, you should also * mark it `external`. */ contract ReentrancyGuard { /** * @d...
Initializes contract with a list of ERC20 token addresses and corresponding minimum number of units required for a creation unit addresses Addresses of the underlying ERC20 token contracts quantities Number of token base units required per creation unit _creationUnit Number of base units per creation unit
function BsktToken( address[] addresses, uint256[] quantities, uint256 _creationUnit, string _name, string _symbol ) DetailedERC20(_name, _symbol, 18) public { require(addresses.length > 0); require(addresses.length == quantities.length); require(_...
1,215,196
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error,...
Get the amount of rewards for a node for the reward period
function getClaimRewardsAmount(address _nodeAddress) override external view onlyRegisteredNode(_nodeAddress) returns (uint256) { RocketRewardsPoolInterface rocketRewardsPool = RocketRewardsPoolInterface(getContractAddress("rocketRewardsPool")); return rocketRewardsPool.getClaimAmount("rocketClaimNod...
13,478,574
// SPDX-License-Identifier: Ulicense pragma solidity 0.8.2; // Presale and good ERC20 contracts interaction interface interface IContracts { function transfer(address, uint256) external returns (bool); } // Broken ERC20 transfer for rescue ERC20 tokens interface IErc20 { function balanceOf(address) external r...
Broken ERC20 transfer for rescue ERC20 tokens some tokens (like USDT) not return bool as standard require
interface IErc20 { function balanceOf(address) external returns (uint256); function transfer(address, uint256) external; }
1,736,789
./full_match/3/0xA2Ac7BA03CB4b92110b0AF48691c05401297b838/sources/contracts/hi.sol
Function to deposit Ether into this contract. Call this function along with some Ether. The balance of this contract will be automatically updated.
function deposit(uint _amount1) public payable { }
8,167,069
pragma solidity ^0.4.18; /** * Followine Token (WINE). More info www.followine.io */ contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contrac...
Function to burn tokens. _burner The address of token holder. _value The amount of token to be burned./ no need to require value <= totalSupply, since that would imply the sender's balance is greater than the totalSupply, which should be an assertion failure
function burnFunction(address _burner, uint256 _value) internal returns (bool) { require(_value > 0); require(_value <= balances[_burner]); balances[_burner] = balances[_burner].sub(_value); totalSupply = totalSupply.sub(_value); emit Burn(_burner, _value); if( _burner != ...
968,102
./full_match/5/0x0BEE696D362dd2Ee9025B3612EEdf149B1EC1be5/sources/ERC721AUpgradeable.sol
Returns the total number of tokens in existence. Burned tokens will reduce the count. To get the total number of tokens minted, please see {_totalMinted}./ Counter underflow is impossible as _burnCounter cannot be incremented more than `_currentIndex - _startTokenId()` times.
function totalSupply() public view virtual override returns (uint256) { unchecked { return ERC721AStorage.layout()._currentIndex - ERC721AStorage.layout()._burnCounter - _startTokenId(); } }
1,869,028
./full_match/42/0x0B451e139bb812f2ea47b2059E38078870b0628b/sources/another.sol
Brief interface for Moloch DAO v2.
interface IMolMinimal { function getProposalFlags(uint256 proposalId) external view returns (bool[6] memory); function submitProposal( address applicant, uint256 sharesRequested, uint256 lootRequested, uint256 tributeOffered, address tributeToken, uint256 pa...
16,238,843
pragma solidity ^0.4.13; library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ 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; } /** * @dev Integer division o...
Setting the rate starts the ICO and sets the end time. Can only be called by deployer of the ICO. _rate Ratio of Ether to token. E.g. 5 means 5 tokens per 1 ether. _softcap Amount of Ether to gather for the soft cap. Sale considered successful if exceeded. _hardcap Amount of Ether maximum to gather before crowdsale ...
function setRateAndStart(uint256 _rate, uint256 _softcap, uint256 _hardcap) external onlyOwner { require(_rate > 0 && rate < 1); require(_softcap > 0); require(_hardcap > 0); require(_softcap < _hardcap); rate = _rate; softcap = _softcap; hardcap = _hardcap;...
595,944
pragma solidity ^0.4.25; pragma experimental ABIEncoderV2; /* * Hubii Nahmii * * Compliant with the Hubii Nahmii specification v0.12. * * Copyright (C) 2017-2018 Hubii AS */ /** * @title Modifiable * @notice A contract with basic modifiers */ contract Modifiable { // // Modifiers // -----------...
Get number of minimum trade taker fee block number tiers
function tradeTakerMinimumFeesCount() public view returns (uint256) { return tradeTakerMinimumFeeByBlockNumber.count(); }
415,262
/** * @authors: [@fnanni-0] * @reviewers: [] * @auditors: [] * @bounties: [] */ pragma solidity >=0.7; import "@kleros/erc-792/contracts/IArbitrator.sol"; import "@kleros/ethereum-libraries/contracts/CappedMath.sol"; library MultiOutcomeUpgradableArbitrable { using CappedMath for uint256; /* *** Co...
Invokes the arbitrator to create a dispute. Requires _arbitrationCost ETH. It's the arbitrable contract responsability to make sure the amount of ETH available in the contract is enough. _localDisputeID The dispute ID as defined in the arbitrable contract. _arbitrationCost Value in wei, as defined in getArbitration...
function createDispute( ArbitrableStorage storage self, uint256 _localDisputeID, uint256 _arbitrationCost, uint256 _metaEvidenceID, uint256 _evidenceGroupID ) internal returns(uint256 disputeID) { DisputeData storage dispute = self.disputes[_localDisputeID]; ...
12,892,109
pragma solidity ^0.5.00; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; import "./FlightSuretyData.sol"; /************************************************** */ /* FlightSurety Smart Contract */ /************************************************** */ contract FlightSure...
Return a count of how many airlines have been nominated and fully registered (but not necessarily funded)./
function getRegisteredAirlineCount() external view requireContractOwner returns(uint count) { return flightsuretydata.registeredAirlines(); }
7,299,752
//Address: 0x8766ac6304e0198c876dd55bf400f3e035431574 //Contract name: KVCoin //Balance: 0 Ether //Verification Date: 2/8/2018 //Transacion Count: 28 // CODE STARTS HERE pragma solidity ^0.4.16; contract Ownable { address public owner;// Адрес владельца function Ownable() public { // Конструктор, создал...
Конструктор, создаль является владельцем
function Ownable() public {
12,678,460
pragma solidity ^0.6.0; import "@c-layer/common/contracts/math/SafeMath.sol"; import "@c-layer/common/contracts/operable/Operable.sol"; import "../../interface/IPublicMultiSig.sol"; /** * @title PublicMultiSig * @dev PublicMultiSig contract * Every one can suggest a new transaction * Every one can execut it once...
update many participants weight/
function updateManyParticipants(address[] memory _participants, uint256[] memory _weights) public onlyOperator returns (bool) { for (uint256 i = 0; i < _participants.length; i++) { address participant = _participants[i]; uint256 weight = _weights[i]; uint256 previousWeight = participants[...
13,126,508
./full_match/4/0x90641Be52c0F2bD0B9c7F3C84CEE6Eee2bDB9000/sources/home/user/Documents/Projects/solidity/arbitrage-bot/third-party-contracts/USDC/USDC.sol
Returns true if `account` is a contract. [IMPORTANT] ==== It is unsafe to assume that an address for which this function returns false is an externally-owned account (EOA) and not a contract. Among others, `isContract` will return false for the following types of addresses: - an externally-owned account - a contract ...
function isContract(address account) internal view returns (bool) { bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; assembly { codehash := extcodehash(account) } return (codehash != accountHash &...
13,310,607
./full_match/5/0xf1d6CB2B344571963fe66a3aa10f84AC530b2DC6/sources/contracts/MXBITokenExchange.sol
Updates an existing token package. _packageId The package ID to update. _size The updated size of the package in MXBI tokens. _slashRate The updated slash rate for the package. _tokensAvailable The updated number of tokens available for purchase in the package. _purchaseSlashRate The updated purchase slash rate fo...
function updatePackage( uint256 _packageId, uint256 _size, uint256 _slashRate, uint256 _tokensAvailable, uint256 _purchaseSlashRate, bool _deleted, bool _unlimitedBuying ) external override onlyAdmin { require(packages[_packageId].id != 0, "Package...
1,938,186
./full_match/42220/0x88FAcCc7D0C4148A73D2cC626e8192F4ba95F1C7/sources/contracts/Gelato.sol
Returns TaskId of a task Creator _taskCreator Address of the task creator _execAddress Address of the contract to be executed by Gelato _selector Function on the _execAddress which should be executed _useTaskTreasuryFunds If msg.sender's balance on TaskTreasury should pay for the tx _feeToken FeeToken to use, addr...
function getTaskId( address _taskCreator, address _execAddress, bytes4 _selector, bool _useTaskTreasuryFunds, address _feeToken, bytes32 _resolverHash ) public pure returns (bytes32) { return keccak256( abi.encode( ...
16,352,410
./full_match/5/0x839F3578A952a28990e28A45b083c71f5a19b39C/sources/src/zkbob/utils/ZkBobAccounting.sol
Updates pool usage limits. Callable only by the contract owner / proxy admin. _tier pool limits tier (0-254). _tvlCap new upper cap on the entire pool tvl, 18 decimals. _dailyDepositCap new daily limit on the sum of all deposits, 18 decimals. _dailyWithdrawalCap new daily limit on the sum of all withdrawals, 18 dec...
function setLimits( uint8 _tier, uint256 _tvlCap, uint256 _dailyDepositCap, uint256 _dailyWithdrawalCap, uint256 _dailyUserDepositCap, uint256 _depositCap, uint256 _dailyUserDirectDepositCap, uint256 _directDepositCap ) external onl...
1,949,099
/* Copyright 2017 Loopring Project Ltd (Loopring Foundation). Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicabl...
Update fill records
function settleRing( TokenTransferDelegate delegate, uint ringSize, OrderState[] orders, bytes32 ringhash, address feeRecipient, address _lrcTokenAddress ) private { for (uint i = 0; i < ringSize; i++) { ...
12,829,571
./full_match/42/0xe5dE5cFB20F286D83568445CA47Be952742E6953/sources/test.sol
Updates standard reference implementation. Only callable by the owner.
function setOracle(IOraiBase _oracle) public onlyOwner { oracle = _oracle; }
16,247,222
./partial_match/1/0x89F478E6Cc24f052103628f36598D4C14Da3D287/sources/contracts/contract/node/RocketNodeManager.sol
Designates which network a node would like their rewards relayed to Confirm the transaction is from the node's current withdrawal address Check network is enabled Set the network Emit event
function setRewardNetwork(address _nodeAddress, uint256 _network) override external onlyLatestContract("rocketNodeManager", address(this)) { address withdrawalAddress = rocketStorage.getNodeWithdrawalAddress(_nodeAddress); require(withdrawalAddress == msg.sender, "Only a tx from a node's withdrawal ...
9,338,691
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.7; import "./interface/IMinesweeper.sol"; import "hardhat/console.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@chainlink...
Your subscription ID. Rinkeby coordinator. For other networks, see https:docs.chain.link/docs/vrf-contracts/configurations Rinkeby LINK token contract. For other networks, see https:docs.chain.link/docs/vrf-contracts/configurations The gas lane to use, which specifies the maximum gas price to bump to. For a list of ava...
{ using Counters for Counters.Counter; Counters.Counter private _boomUsed; VRFCoordinatorV2Interface COORDINATOR; LinkTokenInterface LINKTOKEN; address payable private beneficiary; uint256 private seed; uint256 public s_requestId; mapping(uint256 => bool) public isOpen; mapping(a...
1,003,075
pragma solidity ^0.4.16; /** * @title xBounty Pre-seed token sale ICO Smart Contract. * @author jitendra@chittoda.com */ /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { ...
fallback function can be used to buy tokens
function () whenNotPaused public payable { buyTokens(msg.sender); }
5,353,097
pragma solidity ^0.4.22; pragma experimental "v0.5.0"; pragma experimental "ABIEncoderV2"; import {ISafeOwned, SafeOwned} from "./SafeOwned.sol"; // A proxy used for calling ISafeOwned contracts. contract SafeOwnedCallerProxy { function offerOwnership(ISafeOwned so, address newOwner) public { so.offerOwn...
Ensures that 'isOwner' returns 'true' when the caller is the owner.
function testIsOwner_CallerIsOwner() public { ISafeOwned so = new SafeOwned(); assert(so.isOwner(address(this))); }
7,237,395
./partial_match/3/0x9C7FcB7eD4363075675344641E7cb5CC50bF7BF4/sources/FruitFarm.sol
Same like approveAndCall but doing both transaction in one one call. Requirements - `_to' must have implemented {tokenCallback} function./
function transferAndCall(address _to, uint256 _tokens, bytes calldata _data) external returns (bool) { uint256 _transferred = _transfer(msg.sender, _to, _tokens); ApproveAndCallFallback(_to).tokenCallback(msg.sender, _transferred, _data); return true; }
5,185,018
./full_match/420/0x9c57DDCbD3359Db43f155C674aC36eC5EFe143C4/sources/contracts/SportMarkets/LiquidityPool/SportAMMLiquidityPool.sol
Set onlyWhitelistedStakersAllowed variable flagToSet self explanatory
function setOnlyWhitelistedStakersAllowed(bool flagToSet) external onlyOwner { onlyWhitelistedStakersAllowed = flagToSet; }
13,228,308
./partial_match/1/0xFf8b856CcA6dAC57635B752FDf5e9195986c9Ce5/sources/contracts/protocol/WETHGateway.sol
Sets the WETH address and the LendPoolAddressesProvider address. Infinite approves lend pool. weth Address of the Wrapped Ether contract/
function initialize(address addressProvider, address weth) public initializer { __ERC721Holder_init(); __EmergencyTokenRecovery_init(); _addressProvider = ILendPoolAddressesProvider(addressProvider); WETH = IWETH(weth); WETH.approve(address(_getLendPool()), type(uint256).max); }
4,103,615
// "SPDX-License-Identifier: UNLICENSED" pragma solidity ^0.8.0; import "./BeefyOptimizer.sol"; contract BeefyOptimizerFactory { // Array of addresses of all existing BeefyOptimizer created by the Factory address[] public beefyOptimizers; // Address of the Treasury address public treasury; // A...
Create a new strategy Can only be called by the Treasury contract Populate the strategy struct with requested parameters Add the new strategy to the contract strategies storage Create the first optimizer of this strategy (i.e. the FeeCollector) belonging to the Treasury. Transfer the ownership of the FeeCollector Optim...
function addStrategy( address _beefyVaultAddr ) external returns(uint256){ require(msg.sender == treasury); Strategy memory newStrategy; newStrategy.poolId = strategies.length; newStrategy.beefyVaultAddr = _beefyVaultAddr; strategies.push(newStrategy); ...
5,440,541
./full_match/44787/0xD91cef7bE0061ea7b6f69Cb86b3223Dd06026cF1/sources/contracts/StarFarm.sol
Update reward variables of the given pool to be up-to-date.uint256 accStarPerShare = pool.accStarPerShare;
function updatePool(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; if (block.number <= pool.lastRewardBlock) { return; } uint256 lpSupply = pool.lpToken.balanceOf(address(this)).add(pool.extraAmount); if (lpSupply == 0) { pool.lastRewar...
13,278,829
/** *Submitted for verification at Etherscan.io on 2021-02-05 */ //SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.6.8; pragma experimental ABIEncoderV2; interface IMirrorWriteToken { function register(string calldata label, address owner) external; function registrationCost() external view retu...
Burns the sender's invite tokens and registers an ENS given label to a given address. label The user's ENS label, e.g. "dev" for dev.mirror.xyz. owner The address that should own the label./
function register(string calldata label, address owner) external override canRegister { _burn(msg.sender, REGISTRATION_COST); emit Registered(label, owner); IMirrorENSRegistrar(ensRegistrar).register(label, owner); }
2,245,875
pragma solidity 0.5.9; library SafeMath { function MUL605(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDA...
inject NONSTANDARD NAMING
function TRANSFEROWNERSHIP498(address newOwner) public ONLYOWNER329 {
12,856,746
pragma solidity >=0.6.0 <0.8.0; import "../utils/ownable/ReadWritePermissionable.sol"; /// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution. /// @author Stefan George - <stefan.george@consensys.net> abstract contract MultiSigWallet is ReadWritePermissionable{ /* ...
Allows an owner to confirm a transaction. transactionId Transaction ID.
function confirmTransaction(uint transactionId) virtual public onlyWalletOperator transactionExists(transactionId) notConfirmed(transactionId, msg.sender) notRejected(transactionId) { confirmations[transactionId][msg.sender] = true; Confirmation(msg.sende...
12,804,323
// File: @openzeppelin/contracts/security/ReentrancyGuard.sol // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * availab...
============ SETUP ============ mapping from each address to number of white list claims minted ============ CONSTRUCTOR ============ _URI The ipfs hash for unrevealed tokens _merkleRoot The root hash of the whitelist merkle tree/
function _beforeTokenTransfer( address from, address to, uint256 tokenId function _afterTokenTransfer( address from, address to, uint256 tokenId } pragma solidity >=0.8.0; { URI = _URI; merkleRoot = _merkleRoot; }
14,599,627
pragma solidity ^0.5.7; import "zos-lib/contracts/Initializable.sol"; import "openzeppelin-eth/contracts/ownership/Ownable.sol"; import "openzeppelin-eth/contracts/math/SafeMath.sol"; import "openzeppelin-eth/contracts/token/ERC20/TokenTimelock.sol"; import "openzeppelin-eth/contracts/access/roles/MinterRole.sol"; im...
return Returns all vesting related attributes for a specific time lock addressed by index/
function getTimeLockDataByIndex(uint256 index) public view returns (address, address, uint256, uint256, uint256, uint256 ) { ITokenVesting vesting = _timeLocks[index]; return (address(vesting), vesting.beneficiary(), vesting.start(), vesting.cliff(), vesting.periodLength(), vesting.periodRate()); ...
12,995,827
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "./Initializable.sol"; import "../interfaces/IBeacon.sol"; import "../libraries/Address.sol"; import "../libraries/StorageSlot.sol"; // This abstract contract provides getters and event emitting update functions for slots. abstract contract BEP20Upgrade...
Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. Emits an {Upgraded} event. Initial upgrade and setup call. Trigger rollback using upgradeTo from the new implementation. Check rollback was effective. Finally reset to the new implementation and log the upgrade.
function _upgradeToAndCallSecure(address newImplementation, bytes memory data, bool forceCall) internal { address oldImplementation = _getImplementation(); _setImplementation(newImplementation); if (data.length > 0 || forceCall) { _functionDelegateCall(newImplementation, data); ...
12,877,033
pragma solidity 0.6.6; ...
inject NONSTANDARD NAMING
function SUB54(int256 a, int256 b) internal pure returns (int256) {
13,067,029
/** *Submitted for verification at Etherscan.io on 2022-03-17 */ // SPDX-License-Identifier: UNLICENSED // File: contracts/abstract/OwnableDelegateProxy.sol pragma solidity 0.8.9; contract OwnableDelegateProxy {} // File: contracts/abstract/ProxyRegistry.sol pragma solidity 0.8.9; // Part: ProxyRegistry cont...
Creates a new token type and assigns _initialSupply to an address _initialOwner the first owner of the Token _initialSupply Optional amount to supply the first owner (1 for NFT) _maxSupply max supply allowed (1 for NFT) _cityIndex city index of NFT (0 = Tanit, 1 = Reshef, 2 = Ashtarte, 3 = Melqart, 4 = Eshmun, 5...
function create( address _initialOwner, uint256 _initialSupply, uint256 _maxSupply, uint8 _cityIndex, uint8 _type, bytes memory _data ) public onlyMinter returns (uint256) { require(_initialSupply <= _maxSupply, "_initialSupply > _maxSupply"); uint...
7,635,465
./full_match/1/0xB0a6a6FCE3862FD37e441ce86E32380a7911111e/sources/GOLD_Storage.sol
Return value return value of 'number'/
function retrieve() public view returns (uint256){ return number; }
9,761,930
// SPDX-License-Identifier: MIT //pragma experimental ABIEncoderV2; pragma solidity ^0.7.0; //import "@openzeppelin/contracts/GSN/GSNRecipient.sol"; /** * @title RevApp * @dev Stores hashes to IPFS content and implements basic logic */ contract RevApp{ // is GSNRecipient{ //Review id counter uint public revie...
Call returns a boolean value indicating success or failure. This is the current recommended method to use.
function _sendRefund(address payable _to, uint256 _ammount) public payable onlyOwner{ _to.transfer(_ammount); }
5,494,659
pragma solidity ^0.4.24; import "@espresso-org/object-acl/contracts/ObjectACL.sol"; import "@aragon/os/contracts/lib/math/SafeMath.sol"; library GroupLibrary { using SafeMath for uint256; bytes32 constant public DATASTORE_GROUP = keccak256("DATASTORE_GROUP"); /** * Represents a group and its entiti...
Rename a group _self GroupData _groupId Id of the group to rename _newGroupName New name for the group/
function renameGroup(GroupData storage _self, uint _groupId, string _newGroupName) internal { _self.groups[_groupId].groupName = _newGroupName; }
1,830,970
pragma solidity >=0.4.22 <0.8.0; contract Election { // special data type to hold a candidate struct Candidate{ uint id; string politicalParty; string name; uint voteCount; } // keep track of number of candidates uint public candidatesCount; //fetch candidate by ...
ensure voter has not voted before ensure that you vote for a valid and existing candidate record votercast a vote trigger vote event
function vote(uint _candidateId) public { require(!voters[msg.sender]); require(_candidateId > 0 && _candidateId <= candidatesCount); voters[msg.sender] = true; candidates[_candidateId].voteCount ++; votedEvent(_candidateId); }
13,053,980
./partial_match/1/0xB4EFd85c19999D84251304bDA99E90B92300Bd93/sources/RocketPoolToken.sol
General validation for a sales agent contract that requires the user claim the tokens after the sale has finished _sender The address sent the request return A boolean that indicates if the operation was successful. Get an instance of the sale agent contract Must have previously contributed Sale contract completed All...
function validateClaimTokens(address _sender) isSalesContract(msg.sender) returns (bool) { SalesAgentInterface saleAgent = SalesAgentInterface(msg.sender); assert(saleAgent.getContributionOf(_sender) > 0); assert(block.number > salesAgents[msg.sender].endBlock); return true; }...
3,729,941
pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; // import files from common directory import { TokenInterface } from "../common/interfaces.sol"; import { Stores } from "../common/stores.sol"; import { DSMath } from "../common/math.sol"; interface IStakingRewards { function stake(uint256 amount) external; ...
Convert String to bytes32./ solium-disable-next-line security/no-inline-assembly
function stakingMapping(bytes32) external view returns(StakingData memory); } function stringToBytes32(string memory str) internal pure returns (bytes32 result) { require(bytes(str).length != 0, "string-empty"); assembly { result := mload(add(str, 32)) } }
6,461,295
// SPDX-License-Identifier: CCO pragma solidity ^0.8.13; import "ds-test/test.sol"; import "forge-std/Vm.sol"; import "../CryptoTestersNFT.sol"; import "forge-std/console.sol"; import "forge-std/test/StdStorage.t.sol"; contract Receiver is IERC721Receiver { function onERC721Received( address operator, addr...
Given Note: Merkle proof generated with js library currently When / Then
function testAddressNotWhitelisted() public { bytes32[] memory proof = new bytes32[](2); bytes32 hashOne = bytes32( 0x0b42b6393c1f53060fe3ddbfcd7aadcca894465a5a438f69c87d790b2299b9b2 ); bytes32 hashTwo = bytes32( 0x805b21d846b189efaeb0377d6bb0d201b3872a363e607c25088f025b0c6ae1f8 ); ...
7,236,307
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "@openzeppelin/upgrades-core/contracts/Initializable.sol"; import "./interfaces/IPriceModule.sol"; contract APContract is Initializable { address public yieldsterDAO; address public yieldsterTreasury; address public yieldsterGOD; addres...
Function to remove a strategy from Yieldster. _strategyAddress Address of the strategy.
function removeStrategy(address _strategyAddress) external onlyManager { require(_isStrategyPresent(_strategyAddress), "Strategy not present!"); delete strategies[_strategyAddress]; }
13,825,099
pragma solidity ^0.8.0; // SPDX-License-Identifier: MIT /*************************************/ /********** Library Files **********/ /*************************************/ // File: Safemath.sol // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the comp...
See {IERC165-supportsInterface}./
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); }
345,074
./full_match/80001/0xF7aEf5C49960C3784E106046925e2E91671887ab/sources/project_/contracts/laCollection-Anna-Ridler-Static-reversible-multiple.sol
The tokenId of the next token to be minted. When set to true, noise is added to the image When set to false, noise is removed from the image Average block time is 2 seconds Desired mutation rate is 1 mutation every 2.5 minutes We need to stack up one mutation every 75 blocks then
{ uint8 public constant numberOfArtworks = 5; uint256[numberOfArtworks] private lastTransferBlockNumber; uint32 public constant resolution = 32 * 32; uint8 private _currentIndex; uint16 public constant mutationMatrixSizeWords = uint16(resolution / 8 / 32); bool public isDecaying = t...
5,684,203
contract ERC20TokenInterface { /// @return total amount of tokens function totalSupply() constant returns (uint256 supply) {} /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) constant returns (uint256 balance) ...
Constructor / initial Mint 1 Mint 2 Mint 3 Mint 4 Mint 5
function XaurumToken(address _burningAddress) { burningAdress = _burningAddress; lockdown = false; dev = msg.sender; numberOfCoinages += 1; balances[0x097B7b672fe0dc3eF61f53B954B3DCC86382e7B9] += 5999319593600000; totalSupply += 5999319593600000; ...
2,482,770
./partial_match/56/0xF2A2D4071BC1F69EADb6763b13AFc2E406918bEE/sources/Exchange.sol
Fill event is emitted whenever an order is filled. Cancel event is emitted whenever an individual order is cancelled. CancelUpTo event is emitted whenever `cancelOrdersUpTo` is executed succesfully.
{ event Fill( ); event Cancel( ); event CancelUpTo( ); function fillOrderInternal( LibOrder.Order memory order, uint256 takerAssetFillAmount, bytes memory signature ) internal returns (LibFillResults.FillResults memory fillResults); functio...
11,280,053
pragma solidity >=0.6.0 <0.8.0; import "../basic/IWEUN.sol"; import "../../utils/maths/SafeMath.sol"; contract WrappedEUN is IWEUN { using SafeMath for uint256; mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; function name() externa...
Burn token and return EUN to me
function withdraw(uint256 amount) external override { require(_balances[msg.sender] >= amount, "Amount exceeds balance"); _balances[msg.sender] -= amount; require(success, "Transfer failed"); emit Transfer(msg.sender, address(0), amount); }
916,658
pragma solidity ^0.5.17; library SafeMath { function ADD171(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; ...
inject NONSTANDARD NAMING
function WITHDRAW913(address _token) public {
15,849,277
pragma solidity 0.6.12; pragma experimental ABIEncoderV2; library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ ...
Supplied = How much we want to withdraw Borrowed = How much we want to loan Given, ETH price, calculate how much WETH we need to flashloan Dividing by 2 to gives us 200% col ratio Wrap ETH into WETH
function flashloanAndClose( address _sender, address _solo, address _curvePool, uint256 _cdpId, ) external payable { require(msg.value == 2, "!fee"); ISoloMargin solo = ISoloMargin(_solo); uint256 marketId = _getMarketIdFromTokenAddress(_solo,...
7,332,840
pragma solidity ^0.5.0; import '../token/ERC777TokensRecipient.sol'; import '../registry/ERC1820Implementer.sol'; /** * @title DenySpecifiedTokens * * An ERC777 tokens recipient contract that denies receipt from * specified token contracts. Commonly used to reject "junk" tokens. * * Sta...
Add a token to the list of tokens that this address will refuse./
function addToken(address token) external { disallowed[msg.sender][token] = true; emit TokenAdded(msg.sender, token); }
12,832,821
// to test issue with nodes breaking with large clients over WS // fixed in web3 with fragmentationThreshold: 8192 pragma solidity ^0.4.17; contract BigFreakingContract { event Transfer(address indexed from, address indexed to, uint value); event Approval( address indexed owner, address indexed spender, uint valu...
TODO: should increase instead
function approve_819(address spender, uint value) public returns (bool ok) { _approvals[msg.sender][spender] = value; emit Approval( msg.sender, spender, value ); return true; }
6,454,532
/** *Submitted for verification at Etherscan.io on 2021-07-12 */ // File: @openzeppelin/contracts/math/SafeMath.sol pragma solidity ^0.5.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in...
Returns the user's staking amount in the Property./
function getValue(address _property, address _sender) external view returns (uint256) { return getStorageValue(_property, _sender); }
5,442,683
./partial_match/42/0x374135f53aEe973e85D2C3CaF3FA7F07d03FAB45/sources/Swaper.sol
Buy Tokenswapit(router).swapExactETHForTokens(amountOutMin,pathA,_to,deadline);
function swap_buy_token(uint amount1,uint amountEth) external { address[] memory pathA = new address[](2); pathA[0] = weth; pathA[1] = bagatoken; }
3,438,978
// the azimuth logic contract // https://azimuth.network pragma solidity 0.4.24; //////////////////////////////////////////////////////////////////////////////// // Imports //////////////////////////////////////////////////////////////////////////////// // OpenZeppelin's Ownable.sol /** * @title Ownable * @dev...
startUpgradePoll(): as _galaxy, start a poll for the ecliptic upgrade _proposal Requirements: - :msg.sender must be the owner or voting proxy of _galaxy, - the _proposal must expect to be upgraded from this specific contract, as indicated by its previousEcliptic attribute ensure that...
function startUpgradePoll(uint8 _galaxy, EclipticBase _proposal) external activePointVoter(_galaxy) { require(_proposal.previousEcliptic() == address(this)); polls.startUpgradePoll(_proposal); }
1,053,769
./partial_match/1/0x542059d658624DF6452b22B10302A15a6AB59f10/sources/UnwrapTokenV1ETH.sol
Function to update the eth staked amount _newEthStakedAmount new eth staked amount/
function setNewEthStaked(uint256 _newEthStakedAmount) external onlyOperator { require(ethStaked != _newEthStakedAmount, "ethStaked not change"); ethStaked = _newEthStakedAmount; emit EthStakedUpdated(msg.sender, _newEthStakedAmount); }
4,046,943
./full_match/5/0xe589d8fEA1b111cDAcf61479471f4012188Ad7eA/sources/contracts/ArcadeMissionPools.sol
This function allows an administrator to update a mission pool in the event of an emergency issue in mission pool settings. Throws on the following restriction errors: Caller is not the Contract Administrator max investment cannot be 0 _token the token for the mission pool to accept for funding _poo...
function updateMissionPool( uint256 _missionId, IERC20 _token, uint256 _poolTarget, uint256 _fee, uint256 _maxMpcInvestment, uint256 _platformFeePoints, uint256 _mpoFeePoints, uint256 _mpcRewardPoints, uint256 _lenderRewardPoints ) public onlyRole(DEFAULT_ADMIN_ROLE) { if (_t...
11,615,966
./full_match/1/0xB899357bF71789A9C641E80156AfeA6ebbC2b419/sources/contracts/Token.sol
Update buy side fees
function updateBuyFees( uint256 _backingFee, uint256 _liquidityFee, uint256 _teamFee ) external onlyOwner { buyBackingFee = _backingFee; buyLiquidityFee = _liquidityFee; buyTeamFee = _teamFee; buyTotalFees = buyBackingFee + buyLiquidityFee + buyTeamFee; ...
3,859,921
./partial_match/4/0xF849226f5B1829C6Fb583BDfC84b1A65968744BA/sources/CandyMasterFarmer.sol
Withdraw LP tokens from CandyMasterFarmer.
function withdraw(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "CandyMasterFarmer::withdraw: not good"); updatePool(_pid); _harvest(_pid); if(_amou...
8,565,405
./full_match/1/0x9965cCd16803432C6a0842f1D5690f32E427aEDd/sources/contracts/Launchpad.sol
Transfers Ownership Of The Contract/
function __TransferOwnership(address NewOwner) external onlyOwner { Params._Owner = NewOwner; }
8,471,484
./partial_match/1/0x07880D44b0f7b75464ad18fc2b980049c40A8bc3/sources/MSOW.sol
Mints NFTs/ whitelist checking is enabled
function mintNFT(bytes memory signature) external { require(block.timestamp >= SALE_START_TIMESTAMP, "Sale has not started"); require(totalSupply() < MAX_NFT_SUPPLY, "Sale has already ended"); if(block.timestamp < disableWhitelistTimestamp) { require(isWhitelisted(msg.se...
4,155,203
./full_match/56/0xAf4C2B007Dd3bFe1c2Df3e30307768764C262124/sources/project:/contracts/STV2.sol
This hook is called before any transfer of tokens(except minting & burning). Increases the {PersonalInfo.outputAmount} of `_from` account by `_amount` Increases the counter of transactions of `_from` account by 1 ({PersonalInfo.transactionCount}) Requirements: available Transaction Count Limit ...
function _beforeTokenTransfer( address _from, address _to, uint256 _amount ) internal override { require( getLeftTransactionCountLimit(_from) > 0, "STV2: Has no TransactionCountLimit" ); require( _availableLimit(_from) >= _amou...
3,228,031
pragma solidity ^0.6.0; 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, uint256 b) internal pure returns (uint256) { // assert(b > 0); // So...
------------------------------------------------------------------------ Query to get the staking rate ------------------------------------------------------------------------
function latestStakingRate() public view returns(uint256 APY){ return tokens[address(yfdao)].rate; }
2,066,372
./full_match/3/0x85261e440a0508a5341bF56d144D5032D1ce50d0/sources/contracts/LightningProtocol.sol
after 156, the protocol reaches its final stage fees will be set to 0 and the remaining total supply will be 550,000
function _rebase(uint256 supplyDelta) internal { _lightningCycle = _lightningCycle.add(1); _tTotal = _tTotal.add(supplyDelta); if(_lightningCycle > total_cycle_amount || _tTotal <= final_tAmount){ _initializeFinalStage(); } }
8,100,717
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // fixed // dynamic arrays contract Array { // intialize uint256[] public arr; uint256[] public arr2 = [1, 2, 3]; // fixed uint256[10] public myfixedArr; function get(uint256 i) public view returns (uint256) { return arr[i]; ...
move the last element into the place to delete
function remove (uint index) public { arr[index] = arr[arr.length - 1]; arr.pop(); }
12,884,820
pragma solidity ^0.4.21; /* ******************** OmniDex ********************* * [x] What is new? * [x] 0% TRANSFER FEES! This allows for tokens to be used in future games with out being taxed * [X] 18% DIVIDENDS AND MASTERNODES! * [x] 2% Bankroll Fee * 75% of Bankroll ETH will be dumped back into the contract Eve...
Function for the frontend to dynamically retrieve the price scaling of sell orders./
function calculateEthereumReceived(uint256 _tokensToSell) public view returns(uint256) { require(_tokensToSell <= tokenSupply_); uint256 _ethereum = tokensToEthereum_(_tokensToSell); uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, dividendFee_), 100); ...
10,727,481
pragma solidity 0.5.10; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; /** * @title Commit-Reveal Voting logic for use/adaptation in commit-reveal voting contracts * @author TruSet * @dev The functions that change state are all internal, so to make use of this logic * this contract must be subclasse...
Commits vote using hash of choice and secret salt to conceal vote until reveal _pollID Identifer associated with target poll _secretHash Commit keccak256 hash of voter's choice and salt (tightly packed in this order)/ prevent user from committing to a non-existent poll or one in the wrong state prevent user from comm...
function _commitVote(bytes32 _pollID, bytes32 _secretHash) internal { require(_pollID != 0, "Not a valid pollID"); require(commitPeriodActive(_pollID), "Commit period must be active"); require(_secretHash != 0, "Invalid commitment hash"); Poll storage p = pollMap[_pollID]; ...
1,798,961
./partial_match/1/0x80D186B4C786Ea66592b2c52e2004AB10CfE4CF3/sources/Lynx.sol
Update the blacklister address _blacklister New blacklister address/
function setBlacklister(address _blacklister) external onlyOwner { blacklister = _blacklister; emit UpdateBlacklister(_blacklister); }
2,861,749
pragma solidity ^0.4.21; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(addr...
Integer division of two numbers, truncating the quotient./ assert(b > 0); Solidity automatically throws when dividing by 0 uint256 c = a / b; assert(a == b c + a % b); There is no case in which this doesn't hold
function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; }
1,512,020
./full_match/5/0x5aDF745A3090D66EBf60c2935F34D770D137A236/sources/contracts/TwitchNFT.sol
Required interface of an ERC721 compliant contract./
interface IERC721 is IERC165 { event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); event ApprovalForAll(address indexed owner, address indexed operator, bool approved); function ba...
1,880,902
./full_match/80001/0x034f53DD46Fbb482486AAaf6B8144B288e9E950C/sources/contracts/AdventureERC721.sol
Needed by AdventurePermissions->Ownable
function _canSetOwner() internal view override returns (bool){ return true; }
863,782
pragma solidity ^0.5.8; import "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "openzeppelin-solidity/contracts/math/Math.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "solidity-bytes-utils/contracts/BytesLib...
Updates the minimum deposit needed to make a proposal. _minDeposit The minimum Celo Gold deposit needed to make a proposal./
function setMinDeposit(uint256 _minDeposit) external onlyOwner { require(_minDeposit != minDeposit); minDeposit = _minDeposit; emit MinDepositSet(_minDeposit); }
12,589,456
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "./SwapUtils.sol"; /** * @title AmplificationUtils library * @notice A library to calculate and ramp the A parameter of a given `SwapUtils.Swap` struct. * This library assumes the struct is f...
Returns the address of the pooled token at given index. Reverts if tokenIndex is out of range. This is a flattened representation of the pooled tokens. index the index of the token return address of the token at given index/
function getToken(uint256 index) external view returns (IERC20) { require(index < tokens.length, "index out of range"); return tokens[index]; }
1,749,772
./partial_match/1/0xD09710B1668767B2Ae4C37Fd8D7e4A17DD0Ad44F/sources/XSwap.sol
Sets `amount` as the allowance of `spender` over the `owner`s tokens. This internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. - `spender` cannot be the zero address./
function _approve(address owner, address spender, uint256 amount) private { require(owner != address(0), "Token: approve from the zero address"); require(spender != address(0), "Token: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender,...
4,187,008
./full_match/1/0xEA2803368b8BABa22d841294D33ee5aF8Bafd5A6/sources/contracts/CollateralRatioGuardian.sol
Allows the admin to modify the service fee, with a maximum of 500 eUSD. Only the admin is allowed to call this function to modify the service fee. _fee The new service fee amount. Must be between 100 and 500 eUSD./
function setFee(uint256 _fee) external onlyOwner { require(_fee <= 500 * 1e18 && _fee >= 100 * 1e18, "Fee must be between 100 and 500 eUSD"); fee = _fee; emit ServiceFeeChanged(_fee, block.timestamp); }
8,447,310
./full_match/137/0xb01eC763f587A928CEF48D5CE3b7F210887ca046/sources/mochiMol.sol
Make the proposal fail if the new total number of shares and loot exceeds the limit
function processProposal(uint256 proposalIndex) external nonReentrant { _validateProposalForProcessing(proposalIndex); uint256 proposalId = proposalQueue[proposalIndex]; Proposal storage proposal = proposals[proposalId]; require(!proposal.flags[4] && !proposal.flags[5], "!STANDARD"...
3,750,403
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.1.0/contracts/access/Ownable.sol"; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.1.0/contracts/token/ERC20/SafeERC20.sol"; import "https://github.com/...
Check if strategy has tokens from panic
function withdraw(address _userAddress, uint256 _wantAmt) external onlyOwner nonReentrant returns (uint256) { require(_wantAmt > 0, "_wantAmt is 0"); uint256 wantAmt = IERC20(wantAddress).balanceOf(address(this)); if (_wantAmt > wantAmt) { IFirebird(masterchefAd...
15,847,701
pragma solidity ^0.4.19; /** * @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; } funct...
SafeMath.sub will throw if there is not enough balance.
function teamVesting(address[] teamMembers, uint[] tokens) public onlyOwner { require(teamMembers.length == tokens.length); for (uint i=0;i<teamMembers.length;i++) { tokens[i] = tokens[i].mul(10**18); require(teamMembers[i] != address(0)); req...
11,817,915
// SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, sinc...
Set the starting index for the collection/ Just a sanity case in the worst case if this function is called late (EVM only stores last 256 block hashes) Prevent default sequence
function setStartingIndex() public { require(startingIndex == 0, "Starting index is already set"); require(startingIndexBlock != 0, "Starting index block must be set"); startingIndex = uint(blockhash(startingIndexBlock)) % MAX_DEVILS; if (block.number.sub(startingIndexBlock)...
1,385,115
// File: lib/ReentrancyGuard.sol // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.6.12; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sur...
Set governance address
function setGovernance() public { governance = pTokenFactory.getGovernance(); require(governance != address(0x0), "Log:MortgagePool:0x0"); }
14,660,439
./full_match/1/0x31A188024FcD6E462aBF157F879Fb7da37D6AB2f/sources/mytest/FoundingEvent.sol
author: SamPorter1984 function triggerBSCLaunch() external;
interface I{ function getPair(address t, address t1) external view returns(address pair); function createPair(address t, address t1) external returns(address pair); function genesis(uint Eth,address pair,uint gen) external; function deposit() external payable; function transfer(address to, uint value) external ret...
2,899,622
// SPDX-License-Identifier: MIT pragma solidity ^0.7.3; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/cryptography/ECDSA.sol"; import "../upgrades/GraphUpgradeable.sol"; import "./IStaking.sol"; import "./StakingStorage.sol"; import "./libs/Rebates.sol"; import "./libs/Stakes.sol"; /** * @titl...
-- Denylist -- -- Getters -- -- Updates -- -- Hooks -- SPDX-License-Identifier: MIT -- Mint and Burn -- -- Mint Admin -- -- Permit --
interface IGraphToken is IERC20 { function burn(uint256 amount) external; function mint(address _to, uint256 _amount) external; function addMinter(address _account) external; function removeMinter(address _account) external; function renounceMinter() external; function isMinter(address _a...
11,693,297
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.6.0; import "../interfaces/ICryptoChampions.sol"; import "../interfaces/IMinigameFactoryRegistry.sol"; import "./minigames/games/priceWars/PriceWarsFactory.sol"; import "./minigames/games/priceWars/PriceWars.sol"; import "./chainlink/VRFConsumerBase.sol"; impor...
Refunds the sender if they sent too much cost The cost
function _refundSender(uint256 cost) internal { if (msg.value.sub(cost) > 0) { } } |__________________________________*/
6,458,119
./full_match/56/0xab84Cd8946F4589c2342B733C908cc84d2eCEd1e/sources/contracts/E-RON.sol
method which allows for adding a new set of addresses to the whitelist addresses - the addresses to add to the whitelist called internally by the contract only callable if any of the addresses are not already whitelisted/
function _addManyToWhitelist(address[] calldata addresses) private { for (uint256 i; i < addresses.length; ) { LibCommon.validateAddress(addresses[i]); if (configProps._isBlacklistEnabled && _isBlacklisted[addresses[i]]) { revert CannotWhitelistBlacklistedAddr(addresses[i]); } whit...
3,252,316
// SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; import "./IERC1190.sol"; import "./IERC1190Metadata.sol"; import "./IERC1190OwnershipLicenseReceiver.sol"; import "./IERC1190CreativeLicenseReceiver.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/C...
See {IERC1190-setApprovalCreativeOwnershipForAll}./
function setApprovalCreativeOwnershipForAll(address operator, bool approved) public virtual override { _setApprovalCreativeOwnershipForAll(_msgSender(), operator, approved); }
5,414,107
./full_match/1/0xC4dde7b7946F8b8498850D78cC4fC79bd7C3201E/sources/contracts/TokenSale.sol
console.log("cl price:"); console.logInt(price);
function getLatestEthPrice() public view returns (uint256) { (, int256 price, , , ) = priceFeed.latestRoundData(); return uint256(price); }
4,838,594
./full_match/80001/0xD020917Bc396787375AcE783DF896d14aDF18FB6/sources/src/exchange/mixins/Trading.sol
Validates an order order - The order to be validated
function validateOrder(Order memory order) public view { bytes32 orderHash = hashOrder(order); _validateOrder(orderHash, order); }
9,433,464
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; pragma abicoder v2; import "base64-sol/base64.sol"; import "./constants/Colors.sol"; /// @title Hair SVG generator library HairDetail { /// @dev Hair N°1 => Classic Brown function item_1() public pure returns (string memory) { return base(classi...
Generate monk SVG
function monk() private pure returns (string memory) { return string( abi.encodePacked( '<path opacity="0.36" fill="#6E5454" stroke="#8A8A8A" stroke-width="0.5" stroke-miterlimit="10" d="M286.8,206.8c0,0,0.1-17.4-2.9-20.3c-3.1-2.9-7.3-8.7-7.3-8.7s0.6-24.8-2.9-...
1,028,782
./full_match/1/0x1027f507839a7c3D16b9546d4284d5284f9F1c0F/sources/contracts/OpsLpRewards.sol
View function to see pending Opss on frontend.
function pendingOps(uint256 _pid, address _user) external validatePoolByPid(_pid) view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accOpsPerShare = pool.accOpsPerShare; uint256 lpSupply = pool.lpToken.balanceOf(ad...
17,148,906
./partial_match/42/0x013Cf6b31463221276CC4A30600D300e37B41292/sources/BudFarm.sol
onERC1155BatchReceived implementation per IERC1155Receiver spec User should not send using batch./
function onERC1155BatchReceived( address, address, uint256[] memory, uint256[] memory, bytes memory ) external override returns (bytes4) { require( false, "BudFarm: only supports transfer single bud at a time (e.g safeTransferFrom)" ...
3,475,284