file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
// File: @openzeppelin\contracts-ethereum-package\contracts\math\SafeMath.sol pragma solidity ^0.5.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assum...
Withdraw tokens from protocol (all underlying tokens proportiaonally) _protocol Protocol to withdraw from nAmount Normalized (to 18 decimals) amount to withdraw return Amount of PoolToken burned from user/distributeRewardIfRequired(_protocol);Additional Yield received from protocol (because of lottery, or something)
function withdrawAll(address _protocol, uint256 nAmount) public operationAllowed(IAccessModule.Operation.Withdraw) returns(uint256) { PoolToken poolToken = PoolToken(protocols[_protocol].poolToken); uint256 nBalanceBefore = distributeYieldInternal(_protocol); withdrawFromProto...
33,304
./full_match/80001/0xd42b453AD626935D9bFef859041498350cf5954F/sources/contracts/Contract.sol
トークンごとの Approval を設定する関数
function approve(address _operator, uint256 _tokenId) public override { require(!tokenLocks[_tokenId], "Approval is locked for this token."); super.approve(_operator, _tokenId); }
5,548,867
pragma solidity ^0.4.18; /* VERSION DATE: 04/06/2018 CREATED BY: CRYPTO SPORTZ ENJOY YOUR TEAM AND SPORTS AND EMAIL US IF YOU HAVE ANY QUESTIONS */ contract ERC721Abstract { function implementsERC721() public pure returns (bool); function balanceOf(address _owner) public view returns (uint256 balance); function o...
only owner/admin or anybody after 60 days LogEvent( "CancelGame", curGame.nameGame, idGame );
function cancelGame(uint32 idGame) public { Game storage curGame = game[idGame]; require( curGame.status == Status.PLAYING ); require( msg.sender == owner || admins[msg.sender] || timenow() > curGame.dateStopBuy + 60 days ); curGame.status = Status.CANCELING; takeFee(idGame); }
1,168,102
pragma solidity ^0.4.15; // File: contracts\infrastructure\ITokenRetreiver.sol /** * @title Token retrieve interface * * Allows tokens to be retrieved from a contract * * #created 29/09/2017 * #author Frank Bonnet */ contract ITokenRetreiver { /** * Extracts tokens from the contract ...
Send `_value` token to `_to` from `_from` on the condition it is approved by `_from` _from The address of the sender _to The address of the recipient _value The amount of token to be transferred return Whether the transfer was successful or not/
function transferFrom(address _from, address _to, uint _value) public only_when_unlocked returns (bool) { return super.transferFrom(_from, _to, _value); }
930,971
./full_match/4/0xA5FbD41d6C978c98C3E0C0Cfc31Eb7987Cd75dA2/sources/contracts/safechain/safechain.sol
uint256 weiValue = (income 1e18)/ethereumPrice;
function distributeFunds(address userAddress, uint256 investmentAmount,uint256 investmentToken, uint8 planType) private { address recipientAddress=userAddress; uint256 income; for(uint8 i=0; i<10;i++){ recipientAddress=users[recipientAddress].referrer; if...
799,690
./full_match/1/0x9965cCd16803432C6a0842f1D5690f32E427aEDd/sources/contracts/Auction.sol
Submits A New Bid To The Auction/
function NewBid(address Vault) external payable nonReentrant { }
8,470,742
./full_match/1/0x82a7b5842085f434c6584A8c44b6A1C15c25a512/sources/contracts/test/ExternalCollateralLiquidator.sol
/ Getters // Get collateral status collateralHash Collateral hash return Collateral tracker/
function collateralStatus(bytes32 collateralHash) external view returns (CollateralStatus) { return _collateralTracker[collateralHash]; }
9,659,464
// File: @aragon/court/contracts/lib/os/IsContract.sol // Brought from https://github.com/aragon/aragonOS/blob/v4.3.0/contracts/common/IsContract.sol // Adapted to use pragma ^0.5.8 and satisfy our linter rules pragma solidity ^0.5.8; contract IsCon...
inject NONSTANDARD NAMING
function TRANSFERFROM747(address _from, address _to, uint256 _value) public returns (bool);
2,479,417
./partial_match/1/0xee2058A11612587Ef6F5470e7776ceB0E4736078/sources/FlapperMom.sol
Governance actions with delay
function setOwner(address _owner) external onlyOwner { owner = _owner; emit SetOwner(_owner); }
9,161,172
pragma solidity ^0.4.18; // solhint-disable-line /// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens /// @author Dieter Shirley <dete@axiomzen.co> (https://github.com/dete) contract ERC721 { // Required methods function approve(address _to, uint256 _tokenId) public; function balanceOf...
Creates a new promo Person with the given name, with given _price and assignes it to an address.
function createPromoPerson(address _owner, string _name, uint256 _price) public onlyCOO { require(promoCreatedCount < PROMO_CREATION_LIMIT); address personOwner = _owner; if (personOwner == address(0)) { personOwner = cooAddress; } if (_price <= 0) { _price = startingPrice; } ...
5,841,145
./partial_match/421613/0x7b3A237DD74D1195B769617dE74AD67867F56497/sources/contracts/newFactory.sol
buy tickets/transfer token to contract
function buyTicket(address _raffle,address _tokenType, uint256 slotPrice,uint256 _numSlots) public { uint256 estimatedPrice = (_numSlots * slotPrice)/(10**18); require(IERC20(_tokenType).allowance(msg.sender, address(this)) >= estimatedPrice,"Insufficient Token Allowance"); Arbflle raffle = ...
16,825,601
./full_match/80001/0xB6ECa3c9Ef10ED4853809D0c0836aBf8aD922420/sources/contracts/other/Pi/tba/PiTokenBoundAccount.sol
Withdraw funds for this account from Entrypoint.
function withdrawDepositTo(address payable withdrawAddress, uint256 amount) public virtual override { require(owner() == msg.sender, "Account: not NFT owner"); entryPoint().withdrawTo(withdrawAddress, amount); }
9,438,004
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.10; pragma abicoder v2; import "../AbstractMangrove.sol"; import "../MgvLib.sol"; import "hardhat/console.sol"; import "./Toolbox/TestUtils.sol"; import "./Agents/TestToken.sol"; import "./Agents/TestMaker.sol"; import "./Agents/TestMoriartyMaker.sol"; impor...
ERC20(order.outbound_tkn).transfer({recipient: taker, amount: order.wants});
function makerExecute(ML.SingleOrder calldata) public pure override returns (bytes32) { return ""; }
12,842,070
./full_match/3/0x9Cf53e772473189eAfeC7efA48eD2E1E446fa8FF/sources/delta.sol
referrerAddress or referralID must be provided, the unused parameter should be left as 0 We check that LSW has already started We check if liquidity generation didn't end We check if liquidity genration still has time in it We check if user agreed with the terms of the smart contract
function contributeLiquidity(bool readAndAgreedToLiquidityProviderAgreement, address referrerAddress, uint256 referralID) public payable { require(refundsOpen == false, "Refunds Opened, no deposit"); require(liquidityGenerationHasStarted, "Liquidity generation did not start"); require(liquidityGenerationH...
8,225,065
// to test issue with nodes breaking with large clients over WS // fixed in web3 with fragmentationThreshold: 8192 pragma solidity ^0.4.17; contract BigFreakingContract { event Transfer(address indexed from, address indexed to, uint value); event Approval( address indexed owner, address indexed spender, uint valu...
TODO: should increase instead
function approve_341(address spender, uint value) public returns (bool ok) { _approvals[msg.sender][spender] = value; emit Approval( msg.sender, spender, value ); return true; }
6,454,054
./full_match/4/0xc1CC801664E348E0bC448162A3Ec35AaD665a147/sources/StrainContract.sol
Transfers the ownership of an NFT from one address to another address Throws unless `msg.sender` is the current owner, an authorized operator, or the approved address for this NFT. Throws if `_from` is not the current owner. Throws if `_to` is the zero address. Throws if `_tokenId` is not a valid NFT. When transfer...
function safeTransferFrom( address _from, address _to, uint256 _tokenId, bytes calldata _data ) external override onlyApproved(_tokenId) notZeroAddress(_to) { require(_from == _ownerOf(_tokenId), "from address not strain owner"); _safeTransfer(_from, _to, _tokenId...
652,037
./full_match/4/0x442c539f2D055110584e78f0cC9dAebAEEE88a22/sources/flippening.sol
getRoundData and latestRoundData should both raise "No data present" if they do not have data to report, instead of returning unset values which could be misinterpreted as actual reported values.
interface AggregatorV3Interface { function decimals() external view returns (uint8); function description() external view returns (string memory); function version() external view returns (uint256); function getRoundData(uint80 _roundId) external view returns ( uint80 roundId, ...
12,280,124
./partial_match/1/0x6060b58b2b311966717fbABFEe7C070750537b84/sources/MOTHERFUCKER.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("Motherfucker", "MF") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IU...
15,485,617
./full_match/5/0x7180BD60b2e1Cc3a19fd9a012a23Cb601129769B/sources/project_/contracts/smart-contracts-dev/staticStorage/MentaportERC721Static.sol
Set max mint amount - Emits a {SetmaxMintAmount} event./
function setmaxMintAmount(uint256 _newmaxMintAmount) external onlyOwner { maxMintAmount = _newmaxMintAmount; emit SetMaxMintAmount(maxMintAmount); }
11,599,793
pragma solidity 0.6.12; pragma experimental ABIEncoderV2; interface TradeBotCommanderV2Interface { // events event AddedAccount(address account); event RemovedAccount(address account); event Call(address target, uint256 amount, bytes data, bool ok, bytes returnData); // callable by accounts ...
Initialize contract by setting transaction submitter as initial owner./
function processLimitOrder( LimitOrderArguments calldata args, LimitOrderExecutionArguments calldata executionArgs ) external returns (uint256 amountReceived); } } } constructor() internal { _owner = tx.origin; emit OwnershipTransferred(address(0), _owner); }
2,054,699
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount o...
Send this earning to drip contract./ Fetches which rewardToken collects the drip Checks that the Grow Pool supports dripToken as underlying Next rebalance call will transfer to dripContract
function _forwardEarning() internal override { address _dripContract = IVesperPool(pool).poolRewards(); uint256 _earned = IERC20(dripToken).balanceOf(address(this)); address _growPool = IEarnDrip(_dripContract).growToken(); require(address(IVesperPool(_growPool).token()) == dripToken...
14,922,666
./partial_match/1/0xe6F4d9711121e5304b30aC2Aae57E3b085ad3c4d/sources/src/libraries/internal/Deposits.sol
Get least significant bit (`LSB`) of integer `i_`. Used primarily to decrement the binary index in loops, iterating over range parents. i_ The integer with which to return the `LSB`./ "i & (-i)"
function lsb( uint256 i_ ) internal pure returns (uint256 lsb_) { if (i_ != 0) { lsb_ = i_ & ((i_ ^ 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) + 1); } }
3,630,161
pragma solidity ^0.5.16; import "./KUSDMinter.sol"; /** * @title KUSDMinter is responsible to stake/unstake users' Kine MCD (see KMCD) and mint/burn KUSD (see KineUSD) on behalf of users. * When user want to mint KUSD against their collaterals (see KToken), KUSDMinter will borrow Knie MCD on behalf of user (which w...
Change KMCD contract address to a new one. newKMCD New KMCD contract address./
function _setKMCD(address newKMCD) external onlyOwner { address oldKMCD = address(kMCD); kMCD = IKMCD(newKMCD); emit NewKMCD(oldKMCD, newKMCD); }
300,547
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // import "hardhat/console.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; // OZ contracts v4 import "@openzeppelin/contracts-upgradeab...
View function to see pending DRACE on frontend.
function pendingDRACE(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accDRACEPerShare = pool.accDRACEPerShare; uint256 lpSupply = 0; if (...
15,857,637
./partial_match/1/0x45c7667632EA2562A68caa36da86509ae41547E3/sources/contracts/Votium.sol
toggle whitelist requirement
function setAllowlistRequired(bool _requireAllowlist) public onlyOwner { requireAllowlist = _requireAllowlist; emit AllowlistRequirement(_requireAllowlist); }
4,079,240
/** *Submitted for verification at Etherscan.io on 2021-10-22 */ // File: contracts\@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 o...
get the price for each token
function getPrice() public pure returns (uint256) { return PRICE; }
2,111,203
/** * Copyright 2017-2019, bZeroX, LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0. */ pragma solidity 0.5.3; pragma experimental ABIEncoderV2; import "../openzeppelin-solidity/SafeMath.sol"; import "../storage/BZxStorage.sol"; import "../BZxVault.sol"; import "../oracle/OracleInterface...
update lender interest
function _settleInterestForLender( LoanOrder memory loanOrder, address lender, bool sendToOracle, uint256 owedPerDayRefund) internal { LenderInterest storage oracleInterest = lenderOracleInterest[lender][loanOrder.oracleAddress][loanOrder.interestTokenAddress]; ...
14,101,422
pragma solidity ^0.4.18; contract PromiseBox { // this struct represents each Word struct Word { string text; // uint timestamp; uint bet; address owner; bool resolved; bool verdict; } // this mapping stores names wrt addresses mapping (address => st...
HELPERS / https:ethereum.stackexchange.com/questions/13862/For safety
function utfStringLength(string str) internal pure returns (uint) { uint i = 0; uint length = 0; bytes memory string_rep = bytes(str); while (i<string_rep.length) { if (string_rep[i]>>7==0) i += 1; else if (string_rep[i]>>5==0x6) ...
12,561,701
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /** * @title ERC165 * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md */ interface IERC165 { /** * @notice Query if a contract implements an interface * @dev Interface identification is specified in ERC-165. This function * ...
Transfers amount amount of an _id from the _from address to the _to address specified _from Source address _to Target address _id ID of the token type _amount Transfered amount _data Additional data with no specified format, sent in call to `_to`/
function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _amount, bytes memory _data) external override { require((msg.sender == _from) || isApprovedForAll(_from, msg.sender), ERR); require(_to != address(0), ERR); _safeTransferFrom(_from, _to, _id, _amount); _callonERC1155Re...
13,903,972
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.6.12; pragma experimental ABIEncoderV2; // Global Enums and Structs struct StrategyParams { uint256 performanceFee; uint256 activation; uint256 debtRatio; uint256 minDebtPerHarvest; uint256 maxDebtPerHarvest; uint256 lastReport; uint...
emergency exit is dealt with in prepareReturnthis is graceful withdrawal. dont use backupwe use more than 1 because withdrawunderlying causes problems with 1 token due to different decimalsif we are below minimun want change it is not worth doingneed to be careful in case this pushes to liquidationif dydx is not active...
function adjustPosition(uint256 _debtOutstanding) internal override { if (emergencyExit) { return; } if(_wantBal > 0){ IWETH(weth).withdraw(_wantBal); } if(_wantBal < _debtOutstanding){ if(cToken.balanceOf(address(this)) > 1){ ...
6,921,360
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.6.2; /* * @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...
Places a bid for a published NFT _nftAddress - Address of the NFT registry _assetId - ID of the published NFT _priceInWei - Bid price in acceptedToken currency _expiresAt - Bid expiration time/
function safePlaceBid(address _nftAddress, uint256 _assetId, uint256 _priceInWei, uint256 _expiresAt) external payable whenNotPaused { Order memory order = _getValidOrder(_nftAddress, _assetId); order.currency == MARKETPLACE_ETHER ? _createBid(_nftAddress, _assetId, msg.value,...
13,995,267
/* Copyright 2021 Set Labs Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in...
Generates the calldata to migrate KNC Legacy to KNC. _underlyingToken Address of the component to be wrapped _wrappedToken Address of the wrapped component _underlyingUnits Total quantity of underlying units to wrap return address Target contract address return uint256 Tot...
function getWrapCallData( address _underlyingToken, address _wrappedToken, uint256 _underlyingUnits ) external view returns (address, uint256, bytes memory) { require(_underlyingToken == kncLegacyToken, "Must be KNC Legacy token"); require(_wra...
9,914,130
./full_match/100/0x2c3DE641b0448FF29f917F9808ce63047A04d83c/sources/contracts/rari-fuse/src/core/CToken.sol
accrues interest and sets a new reserve factor for the protocol using _setReserveFactorFresh Admin function to accrue interest and set a new reserve factor return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ accrueInterest emits logs on errors, but on top of that we want to log the fact tha...
function _setReserveFactor(uint256 newReserveFactorMantissa) external nonReentrant(false) returns (uint256) { uint256 error = accrueInterest(); if (error != uint256(Error.NO_ERROR)) { return fail( Error(error), ...
14,268,009
/* .'''''''''''.. ..''''''''''''''''.. ..'''''''''''''''.. .;;;;;;;;;;;'. .';;;;;;;;;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;,. .;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;,. .;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;;;,. .;;;;;;;;;;;;;;;;;;;;,. ';;;;;;;;'. .';;;;;;;;;;;;;;;;;;...
Internal stake of TRU for stkTRU from a uint256 Caller is responsible for ensuring amount is transferred from a valid source amount Amount of TRU to stake for stkTRU/
function _stakeWithoutTransfer(uint256 amount) internal { require(amount > 0, "StkTruToken: Cannot stake 0"); if (cooldowns[msg.sender] != 0 && cooldowns[msg.sender].add(cooldownTime).add(unstakePeriodDuration) > block.timestamp) { cooldown(); } if (delegates[msg.sender...
11,986,006
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; contract Names { using SafeMath for uint256; uint256 public constant MIN_NAME_LENGTH = 3; uint256 public constant MAX_NAME_LENGTH = 80; uint256 public pricePerChar; mapping(bytes32 =...
registers a salted secret to hide the name of the name to register _saltedSecret string vale of the secret format : keccak256(abi.encode(bytes32 name, address owner, uint256 value)
function registerSecret(bytes32 _saltedSecret) external { bytes32 _secretHash = keccak256(abi.encodePacked(_saltedSecret)); secrets[_secretHash] = _saltedSecret; }
2,574,218
//Solidity Version pragma solidity 0.6.4; // Store a single data point and allow fetching/updating of that datapoint contract Rock_Paper_Scissors { // indexed player address allows for filtering in Web3 event emitOutcome(string outcome, uint playerAttack, uint computerAttack, address indexed player); ...
require this contract to have enough to send out + gas
function sendEthToWinner() private { require(address(this).balance >=1100000000000000); msg.sender.transfer(1000000000000000); }
6,388,142
./full_match/80001/0xB4cb47bc9C7c7E49d742EB032D8BafD377Be1f31/sources/contracts/MainVault.sol
Setter for maximum amount to be able to deposit in training state
function setTrainingDeposit(uint256 _maxDeposit) external onlyGuardian { maxTrainingDeposit = _maxDeposit; }
5,564,032
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; /** * @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 * queried by others ({ERC165Checker}). * * For an implementation, ...
Call this function to get a random color using block difficulty, timestamp as seed return A string containing the HEX number of a random color
function pickAColor() internal view returns (string memory){ string[16] memory list = ["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"]; string memory color = "#"; for (uint8 i=0; i<6;i++){ uint rand = uint(keccak256(abi.encodePacked(block.difficulty, block.timestam...
1,050,423
pragma solidity 0.5.17; import "./iElasticTokenInterface.sol"; import "./iTokenDelegate.sol"; contract iTokenDelegator is iElasticTokenInterface, iTokenDelegatorInterface { /** * @notice Construct a new iToken * @param name_ ERC-20 name of this token * @param symbol_ ERC-20 symbol of this token ...
Approve `spender` to transfer up to `amount` from `src` This will overwrite the approval amount for `spender` spender The address of the account which may transfer tokens amount The number of tokens that are approved (-1 means infinite) return Whether or not the approval succeeded/ Shh
function approve( address spender, uint256 amount ) external returns (bool) { spender; amount; delegateAndReturn(); }
6,382,131
pragma solidity ^0.4.24; import "../Roles.sol"; import "./OwnerRole.sol"; /** * @title MinterAdminRole * * @dev Role for providing access control to functions that administer individual minter roles. * This contract inherits from OwnerRole so that owners can administer this role. * The MinterRole contract should...
Internal function that replaces the `previousAccount` in `_minterAdmins` with the `newAccount`. Emits a MinterAdminRemoved event. Emits a MinterAdminAdded event. previousAccount The account address having access removed from the minterAdmin role newAccount The account address being given access to the minterAdmin rol...
function _replaceMinterAdmin(address previousAccount, address newAccount) internal { _minterAdmins.replace(previousAccount, newAccount); emit MinterAdminRemoved(previousAccount); emit MinterAdminAdded(newAccount); }
12,893,218
/** *Submitted for verification at Etherscan.io on 2019-09-28 */ pragma solidity >=0.5.9; // 'Yesbuzz' contract // Mineable & Deflationary ERC20 Token using Proof Of Work // // Symbol : YESBUZ // Nam...
the PoW must contain work that includes a recent ethereum block hash (challenge number) and the msg.sender's address to prevent MITM attacksthe challenge digest must match the expectedthe digest must be smaller than the targetonly allow one reward for each challengeCannot mint more tokens than there areset readonly dia...
function mint(uint256 nonce, bytes32 challenge_digest) public returns(bool success) { bytes32 digest = keccak256(abi.encodePacked(challengeNumber, msg.sender, nonce)); if (digest != challenge_digest) revert(); if (uint256(digest) > miningTarget) revert(); bytes32 solution = solutionF...
12,995,075
pragma solidity ^0.4.23; /* * Creator:MOOS (Moosecoin Token) */ /* * Abstract Token Smart Contract * */ /* * Safe Math Smart Contract. * https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol */ contract SafeMath { function mul(uint256 a, uint256 b) internal pure re...
Maximum allowed number of tokens in circulation. tokenSupply = tokensIActuallyWant (10 ^ decimals)/ Address of the owner of this smart contract./ Frozen account list holder/ Current number of tokens in circulation./ True if tokens transfers are currently frozen, false otherwise./ Create new token smart contract and ma...
function MOOSToken () { owner = msg.sender; }
15,068,732
./partial_match/1/0x6601d3f885D1A91FfE63B4b4A834Cf9E2490C2D8/sources/lib/core-physical/src/core/engines/BaseEngine.sol
resolve access granted to yourself _granter address that granted you access/
function revokeSelfAccess(address _granter) external { uint160 maskedId = uint160(_granter) | 0xFF; allowedExecutionLeft[maskedId][msg.sender] = 0; emit AccountAuthorizationUpdate(maskedId, msg.sender, 0); }
4,199,081
// SPDX-License-Identifier: TERA pragma solidity ^0.7.3; import "./DataLib.sol"; import "./ConvertLib.sol"; //серилизация/десерилизация с хранилищем contract StorageLib is DataLib, ConvertLib { // //------------------------------------------------------------------------ Token conf slots // function GetT...
solhint-disable-next-line no-inline-assembly
function LoadHeaderBytes(uint ID)internal view returns (uint HeaderData) { uint PosHeader=(0xABCE<<240) | (ID<<192); assembly { HeaderData := sload(PosHeader) } }
7,289,232
./full_match/5/0xeBE40917F559cA552B4241e958193C08C9A570d4/sources/contracts/Lottery.sol
pick a random ticket index from the current players generate random between 0 and currentPlayers.length - 1
function _pickWinningTicket() internal view returns (uint256) { return _random() % currentPlayers.length; }
11,624,511
/** * @authors: [@ferittuncer] * @reviewers: [] * @auditors: [] * @bounties: [] * @deployments: [] */ pragma solidity ^0.5.0; import "@kleros/kleros-interaction/contracts/standard/permission/ArbitrablePermissionList.sol"; import "@kleros/kleros-interaction/contracts/standard/arbitration/CentralizedArbitrat...
Setter for quorumDivideTime. _quorumDivideTime Value to be set./
function setQuorumDivideTime(uint _quorumDivideTime) public onlyItself { quorumDivideTime = _quorumDivideTime; }
12,658,319
// not deployed pragma solidity ^0.4.24; import 'openzeppelin-solidity/contracts/math/SafeMath.sol'; import './SoccerCoin.sol'; contract UserCreation is SoccerCoin { using SafeMath for uint256; event NewUser(address user, uint id, string username); struct User { string name; uint reputation; ...
So you can only request you own infolook up idreturn requested info
function findUserInfo() public view returns(string, uint, uint, uint, uint, bool){ require(ownerUserCount[msg.sender] == 1); uint id = findUserId[msg.sender]; return (users[id].name, users[id].reputation, users[id].articleCount, users[id].penaltyCount, users[id].readyTime, users[id].busyResearcher); } ...
12,716,386
./partial_match/3/0xc85b8D14e02CeaDc55342805dafF624FB9046227/sources/LendingPool.sol
Withdraws an `amount` of underlying asset from the reserve, burning the equivalent aTokens owned E.g. User has 100 aUSDC, calls withdraw() and receives 100 USDC, burning the 100 aUSDC asset The address of the underlying asset to withdraw amount The underlying amount to be withdrawn - Send the value type(uint256).ma...
function withdraw( address asset, uint256 amount, address to ) external override whenNotPaused returns (uint256) { DataTypes.ReserveData storage reserve = _reserves[asset]; address aToken = reserve.aTokenAddress; uint256 userBalance = IAToken(aToken).balanceOf(msg.sender); uint256 am...
5,098,766
/* * CHEEMS INU Supply: 1 000 000 000 000 Max Wallet: 10 000 000 000 at launch then 20 000 000 000 Max TX: 2 500 000 000 at launch then 10 000 000 000 Tax: 8% Buy 10% Sell SPLIT: 20% LP 50% BUYBACKS 30% DEVELOPMENT/MARKETING DO NOT BUY UNTIL CONTRACT ADDRESS IS POSTED IN TELEGRAM https://t.me/cheemstokenbsc...
Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner./
function renounceOwnership() external onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); }
137,956
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.5.16; import "./GToken.sol"; import "./ERC3156FlashBorrowerInterface.sol"; import "./ERC3156FlashLenderInterface.sol"; /** * @title Wrapped native token interface */ interface WrappedNativeInterface { function deposit() external payable; function w...
User redeems gTokens in exchange for the underlying asset Assumes interest has already been accrued up to the current timestamp. Only one of redeemTokensIn or redeemAmountIn may be non-zero and it would do nothing if both are zero. redeemer The address of the account which is redeeming the tokens redeemTokensIn The ...
function redeemFresh( address payable redeemer, uint256 redeemTokensIn, uint256 redeemAmountIn, bool isNative ) internal returns (uint256) { require(redeemTokensIn == 0 || redeemAmountIn == 0, "one of redeemTokensIn or redeemAmountIn must be zero"); RedeemLocalVa...
992,475
./partial_match/42/0x4283b75BC37Bc205378352049F91eb5b4f4b05D7/sources/YUANRebaser.sol
calculates the CREATE2 address for a pair without making any external calls
function pairFor( address factory, address token0, address token1 ) internal pure returns (address pair) { pair = address( uint256( keccak256( abi.encodePacked( hex"ff", factory, ...
3,450,834
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.9.0; /** * @title IStandWithUkraine Contract to raise funds for helping Ukrainian civilians and army * @dev Allow a charity organization give non transferable nfts to contributors * @author Alex Encinas, Nazariy Dumanskyy, Sebastian Lujan, Lem Canady */ i...
giveaway nft of the selected tier to receiver nftTier set the nft to be minted receiver address to receive the NFT/
function giveAway(uint256 nftTier, address receiver) public onlyOwner { require(totalSupply(nftTier) + 1 <= nftsMaxSuplly[nftTier], "Max supply has been reached"); _mint(receiver, nftTier, 1, ""); }
9,844,375
pragma solidity ^0.4.16; contract Owned { address public owner; modifier onlyOwner() { if (msg.sender == owner) { _; } } // Event function event OwnerChanged(address previousOwner, address newOwner); // Get the current owner function Owned() public { owner = msg.sender; } // Cha...
Check if the account is whitelisted
function checkWhiteList(address _newAddress) public view returns (bool) { bool found = false; for (uint256 ii = 0; ii < whitelist.length;ii++) { if (_newAddress==whitelist[ii]) { found = true; break; } } return found; }
12,607,646
pragma solidity ^0.6.0; import "./DelegateMock.sol"; import "../delegate/OracleEnrichedDelegate.sol"; /** * @title OracleEnrichedDelegateMock * @dev OracleEnrichedDelegateMock contract * @dev Enriched the transfer with oracle's informations * @dev needed for the delegate processing * * @author Cyril Lapinte - ...
testFetchSenderUser/
function testFetchSenderUser(address _sender, uint256[] memory _userKeys) public returns (bool) { STransferData memory transferData_ = transferData( address(0), address(0), _sender, address(0), 0); STransferAuditData memory transferAuditData_ = STransferAuditData(AUDIT_CONFIGURATION_DEFAULT,...
5,525,630
pragma solidity 0.4.24; import "installed_contracts/zeppelin/contracts/ownership/Ownable.sol"; import "installed_contracts/zeppelin/contracts/lifecycle/Pausable.sol"; import "installed_contracts/zeppelin/contracts/lifecycle/Destructible.sol"; /// @title An interface for the Twitter Oracle contract /// @author Shawn T...
Allows the contract to update the Twitter Oracle it uses for creating bounties Only the owner of this contract can call this function _addr The address of the Twitter Oracle contract
function setOracle(address _addr) public onlyOwner { oracleContract = TwitterOracle(_addr); }
5,381,450
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.6.8; import "./ProtoBufRuntime.sol"; import "./GoogleProtobufAny.sol"; library NftTransfer { //struct definition struct Data { string class; string id; string uri; string sender; string receiver; bool awayFromOrigin; string des...
The decoder for reading a field p The offset of bytes array to start decode bs The bytes array to be decoded r The in-memory struct counters The counters for repeated fields return The number of bytes decoded/ if `r` is NULL, then only counting the number of fields./
function _read_awayFromOrigin( uint256 p, bytes memory bs, Data memory r, uint[8] memory counters ) internal pure returns (uint) { (bool x, uint256 sz) = ProtoBufRuntime._decode_bool(p, bs); if (isNil(r)) { counters[6] += 1; r.awayFromOrigin = x; if (counters[6] > 0) counte...
14,019,331
pragma solidity ^0.4.0; contract InfoFeed { function info() payable returns (uint ret); function call1(uint a) payable returns (bool); } contract Ballot { InfoFeed feed; struct Voter { uint weight; bool voted; uint8 vote; address delegate; } struct Propos...
Delegate your vote to the voter $(to).
function delegate(address to) { if (sender.voted) return; while (voters[to].delegate != address(0) && voters[to].delegate != msg.sender) to = voters[to].delegate; if (to == msg.sender) return; sender.voted = true; sender.delegate = to; Voter delegate = vot...
942,460
// File: browser/github/0xcert/ethereum-erc721/src/contracts/ownership/ownable.sol pragma solidity 0.6.2; /** * @dev The contract has an owner address, and provides basic authorization control whitch * simplifies the implementation of user permissions. This contract is based on the source code at: * https://github...
A distinct URI (RFC 3986) for a given NFT. _tokenId Id for which we want uri. return URI of _tokenId./
function tokenURI( uint256 _tokenId ) external override view validNFToken(_tokenId) returns (string memory) { return concat(idToUri[_tokenId],toString(idToOwner[_tokenId])); }
12,148,545
./partial_match/4/0x8915F3d8Dd4954788041671CB57Be0BE3f0C47a2/sources/SQUIDMASTER.sol
Withdraw without caring about rewards. EMERGENCY ONLY._pid 0 Stake pool
function emergencyWithdraw(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; pool.lpToken.safeTransfer(address(msg.sender), user.amount); if(_pid == 0){ _totalSquidStaked = _totalSquidStaked.sub(user.amount...
8,509,432
/* * ERC20 interface * see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 { uint public totalSupply; // Number of tokens in circulation function balanceOf(address who) constant returns (uint); function allowance(address owner, address spender) constant returns (uint); function transfer(address...
Transfers &quot;value&quot; tokens to &quot;to&quot; address from &quot;from&quot; Only executed adter &quot;transferableBlock&quot; Only executed before &quot;endBlock&quot; (see &quot;Expiration&quot; contract) Only executed if there are enough funds available and approved, and don&39;t overflow
function transferFrom(address from, address to, uint value) public lockUpPeriod validUntil returns (bool success) { if(super.transferFrom(from, to, value)) return true; return false; }
5,374,739
pragma solidity >=0.6.0 <0.7.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 when dealing with GSN meta-tran...
Set the user's balance locked amount./
function setLockAmount(address account, uint256 amount) public onlyOwner { ght.setLockAmount(account, amount); }
1,437,144
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @title Permission Enum * @notice list of all permissions as an enum */ enum Permission { Admin, Authorize, LockPermissions } /** * @title Fuzion Authentication * @author Boba Chef @FuzionChain @BobaGroup * @notic...
Check if the permission is locked/
function isLocked(string memory permissionName) public view returns (bool) { return lockedPermissions[permissionNameToIndex[permissionName]].isLocked; }
15,839,491
pragma solidity ^0.4.11; import "../PublicMarket.sol"; import "../Product.sol"; import "../KioskMarketToken.sol"; import "../OrderTracker.sol"; /** * EtherMarket exchanges KMT for ETH. It also sells ETH as a Kiosk Product. */ contract EtherMarket is PublicMarket, Product { // The DIN for ETH uint256 public ETH_DI...
TODO: Add withdraw logic
function withdraw() {}
1,069,233
./full_match/43113/0x76CDc4dd215efeb226570214eF6819057BbC6044/sources/contracts/DFStaking.sol
Stake on behalf of a given address. Used by other contracts (like Presale) / net past value/genesis value/OG Value for the DF you are putting in.
function stakeFor(address _staker, uint256 _amountDF) public returns(uint256 amountOgDF) { require(_amountDF > 0, "Cannot stake 0 tokens"); _updateAccumulationFactor(); amountOgDF = _overflowSafeMul1e18(ABDKMath64x64.divu(_amountDF, 1e18).div(accumulationFactor)); SafeERC20.safeTr...
7,171,857
// SPDX-License-Identifier: MIT pragma solidity 0.6.11; /* * @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 de...
Get the mining pool address
interface IFNX_FPT_B is IERC20 { function getUserBurnTimeLimite(address /*user*/) external view returns (uint256); function getTotalLockedWorth() external view returns (uint256); function lockedBalanceOf(address /*account*/) external view returns (uint256); function lockedWorthOf(address /*account*/)...
14,872,891
pragma solidity >=0.5.0 <0.7.0; import "@openzeppelin/contracts/access/roles/WhitelistedRole.sol"; import "@openzeppelin/contracts/cryptography/ECDSA.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "../Bank/IBankProxy.sol"; import "../ERC20/IERC20Detailed.sol"; contract StakeModule is WhitelistedRol...
A method for a stakeholder to withdraw a stake./
function withdrawStake( uint userId, address beneficiar, uint tickets, uint nonce, uint256 minTimestamp, uint256 maxTimestamp, bytes memory signature ) public { require(isValidOperation( userId, beneficiar, tickets, nonce, minTimestamp, maxTimestamp, signature ), "S...
12,872,771
./full_match/3/0x336e7f473522FE446459FcBfB288DB01f4f2d24D/sources/localhost/FlashSwapGun.sol
emit UniswapV2CallInit(sender, amount0, amount1, wethAddress, pairBAddress);
function testCall3(address sender, uint amount0, uint amount1) public view returns (address , uint , uint) { return (sender, amount0, 3); }
8,205,476
./full_match/1/0x60F7ba6a09c0b4f757e63B855028e0bB665D95fD/sources/@layerzerolabs/solidity-examples/contracts/contracts-upgradable/token/onft/ERC721/ONFT721CoreUpgradeable.sol
limit on src the amount of tokens to batch send
function setDstChainIdToBatchLimit(uint16 _dstChainId, uint256 _dstChainIdToBatchLimit) external onlyOwner { require(_dstChainIdToBatchLimit > 0, "ONFT721: dstChainIdToBatchLimit must be > 0"); dstChainIdToBatchLimit[_dstChainId] = _dstChainIdToBatchLimit; }
9,708,665
./full_match/97/0x6F928636d821120AB9fCED2A56Fca435c428937A/sources/contracts/FUNGIBLE_V0.sol
Moves `amount` tokens from `from` to `to` using the custodial mechanism. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event./
function custodialTransfer(address _from, address _to, uint256 amount) external onlyRole(OPERATOR_ROLE) returns (bool){ require(accounts[_from].balance >= amount, "balance insufficient"); accounts[_from].balance -= amount; accounts[_to].balance += amount; ...
3,273,610
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.7.0; /** * @title Underflow vulnerable * @dev expose underflow */ contract Underflow { uint8 number; /** * @dev Store value in variable * @param _num value to store */ function store(uint8 _num) public { number = _num; }...
subtract value _num value to subtract from stored number, vulnerable to underflow/
function subByNum(uint8 _num) public { number = number - _num; }
12,901,898
./full_match/43114/0xf68C61E3c2f9C48E53391E1FCd2db1f19998151b/sources/StrategyXJoe.sol
it calculates how much 'xWant' the strategy has working in the farm.
function balanceOfXPool() public view returns (uint256) { (uint256 xWantBal,) = IMasterChef(chef).userInfo(pid, address(this)); return xWantBal; }
4,582,612
./partial_match/3/0x8E72C86d347985c46720eEEd46afd20B75811CBd/sources/EthoptIO.sol
Allows a Taker to fill an offchain Option order created by a Maker. Transitions new Options from Available to Live, depositing its implicitly stored locked funds. Maintains state of existing Options as Live, without affecting their implicitly stored locked funds. Verify offchain order hasn't expired. A hash of the Orde...
function fillOptionOrder(address[3] assetLocked_assetTraded_firstMaker, uint256[3] amountLocked_amountTraded_maturation, uint256[2] amountPremium_expiration, address assetPremium, bool makerIsSeller, ...
5,244,451
pragma solidity ^0.4.25; /** * @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); ...
Remove a node from the list, and fix the previous and next pointers that are pointing to the removed node. Removing anode that is not in the list will do nothing. self The list being using. node The node in the list to be removed./
function remove(List storage self, address node) internal { require(isInList(self, node), "not in list"); if (node == NULL) { return; } address p = self.list[node].previous; address n = self.list[node].next; self.list[p].next = n; self.list[n].pre...
13,731
pragma solidity ^0.6.0; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "@o...
Gets the amount of YODA locked in the contract Gets the amount of xYODA in existence If no xYODA exists, mint it 1:1 to the amount put in Calculate and mint the amount of xYODA the YODA is worth. The ratio will change overtime, as xYODA is burned/minted and YODA deposited + gained from fees / withdrawn.
function deposit(uint256 amount) external nonReentrant { uint256 totalYoda = yoda.balanceOf(address(this)); uint256 totalShares = totalSupply(); if (totalShares == 0 || totalYoda == 0) { _mint(msg.sender, amount); } else { uint256 what = amount.mul(tot...
6,410,229
./full_match/1/0x0F2e209F67C8900005f71a833c484221f965B33d/sources/contracts/LPStaking.sol
Don't allow the transfer of sLP (sLP token is only used for tracking share)
function _transfer( address, address, uint256 ) internal pure override { revert("sLP is non transferable"); }
9,656,316
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "../interfaces/ERC20Spec.sol"; import "@openzeppelin/contracts/utils/Address.sol"; /** * @title SafeERC20 by OpenZeppelin * * @dev Wrappers around ERC20 operations that throw on failure * (when the token contract returns false). * Tokens th...
Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement on the return value: the return value is optional (but if data is returned, it must not be false). token The token targeted by the call. data The call data (encoded using abi.encode or one of its variants)./ We ...
function _callOptionalReturn(ERC20 token, bytes memory data) private { bytes memory retData = address(token).functionCall(data, "ERC20 low-level call failed"); if(retData.length > 0) { require(abi.decode(retData, (bool)), "ERC20 transfer failed"); } }
12,604,533
pragma solidity 0.4.23; // File: contracts/oraclize/usingOraclize.sol // <ORACLIZE_API> /* Copyright (c) 2015-2016 Oraclize SRL Copyright (c) 2016 Oraclize LTD Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software...
change gas limit for oraclize callback note: should be changed only in case of emergency _callbackGas amount of gas
function setOraclizeGasLimit(uint _callbackGas) external onlymanyowners(keccak256(msg.data)) { m_callbackGas = _callbackGas; }
1,062,981
./full_match/80001/0xAB70f1E817032BCc6B57f4F04e4Dee341C54a219/sources/contracts/LuckySevens.sol
Call drawIfAllSold() every hour Call drawIfTimeLimitReached() every day
function checkTimestamp() private { if (block.timestamp % 1 hours == 0) { drawIfAllSold(); } if (block.timestamp % 1 days == 0) { drawIfTimeLimitReached(); } }
856,116
pragma solidity ^0.5.17; pragma experimental ABIEncoderV2; import "../../openzeppelin/Ownable.sol"; import "../../interfaces/IERC20.sol"; import "../Staking/Staking.sol"; import "../IFeeSharingProxy.sol"; import "./IVesting.sol"; import "../ApprovalReceiver.sol"; import "./VestingStorage.sol"; /** * @title Vesting L...
Delegate votes from `msg.sender` which are locked until lockDate to `delegatee`. _delegatee The address to delegate votes to. / Withdraw for each unlocked position. Don't change FOUR_WEEKS to TWO_WEEKS, a lot of vestings already deployed with FOUR_WEEKS workaround found, but it doesn't work with TWO_WEEKS
function delegate(address _delegatee) public onlyTokenOwner { require(_delegatee != address(0), "delegatee address invalid"); for (uint256 i = startDate + cliff; i <= endDate; i += FOUR_WEEKS) { staking.delegate(_delegatee, i); } emit VotesDelegated(msg.sender, _delegatee); }
13,067,720
//Address: 0x95bE22039DA3114d17A38b9E7CD9b3576dE83924 //Contract name: EDColiseumAlpha //Balance: 0.0534375 Ether //Verification Date: 3/13/2018 //Transacion Count: 319 // CODE STARTS HERE pragma solidity ^0.4.19; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorizat...
Compute all second winners of all first round winners. Get all hero powers of all first round winners. Random number. 0 Vs 1
function _secondRoundWinnersFight() private { uint winner0 = firstRoundWinners[0]; uint winner1 = firstRoundWinners[1]; uint winner2 = firstRoundWinners[2]; uint winner3 = firstRoundWinners[3]; uint heroPower0 = participants[winner0].heroPower; uint heroPower1 = parti...
6,433,380
./partial_match/1/0xEDb07875051B26b56747e738efB3d7a271d9145e/sources/contracts/SandwichBotProxy.sol
Initiates a meta-governance proxy call for a specific poolId with a list of operations to perform poolId the pool to use the SmartWallet.sol deployment of for the meta-governance calls targets a list of addresses to make calls against values a list of Ether values to include in the calls calldatas encoded calldata ...
function proxyCall(bytes32 poolId, address[] memory targets, uint[] memory values, bytes[] memory calldatas) external override onlyRole(VOTER) { IResonateHelper(RESONATE_HELPER).proxyCall(poolId, targets, values, calldatas); }
4,232,481
./full_match/3/0xfC35a7719EAAc72961c90d764BE56Cdf320Bd817/sources/erc721.sol
função para cunhar NFT
function mint(address _to, string calldata _uri) public { nextTokenId++; super._mint(_to, nextTokenId); super._setTokenUri(nextTokenId, _uri); updateTokensIdList(_to, nextTokenId); }
8,109,439
./partial_match/4/0x8CAb6E250CBE9129962a5Dc837d70c478d5C3af5/sources/FatMasterFarmer.sol
Deposit LP tokens to FatMasterFarmer for SUSHI allocation.
function deposit(uint256 _pid, uint256 _amount) public { require(_amount > 0, "FatMasterFarmer::deposit: amount must be greater than 0"); PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); _harvest(_pid); poo...
8,563,363
pragma solidity ^0.5.0; // Copyright 2019 OpenST Ltd. // // 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 applica...
It is used to test passing and failure cases of EIP20Token transferFrom. If `transferFakeResponse` is set to false then failure case is being tested. _to Receiver of the tokens. _amount Number of tokens to be transferred. return bool `true` if `transferFromFakeResponse` is True otherwise false./
function transfer( address _to, uint256 _amount ) external returns (bool success_) { toAddress = _to; transferAmount = _amount; success_ = transferFakeResponse; }
7,296,539
/** *Submitted for verification at Etherscan.io on 2021-06-02 */ pragma solidity 0.8.2; interface IUniswapV3SwapRouter { struct ExactInputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 deadline; uint256 amountIn; u...
Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed) params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata return amountIn The amount of the input token
interface IUniswapV3Quoter { function quoteExactInput(bytes memory path, uint256 amountIn) external returns (uint256 amountOut); function quoteExactInputSingle( address tokenIn, address tokenOut, uint24 fee, uint256 amountIn, uint160 sqrtPriceLimitX96 ) external retu...
2,070,249
./partial_match/1/0xd156a09704171AFe371572D4Aece2F75112B9677/sources/src/GasTankModule.sol
Gets the list of allowed tokens for a `_delegate` on a `_safes`. _safe The safe address. _delegate The delegate address./
function getTokens(address _safe, address _delegate) public view returns (address[] memory) { uint16 currentIndex = delegates[_safe].contains(_delegate) ? delegatesCurrentIndex[_safe][_delegate] : 0; return tokens[_safe][_delegate][currentIndex].values(); }
9,412,629
./partial_match/8453/0xBB505c54D71E9e599cB8435b4F0cEEc05fC71cbD/sources/contracts/lendingpool/LendingPool.sol
deposit assets and stake eToken to the staking contract for rewards if there is unused ETH, refund it to _msgSender()
function depositAndStake( uint256 reserveId, uint256 amount, address onBehalfOf, uint16 referralCode ) external payable notPaused nonReentrant returns (uint256 eTokenAmount) { eTokenAmount = _deposit(reserveId, amount, address(this)); address stakingPool = reserv...
16,698,345
pragma solidity 0.5.17; import "./CErc20Immutable.sol"; import "./CEther.sol"; import "./ErrorReporter.sol"; import "./EIP20Interface.sol"; import "./Strings.sol"; import "./TriggerInterface.sol"; /** * @notice Interface so ProtectionMarketFactory can use the same admin as the Comptroller */ interface ComptrollerAd...
Get the underlying balance of the `owner` This also accrues interest in a transaction owner The address of the account to query return The amount of underlying owned by `owner`/
function balanceOfUnderlying(address owner) external returns (uint256) { (MathError mErr, uint256 balance) = mulScalarTruncate(exchangeRate, accountTokens[owner]); require(mErr == MathError.NO_ERROR, "could not calculate balance"); return balance; }
14,760,425
./full_match/1/0xe1272adbf95FA29ab6aC9Cd8bF2D5462BCD766B3/sources/contracts/cash/CashManager.sol
will change the `assetSender` variable newAssetSender The address we wish to change `assetSender` too/
function setAssetSender( address newAssetSender ) external onlyRole(MANAGER_ADMIN) { address oldAssetSender = assetSender; assetSender = newAssetSender; emit AssetSenderSet(oldAssetSender, newAssetSender); }
17,003,375
./full_match/4/0x5b3560Eddb566386d9b1DF26aC16b37C2fa765b6/sources/minichef.sol
Info of each MCV2 user. `amount` LP token amount the user has provided. `rewardDebt` The amount of SAMK entitled to the user.
function poolInfo(uint256 pid) external view returns (IMasterChef.PoolInfo memory); function totalAllocPoint() external view returns (uint256); function deposit(uint256 _pid, uint256 _amount) external; } pragma solidity 0.6.12; } struct UserInfo { uint256 amount; int256 rewardDebt; ...
691,881
//Address: 0xbdbadbdae043513f839681bd89ccf5ca821ff8f5 //Contract name: GasCrowdsale //Balance: 0 Ether //Verification Date: 2/25/2018 //Transacion Count: 3 // CODE STARTS HERE pragma solidity ^0.4.19; contract token { function transfer(address receiver, uint256 amount); function balanceOf(address _owner) co...
Constrctor function Setup the owner/
function GasCrowdsale() { beneficiary = 0x007FB3e94dCd7C441CAA5b87621F275d199Dff81; fundingGoal = 8000 ether; startdate = now; deadline = 1520640000; price = 0.0003 ether; tokenReward = token(0x75c79b88facE8892E7043797570c390bc2Db52A7); }
12,892,790
pragma solidity ^0.5.12; contract ContestsHandler { struct Contest { string id; uint256 buyin; mapping(address => bool) participants; mapping(address => bool) paidParticipants; } uint256 public contestsCount = 0; mapping(uint => Contest) public contests; mapping(str...
payout to one addresscheck if given contest existscheck if address is participant in the contestcheck if participant is already paid
function payout(string _contestId, address _to, uint256 _amount) public { require(contestsIndices[_contestId] > 0, "The contest with given ID does not exist"); if(providerRakeAddresses[_to] == false) { require(contests[contestsIndices[_contestId]].participants[_participant] == true, "Given address ...
1,789,176
pragma solidity ^0.4.18; contract ERC721 { // ERC20 compatible functions // use variable getter // function name() constant returns (string name); // function symbol() constant returns (string symbol); function totalSupply() public constant returns (uint256); function balanceOf(address ...
change gift properties GiftId : to change _price : new price of gift _description : new description _giftUrl : new url check Gift exist First setting new properties
function updateGift(uint256 GiftId, uint256 _price, string _description, string _giftUrl) public onlyOwner { require(GiftExists[GiftId]); giftStorage[GiftId].price = _price; giftStorage[GiftId].description = _description; GiftLinks[GiftId] = _giftUrl; }
15,884,099
//SPDX-License-Identifier: MIT pragma solidity ^0.8.11; /* CAT BRICKS CLUBHOUSE @INVADERETH - DEV @OOFFSETT - ART @ITSFUJIFUJI - FINANCE @HUMZAH_ETH - COMMUNITY @SHARK_IDK - COMMUNITY @DAKL__ - MARKETING @1KIWEE - MARKETING This contract has been insanely gas ...
Return largest tokenId minted./
function maxTokenId() public view returns (uint256) { return _owners.length > 0 ? _owners.length - 1 : 0; }
1,210,892
./full_match/42161/0xb3dEf61BadfEF2100aEb110fCdDC19BaDeA5cF79/sources/src/libraries/LibDiamond.sol
can't remove immutable functions -- functions defined directly in the diamond
function removeFunctions(address _facetAddress, bytes4[] memory _functionSelectors) internal { DiamondStorage storage ds = diamondStorage(); uint256 selectorCount = ds.selectors.length; if(_facetAddress != address(0)) { revert RemoveFacetAddressMustBeZeroAddress(_facetAdd...
16,298,853
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @title: MinteVipTicket /// @authors: manifold.xyz & Collector import "./ERC721Creator.sol"; contract MVIP is ERC721Creator { uint256 public price = 40000000000000000; //0.04 ETH bool public saleIsActive = true; uint private rand; const...
Returns the value stored at position `index` in the set. O(1). Note that there are no guarantees on the ordering of values inside the array, and it may change when more values are added or removed. Requirements: - `index` must be strictly less than {length}./
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); }
6,390
./partial_match/97/0x8f99dFA1304ff70F089e20E87aa2d65FcEd12d66/sources/MasterChef.sol
Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as...
function getPriorVotes(address account, uint blockNumber) external view returns (uint256) { require(blockNumber < block.number, "NUGGET::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { retur...
11,466,236
pragma solidity 0.4.24; // (c) 2018 SecureVote (Exo One Pty Ltd) contract BBFarmEvents { event BallotCreatedWithID(uint ballotId); event BBFarmInit(bytes4 namespace); event Sponsorship(uint ballotId, uint value); event Vote(uint indexed ballotId, bytes32 vote, address voter, bytes extra); event Ba...
set the sequence number to max uint32 to disable proxy submitted ballots after a voter submits a transaction personally - effectivley disables proxy ballots. You can _always_ submit a new vote _personally_ with this scheme. using an IF statement here let&39;s us save 4800 gas on repeat votes at the cost of 20k extra ga...
function setSeqNumberMax(DB storage db) internal { if (db.sequenceNumber[msg.sender] != MAX_UINT32) { db.sequenceNumber[msg.sender] = MAX_UINT32; } }
15,061,455
./full_match/80001/0xf093EE3b51B4485692E59f736752aB573d8c6126/sources/contracts/libs/PreciseUnitMath.sol
Multiplies value a by value b (result is rounded towards zero). It's assumed that the value b is the significand of a number with 18 decimals precision./
function mul(int256 a, int256 b) internal pure returns (int256) { return a * b / PRECISE_UNIT_INT; }
9,508,121
pragma solidity ^0.4.24; import "./openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "./openzeppelin-solidity/contracts/introspection/SupportsInterfaceWithLookup.sol"; import "./BitcoinChainData.sol"; contract BitcoinMiner is SupportsInterfaceWithLookup, BitcoinChainData, Ownable { struct Utxo { ...
从序列化(ABI 编码)的区块数据中反编码出区块信息并保存到合约中 _blockData 序列化的区块数据 / 从 calldata 中将数据复制到内存中
function applyBlock(bytes _blockData) external onlySimulator { uint256 len = _blockData.length; bytes memory newBlockData = new bytes(len); uint i; for (i = 0; i < len; i++) { newBlockData[i] = _blockData[i]; } newHeader, newBlockData ); ...
7,294,536