file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./partial_match/42/0x40A4710240996d1cFC44EC47FB5458782D3fdD6E/sources/DfFinanceDeposits.sol
address public constant SOLO_MARGIN_ADDRESS = 0x1E0447b19BB6EcFdAe1e4AE1694b0C3659614e4e; Mainnet
{ function _initFlashloanDyDx( address _token, uint256 _amount, } ) internal { ISoloMargin solo = ISoloMargin(SOLO_MARGIN_ADDRESS); uint256 marketId = _getMarketIdFromTokenAddress(address(solo), _token); uint256 repayAmount = _getRepaymentAmountInternal(_amount); ...
9,053,805
./partial_match/1/0xE9F0a0a787CEEA82f1c8fE7A783826eBD181e707/sources/packages/contracts-core/contracts/governance/GovernanceRouter.sol
Set the router address for a given domain and dispatch the change to all remote routers _domain The domain _router The address of the new router/
function setRouterGlobal(uint32 _domain, bytes32 _router) external onlyGovernor onlyNotInRecovery { _setRouterGlobal(_domain, _router); }
15,740,888
pragma solidity ^0.5.0; library SafeMath { function sub(uint a, uint b) internal pure returns (uint) { require(b <= a); return a - b; } function add(uint a, uint b) internal pure returns (uint) { uint c = a + b; require(c >= a); return c; } /*function mul(uint a, uint b) inter...
Vote in favor of the current proposal/
function voteYes() public { commitDividend(msg.sender); require(users[msg.sender].voted == 0 && proposalBlock + weekBlocks*4 > block.number && proposalBlock > 0); users[msg.sender].voted=1; proposalVotesYes+=users[msg.sender].votes; }
907,039
pragma solidity ^0.4.21; contract EIP20Interface { uint256 public totalSupply; function balanceOf(address _owner) public view returns (uint256 balance); function transfer(address _to, uint256 _value) public returns (bool success); function transferFrom(address _from, address _to, uint256 _value) publi...
called by the owner on emergency, triggers stopped state
function halt() external onlyOwner { halted = true; }
251,067
./partial_match/1/0x2AF772E90398B6Eca5bfb4c36d20bEAb71979938/sources/src/SteamerBuffer.sol
@inheritdoc ISteamerBuffer
function setSteamer(address underlyingToken, address newSteamer) external override onlyAdmin { if (ISteamer(newSteamer).underlyingToken() != underlyingToken) { revert IllegalArgument(); } steamer[underlyingToken] = newSteamer; emit SetSteamer(underlyingToken, newSteamer);...
2,685,902
./full_match/11155111/0x66F0E06b6F33B4307DDfe0ADaa5f545C4A834A13/sources/contracts/Contract.sol
Function to add a new product for sale
function addProduct( string memory _productName, uint256 _productPrice, uint256 _weight, string memory _imageUrl ) public { require(msg.sender == farmer, "Only the farmer can add products"); products.push( Product(_productName, _productPrice, _weight,...
3,823,292
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; pragma experimental ABIEncoderV2; import "./libraries/boringcrypto/BoringBatchable.sol"; import "./HarvestPermit.sol"; import "./JoinPermit.sol"; import "./ERC20FlashLoan.sol"; /// @title The fountain contract Fountain is HarvestPermit, JoinPermit, ...
Fetch the token from fountain. Can only be called by Archangel. Will only fetch the extra part if the token is the staking token. Otherwise the entire balance will be fetched. token The token address. to The receiver. return The transferred amount.
function rescueERC20(IERC20 token, address to) external onlyArchangel returns (uint256) { uint256 amount; if (token == stakingToken) { amount = token.balanceOf(address(this)).sub(totalSupply()); amount = token.balanceOf(address(this)); } ...
1,757,271
./partial_match/1/0x48d2Ae51E665298000A42f924E7Ad09914f21821/sources/TokenProxy.sol
Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but with `errorMessage` as a fallback revert reason when `target` reverts. _Available since v3.1._/
function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return verifyCallResultFromTarget(target, success, returndata, e...
2,736,364
/* ----------------------------------------------------------------- FILE HEADER ----------------------------------------------------------------- file: Havven.sol version: 1.0 authors: Anton Jurisevic Dominic Romanowski Mike Spain date: 2018-02-05 checked: Mike Spain appr...
If the motion was to terminate at this instant, it would pass. That is: there was sufficient participation and a sizeable enough majority. /
function motionPasses(uint motionID) public view returns (bool) { uint yeas = votesFor[motionID]; uint nays = votesAgainst[motionID]; uint totalVotes = safeAdd(yeas, nays); if (totalVotes == 0) { return false; } uint participa...
1,230,017
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.4; // Uncomment if needed. // import "hardhat/console.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "@ope...
Widthdraw a single position. tokenId The related position id. noReward true if use want to withdraw without reward refund iZi to user refund lockToken to user
function withdraw(uint256 tokenId, bool noReward) external nonReentrant { require(owners[tokenId] == msg.sender, "NOT OWNER OR NOT EXIST"); if (noReward) { _updateGlobalStatus(); _collectReward(tokenId); } TokenStatus storage t = tokenStatus[tokenId]; ...
5,850,550
// hevm: flattened sources of src/LoihiFactory.sol pragma solidity >0.4.13 >=0.4.23 >=0.5.0 <0.6.0 >=0.5.7 <0.6.0; ////// lib/abdk-libraries-solidity/src/ABDKMath64x64.sol /* * ABDK Math 64.64 Smart Contract Library. Copyright © 2019 by ABDK Consulting. * Author: Mikhail Vladimirov <mikhail.vladimirov@gmail.com> *...
views the total allowance one address has to spend from another address _owner the address of the owner _spender the address of the spender return allowance_ the amount the owner has allotted the spender
function allowance ( address _owner, address _spender ) public view returns ( uint allowance_ ) { allowance_ = shell.allowances[_owner][_spender]; }
1,235,437
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; pragma abicoder v2; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol"; import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";...
Adds a new user eligible for vesting. Automatically calculates rewardsPerBlock, based on the tranches and tranche duration user address of eligible user totalRewards amount of rewards to be vested for this user/ check that address is not empty check that user has rewards to receive check that user does not exist yet ...
function addUserVesting(address user, uint256 totalRewards) public onlyOwner { require(user != address(0), "ZERO_ADDRESS"); require(totalRewards > 0, "NO_REWARDS"); require(_userData[user].totalRewards == 0, "EXISTING_USER"); uint256 startBlock = _tranches[0]; ...
11,652,004
./full_match/137/0x03f68539146A26378C10a8d98d182Dbbbf145E29/sources/POLYGON_SAND_Strat_Sandbox.sol
pauses deposits and withdraws all funds from third party systems.
function panic() public onlyManager { pause(); ISandboxChef(chef).withdraw(balanceOfPool()); }
4,749,549
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; /* ___ _ _ | _ )_ _ _ _ _ _ _ _ | | | | | _ \ || | ' \| ' \ || | |_| |_| |___/\_,_|_||_|_||_\_, | (_) (_) |__/ * * MIT License * =========== * * Copyright (c) 2020 BunnyFinance * * Permission is hereby granted...
should be called when determining mint in governance. Bunny is transferred to the timelock contract.
function mintGov(uint amount) external override onlyOwner { if (amount == 0) return; _mint(amount, TIMELOCK); }
15,802,870
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } functio...
low level token Pledge functionminimum amount in ETHmaximum amount in ETHhard capPre-saleico
function procureTokens(address beneficiary) public payable { uint256 tokens; uint256 weiAmount = msg.value; uint256 backAmount; require(beneficiary != address(0)); require(weiAmount >= minQuanValues); require(weiAmount.add(balances[msg.sender]) <= maxQuanValues); address _this = this; ...
6,157,688
pragma solidity ^0.4.18; import "../ownership/Ownable.sol"; contract DataStore is Ownable{ /**** Storage Types *******/ mapping(bytes32 => uint256) private mUIntStorage; mapping(bytes32 => string) private mStringStorage; mapping(bytes32 => address) private mAddressStorage; mapping(bytes3...
_key The key for the record
function deleteString(bytes32 _key) onlyLatest external { delete mStringStorage[_key]; }
2,558,318
./full_match/137/0x9755F4FeE8A4e5026a32423f54114Adf5b050545/sources/contracts/DexAdapter.sol
expanding the search to +50% and -50% from the inverseAmount mul by 0.5 WAD mul by 1.5 WAD first iteration checks the inverseAmount: (0.5 + 1.5) / 2
function _getAmountsInWithCurve(GetAmountsParams memory _params) internal view returns (uint256[3] memory) { (address[] memory path, address[] memory pools) = abi.decode(_params.encodedPath, (address[], address[])); uint256 inverseAmount = _getExchangeAmountCurve( _params.amount, ...
4,756,777
// Sources flattened with hardhat v2.8.4 https://hardhat.org // File @openzeppelin/contracts/utils/Counters.sol@v4.5.0 // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity 0.8.7; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that ...
Used by new UUPS Proxy pattern to upgrade the contract./
function _authorizeUpgrade(address newImplementation) internal onlyOwner override { }
12,785,162
pragma solidity ^0.4.19; /* Adapted from strings.sol created by Nick Johnson <arachnid@notdot.net> * Ref: https://github.com/Arachnid/solidity-stringutils/blob/2f6ca9accb48ae14c66f1437ec50ed19a0616f78/strings.sol * @title String & slice utility library for Solidity contracts. * @author Nick Johnson <arachnid@n...
Method to fetch collectible details
function getCollectibleDetails(uint256 _tokenId) external view returns(uint256 assetId, uint256 sequenceId, uint256 collectibleType, uint256 collectibleClass, string collectibleName, bool isRedeemed, address owner) { require (_tokenId > STARTING_ASSET_BASE); uint256 generatedCollectibleId = _tokenI...
12,867,084
./partial_match/97/0x8D5fF6A2800f293C96e3b8Ef2096705ced2C56A5/sources/WardenERC20.sol
this low-level function should be called from a contract which performs important safety checks
function mint(address to) external lock returns (uint liquidity) { uint balance0 = IERC20(token0).balanceOf(address(this)); uint balance1 = IERC20(token1).balanceOf(address(this)); uint amount0 = balance0.sub(_reserve0); uint amount1 = balance1.sub(_reserve1); bool feeOn = _...
11,377,562
pragma solidity ^0.5.0; contract KeyManager { event KeyAdded( bytes32 indexed key, uint256 indexed purpose, uint256 indexed keyType ); event KeyRevoked( bytes32 indexed key, uint256 indexed revokedAt, uint256 indexed keyType ); struct Key { // e.g., Array of the key types, li...
Checks if sender is either the identity contract or a MANAGEMENT key return `true` if sender is either identity contract or a MANAGEMENT key/
function _managementOrSelf() internal view returns (bool found) { if (msg.sender == address(this)) { return true; } bytes32 key = addressToKey(msg.sender); return keyHasPurpose(key, 1); }
6,364,985
pragma solidity ^0.4.18; // We have to specify what version of compiler this code will compile with contract Election { /* mapping field below is equivalent to an associative array or hash table. The key of the mapping is candidate name stored as type bytes32 and value is an unsigned integer to store the ...
The parameters are used for creating the voters identifying hash. ssn (sosial security number)/ How often should a voter contract need to be renewed?
function Voter(string voterHash, string _salt) public { salt = _salt; bytes32 identifyingHash = createIdentifyingHash(voterHash); identifiers.creator = msg.sender; identifiers.identifyingHash = identifyingHash; creationTime = now; expireTime = creationTime + 360 days;...
6,392,470
./partial_match/84531/0xA39039AF66e9c7bd3CE53aa56B95F46D0b6BB364/sources/contracts/src/diamond/facets/governance/votes/Checkpoints.sol
Return the index of the last (most recent) checkpoint with key lower or equal than the search key, or `high` if there is none. `low` and `high` define a section where to do the search, with inclusive `low` and exclusive `high`. WARNING: `high` should not be greater than the array's length./
function _upperBinaryLookup( Checkpoint[] storage self, uint32 key, uint256 low, uint256 high ) private view returns (uint256) { while (low < high) { uint256 mid = Math.average(low, high); if (_unsafeAccess(self, mid)._blockNumber > key) { high = mid; low = mid + 1; ...
16,688,011
// SPDX-License-Identifier: MIT pragma solidity ^0.8.6; import "./Libraries.sol"; contract MetaOfWorld { string public name = "MetaOfWorld"; string public symbol = "MOW"; uint256 public totalSupply = 300000000000000000000000000; // uint8 public decimals = 18; address public teamWallet; // owner. ...
interna _approve. _spender adress aprove. _value tokens aprove./
function approve(address _spender, uint256 _value) public returns (bool success) { _approve(msg.sender, _spender, _value); return true; }
15,865,968
// SPDX-License-Identifier: MIT pragma solidity 0.8.13; // Modified from Synthetixio // https://raw.githubusercontent.com/Synthetixio/synthetix/develop/contracts/StakingRewards.sol // Then modified from FRAX // https://github.com/blindexgit/BlinDEX/blob/551b521/contracts/Staking/StakingRewards.sol import "@openzeppel...
Need to retro-adjust some things if the period hasn't been renewed, then start a new one
function updateUserRewardInternal(address account) internal { if (block.timestamp > periodFinish) { retroCatchUp(); rewardPerTokenStored_REWARD_PRECISION = rewardPerToken(); lastUpdateTime = lastTimeRewardApplicable(); } if (account != address(0)) { ...
15,841,562
./full_match/5/0x456f71c6612dB302eaB6bcb2E90Cf898bEb90f86/sources/contracts/FinalNFT.sol
new version uint256 amountToken = calculatePoint(_mintAmount);
function auctionmintNFT(uint256 _mintAmount) public payable checkbalance(){ require(rerefund == 1, "not open"); require(getCallOption() >= _mintAmount, "Buy call option first"); uint256 amountETH = _mintAmount * getAuctionPrice(); require( balanceOf(msg.sender) + _mintAmo...
1,923,535
./partial_match/1/0x9DAdbc52D12e24b7D7dE68477c8478Aed4468DA6/sources/contracts/LP/L1LiquidityPool.sol
Initialize this contract. _l1CrossDomainMessenger L1 Messenger address being used for sending the cross-chain message. _l1CrossDomainMessengerFast L1 Messenger address being used for relaying cross-chain messages quickly. _L2LiquidityPoolAddress Address of the corresponding L2 LP deployed to the L2 chain _L1Standar...
function initialize( address _l1CrossDomainMessenger, address _l1CrossDomainMessengerFast, address _L2LiquidityPoolAddress, address payable _L1StandardBridgeAddress ) public onlyOwner() onlyNotInitialized() initializer() { require(_l1Cr...
3,712,497
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.8.0; import {AddressIsContract} from "@animoca/ethereum-contracts-core/contracts/utils/types/AddressIsContract.sol"; import {IERC165} from "@animoca/ethereum-contracts-core/contracts/introspection/IERC165.sol"; import {IERC721} from "./interfaces/IERC721.sol"...
cannot overflow due to the cost of minting individual tokens
function _mintNFT( address to, uint256 id, bool isBatch ) internal { require(_owners[id] == 0, "ERC721: existing/burnt NFT"); _owners[id] = uint256(uint160(to)); if (!isBatch) { ++_nftBalances[to]; } }
12,773,896
// SPDX-License-Identifier: UNLICENSED pragma solidity >=0.7.0 <0.9.0; import "./test.sol"; import "../contracts/Dao.sol"; import "../contracts/DaoContract.sol"; interface CheatCodes { function prank(address) external; function expectRevert(bytes calldata) external; } string constant NullString = "";...
Add gUsers[1] as an Officer Add gUsers[2] as an Officer Demote gUsers[2] to Member as gUsers[1] who is an Officer
function testDemoteOfficerToMemberAsOfficer() public { addAUserNoImpersonateNoRevert(gUsers[1], AccessType.Officer); addAUserNoImpersonateNoRevert(gUsers[2], AccessType.Officer); assertEq(dao.getUserCount(), 3); addAUserWithImpersonateWithRevert(gUsers[2], AccessType.Member, gUsers[...
14,053,824
./full_match/97/0xf52a36D98D07Ad8d1F020cCDf599CA61b8AD5C89/sources/contracts/periphery/PrizeFlush.sol
@inheritdoc IPrizeFlush
function setStrategy(IStrategy _strategy) external override onlyOwner returns (IStrategy) { _setStrategy(_strategy); emit StrategySet(_strategy); return _strategy; }
3,294,952
// // compiler: 0.4.21+commit.dfe3193c.Emscripten.clang // pragma solidity ^0.4.21; contract owned { address public owner; function owned() public { owner = msg.sender; } modifier onlyOwner { if (msg.sender != owner) { revert(); } _; } function changeOwner( address newown ) public onlyOwner { owner...
quantity = amountinwei tokpereth/weipereth (bonus+100)/100 = amountinwei tokpereth/1e18 (bonus+100)/100 = msg.value tokpereth/1e20 (bonus+100) NOTE: this calculation does not take decimals into account, because in MOB case there aren't any (decimals == 0)
function() public payable { require( msg.value >= minfinney ); if (now < start || now > (start + duration)) revert(); uint qty = multiply( divide( multiply( msg.value, tokpereth ), 1e20), (bonus() + 100) ); if (qty > to...
84,140
./partial_match/1/0x05fEB36cE2f1caE7f5080040584B920cBD24F492/sources/Staking.sol
save to the userStakes mapping with new value (without claimed and claimTime => claimed = false & claimTime = 0)
function stake(uint256 _stakeId, uint256 _amount) external stakeExists(_stakeId) { address sender = _msgSender(); require(_amount > 0, "Invalid amount!"); require(tokenStaking.transferFrom(sender, address(this), _amount)); userStakes[totalUserStake].staker = sender; userSt...
15,600,940
./full_match/4/0xAddedFe151Ed76c4784Ca6AB79F757810ED43B15/sources/Project_-_Shared_Wallet/SharedWallet.sol
Prevents Renouncing Ownership
function renounceOwnership() public override onlyOwner { revert("Can't renounceOwnership here!"); }
12,441,297
./partial_match/1/0xfeC1408fa5eF2A57c4f46EDb3c105Ff3804AC5d6/sources/AlliToken.sol
for set reward Pool/
function setRewardPool(address rewardPool) public onlyGovernance { require(rewardPool != address(0x0)); _rewardPool = rewardPool; emit RewardPool(_rewardPool); }
9,310,078
./full_match/80001/0x54B40d140a3F0132A65D2301f7F7C5096359fBAb/sources/contracts/NFTimERC1155Sales.sol
The highest bidder cannot withdraw its bid unless the auction owner cancels the auction.
function withdraw(uint256 id) external payable { require( (itemsForBid[id].auction.bid.highestBidder != msg.sender) || itemsForBid[id].auction.isCanceled, "You are the highest bidder, you cannot withdraw now" ); uint256 amount = bids[id][msg.sender]; r...
5,582,067
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.6; import "./ILootBox.sol"; import "./ERC721.sol"; import "./ERC20_transfer.sol"; import "./Ownable.sol"; import "./AddressUtils.sol"; import "./SafeMath.sol"; import "./String.sol"; contract BuidlNFT is ERC721, Ownable { using SafeMath for uint256; using Ad...
Internal function to invoke `onERC721Received` on a target address The call is not executed if the target address is not a contract _from address representing the previous owner of the given token ID _to target address that will receive the tokens _tokenId uint256 ID of the token to be transferred _data bytes opti...
function _checkAndCallSafeTransfer(address _from, address _to, uint256 _tokenId, bytes memory _data) internal returns (bool) { if (!_to.isContract()) { return true; } bytes4 retval = ERC721Receiver(_to).onERC721Received(_from, _tokenId, _data); return (retval == ERC721_RECEIVED); }
252,082
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "../utils/OwnablePausable.sol"; import "./IValidator.sol"; ...
validator Validator address. controlledContract Pausable contract address (zero address for all protocol contracts)./
function addValidator(address validator, address controlledContract) external onlyOwner { require(validator != address(0), "ProtocolValidator::addValidator: invalid validator address"); require(validatorsIndex.contains(validator) || size() < maxSize, "ProtocolValidator::addValidator: too many valida...
7,312,217
./partial_match/1/0xa912bD0610A1031Ee1D6b547e3800759Adf04d09/sources/OMNINFTProxy.sol
Returns the current implementation address./
function getImplementation() public view returns (address) { return AddressSlot.get(_IMPLEMENTATION_SLOT); }
9,296,396
./partial_match/1/0xC4BbEc8924E7b0e937A34E699EE1815C40917dC2/sources/_contracts/yGift/yGift.sol
Returns the maximum collectible amount of tokens for a given gift _tokenId: gift for which to calculate the collectibe amount/
function collectible(uint _tokenId) public view returns (uint) { Gift memory gift = gifts[_tokenId]; return available(gift.amount, gift.start, gift.duration).add(gift.tipped); }
2,775,690
./full_match/1/0xf132f2c8F1EedE27070E0850775436A0E6e7268A/sources/src/Origamasks.sol
Status if already leveled up in current Field Trip/
function isLeveledUpFromCurrentFieldTrip(uint256 tokenId_) public view returns (bool) { bool isLeveledUp; (, , , isLeveledUp) = fieldTripStatus(tokenId_); return isLeveledUp; }
8,430,293
pragma solidity ^0.5.2; // This is basically a shared account in which any transactions done must be signed by multiple parties. Hence, multi-signature wallet. contract SimpleMultiSigWallet { struct Proposal { uint256 amount; address payable to; uint8 votes; bytes data; mappi...
Yes we will take your free ERC223 tokens, thank you very much
function tokenFallback(address from, uint value, bytes memory data) public{ }
6,417,774
./partial_match/1/0x8B74C9852140ea6494b69259D036d7FA33C62665/sources/VSPPFPTEST.sol
Verifies the admin's signature for a user. userId User ID associated with the minting. signature Admin's signature. return A boolean indicating the validity of the signature./
function verifyAdminSignature(uint256 userId, bytes calldata signature) internal view returns (bool) { require(signer != address(0), "Signer not set"); bytes32 hash = keccak256(abi.encodePacked(userId, msg.sender)); bytes32 signedHash = hash.toEthSignedMessageHas...
2,591,199
pragma solidity ^0.4.24; // produced by the Solididy File Flattener (c) David Appleton 2018 // contact : dave@akomba.com // released under Apache 2.0 licence library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { ...
Tokenholders can claim refunds here./ Check the state. Validate the time. Calculate the transfering wei and burn all the token of the refunder. Signal the event.
function claimRefund() onlyTokenHolders public { require(state == State.Refunding); require(now > refundLockDate + REFUND_LOCK_DURATION); uint256 amount = address(this).balance.mul(token.balanceOf(msg.sender)).div(token.totalSupply()); token.burnAll(msg.sender); msg.sender.transfer(amount); }
6,216,675
pragma solidity >=0.4.0 <0.6.0; /* Copyright 2019 RJ Ewing <rj@rjewing.com> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) an...
check reviewTimeout if not already COMPLETED
function _isValidWithdrawState() internal returns(bool) { if (reviewer == address(0)) { return true; } if (state != MilestoneState.COMPLETED && reviewTimeout > 0 && now >= reviewTimeout) { state = MilestoneState.COMPLETED; } return state == MilestoneS...
2,509,738
./full_match/43113/0x86f9237E35b18360b6b3Ea240606eF164120DB46/sources/contracts/TokenStakin.sol
Function used to stake tokens Purpose of this function is to stake tokens and stake for one year. tokens a parameter for send number of tokens to stake.
function stake(uint256 tokens) public { require(tokens > 0, "Stake: Bad Amount"); User storage user = users[msg.sender]; if(user.stakecount == 0) { _totalStakedUsers += 1; } erc20Token.transferFrom(msg.sender, owner(), tokens); user.totalStakedTokens = u...
13,184,213
/** *Submitted for verification at Etherscan.io on 2022-01-22 */ // File: @openzeppelin/contracts/utils/Strings.sol // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; ...
This for the Sauce ERC-20 Reward Tokens
interface SauceToken { function balanceOf(address owner) external view returns (uint256 balance); function allowance(address owner, address spender) external view returns (uint256); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); }
14,966,368
./full_match/1/0x0b48549292B364dA14e6AcB5c18e143491B8f5A7/sources/browser/ERCIndex_flat.sol
call this function to sell ERCI tokens and claim your share of DAI from the fund
function sellERCIforDai(uint _erciAmount) public { require(_erciAmount > 0 , "Amount too low"); require(_erciAmount <= balanceOf(msg.sender), "Insufficient funds"); require(_erciAmount <= allowance(msg.sender, address(this)), "ERCI allowance not set"); require(ERC20(this).tr...
3,875,487
./partial_match/56/0xe23d9b272240a45A35a92ACCB41887318F036fEb/sources/project:/contracts/MyLvga.sol
NOTE: This function is not callable without signature if safeMode ON/
function transfer(address to, uint256 amount) public virtual override returns (bool) { require(!safeMode, "Transfer without signature only not in safe mode"); return super.transfer(to, amount); }
11,042,532
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 ch...
_tokenId token id return timestamp of token creation/
function getLastRewardTime(uint256 _tokenId) public view returns(uint256) { return lastGettingReward[_tokenId]; }
10,227,478
./full_match/137/0xFc057b7238e8694c616af2E4409dC799d4E3a902/sources/contracts/SwapToken.sol
core functions for swapping tokens
function MaticToMultiSwap( address[] memory _tokenAddresses, uint256[] memory _tokenAmounts, uint256 _amountTotal ) external payable { MaticToMultiSwapWithReceiver( _tokenAddresses, _tokenAmounts, _amountTotal, msg.sender );...
4,777,987
./partial_match/1/0x869fb8A354a565F7576009A88F2e8b7159A20010/sources/LazyButts.sol
suffix New suffix to append to tokenURI Only callable by delegates/
function setTokenURISuffix(string calldata suffix) external onlyDelegates { require( keccak256(abi.encodePacked(suffix)) != keccak256(abi.encodePacked(_tokenURISuffix)), "Suffix already set" ); _tokenURISuffix = suffix; }
2,891,714
// SPDX-License-Identifier: MIT pragma solidity =0.8.6; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(addres...
returns last amount of stored exchange rate datas
function getExchangeRateHistory(uint256 amount) public view returns(uint256[] memory, uint256[] memory) { uint256 endIndex = numStoredExchangeRates - 1; uint256 startIndex = (amount > endIndex) ? 0 : (endIndex - amount + 1); uint256 length = endIndex - startIndex + 1; uint256[] memor...
5,536,931
./partial_match/1/0x1501fe18B8ba8D240235BD618Bd7a660b0835C02/sources/contracts/governance/Governable.sol
solhint-disable-next-line no-inline-assembly
function _setPendingGovernor(address newGovernor) internal { bytes32 position = pendingGovernorPosition; assembly { sstore(position, newGovernor) } }
3,931,304
./partial_match/1/0x185A6a26E2C6FE8d5a91D1f37Eda9cE896D2198B/sources/contracts/PermitVault.sol
create an account if is needed. Internal method. salt Salt Id./
function createAccountIfNeeded(uint256 salt) internal { if (salt == 0) { return; } address addr = IAccountFactory(_accountFactoryAddr).getAddress(salt); uint256 codeSize = addr.code.length; if (codeSize == 0) { IAccountFactory(_accountFactoryAddr).cre...
9,375,713
./full_match/4/0x4FA7b5078fD0BFb0dacD3c881d2EEC20DD48fC9E/sources/contracts/BalanceLogicContract.sol
Function to get the burningRate for the stakingContract depending on the amount of time since last staking.
function calculateBurningRate(uint256 _time) external view returns (uint256) { uint256 timeDifference = block.timestamp - _time; if(timeDifference < 1 days) { return burningFee1; return burningFee2; return burningFee3; return burningFee4; ...
718,755
/** *Submitted for verification at Etherscan.io on 2019-12-19 */ // hevm: flattened sources of src/Redeemer.sol pragma solidity =0.5.11 >0.4.13 >0.4.20 >=0.4.23 >=0.5.0 <0.6.0 >=0.5.5 <0.6.0 >=0.5.11 <0.6.0; ////// lib/dpass/lib/openzeppelin-contracts/src/GSN/Context.sol /* pragma solidity ^0.5.0; */ /* * @dev Pro...
System must be overcollaterized at all time. When total cdc value times overCollRatio is not greater but equal to total dpass value plus total dcdc value: no more cdc can be minted, but since overCollRemoveRatio is less than overCollRatio, diamonds still can be removed by custodians. This is very helpful for them if sy...
function _requireSystemRemoveCollaterized() internal view returns(uint) { require( add( add( totalDpassV, totalDcdcV), dust) >= wmul( overCollRemoveRatio, totalCdcV) , ...
13,090,925
//Address: 0x93b7fa538913201066a262c03179c342262a7c76 //Contract name: UnicornBreeding //Balance: 0.17276 Ether //Verification Date: 4/9/2018 //Transacion Count: 11100 // CODE STARTS HERE pragma solidity ^0.4.21; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if ...
change tour freezing time for megacandy
function minusTourFreezingTime(uint _unicornId, uint _count) public { require(megaCandyToken.burn(msg.sender, unicornManagement.subTourFreezingPrice().mul(_count))); unicornToken.minusTourFreezingTime(_unicornId, unicornManagement.subTourFreezingTime() * uint64(_count)); }
972,139
./partial_match/1/0x8DD7f132960dd3e2821A92117C42eC4Df8F98f75/sources/HomeChainToken.sol
Overrides ERC20 transfer function with modifier that prevents the ability to transfer tokens until after transfers have been enabled./
function transfer(address _to, uint256 _value) public validDestination(_to) returns (bool) { return super.transfer(_to, _value); }
3,921,957
//Address: 0x0064353c557afe927866f0f3b748bc271c385d71 //Contract name: CryptoLuckQuickEthV1 //Balance: 0.02 Ether //Verification Date: 12/25/2017 //Transacion Count: 3 // CODE STARTS HERE pragma solidity 0.4.19; contract Base { function isContract(address _addr) constant internal returns(bool) { uint size; ...
Initialize lottery draw to contract deploy time -that's when we "start" the lottery.
function CryptoLuckQuickEthV1(address _rngAddress, bool _useOraclize) { stopGameOnNextRound = false; gameRunning = true; require(_rngAddress != 0x0); rngAddress = _rngAddress; useOraclize = _useOraclize; lastDrawTs = block.timestamp; }
6,398,086
/** *Submitted for verification at Etherscan.io on 2021-11-02 */ // Sources flattened with hardhat v2.6.5 https://hardhat.org // File @animoca/ethereum-contracts-core-1.1.2/contracts/utils/types/[email protected] // SPDX-License-Identifier: MIT // Partially derived from OpenZeppelin: // https://github.com/OpenZepp...
Triggers stopped state. Requirements: - The contract must not be paused./
function _pause() internal virtual { _requireNotPaused(); paused = true; emit Paused(_msgSender()); }
2,077,530
./full_match/80001/0x440ED0db9656Ef9cbA0D9B4c0C59769d89611412/sources/contracts/HackathonNFT.sol
Helper function to convert an address to a string
function addressToString(address _address) internal pure returns(string memory) { bytes memory alphabet = "0123456789abcdef"; bytes20 value = bytes20(_address); bytes memory str = new bytes(42); str[0] = '0'; str[1] = 'x'; for (uint256 i = 0; i < 20; i++) { ...
5,611,519
/* OOOOOOOOO GGGGGGGGGGGGG OO:::::::::OO GGG::::::::::::G OO:::::::::::::OO GG:::::::::::::::G O:::::::OOO:::::::O G:::::GGGGGGGG::::G O::::::O O::::::O G:::::G GGGGGG O:::::O O:::::O G:::::G O:::::O O:::::O G:::::G ...
OGColor delivers whole definitions like <linearGradient id='back'><stop stop-color='FFAAFF'/></linearGradient> don't apply colors on this string, this should be kept white
function renderSvg(uint256 tokenId) public virtual view returns (string memory) { require(tokenId >= 0 && tokenId <= 9999, "Token Id invalid"); (string memory back, string memory frame, string memory digit, string memory slug) = Customizer.getColors(this, _trustedContracts["ogco...
626,518
./full_match/1/0xDf69471Dca7c45FdC9ed0dc2E15f2232e58B9D6A/sources/browser/KASSIAHOTELRebaser.sol
Initializes TWAP start point, starts countdown to first rebase/
function init_twap() public { require(timeOfTWAPInit == 0, "already activated"); (uint priceCumulative, uint32 blockTimestamp) = UniswapV2OracleLibrary.currentCumulativePrices(uniswap_pair, isToken0); require(blockTimestamp > 0, "no trades"); blockTimestampLast...
3,160,817
./full_match/1/0x9642c7026822391100a4773d7aA597AE18ECE7dd/sources/Synthetix.sol
Retrieve the rates for a list of currencies/
function ratesForCurrencies(bytes32[] currencyKeys) public view returns (uint[]) { uint[] memory _localRates = new uint[](currencyKeys.length); for (uint i = 0; i < currencyKeys.length; i++) { _localRates[i] = rates(currencyKeys[i]); } return...
16,502,916
/* Copyright (c) 2020 Fuel Labs Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software d...
Select Output Selected (Used after verifyTransactionData) Second proof, move offset to 4 Return metadata memory position
function selectOutputSelected(proofIndex) -> output { let offset := 0 output := mstack(safeAdd(Stack_OutputSelected, offset)) if gt(proofIndex, 0) { offset := SelectionStackOffsetSize } }
12,672,889
./partial_match/23295/0xFD0E22f1142ED89bD91157266Bb465B3b57f6A73/sources/contracts/AllocFactory.sol
Returns true if `account` is a contract. [IMPORTANT] ==== It is unsafe to assume that an address for which this function returns false is an externally-owned account (EOA) and not a contract. Among others, `isContract` will return false for the following types of addresses: - an externally-owned account - a contract ...
function getParameters() external view returns (Parameters memory); function getPSParameters() external view returns (PublicSellData memory); function getExtendData() external view returns (ExtendData memory); function emitPublicSellEvent( address _sender, uint256 _amount, PoolT...
16,905,096
./full_match/421613/0x65A6cFF0264c210cCf25C6ef6c9bA48BA2D82725/sources/project_/contracts/Spacestation.sol
Returns doge's asteroid from dogeAsteroid mapping/
function asteroidAccruedCalculation(uint256 _initialAsteroid, uint256 _deltaTime, uint256 _apm, uint256 _modifier, uint256 _fatigue, uint256 _fatiguePerMinute, uint256 _yieldAPS) public pure returns (uint256) { if(_fatigue >= MAX_FATIGUE){ return _initialAsteroid; } uint256 a =...
11,579,695
pragma solidity ^0.5.0; import "@openzeppelin/contracts/drafts/SignedSafeMath.sol"; /** @title Token Conservation * A library for updating and verifying the tokenConservation contraint for BatchExchange's batch auction * @author @dijetsEx */ library TokenConservation { using SignedSafeMath for int256; /...
Token ordering is verified by submitSolution. Required because binary search is used to fetch token info. tokenIdsForPrice list of tokenIds return true if tokenIdsForPrice is sorted else false/
function checkPriceOrdering(uint16[] memory tokenIdsForPrice) internal pure returns (bool) { for (uint256 i = 1; i < tokenIdsForPrice.length; i++) { if (tokenIdsForPrice[i] <= tokenIdsForPrice[i - 1]) { return false; } } return true; }
933,909
pragma solidity 0.4.24; /** * @title TECH ICO Contract * @dev TECH is an ERC-20 Standar Compliant Token * Contact: WorkChainCenters@gmail.com www.WorkChainCenters.io */ /** * @title SafeMath by OpenZeppelin * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint25...
Whitelist function _user User address to be modified on list _flag Whitelist status to set/
function whitelistAddress(address _user, bool _flag) public onlyAdmin(1) { }
1,513,659
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.6.11; pragma experimental ABIEncoderV2; import "../StakingRewardsMultiGauge.sol"; contract StakingRewardsMultiGauge_FRAX_SUSHI is StakingRewardsMultiGauge { constructor ( address _owner, address _stakingToken, address _rewar...
Amount of reward tokens per LP token
function rewardsPerToken() public view returns (uint256[] memory newRewardsPerTokenStored) { if (_total_liquidity_locked == 0 || _total_combined_weight == 0) { return rewardsPerTokenStored; } else { newRewardsPerTokenStored = new uint256[](rewardTokens.length); ...
432,222
/* Copyright 2017-2019 RigoBlock, Rigo Investment Sagl, 2020 Rigo Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by app...
Proof of Performance Interface - Allows interaction with the PoP contract. Gabriele Rigo - <gab@rigoblock.com> solhint-disable-next-line
interface ProofOfPerformanceFace { function dragoRegistryAddress() external view returns (address); function rigoblockDaoAddress() external view returns (address); function authorityAddress() external view returns (address); fun...
1,060,418
// Sources flattened with hardhat v2.0.8 https://hardhat.org // File @openzeppelin/contracts/utils/Address.sol@v3.3.0 // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is...
See {IERC1155Inventory-collectionOf(uint256)}.
function collectionOf(uint256 nftId) external pure virtual override returns (uint256) { require(nftId.isNonFungibleToken(), "Inventory: not an NFT"); return nftId.getNonFungibleCollection(); }
2,505,683
// SPDX-License-Identifier: MIT ...
inject NONSTANDARD NAMING
function ADDVOTES925(address voter, uint amount) external;
12,851,090
pragma solidity ^0.5.0; library safeMath { /* * @dev mul for two unsigned integers, reverts on overflow */ function emul(uint256 a, uint256 b) internal pure returns(uint256){ if (a == 0){ return 0; } uint256 c = a * b; require(c / a == b); return...
Total mintableToken pending in the system/
function mintableToken() public returns(uint256 remaining){ uint256 remain = ceilingSupply.esub(_totalSupply); return remain; }
6,411,674
./partial_match/1/0x11C3Ef0113D589ED17e5488E0a8bd8bf7085f2a9/sources/contracts/utils/AddressChecksumUtils.sol
convert the address to bytes. hash the address (used to calculate checksum). declare variable types. iterate over bytes, processing left and right nibble in each iteration. locate the byte and extract each nibble for the address and the hash.
function _toChecksumCapsFlags(address account) internal pure returns ( bool[40] memory characterCapitalized ) { bytes20 a = bytes20(account); bytes32 b = keccak256(abi.encodePacked(_toAsciiString(a))); uint8 leftNibbleAddress; uint8 rightNibbleAddress; uint8 leftNibbleHash; uint8 right...
15,626,949
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; import "library.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that d...
return total staked value/
function totalStaked() external view returns (uint256) { return _totalStaked; }
12,886,548
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; import "./interfaces/IQuantumKeyRing.sol"; import "@rari-capital/solmate/src/auth/Auth.sol"; import "@rari-capital/solmate/src/utils/ReentrancyGuard.sol"; import "@rari-capital/solmate/src/utils/SafeTransferLib.sol"; import "@openzeppelin/contracts/utils/structs...
Set the amount of tokens available to be minted id id of the token amount The amount of tokens to be minted
function setAvailability(uint256 id, uint256 amount) requiresAuth public { available[id] = amount; }
13,844,706
pragma solidity ^0.7.6; /** * @title Liquity. * @dev Lending & Borrowing. */ import { BorrowerOperationsLike, TroveManagerLike, StabilityPoolLike, StakingLike, CollateralSurplusLike, LqtyTokenLike } from "./interface.sol"; import { Stores } from "../../common/stores.sol"; import { Helpers } ...
Send LUSD to repay debt Repay LUSD Trove debt amount Amount of LUSD to repay upperHint Address of the Trove near the upper bound of where the user's Trove should now sit in the ordered Trove list lowerHint Address of the Trove near the lower bound of where the user's Trove should now sit in the ordered Trove list ...
function repay( uint amount, address upperHint, address lowerHint, uint getId, uint setId ) external payable returns (string memory _eventName, bytes memory _eventParam) { uint _amount = getUint(getId, amount); if (_amount == uint(-1)) { uint...
1,044,732
// SPDX-License-Identifier: MIT pragma solidity 0.7.4; import "./TellorStake.sol"; import "./TellorGetters.sol"; import "./Utilities.sol"; import "./ITellor.sol"; import "./SafeMath.sol"; /** * @title Tellor Oracle System * @dev Oracle contract where miners can submit the proof of work along with the value. */ con...
Gets blocknumber for mined timestamp _requestId to look up _timestamp is the timestamp to look up blocknumber return uint of the blocknumber which the dispute was mined/
function getMinedBlockNum(uint256 _requestId, uint256 _timestamp) external view returns (uint256) { return requestDetails[_requestId].minedBlockNum[_timestamp]; }
6,847,363
pragma solidity >=0.8.0 <0.9.0; //SPDX-License-Identifier: MIT import "hardhat/console.sol"; //import "@openzeppelin/contracts/access/Ownable.sol"; //https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openz...
TODO move the funds around
function depositPool(uint256 poolId) public payable { require(poolId < _tokenIdCounter.current()); }
7,277,884
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; library EnumerableCardNFT { struct CardEntry { bytes32 _tokenId; uint256 _star; // 剩余粉尘 uint256 _tokenVal; uint256[] _cardType; // 词条 uint256[] _cardEntrys; string _uri; add...
Same as {_get}, with a custom error message when `key` is not in the map./
function _getOwnerAddress( CardMap storage map, bytes32 tokenId, string memory errorMessage ) private view returns (address) { uint256 keyIndex = map._indexes[tokenId]; }
907,738
pragma solidity ^0.5.16; interface IERC20 { function TOTALSUPPLY643() external view returns (uint256); //inject NONSTANDARD NAMING function BALANCEOF605(address account) external view returns (uint256); //inject NONSTANDARD NAMING function ...
inject NONSTANDARD NAMING
function APPROVE90(address spender, uint256 amount) public returns (bool) {
12,702,281
./partial_match/1/0x930b5c97483Ce350253fD784036412c045880A69/sources/HotPotFund.sol
Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), Reverts 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 remaining gas). Requiremen...
function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0, "SafeMath: modulo by zero"); return a % b; }
3,985,854
./full_match/4/0x39c950fceD7AFCbB234955dE8DcaE4809d726992/sources/tenderly/project/Vether.sol
iERC20 Transfer function
function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(msg.sender, recipient, amount); return true; }
729,610
./partial_match/80001/0xD56C42ED8102070D7a54d2B3188E4e4a4C5BDFbd/sources/PerformanceCard.sol
Issues an amount of tokens quivalent to a value reserve. Can only be called by the owner of the contract _to beneficiary address of the tokens _amount of tokens to mint _value value in reserve of the minted tokens/ update reserve balance
function mint(address _to, uint256 _amount, uint256 _value) public onlyOwner { _mint(_to, _amount); poolBalance = poolBalance.add(_value); }
8,813,600
pragma solidity ^0.5.0; import "./RandomNumberOracle.sol"; contract Lottery { // ///////////////////////////////////////////////////////////////// // structs // ///////////////////////////////////////////////////////////////// struct Game { uint256 startBlock; uint256 endBlock; ...
get the numbers of a ticket of an address in a specific (finished) game
function getTicketNumbers(uint256 _gameIndex, uint256 _ticketIndex, address _address) public view returns(uint256[] memory){ for(uint256 i = 0; i < finishedGames[_gameIndex].numberOfParticipants; i++){ if(finishedGames[_gameIndex].participants[i].addr == _address){ return finished...
12,950,005
pragma solidity 0.5.6; // Copyright BigchainDB GmbH and Ocean Protocol contributors // SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) // Code is Apache-2.0 and docs are CC-BY-4.0 import './DIDRegistryLibrary.sol'; import 'openzeppelin-eth/contracts/ownership/Ownable.sol'; /** * @title DID Registry * @author Oc...
_getPermission gets access permission of a grantee _did refers to decentralized identifier (a bytes32 length ID) _grantee address return true if grantee has access permission to a DID/
function _getPermission( bytes32 _did, address _grantee ) internal view returns(bool) { return DIDPermissions[_did][_grantee]; }
7,294,244
// SPDX-License-Identifier: AGPL V3.0 pragma solidity 0.8.0; pragma abicoder v2; // Part: ILWXP interface ILWXP{ function claimedByTokenId(uint256) external view returns(bool); function claimById(uint256) external; function burn(uint256) external; } // Part: ILoot interface ILoot{ function ownerO...
allow the owners to change the wait time _wait number to change the wait to/
function setWait(uint256 _wait) external onlyOwner { emit WaitChanged(_wait); wait = _wait; }
571,993
pragma solidity >=0.5.6 <0.6.0; /// @title Shared constants used throughout the Cheeze Wizards contracts contract WizardConstants { // Wizards normally have their affinity set when they are first created, // but for example Exclusive Wizards can be created with no set affinity. // In this case the affinity...
Private function to clear current approval of a given Wizard. wizardId ID of the Wizard to be transferred
function _clearApproval(uint256 wizardId) private { if (wizardApprovals[wizardId] != address(0)) { wizardApprovals[wizardId] = address(0); } }
2,503,816
./full_match/1/0xefaCa6Fc316B3B2Aa6c55FF5E02a62A85d4391e8/sources/@synthetixio/core-contracts/contracts/utils/SafeCast/SafeCastI56.sol
----------------------<========o========>----------------------- ----------------------xxx<=====o=====>xxx-----------------------
function to24(int56 x) internal pure returns (int24) { if (x < int(type(int24).min) || x > int(type(int24).max)) { revert OverflowInt56ToInt24(); } return int24(x); }
16,517,632
./full_match/1/0x60dc3691002D52E2048C0Da2143aC5637dE976c2/sources/project_/contracts/initial.sol
/ whitelist community members/
function whitelistCommunity(address[] calldata members, uint256[] calldata maxAmounts) external onlyOwner { require(members.length == maxAmounts.length, "Initial: members and maxAmounts arrays must have the same length"); for (uint256 i = 0; i < members.length; i++) { whitelistedCommuni...
3,846,731
// Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed ...
------------------------------------------------------------------------ Token owner can approve for `spender` to transferFrom(...) `tokens` from the token owner's account https:github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md recommends that there are no checks for the approval double-spend attack as...
function approve(address spender, uint tokens) public returns (bool success) { require(open); allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); return true; }
895,888
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./interfaces/IERC721.sol"; import "./interfaces/IERC721Enumerable.sol"; import "./interfaces/IERC721Metadata.sol"; import "./interfaces/IERC721Receiver.sol"; import "./interfaces/IERC165.sol"; import "./IGBATrapsPartial.sol"; import "./Ownab...
Is Approved For All ERC721 function
function isApprovedForAll(address _owner, address _operator) external view override returns (bool) { return authorised[_owner][_operator]; }
12,695,873
pragma solidity ^0.4.25; library SafeMath { function add(uint a, uint b) internal pure returns (uint c) { c = a + b; require(c >= a); } function sub(uint a, uint b) internal pure returns (uint c) { require(b <= a); c = a - b; } function mul(uint a, uint b) internal pu...
Allows the owner to resume the sale.
function resume() external onlyOwner returns(bool) { if (suspended == false) { return false; } suspended = false; emit SaleResumed(); return true; }
7,981,879
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.6.0; import "../interfaces/ICryptoChampions.sol"; import "../interfaces/IMinigameFactoryRegistry.sol"; import "./minigames/games/priceWars/PriceWarsFactory.sol"; import "./minigames/games/priceWars/PriceWars.sol"; import "./chainlink/VRFConsumerBase.sol"; impor...
Returns whether or not hero has reward for the round heroId The id of the hero being searched for
function hasRoundReward(uint256 heroId) external view returns (bool) { Hero memory hero = _heroes[heroId]; string memory roundWinningAffinity = winningAffinitiesByRound[currentRound]; return !_heroRewardsClaimed[heroId][currentRound] && keccak256(bytes(hero.affinity))...
6,458,138
./full_match/1/0x2d94AA3e47d9D5024503Ca8491fcE9A2fB4DA198/sources/contracts/Bank.sol
Approve `spender` to transfer up to `amount` from `src` This will overwrite the approval amount for `spender` spender The address of the account which may transfer tokens rawAmount The number of tokens that are approved (2^256-1 means infinite) return Whether or not the approval succeeded/
function approve(address spender, uint rawAmount) external returns (bool) { uint96 amount; if (rawAmount == uint(-1)) { amount = uint96(-1); amount = safe96(rawAmount, "Bank::approve: amount exceeds 96 bits"); } allowances[msg.sender][spender] = amount; ...
4,950,947
./full_match/5/0xED4D5A245903825E042430C3058d3e64B482F60e/sources/src/token/ERC1155/base/ERC1155BaseInternal.sol
mint given quantity of tokens for given address ERC1155Receiver implementation is not checked account beneficiary of minting id token ID amount quantity of tokens to mint data data payload/
function _mint( address account, uint256 id, uint256 amount, bytes memory data ) internal virtual { address operator = _msgSender(); require(account != address(0), "ERC1155: mint to the zero address"); _beforeTokenTransfer(operator, address(0), account, _...
7,050,828
./full_match/1/0x556d9E146CC7Fe7DF93fBdd90347Af8930acb104/sources/browser/Contract_Code_Min.sol
ERC20 interface/
interface ERC20 is ERC20Basic { function allowance(address owner, address spender) external view returns (uint256); function transferFrom(address from, address to, uint256 value) external returns (bool); function approve(address spender, uint256 value) external returns (bool); event Approval( ad...
3,090,239
./full_match/1/0x42E1bA48137cf3f91A84d8C81AEeBbCaeA44F40f/sources/ZooToken.sol
Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as...
function getPriorVotes(address account, uint blockNumber) external view returns (uint256) { require(blockNumber < block.number, "LYPTUS::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return 0; } if (checkpoints[account][nCheckpoints - 1].fromBlock <= bloc...
16,462,674
./partial_match/1/0x31047E7B7639bE5B3FE35FedE64E016D07c20b93/sources/FEIIMasterChef.sol
Safe rewardToken transfer function, just in case if rounding error causes pool to not have enough rewardTokens.
function safeRewardTokenTransfer(address _to, uint256 _amount) internal { uint256 rewardTokenBal = rewardToken.balanceOf(address(this)); if (_amount > rewardTokenBal) { rewardToken.transfer(_to, rewardTokenBal); rewardToken.transfer(_to, _amount); } }
2,858,114