file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./full_match/80001/0xC42DCF0FBc12A4A3D204000d4f560d49e88307A2/sources/contracts/Marketplace.sol
Closes an auction for an auction creator; distributes winning bid amount to auction creator.
function _closeAuctionForAuctionCreator(Listing memory _targetListing, Offer memory _winningBid) internal { uint256 payoutAmount = _winningBid.pricePerToken * _targetListing.quantity; _targetListing.quantity = 0; _targetListing.endTime = block.timestamp; listings[_targetListing.list...
5,599,689
./full_match/1/0x9C1dC986D786534c13Ec32eFA6C7A1631898d102/sources/inari1.sol
Unstake aXSUSHI `amount` into SUSHI for benefit of `to` by batching calls to `aave` and `sushiBar`.
function unstakeSushiFromAaveTo(address to, uint256 amount) external { } β–ˆ β–ˆ β–ˆβ–€ β–€ β–ˆ β–€β–€β–€ β–ˆ β–ˆ β–ˆ β–ˆ β–€ β–„ β–ˆβ–ˆβ–„β–„ β–ˆβ–ˆ β–ˆ β–ˆ β–ˆ β–ˆ β–ˆ β–„β–€ β–ˆβ–„ β–„β–€ β–ˆ β–ˆ β–ˆ β–ˆ β–€β–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆ β–€β–ˆβ–ˆβ–ˆβ–€ β–ˆ β–ˆ β–ˆ β–€ β–ˆ β–ˆβ–ˆ */
3,116,974
pragma solidity ^0.4.24; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) pu...
function to check the staking balance of a user _user to check the balance of return uint of the stake balance
function stakeBalanceOf(address _user) view external returns (uint) { return stakeBalances[_user].stakeBalance; }
12,235,982
./full_match/5/0x5911a979e00C4847B2BE34F733e59cF6885fC48A/sources/contracts/claim/factory/MerkleSet.sol
Tests membership in the merkle set/
function _testMembership( bytes32 leaf, bytes32[] memory merkleProof ) internal view returns (bool) { return MerkleProof.verify(merkleProof, merkleRoot, leaf); }
1,891,659
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; // File: @openzeppelin/contracts/GSN/Context.sol /* * @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 b...
Return the 6 digit price of soda on uniswap.
function getSodaPrice() public view returns (uint256) { return getTokenPrice(sodaMaster.soda()); }
6,835,731
./full_match/4/0x05F5230b57E7D1d96B7ECC3975e447955a690b85/sources/BondingCurveFactory_flat.sol
return address: The address of the uniswap router./
function getRouterAddress() public view returns(address) { return address(routerInstance); }
651,453
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract VolcanoCoin is ERC20{ //set variables uint totalSupply = 10000; address owner; event totalSupplyInc(uint); // event Transfer(address indexed sender, address indexed rece...
Increment total supply by 1000 tokens - owner onlyShould increment the balance of the owner with 1000 here?
function incTotalSupply() public onlyOwner { totalSupply = totalSupply + 1000; emit totalSupplyInc(totalSupply); }
15,861,018
pragma solidity ^0.5.7; library MyEtherFundControl { using MyEtherFundControl for data; struct data { uint min; uint max; uint startAt; uint maxAmountPerDay; mapping(uint => uint) investmentsPerDay; } function addInvestment(data storage control, uint amount) i...
top investor in 24 hours if current dead, delete him
function considerTopInvestor(uint amount) internal { if (top_investor.addr != address(0) && top_investor.from + 24 hours < now) { top_investor.addr = address(0); top_investor.deposit = 0; emit PerseusUpdate(msg.sender, "expired"); } if (amount > top_inves...
14,027,770
./partial_match/1313161554/0x548A76388D5A11C37a34f24be3560eFFf7289267/sources/_contracts/abstract/ReaperBaseStrategyv2.sol
This function must be overriden simply for access control purposes. Only DEFAULT_ADMIN_ROLE can upgrade the implementation once the timelock has passed./
function _authorizeUpgrade(address) internal override { _atLeastRole(DEFAULT_ADMIN_ROLE); require(upgradeProposalTime + UPGRADE_TIMELOCK < block.timestamp); clearUpgradeCooldown(); }
16,915,265
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC1271 standard signature validation method for * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271]. * * _Available since v4.1._ */ interface IERC1271 { /** * @dev Should return whether the signa...
gives the note and instrument for a particular Bleep id. id bleep id which represent a pair of (note, instrument). return note the note index (0 to 63) starting from C2 to D7 return instrument the instrument index (0 to 16). At launch there is only 9 instrument but the DAO could add more (up to 16 in total).
function sound(uint256 id) external pure returns (uint8 note, uint8 instrument) { note = uint8(id & 0x3F); instrument = uint8(uint256(id >> 6) & 0x0F); }
6,180,858
/** *Submitted for verification at Etherscan.io on 2022-02-19 */ // SPDX-License-Identifier: MIT // Amended by HashLips /** __ ______ ________ ______ | \ / \ | \ / \ | $$ | $$...
Approve `operator` to operate on all of `owner` tokens Emits a {ApprovalForAll} event./
function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC1155: setting approval status for self"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved)...
15,086,163
pragma solidity ^0.4.23; interface ApproveAndCallFallBack { function receiveApproval( address from, uint256 _amount, address _token, bytes _data ) external; } contract Controlled { /// @notice The address of the controller is the only address that can call ...
This function makes it easy to get the total number of tokens return The total number of tokens/
function totalSupply() external view returns (uint) { return totalSupplyAt(block.number); }
5,388,937
./partial_match/42161/0xB4ee30dE6BF7e8F9eFBFcC9715021144DEFDe96F/sources/contracts/community-token/MintableERC20.sol
Creates `amount` new tokens for `to`. See {ERC20-_mint}. Requirements: - the caller must have the `MINTER_ROLE`./
function mint(address to, uint256 amount) external virtual { require(hasRole(MINTER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have minter role to mint"); _mint(to, amount); }
3,493,192
./full_match/1/0xfaE2266018B3f19346BDCeA68aE6a7d9B8B1f62a/sources/Pepe Juice.sol
_saleState is a number 0-1 to set the state of contract 0-ACTIVE, 1-PUBLIC
function setSaleState(SaleState _saleState) external onlyRole(DEV) { saleState = _saleState; }
4,964,315
pragma solidity ^0.4.11; // Created for conduction of Zaber ICO - http://www.zabercoin.io/ // Copying in whole or in part is prohibited. // This code is the property of ICORating and ICOmachine - http://ICORating.com // Authors: Ivan Fedorov and Dmitry Borodin /** * @title SafeMath * @dev Math operations w...
Check for the possibility of buying tokens. Inside. Constant. The round started and did not end Rate is greater than or equal to the minimum hardCap is not reached, and in the event of a transaction, it will not be exceeded by more than OverLimit round is initialized and no "Pause of trading" is set
function validPurchase() internal constant returns (bool) { bool withinPeriod = (now > startTime && now < endTime); bool nonZeroPurchase = msg.value >= minPay; bool withinCap = msg.value <= hardCap.sub(weiRaised()).add(overLimit); return withinPeriod && nonZeroPurchase && withinC...
2,524,415
./partial_match/3/0xE058599081394D1feE9df4f91bb00BD600fF7896/sources/LotteryTwo.sol
Get PPDEX in UniV2 addressGet Total LP tokenssubtract a small fudge factor
function MinLPTokensGolden() public view returns (uint){ uint totalPPDEX = IERC20(PPDEX).balanceOf(UniV2Address); uint totalLP = IUniswapV2ERC20(UniV2Address).totalSupply(); return (minPPDEXGolden.mul(totalLP) / totalPPDEX).sub(10000); }
5,226,042
./full_match/11155111/0xbB1Bc864b3e8170a584433D4bfC4c07B9CB91Bf1/sources/contracts/swap.sol
Cancels an order This function can only be called by the initiator of the order. It requires the order to not be fully filled, disapproved or cancelled. orderId The id of the order to cancel
function cancelOrder(uint256 orderId) public { require( msg.sender == orders[orderId].initiator, "Only initiator can cancel" ); require(!orders[orderId].status.isCancelled, "Order already cancelled"); require( orders[orderId].filledAmount < orders[...
3,790,112
pragma solidity 0.5.11; // WARNING - `executeActionWithAtomicBatchCalls` has a `bytes[]` argument that // requires ABIEncoderV2, and the alternatives are pretty convoluted. Consider // losing that function and ABIEncoderV2 for the V1 smart wallet implementation. pragma experimental ABIEncoderV2; import "@openzeppelin/...
Protected function that can only be called from `withdrawUSDC` on this contract. It will attempt to withdraw the supplied amount of USDC, or the maximum amount if specified using `uint256(-1)`, to the supplied recipient address by redeeming the underlying USDC from the cUSDC contract and transferring it to the recipien...
function _withdrawUSDCAtomic( uint256 amount, address recipient ) external returns (bool success) { _enforceSelfCallFrom(this.withdrawUSDC.selector); bool maxWithdraw = (amount == uint256(-1)); uint256 redeemUnderlyingAmount; if (maxWithdraw) { redeemUnderlyingAmount = _CUSDC.balanceO...
12,781,678
/** *Submitted for verification at Etherscan.io on 2020-09-18 */ /** *Submitted for verification at Etherscan.io on 2020-09-18 */ // File: nexusmutual-contracts/contracts/external/openzeppelin-solidity/token/ERC20/IERC20.sol pragma solidity 0.5.7; /** * @title ERC20 interface * @dev see https://github.com/ethe...
Calls the Oraclize Query to close a given Claim after a given period of time. id Claim Id to be closed time Time (in seconds) after which Claims assessment voting needs to be closed
function closeClaimsOraclise(uint id, uint time) external onlyInternal { bytes32 myid = _oraclizeQuery(4, time, "URL", "", 3000000); _saveApiDetails(myid, "CLA", id); }
7,287,170
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address ac...
Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address./
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + 1); return true; }
14,667,987
./full_match/100/0xAE76442a5a9E2bf27bb1B2bA4171d1e83Bd0277c/sources/node_modules/_gnosis.pm/safe-contracts/contracts/base/ModuleManager.sol
Allows a Module to execute a Safe transaction without any further confirmations. to Destination address of module transaction. value Ether value of module transaction. data Data payload of module transaction. operation Operation type of module transaction. Only whitelisted modules are allowed. Execute transaction w...
function execTransactionFromModule( address to, uint256 value, bytes memory data, Enum.Operation operation ) public virtual returns (bool success) { require(msg.sender != SENTINEL_MODULES && modules[msg.sender] != address(0), 'GS104'); success = execute(to, value, data, operation, gasleft())...
14,283,145
// SPDX-License-Identifier: MIT pragma solidity =0.7.6; pragma experimental ABIEncoderV2; interface IERC20 { function totalSupply() external view returns (uint256 supply); function balanceOf(address _owner) external view returns (uint256 balance); function transfer(address _to, uint256 _value) exter...
Common interface for the Trove Manager. --- Events ---
interface ITroveManager { event BorrowerOperationsAddressChanged(address _newBorrowerOperationsAddress); event PriceFeedAddressChanged(address _newPriceFeedAddress); event LUSDTokenAddressChanged(address _newLUSDTokenAddress); event ActivePoolAddressChanged(address _activePoolAddress); event D...
14,390,465
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerableUpgradeable is...
sets the deposit limit of a given pool requirements: - the caller must be the owner of the contract/
function setDepositLimit(Token pool, uint256 newDepositLimit) external onlyOwner { Pool storage data = _poolStorage(pool); uint256 prevDepositLimit = data.depositLimit; if (prevDepositLimit == newDepositLimit) { return; } data.depositLimit = newDepositLimit; ...
10,394,349
// SPDX-License-Identifier: MIT pragma solidity 0.5.16; import "./SafeMath.sol"; import "./Token.sol"; /// @title ΠšΠΎΠ½Ρ‚Ρ€Π°ΠΊΡ‚ ICO contract TokenCrowdSale { using SafeMath for uint256; address payable private owner; /// адрСс Π²Π»Π°Π΄Π΅Π»ΡŒΡ†Π° uint256 private _openingTime; /// врСмя открытия ICO (Unix Timestamp...
ΠŸΠΎΠ»ΡƒΡ‡ΠΈΡ‚ΡŒ ΠΈΠ½Ρ„ΠΎΡ€ΠΌΠ°Ρ†ΠΈΡŽ ΠΎ Ρ€Π°Π·Ρ€Π΅ΡˆΠ΅Π½ΠΈΠΈ Π½Π° Π²Ρ‹Π²ΠΎΠ΄ срСдств (случай Π½Π΅ΡƒΡΠΏΠ΅ΡˆΠ½ΠΎΠ³ΠΎ ICO)
function allowRefunds() public view returns(bool) { return _allowRefunds; }
975,312
./full_match/97/0xe00aedd1F593B82429ea304A29b947d1FdF8Daba/sources/project_/contracts/BakaCoin.sol
Transfer many address for airdrop/
function transferMany(address[] memory to, uint256[] memory amount) public { for (uint256 i; i < to.length; i++) { super._transfer(_msgSender(), address(to[i]), amount[i]); } }
3,268,291
./full_match/1/0x0439e60F02a8900a951603950d8D4527f400C3f1/sources/contracts/MetaBridge.sol
Unpauses the contract to make the bridge function callable./
function unpauseBridge() external onlyOwner { _unpause(); }
17,185,298
pragma solidity ^0.5.0; // import "@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol"; import "@nomiclabs/buidler/console.sol"; import "./LBCR.sol"; import "./UserProxy.sol"; import "./UserProxyFactory.sol"; import "./ILBCR.sol"; /// @title Registers users, protocols, aggregates reputation cont...
For each of the LBCRs in Byzantic, if the round has elapsed, users will be curated into layers according to their score
function curateLBCRs() public { for(uint i = 0; i < lbcrs.length; i++) { lbcrs[i].curateIfRoundEnded(); } }
2,512,824
pragma solidity ^0.6.0; import "../Initializable.sol"; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dea...
Whether `a` is equal to `b`. a a FixedPoint. b a FixedPoint. return True if equal, or False./
function isEqual(Unsigned memory a, Unsigned memory b) internal pure returns (bool) { return a.rawValue == b.rawValue; }
469,936
./partial_match/3/0x8252AaBFFa377a323F11DFa0d7cBB41409878BA3/sources/yaDelayu3.sol
Only staking contract can call
function burnToken(address burnFrom, uint burnAmount) public returns(bool){
5,198,057
./full_match/1/0x76f87b70D20547B2415cf6fcba0091072d86B21e/sources/Donation.sol
used to check whether donation is active or not return bool returns true if donation is active, otherwise false/
function isDonationActive() external view returns (bool) { return donationState == 0 ? true : false; }
4,943,108
pragma solidity ^0.5.8; // https://github.com/pipermerriam/ethereum-datetime contract DateTime { struct _DateTime { uint16 year; uint8 month; uint8 day; uint8 hour; uint8 minute; uint8 second; uint8 weekday; } uint constant DAY_IN_SECONDS = 86400; uint constant YEAR_IN_SECONDS = 31...
reverts erc223 transfers
function tokenFallback(address, uint, bytes calldata) external pure { revert("ERC223 tokens not allowed in Vault"); }
13,048,609
./partial_match/56/0x55441C50a1aDa087D41070dF99d9570a9913e020/sources/MasterChef.sol
Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as...
function getPriorVotes(address account, uint blockNumber) external view returns (uint256) { require(blockNumber < block.number, "NOOM::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return ...
11,142,878
./partial_match/42/0x098F3795ebc7D9533392347BdCb610Cb0D4DF338/sources/WyAttackV1.sol
Compound ε½’θΏ˜cERC20 θ΅Žε›žERC20 amount=ε½’θΏ˜cERC20ηš„ζ•°ι‡ amount=θ¦θ΅Žε›žηš„ERC20ηš„ζ•°ι‡
function redeemCErc20Tokens(uint256 amount, bool redeemType, address cErc20Contract) public { CErc20 cToken = CErc20(cErc20Contract); uint256 redeemResult; if (redeemType == true) { redeemResult = cToken.redeem(amount); redeemResult = cToken.redeemUnderlying(amount);...
3,418,133
pragma solidity ^0.4.18; import './FloatMath.sol'; contract Tester { FloatMath floatLib; // using FloatMath for bytes32; // using FloatMath for uint256[3]; // bytes32 public res; // uint256 constant public SIGNIF_BITS = 236; // uint256 constant public EXP_BITS = 19; // uint256 c...
result = a.toArray();
function testBytesToArray(bytes32 a) public view returns (uint256[3] result) { floatLib.toArray(a); return result; }
1,828,153
./partial_match/1/0x45c00508C14601fd1C1e296eB3C0e3eEEdCa45D0/sources/contracts/interfaces/ILendingPoolAddressesProviderV2.sol
LendingPoolAddressesProvider contract Main registry of addresses part of or connected to the protocol, including permissioned roles - Acting also as factory of proxies and admin of those, so with right to change its implementations - Owned by the Aave Governance Aave/
interface ILendingPoolAddressesProviderV2 { event MarketIdSet(string newMarketId); event LendingPoolUpdated(address indexed newAddress); event ConfigurationAdminUpdated(address indexed newAddress); event EmergencyAdminUpdated(address indexed newAddress); event LendingPoolConfiguratorUpdated(address indexed ne...
9,182,592
./partial_match/42/0xe29fEfa1ECD4b1Ca55deC29A7EfDBc622998FD99/sources/GebUniswapV2MultiCollateralKeeperFlashProxy.sol
--- Core Bidding and Settling Logic --- Liquidates an underwater SAFE and settles the auction right away It will revert for protected safes (those that have saviours), these need to be liquidated through the LiquidationEngine collateralJoin Join address for a collateral type safe A SAFE's ID return auction Auction ...
function liquidateAndSettleSAFE(CollateralJoinLike collateralJoin, address safe) public returns (uint auction) { collateralType = collateralJoin.collateralType(); if (liquidationEngine.safeSaviours(liquidationEngine.chosenSAFESaviour(collateralType, safe)) == 1) { require (liquidationEng...
3,448,357
./full_match/1/0x13dD6168C0027E75FE76AEA000e9e742C862a281/sources/contracts/messaging/libraries/DomainIndexer.sol
Validate given domains and connectors arrays are correct (i.e. they mirror what is currently saved in storage). Reverts if domains or connectors do not match, including ordering. _domains The given domains array to check. _connectors The given connectors array to check./ Sanity check: arguments are same length. Vali...
function validateDomains(uint32[] calldata _domains, address[] calldata _connectors) public view { require(_domains.length == _connectors.length, "!matching length"); require(keccak256(abi.encode(_domains)) == domainsHash, "!domains"); require(keccak256(abi.encode(_connectors)) == connectorsHash, "!connec...
9,801,356
pragma solidity 0.4.24; // File: contracts\lib\Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event Owner...
function that allows token purchases with STAR beneficiary Address of the purchaser/ calculate token amount to be createdremainder logic
function buyTokens(address beneficiary) public payable whenNotPaused isWhitelisted(beneficiary) crowdsaleIsTokenOwner { require(beneficiary != address(0)); require(validPurchase() && tokenOnSale.totalSupply() < crowdsaleCap); if (!isWeiAccepted) {...
953,322
pragma solidity ^0.4.11; import "./SafeMath.sol"; import './Halt.sol'; contract HTLCBase is Halt { using SafeMath for uint; /** * * ENUMS * */ /// @notice tx info status /// @notice uninitialized,locked,refunded,revoked enum TxStatus {None, Locked, Refunded, Revoked} /// @n...
set locked time(only owner has the right) time the locked time,in seconds
function setLockedTime(uint time) public onlyOwner isHalted returns (bool) { lockedTime = time; return true; }
2,566,383
// SPDX-License-Identifier: MIT // TODO: What license do we release under? pragma solidity >=0.6.0 <0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; /** @title Fountain Create a MoneyPool (...
Proportionally allocate the specified amount to the contributors of the specified MoneyPool, meaning each sustainer will receive a portion of the specified amount equivalent to the portion of the total amount contributed to the sustainment of the MoneyPool that they are responsible for. mp The MoneyPool to update. R...
function _updateTrackedRedistribution(MoneyPool storage mp) private { if (mp.sustainabilityTarget >= mp.currentSustainment) return; uint256 surplus = mp.currentSustainment.sub(mp.sustainabilityTarget); for (uint256 i = 0; i < mp.sustainers.length; i++) { address sustainer = mp....
13,081,331
pragma solidity ^0.5.16; import "./CToken.sol"; /** * @title Compound's CErc20Delegator Contract * @notice CTokens which wrap an EIP-20 underlying and delegate to an implementation * @author Compound */ contract CErc20Delegator is CTokenInterface, CErc20Interface, CDelegatorInterface { /** * @notice Cons...
Approve `spender` to transfer up to `amount` from `src` This will overwrite the approval amount for `spender` spender The address of the account which may transfer tokens amount The number of tokens that are approved (-1 means infinite) return Whether or not the approval succeeded/
function approve(address spender, uint256 amount) external returns (bool) { bytes memory data = delegateToImplementation(abi.encodeWithSignature("approve(address,uint256)", spender, amount)); return abi.decode(data, (bool)); }
249,833
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @title: MinteVipTicket /// @authors: manifold.xyz & Collector import "./ERC721Creator.sol"; contract MVIP is ERC721Creator { uint256 public price = 40000000000000000; //0.04 ETH bool public saleIsActive = true; uint private rand; const...
Set token uri prefix for an extension/
function _setTokenURIPrefixExtension(string calldata prefix) internal { _extensionURIPrefix[msg.sender] = prefix; }
6,447
// Sources flattened with hardhat v2.3.0 https://hardhat.org // File contracts/shared/interfaces/IDiamondCut.sol // SPDX-License-Identifier: MIT pragma solidity 0.8.1; /******************************************************************************\ * Author: Nick Mudge <nick@perfectabstractions.com> (https://twitter...
Calculates the base rarity score, including collateral modifier
function baseRarityScore(int16[NUMERIC_TRAITS_NUM] memory _numericTraits) internal pure returns (uint256 _rarityScore) { for (uint256 i; i < NUMERIC_TRAITS_NUM; i++) { int256 number = _numericTraits[i]; if (number >= 50) { _rarityScore += uint256(number) + 1; ...
2,501,944
pragma solidity ^0.4.24; // Amis Dex OnChainOrderBook follows ERC20 Standards contract ERC20 { function totalSupply() constant returns (uint); function balanceOf(address _owner) constant returns (uint balance); function transfer(address _to, uint _value) returns (bool success); function transferFrom(address _f...
Internal Price Calculation - compute amount in counter currency that would be obtained by selling baseAmount at the given packed price (if no fees). Notes: - Does not validate price - caller must ensure valid. - Direction of the packed price is ignored. - Could overflow producing very unexpected results if baseAmoun...
function computeCntrAmountUsingPacked( uint baseAmount, uint16 price ) internal constant returns (uint) { var (, mantissa, exponent) = unpackPrice(price); return computeCntrAmountUsingUnpacked(baseAmount, mantissa, exponent); }
914,675
./full_match/8453/0x74F13914DA24e94B15E12879fA969B345D3a4387/sources/contracts/airdrop/AirdropERC721.sol
Lets contract-owner send ERC721 tokens to a list of addresses. The token-owner should approve target tokens to Airdrop contract, which acts as operator for the tokens. _tokenAddress The contract address of the tokens to transfer. _tokenOwner The owner of the the tokens to tra...
function airdrop( address _tokenAddress, address _tokenOwner, AirdropContent[] calldata _contents ) external nonReentrant { require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "Not authorized."); uint256 len = _contents.length; for (uint256 i = 0; i < len; ) { ...
11,551,432
./partial_match/1/0xDfE695026EafAaba6d880d966A4a3694b436c841/sources/GoldBars.sol
Return true if the token id is in the freezelist/
function isFrozen(uint256 _tokenId) public virtual view returns(bool) { return freezelist[_tokenId]; }
15,493,677
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "./ERC2981.sol"; import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol"; import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Pausable.sol"; import "@openzeppel...
Withrawal all Funds sent to the contract to Owner Requirements: - `msg.sender` needs to be Owner and payable/
function withdrawalAll() external { require( hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "CharityToken: must have admin role to withdrawal" ); require(payable(msg.sender).send(address(this).balance)); }
5,938,627
pragma solidity ^0.4.17; import 'openzeppelin-solidity/contracts/token/ERC20/BasicToken.sol'; contract MetaCoin is BasicToken { event PixelChange(uint256 pixelId); address owner; string public constant name = "PixelCoin"; string public constant symbol = "PXC"; uint8 public constant decimals = 0; uint256 ...
Buy pixel in matrix. id Id of the pixel. red Red color component. red Green color component. red Blue color component. numofMinutes Number of minutes that pixel should be shown./
function buyPixel(uint id, uint8 red, uint8 green, uint8 blue, uint numofMinutes) public returns(bool) { require(id >= 0 && id < NUMBER_OF_PIXELS); require(numofMinutes > 0); require(isColor(red) && isColor(green) && isColor(blue)); require(isExpired(id)); uint coins = minutesToCoins(numofMinutes...
6,369,277
pragma solidity ^0.5.10; // File: openzeppelin-solidity/contracts/math/SafeMath.sol /** * @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...
low level token purchase This function has a non-reentrancy guard, so it shouldn't be called by another `nonReentrant` function./ calculate token amount to be sent
function buyTokens() public nonReentrant payable { address beneficiary = msg.sender; uint256 weiAmount = msg.value; require(weiAmount != 0, "TokenDealer: weiAmount is 0"); uint256 tokenAmount = _getTokenAmount(beneficiary, weiAmount); _token.safeTransfer(beneficiary, token...
943,908
/** * SPDX-License-Identifier: UNLICENSED */ pragma solidity 0.6.10; /** * @dev Interface of the Chainlink aggregator */ interface AggregatorInterface { function decimals() external view returns (uint8); function description() external view returns (string memory); function version() external view re...
scale aggregator response to base decimals (1e8) _price aggregator price return price scaled to 1e8/
function _scaleToBase(uint256 _price) internal view returns (uint256) { if (aggregatorDecimals > BASE) { uint256 exp = aggregatorDecimals.sub(BASE); _price = _price.div(10**exp); uint256 exp = BASE.sub(aggregatorDecimals); _price = _price.mul(10**exp); ...
484,077
./full_match/1/0xd24047316B274d48dBb2FE20068C9Cc849B76152/sources/contracts/rate_oracles/BaseRateOracle.sol
@inheritdoc IRateOracle
function getApyFromTo(uint256 from, uint256 to) public view override returns (uint256 apyFromToWad) { require(from <= to, "Misordered dates"); uint256 rateFromToWad = getRateFromTo(from, to); uint256 timeInSeconds = to - from; uint256 timeInSeco...
16,479,632
/** For everyone who missed BiznizInu */ // SPDX-License-Identifier: Unlicensed pragma solidity 0.8.13; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { ...
exclude from paying fees or having max transaction amount
constructor() ERC20("Bizniz Ape", "BizAPE") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(...
210,819
./full_match/56/0xEdF11ced88AEE8e9e15B3977d8DC6B01f25Bb3Fb/sources/src/tokens/VaultFounderToken.sol
set multiplicator for the next token in percents in case nextTokenPriceMultiplier_ = 13_000 the next price of the token will be: curPrice 130% nextTokenPriceMultiplier_ persent multiplicator the price of the previous token calculation the price with the new multiplier
function setNextTokenMultiplier(uint256 nextTokenPriceMultiplier_) external onlyRole(DEFAULT_ADMIN_ROLE) { nextTokenPrice = nextTokenPrice * 10000 / nextTokenPriceMultiplier; nextTokenPriceMultiplier = nextTokenPriceMultiplier_; nextTokenPrice = nextTokenPrice * nextTokenPriceMultiplier_ / 1...
3,235,219
pragma solidity ^0.4.8; contract Bet { //jedi bet status uint constant STATUS_WIN = 1; uint constant STATUS_LOSE = 2; uint constant STATUS_TIE = 3; uint constant STATUS_PENDING = 4; //game status uint constant STATUS_NOT_STARTED = 1; uint constant STATUS_STARTED = 2; uint constan...
returns - [<description>, 'originator', <originator status>, 'taker', <taker status>]
function getBetOutcome() public view returns (string description, string originatorKey, uint originatorStatus, string takerKey, uint takerStatus) { if (game.originator.status == STATUS_TIE || game.taker.status == STATUS_TIE) { description = "Both bets were the same or were over the num...
12,794,368
/* Copyright 2021 Set Labs Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in...
Check if there are any more tokens to sell. Since we allow WETH to float around it's target during rebalances it is not checked. _setToken Instance of the SetToken to be rebalanced return bool True if there is not any component that can be sold, otherwise false/
function _noTokensToSell(ISetToken _setToken) internal view returns (bool) { address[] memory rebalanceComponents = rebalanceInfo[_setToken].rebalanceComponents; for (uint256 i = 0; i < rebalanceComponents.length; i++) { } return true; }
6,960,913
// SPDX-License-Identifier: MIT /// @title OMNI Token V1 / Ethereum v1 /// @author Alfredo Lopez / Arthur Miranda / OMNI App 2021.5 */ pragma solidity 0.8.4; import "../@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-ERC20PermitUpgradeable.sol"; import "../@openzeppelin/contracts-upgradeable/securit...
Auxiliary Method to permit Upload all wallets in all allocation, based on Vesting Process wallet Wallet will be Frozen based on correspondig Allocation totalAmount Total Amount of Stake holder based on Investment and the Allocation to participate dailyAmount Daily Amount of Stake holder based on Investment and the A...
function addFrozenWallet(address wallet, uint256 totalAmount, uint256 dailyAmount,uint256 monthlyAmount ,uint256 initialAmount, uint256 afterDays) internal { uint256 releaseTime = getReleaseTime(); FrozenWallet memory frozenWallet = FrozenWallet( true, uint32(releaseTime.add(afterDays)), ...
6,378,913
// SPDX-License-Identifier: MIT pragma solidity ^0.8.3; //Libraries import "../libraries/TxDataUtils.sol"; import "../openzeppelin-solidity/SafeMath.sol"; //Inheritance import "../interfaces/IVerifier.sol"; //Interfaces import "../interfaces/IAddressResolver.sol"; import "../interfaces/IAssetHandler.sol"; import "....
Parses the transaction data to make sure the transaction is valid addressResolver Address of AddressResolver contract pool Address of the pool to External contract address data Transaction call data return (uint, address) Whether the transaction is valid and the received asset/Get assetsParse transaction dataCheck ...
function verify(address addressResolver, address pool, address to, bytes calldata data) external override returns (bool, address) { bytes4 method = getMethod(data); address assetHandlerAddress = IAddressResolver(addressResolver).getContractAddress("AssetHandler"); address ubeswapLPVerifierA...
5,354,722
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; // File: contracts/lib/MathUint.sol // Copyright 2017 Loopring Technology Limited. /// @title Utility Functions for uint /// @author Daniel Wang - <daniel@loopring.org> library MathUint { function mul( uint a...
Binds all methods to the given wallet.
function bindMethods(address wallet) internal { Wallet w = Wallet(wallet); bytes4[] memory methods = bindableMethods(); for (uint i = 0; i < methods.length; i++) { w.bindMethod(methods[i], address(this)); } }
134,458
// SPDX-License-Identifier: ISC pragma solidity 0.6.12; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol"; import "@openzeppelin/contra...
Public callable function for claiming unbonded stake in the event of admin failure/incapacitation. Can only be called after a period of manager inactivity. Can only be called after a 30-day unbonding period, and must be called within 72 hours of unbound period expiry. Makes a claim for all staking proxies/ Claim every...
function emergencyClaim() external override { require(adminActiveTimestamp.add(LIQUIDATION_TIME_PERIOD) < block.timestamp, "Liquidation time not elapsed"); require(emergencyUnbondTimestamp != 0, "Emergency unbond not called"); emergencyUnbondTimestamp = 0; for (uint256 i = 0; i < s...
10,295,839
./full_match/80001/0x59a753Ed44FCa823870Ae337B00331Ceac257DEE/sources/contracts/Kisaki.sol
Script to transform hash to picture /
function setScript(string calldata _script) public onlyOwner { script = _script; } mapping(bytes32 => uint256) public hashToToken; constructor( address _royaltyRecipient, uint128 _royaltyBps, address _primarySaleRecipient, string memory _script ) ERC...
5,672,824
./full_match/3/0xe9460c6987061d3D3ae8d7007E2C7bFDb82CF1af/sources/contracts/mood.sol
This is going to get mood
function getMood() public view returns(string memory) { return mood; }
14,145,988
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @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 functio...
Returns the current total supply of votes./
function _getTotalSupply() internal view virtual returns (uint256) { return _totalCheckpoints.latest(); }
634,756
./full_match/1/0xCbb07CB17f3EF0A10fA881C5E961A29d8367DA37/sources/contracts/words_final.sol
Check whether tokens are still available return the available token count
function availableTokenCount() public view returns (uint256) { return maxSupply - totalSupply(); }
4,857,679
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol pragma solidity ^0.5.2; /** * @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 private _o...
Edit oracle address associated with a token address _tokenAddress Token address to add to the whitelist _oracleAddress Oracle address to add to the whitelist under _tokenAddress/ Set new oracle address for passed token address
function editTokenOraclePair( address _tokenAddress, address _oracleAddress ) external onlyOwner timeLockUpgrade { require( oracleWhiteList[_tokenAddress] != address(0), "OracleWhiteList.editTokenOraclePair: Token and Oracle pair must e...
14,090,941
// SPDX-License-Identifier: MIT pragma solidity 0.6.6; // ...
inject NONSTANDARD NAMING
function TOTALSUPPLY861() external view returns (uint);
12,546,417
/** *Submitted for verification at Etherscan.io on 2021-04-22 */ // SPDX-License-Identifier: MIT /* This is a Stacker.vc FarmTreasury version 1 contract. It deploys a rebase token where it rebases to be equivalent to it's underlying token. 1 stackUSDT = 1 USDT. The underlying assets are used to farm on different smar...
we have too much in hot wallet, send to farmBoss we have too little in hot wallet, pull from farmBoss
function _calcHotWallet() internal view returns (bool _fundsNeeded, uint256 _amountChange) { uint256 _balanceHere = IERC20(underlyingContract).balanceOf(address(this)); uint256 _balanceFarmed = ACTIVELY_FARMED; uint256 _totalAmount = _balanceHere.add(_balanceFarmed); uint256 _hotAmo...
1,571,247
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; /** * @title OptimismMintableERC20 * This contract represents the remote representation * of an ERC20 token. It is linked to the address of * a token in another domain and tokens can be l...
Returns the corresponding L1 token address. This is a legacy function and wraps the remoteToken value./
function l1Token() public view returns (address) { return remoteToken; }
12,681,735
// SPDX-License-Identifier: BSD-3-Clause pragma solidity ^0.8.6; import "./Interfaces.sol"; // solhint-disable const-name-snakecase // solhint-disable private-vars-leading-underscore // solhint-disable not-rely-on-time contract GovernorBravo is GovernorBravoDelegateStorageV1, GovernorBravoEvents { /// @notice The n...
Function used to propose a new proposal. Sender must have delegates above the proposal threshold targets Target addresses for proposal calls values Eth values for proposal calls signatures Function signatures for proposal calls calldatas Calldatas for proposal calls description String description of the proposal r...
function propose( address[] memory targets, uint256[] memory values, string[] memory signatures, bytes[] memory calldatas, string memory description ) public returns (uint256) { require( governanceToken.getPriorVotes(msg.sender, block.number - 1) > proposalThreshold, "GovernorBra...
5,354,330
./full_match/11155111/0xdbB6d1acdfd7A803401F377149a8C5a82c684F1f/sources/contracts/GameFactory.sol
uint256 _entryPrice = games[_gameId].entryPrice;require(msg.value >= _entryPrice, "Please send funds for the correct entry price");require(games[_gameId].status == Status.Open, "Game is not currently open");
function buyEntries(uint256 _gameId, uint256 _numEntries) public payable { require(!factoryPaused, "Game Factory is currently paused. Come back later"); require(msg.sender != games[_gameId].owner, "You own the Game. You can not enter"); bool matchingTierFlag = false; for(uint i = 0;...
3,798,153
./full_match/5/0x32ff4D05236E95FF60299E9b7BaB351179138389/sources/contracts/core/libraries/BaseSplitCodeFactory.sol
Returns the creation code that will result in a contract being deployed with `constructorArgs`./ This function exists because `abi.encode()` cannot be instructed to place its result at a specific address. We need for the ABI-encoded constructor arguments to be located immediately after the creation code, but cannot rel...
function _getCreationCodeWithArgs(bytes memory constructorArgs) private view returns (bytes memory code) { address creationCodeContractA = _creationCodeContractA; uint256 creationCodeSizeA = _creationCodeSizeA; address creationCodeContractB = _creationCodeContractB; uint256 creationCode...
1,940,698
./full_match/5/0x1aF7041005ab72C4b0fF0365ad5Aa2c5D90b9901/sources/contracts/CrowdFunding.sol
Allow users to refund the money collected if target is not reached. Get the campaign. check if the campaign was successfully completed. Check if the deadline for the campaign is exceeded. Check if the target has been reached. Check if the owner is not calling the transaction. check if the amount is already withdrawn by...
function refund(uint256 _id) public { Campaign storage campaign = campaigns[_id]; require( campaign.owner != address(0), "Campaign was successfully completed" ); require(campaign.deadline < block.timestamp, "Deadline not met"); require(campaign.Amou...
1,910,898
/** *Submitted for verification at FtmScan.com on 2021-10-11 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.7; /** * @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, th...
0-dead,1-safe, 2-dangerous(time expired), 3-dangerous(location error)severity: 0 > 3 > 2
function getSummonerState(uint256 summoner)public view returns(bool,uint256 state){ if(summoner == 0){ return (false,0); } summonerInfo memory sInfo = _summonersInfo[summoner]; if(sInfo.state == 0){ return(true,0); } (,uint256 x,) = getRLS().g...
925,995
./full_match/11155111/0xFCc8a75ab4e55E1E9c3d8d1A8d833CB7BF45F5B7/sources/_ganache/console.log/console.sol
Prints to `stdout` with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution ```solidity uint256 count = 5; console.log('count: %d', count); console.log('count:', count); ``` See `util.format()` for more information./
function log(string memory value1, bool value2, bool value3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool)", value1, value2, value3)); }
3,821,378
pragma solidity ^0.4.24; /************************************************* * Title: ERC20 Token * Author: https://github.com/willitscale * Date: NA * Code version: NA * Availability: https://github.com/willitscale/learning-solidity/blob/master/tutorial-10/MyFirstToken.sol *********************************************...
send `_value` token to `_to` from `_from` on the condition it is approved by `_from` _from The address of the sender _to The address of the recipient _value The amount of token to be transferred return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) external isNotPaused returns (bool){ require(_to != address(0)); require(_balanceOf[_from] >= _value); require(_allowance[_from][msg.sender] >= _value); require(_value > 0); require(_value < MAX_LIMIT); _balanceOf[_f...
12,780,468
./full_match/4/0x88cd87A06D6b0F1dB961F02b321E3C071336b570/sources/contracts/L1/messaging/L1StandardBridge.sol
@inheritdoc IL1StandardBridge/
function depositETHTo( address _to, uint32 _l2Gas, bytes calldata _data ) external payable { _initiateETHDeposit(msg.sender, _to, _l2Gas, _data); }
650,606
./full_match/137/0x16D66b01664bc834f5db13D01E51E1Fa7C44f03B/sources/browser/NFT721.sol
Returns the number of values in the set. O(1)./
function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); }
4,781,829
// SPDX-License-Identifier: MIT /* * Work in progress */ pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/token/ERC721/e...
uint256 _token_id = totalSupply() + 1; console.log not showing upconsole.log("TOKEN: %d", _token_id);
function mint( address origin, string memory _tokenURI, uint256 _token_id, uint256 _price ) public onlyOwner(origin) returns (bool) { price = _price; token_id = _token_id; _mint(address(this), _token_id); _setTokenURI(_token_id, _tokenURI); ...
6,439,505
./partial_match/56/0x15B3d410fCd0d695E1bbe4F717F8E1B6D0Fb2D0C/sources/KetchupBar.sol
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())...
11,195,320
pragma solidity >=0.6.0; pragma experimental ABIEncoderV2; import './PriceAPI.sol'; import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/math/SafeMath.sol"; import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/utils/ReentrancyGuard.sol"...
Allows user to withdraw their winning amount after market is resolved It uses withdrawl pattern return Returns true if successful withdrawl pattern check user has deposited calculate amount to pay check if enough balance change share to 0 tranfer eth to the user
function withdraw() public override marketInactive onlyInEmergency nonReentrant returns(bool) { require(predictors[msg.sender], "Not authorised"); require(predictions[msg.sender].share != 0, "Already withdrawn"); bool finalResult = false; if(M.action == Action.lt) { final...
2,473,750
pragma solidity ^0.4.16; // METADOLLAR (DOL) VAULT - COPYRIGHT 2018 METADOLLAR.ORG // ERC Token Standard #20 Interface // https://github.com/ethereum/EIPs/issues/20 contract OraclizeI { address public cbAddress; function query(uint _timestamp, string _datasource, string _arg) external payable returns (b...
Transfer the ownership to another account newOwner - address who get the ownership
function transferOwnership(address newOwner) isOwner { assert(newOwner != address(0)); address oldOwner = owner; owner = newOwner; ownerChanged(msg.sender, oldOwner, newOwner); allowed[this][oldOwner] = 0; allowed[this][newOwner] = tokenBalanceOf[this]; }
1,594,760
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../utils/Context.sol"; /** * @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. * * By default, the owner account will be...
Reduce first Send reward
function claim() public nonReentrant { _checkFarming(); _updateReward(msg.sender); uint256 reward = _usersInfos[msg.sender].pendingReward; if (reward > 0) { _usersInfos[msg.sender].pendingReward = 0; rewardToken.mint(msg.sender, reward); emit Cl...
13,890,895
./full_match/1/0x756c725184eb024Cb40f0FFc919a4988509d2b41/sources/contracts/DoggoMintooor.sol
Check minting fee sent Mint NFT to caller Track token ID
function _acceptMoneyAndMintFor( string memory _url, IERC20 token, bytes memory swapPath, uint256 amountIn, uint256 amountOutMinimum, address to ) internal { require(bytes(_url).length > 0, "Doggomintoor: Empty URL"); uint256 amountInReserveCurren...
9,669,460
pragma solidity 0.6.12; pragma experimental ABIEncoderV2; contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor () internal { } function _msgSender() internal view virtual re...
Downshift `input` to open space at the "front" of the bytes32
function _addPrefix( bytes32 input, bytes32 prefix, uint256 prefixLength ) internal pure returns (bytes32) { bytes32 shiftedInput = input >> (prefixLength * 8); return shiftedInput | prefix; }
7,359,849
./full_match/1/0x492B6F8A53D1c42cC2DD352788a6C02c557BE9F5/sources/contracts/integrations/curve/common/Stablz3CRVMetaPoolIntegration.sol
Get the CRV to 3CRV swap params return swapParams Swap params for CRV to 3CRV
function getCRVTo3CRVSwapParams() public pure returns (uint[3][4] memory swapParams) { swapParams[0][0] = 1; swapParams[0][2] = 3; swapParams[1][0] = 2; swapParams[1][2] = 3; swapParams[2][0] = 2; swapParams[2][2] = 7; return swapParams; }
3,190,064
// SPDX-License-Identifier: MIT // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in ...
takes a numeraire amount and returns the raw amount
function viewRawAmount(int128 _amount) external view override returns (uint256 amount_) { uint256 _rate = getRate(); amount_ = (_amount.mulu(DECIMALS) * 1e8) / _rate; }
6,028,528
// SPDX-License-Identifier: MIT pragma solidity >=0.4.4 < 0.7.0; pragma experimental ABIEncoderV2; import "./SafeMath.sol"; //interface de token ERC20 interface IERC20{ //devuelve la cantidad de token en existentes function totalSupply() external view returns(uint256); //devuelve la cantidad de token por ...
interface de token ERC20devuelve la cantidad de token en existentesdevuelve la cantidad de token por una dirrecion indica por parametroDevuelve el nΓΊmero de token que el spender podrΓ‘ gastar en nombre del propietario (owner)Devuelve un valor booleano resultado de la operaciΓ³n indicadaDevuelve un valor booleano con el r...
interface IERC20{ function totalSupply() external view returns(uint256); function balanceOf(address account) external view returns(uint256); function allowance(address owner, address spender) external view returns(uint256); function transfer(address recipient, uint256 amount) external returns(bool); ...
12,816,785
./full_match/5/0xf1d8C4acb1B983f231AC60DF57692dB9747a7133/sources/src/ERC1155TL.sol
@inheritdoc StoryContractUpgradeable restricted to the owner of the contract
function _isCreator(address potentialCreator, uint256 /* tokenId */ ) internal view override(StoryContractUpgradeable) returns (bool) { return potentialCreator == owner(); } BlockList Functions
1,861,336
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; import {DataTypes as dt} from "./libraries/DataTypes.sol"; import {Transitions as tn} from "./libraries/Transitions.sol"; import "./libraries/ErrMsg.sol"; import "./libraries/MerkleTree.sol"; import "./TransitionEvaluator.sol"; import "./Registry.sol"; contract ...
Dispute a transition. _prevTransitionProof The inclusion proof of the transition immediately before the fraudulent transition. _invalidTransitionProof The inclusion proof of the fraudulent transition. _accountProofs The inclusion proofs of one or two accounts involved. _strategyProof The inclusion proof of the stra...
function disputeTransition( dt.TransitionProof calldata _prevTransitionProof, dt.TransitionProof calldata _invalidTransitionProof, dt.AccountProof[] calldata _accountProofs, dt.StrategyProof calldata _strategyProof, dt.StakingPoolProof calldata _stakingPoolProof, dt.G...
5,359,202
./partial_match/100/0x5f8bCFAE2ED503435e02046f745638c3c2378f22/sources/EscrowFactory.sol
Payee gets paidModerator gets paid if exists
function releaseFundsToPayee(bytes32 esid) external onlyPayerOrModerator(esid) { 1) The payee gets paid the escrow settlement amount 2) The moderator gets paid the moderation fee if exists 3) Any remaining amount is transferred to the Payer Escrow storage th...
16,668,159
// SPDX-License-Identifier: MIXED // File @boringcrypto/boring-solidity/contracts/libraries/BoringMath.sol@v1.2.1 // License-Identifier: MIT pragma solidity 0.6.12; /// @notice A library for performing overflow-/underflow-safe math, /// updated with awesomeness from of DappHub (https://github.com/dapphub/ds-math). li...
Approves `value` from `owner_` to be spend by `spender`. owner_ Address of the owner. spender The address of the spender that gets approved to draw from `owner_`. value The maximum collective amount that `spender` can draw. deadline This permit must be redeemed before this deadline (UTC timestamp in seconds).
function permit( address owner_, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external { require(owner_ != address(0), "ERC20: Owner cannot be 0"); require(block.timestamp < deadline, "ERC20: Expired"); ...
1,007,991
./full_match/1/0x139D5153287B00CD636f599a27BD28Fdd48BE9DA/sources/contracts/SignatureTransfer.sol
Checks whether a nonce is taken and sets the bit at the bit position in the bitmap at the word position from The address to use the nonce at nonce The nonce to spend
function _useUnorderedNonce(address from, uint256 nonce) internal { (uint256 wordPos, uint256 bitPos) = bitmapPositions(nonce); uint256 bit = 1 << bitPos; uint256 flipped = nonceBitmap[from][wordPos] ^= bit; if (flipped & bit == 0) revert InvalidNonce(); }
4,821,753
./full_match/1/0xAc096F8abCd44A346ad0eA6Df4Ccde52160837A6/sources/contracts/Lottery/SpacecowsLottery.sol
Buy tickets for the current lottery _lotteryId: lotteryId _numberOfTickets: amount of tickets to buy Callable by users/ Calculate number of SMILK to this contract Transfer smilk tokens to this contract
function buyTickets(uint256 _lotteryId, uint32 _numberOfTickets) external notContract nonReentrant { Lottery storage selectLottery = _lotteries[_lotteryId]; require(_numberOfTickets != 0, "No ticket amount specified"); require(_numberOfTickets < maxTicketsPerTra...
17,102,633
pragma solidity ^0.5.2; // ---------------------------------------------------------------------------- // rev rbs eryk 190105.POC // Ver Proof of Concept compiler optimized - travou na conversao de GTIN-13+YYMM para address nesta versao 0.5---droga // &#39;IGR&#39; &#39;InGRedient Token with Fixed Supply Token&#39; c...
-------------------------------------------------------------------------------------------------- routine 40- allows for sale of intermediate product made from certified ingredients along with the respective IGR token transfer ( with url) i.e.: allows only the pro-rata quantity of semi-processed InGRedient tokens to ...
function sellsIntermediateGoodWithDepletion(address to, uint tokens,string memory _url,uint out2inIngredientPercentage ) public returns (bool success) { transfer(to, tokens*out2inIngredientPercentage/100); return true; }
7,849,142
./full_match/1/0x6Cc7D6c7b3000a8f1EefEbbBA253BD277457CD2C/sources/browser/BlockFiToken.sol
convert uint to uint32 n uint number errorMessage error message return uint32 number/
function safe32(uint n, string memory errorMessage) internal pure returns (uint32) { require(n < 2**32, errorMessage); return uint32(n); }
3,145,498
./full_match/53935/0x3C351E1afdd1b1BC44e931E12D4E05D6125eaeCa/sources/contracts/dex/UniswapV2Router02.sol
REMOVE LIQUIDITY
function removeLiquidity( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) public virtual override ensure(deadline) returns (uint256 amountA, uint256 amountB) { address pair =...
3,786,368
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; /* * @dev Provides information about the current execution context. * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { ...
Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as...
function getPriorVotes(address account, uint blockNumber) external view returns (uint256) { require(blockNumber < block.number, ":getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return 0; } ...
163,177
./full_match/9000/0x96b2AD3813f2b22aB5782871C1F23Ede6FdAfB78/sources/gist-e259420aec8d85ea2219e4154536ad35/contracts/RedelegateReward.sol
return Returns total rewards amount for current duration./
function getRewardForDuration() external view returns (uint256) { return rewardRate * rewardsDuration; }
3,260,721
pragma solidity ^0.4.2; /// Implements ERC 20 Token standard: https://github.com/ethereum/EIPs/issues/20 /// @title Abstract token contract - Functions to be implemented by token contracts. contract AbstractToken { // This is not an abstract function, because solc won't recognize generated getter functions ...
calculate discountedPrice Token count is rounded down. Sent ETH should be multiples of baseTokenPrice.
function calculateTokens(uint investment, uint timestamp) public constant returns (uint) { discountedPrice = (baseTokenPrice * 1000) / getBonus(timestamp); return investment / discountedPrice; }
12,809,886
pragma solidity ^0.4.24; import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; import "openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; import "@evolutionla...
double check burn token after receiving it remember give address(this) authority to burn
function tokenFallback(address _from, uint _amount, bytes _data) public { if (msg.sender == address(ring)) { return; } if (registeredToken[msg.sender] == true) { IBurnableERC20(msg.sender).burn(address(this), _amount); } }
12,534,848
./full_match/42/0x963178bE123906DFB0EE1BBaA3441bFc27E48326/sources/contracts/FREther.sol
Sender repays their own borrow Reverts upon any failure/
function repayBorrow(uint borrowId) external payable { (uint err,) = repayBorrowInternal( borrowId); requireNoError(err, "repayBorrow failed"); }
16,272,142