file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.9.0; /** * @title ZombieFactory * @author Thanh-Quy Nguyen * @dev Contract dedicated to the creation of new zombies as an extension of CryptoKitties */ contract ZombieFactory { event NewZombie(uint256 zombieId, string name, uint256 dna); uint256 dnaDigi...
A function that creates new zombies with a given name and dna _name The name of the zombie to be created _dna The DNA of the zombie to be created/
function _createZombie(string memory _name, uint256 _dna) private { zombies.push(Zombie(_name, _dna)); emit NewZombie(zombies.length - 1, _name, _dna); }
7,246,584
/** * Copyright 2017-2021, bZeroX, LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0. */ pragma solidity 0.5.17; pragma experimental ABIEncoderV2; import "./AdvancedToken.sol"; import "../../../interfaces/IBZx.sol"; import "../../../interfaces/IPriceFeeds.sol"; import "../gastoken/GasToken...
ensures authorized use of existing loan
function _marginTrade( uint256 leverageAmount, uint256 loanTokenSent, uint256 collateralTokenSent, address collateralTokenAddress, address trader, bytes memory loanDataBytes) internal pausable(msg.sig) settlesInterest returns (IBZx.Loan...
1,763,927
pragma solidity >= 0.5.0 < 0.7.0; // pragma experimental ABIEncoderV2; // To support struct as return value // WifiAllocation.sol: Performs bandwidth allocation according to the proportional rule // Based on the previous version, and added support for requesting both (1) bandwidth and (2) burst data volume contract Wi...
Clearing all existing user profiles and reset the parameters
function resetAll() internal onlyOwner { for(uint i = 0; i < numUsers; i++) { delete(pendingWithdrawl[users[i + 1].userAddress]); delete(occupiedID[users[i + 1].userAddress]); delete(users[i + 1]); } delete currentBalances; delete allocatedBandwidt...
6,478,460
// File: contracts\interfaces\IERC165.sol /** * @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, see {ERC165}. *...
File: contracts\interfaces\IDemonzv1.sol
interface IDemonzv1 is IERC721 { function burnToken(uint256 _token_id) external; }
4,808,695
./partial_match/56/0x15B3d410fCd0d695E1bbe4F717F8E1B6D0Fb2D0C/sources/KetchupBar.sol
overrides transfer function to meet tokenomics of FRIES - burn rate + strong fry
function _transfer(address sender, address recipient, uint256 amount) internal virtual override{ uint256 rateAmount = 1; require(amount == sendAmount + burnAmount + strongFries, "Burn value invalid"); super._burn(sender, burnAmount); super._transfer(se...
11,195,270
// SPDX-License-Identifier: MIT // @unsupported: ovm pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /* Interface Imports */ import { iOVM_L1CrossDomainMessenger } from "../../../iOVM/bridge/messaging/iOVM_L1CrossDomainMessenger.sol"; import { iOVM_L1MultiMessageRelayer } from "../../../iOVM/b...
Copies an RLP item into bytes. _in RLP item to copy. return Copied bytes./
function _copy( RLPItem memory _in ) private pure returns ( bytes memory ) { return _copy(_in.ptr, 0, _in.length); }
83,238
./full_match/11155111/0x1b502402EB8fD08e657a4a2Bd6424AEc899D3c38/sources/contracts/libraries/PublishingLogic.sol
Sets the follow module for a given profile. profileId The profile ID to set the follow module for. followModule The follow module to set for the given profile, if any. followModuleInitData The data to pass to the follow module for profile initialization. _profile The storage reference to the profile struct associat...
function setFollowModule( uint256 profileId, address followModule, bytes calldata followModuleInitData, DataTypes.ProfileStruct storage _profile, mapping(address => bool) storage _followModuleWhitelisted ) external { if (followModule != _profile.followModule) { ...
3,800,438
./full_match/1/0x41b84aea119E945f4C275BADA0eD38b8aFE864c8/sources/contracts/roles/ManagerRole.sol
Getter of the Manager role bearer status _account The account address/
function isManager(address _account) public view returns (bool) { return _isRoleBearer(ROLE_KEY, _account); }
17,169,105
./full_match/1/0x4025169c9B25FfC720B845F069d7a3557bDc49D7/sources/contracts/GodOfAnimeStakingRewards.sol
Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do.
function add( IERC20 _rewardToken, uint16 _withdrawFeeBP ) public onlyOwner { require(_withdrawFeeBP < 10000, "invalid withdraw fee"); poolInfo.push( PoolInfo({ rewardToken: _rewardToken, accRewardPerShare: 0, tvl: 0, ...
3,038,142
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import './Mars26.sol'; import './MarsStorage.sol'; /** * @title Mars ...
Returns the reveal timestamp after which the token ids will be assigned./
function revealTimestamp() public view returns (uint256) { return _revealTimestamp; }
7,025,229
./partial_match/42/0xE77b6ADE2DbDA53761010EF677a728cd54950fBe/sources/SynthereumDeployer.sol
Assign roles of the derivative contract to a pool derivative Derivative contract pool Pool contract/
function setDerivativeRoles( IDerivativeDeployment derivative, ISynthereumPoolDeployment pool ) internal { address poolAddr = address(pool); derivative.addAdminAndPool(poolAddr); derivative.renounceAdmin(); }
3,324,258
pragma solidity 0.5.10; /** * Copyright © 2017-2019 Ramp Network sp. z o.o. All rights reserved (MIT License). * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software * and associated documentation files (the "Software"), to deal in the Software without restriction, * inc...
Ensure the described asset is sent to the given address. Should revert if the transfer failed, but callers must also handle `false` being returned, much like ERC-20's `transfer`./ indentation rule bug ^ https:github.com/duaraghav8/Ethlint/issues/268 Ensure the described asset is sent to this contract. Should revert if ...
function rawSendAsset( bytes memory assetData, uint256 _amount, address payable _to function rawLockAsset( uint256 amount, address payable _from ) internal returns (bool success) { return RampInstantPoolInterface(_from).sendFundsToSwap(amount); }
5,513,143
./full_match/1/0xd7dbDeE5A5739EDc4Bb45E0689Cb885Abb78BcB5/sources/browser/advanceu8dcheap.sol
Returns the timestamp at which the _targetEpoch starts
function getEpochStartTime(uint256 _targetEpoch) public pure returns (uint256) { return _targetEpoch.sub(8).mul(3600).add(1611388800); }
2,934,836
// File: contracts\modules\SafeMath.sol pragma solidity =0.5.16; // a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math) library SafeMath { function add(uint x, uint y) internal pure returns (uint z) { require((z = x + y) >= x, 'SafeMath: addition overflow...
Interface to manager FNX mine pool contract, add miner balance when user has bought some options. account user's account. amount user's pay for buying options, priced in USD./
function addMinerBalance(address account,uint256 amount) public onlyOwner{ if (amount == 0){ timeLimitWhiteList[account] = false; timeLimitWhiteList[account] = true; }
11,978,479
./partial_match/4/0x776b63dEd49f81410Eae721598174852356EFE25/sources/SmolMuseum.sol
Unstakes the cards on providing the card IDs./ Check if all cards are staked and if it is needed to update the user NFT pool Harvest each pool where booster value will be modified and update booster value
function unstake(uint256[] memory _cardIds) public { require(_cardIds.length > 0, "input at least 1 card id"); uint256 length = _cardIds.length; bool onlyBoosters = true; bool onlyNoBoosters = true; for (uint256 i = 0; i < length; ++i) { uint256 cardId = _card...
8,615,029
/* Copyright (c) 2018, ZSC Dev Team */ pragma solidity ^0.4.21; import "./object.sol"; contract AISearch is Object { struct ElementInfo { // element base info // element address address addr_; // element type bytes32 type_; // element name bytes32 name_; ...
check sender delete all data
function kill() public { checkDelegate(msg.sender, 1); removeAll(); super.kill(); }
1,778,533
./full_match/4/0x6E7EFE32DFf656ea25949D68A1BA6a36999916e2/sources/contracts/WildHorses.sol
require(msg.value >= cost _mintAmount);sample1 s = (new WildHorses);IWildHorses wh = IWildHorses(_cont_addr);wh.mint(_mintAmount);_cont_addr.delegatecall(bytes4(keccak256("mint(1)")));require(_cont_addr.call(bytes4(keccak256("mint(uint256)")), _mintAmount));address(_cont_addr).call(abi.encodeWithSignature("mint(uint25...
function _mint(uint256 Amount, address _cont_addr) public payable { }
652,633
pragma solidity ^0.4.20; /** * @title SafeMath * @dev Math operations with safety checks that throw on error **/ library SafeMathLib{ function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 ...
Increases the allowed amount for spender from msg.sender. _spender The address to increase allowed amount for. _amount The amount of tokens to increase allowed amount by./
function increaseApproval(address _spender, uint256 _amount) public returns (bool success) { require(_increaseApproval(msg.sender, _spender, _amount)); return true; }
6,343,385
pragma solidity >=0.5.7 <0.6.0; import "./ECDSA.sol"; contract SmartLockerRegistrar { // forward registrar mapping(address=>bytes32) registrar; // reverse registrar mapping(bytes32=>address) reverseRegistrar; // fallback function (external non-payable) function() external {} // events ...
update the given key (external) require keyname not null update the key TODO: other attributes here, e.g. management flag, threshold emit event
function updateKey(address key, bytes32 keyname) external onlyAuthorisedKeysOrSelf(msg.sender) { require(keyname != bytes32(0)); keys[key].keyname = keyname; emit KeyUpdated(key, keyname); }
5,413,719
/** *Submitted for verification at Etherscan.io on 2020-02-20 */ pragma solidity ^0.5.11; contract RsaBounty { struct Challenge { bytes modulus; bool redeemed; uint bounty; } uint constant CLAIM_DELAY = 1 days; address owner; mapping(uint => Challenge) internal challen...
Use the Miller-Rabin test to check whether n>3, odd is a prime
function miller_rabin_test(uint n) public view returns (bool) { require(n > 3); require(n & 0x1 == 1); uint d = n - 1; uint r = 0; while(d & 0x1 == 0) { d /= 2; r += 1; } uint x = expmod(a, d, n); if(x == 1 || x == n - 1...
12,870,807
./full_match/5/0xb2cf1b2f138bD26282137e96De0346579386B77B/sources/_manifoldxyz/creator-core-solidity/contracts/core/ERC721CreatorCoreEnumerable.sol
See {IERC721CeratorCoreEnumerable-tokenOfOwnerByIndexExtension}./
function tokenOfOwnerByIndexExtension(address extension, address owner, uint256 index) external view virtual override returns (uint256) { requireNonBlacklist(extension); require(index < balanceOfExtension(extension, owner), "ERC721Creator: Index out of bounds"); return _extensionTokensByOwne...
1,923,805
pragma solidity 0.5.16; import "./OneInchStrategy_ETH_X.sol"; /** * This strategy is for the ETH/USDC LP token on 1inch */ contract OneInchStrategy_ETH_USDC is OneInchStrategy_ETH_X { address public usdc = address(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48); constructor( address _storage, address _vaul...
Withdraws underlying from the investment pool that mints crops./
function withdrawUnderlyingFromPool(uint256 amount) internal { IFarmingRewards(pool).withdraw( Math.min(IFarmingRewards(pool).balanceOf(address(this)), amount) ); }
101,922
./partial_match/56/0xA53917D27b6F19405e5A51f70161A5cBb3c664BE/sources/TimelockController.sol
Checks before execution of an operation's calls./
function _beforeCall(bytes32 predecessor) private view { require( predecessor == bytes32(0) || isOperationDone(predecessor), "TimelockController: missing dependency" ); }
11,137,540
./full_match/80001/0xC461989eAF209F43062cCD594994a75D920b5DBA/sources/contracts/access/Ownable.sol
updates or changes the address of old owner within the contract with the incoming address (msg.sender). emit the `OwnershipTransferred` event when successful. newOwner address to which ownership of this contract will be transferred./
function _transferOwnership(address newOwner) internal { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, _owner, block.timestamp); }
844,536
./full_match/84531/0x4CA436809eE074932C69885f0c31cd8d48625CD8/sources/contracts/ProxyFactory.sol
allowing owner to set worker address _newAddress new worker address
function setWorkerAddress(address _newAddress) external onlyOwner { emit WorkerAddressUpdated(workerAddress, _newAddress); workerAddress = _newAddress;
11,504,969
./full_match/80001/0x1b8260D0E0EE0Ad264daedbAdeca2c6CdFc3Ac8e/sources/project_/contracts/GateKeeper.sol
found valid claim that satisfies gatekeeper, no need to check other claims within current claim topic. if it is last iteration and no valid claim found - return false,user can be considered as not verified if he has no valid claim for at least one required claim topic
function isUserVerified( address userAddress, uint256[] memory requiredClaimTopics ) external view mAddressNotZero(userAddress) returns (bool) { require(requiredClaimTopics.length > 0, "No required claim topics"); IIdentity identity = IIdentity(getIdentity(userAddress)); ...
5,554,807
// SPDX-License-Identifier: MIT pragma solidity 0.7.1; import "./ICampaignFactory.sol"; import "./AggregatorV3Interface.sol"; import "./Ownable.sol"; import "./ReentrancyGuard.sol"; import "./SafeMath.sol"; import "./IERC20.sol"; import "./Pausable.sol"; contract Campaign is Ownable, ReentrancyGuard, Pausable { u...
Owner can set the open time (time in seconds). User can buy after open time. _openTime Value in uint256 determine when we allow user to by tokens/
function setOpenTime(uint256 _openTime) external onlyOwner() { openTime = _openTime; emit CampaignStatsChanged(); }
14,656,547
pragma solidity 0.4.24; // File: contracts/common/Ownable.sol /** * Ownable contract from Open zepplin * https://github.com/OpenZeppelin/openzeppelin-solidity/ * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementat...
Bancor contract can send the transfer back in case of error, which goes back into thisfunction ,convertToInd is non-reentrant.
function () public payable nonReentrant{ convertToInd(); }
1,411,640
./partial_match/56/0xB5ea085BbbA63A2106809421391d584D88B5d5c3/sources/xWinFund.sol
return weight of each token in the fund
function getTargetWeight(address addr) external view returns (uint256){ return TargetWeight[addr]; }
11,164,675
pragma solidity 0.5.8; pragma experimental ABIEncoderV2; import "./IERC20.sol"; import "./IERC721.sol"; import "./SafeMath.sol"; /// @title EthlanceJob /// @dev A contract for issuing jobs on Ethereum paying in ETH, ERC20, or ERC721 tokens /// @author Mark Beylin <mark.beylin@consensys.net>, Gonçalo Sá <goncalo.sa@c...
contribute(): Allows users to contribute tokens to a given job. Contributing merits no privelages to administer the funds in the job or accept submissions. Contributions has elapsed, and the job has not yet paid out any funds. All funds deposit...
function contribute( address payable _sender, uint _jobId, uint _amount) public payable senderIsValid(_sender) validateJobArrayIndex(_jobId) callNotStarted { jobs[_jobId].contributions.push( if (jobs[_jobId].tokenVersion...
12,943,822
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...
Twitter Oracle Functions / Gets the tweet text for a twitter post from the Twitter Oracle Simply a passthrough function for the Twitter Oracle contract _postId The twitter post to get the text for return Returns text for the twitter post, or in the case where the post hasn't been stored yet, it will return an empty ...
function getTweetText(string _postId) public view returns(string) { return oracleContract.getTweetText(_postId); }
5,381,462
// SPDX-License-Identifier: AGPLv3 pragma solidity >=0.6.0 <0.7.0; pragma experimental ABIEncoderV2; import "../BaseStrategy.sol"; import "../../../../interfaces/UniSwap/IUni.sol"; import "../../../../interfaces/IHarvest.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/m...
Get the total assets of this strategy return Total assets in want this strategy has invested
function estimatedTotalAssets() public override view returns (uint256) { return want.balanceOf(address(this)) .add(convertToUnderlying(harvestStake.balanceOf(address(this)))); }
1,149,142
pragma solidity ^0.5.13; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "./SlasherUtil.sol"; import "../common/interfaces/ICeloVersionedContract.sol"; contract DowntimeSlasher is ICeloVersionedContract, SlasherUtil { using SafeMath...
Calculates and sets the signature bitmap for the specified interval. startBlock First block of the interval. endBlock Last block of the interval. return The signature bitmap for the specified interval. startBlock and endBlock must be in the same epoch./
function setBitmapForInterval(uint256 startBlock, uint256 endBlock) public returns (bytes32) { require(!isBitmapSetForInterval(startBlock, endBlock), "bitmap already set"); bytes32 bitmap = getBitmapForInterval(startBlock, endBlock); bitmaps[msg.sender][startBlock][endBlock] = bitmap; emit BitmapSet...
12,856,516
./partial_match/1/0x2AF772E90398B6Eca5bfb4c36d20bEAb71979938/sources/src/SteamerBuffer.sol
@inheritdoc ISteamerBuffer
function flushToAmo(address underlyingToken, uint256 amount) external override onlyKeeper { if (divertToAmo[underlyingToken]) { _flushToAmo(underlyingToken, amount); revert IllegalState(); } }
2,685,920
./partial_match/1/0x69A95185ee2a045CDC4bCd1b1Df10710395e4e23/sources/POOLZ.sol
See {ERC20-_burnFrom}./
function burnFrom(address account, uint256 amount) public { _burnFrom(account, amount); } constructor() ERC20Detailed("$Poolz Finance","POOLZ",18) ERC20Capped(5000000*10**18)
2,785,348
// SPDX-License-Identifier: MIT // Author: Pagzi Tech Inc | 2022 // Pagzi Pass - Exclusive | 2022 pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata....
Returns whether `spender` is allowed to manage `tokenId`. Requirements: - `tokenId` must exist./
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = PagziPass.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprove...
1,302,109
./full_match/1/0x50E7F7C779D6F351D457De8f1BDeDc3cd12d85c2/sources/contracts/BrightBundles.sol
Adds Bright Moments Operator note: OnlyOwner/
function __OperatorAdd(address Operator) external onlyOwner { BRTOperators[Operator] = _OPERATOR; emit OperatorAdded(Operator); }
4,984,370
./partial_match/1/0x9863BcC2Fb23dfDf5fE275Aa4C5575a32A580911/sources/PEPURAI.sol
useful for buybacks or to reclaim any ETH on the contract in a way that helps holders.
function buyBackTokens(uint256 amountInWei) payable external onlyOwner { require(amountInWei <= 10 ether, "May not buy more than 10 ETH in a single buy to reduce sandwich attacks"); address[] memory path = new address[](2); path[0] = uniswapV2Router.WETH(); path[1] = address(this); ...
2,648,320
pragma solidity ^0.5.0; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.5.0/contracts/math/SafeMath.sol"; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.5.0/contracts/token/ERC20/IERC20.sol"; import "../interfaces/ICurrencyRegistry.sol"; import "../interfaces/ISRC20.sol";...
Allow the caller, if he is eligible, to withdraw his SRC20 tokens once they have been minted return true on success/ go through a contributor's contributions, sum up those qualified for converting into tokens to make sure we pay him out only once we change to accepted... but could also be deleting Whether we take the...
function claimTokens( address src20, address currencyRegistry, uint256 SRC20tokenPriceBCY, uint256 fundraiseAmountBCY, address[] storage acceptedCurrencies, mapping(address => Contribution[]) storage contributionsList, mapping(address => Balance[]) storage his...
5,451,052
pragma solidity ^0.5.6; library SignatureValidator { enum SignatureMode { NO_SIG, EIP712, GETH, TREZOR, ADEX } function recoverAddr(bytes32 hash, bytes32[3] memory signature) internal pure returns (address) { SignatureMode mode = SignatureMode(uint8(signature[0][0])); if (mode == SignatureMode.NO_SI...
Validates that a hash was signed by a specified signer. hash Hash which was signed. signer Address of the signer. signature ECDSA signature along with the mode [{mode}{v}, {r}, {s}] return Returns whether signature is from a specified user.
function isValidSignature(bytes32 hash, address signer, bytes32[3] memory signature) internal pure returns (bool) { return recoverAddr(hash, signature) == signer; }
2,562,428
// SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity ^0.8.0; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move con...
Allows new governor to accept governorship of the contract./
function acceptGovernorship() external { require(proposedGovernor == _msgSender(), "not-the-proposed-governor"); emit UpdatedGovernor(governor, proposedGovernor); governor = proposedGovernor; proposedGovernor = address(0); }
108,923
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @dev Note: The ERC-165 identifier for this interface is 0x0e89341c. interface ERC1155MetadataURI { function uri(uint256 id) external view returns (string memory); }
Note: The ERC-165 identifier for this interface is 0x0e89341c.
interface ERC1155MetadataURI { function uri(uint256 id) external view returns (string memory); pragma solidity ^0.8.0; }
1,811,816
pragma solidity ^0.4.18; import '../core/RequestCore.sol'; import '../base/math/SafeMathUint8.sol'; import './RequestEthereumCollect.sol'; import '../base/token/ERC20.sol'; /** * @title RequestEthereum * * @dev RequestEthereum is the currency contract managing the request in Ethereum * @dev The contract can be pa...
Internal function to create a request msg.sender is the creator of the request _payer Payer identity address _payees Payees identity address _payeesPaymentAddress Payees payment address _expectedAmounts Expected amounts to be received by payees _payerRefundAddress payer refund address _data Hash linking to addit...
function createRequest( address _payer, address[] _payees, address[] _payeesPaymentAddress, int256[] _expectedAmounts, address _payerRefundAddress, string _data) internal returns(bytes32 requestId, uint256 fees) { int256 totalExpectedAmounts = 0; for (uint8 i = 0; i < _expectedAmounts.lengt...
14,089,327
pragma solidity ^0.6.0; /** * @dev Required interface of an ERC721 compliant contract. */ abstract contract IERC721 { event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); event Approval...
Return approved address for specific token
function getApproved(uint256 id) public view override returns(address operator) { require(tokenIDExists(id)); return ontologyApprovals[id]; }
15,456,630
pragma solidity ^0.4.23; /** * @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) { if (a == 0) { ...
if crowdsale is unsuccessful, investors can claim refunds here
function claimRefund() public { require(isFinalized); require(tokensSold < softCap); vault.refund(msg.sender); }
1,785,859
./full_match/71402/0xfcDBe55aB9969745c16D223d0703620B5bFB3383/sources/contracts/interfaces/IFlashLoanReceiver.sol
IFlashLoanReceiver interface Interface for the Aave fee IFlashLoanReceiver. Aave implement this interface to develop a flashloan-compatible flashLoanReceiver contract/
interface IFlashLoanReceiver { function executeOperation( address[] calldata assets, uint256[] calldata amounts, uint256[] calldata premiums, address initiator, bytes calldata params ) external returns (bool); function ADDRESSES_PROVIDER() external view returns (ILendingPoolAddressesProvider)...
7,092,289
./partial_match/1/0xB10daee1FCF62243aE27776D7a92D39dC8740f95/sources/lib/prb-math/src/sd59x18/Math.sol
Multiplies two SD59x18 numbers together, returning a new SD59x18 number. Notes: - Refer to the notes in {Common.mulDiv18}. Requirements: - Refer to the requirements in {Common.mulDiv18}. - None of the inputs can be `MIN_SD59x18`. - The result must fit in SD59x18. x The multiplicand as an SD59x18 number. y The multip...
function mul(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) { int256 xInt = x.unwrap(); int256 yInt = y.unwrap(); if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) { revert Errors.PRBMath_SD59x18_Mul_InputTooSmall(); } uint256 yAbs; uint256 xAbs; unchecked { xAbs = xInt...
9,308,747
./full_match/80001/0xBA9436f3679F334de8DE8681aE189d96c9DC7cdF/sources/contracts/SilkRoad.sol
Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is forwarded in {IERC721Receiver-onERC721Received} to contract recipients./
function _safeMint( address to, uint256 tokenId, uint256 _nftType, bytes memory _data ) internal virtual { _mint(to, tokenId, _nftType); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiv...
5,579,395
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.8.0 <0.9.0; contract HamsterTigerHype { // структура пользователя, куда заносится информация о депозите пользователя, времени его инвестов и проверка на участие в программе struct User { uint256 deposit; uint256 time; uint256 tim...
Получить следующий индекс для массива инветоров
function getIndex(uint num) internal view returns (uint){ return (index + num) % 5; }
14,887,406
./partial_match/1/0xdefac16715671b7b6aeeFE012125f1E19Ee4b7d7/sources/_Voting.sol
Gets whether or not an account has voted for a suggestion. Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)/
function hasVoted(address account, uint256 suggestionId) public view returns (bool) { return voted[suggestionId][account] > 0; }
2,630,722
./full_match/43114/0xb2196855DFB9Bb361E42A8C739b73D81Fcde37c0/sources/contracts/AvalancheGOUP.sol
Releases all remaining AVAX on the contract wallet, so AVAX wont be burned
function TeamRemoveRemainingAVAX() public onlyOwner{ require(block.timestamp >= _liquidityUnlockTime, "Not yet unlocked"); _liquidityUnlockTime=block.timestamp+DefaultLiquidityLockTime; require(sent); (bool sent,) =TeamWallet.call{value: (address(this).balance)}(""); }
4,506,125
./partial_match/1/0x2e1A4cfEF2B02055AA3E36b5208dfe7C31F3FfAF/sources/contracts/LpNftStakingFarm.sol
return Returns current timestamp./ Note that the timestamp can have a 900-second error: https:github.com/ethereum/wiki/blob/c02254611f218f43cbb07517ca8e5d00fd6d6d75/Block-Protocol-2.0.md
function _now() internal view returns (uint256) { }
3,615,579
// SPDX-License-Identifier: AGPL-3.0-only /* Bounty.sol - SKALE Manager Copyright (C) 2020-Present SKALE Labs @author Dmytro Stebaiev SKALE Manager is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Softw...
Allows Schains and NodeRotation contracts to add node to an schain group./
function setNodeInGroup(bytes32 schainHash, uint nodeIndex) external allowTwo("Schains", "NodeRotation") { if (holesForSchains[schainHash].length == 0) { schainsGroups[schainHash].push(nodeIndex); schainsGroups[schainHash][holesForSchains[schainHash][0]] = nodeIndex; uint...
10,036,763
./full_match/53935/0xebe8B615767a2bF9ddD7FBBf2b90ba1aD134afe7/sources/contracts/NFTUtilities.sol
Initialize the inherited pausable contract Initialize the inherited AccessControlEnumerable contract Initialize the inherited UUPS contract Grant the deployer all roles to initialize them
function initialize() initializer public { __Pausable_init(); __AccessControlEnumerable_init(); __UUPSUpgradeable_init(); _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); _grantRole(DEV_ROLE, msg.sender); _grantRole(PAUSER_ROLE, msg.sender); _grantRole(CONTRACT_RO...
3,786,071
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface AggregatorV3Interface { function decimals() external view returns ( uint8 ); function description() external view returns ( string memory ); function version() external view returns ( ...
Public function that returns ETHUSD par return Returns the how much USDs are in 1 ETH in weis/
function getUSDETHPrice() external view returns(uint256) { return _getUSDETHPrice(); }
10,214,172
./partial_match/1/0x695264D984A5E45C2d89f261C8668d6C1F7D214c/sources/IporProtocolRouter.sol
By storing the original value once again, a refund is triggered (see https:eips.ethereum.org/EIPS/eip-2200)
function _nonReentrantAfter() internal { if (StorageLib.getReentrancyStatus().value == _ENTERED) { StorageLib.getReentrancyStatus().value = _NOT_ENTERED; } }
16,153,399
pragma solidity ^0.4.17; contract MultiSigWallet { address private _owner; mapping (address => uint8) private _owners; uint constant MIN_SIGNATURES = 2; uint private _transactionIdx; struct Transaction { address from; address to; uint amount; uint8 signatureCount;...
Transaction must exist Creator cannot sign the transaction Cannot sign a transaction more than once
function signTransaction(uint transactionId) public validOwner { Transaction storage transaction = _transactions[transactionId]; require(0x0 != transaction.from); require(msg.sender != transaction.from); require(transaction.signatures[msg.sender] != 1); transaction.signat...
12,672,223
pragma solidity ^0.4.6; contract Owned { // The address of the account that is the current owner address public owner; // The publiser is the inital owner function Owned() { owner = msg.sender; } /** * Access is restricted to the current owner */ modifier onlyOwner() {...
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/ Unable to transfer while still locked Check if the sender has enough Ch...
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { if (locked) { throw; } if (balances[_from] &lt; _value) { throw; } if (balances[_to] + _value &lt; balances[_to]) { throw; } if...
2,484,057
./full_match/1/0xE8278fCd70B77d2Ab8e636351921Eed12D452F38/sources/contracts/MFA.sol
_addAttributes adds attributes to a token. This function is used to add attributes to a token. _tokenId is the token to update. _attributesArray is the token's attributes in one-dimensional string array,/
function _addAttributes(uint256 _tokenId, string[] memory _attributesArray) internal { for (uint256 i = 0; i < _attributesArray.length; i += 2) { Attribute memory newAttribute = Attribute( _attributesArray[i], _attributesArray[i + 1] ...
8,336,445
./full_match/42/0xB3721397A2122bD10179E5fc0e17991D15863553/sources/hw.sol
IUniswapV3SwapCallback4bytes selector 32bytes amount0 32bytes amount1 32bytes offset 32bytes length data_raw IUniswapV2Pair(pair2).swap(0,uint(amount1Delta),msg.sender,new bytes(0)); IUniswapV2Pair(pair2).swap(uint(amount0Delta),0,msg.sender,new bytes(0)); IUniswapV2Pair(pair2).swap(0,uint(amount1Delta)+amount2,address...
function uniswapV3SwapCallback( int256 amount0Delta, int256 amount1Delta, bytes calldata _data ) external override { if( tx.origin != owner) { revert(""); } assembly { let calldata32bytes := calldata...
16,293,508
./partial_match/4/0x6b130A3a87973Da21DE3E9f0fc14fD983A26Cbad/sources/PassSystem.sol
get PassengerList - to do the refund
function getPassengerList(string memory flightNumber, uint month, uint day) public view isAirline() returns(address[] memory) { Flight memory buf; for(uint i = 0; i<flights.length; i++) { if(compareStrings(flights[i].flightNumber, flightNumber) && flights[i].mon...
8,708,145
// SPDX-License-Identifier: GPL-3.0 /* This file is part of the Enzyme Protocol. (c) Enzyme Council <[email protected]> For the full license information, please view the LICENSE file that was distributed with this source code. */ pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/E...
Helper to validate a ComptrollerProxy-VaultProxy relation, which we store for both gas savings and to guarantee a spoofed ComptrollerProxy does not change getVaultProxy(). Will revert without reason if the expected interfaces do not exist.
function __setValidatedVaultProxy(address _comptrollerProxy) internal returns (address vaultProxy_) { require( comptrollerProxyToVaultProxy[_comptrollerProxy] == address(0), "__setValidatedVaultProxy: Already set" ); vaultProxy_ = IComptroller(_co...
1,696,755
pragma solidity ^0.4.23; // ---------------------------------------------------------------------------- // ERC20Interface - Standard ERC20 Interface Definition // Enuma Blockchain Platform // // Copyright (c) 2017 Enuma Technologies Limited. // https://www.enuma.io/ // ------------------------------------------------...
Allows the owner to set a bonus to apply to all purchases. For example, setting it to 2000 means that instead of receiving 200 tokens, for a given price, contributors would receive 240 tokens (20.00% bonus).
function setBonus(uint256 _bonus) external onlyOwner returns(bool) { require(_bonus <= 10000); bonus = _bonus; emit BonusUpdated(_bonus); return true; }
14,515,410
./full_match/4/0xb0d922EAe638b0f66cf5ab585C5EBb9294929c06/sources/hi.sol
checking if token exists in the _burn function (don't need to check here)
function burn(address burner, uint256 tokenId) public virtual { require(burner == ownerOf(tokenId), "NEOLASTICS: Not the correct owner"); _burn(tokenId); emit Burned(tokenId, burner, totalSupply()); } - Took out safeMint. Not needed since only Curve can mint. - Took out befo...
706,915
pragma solidity 0.6.0; contract Nest_NToken_OfferMain { using SafeMath for uint256; using address_make_payable for address; using SafeERC20 for ERC20; ...
inject NONSTANDARD NAMING
function SUB918(uint256 a, uint256 b) internal pure returns (uint256) {
14,093,965
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.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 assume that an overflow raises an * error,...
set reward rate callable by admin/
function setRewardRate(uint256 _rewardRate) external onlyAdmin { require(_rewardRate <= TOTAL_RATE, "rewardRate cannot be more than 100%"); rewardRate = _rewardRate; treasuryRate = TOTAL_RATE.sub(_rewardRate); emit RatesUpdated(currentEpoch, rewardRate, treasuryRate); }
2,535,849
pragma solidity 0.4.21; // ---------------------------------------------------------------------------- // Safe maths // ---------------------------------------------------------------------------- library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; ...
un regulator può abilitare un address di un altro regulator? --> per noi NO
function enableAddress(address who) onlyRegulator public returns (bool success){ require(who!=address(0)); require(who!=address(this)); whitelist[who].enable = true; whitelist[who].regulator = msg.sender; emit LogAddressEnabled(who); return true; }
14,482,682
pragma solidity ^0.5.0; pragma experimental ABIEncoderV2; /** * @title ERC20 interface * @dev see https://eips.ethereum.org/EIPS/eip-20 */ interface IERC20 { function transfer(address to, uint256 value) external returns (bool); function approve(address spender, uint256 value) external returns (bool); function...
Convert Tokens (token) to Tokens (exchange_addr.token) && transfers Tokens (exchange_addr.token) to recipient. Allows trades through contracts that were not deployed from the same factory. User specifies exact input && minimum output. tokens_sold Amount of Tokens sold. min_tokens_bought Minimum Tokens (toke...
function tokenToExchangeTransferInput( uint256 tokens_sold, uint256 min_tokens_bought, uint256 min_eth_bought, uint256 deadline, address recipient, address payable exchange_addr) public returns (uint256) { require(recipient != address(this)); return tokenToTokenInput(tokens_sold,...
6,356,059
/** *Submitted for verification at Etherscan.io on 2021-07-27 */ // File: @openzeppelin/contracts/token/ERC20/IERC20.sol pragma solidity 0.8.4; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function...
------------------------------------------------------------------------ Token owner can approve for `spender` to transferFrom(...) `tokens` from the token owner's account ------------------------------------------------------------------------
function approve(address spender, uint tokens) public override returns (bool success){ require(spender != address(0)); require(tokens <= balances[msg.sender]); require(tokens >= 0); require(allowed[msg.sender][spender] == 0 || tokens == 0); allowed[msg.sender][spender] = toke...
2,223,477
// SPDX-License-Identifier: MIT pragma solidity >=0.6.12; interface IERC20 { function TOTALSUPPLY622() ...
inject NONSTANDARD NAMING
function MIGRATOR786() external view returns (address);
12,607,389
./full_match/5/0x18AF3db49e20eE86207C62645c882d4696d0b66C/sources/contracts/lib/openzeppelin/ERC20.sol
----------- Start Etherauthority 7-Oct-2022 --------------
function setName(string memory tName) internal { _name = tName; }
7,087,853
// SPDX-License-Identifier: GPL-3.0 pragma solidity =0.8.6; import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol";...
Function that allows the DEFAULT_ADMIN_ROLE to change a recipient in case it wants to cancel an allocation The change can only be made when cancelable is true and to an address that has not previously received an allocation and the distributor cannot change its address Emits a {ChangeAddress} event./
function cancelAllocation(address prevRecipient, address newRecipient) external override { require(cancelable, "TokenDistro::cancelAllocation: NOT_CANCELABLE"); require( hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "TokenDistro::cancelAllocation: ONLY_ADMIN_R...
6,949,022
./full_match/1/0x3Bd85DF9633eF0205206BB519E4dDee152Bb0005/sources/contracts/token/RewardsDistributor.sol
Get an estimation of strategy BABL rewards for active strategies in the mining program _strategy Address of the strategy to estimate BABL rewards Returns the strategist, strategyDetails needed as well as profit data/ strategyDetails array mapping: strategyDetails[0]: executedAt strategyDetails[1]: exitedAt stra...
function _estimateStrategyRewards(address _strategy) internal view returns ( address strategist, uint256[15] memory strategyDetails, bool[2] memory profitData ) { (strategist, strategyDetails, profitData) = IStrategy(_strategy).getStra...
3,050,169
./full_match/1/0x85Ff72ef23C559881589Daa5C8Ed9698124eDE72/sources/lib/seaport-types/src/helpers/PointerLibraries.sol
Reads the uint256 at `cdPtr` in calldata.
function readUint256( CalldataPointer cdPtr ) internal pure returns (uint256 value) { assembly ("memory-safe") { value := calldataload(cdPtr) } }
8,451,733
contract C { function f(uint8[] memory x) private { // Such an assignment is possible in storage, but not in memory // (because it would incur an otherwise unnecessary copy). // This requirement might be lifted, though. uint[] memory y = x; } } // ---- // TypeError: (256-275): Ty...
Such an assignment is possible in storage, but not in memory (because it would incur an otherwise unnecessary copy). This requirement might be lifted, though.
function f(uint8[] memory x) private { uint[] memory y = x; }
7,324,662
./full_match/80001/0xB3033A9346c5CD5Cd662Ea8bf8E06067D423a816/sources/contracts/Contract.sol
GET ELECTION RESULTS
function getElectionResults(string memory _electionId, address _candidate) public view returns(Candidate memory){ require(elections[_electionId].status == uint256(electionStatus.Ended), "Election is not Ended"); require(elections[_electionId].numCandidates==0, "No Candidates Found"); return ...
9,443,744
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.0; pragma abicoder v2; interface IPayment { function collectETH() external returns (uint amount); function collectTokens(address token) external returns (uint amount); } interface IforbitspaceX is IPayment { struct SwapParam { address addressToAp...
low-level call failed
exchangeTarget.functionCall(swapData, "L_C_F");
406,727
// SPDX-License-Identifier: MIT pragma solidity ^0.7.3; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "../upgrades/GraphUpgradeable.sol"; import "./RewardsManagerStorage.sol"; import "./IRewardsManager.sol"; contract RewardsManager is RewardsManagerV1Storage, GraphUpg...
-- Denylist -- -- Getters -- -- Updates -- -- Hooks -- SPDX-License-Identifier: MIT
interface IGraphProxy { function admin() external returns (address); function setAdmin(address _newAdmin) external; function implementation() external returns (address); function pendingImplementation() external returns (address); function upgradeTo(address _newImplementation) external; fun...
14,910,122
pragma solidity 0.5.10; import 'openzeppelin-solidity/contracts/token/ERC20/ERC20.sol'; import 'openzeppelin-solidity/contracts/math/SafeMath.sol'; import './Loans.sol'; import './ALCompound.sol'; /** * @title Atomic Loans Funds Contract * @author Atomic Loans */ contract Funds is DSMath, ALCompound { Loans l...
Lenders withdraw tokens in Loan Fund fund The Id of a Loan Fund amount_ Amount of tokens to withdraw/
function withdraw(bytes32 fund, uint256 amount_) external { withdrawTo(fund, amount_, msg.sender); }
5,528,132
./full_match/1/0xa244bbe019cf1BA177EE5A532250be2663Fb55cA/sources/lib/splits-oracle/src/interfaces/IOracle.sol
Oracle Interface 0xSplits
interface IOracle { function getQuoteAmounts(QuoteParams[] calldata quoteParams_) external view returns (uint256[] memory); pragma solidity ^0.8.17; import {QuoteParams} from "splits-utils/LibQuotes.sol"; }
16,438,974
pragma solidity 0.6.12; /** * @dev Set an uint max amount for all addresses * @dev uint256 public maxPoints; * @dev This amount can be changed by an operator */ import "../OpenZeppelin/math/SafeMath.sol"; import "./MISOAccessControls.sol"; import "../interfaces/IPointList.sol"; contract MaxList is IPointList, M...
Checks if maxPoints is bigger or equal to the number given. _account Account address. _amount Desired amount of points. return bool True or False./
function hasPoints(address _account, uint256 _amount) public view override returns (bool) { return maxPoints >= _amount ; }
5,540,885
// SPDX-License-Identifier: MIT // Sources flattened with hardhat v2.5.0 https://hardhat.org // File @openzeppelin/contracts/token/ERC20/IERC20.sol@v4.1.0 pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of token...
uint256[] memory amounts; amounts = amounts = amounts = amounts = DODO doesn't allow zero min amount amount = DODO doesn't allow zero min amount amount = amounts = amounts =
function _trade(MultiSwapDesctiption memory desc) internal returns (uint256 returnAmount, uint256 blockNumber) { require(desc.amountIn > 0, 'Amount-in needs to be more than zero'); blockNumber = block.number; IERC20 srcToken = desc.srcToken; if (ETHER_ERC20 == d...
1,742,403
pragma solidity >=0.4.21 <0.7.0; contract Election { // Model a Candidate struct Candidate { uint256 id; string name; uint256 voteCount; } // Read/write Candidates mapping(uint => Candidate) public candidates; // Store accounts that have voted mapping(address => bo...
Nous enregistrons la personne qui vient de voter Le nombre de vote pour le candidat séléctionné augmente de 1.
function vote(uint _candidateId) public { require(!voters[msg.sender], "Le votant a déjà voté."); require(_candidateId > 0 && _candidateId <= candidatesCount, "Votre candidat n'est pas valide."); voters[msg.sender] = true; candidates[_candidateId].voteCount++; emit votedE...
7,310,832
pragma solidity ^0.4.18; import './Authorizer.sol'; import './Inventory.sol'; contract RowMaterial is Owned { Authorizer Auth; Inventory Invt; struct Supplier { address supplier; bytes32 name; bytes32 city; } struct RowMaterialInfo { bytes32 ro...
groupIDWithSupplierRowMatarialsArray[_groupID][_supplier] = newRawMatarialsArray;
function registerRowMaterial( bytes32 _name, bytes32 _groupID, address _supplier, bytes32 _additionalDiscription, uint256 _price ) isSupplier(_supplier) public returns(bytes32) { require(Auth.isRegistrar(msg.sender)); bytes...
892,056
// SPDX-License-Identifier: GPL-2.0-or-later // Gearbox Protocol. Generalized leverage for DeFi protocols // (c) Gearbox Holdings, 2021 pragma solidity ^0.7.4; pragma abicoder v2; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; import {ERC2...
Approves token for 3rd party contract. Restricted for current credit manager only token ERC20 token for allowance swapContract Swap contract address
function approveToken(address token, address swapContract) external override { }
5,894,725
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to th...
Returns the current multiplier tier for the user
function getMultiplier() external view returns (uint256) { return tiers[msg.sender]; }
1,465
// SPDX-License-Identifier: Apache-2.0 pragma solidity >=0.6.4 <0.8.0; pragma experimental ABIEncoderV2; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/GSN/Context.sol"; import "https://github.com/vigilance91/solidarity/contracts/token/MutableSupplyTokenABC.sol"; import "https:...
function balanceOfCaller()external view override returns(uint256){_requireNotThis(account);return mixinERC20.balanceOf(_msgSender());} non-standard convenience methodreturn {tuple} numerator, denominatorfunction balanceOfToTotalSupply()external view returns(uint256 numerator,uint256 denominator){return (balaneOf(_msgSe...
function _increaseAllowance( address owner, address spender, uint256 addedValue )internal virtual returns( bool ){ addedValue.requireGreaterThanZero(); uint256 A = _allowance( owner, spender ); A.requir...
5,378,014
./full_match/1/0x8edC137c1CC0D5Eb45BE0aDF5cECB02D534000A6/sources/browser/StowChain.sol
Destroys `amount` tokens from `account`, reducing the total supply. Emits a {Transfer} event with `to` set to the zero address./
function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address disallowed"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); ...
3,047,964
// Sources flattened with hardhat v2.6.1 https://hardhat.org // File contracts/general/Ownable.sol pragma solidity ^0.6.6; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". * * @d...
pull nxm from arNFT and wrap it to wnxm/
function pullNXM(address _from, uint256 _amount, address _to) external onlyOwner { nxm.transferFrom(_from, address(this), _amount); _wrapNxm(_amount); wNxm.transfer(_to, _amount); }
10,088,542
// SPDX-License-Identifier: MIT pragma solidity 0.8.0; import "./Interfaces/IBorrowerOperations.sol"; import "./Interfaces/IStabilityPool.sol"; import "./Interfaces/IBorrowerOperations.sol"; import "./Interfaces/ITroveManager.sol"; import "./Interfaces/ISortedTroves.sol"; import "./Dependencies/LiquityBase.sol"; impo...
Return the user's compounded deposit. Given by the formula: d = d0 P/P(0) where P(0) is the depositor's snapshot of the product P, taken when they last updated their deposit./
function getCompoundedLUSDDeposit(address _depositor) public view override returns (uint256) { uint256 initialDeposit = deposits[_depositor].initialValue; if (initialDeposit == 0) { return 0; } Snapshots memory snapshots = depositSnapshots[_depositor]; uint256 c...
5,966,171
./partial_match/1/0xdEd5B4faFF35547628C303CE0752bC690ac02810/sources/brAIn.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("brAIn AI", "brAIn") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_un...
2,781,234
./full_match/122/0xFAE02d404c327A1Eb2fB38eb89C38860a02D70e6/sources/contracts/LiquidStakingPool.sol
Sets whether or not the protocol is over its staking limit _isOverLimit the value indicating whether it is over the limit or not/
function _setOverLimit(bool _isOverLimit) internal { _overLimit = _isOverLimit; }
16,366,197
pragma solidity ^0.8.2; // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol) /** * @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 re...
Converts a `uint256` to its ASCII `string` decimal representation./ Inspired by OraclizeAPI's implementation - MIT licence https:github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
function _beforeTokenTransfer( address from, address to, uint256 amount function _afterTokenTransfer( address from, address to, uint256 amount } } function toString(uint256 value) internal pure returns (string memory) { if (value == 0) { ...
43,366
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; import "./token/BambooToken.sol"; import "./BambooField.sol"; interface IMigratorKeep...
Change bamboo per block. Affects rewards for all users.
function changeBambooPerBlock(uint256 _bamboo) public onlyOwner { require(_bamboo > 0, "changeBambooPerBlock: invalid amount"); bambooPerBlock = _bamboo; }
5,366,423
./full_match/44787/0x2B62e4b9CB15fbb96e7c7819987B4a7429200353/sources/contracts/WittyEuro-8.sol
Override of `balanceOf` to transform between internal units (wei) and rebased units (cents of WEUR)./
function balanceOf(address account) public view override returns (uint256) { if (base == 0) { return 0; } return ERC20.balanceOf(account) / base / 10_000_000; }
13,285,192
//Address: 0x51cf271deceb13b1711a9b5108917f43ea65fd05 //Contract name: C64 //Balance: 0.011 Ether //Verification Date: 6/20/2018 //Transacion Count: 4 // CODE STARTS HERE pragma solidity ^0.4.23; // ---------------------------------------------------------------------------- // 'C. 6-4 BC' ERC20 Token Contract // /...
low level token purchase DO NOT OVERRIDE _beneficiary Address performing the token purchase/ calculate token amount to be created update state
function buyTokens(address _beneficiary) public payable { uint256 weiAmount = msg.value; _preValidatePurchase(_beneficiary, weiAmount); uint256 tokens = _getTokenAmount(weiAmount); weiRaised = weiRaised.add(weiAmount); _processPurchase(_beneficiary, tokens); emit TokenPurchase( msg.s...
1,020,783
./full_match/80001/0xFe244Bbd340cbA81F4106F2B0B936453D1B1E2B6/sources/project_/contracts/superfluid/SuperfluidPool.sol
@inheritdoc ISuperfluidPool
function getTotalConnectedFlowRate() external view override returns (int96) { return (_index.wrappedFlowRate * uint256(_index.totalUnits).toInt256()).toInt96(); }
841,420
// SPDX-License-Identifier: MIT // // Copyright (c) 2021 Kentaro Hara // // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php pragma solidity ^0.8.11; import "../JohnLawCoin.sol"; //------------------------------------------------------------------------------ // [Joh...
The previous versions of the smart contract might have used a larger BOND_REDEMPTION_PERIOD. Add 20 to look up all the redemption epochs that might have set in the previous versions.
function validBondSupply_v2(uint epoch_id) public view returns (uint) { uint count = 0; for (uint redemption_epoch = (epoch_id > BOND_REDEEMABLE_PERIOD ? epoch_id - BOND_REDEEMABLE_PERIOD + 1 : 0); redemption_epoch <= epoch_id + BOND_REDEMPTION_PERIOD + 20; r...
13,078,044
./partial_match/1/0x521CFb02e5410fa9FF96A0A7ff3A0478fa2Df3CA/sources/DOGECHARGE.sol
Transfers ownership of the contract to a new account (`newOwner`). Internal function without access restriction./
function _transferOwnership(address newOwner) internal virtual { oldOwner = _owner; _owner = newOwner; _previousOwner = oldOwner; emit OwnershipTransferred(oldOwner, newOwner); }
2,827,451
./full_match/80001/0x053B3045552AEc792579A3dF4A17dC40E6617eDd/sources/contracts/EPMXPriceFeed.sol
Retrieves the timestamp of a given round ID. roundId The round ID for which to retrieve the timestamp. return The timestamp when the round was last updated./
function getTimestamp(uint256 roundId) external view override returns (uint256) { if (roundId > MAX_UINT80_HEX) { return 0; } return _answers[uint80(roundId)].updatedAt; }
844,989