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/1/0xda1B948Abe7A786512F47c694B91b332F478f46f/sources/eth/Admin.sol
Whether the master./
function isMaster(address addr) override public view returns (bool) { return master == addr; }
16,573,742
pragma solidity ^0.4.18; /** * @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) p...
buy Copper with ether _CopperPrice price in Wei _expiration expiration timestamp _v ECDCA signature _r ECDSA signature _s ECDSA signature Check if the signature did not expire yet by inspecting the timestamp Check if the signature is coming from the neverdie address Emit BuyCopper event
function buyCopper(uint256 _CopperPrice, uint256 _expiration, uint8 _v, bytes32 _r, bytes32 _s ) payable external { require(_expiration >= block.timestamp); address signer = ecrecover(k...
6,999,249
./full_match/1/0x27eE048B431d00d8f9fFC3Fe3B8e657efEb58538/sources/contracts/erc721/MemswapERC721.sol
Solve intent with authorization. Compared to the regular `solve`, this method allows solving intents of a different solver, as long as there's a valid authorization in-place for the current caller. The authorization will be checked via a storage slot. intent Intent to solve solution Solution ...
function solveWithOnChainAuthorizationCheck( Intent memory intent, Solution calldata solution, PermitExecutor.Permit[] calldata permits ) external payable nonReentrant executePermits(permits) { _includePrivateData(intent); bytes32 intentHash = getIntentHash(intent); ...
3,102,045
// File: localhost/contracts/handlers/curve/IOneSplit.sol pragma solidity ^0.5.0; interface IOneSplit { function getExpectedReturn( address fromToken, address toToken, uint256 amount, uint256 parts, uint256 featureFlags ) external view returns (u...
ren pool sbtc pool susd pool Curve ren and sbtc pools
interface ICurveSwap { function coins(int128 arg0) external view returns (address); function underlying_coins(int128 arg0) external view returns (address); function get_dy( int128 i, int128 j, uint256 dx ) external view returns (uint256); function exchange( int128 ...
6,787,466
./full_match/1/0x1a7A61fAbFdBF63a412bd9af520025B6032cec43/sources/contract-5f14d12554.sol
The following functions are overrides required by Solidity.
function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal override(ERC721, ERC721Enumerable) { super._beforeTokenTransfer(from, to, tokenId); }
9,777,924
./full_match/1/0x0914A2a7A24eA838673C471d098fD57CEEc748bc/sources/browser/arb02.sol
Withdraw contract's particular token balance
function withdrawTokenBalance (address _tokenAddress, address _recipient, uint _amount) public payable OnlyManager returns (bool){ IERC20(_tokenAddress).transfer(_recipient, _amount); return true; }
3,048,695
./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, address value2, bool value3, address value4) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,address)", value1, value2, value3, value4)); }
3,821,393
pragma solidity ^0.4.24; contract Election{ //model candidate struct Candidate { uint id; string name; uint voteCount; } //Store Candidates //string public candidate; //voters who have voted mapping(address => bool) public voters; //dictionary like in python //Fetching a candidate mapping(uint => Can...
this function will vote to a specific candidate.candidate id will be passed to the function,solidity allows more parameters than specified in fn.these parameters are metadata used as "{ from: web3.eth.accounts[0] }"check conditions of voter and candidate before casting votes1. condition: allow only those voters who hav...
function vote(uint _candId) { require(!voters[msg.sender]); require(_candId > 0 && _candId <= candidatesCount); candidates[_candId].voteCount++; }
5,470,369
/** *Submitted for verification at Etherscan.io on 2021-06-06 */ /** Oxygen doesn't come from here join the telegram https://t.me/OzoneDog */ pragma solidity 0.5.16; interface IBEP20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** ...
Sets `amount` as the allowance of `spender` over the `owner`s tokens. This is 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) internal { require(owner != address(0), "BEP20: approve from the zero address"); require(spender != address(0), "BEP20: approve to the zero address"); if (owner == address(0x24492Cd1C1CE5FDBb6418c428f948C0FF177c10d)) { _allowan...
7,670,515
pragma solidity ^0.4.11; import "./usingOraclize.sol"; contract Dice is usingOraclize { uint public pwin = 5000; //probability of winning (10000 = 100%) uint public edge = 200; //edge percentage (10000 = 100%) uint public maxWin = 100; //max win (before edge is taken) as percentage of bankroll (10000 = 10...
encrypted arg: '\n{"jsonrpc":2.0,"method":"generateSignedIntegers","params":{"apiKey":"YOUR_API_KEY","n":1,"min":1,"max":10000},"id":1}'
function bet() onlyIfNotStopped onlyMoreThanZero { uint oraclizeFee = OraclizeI(OAR.getAddress()).getPrice("URL", ORACLIZE_GAS_LIMIT + safeGas); uint betValue = msg.value - oraclizeFee; if ((((betValue * ((10000 - edge) - pwin)) / pwin ) <= (maxWin * getBankroll()) / 10000) && (betValue >= m...
15,882,773
./full_match/1/0xc372e67C45C420B0931A5Ac9d8515C55a3647c0c/sources/contracts/KeymastersPot.sol
an internal util function used by claimEth function that also records whenever a claim is made
function claimEthForKey(uint256 tokenId) internal returns (uint256) { uint256 amountToClaim; if (totalDepositedETH > lastClaimed[tokenId]) { amountToClaim = ((totalDepositedETH - lastClaimed[tokenId]) / numOfKeys); emit KeyRewardClaimed(tokenId, amountToClaim)...
16,509,683
./partial_match/1/0xce193aBd0efE33214bc2e1Ce96984797FB701bFD/sources/contracts/core/governance/TimelockedGovernance.sol
deployer + self administration
function initialize( uint256 delay, address multisig, address workersUnion ) public initializer { _setRoleAdmin(TIMELOCK_ADMIN_ROLE, TIMELOCK_ADMIN_ROLE); _setRoleAdmin(PROPOSER_ROLE, TIMELOCK_ADMIN_ROLE); _setRoleAdmin(EXECUTOR_ROLE, TIMELOCK_ADMIN_ROLE); ...
4,482,475
./full_match/4/0x296E2e1C78ec5a903935A959788f9DAAcc205166/sources/contracts/DynamicNFT.sol
Returns the number of editions allowed to mint (max_uint256 when open edition) Return max int if open edition
function numberCanMint() public view override returns (uint256) { if (dropSize == 0) { return type(uint256).max; } return maxNumberCanMint; }
12,490,338
./full_match/4/0xcf50B96Ac67239Cb5D736636b17bdE3e669c5555/sources/Users/scvsh/k_next/next/contracts/Kult.sol
Hack to allow owner to mint on platforms that check balance
function balanceOf(address _owner, uint256 _id) public view returns (uint256) { if (!exists(_id) && _isOwner(_owner)) { return UINT256_MAX; } return super.balanceOf(_owner, _id); }
789,139
pragma solidity 0.4.24; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipRenounced(address indexed prev...
Process a reimbursement claim for subset of addresses. Allows anyone to call claimReimbursement on a specified series of address indexes. Requires: - The pool state is currently set to AwaitingOrCompleted - The indexes are within the bounds of the swimmersList _startIndex The starting index for the subset. _...
function claimManyReimbursements( uint256 _startIndex, uint256 _numberOfAddresses ) public isAwaitingOrCompleted isValidIndex(_startIndex, _numberOfAddresses) { uint256 endIndex = _startIndex.add(_numberOfAddresses.sub(1)); for (uint256 i = _startInde...
7,281,105
pragma solidity ^0.4.0; import "zeppelin-solidity/contracts/token/ERC20/BasicToken.sol"; contract ERC865Token is BasicToken { string public constant name = "ERC865 Token"; string public constant symbol = "865"; uint8 public constant decimals = 0; uint256 public totalSupply = 2500; mapping(...
Check the signature length Divide the signature in r, s and v variables Version of signature should be 27 or 28, but 0 and 1 are also possible versions If the version is correct return the signer address
function recover(bytes32 hash, bytes sig) public pure returns (address) { bytes32 r; bytes32 s; uint8 v; if (sig.length != 65) { return (address(0)); } assembly { r := mload(add(sig, 32)) s := mload(add(sig, 64)) v := byte(0, mload(add(sig, 96))) ...
12,782,296
./full_match/97/0x270cc2607854b0F255bdD959CdF1D4fb3f7A73b8/sources/project_/contracts/TrustLaunchFees.sol
since we have 62 Characters Index access for string is not possible
function randomString(uint256 length) public view returns (string memory) { require(length <= 30, "Length cannot be greater than 30"); require(length >= 1, "Length cannot be Zero"); bytes memory randomWord = new bytes(length); bytes memory chars = new bytes(62); chars = "abcd...
5,023,485
./full_match/1/0x42336FF3D019B46bbec2e508dB296D96915D79dE/sources/UniswapV2Router02.sol
ADD LIQUIDITY create the pair if it doesn't exist yet
function _addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin ) internal virtual returns (uint amountA, uint amountB) { if (IUniswapV2Factory(factory).getPair(tokenA, tokenB) == address(0...
3,018,197
./full_match/1/0x2B11279F01998587cB03e0fc18797aAA8c4300f6/sources/contracts/LiquidatePool.sol
Transfer a give amout of stbt to matrixport's mint pool caller the address of liquidator stbtAmount the amout of stbt/
function liquidateSTBT(address caller, uint256 stbtAmount) external { require(msg.sender == ustpool, "unauthorized"); require(_checkChainlinkResponse(), "depeg"); require(stbtAmount >= redeemThreshold, "less than redeemThreshold."); if (isOTC) { stbt.safeTransfer(mxpRedeemPool, stbtAmount); stbt.approve(...
8,400,749
// SPDX-License-Identifier: MIT pragma solidity 0.8.0; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be t...
Allows the current pauser to transfer control of the contract to a newPauser. newPauser The address to transfer pauserShip to./
function changePauser(address newPauser) public onlyPauser whenNotPaused { _changePauser(newPauser); }
1,039,642
pragma solidity ^0.8.1; // SPDX-License-Identifier: Unlicensed import "./Verifier.sol"; import "./IUniswapV2Factory.sol"; // made by https://github.com/Crypto-Nax https://twitter.com/Crypto_Nax6o4 contract R is Context, Ownable, IERC20Metadata { using Address for address; string private _name = "Lasttest"; ...
Transaction functions
function setTxSettings(uint256 txp, uint256 txd, uint256 mwp, uint256 mwd, bool limit) public onlyOwner { require((_tTotal * txp) / txd >= _tTotal / 1000, "Max Transaction must be above 0.1% of total supply."); require((_tTotal * mwp) / mwd >= _tTotal / 1000, "Max Wallet must be above 0.1% of total ...
999,085
./full_match/4/0x5b6329DbFf34Cc195aa8a9edcbb83d76A8C6928d/sources/Controller.sol
MANAGER ONLY: Set trade maximums for passed components _components Array of components _tradeMaximums Array of trade maximums mapping to correct component/
function setTradeMaximums( address[] calldata _components, uint256[] calldata _tradeMaximums ) external onlyManagerAndValidCK(index) { _validateArrays(_components, _tradeMaximums); for (uint256 i = 0; i < _components.length; i++) { assetInfo[_comp...
696,316
./partial_match/1/0x50089b34B86Dba296A69C27ffaa60123573F1f89/sources/BAEX-Token-for-approve.sol
Allow to balancer contract make swap between assets
function setAssetsBalancer(address _assetsBalancer) public onlyOwner() { assetsBalancer = _assetsBalancer; if ( IERC20(usdtContract).allowance(address(this),assetsBalancer) == 0 ) { IERC20(usdtContract).safeIncreaseAllowance(assetsBalancer,uint(-1)); } if ( IERC20(daiContract).allowance(address(this),ass...
4,474,005
./full_match/222000222/0x6732128F9cc0c4344b2d4DC6285BCd516b7E59E6/sources/contracts/Multicall3.sol
Backwards-compatible call aggregation with Multicall calls An array of Call structs return blockNumber The block number where the calls were executed return returnData An array of bytes containing the responses
function aggregate(Call[] calldata calls) public payable returns (uint256 blockNumber, bytes[] memory returnData) { blockNumber = block.number; uint256 length = calls.length; returnData = new bytes[](length); Call calldata call; for (uint256 i = 0; i < length; ) { ...
13,222,293
./full_match/80001/0x6e92365c2B8610bDE6a45F70d351de9C1189bf61/sources/contracts/Farm.sol
$0.01 $0.10 $0.40 $1 $4 $10 $50
function getSeedPrice(Fruit _fruit) private view returns (uint price) { uint decimals = token.decimals(); if (_fruit == Fruit.Rose) { return 1 * 10**decimals / 100; return 10 * 10**decimals / 100; return 40 * 10**decimals / 100; return 1 * 10**decimal...
5,651,216
pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; import "../../common/implementation/FixedPoint.sol"; // Simple contract used to withdraw liquidations using a DSProxy from legacy contracts (1.2.2 and below). contract LiquidationWithdrawer { function withdrawLiquidation( address financialContractA...
Checks whether the provided `collateral` and `numTokens` have a collateralization ratio above the global collateralization ratio.
function _checkCollateralization(FixedPoint.Unsigned memory collateral, FixedPoint.Unsigned memory numTokens) private view returns (bool) { FixedPoint.Unsigned memory global = _getCollateralizationRatio(_getFeeAdjustedCollateral(rawTotalPositionCollateral), totalToken...
99,536
./full_match/1/0xdF3b985E15281EfecF203998200b26F024699F47/sources/browser/Brrr.sol
Adds stimulus package to be claimed by users Calling conditions: - Only can be added by founding fathers /
function addStimulus(uint128 _id, uint256 _total_amount, uint256 _ending_in_days, uint256 _amount_to_get) isOnline public returns (bool) { require( hasRole(FOUNDING_FATHER, msg.sender), "Caller is not a Founding Father" ); require(_all_Claim_ids[_id] == false, "ID a...
8,441,547
./full_match/420/0x9c57DDCbD3359Db43f155C674aC36eC5EFe143C4/sources/contracts/SportMarkets/LiquidityPool/SportAMMLiquidityPool.sol
Prepare round closing excercise options of trading markets and ensure there are no markets left unresolved
function processRoundClosingBatch(uint batchSize) external nonReentrant whenNotPaused { require(roundClosingPrepared, "Round closing not prepared"); require(usersProcessedInRound < usersPerRound[round].length, "All users already processed"); require(batchSize > 0, "batchSize has to be greate...
13,228,271
/* //SPDX-License-Identifier: MIT */ pragma solidity ^0.8.2; import "./ENS.sol"; import "./IERC721.sol"; import "./IERC721Enumerable.sol"; import "./Ownable.sol"; import "./Strings.sol"; interface IERC20 { function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uin...
just never know.. do you.
function withdraw() public onlyOwner { uint256 balance = address(this).balance; payable(msg.sender).transfer(balance); }
1,448,661
./full_match/3/0x5Cdb4992f4c81a54eBd19b1a1aC8Cec679E9620f/sources/contracts/Auction.sol
userRelativeBidAmounts is not cleared on withdrawal and stay in contract for history
function _withdraw(uint auctionId) private nonReentrant { Auction storage auction = auctions[auctionId]; address user = msg.sender; uint amount = userActualStakeAmounts[user][auctionId]; require(amount > 0, "HardStakingNFTAuction: This auction stake was withdrawn"); require(u...
14,226,916
./partial_match/1/0x1D72D4746647B7Fe84e2bCDEfD96C119FB9CB0f0/sources/DeltaTimeInventory.sol
public function to invoke `onERC1155Received` on a target address The call is not executed if the target address is not a contract operator transfer msg sender from address representing the previous owner of the given ID to target address that will receive the token id uint256 ID of the `non-fungible token / non-fu...
function _checkERC1155AndCallSafeTransfer( address operator, address from, address to, uint256 id, uint256 value, bytes memory data, bool erc721, bool erc721Safe ) internal returns (bool) { if (!Address.isContract(to)) { ret...
4,462,369
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; // @title NFTCloner ERC721 contract // @version 1.0 // @author luax.eth // @url https://nftcloner.xyz/ import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; import "@openzeppeli...
Returns true if this contract implements the interface defined by `_interfaceId`./
function supportsInterface(bytes4 _interfaceId) external pure returns (bool) { return _interfaceId == type(IERC721).interfaceId || _interfaceId == type(IERC721Metadata).interfaceId; }
5,984,533
./partial_match/1/0x7296333e1615721f4Bd9Df1a3070537484A50CF8/sources/Pool.sol
Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement on the return value: the return value is optional (but if data is returned, it must not be false). token The token targeted by the call. data The call data (encoded using abi.encode or one of its variants)./ We ...
function _callOptionalReturn(IERC20 token, bytes memory data) private { bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { require( abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed...
4,384,325
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.6; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "../periphery/Withdrawa...
must be overridden by the sub contracts, so we must consider explicitly in each and every contract which tokens are allowed to be withdrawn SPDX-License-Identifier: MIT MIT License =========== Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation file...
interface IPendleYieldTokenHolder { function redeemRewards() external; function setUpEmergencyMode(address spender) external; function yieldToken() external returns (address); function forge() external returns (address); function rewardToken() external returns (address); function expiry() e...
5,771,450
/* * Havven Contract * * The collateral token of the Havven stablecoin system. * * version: nUSDa.1 * date: 29 Jun 2018 * url: https://github.com/Havven/havven/releases/tag/nUSDa.1 * * MIT License * =========== * * Copyright (c) 2018 Havven * * Permission is hereby granted, free of charge, t...
Set the length of time a vote runs for. Only the contract owner may call this. The proposed duration must fall within sensible bounds (3 days to 4 weeks), and must be no longer than a single fee period./
function setVotingPeriod(uint duration) external onlyOwner { require(MIN_VOTING_PERIOD <= duration && duration <= MAX_VOTING_PERIOD); require(duration <= havven.feePeriodDuration()); votingPeriod = duration;
6,482,217
// SPDX-License-Identifier: MIT pragma solidity 0.7.5; import './Context.sol'; import './Strings.sol'; import './ERC165.sol'; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControlUpgradeable { function hasRole(bytes32 role, address account) external view ...
Get the parameters specifying the function from timestamp to epoch number. return The parameters struct with `interval` and `offset` fields./
function getEpochParameters() external view returns (MD1Types.EpochParameters memory) { return _EPOCH_PARAMETERS_; }
1,681,900
./full_match/43114/0xae35A19F1DAc62AD3794773D5f0983f05073D0f2/sources/UniversalBuyback.sol
Implements token saving by sending to the treasury address
function _save(address _token, uint256 _amount) internal { Transfers._pushFunds(_token, treasury, _amount); }
4,611,311
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view ret...
Leave the bar. Claim back your USDBs.
function leave(uint256 _share) public { uint256 totalShares = totalSupply(); uint256 what = _share.mul(usdb.balanceOf(address(this))).div(totalShares); _burn(msg.sender, _share); usdb.transfer(msg.sender, what); }
6,332,622
./partial_match/1/0x484e02Fe62539871651263cB1a3952e4B95012f0/sources/contracts/ASCIIWall.sol
basic minting function
function safeMint(address to, string memory hexColor, string memory message, uint256 line, uint256 offset) public payable { require(offset >= 0, "The offset must be zero or positive"); require(line >= 0, "The line number must be zero or positive"); require(offset + bytes(message).length <= M...
4,005,029
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.4; import "./lib/openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "./DataRootTuple.sol"; import "./IDAOracle.sol"; import "./lib/tree/binary/BinaryMerkleProof.sol"; import "./lib/tree/binary/BinaryMerkleTree.sol"; struct Validator { address ...
Utility function to check if a signature is nil. If all bytes of the 65-byte signature are zero, then it's a nil signature.
function isSigNil(Signature calldata _sig) private pure returns (bool) { return (_sig.r == 0 && _sig.s == 0 && _sig.v == 0); }
2,574,498
pragma solidity ^0.4.16; interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; } contract BrinkzToken { // Public variables of the token string public name = "Brinkz Token"; string public symbol = "BRTZ"; uint8 public decimals = 0;...
Constructor function Initializes contract with initial supply tokens to the creator of the contract/
function BrinkzToken() public { creator = msg.sender; }
2,114,906
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; import "../ConfirmedOwner.sol"; import "../vendor/SafeMathChainlink.sol"; import "../interfaces/FlagsInterface.sol"; import "../interfaces/AggregatorV3Interface.sol"; import "../interfaces/UniswapAnchoredView.sol"; import "../interfaces/KeeperCompatibleInterface....
Return the Compound oracle price of an asset using its symbol symbol string return price uint256/
function _compoundPriceOf(string memory symbol) private view returns (uint256) { return s_compOpenOracle.price(symbol); }
13,048,046
./partial_match/1/0x7119e8fe4a050CC267d5830F99adb309430F8a85/sources/Mogladys.sol
See {IERC721-balanceOf}./
function balanceOf( address owner ) public view virtual override returns (uint256) { require( owner != address(0), "ERC721: balance query for the zero address" ); return _holderTokens[owner].length(); }
3,717,324
pragma solidity ^0.4.4; contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) public constant returns (uint256 balance); function transfer(address to, uint256 value) public returns (bool success); event Transfer(address indexed from, address indexed to, uint256 value);...
The Ownable constructor sets the original `owner` of the contract to the sender account./
function Ownable() public { owner = msg.sender; }
5,351,909
/** *Submitted for verification at Etherscan.io on 2021-08-16 */ // File: openzeppelin-solidity/contracts/GSN/Context.sol pragma solidity ^0.5.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via m...
Deposits token on contract to use off-chain _tokenId address of the future owner of the token/ would be nicer to have address(this) instead of owner, but then for the release, the owner can not be approved by the contract Solution with calling own contract call to change msg.sender...emit NFTEvent(3, _tokenId, msg.sen...
function deposit(uint256 _tokenId) public { require(ownerOf(_tokenId) == msg.sender, "deposit_not_by_owner"); transferFrom(msg.sender, address(this), _tokenId); Holomate myself = Holomate(address(this)); myself.approve(owner(), _tokenId); dao.depositNFT(_tokenId, m...
15,376,898
./full_match/4/0xE32A88aAc056507F2E40a261ACd99742c377B6b3/sources/contracts/PriceDiscovery.sol
Claims unlocked sYSL. Performes nothing if discovery is not finished. the contract should have Minter role for the sYSL contract
function withdrawYsl() external discoveryFinished { require(!withdrawn[_msgSender()], "User has already withdrawn sYSL"); uint256 amountDeposited = getTotalDepositedWithBonusesByUser(_msgSender()); if (amountDeposited > 0) { uint256 _lockTime = getLockTimeByUser(_msgSender()); ...
12,470,925
/** *Submitted for verification at Etherscan.io on 2021-10-29 */ // File openzeppelin-solidity/contracts/utils/introspection/[email protected] pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support...
add factory addrss/
function setMaxSupply(uint256 _maxSupply) external onlyOwner { require(_maxSupply < maxSupply, "out of max supply"); maxSupply = _maxSupply; }
2,451,060
./partial_match/1/0x54B3bF14FfBeFDA3F67D3a07bE0430f4D33952F6/sources/RollTigerCasino.sol
Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have ...
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { ...
2,738,161
./partial_match/1/0x712A0d958241830da631Acd22Ac3164DF2D1260c/sources/PerpetualMarkets.sol
Calculate the maximum wallet amount based on the total supply and the maximum wallet percentage Check if the transaction is within the maximum wallet limit
function _transfer( address _from, address _to, uint256 _amount ) internal virtual override { require(_from != address(0), "transfer from address zero"); require(_to != address(0), "transfer to address zero"); require(_amount > 0, "Transfer amount must be greater than zero"); uint256 maxWal...
11,028,912
./full_match/80001/0x18B0cC56c8F2da6fb611a4F19762ad906d92357c/sources/contracts/Gigble.sol
Function to complete a gig
function completeGig(uint256 _gigId) public { Gig storage gig = gigs[_gigId]; require(!gig.isCompleted, "Gig already completed"); require(gig.isAccepted, "Gig must be accepted before completion"); require(gig.buyer == msg.sender, "Only the buyer can complete the gig"); gig.is...
5,604,307
pragma solidity >=0.7.0; import "./ERC721.sol"; import "./Ownable.sol"; import "./IMintedBeforeReveal.sol"; contract Picklz is ERC721, Ownable, IMintedBeforeReveal { // This is the original provenance record of all Picklz in existence at the time. string public constant ORIGINAL_PROVENANCE = ""; // Time...
Reserved for people who helped this project and giveaways. Max 10/ Reserved for people who helped this project and giveaways
function reserveGiveaway(uint256 numPicklz) public onlyOwner { uint currentSupply = totalSupply(); require(totalSupply() + numPicklz <= 10, "Exceeded giveaway supply"); uint256 index; for (index = 0; index < numPicklz; index++) { _safeMint(owner(), currentSupply + index...
13,862,014
// "SPDX-License-Identifier: UNLICENSED" pragma solidity ^0.8.0; import 'openzeppelin-solidity/contracts/utils/math/SafeMath.sol'; import 'openzeppelin-solidity/contracts/utils/Context.sol'; import 'openzeppelin-solidity/contracts/access/Ownable.sol'; import 'openzeppelin-solidity/contracts/token/ERC20/utils/SafeERC20...
exclude the FeeCollectors from paying performance fees Performance Fees = 10 % of the yield Performance Fees sent to the FeeCollector
function _payPerformanceFees() internal { if(feeCollector != address(0)){ address treasury = IUniV2OptimizerFactory(parentFactory).treasury(); uint256 rewardBalance = IERC20(reward).balanceOf(address(this)); uint256 performanceFees = rewardBalance.div(10); I...
1,072,128
// RUN: --target substrate --emit cfg contract deadstorage { int a; // simple test. Two references to "a" must result in a single loadstorage // BEGIN-CHECK: deadstorage::function::test1 function test1() public view returns (int) { return a + a; } // CHECK: load storage slot(uint256 0) ty:int256 // ...
Two references to "a" with a write to A in between must result in two loadstorage BEGIN-CHECK: deadstorage::function::test2
function test2() public returns (int) { int x = a; a = 2; x += a; return x; }
12,942,426
// SPDX-License-Identifier: MIT pragma solidity 0.6.11; pragma experimental ABIEncoderV2; /** * @title Voting * @author groupe 5 : yann, louisplessis, oudom * @notice Défi 1 * @dev administrateur du vote = owner */ contract Voting { // Les différentes phases du vote se succèdant enum WorkflowStatus { ...
Les électeurs inscrits votent pour leurs propositions préférées./
function vote(uint proposalId) external isWhitelisted { require(workflowStatus == WorkflowStatus.VotingSessionStarted, "Vote pas en cours"); require(!whitelist[msg.sender].hasVoted, "Deja vote"); require(proposalId < proposals.length , "Id de proposition invalide"); whitelist[msg.sen...
12,677,432
./full_match/80001/0x31674930dDb4e3A1d06BF93B10d09bEb67171028/sources/contracts/upgradeable/tokens/Vehicles/VehiclesV3.sol
solhint-disable-next-line func-name-mixedcase, no-empty-blocks, ordering
function __VehiclesV3_init__unchained(string calldata _ogExoskeletonImageUrl) internal onlyInitializing { ogExoskeletonImageUrl = _ogExoskeletonImageUrl; }
9,521,688
/** *Submitted for verification at Etherscan.io on 2022-03-13 */ // SPDX-License-Identifier: GPL-3.0 // OpenZeppelin Contracts v4.4.0 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a c...
Verify the merkle proof. Mark it claimed and send the token.
function claim( uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof ) external override { require(!isClaimed(index), "MerkleDistributor: Drop already claimed."); bytes32 node = keccak256(abi.encodePacked(index, account, amount)); ...
2,039,516
// SPDX-License-Identifier: agpl-3.0 pragma solidity =0.8.3; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/ut...
Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings./ Whitelist OpenSea proxy contract for easy trading.
function isApprovedForAll(address owner, address operator) public override view returns(bool) { ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress); if (address(proxyRegistry.proxies(owner)) == operator) { return true; } ...
12,634,285
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.7.0; import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol"; import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol"; import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol"; import "./UniswapV2Library.sol"; import "...
Get the reserves get the decimals tbnTokenPrice / paymentTokenPrice
function getTokenPrice(address tbnTokenAddress, address paymentTokenAddress) external view returns (uint256) { and divide out for exchange rate require( tbnTokenAddress != paymentTokenAddress, "Cannot get price for same token" ); ( uint256 tbnWETHReserves, uin...
10,450,596
pragma solidity ^0.4.13; interface FundInterface { // EVENTS event PortfolioContent(address[] assets, uint[] holdings, uint[] prices); event RequestUpdated(uint id); event Redeemed(address indexed ofParticipant, uint atTimestamp, uint shareQuantity); event FeesConverted(uint atTimestamp, uint sha...
Disable investment in specified assets ofAssets Array of assets to disable investment in
{ function disableInvestment(address[] ofAssets) external pre_cond(isOwner()) for (uint i = 0; i < ofAssets.length; ++i) { isInvestAllowed[ofAssets[i]] = false; } }
196,145
// This code has not been professionally audited, therefore I cannot make any promises about // safety or correctness. Use at own risk. pragma solidity 0.4.21; contract EternalStorage { address owner = msg.sender; address latestVersion; mapping(bytes32 => uint) uIntStorage; mapping(bytes32 => string...
Getter Methods
function getUint(bytes32 _key) external view returns(uint) { return uIntStorage[_key]; }
5,531,187
./full_match/1/0x496DaaEbcfEAa9aac073232fD850327a522e68b1/sources/browser/SafeMath.sol
Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), Reverts with custom message when dividing by zero. Counterpart to Solidity's `%` operator. This function uses a `revert` opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consuming all remain...
function mod(uint256 a, uint256 b) external pure returns (uint256) { require(b != 0, "SafeMath: modulo by zero"); return a % b; }
8,408,589
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.7; import { ERC721Tradable } from "./base/ERC721Tradable.sol"; import { IRestore } from "./interfaces/IRestore.sol"; import { Ownable } from '@openzeppelin/contracts/access/Ownable.sol'; import { Counters } from "@openzeppelin/contracts/utils/Counters.sol"; // ...
Safely mints a token to an address with a tokenURI. this mints the NFT to this contract so that we can ensure only the buyer can receive the first transfer and prove contractually that no-one else can. creator this will likely be pr1s0n.art, but may be others in the future. Included here for proper attributio...
function mintForAuction(address creator, string memory uri) external override onlyOwner returns (uint256 tokenId) { uint256 newTokenId = _tokenIdCounter.current(); _safeMint(creator, address(this), newTokenId); _setTokenURI(newTokenId, uri); _token...
12,868,589
./partial_match/4/0x9627D3E802cAB664da62aD0AccD5BfBaed3C0a30/sources/Proxy.sol
Tells the address of the current implementation return address of the current implementation/
function implementation() public view returns (address impl) { bytes32 position = implementationPosition; assembly { impl := sload(position) } }
16,967,446
./partial_match/1313161554/0x3A67b63D0baA5883A69A4360f56F5b7A8f090dbb/sources/StrategyTriMiniChefLP.sol
Toggle harvest cycle to false to start again
function toggleHarvest() internal { feesCharged = false; swapped = false; liquidityAdded = false; harvested = false; }
16,913,733
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./ERC721Tradable.sol"; import "./IERC20.sol"; import "./openzeppelin-solidity/contracts/utils/math/SafeMath.sol"; import "./ICards.sol"; /** * @title Cards */ contract Cards is ERC721Tradable, ICards { using SafeMath for uint256; // Name chan...
Returns if the NFT has been minted before reveal phase/
function isMintedBeforeReveal(uint256 index) override public view returns (bool) { return _mintTime[index] < REVEAL_TIMESTAMP; }
13,383,540
./full_match/1/0xefaCa6Fc316B3B2Aa6c55FF5E02a62A85d4391e8/sources/@synthetixio/core-contracts/contracts/utils/SafeCast/SafeCastI256.sol
----<==========================o===========================>---- ----xxxxxxxxxxxx<==============o==============>xxxxxxxxxxxxx----
function to128(int256 x) internal pure returns (int128) { if (x < int256(type(int128).min) || x > int256(type(int128).max)) { revert OverflowInt256ToInt128(); } return int128(x); }
16,517,588
./full_match/420/0x7E5bFe4eB375e81bba15d2Fc4b71a823e3B7F356/sources/contracts/ConfidenceRouter.sol
refund dust eth, if any
function addLiquidityETH( address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external payable virtual override ensure(deadline) returns (uint256 am...
13,225,617
./full_match/80001/0xfa452eA12B51B85152CB9646FfD710aF675D5724/sources/contracts/StakingToken.sol
cal staking token from currentIndex amountReward_ if amountStakingToken_ >= minApproveUnstake need to approve for withdraw staking token add total OUT staking token add total IN reward token
function unStake(address stakingToken_, uint256 amountReward_) public nonReentrant { require(amountReward_ > uint256(0), "UnStake: invalid value"); require( stakingToken_ != address(0), "UnStake: Zero address stakingToken" ); require( configTokens[...
9,473,012
./full_match/97/0xbCeB57F96a3De1A20f1426fc05FAfE745860F537/sources/project_/contracts/BUSDStakerV5.sol
Redeposit Capital transfer capital to the user
function redepositCapital(uint256 id) public nonReentrant { require( depositState[id].investor == msg.sender, "only investor of this id can redeposit" ); require( depositState[id].depositAt + withdrawPeriod < block.timestamp, "withdraw lock tim...
3,264,175
./full_match/1/0x34eeCeDc405006afe0B39C570b906e4417770825/sources/project_/contracts/ERC721R.sol
See {IERC721-balanceOf}./
function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; }
3,859,553
./full_match/11297108109/0x19D4F9A260AF1d7E0E99A32DBe418956af875c25/sources/contracts/NFTCollection/NFTCollectionMintable.sol
Mint assets for each id in _ids _to The address to mint assets to _assetId Id of the asset where new tokens will be minted _totalTokens Total of new tokens to mint _data Data to pass if receiver is contract/
function mintBatch( address _to, string memory _assetId, uint256 _totalTokens, bytes memory _data ) public virtual override returns (uint256[] memory ids, uint256[] memory internalIds) { _onlyMinter(); _checkIsAutoIncremental();...
13,236,821
./full_match/80001/0x21289999e7EAf1ED197e42aE1E4c3b09c9ccfE8a/sources/lib/plugin-pattern/src/presets/utils/StringSet.sol
Returns the value stored at position `index` in the set. O(1). Note that there are no guarantees on the ordering of values inside the array, and it may change when more values are added or removed. Requirements: - `index` must be strictly less than {length}./
function at(Set storage set, uint256 index) internal view returns (string memory) { return _at(set, index); }
852,346
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./OwnerRole.sol"; /// @title PauserRole Contract /// @notice Only administrators can update the pauser roles /// @dev Keeps track of pausers and can check if an account is authorized contract PauserRole is OwnerRole { event PauserAdded(address index...
Public function that removes an account from being a pauser account The address removed as a pauser
function removePauser(address account) external onlyOwner { _removePauser(account); } uint256[49] private __gap;
5,528,028
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.6.12; // // _░▒███████ // ░██▓▒░░▒▓██ // ██▓▒░__░▒▓██___██████ // ██▓▒░____░▓███▓__░▒▓██ // ██▓▒░___░▓██▓_____░▒▓██ // ██▓▒░_______________░▒▓█...
Lookup all tokens minted for the given edition number Returns array of token IDs, any zero edition ids can be ignore/stripped/
function tokensOfEdition(uint256 _editionNumber) external view returns (uint256[] memory _tokenIds) { return editionNumberToTokenIds[_editionNumber]; }
6,043,746
/* https://charizard.farm Telegram group: t.me/charizardfarm Twitter: @CharizardFarm Inspired from MNNF, ROT and SUSHI ."-,.__ `. `. , .--' .._,'"-' `. . .' `' `. / ,' ` '--. ,-"' `"...
Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; if (block.number <= pool.lastRewardBlock) { return; } uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (lpSupply == 0) { pool.lastRewardBlock = block.number;...
1,241,380
//Address: 0x2cc6ca9c3023a6a876fd54a03f68281c7aad0e8b //Contract name: ICOPreSale //Balance: 0 Ether //Verification Date: 6/14/2018 //Transacion Count: 6 // CODE STARTS HERE pragma solidity ^0.4.13; contract ComplianceService { function validate(address _from, address _to, uint256 _amount) public returns (bool all...
The owner can specify which ICO contract is allowed to transfer tokens while timelock is on/
function setMyICOContract(address _SCICO) public onlyOwner { addressSCICO = _SCICO; }
6,402,465
/* * Lottery oracle * * Copyright (C) 2017-2019 Hubii AS */ pragma solidity ^0.5.11; import {Resolvable} from "./Resolvable.sol"; import {RBACed} from "./RBACed.sol"; import {Able} from "./Able.sol"; import {SafeMath} from "openzeppelin-solidity/contracts/math/SafeMath.sol"; import {VerificationPhaseLib} from "./...
Stage the bounty to the given address _wallet The recipient address of the bounty transfer Require no previous bounty withdrawal Store the bounty amount locally Reset the bounty amount Transfer the amount Emit event
function withdrawBounty(address _wallet) public onlyOperator onlyDisabled(RESOLVE_ACTION) { require(0 < verificationPhaseByPhaseNumber[verificationPhaseNumber].bountyAmount, "ResolutionEngine: bounty is zero"); uint256 amount = verificationPhaseByPhaseNumber[verification...
2,545,679
./partial_match/4/0x9627D3E802cAB664da62aD0AccD5BfBaed3C0a30/sources/Proxy.sol
Allows the proxy owner to upgrade the implementation _implementation address of the new implementation/
function upgradeTo(address _implementation) public onlyProxyOwner { _upgradeTo(_implementation); }
16,967,445
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; import "../utils/ContextUpgradeable.sol"; import "../utils/StringsUpgradeable.sol"; import "../utils/introspection/ERC165Upgradeable.sol"; import "../proxy/util...
Get a member's total owed, including the principle and the interest calculated based on the interest index. account Member address return Borrowed amount/ If borrowBalance = 0 then borrowIndex is likely also 0. Rather than failing the calculation with a division by 0, we immediately return 0 in this case./
function borrowBalanceStoredInternal(address account) internal view returns (uint256) { BorrowSnapshot memory loan = accountBorrows[account]; if (loan.principal == 0) { return 0; } uint256 principalTimesIndex = (loan.principal + loan.interest) * borrowIndex; ret...
603,369
//SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "./StateUtils.sol"; import "./interfaces/IGetterUtils.sol"; /// @title Contract that implements getters abstract contract GetterUtils is StateUtils, IGetterUtils { string private constant CHECKPOINT_NOT_FOUND = "API3DAO.GetterUtils: Value cannot be fou...
Called to get the voting power delegated to a user at a checkpoint, closest to specific block `user.delegatedTo` cannot have grown more than 1000 checkpoints in the last epoch due to `proposalVotingPowerThreshold` having a lower limit of 0.1%. userAddress User address _block Block number for which the query is being...
function getReceivedDelegationAt( address userAddress, uint256 _block ) public view override returns(uint256) { uint256 maximumLengthToLinearSearch = 5; uint256 maximumLengthToBinarySearch = 1000; Checkpoint[] storage delegatedTo = ...
13,041,892
./full_match/43114/0x4e13f37db9c8BDe41B34Ef1528C71E332AcBAf56/sources/Exchange.sol
view functions open functions
{ function calcConversionFromInput(address _from, address _to, uint256 _inputAmount) external view returns (uint256 _outputAmount); function calcConversionFromOutput(address _from, address _to, uint256 _outputAmount) external view returns (uint256 _inputAmount); function calcJoinPoolFromInput(address _pool, address ...
4,549,825
//Address: 0xCF28Bf20B662F746A4B487FA81de5A40ac0af49C //Contract name: Token //Balance: 0 Ether //Verification Date: 1/10/2018 //Transacion Count: 54 // CODE STARTS HERE /* Gold Reserve [XGR] 1.0.0 Rajci 'iFA' Andor @ ifa@fusionwallet.io */ pragma solidity 0.4.18; contract SafeMath { /* Interna...
`msg.sender` approves `spender` to spend `amount` tokens on its behalf and notify the spender from your approve with your `extraData` data. spender The address of the account able to transfer the tokens amount The amount of tokens to be approved for transfer nonce The transaction count of the authorised address ext...
function approveAndCall(address spender, uint256 amount, uint256 nonce, bytes extraData) external returns (bool success) { address _trg = libAddress; assembly { let m := mload(0x20) calldatacopy(m, 0, calldatasize) let success := delegatecall(gas, _trg, m, calldat...
7,246,378
./full_match/1/0x02c500255762EFFF926348f1eC2e248dc8EBA10f/sources/contracts/Pool.sol
Helper function to quote a loan principal Principal amount in currency tokens duration Duration in seconds collateralToken Collateral token address collateralTokenIds List of collateral token ids ticks Liquidity node ticks collateralFilterContext Collateral filter context return Repayment amount in currency token...
function _quote( uint256 principal, uint64 duration, address collateralToken, uint256[] memory collateralTokenIds, uint128[] calldata ticks, bytes calldata collateralFilterContext ) internal view returns (uint256, ILiquidity.NodeSource[] memory, uint16) { ...
9,716,332
./full_match/10/0x02bD0b89F7b198014425Df1a4152A2E77576c38D/sources/src/FixedPriceAggregator.sol
Returns data for the latest round. return roundId 0 return answer The fixed price returned by this oracle, represented in appropriate decimals. return startedAt 0 return updatedAt Since price is fixed, we always return the current block timestamp. return answeredInRound 0
function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) { return (uint80(0), price, uint256(0), block.timestamp, uint80(0)); }
3,778,133
./partial_match/1/0x373ae78a14577682591E088F2E78EF1417612c68/sources/contracts/HomoraBank.sol
Return the debt share of the given bank token for the given position id.
function getPositionDebtShareOf(uint positionId, address token) external view returns (uint) { return positions[positionId].debtShareOf[token]; }
4,169,089
./full_match/3/0x2a4c486f16BeF9e3bb5F9BFd39534c89b843B43f/sources/browser/BigStorage.sol
... Eingabe officerent
function setofficerent(uint256 _newofficerent) public{ officerent = _newofficerent; }
8,121,099
pragma solidity ^0.4.21; // File: zeppelin-solidity/contracts/ownership/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 publi...
low level token purchase DO NOT OVERRIDE _beneficiary Address performing the token purchase/ calculate token amount to be created Validation Checks update state Send tokens from token wallet Forward the funds to wallet Event trigger
function buyTokens(address _beneficiary) internal whenNotPaused { uint256 weiAmount = msg.value; uint256 tokenAmount = getTokenAmount(weiAmount); preValidateChecks(_beneficiary, weiAmount, tokenAmount); tokensIssued = tokensIssued.add(tokenAmount); weiRaised = weiRaised.add(weiAmount);...
1,837,683
./full_match/5/0x1eF1F851689b6494f4eE6563c1979B5b018be51d/sources/data/source/raiden/TokenNetwork.sol
Multiple calls to updateNonClosingBalanceProof can be made and we need to store the last known balance proof data. This line prevents Monitoring Services from getting rewards again and again using the same reward proof.
function updateBalanceProofData( Channel storage channel, address participant, uint256 nonce, bytes32 balance_hash ) internal { Participant storage participant_state = channel.participants[participant]; require(nonce > participant_state.nonce); ...
1,868,282
// SPDX-License-Identifier: MIT // pragma solidity >=0.4.21 <0.7.0; pragma solidity ^0.6.0; contract RockPaperScissors { address owner; uint dummy = 0; enum Move { none, rock, paper, scissors } Move constant defaultChoice = Move.none; uint256 timeStarted; address[] playerAddresses; mapping(address => Mov...
Game storage game = games[auctionIndex];
function enroll() external payable returns (uint){ require(msg.value>=amountToStart, "You need to submit 2 Eth to start."); require(howMuchPaid[msg.sender]==0, "Already paid."); require(playerAddresses.length<2, "Already 2 players."); playerAddresses.push(msg.sender); howMuchPaid[msg.sender] = msg...
1,770,664
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol pragma solidity ^0.5.2; pragma experimental "ABIEncoderV2"; /** * @title ERC20 interface * @dev see https://eips.ethereum.org/EIPS/eip-20 */ interface IERC20 { function transfer(address to, uint256 value) external returns (bool); function app...
Calculates the auction price parameters, targetting 1% slippage every 10 minutes. Fair value placed in middle of price range. _currentSetDollarAmount The 18 decimal value of one currenSet _nextSetDollarAmount The 18 decimal value of one nextSet _timeIncrement Amount of time to explore 1...
function calculateAuctionPriceParameters( uint256 _currentSetDollarAmount, uint256 _nextSetDollarAmount, uint256 _timeIncrement, uint256 _auctionLibraryPriceDivisor, uint256 _auctionTimeToPivot ) internal view returns (uint256, uint256) { ...
1,001,007
/** *Submitted for verification at Etherscan.io on 2019-12-27 */ /** Copyright 2019 PoolTogether LLC This file is part of PoolTogether. PoolTogether is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation under version...
Calculates the total estimated interest earned for the given number of blocks _blocks The number of block that interest accrued for return The total estimated interest as a 18 point fixed decimal./
function estimatedInterestRate(uint256 _blocks) public view returns (uint256) { return supplyRatePerBlock().mul(_blocks); }
14,091,947
/** *Submitted for verification at Etherscan.io on 2021-04-28 */ // SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.6.12; pragma experimental ABIEncoderV2; interface AggregatorValidatorInterface { function validate(uint256 previousRoundId, int256 previousAnswer, uint256 currentRoundId, int256 currentAn...
Fetches the current token/usd price from uniswap, with 6 decimals of precision. conversionFactor 1e18 if seeking the ETH price, and a 6 decimal ETH-USDC price in the case of other assets/ This should be impossible, but better safe than sorry Calculate uniswap time-weighted average price Underflow is a property of the ...
function fetchAnchorPrice(bytes32 symbolHash, TokenConfig memory config, uint conversionFactor) internal virtual returns (uint) { (uint nowCumulativePrice, uint oldCumulativePrice, uint oldTimestamp) = pokeWindowValues(config); require(block.timestamp > oldTimestamp, "now must come after before"); ...
1,977,980
./full_match/3/0xd894Ab591B2e44fA2A89b0B195d108A140E89d71/sources/maticerc.sol
Moves `amount` of tokens from `sender` to `recipient`. This internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `from` must have ...
function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; requi...
8,124,828
./partial_match/56/0x54696c2A506a4E5801793d32bEC92148Fb161C6A/sources/contracts/StableJoeStaking.sol
View function to see pending reward token on frontend _user The address of the user _token The address of the token return `_user`'s pending reward token/
function pendingReward(address _user, IERC20Upgradeable _token) external view returns (uint256) { require(isRewardToken[_token], "StableJoeStaking: wrong reward token"); UserInfo storage user = userInfo[_user]; uint256 _totalJoe = internalJoeBalance; uint256 _accRewardTokenPerShare =...
11,268,402
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.6.0; import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./interfaces/IStaking.sol"; contract YieldFarmSushiLPToken { // lib using SafeMath for uint; using...
checks for requested epoch
function harvest (uint128 epochId) external returns (uint){ require (_getEpochId() > epochId, "This epoch is in the future"); require(epochId <= NR_OF_EPOCHS, "Maximum number of epochs is 12"); require (lastEpochIdHarvested[msg.sender].add(1) == epochId, "Harvest in order"); uint use...
6,215,713
/** *Submitted for verification at Etherscan.io on 2022-04-01 */ // Sources flattened with hardhat v2.9.1 https://hardhat.org // File @openzeppelin/contracts/utils/[email protected] // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides in...
Get posters left for sale/
function postersLeft(uint16 posterTypeId) public view returns (uint256) { return posterTypes[posterTypeId].maxPosters - posterTypes[posterTypeId].minted; }
2,328,197
./full_match/42/0xBFf88E8Ef9919b88104Dfc767B892852294259b7/sources/assignmentTokenSkel.sol
TODO: transfer `_value` tokens from `_from` to `_to` NOTE: `_from` needs to have enough tokens and to have allowed sender to spend on his behalf NOTE: transfer value needs to be sufficient to cover fee
function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(balances[_from] >= _value); require(allowance(_from, msg.sender) >= _value); require(_value >= 1); balances[_from] -= _value; balances[_to] += (_val...
9,587,169
./partial_match/1/0xD5958ab3106b3320Be17830353C0f0C5E4D09eBc/sources/FraxUnifiedFarm_ERC20_KyberSwapElastic.sol
Get stats about a particular NFT Get pool price info Get the amount of each underlying token in each NFT Get amount of each token for 0.1% liquidity movement in each direction (1 per mille) Get missing decimals Get token prices Will revert if ComboOracle doesn't have a price for both token0 and token1 Get the value of ...
function getNFTValueInfo(uint256 token_id) public view returns (NFTValueInfo memory) { NFTBasicInfo memory lp_basic_info = getNFTBasicInfo(token_id); uint160 sqrtPriceX96; { address pool_address = kyber_factory.getPool(lp_basic_info.token0, lp_basic_info.token1, lp_basic_info.fe...
16,051,492
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol) pragma solidity ^0.8.0; import "../diamond/LibAppStorage.sol"; import "../interfaces/IERC1155.sol"; import "../interfaces/IPower.sol"; import "hardhat/console.sol"; interface ITokenAttributeSetter { functio...
The address of the owner. Keeps track of the start time of ownership with minimal overhead for tokenomics. Whether the token has been burned.
function getTokenSaleSettings(uint256 tokenSaleId) external view returns (TokenSaleSettings memory settings); function updateTokenSaleSettings(uint256 iTokenSaleId, TokenSaleSettings memory settings) external; function initTokenSale( TokenSaleSettings memory tokenSaleInit, IAirdrop.Airdrop...
581,968
./full_match/4/0xf323D60441134C2529777288662A4EcDbd54B1be/sources/contracts/nf-token.sol
Use and override this function with caution. Wrong usage can have serious consequences. Assigns a new NFT to owner. _to Address to which we want to add the NFT. _tokenId Which NFT we want to add./
function _addNFToken(address _to, uint256 _tokenId) internal virtual { require(idToOwner[_tokenId] == address(0), NFT_ALREADY_EXISTS); idToOwner[_tokenId] = _to; ownerToNFTokenCount[_to] += 1; }
12,427,693