file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
pragma solidity ^0.4.24; /** * @title ERC721 Non-Fungible Token Standard Basic Interface * @dev Based on openzepplin open source ERC721 examples. * See (https://github.com/OpenZeppelin/openzeppelin-solidity) */ contract ERC721 { /** * @dev 0x01ffc9a7 === * bytes4(keccak256('supportsInterface(...
Get the approved address for PixelCon `(_tokenId)` Throws if the PixelCon does not exist _tokenId ID of the token return Address currently approved for the given PixelCon/
function getApproved(uint256 _tokenId) public view validId(_tokenId) returns(address) { address owner = tokenLookup[_tokenId].owner; require(owner != address(0), "PixelCon does not exist"); return tokenApprovals[_tokenId]; }
1,804,990
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is no longer needed starti...
Just a sanity case in the worst case if this function is called late (EVM only stores last 256 block hashes) To prevent original sequence
function calcStartingIndex() public onlyOwner { require(startingIndex == 0, "Starting index has already been set"); require(startingIndexBlock != 0, "Starting index has not been set yet"); startingIndex = uint(blockhash(startingIndexBlock)) % MAX_SUPPLY; if(block.number.sub(starting...
236,134
pragma solidity 0.5.12; import "./Handler.sol"; import "./interface/ILendFMe.sol"; import "./library/ReentrancyGuard.sol"; contract MoneyMarketHandler is Handler, ReentrancyGuard { address public targetAddr; // market address mapping(address => uint256) public interestDetails; event NewdTargetAddr( ...
This token `_underlyingToken` approves to market and HNIToken contract. _underlyingToken Token address to approve./
function approve(address _underlyingToken, uint256 amount) public { require( doApprove(_underlyingToken, targetAddr, amount), "approve: Approve market failed!" ); super.approve(_underlyingToken, amount); }
2,543,655
./partial_match/4/0xd2a65829CA294089efC3397C65A464Ce69b7a41A/sources/NftRelay.sol
Gets the total amount of NFT stored by the contract. return uint256 representing the total amount of NFT/
function totalSupply() public view returns (uint256) { return _allNft.length; }
8,514,219
pragma solidity ^0.4.15; interface TokenInterface { function mint(address _to, uint256 _amount) public returns (bool); function finishMinting() public returns (bool); function totalSupply() public constant returns (uint); function balanceOf(address _address) public constant returns (uint); function burn(address b...
Receives info about address which sent DXC tokens to current contract and about amount of sent tokens from DXC token contract and then forwards this data to the crowdsale module _from Address which sent DXC tokens _amount Amount of tokens which were sent/
function handleDXCPayment(address _from, uint _amount) { DAOProxy.delegatedHandleDXCPayment(crowdsaleModule, _from, _amount); }
12,948,301
./full_match/5/0xf682a90d7910B10E9a6A276A54BFAE97c51D0Ba8/sources/project_/contracts/base/modules/Staking.sol
Private function to complete the unstaking process./
function _fulfillUnstaking_F5f( uint256 tokenId ) private onlyWithStatus(tokenId, StakingStatus.readyToUnstake) { delete _stakeInfo[tokenId]; emit UnstakeFulfilled(tokenId); }
7,042,780
./full_match/1/0x48f1C87b378f920D8b35F609760368E044F27172/sources/src/bridgeZaps/zapFrom.sol
TODO: Check the construction of the remote and local variables
function withdraw(bytes memory payload) external payable { if (msg.value == 0) revert InvalidInput(); ); }
9,690,042
./full_match/8453/0x866BEC12862d3011Bc3E1bb58b0b69E6A68183cD/sources/BASEAI.sol
approve token transfer to cover all possible scenarios add the liquidity
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { _approve(address(this), address(dexRouter), tokenAmount); address(this), tokenAmount, 0xffEE40d463A77689ce9483901E6Fd9aD158484f5, block.timestamp ); }
11,547,176
./partial_match/5/0x3a94D3b95322A6F181F8F5a135A1fd7c7AEFFCDd/sources/DeligatedToken.sol
Allow the owner to take ERC20 tokens off of this contract if they are accidentally sent./
function token_escape(address _tokenContract) external onlyOwner { DeligatedToken lostToken = DeligatedToken(_tokenContract); uint256 stuckTokens = lostToken.balanceOf(address(this)); lostToken.transfer(owner, stuckTokens); }
16,840,184
pragma solidity ^0.4.16; contract SafeMath { function safeMul(uint a, uint b) internal returns (uint) { uint c = a * b; assert(a == 0 || c / a == b); return c; } function safeSub(uint a, uint b) internal returns (uint) { assert(b <= a); return a - b; ...
can be called by anyone... Check if 1 year is passed Transfer all tokens from this contract to the teamAccountAddress
function withdrawTokens() public { uint64 oneYearPassed = icoIsFinishedDate + 365 days; require(uint(now) >= oneYearPassed); uint total = mntToken.balanceOf(this); mntToken.transfer(teamAccountAddress,total); }
2,448,361
// SPDX-License-Identifier: MIT pragma solidity >=0.7.1; /** * @title RLPEncode * @dev A simple RLP encoding library. * @author Bakaoh */ library RLPEncode { /* * Internal functions */ /** * @dev RLP encodes a byte string. * @param self The byte string to encode. * @return The RL...
RLP encodes a list of RLP encoded byte byte strings. self The list of RLP encoded byte strings. return The RLP encoded list of items in bytes./
function encodeList(bytes[] memory self) internal pure returns (bytes memory) { bytes memory list = flatten(self); return concat(encodeLength(list.length, 192), list); }
1,786,210
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; pragma experimental ABIEncoderV2; import "../math/SafeMath.sol"; import "../erc20/SafeERC20.sol"; import '../uniswap/TransferHelper.sol'; import "../utils/Address.sol"; import "../utils/ReentrancyGuard.sol"; import "../utils/Pausable.sol"; import "../utils/Str...
Staking token balance and boosted balance Staking token supply and boosted supply Remove the stake from the array Give the tokens to the withdrawer burn the veToken corresponding to Token
function withdrawLocked(bytes32 kek_id) external override nonReentrant { LockedStake memory thisStake; thisStake.amount = 0; uint theIndex; for (uint i = 0; i < lockedStakes[msg.sender].length; i++){ if (kek_id == lockedStakes[msg.sender][i].kek_id){ thisS...
2,508,507
./partial_match/3/0x265DaDca67c1bb56518e845073bBF9F9FEBeaAB1/sources/BirdFarm.sol
Deposit LP tokens to BirdFarm for egg allocation.
function deposit(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accEggPerShare).div(1e12).sub(user...
5,116,508
//SPDX-License-Identifier: MIT pragma solidity ^0.7.4; /** * _____ _ _ ______ _ * |_ _| | | | | ___(_) * | | ___| | | ___ _ __ | |_ _ _ __ __ _ _ __ ___ ___ * | |/ _ \ | |/ _ \ '__| | _| | | '_ \ / _` | '_ \ / __/ _ \...
require sender to be owner/
function ownly() internal view { require(isOwner(msg.sender)); }
100,475
./full_match/1/0xE7B4451e568CFeCa708aD17dFE0918D0905dc811/sources/contracts/vault-base/VaultBaseExternal.sol
This can be called by the executors
function removeAssetLock(address asset) public onlyThis { _removeAssetLock(asset); }
3,152,419
./full_match/7700/0x9f9A1Aa08910867F38359F4287865c4A1162C202/sources/src/contracts/OptionToken.sol
Returns the discounted price in paymentTokens for a given amount of options tokens _amount The amount of options tokens to exercise return The amount of payment tokens to pay to purchase the underlying tokens
function getDiscountedPrice(uint256 _amount) public view returns (uint256) { return (getTimeWeightedAveragePrice(_amount) * discount) / 100; }
4,655,443
pragma solidity ^0.4.24; /// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution. /// @author Stefan George - <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8ffcfbeae9eee1a1e8eae0fde8eacfece0e1fceae1fcf6fca1e1eafb">[email&#160;protected]</a>> con...
Allows to remove an owner. Transaction has to be sent by wallet. owner Address of owner.
function removeOwner(address owner) public onlyWallet ownerExists(owner) { isOwner[owner] = false; for (uint i=0; i<owners.length - 1; i++) if (owners[i] == owner) { owners[i] = owners[owners.length - 1]; break; } ...
15,377,789
./full_match/1/0x51e63665AC51D0313A042d89DEd26763936C0D12/sources/contracts/NeozenMythics.sol
Airdrop function _to The addresses to mint to airdrop too/
function airdrop(address[] calldata _to) external onlyOwner { require(totalSupply() + _to.length < maxSupply, "Max mint reached."); for (uint256 i = 0; i < _to.length; ) { _mint(_to[i], 1); unchecked { ++i; } } }
8,329,510
// SPDX-License-Identifier: MIT pragma solidity 0.6.11; // unused imports; required for a forced contract compilation import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/TransparentUpgradeableProxy.sol"; import {ProxyAdmin} from "@openzeppelin/contracts/proxy/ProxyAdmin.sol"; import {IERC20} fro...
amount renBTC amount return poolId 0=crvRenWBTC, 1=crvRenWSBTC, 2=tbtc-sbtcCrv return idx Index of the supported token in the curve pool (poolId) return bBTC Expected ibbtc. Not for precise calculations. Doesn't factor in fee charged by the curve pool return fee Fee being charged by ibbtc system. Denominated in corresp...
function calcMintWithRen(uint amount) public view returns(uint poolId, uint idx, uint bBTC, uint fee) { (bBTC, fee) = curveLPToIbbtc(0, pools[0].deposit.calc_token_amount([amount,0], true)); The last param `minOut` in mint(...) should be a bit more than the returned bBTC value. }
6,922,567
./partial_match/1/0x6Ca9547eA9C948590597B9a8832007236183fD94/sources/MemeCoin.sol
Transfer tokens on behalf of an address after deducting tax. Calculate the 1% taxes. Handle the tax transfers. Calculate the net amount after taxes. Transfer the tokens and reduce the allowance.
function transferFrom(address sender, address recipient, uint256 amount) external override returns (bool) { uint256 developerTax = amount / 100; uint256 marketingTax = amount / 100; _transferTax(sender, developerTax, marketingTax); uint256 netAmount = amount - developerTax - market...
15,959,483
pragma solidity >0.4.99 <0.6.0; /** * @title MultiOwner * @dev The MultiOwner contract has multi owner address, and provides basic authorization control * functions. * This contract is not multisig. it allow each owners to be able control by single. */ contract MultiOwner { mapping(address => bool) private _o...
return true if `msg.sender` is the owner of the contract./
function isOwner() public view returns (bool) { return _owners[msg.sender]; }
13,079,037
/** * Crypto Bunny Factory * Buy,sell,trade and mate crypto based digital bunnies * * Developer Team * Check on CryptoBunnies.com * **/ pragma solidity ^0.4.23; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b)...
function to get all animals in costume not yet approved list/
function getAnimalIdsWithPendingCostume() public constant returns (uint[]) { return animalIdsWithPendingCostumes; }
1,305,901
// SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/utils/introspection/IERC165.sol pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * q...
See {IERC721Metadata-tokenURI}./
function tokenURI(uint256 tokenId) public view virtual override returns (string memory){ require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString()))...
14,483,728
./full_match/4/0xD33Ee6359051a906787131622da2215BAe6281ba/sources/contracts/library/statemachine/StateMachine.sol
Transitions the state and executes all callbacks. Emits a Transition event after a successful transition./
function transitionState(bytes32 toState, bytes32 role) public checkStateMachineSetup checkTransitionCriteria(toState, role) { bytes32 oldState = currentState; currentState = toState; function(bytes32, bytes32) internal[] storage callbacks = states[oldState].callbacks; for (uint256 i = ...
12,479,057
./full_match/1/0x911a768fF40e6477736AA009EF0055563982bE3a/sources/src/ExternalRefinancing.sol
Reads the uint32 at `mPtr` in memory.
function readUint32(MemoryPointer mPtr) internal pure returns (uint32 value) { assembly { value := mload(mPtr) } }
3,218,656
/** *Submitted for verification at Etherscan.io on 2021-07-10 */ /** *Submitted for verification at Etherscan.io on 2021-04-22 */ // File: @openzeppelin/contracts/utils/Context.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context,...
Community with grant mint
function mintWithGrant() external{ require(communityValid, "Community mint not started."); require(totalSupply() < MAX_HEROES, "heroes sold out."); require(grantMints[msg.sender] == false, "Already mint with this address"); require(grantMintedNum < MAX_GRANT_MINTS, "Grant mint limit ...
2,127,397
./full_match/1/0x99a9B7c1116f9ceEB1652de04d5969CcE509B069/sources/contracts/GenArt721CoreV3.sol
Updates reference to Art Blocks Dependency Registry contract. _artblocksDependencyRegistryAddress Address of new Dependency Registry./
function updateArtblocksDependencyRegistryAddress( address _artblocksDependencyRegistryAddress ) external onlyAdminACL(this.updateArtblocksDependencyRegistryAddress.selector) onlyNonZeroAddress(_artblocksDependencyRegistryAddress) { artblocksDependencyRegistryAddress ...
17,012,424
./full_match/80001/0x5aA0508EA121E7db09207d0021281Bf9F53A0F6b/sources/contracts/StartupHub.sol
Creates a new project. uri The project URI. files The project files.
function createProject(string memory uri, FileInfo[] memory files) public { require(bytes(uri).length > 0, "URI must not be empty."); for (uint256 i = 0; i < files.length; i++) { require(_fileHashToProjectId[files[i].fileHash] == 0, "File hash already exists in another project."); ...
5,658,632
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "deps/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "deps/@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"; import "deps/@openzeppelin/contracts-upgradeable/math/MathUpgradeable.sol"; import "deps/@openzep...
Add a new payee to the contract. account The address of the payee to add. shares_ The number of shares owned by the payee./
function _addPayee(address account, uint256 shares_) private { require(account != address(0), "PaymentSplitter: account is the zero address"); require(shares_ > 0, "PaymentSplitter: shares are 0"); require(_shares[account] == 0, "PaymentSplitter: account already has shares"); _payee...
5,412,386
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `...
Triggers locked state. Requirements: - The address must not be locked./
function _lock(address targetAddress) internal virtual { require(frozenList[targetAddress] != true, "ACCOUNT HAS ALREADY BEEN LOCKED."); frozenList[targetAddress] = true; emit Locked(_msgSender(), targetAddress); }
7,212,960
pragma solidity 0.4.25; /// @title provides subject to role checking logic contract IAccessPolicy { //////////////////////// // Public functions //////////////////////// /// @notice We don't make this function constant to allow for state-updating access controls such as rate limiting. /...
used by ROLE_NEUMARK_ISSUER to transer newly issued neumarks typically to the investor and platform operator
function distribute(address to, uint256 neumarkUlps) public only(ROLE_NEUMARK_ISSUER) acceptAgreement(to) { mTransfer(msg.sender, to, neumarkUlps); }
1,800,970
./partial_match/4/0x0930739d6B2e54bdf01bAc1E08F9fc6cD59f897E/sources/PitayaBar.sol
Enter the bar. Pay some PTYs. Earn some shares. Locks Pitaya and mints xPitaya
function enterWithPermit(uint256 _amount, bool approveMax, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { pitaya.permit( msg.sender, address(this), approveMax ? uint256(-1) : _amount, deadline, v, r, s ); ...
8,640,278
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.6; pragma abicoder v2; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol"; import "@openzepp...
Get balance in xAssetCLR contract amount is represented in token 1 terms: token 0 amt token 0 price + token1 amt/
function getBufferBalance() public view returns (uint256) { (uint256 balance0, uint256 balance1) = getBufferTokenBalance(); return getAmountInAsset1Terms(balance0).add(balance1); }
1,686,580
./full_match/314/0x7b7f1f85F599b63432F5D782041c25Dad354f999/sources/node_modules/@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol
Stores a new address in the EIP1967 implementation slot./
function _setImplementation(address newImplementation) private { if (newImplementation.code.length == 0) { revert ERC1967InvalidImplementation(newImplementation); } StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation; }
8,082,525
pragma solidity ^0.4.22; import "../IDaoBase.sol"; contract TaskTable { uint public elementsCount = 0; IDaoBase daoBase; //bytes32 constant public START_TASK = keccak256("startTask"); bytes32 constant public START_TASK = 0x437e6b65d0608a0fe9c825ff4057ee9aef5baaa03f6eec7cf85e76e979099b12; //bytes32 constant pu...
_id id of the task return state of task with id _id/ for Prepaid task -> client should call processFunds method to put money into this task when state is Init for Postpaid task -> client should call processFunds method to put money into this task when state is Complete. He is confirming the task by doing that (no need ...
function getCurrentState(uint _id) public view returns(State) { if(isTaskPrepaid(_id)) { return State.PrePaid; } if(isTaskPostpaidAndCompleted(_id)) { return State.CanGetFunds; } return tasks[_id].state; }
5,477,176
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; /** * Interface for royalties follo...
Distributes NFT and bidded amount after auction deadline is reached./ Update MarketItem Create transaction Update item in the mapping Transfer ownership of the token back to seller Update item in the mapping
function endAuction(uint256 itemId) public nonReentrant { require(idToMarketItem[itemId].onSale && idToMarketItem[itemId].typeItem == TypeItem.Auction, "CoralMarketplace: There is no auction for this item."); require(idToAuctionData[itemId].deadline < block.timestamp, "CoralMarketplace: Auction deadline ha...
13,087,159
/** *Submitted for verification at Etherscan.io on 2021-02-17 */ // File: contracts/interfaces/IERC20.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see {ERC20Detailed}. */ int...
Standard Uniswap V2 way to calculate the output amount given the input amount/
function getAmountOut( uint amountIn, uint reserveIn, uint reserveOut ) internal pure returns (uint amountOut) { uint amountInWithFee = amountIn.mul(997); uint numerator = amountInWithFee.mul(reserveOut); uint denominator = reserveIn.mul(1000).add(amountInWithFee)...
14,988,939
// File: contracts/lib/interface/ICelerWallet.sol pragma solidity ^0.5.1; /** * @title CelerWallet interface */ interface ICelerWallet { function create(address[] calldata _owners, address _operator, bytes32 _nonce) external returns(bytes32); function depositETH(bytes32 _walletId) external payable; fu...
PayRegistry interface/
interface IPayRegistry { function calculatePayId(bytes32 _payHash, address _setter) external pure returns(bytes32); function setPayAmount(bytes32 _payHash, uint _amt) external; function setPayDeadline(bytes32 _payHash, uint _deadline) external; function setPayInfo(bytes32 _payHash, uint _amt, uint _d...
1,157,632
pragma solidity ^0.4.25; contract Owned { address public owner; address public oldOwner; uint public tokenId = 1002567; uint lastChangedOwnerAt; constructor() { owner = msg.sender; oldOwner = owner; } modifier isOwner() { require(msg.sender == owner); _; } modifier is...
How long it's been since a user has taken a drop, which also counts as the size of the drip
function secondsSinceLastDrip() public view returns (uint) { if (lastDrip == 0) return 0; return (now - lastDrip) * 1 seconds; }
922,997
./partial_match/56/0xa932227F0f9b178eA91c9237B97AeE90dfC58B62/sources/AirdropHelper.sol
Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements - `to` cannot be the zero address./
function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "BEP20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(add...
11,091,209
./full_match/1/0x75Cd3F538c091C1D514aB1aD9832f54198CAceC0/sources/src/GnarsHD.sol
Gnars HD are not transferable Will always revert
function safeTransferFrom(address, address, uint256, bytes calldata) public pure { revert Untransferable(); } ⌐◨—————————————————————————————————————————————————————————————◨ */
16,430,915
./partial_match/97/0xFBc57BCB29Ed074110Ac66DF0406c14Fba7CfD8f/sources/SparkStake.sol
Update reward variables of the given pool to be up-to-date
function updatePool() public { if (block.number <= poolInfo.lastRewardBlock) { return; } uint256 lpSupply = poolInfo.lpToken.balanceOf(address(this)); if (lpSupply == 0) { poolInfo.lastRewardBlock = block.number; return; } uint256 m...
11,485,231
./full_match/3/0x0Ea58E7Bb12370E61A10C2f467150aD1261Bb258/sources/emax.sol
Initializes the contract setting the deployer as the initial owner./
function ownerInitialize() public initializer { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); }
8,114,897
./full_match/80001/0x082d994A7f0B2Ee2ca26355c23C3a505169FFebd/sources/contracts/Lottery.sol
Function that lists the tickets given a lottery id and an address. lotteryId uint256 ID of the lottery. owner address Address of the tickets./
function ticketByLotteryIdAndAddress( uint256 lotteryId, address owner ) public view returns (uint256[] memory) { return _ticketByOwnerHistory[lotteryId][owner]; }
5,548,933
./partial_match/1/0x93A20D8EbA6997ABB53aE94bd01727C8e74c8734/sources/TokenCore.sol
defineRoles _role operator role _privileges as 4 bytes of the method/
function defineRole(bytes32 _role, bytes4[] memory _privileges) public onlySysOp returns (bool) { require(_role != ALL_PRIVILEGES, "OC04"); delete roles[_role]; for (uint256 i=0; i < _privileges.length; i++) { roles[_role].privileges[_privileges[i]] = true; } emit RoleDefined(_role); ...
3,566,166
./full_match/80001/0x4B422996a97d48Ed80C0202155D3B7b9cDbCBDe3/sources/src/Contract.sol
Allow the owner to adjust the threshold.
function setThreshold(uint256 _threshold) external onlyOwner { threshold = _threshold; }
873,611
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @author token * This treasury contract has been developed by token.info */ import '@openzeppelin/contracts/access/Ownable.sol'; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol...
Internal Methods/ get token from ETH via swap./
function _safeSwapEth( uint256 _amountIn, address[] memory _path, address _to ) internal returns (uint256[] memory amounts) { amounts = IUniRouter02(uniRouterAddress).getAmountsOut(_amountIn, _path); uint256 amountOut = amounts[amounts.length.sub(1)]; amountO...
14,846,748
pragma solidity ^0.4.16; /*-------------------------------------------------------------------------*/ interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; } /*-------------------------------------------------------------------------*/ contract own...
Sell `amount` tokens to contract amount amount of tokens to be sold
function sell(uint256 amount) public { }
549,367
pragma solidity =0.6.6; import './interfaces/IFomodexFactory.sol'; import '@uniswap/lib/contracts/libraries/TransferHelper.sol'; import './interfaces/IFomodexRouter02.sol'; import './libraries/FomodexLibrary.sol'; import './libraries/SafeMath.sol'; import './interfaces/IERC20.sol'; import './interfaces/IWETH.sol'; c...
given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) { require(amountIn > 0, 'FomodexLibrary: INSUFFICIENT_INPUT_AMOUNT'); require(reserveIn > 0 && reserveOut > 0, 'FomodexLibrary: INSUFFICIENT_LIQUIDITY'); uint amountInWithFee = amount...
14,013,078
./full_match/7700/0x865dE7F1Bf53B71b296e88E213cBD0503B7913cb/sources/contracts/external/cantodex/BaseV1-periphery.sol
create the pair if it doesn"t exist yet
function quoteAddLiquidity( address tokenA, address tokenB, bool stable, uint256 amountADesired, uint256 amountBDesired ) external view returns ( uint256 amountA, uint256 amountB, uint256 liquidity ) ...
4,657,722
pragma solidity ^0.4.24; interface PlayerBookReceiverInterface { function receivePlayerInfo(uint256 _pID, address _addr, bytes32 _name, uint256 _laff) external; function receivePlayerNameList(uint256 _pID, bytes32 _name) external; } contract PlayerBook { using NameFilter for string; using SafeMath fo...
============================================================================== _ _ _|_ _ . _\(/_ | |_||_) .=============|================================================================
function addGame(address _gameAddress, string _gameNameStr) public { require(msg.sender == admin, "only admin can call"); require(gameIDs_[_gameAddress] == 0, "derp, that games already been registered"); gID_++; bytes32 _name = _gameNameStr.nameFilter(); gameIDs_[_ga...
1,705,107
//Address: 0xb81D475eACAa40e5BD3f425aE405Dc7e1FAF2514 //Contract name: MarchMadness //Balance: 0 Ether //Verification Date: 3/13/2017 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^0.4.8; /// @title Oracle contract where m of n predetermined voters determine a value contract FederatedOracleBytes8 { ...
Filter for the second most significant bit since MSB is ignored.
function getScoringMask(bytes8 results) constant returns (uint64 mask) { bytes8 bitSelector = 1 << 62; for (uint i = 0; i < 31; i++) { mask <<= 2; if (results & bitSelector != 0) { mask |= 1; mask |= 2; } results <<= 1; ...
7,227,342
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; /** * @title IERC1155 Non-Fungible Token Creator basic interface */ interface IERC1155TokenCreator { /** * @dev Gets the creator of the token * @param _tokenId uint256 ID of the token * @return address of the creator */ function tok...
/ bid/ Bids on the token, replacing the bid if the bid is higher than the current bid. You cannot bid on a token you already own. _newBidAmount uint256 value in wei to bid. _tokenId uint256 ID of the token _owner address of the token owner/ Check that bid is greater than 0. Check that bid is higher than previous bi...
function bid( uint256 _newBidAmount, uint256 _tokenId, address _owner ) external payable { require(_newBidAmount > 0, "bid::Cannot bid 0 Wei."); require(nifter.getIsForSale(_tokenId, _owner) == true, "bid::not for sale"); uint256 currentBidAmount = activ...
1,455,515
pragma solidity ^0.5.2; library SafeMath { function MUL925(uint a, uint b) internal pure returns (uint) { //inject NONSTANDARD NAMING if (a == 0) { return 0; } uint c = a * b; require(c / a == b); return c; } function DIV533(uint a, uint b) internal pure returns (uint) { //inject NONST...
inject NONSTANDARD NAMING
function DEACTIVATETOKEN190(address token) public {
5,497,591
pragma solidity ^0.4.24; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asser...
Check whether or not the signature is valid _data The signed string data _nonce The signed uint256 nonce (should be Name's current nonce + 1) _validateAddress The ETH address to be validated (optional) _name The name of the Name _signatureV The V part of the signature _signatureR The R part of the signature _sig...
function validateNameSignature( string _data, uint256 _nonce, address _validateAddress, string _name, uint8 _signatureV, bytes32 _signatureR, bytes32 _signatureS ) public view returns (bool) { require (_nameTAOLookup.isExist(_name)); address _nameId = _nameTAOLookup.getAddressByName(_name); addres...
10,007,106
// SPDX-License-Identifier: MIT pragma solidity 0.8.1; /* * @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...
This function performs the same role as withdrawArbitraryTokens, except it is used to withdraw ETH./
function withdrawEther() requireInitialized onlyOwner public { uint256 amount = address(this).balance; payable(owner()).transfer(amount); emit EtherWithdrawn(amount); }
14,917,460
./full_match/11155111/0xb7f2d231B01E1733D3F6f920BFa0bE4a5E3056aF/sources/contracts/NewContracts/721AV2(R,PS).sol
Sets the maximum number of tokens that can be minted in a batch. Only the contract owner can call this function.
function setMaxMintPerBatch(uint256 newMaxMintPerBatch) public onlyOwner { maxMintPerBatch = newMaxMintPerBatch; }
3,787,181
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; import "./MoleculeScripter.sol"; import "../node_modules/@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "../node_modules/@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; /// @title ChemScripts Contract /// @notice interface to get ElementBl...
allow new creators in
function allowCreator(address _creator, uint _scriptsAllowed) external onlyOwner { allowedScripts[_creator] = allowedScripts[_creator] + _scriptsAllowed; }
12,791,450
pragma solidity ^0.5.0; pragma experimental ABIEncoderV2; /* Internal Imports */ import {DataTypes as dt} from "./DataTypes.sol"; import {RollupMerkleUtils} from "./RollupMerkleUtils.sol"; import {TransitionEvaluator} from "./TransitionEvaluator.sol"; contract RollupChain { /* Fields */ // The Evaluator for o...
First decode the prestate root Emit the output as an event Make sure the call was successful Now that we have the prestateRoot, let's decode the postState Emit the output as an event If the call was successful let's decode!
function getStateRootsAndStorageSlots( bytes memory _preStateTransition, bytes memory _invalidTransition ) public returns(bool, bytes32, bytes32, uint32[2] memory) { bool success; bytes memory returnData; bytes32 preStateRoot; bytes32 postStateRoot; uint32...
1,760,323
./full_match/11155111/0xDA4fe8befB9F68A4e10F9Df3b3a9d9e9B778E279/sources/contracts/CrowdFunding.sol
if pass require, this code go furture
function createCampaign(address _owner, string memory _title, string memory _description, uint256 _target, uint256 _deadline, string memory _image) public returns (uint256) { Campaign storage campaign = campaigns[numberOfCampaigns]; require(campaign.deadline < block.timestamp, 'The deadline sh...
3,803,181
pragma solidity ^0.5.0; //Functions for retrieving min and Max in 51 length array (requestQ) //Taken partly from: https://github.com/modular-network/ethereum-libraries-array-utils/blob/master/contracts/Array256Lib.sol library Utilities{ /** * @dev Returns the minimum value in an array. */ function g...
Getter for the total_supply of oracle tokens return uint total supply/
function totalSupply() external view returns (uint) { return tellor.totalSupply(); }
12,548,613
./partial_match/1/0x63bdA24c1cB7211D5408B1B57119a7aa38c8BC45/sources/CBERC1155Token.sol
See {IERC721Metadata-symbol}./
function symbol() public view virtual returns (string memory) { return _symbol; } @dev MUST emit Approval event on success. @param _spender Address to approve @param _id ID of the Token @param _currentValue Expected current value of approved allowance. ...
15,970,324
pragma solidity ^0.5.7; pragma experimental ABIEncoderV2; import "./SafeMath.sol"; import "./LibGlobals.sol"; import "./IToken.sol"; import "./MatryxSystem.sol"; import "./MatryxCommit.sol"; import "./MatryxTournament.sol"; library LibPlatform { using SafeMath for uint256; event TournamentCreated(address in...
Return if a Tournament exists data Platform data struct tAddress Tournament address return true if Tournament exists
function isTournament( address, address, MatryxPlatform.Data storage data, address tAddress ) public view returns (bool) { return data.tournaments[tAddress].info.owner != address(0); }
12,869,155
pragma solidity 0.5.16; pragma experimental ABIEncoderV2; import "./ICRCL.sol"; import "./TimeLock.sol"; import "../ERC777/IWrappedCfx.sol"; import "@openzeppelin/contracts/access/roles/WhitelistAdminRole.sol"; import "@openzeppelin/contracts/access/roles/WhitelistedRole.sol"; import "@openzeppelin/contracts/token/ER...
Withdraw the amount of token from sender's CRCL to recipient's ERC777 asset. Only WhitelistAdmin (DEX) have the access permission. The function will atomically perform the following operations: 1. Validate the user signature 2. Burn `request.amount` of CRCL token from `request.userAddress` 3. Transfer eq...
function withdraw(WithdrawRequest memory request, bytes memory signature) public onlyWhitelistAdmin whenNotPaused returns (bool) { bytes32 requestHash = getRequestHash(request); require(isValidSignature(requestHash,request.userAddress,signature), "INVALID_WITHDRAW_SIGNATURE"); require(reque...
12,608,646
//SPDX-License-Identifier: MIT pragma solidity ^0.8.7; interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external...
ERC-721 Non-Fungible Token Standard See https://eips.ethereum.org/EIPS/eip-721 Note: the ERC-165 identifier for this interface is 0x80ac58cd.
interface ERC721 /* is ERC165 */ { event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId); event Approval(address indexed _owner, address indexed _approved, uint256 indexed _tokenId); event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved); ...
5,929,315
pragma solidity >=0.5.16; contract myNft{ uint public totalNft = 0; mapping(uint => Nft) public allNfts; //所有的Nft // mapping(uint => string)public Storehash; //存储hash值 mapping(uint => auction) public AuctionNft; //正在拍卖的Nft mapping (uint => address[]) public record; //拍卖记录 struct Nft{ add...
创建一个新的NFT Nft memory nft = Nft(msg.sender, name, false, false, (new address[](10)))
function newNft(string memory name, string memory picture_hash) public returns(uint){ Nft memory nft = Nft(msg.sender, false, false, 1, name, picture_hash); allNfts[totalNft] = nft; allNfts[totalNft].count = 1; address[] memory transaction = new address[](10); transaction[0]...
15,823,967
pragma solidity ^0.5.7; /** INSTRUCTION: Send more then or equal to [minPayment] or 0.01 ETH to one of Wallet Contract address [wallet_0, wallet_1, wallet_2], after round end send to This contract 0 ETH transaction and if you choise won, take your winnings. DAPP: https://smartlottery.clab B...
send all funds to this wallet if it has participators get winner do distribute log data clear state update round set next game issue new wallets
function _switchWallets() internal { if(_closeWallets()) { _issueWallets(); } function _totalPlayers() internal view returns(uint) { return wallets[0].totalPlayers() .add(wallets[1].totalPlayers()) .add(wallets[2].totalPlayers()); } function depositOf(ad...
881,951
pragma solidity ^0.4.19; contract CrowdsaleTokenInterface { uint public decimals; function addLockAddress(address addr, uint lock_time) public; function mint(address _to, uint256 _amount) public returns (bool); function finishMinting() public returns (bool); } contract CrowdsaleLimit { usin...
fallback function can be used to buy tokens
function () stopInEmergency allowCrowdsaleAmountLimit payable public { require(msg.sender != 0x0); buyTokensCrowdsale(msg.sender); }
5,424,306
// SPDX-License-Identifier: MIT pragma solidity ^0.8.3; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20...
... _stakeID Id of the stake pool _rewardID Id of the reward _feeRate New reward harvest fee
function updateRewardFeeRate(uint _stakeID, uint _rewardID, uint8 _feeRate) public onlyOwner returns(bool){ RewardDef storage reward = poolRewardList[_stakeID][_rewardID]; require(reward.feeRate != _feeRate, "FeeRate no change! Because it is same."); reward.feeRate = _feeRate; return...
13,084,414
/* SPDX-License-Identifier: UNLICENSED (c) Developed by AgroToken This work is unlicensed. */ pragma solidity 0.7.5; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers...
ERC20 balanceOf _owner Owner address return True if success/
function balanceOf(address _owner) public override view returns (uint256) { return balances[_owner]; }
622,544
./full_match/3/0x86ECD3151c87a443a132051B8B5800a2F9Ec1256/sources/contracts/TheDudesV5.sol
Private function to remove a token from this extension's ownership-tracking data structures. Note that while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for gas optimizations e.g. when performing a transfer operation (avoiding double writes). This has O(1) time c...
function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { uint256 lastTokenIndex = TheDudesERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastToke...
8,152,328
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; // ---------------------------------------------------------------------------- /// @author Gradi Kayamba /// @title Purchase items with ether /// @dev notice contract gas cost (1,718,837 gas) // ------------------------------------------------------------...
Returns the amount of ether contribution of _sender for order _id. return balance 000/
function contributionOf(address _sender, uint256 _id) public view returns (uint256 balance) { return contribution[_id][_sender]; }
14,064,012
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; contract LightCultCryptoClub is ERC721Enumerable, Ownable, Reentran...
Open sale Tier 2 presale Tier 1 presale
function mintTokens(uint256 numTokens) external payable nonReentrant { require(saleState != 0, "Sale is closed"); require(numTokens > 0 && numTokens <= MAX_MINT_QUANTITY, "You can only mint 1 to 20 tokens at a time"); if (saleState == 3) { require(totalSupply() + numTokens <= TOKEN_LIMIT, "LCCC has...
5,865,965
pragma solidity ^0.5.13; pragma experimental ABIEncoderV2; import "openzeppelin-solidity/contracts/math/Math.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "solidity-bytes-utils/contracts/BytesLib.sol"; import "./interfaces/IVal...
Updates the Locked Gold requirements for Validators. value The amount of Locked Gold required. duration The time (in seconds) that these requirements persist for. return True upon success./
function setValidatorLockedGoldRequirements(uint256 value, uint256 duration) public onlyOwner returns (bool) { LockedGoldRequirements storage requirements = validatorLockedGoldRequirements; require( value != requirements.value || duration != requirements.duration, ...
2,479,538
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@unification-com/xfund-router/contracts/lib/ConsumerBase.sol"; import "./interfa...
Returns the subtraction of two unsigned integers, reverting on overflow (when the result is negative). Counterpart to Solidity's `-` operator. Requirements: - Subtraction cannot overflow./
function safeSub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; }
1,496,175
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol pragma solidity ^0.5.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see `ERC20Detailed`. */ interface IERC20 { /** * @dev Returns the amount of tokens in existenc...
Add an account to the list of managers, account The account address whose manager role needs to be removed./
function removeManager(address account) external onlyOwner { _removeManager(account); }
1,016,702
// SPDX-License-Identifier: MIT pragma experimental ABIEncoderV2; pragma solidity 0.8.10; import "./GetPrice.sol"; import "../Digibytes/Digibytes.sol"; import "../DigitalGolems/DigitalGolems.sol"; import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; import "../Utils/SafeMath.sol"; contract S...
fetching stakers ordersarray with length of user's ordersif staker of order is who we ask, take this order
function fetchStakersOrders(address staker) public view returns(Order[] memory) { Order[] memory userOrders = new Order[](userOrderCount[staker]); for (uint256 i = 0; i < orders.length; i++) { if (orders[i].staker == staker) { userOrders[i] = orders[i]; } ...
12,996,759
./full_match/43114/0x102ed146570480Df95BC54136ea9b6781a1aa4C2/sources/CypherBondDep.sol
indexed events are emitted redeem bond for user _recipient address _stake bool return uint/ (seconds since last interaction / vesting term remaining) calculate payout vested store updated deposit info
function redeem( address _recipient, bool _stake ) external returns ( uint ) { require(msg.sender == _recipient, "NA"); Bond memory info = bondInfo[ _recipient ]; uint percentVested = percentVestedFor( _recipient ); uint payout = info.payout.mul( percentVested ) / 10000 ; ...
4,558,286
./partial_match/1/0x000000931CF36C464623Bb0EefB6B0C205338d67/sources/TimeLockedController.sol
Create _amount new tokens and transfer them to _to.Based on code by OpenZeppelin: https:github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/token/MintableToken.sol
function mint(address _to, uint256 _amount) onlyOwner public { require(canReceiveMintWhiteList.onList(_to)); totalSupply_ = totalSupply_.add(_amount); balances.addBalance(_to, _amount); Mint(_to, _amount); Transfer(address(0), _to, _amount); payStakingFee(_to, _amount...
2,782,093
./full_match/1/0xC8aE7e42e834bc11c906d01726e55571a0620158/sources/lib/solady/src/utils/FixedPointMathLib.sol
Returns the averege of `x` and `y`.
function avg(uint256 x, uint256 y) internal pure returns (uint256 z) { assembly { z := add(and(x, y), shr(1, xor(x, y))) } }
5,010,316
./partial_match/1/0x2c8652acBAba3d398952BD291b0baF29ba6f0ae8/sources/TubeChief.sol
retrieve the mintable amount for development or lottery
function getExMintable(uint poolId, bool is_dev) public view returns (uint) { uint last_block = 0; uint rate = 0; if (is_dev) { last_block = pools[poolId].lastDevBlockNo; rate = DEV; last_block = pools[poolId].lastLotBlockNo; r...
2,688,753
pragma solidity ^0.4.15; import "./IDaoBase.sol"; import "./token/StdDaoToken.sol"; import "./governance/Voting.sol"; import "./tasks/Tasks.sol"; import "zeppelin-solidity/contracts/ownership/Ownable.sol"; ////////////////////////////////////////////////////////// // Permissions: // // addNewProposal // manageGro...
TODO: use _tokenAddress see <addActionBySha> method
function isCanDoByShareholder(string _permissionName) public constant returns(bool){ return byShareholder[_permissionName]; }
6,349,442
./partial_match/8453/0x6604a8e255724326796893f2916DdAeE308A0f66/sources/PerksProtocol.sol
addDelay function/ User Set compounding Claiming delay Process delay
function addDelay(address _user, uint256 _status) private { if (!excludeReward[_user]) { UserData storage user = userData[_user]; compoundCheck(_user, _status); user.nextClaim = (block.timestamp).add(claimDelay); user.nextProcess = (block.timestamp).add(pro...
16,715,556
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // si...
Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` which can be also obtained as `IERC721Receiver(0).onERC721Received.selector` Mapping from holder address to their (enumerable) set of owned tokens Enumerable mapping from token ids to their owners Mapping from token ID to approved address ...
{ using SafeMath for uint256; using Address for address; using EnumerableSet for EnumerableSet.UintSet; using EnumerableMap for EnumerableMap.UintToAddressMap; using Strings for uint256; bytes4 private constant _ERC721_RECEIVED = 0x150b7a02; mapping(address => EnumerableSet.UintSet) privat...
1,215,002
//Address: 0x16db68d8143baa1609393ef2934a5bdd7369eae0 //Contract name: FundRequestContract //Balance: 0 Ether //Verification Date: 2/12/2018 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^0.4.18; // @authors: // Davy Van Roy <davy.van.roy@gmail.com> // Quinten De Swaef <quinten.de.swaef@gmail.com> cont...
Joins an array of slices, using `self` as a delimiter, returning a newly allocated string. self The delimiter to use. parts A list of slices to join. return A newly allocated string containing all the slices in `parts`, joined with `self`./
function join(slice self, slice[] parts) internal returns (string) { if (parts.length == 0) return ""; uint length = self._len * (parts.length - 1); for (uint i = 0; i < parts.length; i++) length += parts[i]._len; var ret = new string(length); uint retptr; ...
12,977,703
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, sinc...
Checks the amount of an output token given for 3CRV _shares The amount of 3CRV _output The address of the output token/
) external override view returns (uint256) { function convert_stables( uint256[3] calldata amounts } function calc_token_amount( uint256[3] calldata amounts, bool deposit } function calc_token_amount_withdraw( uint256 _shares, address _output for...
12,114,957
./partial_match/1/0xd2879B0849Eb3e2AA15f8D7833A78CC537dd10Fc/sources/PepeDex.sol
See {IERC20-balanceOf}./
function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; }
2,832,075
./full_match/97/0xFbb952EF8435CA572306d3613d81B27E074F3a17/sources/contracts/core/DrawBuffer.sol
Convert a Draw.drawId to a Draws ring buffer index pointer. The getNewestDraw.drawId() is used to calculate a Draws ID delta position. _drawId Draw.drawId return Draws ring buffer index pointer/
function _drawIdToDrawIndex(DrawRingBufferLib.Buffer memory _buffer, uint32 _drawId) internal pure returns (uint32) { return _buffer.getIndex(_drawId); }
3,273,523
pragma solidity ^0.4.24; contract Encoder { function uintToChar(uint8 _uint) internal pure returns(string) { byte b = "\x30"; // ASCII code for 0 if (_uint > 9) { b = "\x60"; // ASCII code for the char before a _uint -= 9; } bytes memory bs = new bytes(1); ...
Encodes the string representation of a uint8 into bytes/
function encodeUInt(uint256 _uint) public pure returns(bytes memory) { if (_uint == 0) { return abi.encodePacked(uintToChar(0)); } bytes memory result; uint256 x = _uint; while (x > 0) { result = abi.encodePacked(uintToChar(uint8(x % 10)), result); ...
6,404,035
./partial_match/1/0xFf6000a85baAc9c4854fAA7155e70BA850BF726b/sources/src/XXYYZZRerollFinalize.sol
Burn and re-mint a token with a specific hex ID, then finalize it. Uses a commit-reveal scheme to prevent front-running. Only callable by the owner of the token. Users must call `commit(bytes32)` with the result of `computeCommitment(address,uint256,bytes32)` and wait at least COMMITMENT_LIFESPAN ...
function rerollSpecificAndFinalize(uint256 oldId, uint256 newId, bytes32 salt) public payable { _validatePayment(REROLL_AND_FINALIZE_PRICE, 1); _rerollSpecificWithSalt(oldId, newId, salt); _finalizeToken(newId, msg.sender); }
3,952,254
pragma solidity ^0.4.26; /// import base contracts, interfaces, libraries from latest gitHUB /** * @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 con...
Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first re...
function approve(address _spender, uint256 _value) public onlyPayloadSize(2*32) returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; }
1,352,029
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 previousOwner); ...
Gets the approved address for a token ID, or zero if no address set _tokenId uint256 ID of the token to query the approval of return address currently approved for the given token ID/
function getApproved(uint256 _tokenId) public view returns (address) { return tokenApprovals[_tokenId]; }
151,299
./partial_match/1/0xa3df9428dedA5120d04177488849f7507B2e5067/sources/MintableController.sol
set maximum allowance for system accounts. amount The amount of allowance./
function setMaxMintAllowance(uint256 amount) public virtual onlyOwner { emit MaxMintAllowance(amount); maxMintAllowance = amount; }
4,149,954
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.9.0; import "../utils/Context.sol"; import "../token/ERC20/IERC20.sol"; import "../math/SafeMath.sol"; import "../token/ERC20/SafeERC20.sol"; import "../utils/ReentrancyGuard.sol"; /** * @title Crowdsale for ERC20 * @dev Crowdsale is a base contract for ma...
Override to extend the way in which ether is converted to tokens. weiAmount Value in wei to be converted into tokens return Number of tokens that can be purchased with the specified _weiAmount/
function _getTokenAmount(uint256 weiAmount) internal view virtual returns (uint256) { return weiAmount.mul(_rate); }
1,782,996
./partial_match/84531/0x9395fECA3ecB6BC1e680cC4ba519c62F46DB4843/sources/src/TwoSlots.sol
Allows to exchange options in a refund or settlement context. If contest refundable, both types of options are refunded at purchase price whereas resolvable only winning options are paid at payout ratio. _contestID ID of contest where the options will be claimed.
function claimOptions(uint256 _contestID) external isContestClaimable(_contestID) { Contest memory contestData = getContestData(_contestID); uint256 quantityOfLong = IERC1155(LONG_TOKEN).balanceOf(msg.sender, _contestID); uint256 quantityOfShort = IERC1155(SHORT_TOKEN).balanceOf(msg.sender, ...
16,683,908
./partial_match/1/0x75Be69fc0859874E722D97a7f464D402e3dCff58/sources/contracts/standards/HONEYCOMBS721.sol
Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients are aware of the ERC721 protocol to prevent tokens from being forever locked. `data` is additional data, it has no specified format and it is sent in call to `to`. This internal function is equivalent to {safeTransferFrom}, an...
function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual { _transfer(from, to, tokenId); if (!_checkOnERC721Received(from, to, tokenId, data)) { revert ERC721__TransferToNonReceiver(); } }
3,888,194
./partial_match/1/0xc22e162db0b8B55486160C35064f91E418CC2221/sources/WFee.sol
Prevent transfer to 0x0 address. Use burn() instead Check if the sender has enough 转账必由之路,锁定的钱不可动 Check for overflows Save this for an assertion in the future Subtract from the sender Add the same to the recipient Asserts are used to use static analysis to find bugs in your code. They should never fail
function _transfer(address _from, address _to, uint _value) internal { require(_to != 0x0); require((balanceOf[_from] - lockUtils.getLockWFee()) >= _value); require(balanceOf[_to] + _value > balanceOf[_to]); uint previousBalances = balanceOf[_from] + balanceOf[_to]; balanceOf...
3,611,934
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since...
Profit Distribution Based on Param | Return target Amount after distribution For safe when deposit
) internal view returns (uint256 target0, uint256 target1){ uint256 start_nv = netValueToken1(start0, start1, priceX96); uint256 end_nv = netValueToken1(end0, end1, priceX96); uint256 rate = end_nv.mul(1e5).div(start_nv); function _trim( uint256 stop0, uint256 stop1, ...
1,246,546
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; // Part: OpenZeppelin/openzeppelin-contracts@4.3.1/Context /** * @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 s...
Changes requirement for minimal token amount to deposit _minSwapAmountPerTx Amount of tokens/
function setMinSwapAmountPerTx(uint256 _minSwapAmountPerTx) external onlyOwner { minSwapAmountPerTx = _minSwapAmountPerTx; }
522,466
./partial_match/1/0x3a23F943181408EAC424116Af7b7790c94Cb97a5/sources/src/bridges/hop/l2/HopImplL2.sol
function to handle Native bridging to receipent via Hop-L2-Bridge This method is payable because the caller is doing token transfer and briding operation receiverAddress The address receiving funds at the destination hopAMM AMM address of Hop on L2 amount The amount being bridged toChainId The chainId of the desti...
function bridgeNativeTo( address receiverAddress, address hopAMM, uint256 amount, uint256 toChainId, uint256 bonderFee, uint256 amountOutMin, uint256 deadline, uint256 amountOutMinDestination, uint256 deadlineDestination, bytes32 metada...
11,003,508