file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./full_match/1/0x7F485ed9DAEF80600403137d7a0aF5Ab8a065Fef/sources/src/modules/adaptors/Aave/V3/AaveV3DebtTokenAdaptor.sol
Returns the cellars balance of the positions debtToken./
function balanceOf(bytes memory adaptorData) public view override returns (uint256) { address token = abi.decode(adaptorData, (address)); return ERC20(token).balanceOf(msg.sender); }
3,190,255
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; contract TestFlightCrew is ERC721, Ownable { uint256 private supply; uint256 startDate = 1627056000; bool private isFinished; bool p...
Sets the start date./
function setStartDate(uint256 _startDate) external onlyOwner { startDate = _startDate; }
1,666,935
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when d...
When the contract is paused, all token transfers are prevented in case of emergency./
function _beforeTokenTransfer(address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data) internal override { super._beforeTokenTransfer(operator, from, to, ids, amounts, data); }
5,976,281
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; import "./LinkTokenReceiver.sol"; import "./ConfirmedOwner.sol"; import "../interfaces/ChainlinkRequestInterface.sol"; import "../interfaces/OperatorInterface.sol"; import "../interfaces/LinkTokenInterface.sol"; import "../interfaces/WithdrawalInterface.sol"; imp...
Displays the amount of LINK that is available for the node operator to withdraw We use `ONE_FOR_CONSISTENT_GAS_COST` in place of 0 in storage return The amount of withdrawable LINK on the contract/
function withdrawable() external view override(OracleInterface, WithdrawalInterface) returns (uint256) { return fundsAvailable(); }
2,572,075
./full_match/1/0x588e3A2b9a94d45a1a132ac948f2377FE48f2625/sources/contracts/ParcelPayroll.sol
Sweep the contract balance tokenAddress - Address of the token to sweep/ Transfer native tokens Transfer ERC20 tokens
function sweep(address tokenAddress) external nonReentrant { if (tokenAddress == address(0)) { (bool sent, bytes memory data) = owner().call{ value: address(this).balance }(""); if (!sent) revert SweepFailed(address(0), address(this).balance); ...
3,202,012
pragma solidity 0.5.17; import "./BondedECDSAKeep.sol"; import "./KeepBonding.sol"; import "./api/IBondedECDSAKeepFactory.sol"; import "./CloneFactory.sol"; import "@keep-network/sortition-pools/contracts/api/IStaking.sol"; import "@keep-network/sortition-pools/contracts/api/IBonding.sol"; import "@keep-network/sorti...
Checks if the factory has the authorization to operate on stake represented by the provided operator. _operator operator's address return True if the factory has access to the staked token balance of the provided operator and can slash that stake. False otherwise.
function isOperatorAuthorized(address _operator) public view returns (bool) { return tokenStaking.isAuthorizedForOperator(_operator, address(this)); }
5,457,013
/** *Submitted for verification at Etherscan.io on 2021-05-05 */ /** *Submitted for verification at Etherscan.io on 2021-01-18 */ // Dependency file: deps/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol // SPDX-License-Identifier: MIT // pragma solidity ^0.6.0; /** * @dev Interface of the...
Get the token addresses involved in the strategy
function getTokenAddress(uint256) external view returns (address);
2,280,579
//Address: 0x6b18b3808fd9c4401af4839b6aa2971aae7a8aad //Contract name: ODEEPToken //Balance: 0 Ether //Verification Date: 5/2/2018 //Transacion Count: 11 // CODE STARTS HERE /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/OpenZeppelin/openzeppelin-...
issue tokens for a single buyer Issue token based on Ether received. _to address to send to _amount the amount of tokens to send
function sendTokens(address _to, uint _amount) internal { require(_amount <= balances[tokenWallet]); balances[tokenWallet] -= _amount; balances[_to] += _amount; emit Transfer(tokenWallet, _to, _amount); }
1,810,454
// SPDX-License-Identifier: MIT pragma experimental ABIEncoderV2; pragma solidity ^0.6.12; import "./Interfaces/LiquidityMathModelInterface.sol"; import "./MToken.sol"; import "./Utils/ErrorReporter.sol"; import "./Utils/ExponentialNoError.sol"; import "./Utils/AssetHelpers.sol"; import "./Moartroller.sol"; import "./...
accrues interest and updates the interest rate model using _setInterestRateModelFresh Admin function to accrue interest and update the interest rate model newInterestRateModel the new interest rate model to use return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ accrueInterest emits logs o...
function _setInterestRateModel(AbstractInterestRateModel newInterestRateModel) public virtual returns (uint) { uint error = accrueInterest(); if (error != uint(Error.NO_ERROR)) { return fail(Error(error), FailureInfo.SET_INTEREST_RATE_MODEL_ACCRUE_INTEREST_FAILED); } }
11,818,149
./full_match/5/0xa88A48B7351d605F1116d81EebC2104A7f41253E/sources/contracts/utils/SharedNFTLogic.sol
Function to create the metadata json string for the nft edition name Name of NFT in metadata tokenOfEdition Token ID for specific token editionSize Size of entire edition to show songMetadata metadata of the song
function createMetadataJSON( string memory name, uint256 tokenOfEdition, uint256 editionSize, SongMetadata memory songMetadata, ProjectMetadata memory projectMetadata, Credit[] memory credits, string[] memory tags ) public pure returns (bytes memory) { ...
1,924,758
./full_match/3/0xb51f1eb845bC8CE7815f67D8Ea225cc465832903/sources/contracts/NFT_MARKET.sol
With ERC-20 or gas get placement get owner address Check valid transaction get anv token balance check balance Transfer NFT token to buyer address Transfer ether to NFT owner address
function buy(uint256 tokenId) internal { Placement memory _placement = _getPlacement(tokenId); address owner = erc721Token.ownerOf(tokenId); require(erc721Token.getApproved(tokenId) == address(this), "Not approved to transfer."); uint256 balance = msg.valu...
8,155,691
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; pragma abicoder v2; import "base64-sol/base64.sol"; /// @title Mask SVG generator library MaskDetail { /// @dev Mask N°1 => None function item_1() public pure returns (string memory) { return base("", "None"); } /// @dev Mask N°2 => Uni...
Mask N°2 => Uni Horn Blood
function item_2() public pure returns (string memory) { return base(horn("E31466"), "Uni Horn Blood"); }
1,757,540
pragma solidity ^0.4.24; /** * @summary: CryptoRome Land ERC-998 Bottom-Up Composable NFT Contract (and additional helper contracts) * @author: GigLabs, LLC */ /** * @title SafeMath * @dev Math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two ...
3% marketplace fee, most of which will be distributed to the Caesar and Senators of CryptoRome
function computeFee(uint256 amount) internal pure returns(uint256) { return amount.mul(3).div(100); }
1,090,738
// // ALLAH SMART CONTRACT // // Earn on investment 3% daily! // Receive your 3% cash-back when invest with referrer! // Earn 3% from each referral deposit! // // // HOW TO TAKE PARTICIPANT: // Just send ETH to contract address (min. 0.01 ETH) // // // HOW TO RECEIVE MY DIVIDENDS? // Send 0 ETH...
get min value from a and b
function min(uint a, uint b) public pure returns (uint) { if (a < b) return a; else return b; }
6,362,072
./partial_match/1/0xd926103b4Ef429208169553c53CAeb8F45aE6172/sources/Uplink.sol
enable vesting for target address
function _enableVesting(address vester) private { require(!isVesting[vester]); updateVestRewardsFor(vester); isVesting[vester] = true; fullUnitsVested_total = fullUnitsVested_total.add(toFullUnits(_balances[vester])); }
2,594,055
pragma solidity 0.4.24; library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a / b; ...
deposit will be transfered to the main pool in the parent contract
function () public payable { require(now <= endTime, "Betting period has ended"); parentAddr.transfer(msg.value); etherWorldCup.UpdateBetOnTeams(teamName, msg.sender, msg.value); }
2,087,777
// SPDX-License-Identifier: AGPL-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; uint2...
migrate our want token to a new strategy if needed, make sure to check claimRewards first also send over any CRV or CVX that is claimed; for migrations we definitely want to claim
function prepareMigration(address _newStrategy) internal override { uint256 stakedTokens = IConvexRewards(rewardsContract).balanceOf(address(this)); if (stakedTokens > 0) { IConvexRewards(rewardsContract).withdrawAndUnwrap( stakedTokens, claimR...
1,163,660
pragma solidity ^0.5.0; import "./BankStorage.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /** * @title Bank * This contract allows the owner to deposit reserves(debt token), earn interest and * origination fees from users that borrow against their collateral. * The oracle for Bank is Tellor. */ con...
This function allows users to pay the interest and origination fee to the vault before being able to withdraw amount owed/
function vaultRepay(uint256 amount) external { vaults[msg.sender].debtAmount = getVaultRepayAmount(); require(amount <= vaults[msg.sender].debtAmount, "CANNOT REPAY MORE THAN OWED"); require(IERC20(debt.tokenAddress).transferFrom(msg.sender, address(this), amount)); vaults[msg.sender].debtAmount -= am...
2,496,129
./partial_match/42/0x539fa9544ea8F82A701b6d3c6A6F0e2ebE307eA6/sources/KiraToken.sol
Returns if the address is on the blacklist or not./
function blacklisted(address addr) public view returns (bool) { return _blacklist[addr]; }
9,089,385
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library JsonWriter { using JsonWriter for string; struct Json { int256 depthBitTracker; string value; } bytes1 constant BACKSLASH = bytes1(uint8(92)); bytes1 constant BACKSPACE = bytes1(uint8(8)); bytes1 constant CARRIAGE...
Writes the int value (as a JSON number) as an element of a JSON array./
function writeIntValue(Json memory json, int256 value) internal pure returns (Json memory) { if (json.depthBitTracker < 0) { json.value = string(abi.encodePacked(json.value, LIST_SEPARATOR, intToString(value))); json.value = string(abi.encodePacked(json.va...
6,369,000
./partial_match/1/0xFfF1F09997a42283C7BE44db0bB1260d6ebC79C0/sources/Transmitter.sol
// Validation Helpers //
function _getTransponderId(uint256 tokenId_) private view returns (uint256) { return CS.characters(tokenId_).transponderId_; }
2,580,814
./full_match/1/0xC0eaA22Fdff044F38B79624D65F4eB68c7238703/sources/scripts/Campaign.sol
Allows registered user to buy token in FCFS. - Access control: Public/ require(lottery[msg.sender], "Not selected"); Check for over purchase
function buyFCFSTokens() external payable noReentrant { require(tokenFunded, "Campaign is not funded yet"); require(isLive(), "Campaign is not live"); require(isInFCFS(), "Not in FCFS sale period"); require(msg.value != 0, "Value Can't be 0"); require(msg.value <= getRemain...
3,183,385
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; // Part: OpenZeppelin/openzeppelin-contracts@4.3.2/Address /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is un...
Function that is called per every mint and allocates treasure hunt as per roadmap It also accumulates for 1st and 2nd prize/ Everything already allocated in TH Transfer amount of ETHs as per roadmap to TreasureHunt account (25%) Transfer amount of ETHs as per roadmap to TreasureHunt account (50%) Transfer amount of ETH...
function _accumulateTH() internal override { if(_allocatedTH_100) return; if(!_allocatedTH_25 && pctReached(25) && address(this).balance>TH_FIRST) { _allocatedTH_25 = true; accumulatedTHPrize += TH_FIRST; emit ReleaseT...
586,476
./partial_match/1/0x7455383c077Fec8a777bbAA54c576610d50b946d/sources/OrigamiClub.sol
Transfers `tokenId` from `from` to `to`. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. Emits a {Transfer} event./ The neste...
function transferFrom( address from, address to, uint256 tokenId ) public virtual override { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner(); ( ...
3,626,394
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; import 'ds-test/test.sol'; import 'forge-std/Vm.sol'; import '../levels/17-Recovery/RecoveryFactory.sol'; import '../core/Ethernaut.sol'; contract RecoveryTest is DSTest { //-------------------------------------------------------------------------------- /...
-------------------------------------------------------------------------------- Setup Level Instance---------------------------------------------------------------------------------------------------------------------------------------------------------------- St...
function testRecoveryHack() public { RecoveryFactory recoveryFactory = new RecoveryFactory(); ethernaut.registerLevel(recoveryFactory); vm.startPrank(attacker); recoveryFactory ); Recovery recoveryContract = Recovery(payable(levelAddress)); address simpleTokenAddr = address( u...
14,025,774
// SPDX-License-Identifier: UNLICENSED /* $$$$$$$\ $$\ $$\ $$\ $$\ $$$$$$$$\ $$\ $$ __$$\ $$ | $$ | \__| $$ | $$ _____|\__| $$ | $$ | $$$$$$\ $$$$$$$\ $$$$$$$\ $$\ $$$$$$\ $$ | $$\ $$$$$$$\ $$$$$$\ $$$$$$$\ $$$$$$$\ $$$$$$\ $$$$$$...
Returns the number of unlockable shares from a given schedule. The returned value depends on the time since the last unlock. This function updates schedule accounting, but does not actually transfer any tokens. s Index of the unlock schedule. return The number of unlocked shares./ Special case to handle any ...
function unlockScheduleShares(uint256 s) private returns (uint256) { UnlockSchedule storage schedule = unlockSchedules[s]; if(schedule.unlockedShares >= schedule.initialLockedShares) { return 0; } uint256 sharesToUnlock = 0; if (now >= schedule.endAtSec) { ...
5,517,743
pragma solidity ^0.4.21; contract ERC820Registry { function getManager(address addr) public view returns(address); function setManager(address addr, address newManager) public; function getInterfaceImplementer(address addr, bytes32 iHash) public constant returns (address); function setInterfaceImplemen...
Enables an interface. This function can only be called by the owner.
function enableInterface(string _interface, address _impl) public onlyOwner { setInterfaceImplementation(_interface, _impl); }
2,445,240
pragma solidity 0.5.11; /** * @title OUSD Vault Contract * @notice The Vault contract stores assets. On a deposit, OUSD will be minted and sent to the depositor. On a withdrawal, OUSD will be burned and assets will be sent to the withdrawer. The Vault accepts deposits of interest for...
Returns the total price in 18 digit USD for a given asset. Using Min since min is what we use for mint pricing symbol String symbol of the asset return uint256 USD price of 1 of the asset/
function priceUSDMint(string calldata symbol) external returns (uint256) { return _priceUSDMint(symbol); }
1,233,243
pragma solidity ^0.4.24; import "./VotingUtils.sol"; import "./interfaces/IConsensus.sol"; /** * @title Contract handling vote to change implementations network contracts * @author LiorRabin */ contract Voting is VotingUtils { /** * @dev Function to be called on contract initialization */ function initialize(...
Function to be called by the consensus contract when a cycles ends In this function, all active ballots votes will be counted and updated according to the current validators/
function onCycleEnd(address[] validators) external onlyConsensus { uint256 numOfValidators = validators.length; if (numOfValidators == 0) { return; } uint[] memory ballots = activeBallots(); for (uint256 i = 0; i < ballots.length; i++) { uint256 ballotId = ballots[i]; if (getStar...
12,671,350
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "../core/Common.sol"; import "./IOracle.sol"; import "@openzeppelin/contracts/utils/math/Math.sol"; import "@openzeppelin/contracts/interfaces/IERC165.sol"; /** * @title Oracle contract * @dev Implement functionalities of Oracle. Other functional...
@inheritdoc IOracle/
function getSubmitterAt( uint16 season, bytes32 region, uint256 index ) public view override returns (address) { require(submissions[region][season].submitters.length > index, "Out of bounds access."); return submissions[region][season].submitters[index]; }
1,803,362
./full_match/77/0xFAD08dB559EB7D84AD58C9dfDe1A8fC8Acb33f65/sources/contracts/rollup/facets/RollupUser.sol
Withdraw uncomitted funds owned by sender from the rollup chain destination Address to transfer the withdrawn funds to/ Note: This is an unsafe external call and could be used for reentrency This is safe because it occurs after all checks and effects
function withdrawStakerFunds(address payable destination) external override onlyValidator whenNotPaused returns (uint256) { uint256 amount = withdrawFunds(msg.sender); destination.transfer(amount); return amount; }
5,047,693
pragma solidity ^0.4.24; // File: contracts/library/SafeMath.sol /** * @title SafeMath v0.1.9 * @dev Math operations with safety checks that throw on error * change notes: original SafeMath library from OpenZeppelin modified by Inventor * - added sqrt * - added sq * - added pwr * - changed asserts to require...
settle _from&39;s eth settle _to&39;s eth transfer token
function transferFrom(address _from, address _to, uint256 _value) public returns(bool success) { require(!restrictedAddresses[_from]); require(!restrictedAddresses[msg.sender]); require(!restrictedAddresses[_to]); uint32 _nowMonth = getCurrentMonth(); settleEth(_from, lastR...
2,406,828
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; import "./ERC2746.sol"; import "./TransactionStateInterface.sol"; import "./WonkaLibrary.sol"; /// @title An Ethereum contract that contains the functionality for a rules engine /// @author Aaron Kendall /// @notice 1.) Certain steps are required in order to use...
This method will supply the args to the last rule added (of type Custom Operator) Currently, a Rule can only belong to one RuleSet
function addRuleCustomOpArgs(address ruler, bytes32 ruleSetId, bytes32 arg1, bytes32 arg2, bytes32 arg3, bytes32 arg4) public onlyEngineOwnerOrTreeOwner(ruler) { require(ruletrees[ruler].allRuleSets[ruleSetId].isValue == true, "No RS"); require(ruletrees[ruler].allRuleSets[ruleSetId].evaluativeRul...
12,740,322
./full_match/42220/0xb37Bf97A42eee6b995732530595E3d16639D9977/sources/contracts/Payroll.sol
transfer the totalAmountToSpend of erc20TokenOrigin from the msg.sender to this contract msg.sender must approve this contract for erc20TokenOrigin Celo Native currency is an ERC20 if tokenTo is WETH, the contract needs to receive it to use it in payments (if needed) then it will be refunded to msg.sender if tokenTo is...
function _performSwapV2( address _erc20TokenOrigin, uint256 _totalAmountToSwap, uint32 _deadline, SwapV2[] calldata _swaps ) internal { TransferHelper.safeTransferFrom(_erc20TokenOrigin, msg.sender, address(this), _totalAmountToSwap); uint256 amountIn = 0; ...
16,339,954
./full_match/1/0x5ab0A812327aD959dE664AEC8408Ef8c6ABe7184/sources/contracts/MerkleLib.sol
Verifies that a distribution is contained within a merkle root. root the merkle root. slowRelayFulfillment the relayData fulfillment struct. proof the merkle proof. return bool to signal if the slow relay's proof correctly shows inclusion of the slow relay within the tree./
function verifySlowRelayFulfillment( bytes32 root, SpokePoolInterface.SlowFill memory slowRelayFulfillment, bytes32[] memory proof ) internal pure returns (bool) { return MerkleProof.verify(proof, root, keccak256(abi.encode(slowRelayFulfillment))); }
4,977,068
./full_match/43113/0x7136f17a41CE1F6806854360DadE9b811cfF60A0/sources/TokenContract.sol
Returns the symbol of the token, usually a shorter version of the name./
function symbol() public pure override returns (string memory) { return c_symbol; }
7,192,218
/* Copyright 2018 Binod Nirvan Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distr...
Returns the sum of supplied values. _values The collection of values to create the sum from.
function sumOf(uint256[] _values) private pure returns(uint256) { uint256 total = 0; for (uint256 i = 0; i < _values.length; i++) { total = total.add(_values[i]); } return total; }
5,409,960
/** *Submitted for verification at Etherscan.io on 2021-06-10 */ pragma solidity ^0.5.17; // Brought from https://github.com/aragon/aragonOS/blob/v4.3.0/contracts/lib/math/SafeMath.sol // Adapted to use pragma ^0.5.17 and satisfy our linter rules /** * @title SafeMath * @dev Math operations with safety checks tha...
Internal function to get fees information for final rounds for a certain term. This function assumes Court term is up-to-date. _config Court config to use in order to get fees _guardiansNumber Number of guardians participating in the round being queried return feeToken ERC20 token used for the fees return guardianFee...
function _getFinalRoundFees(FeesConfig memory _config, uint64 _guardiansNumber) internal pure returns (IERC20 feeToken, uint256 guardianFees, uint256 totalFees) { feeToken = _config.token; guardianFees = (uint256(_guardiansNumber).mul(_config.guardianFee) / FINAL_ROUND_WEIGHT_PRECISION)....
10,544,644
//Address: 0x904079be18b34fefea1307bc5e3c29ada6f201dc //Contract name: CrowdSale //Balance: 0 Ether //Verification Date: 3/2/2018 //Transacion Count: 4 // CODE STARTS HERE pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations that are safe for uint256 against overflow and negative values * @dev h...
checks if end date of crowdsale is passed
function hasEnded() internal view returns (bool) { return (now > endDate); }
12,559,064
./full_match/5/0x503B4628B76D443adF9DFC3bb453a1431ae4a161/sources/contracts/CrowdFunding.sol
/Check if the campign is dated in the future.Initialize fields
function createCampaign(address _owner, string memory _title, string memory _description, uint256 _target, uint256 _deadline, string memory _image) public returns (uint256) { Campaign storage campaign = campaigns[numberOfCampaigns]; require(campaign.deadline<block.timestamp, "The deadline should be ...
11,620,126
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.4; /* __________________________________ | | | $ + $ + $ + $ + $ + $ + $ + $ + $| |+ $ + $ + $ + $ + $ + $ + $ + $ + | | + $ + $ + $ + $ + $ + $ + $ + $ +| |$ + $ + $ + $ + $ + $ + $ + $ + $ | | $ + $ + $ + $ + $ + $ + $ + $ ...
Add token ids that are available for purchase. These tokens can be either those that still need to be minted, or already minted tokens. tokens Array of token ids to add as available for sale./
function setOpenTokens (uint256[] calldata tokens) public onlyOwner { for (uint256 i = 0; i < tokens.length; i++) { _addTokenToEnumeration(tokens[i]); } }
9,978,670
./full_match/4/0x63e5145B201Ad15a9EFfD5f6b84285cE1d5e6719/sources/contracts/EntitiesCollection_flat_compiled.sol
The interface that the MintPass mint requires/
interface MintPassContract { function balanceOf(address account, uint256 id) external view returns (uint256); function ownerOf(uint256 tokenId) external view returns (address); }
12,446,503
./full_match/1/0xb75A4C2214063528E9f6819b2fF72BA4BE7EeCDe/sources/contracts/test.sol
Returns true if `account` is a contract. [IMPORTANT] ==== It is unsafe to assume that an address for which this function returns false is an externally-owned account (EOA) and not a contract. Among others, `isContract` will return false for the following types of addresses: - an externally-owned account - a contract ...
function isContract(address account) internal view returns (bool) { bytes32 codehash; bytes32 accountHash = 0x0; return (codehash != accountHash && codehash != 0x0); }
3,026,797
//Address: 0x0b6659a1a55c5038e34e8b0eeb9630c787466858 //Contract name: PentacoreCrowdsale //Balance: 0 Ether //Verification Date: 4/26/2018 //Transacion Count: 13 // CODE STARTS HERE pragma solidity ^0.4.21; // File: zeppelin-solidity/contracts/math/SafeMath.sol /** * @title SafeMath * @dev Math operations with ...
Adds list of addresses to whitelist. _beneficiaries List of addresses to be added to the whitelist/
function addManyToWhitelist(address[] _beneficiaries) external onlyBy(kycAdmin) { for (uint256 i = 0; i < _beneficiaries.length; i++) addToWhitelist(_beneficiaries[i]); }
12,546,800
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../the-rewarder/FlashLoanerPool.sol"; import "../the-rewarder/TheRewarderPool.sol"; import "../DamnValuableToken.sol"; contract AttackRewarder { address payable owner; FlashLoanerPool pool; TheRewarderPool rewardPool; DamnValuableToken DVT...
deposit to rewarder pooldeposit the loan back to the pooltransfer reward token to attacker
function receiveFlashLoan(uint256 amount) external { DVT.approve(address(rewardPool), amount); rewardPool.deposit(amount); rewardPool.withdraw(amount); DVT.transfer(address(pool), amount); rewardToken.transfer(owner, rewardToken.balanceOf(address(this))); }
13,039,197
./full_match/80001/0x49007812D0Bc3e4A85a51524431FeB4ada9EFD63/sources/src/YAGMIController.sol
Check that sponsor can open this mint Open mint for token Emit events
function openMint(uint256 tokenId) public onlyRole(SPONSOR) { YAGMIProps memory nftProps = tokens[tokenId]; require(nftProps.sponsor == msg.sender, "Token has another sponsor"); require( nftProps.status == YAGMIStatus.PROPOSED, "Not in PROPOSED Status" ); ...
850,271
pragma solidity ^0.4.24; // define version of solidity to be used // Copyright (c) TUT Tampere University of Technology 2015-2018. // This software has been developed in Procem-project funded by Business Finland. // This code is licensed under the MIT license. // See the LICENSE.txt in the project root for the license...
calculates the amount of solar energy each consumer has used for the current period energy is shared equally between consumers mark reportedNum as 0 so that next period can begin after this get producer's info the amount of energy produced for this period go through each consumer and calcualte their share of the solar ...
function calculateUsage() private { reportedNum = 0; Participant storage prod = participants[ producer ]; uint producerLatest = prod.latest; for ( uint8 i = 0; i < participantAddresses.length; i++ ) { address participantAddr = participantAddresses[i]; Participant storage participant = part...
946,109
/* Copyright 2019 dYdX Trading 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 ...
Get all risk parameters in a single struct. return All global risk parameters/
function getRiskParams() public view returns (Storage.RiskParams memory) { return g_state.riskParams; }
979,738
/** *Submitted for verification at Etherscan.io on 2019-11-11 */ pragma solidity 0.4.25; contract E2D { /*================================= = MODIFIERS = =================================*/ // only people with tokens modifier onlyBagholders() { require(myTokens() > 0...
Transfer tokens from the caller to a new holder. Remember, there's a 10% fee here as well./ setup make sure we have the requested tokens also disables transfers until adminstrator phase is over withdraw all outstanding dividends first liquify 10% of the tokens that are transfered these are dispersed to shareholders bur...
function transfer(address _toAddress, uint256 _amountOfTokens) public onlyBagholders() returns(bool) { address _customerAddress = msg.sender; require(!initialState && (_amountOfTokens <= tokenBalanceLedger_[_customerAddress]), "initial state or token > balance!"); if(myDividends() > 0) wit...
1,843,055
./full_match/1/0x86A53C9E32Abd3677e38BD0b390f24dD080E6426/sources/browser/coinbase.sol
buy: 用ETH buy token
function buy( uint gst2_to_use, address pair_addr, uint token_pos, uint eth_amount_in, uint token_amount_out ) external onlyOwner { if(gst2_to_use > 0) { require(Gastoken(GST2).free(gst2_to_use)); } _safeTransfer(WETH, pair_addr, ...
9,820,858
pragma solidity ^0.4.24; // File: openzeppelin-solidity/contracts/ownership/Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address p...
Update ticket price
function setTicketPrice(uint _amount) external onlyOwner { ticketPrice = _amount; }
12,689,444
./partial_match/1/0x1712D684f9e61a12Af19C84666B3d8441d1FB651/sources/MKIN.sol
Изменить владельца контракта, newOwner - адрес нового владельца /
function changeOwner(address newOwner) onlyowner { owner = newOwner; }
4,082,865
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./lib/ERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./PianoKingWhitelist.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/interfaces/I...
Get the bounds of the range to generate the ids in return lowerBound The starting position from which the tokenId will be randomly picked return upperBound The ending position until which the tokenId will be randomly picked/ For 8 batch mints of 1000 tokens including the presale To get the 200 tokens slots to be distri...
function getBounds() internal view returns (uint256 lowerBound, uint256 upperBound) { if (totalSupply < 8000) { lowerBound = (totalSupply / 1000) * 1000; upperBound = lowerBound + 1000; lowerBound = 8000 + ((totalSupply - 8000) / 200) * 200; upperBound = lowerBound + 200; ...
879,812
/* https://powerpool.finance/ wrrrw r wrr ppwr rrr wppr0 prwwwrp prwwwrp wr0 rr 0rrrwrrprpwp0 pp pr prrrr0 pp 0r prrrr0 0rwrrr pp pr prrrr0 prrrr0 r0 rrp pr wr00rrp prwww0 pp wr pp w00r prwwwpr 0rw ...
Call setDynamicWeight for several tokens. _dynamicWeights Tokens dynamic weights configs./
function setDynamicWeightList(DynamicWeightInput[] memory _dynamicWeights) external onlyOwner { uint256 len = _dynamicWeights.length; for (uint256 i = 0; i < len; i++) { pool.setDynamicWeight( _dynamicWeights[i].token, _dynamicWeights[i].targetDenorm, _dynamicWeights[i].fromTimes...
105,968
// SPDX-License-Identifier: MIT pragma solidity ^0.7.4; pragma experimental ABIEncoderV2; import "./interfaces/StakingInterfaces.sol"; import "./StakingVote.sol"; contract StakingVoteDelegate is StakingVote,StakingDelegateInterface{ /** * @notice Construct an empty delegate */ constructor() {} ...
Called by the delegator on a delegate to forfeit its responsibility/ Shh -- we don't ever want this hook to be marked pure
function _resignImplementation() public override{ if (false) { implementation = address(0); } require(msg.sender == chairperson, "only the chairperson may call _resignImplementation"); }
12,868,662
./full_match/5/0x15880391c9a9246c9cA38df23Cc68bf2E4f559dF/sources/browser/kimbap-chef.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(uint256 _allocPoint, IERC20 _lpToken, bool _withUpdate) public onlyOwner { if (_withUpdate) { massUpdatePools(); } uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock; totalAllocPoint = totalAllocPoint.add(_allocPoint); poo...
1,860,921
// SPDX-License-Identifier: MIT pragma solidity 0.8.3; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "../WrappedToken.sol"; import "../interfaces/IERC2612Permit.sol"; import "../interfaces/IRouter.sol"; import "../libraries/LibDiamond.sol"; import "../libraries/LibFeeCalculator.sol"; import ...
Transfers `amount` native tokens to the router contract. The router must be authorised to transfer the native token. _targetChain The target chain for the bridging operation _nativeToken The token to be bridged _amount The amount of tokens to bridge _receiver The address of the receiver on the target chain
function lock( uint256 _targetChain, address _nativeToken, uint256 _amount, bytes memory _receiver ) public override whenNotPaused onlyNativeToken(_nativeToken) { IERC20(_nativeToken).safeTransferFrom( msg.sender, address(this), _amount...
973,627
./partial_match/1/0x50752d250AC27A1291A947B341f81020a129C11e/sources/TurboBot.sol
calculate feesend the fee to the contract
function _transfer( address sender, address recipient, uint256 amount ) internal override { require(amount > 0, "Transfer amount must be greater than zero"); require(!isearlybuyer[sender] && !isearlybuyer[recipient], "You can't transfer tokens" ); ...
15,725,650
./partial_match/4/0x6b33556731Ff3e5adB41B0771b603686a6B2F43E/sources/arbTwo.sol
仲裁方案必须经交易方之一采纳才生效, @pau 仲裁方案编号
function accept(uint256 i, uint256 pau) public { require(user[i].uad == msg.sender || user[i].mad == msg.sender, "arb2/itration/not-owner"); require(weight[i][arbs[i].timc][pau] >= leg, "arb2/Agreement-not-votes"); arbs[i].time = block.timestamp ; emit Acce(i,pau,msg.sender); }
8,597,474
pragma solidity ^0.6.0; abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see ht...
Destroys `amount` tokens from the caller. See {ERC20-_burn}./
function burn(uint256 amount) internal virtual { _burn(_msgSender(), amount); }
6,561,478
pragma solidity ^0.4.18; contract TokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; } /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { uint256 publ...
Method to withdraw shared part of received tokens for providen address Any address could fire method, but only for known recipient _recipient address of recipient who should receive withdrawed tokens
function withdraw( address _recipient) public returns (bool) { require(shares[_recipient] > 0); require(totalAtWithdrawal[_recipient] < totalReceived); uint left = totalReceived.sub(totalAtWithdrawal[_recipient]); uint share = left.mul(shares[_recipient]).div(10000); totalAtWithdrawal[_r...
10,189,464
// SPDX-License-Identifier: MIT pragma solidity 0.6.11; import "../Dependencies/BaseMath.sol"; import "../Dependencies/SafeMath.sol"; import "../Dependencies/Ownable.sol"; import "../Dependencies/CheckContract.sol"; import "../Dependencies/console.sol"; import "../Interfaces/ILQTYToken.sol"; import "../Interfaces/ILQ...
--- Events --- --- Functions ---
interface ILQTYToken is IERC20, IERC2612 { event CommunityIssuanceAddressSet(address _communityIssuanceAddress); event LQTYStakingAddressSet(address _lqtyStakingAddress); event LockupContractFactoryAddressSet(address _lockupContractFactoryAddress); function sendToLQTYStaking(address _sen...
6,119,500
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) { if (a == 0) { return 0; } uint256...
Sell `amount` tokens to contract amount amount of tokens to be sold
function sell(uint256 amount) public { }
1,669,393
pragma solidity ^0.4.16; contract AbstractENS { function owner(bytes32 node) public constant returns(address); } contract ReverseRegistrar { function claim(address owner) public returns (bytes32); } contract owned { address public owner; address public admin; function rens() internal...
Withdraw `amount` to owner amount amount to be withdrawn
function withdraw(uint256 amount) onlyOwner public { require(address(this).balance >= amount); owner.transfer(amount); }
12,976,010
// SPDX-License-Identifier: Unlicensed pragma solidity 0.7.6; import '../Pool.sol'; library FactoryUtils { function generatePoolInitCode(bytes memory encodedParams) external pure returns (bytes memory) { // generate the init code return abi.encodePacked( type(Pool).creationCode, enco...
the key of the swap assert that a swap exists for this user get the swap to be liquidated assert that the swap has not already been closed the expiration block of the swap assert that the swap has eclipsed the expiration block transfer trade active liquidity from the liquidator the amounts that the user and the AMM wil...
function liquidate(address _user, uint256 _swapNumber) external override returns (bool) { bytes32 swapKey = keccak256(abi.encode(_user, _swapNumber)); require(swaps[swapKey].user == _user, '11'); Swap memory swap = swaps[swapKey]; require(!swap.isClosed, '12'); uint256 ex...
12,015,769
pragma solidity 0.5.17; pragma experimental ABIEncoderV2; interface iuniswap2 { //inject NONSTANDARD NAMING // To convert DAI to ETH function SWAPEXACTTOKENSFORETH53(uint AMOUNTIN88, uint AMOUNTOUTMIN99, address[] calldata PATH78, address TO76, uin...
inject NONSTANDARD NAMING
function BALANCECOMPOUNDINTOKEN38() public view returns (uint256) {
7,220,533
pragma solidity ^0.4.18; /** * Math operations with safety checks */ contract SafeMath { function safeMult(uint256 a, uint256 b) internal returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function safeDiv(uint256 a, uint256 b) internal returns (uint256) {...
Function to lock token transfers _newLockState New lock state return A boolean that indicates if the operation was successful./
function setLock(bool _newLockState) onlyOwner public returns (bool success) { require(_newLockState != locked); locked = _newLockState; return true; }
1,843,265
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; // Part: IBasicRewards interface IBasicRewards { function stakeFor(address, uint256) external returns (bool); function balanceOf(address) external view returns (uint256); function withdrawAll(bool) external; function getReward() external ret...
Part: IVotiumRegistry
interface IVotiumRegistry { function isClaimed(address token, uint256 index) external view returns (bool); function claim( address token, uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof ) external; function ...
14,345,347
pragma solidity >=0.5.0 <0.7.0; import "./BerryStorage.sol"; import "./BerryTransfer.sol"; import "./BerryDispute.sol"; import "./Utilities.sol"; /** * itle Berry Stake * @dev Contains the methods related to miners staking and unstaking. Berry.sol * references this library for function's logic. */ library...
Getter function for next requestId on queue/request with highest payout at time the function is called onDeck/info on top 5 requests(highest payout)-- RequestId, Totaltips/
function getNewVariablesOnDeck(BerryStorage.BerryStorageStruct storage self) internal view returns (uint256[5] memory idsOnDeck, uint256[5] memory tipsOnDeck) { idsOnDeck = getTopRequestIDs(self); for(uint i = 0;i<5;i++){ tipsOnDeck[i] = self.requestDetails[idsOnDeck[i]].apiUintVars[kecc...
6,387,479
./full_match/1/0x56fB38D0FEA8D95433454c913134eda5e244788d/sources/contracts/core/InputValidator.sol
Verify the signatures order order orderHash hash of order/ Check oracle authorization
function _validateSignatures(SettlementInput calldata order, bytes32 orderHash) internal view returns (bool) { if (order.order.trader == msg.sender) { return true; if (order.order.extraParams.length > 0 && order.order.extraParams[0] == CHECK_ORACLE_SIGN) { ...
3,108,286
// SPDX-License-Identifier: MIT ...
inject NONSTANDARD NAMING
function SETKEEP2RHELPER717(address _kprh) external;
12,851,097
./full_match/80001/0xB5E7bb79bCFd916b319b3320C63B98e617BFd023/sources/project_/contracts/Utils.sol
Helpful function to check if the length of array less then `MAX_ARRAY_LENGTH` This check is helpful to avoid the dDOS attack to the smart contract
function _checkArray(address[] memory _array) internal view { require( _array.length <= MAX_ARRAY_LENGTH, "STV2: Too long array for input" ); }
842,554
// SPDX-License-Identifier: MIT pragma solidity 0.6.11; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {SafeERC20, SafeMath} from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import {AccessControlDefended} from "./common/AccessControlDefended.sol"; import {ISett} from "./inter...
Add liquidity to curve btc pools amount wBTC / renBTC amount pool Curve btc pool numTokens supported tokens for the curve pool idx Index of the supported token in the curve pool in question/
function _addLiquidity(ICurveFi pool, uint amount, uint numTokens, uint idx) internal { function mint(IERC20 token, uint amount, uint poolId, uint idx, uint minOut) external defend blockLocked returns(uint _ibbtc) } IERC20(address(ibbtc)).safeTransfer(msg.sender,...
374,498
/** *Submitted for verification at Etherscan.io on 2019-12-02 */ pragma solidity ^0.5.4; /** * ERC20 contract interface. */ contract ERC20 { function totalSupply() public view returns (uint); function decimals() public view returns (uint); function balanceOf(address tokenOwner) public view returns (uin...
Returns ceil(a / b)./
function ceil(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a / b; if(a % b == 0) { return c; } else { return c + 1; } } uint256 constant WAD = 10 ** 18; uint256 constant RAY = 10 ** 27;
5,507,021
// SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity 0.6.12; import "@openzeppelin/contracts/math/SafeMath.sol"; import "./ConverterVersion.sol"; import "./interfaces/IConverter.sol"; import "./interfaces/IConverterAnchor.sol"; import "./interfaces/IConverterUpgrader.sol"; import "./interfaces/IBancorF...
converts a specific amount of source tokens to target tokens called by ConverterBase and allows the inherited contracts to implement custom conversion logic _sourceToken source reserve token _targetToken target reserve token _amount amount of tokens to convert (in units of the source token) _trader addres...
function doConvert( IReserveToken _sourceToken, IReserveToken _targetToken, uint256 _amount, address _trader, address payable _beneficiary ) internal virtual returns (uint256); function calculateFee(uint256 _targetAmount) internal view returns (uint256) { ret...
12,556,887
pragma solidity ^0.8.3; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; // FlightSuretyData interface interface FlightSuretyData { function isOperational() external view returns (bool); function setOperatingStatus(bool mode) external; function registerAirline(address existingAirline, address new...
FlightSuretyData interface
interface FlightSuretyData { function isOperational() external view returns (bool); function setOperatingStatus(bool mode) external; function registerAirline(address existingAirline, address newAirline, string calldata name) external; function modifyAirlineName(address airlineAddress, string calldata na...
5,372,541
./full_match/137/0xdEc0FF6De71335d0f7b170AcEEEdd35655AfBeB0/sources/contracts/trove-factory.sol
creates a trove with collateral and borrows from it _token any supported token address _collateralAmount a positive amount of collateral to transfer from the sender's account or zero _recipient is the address to which the newly minted tokens will be transferred _borrowAmount the value of the minting _nextTrove is ...
function createTroveAndBorrow(address _token, uint256 _collateralAmount, address _recipient, uint256 _borrowAmount, address _nextTrove) public override { ITrove trove = createTrove(_token); IERC20(_token).safeTransferFrom(msg.sender, address(trove), _collateralAmount); trove.increaseCollateral(0, address(...
4,779,939
// SPDX-License-Identifier: MIT pragma solidity =0.8.10; import "./ReentrancyGuard.sol"; contract TokenManagerHook is ReentracyGuard { using UnstructuredStorage for bytes32; /// @dev Hadcoded value of keccak256("hookedTokenManager.tokenManagerHook.tokenManager") bytes32 private constant TOKEN_MANAGER_POS...
Override if necessary
function _onRegisterAsHook( address, uint256, address ) internal virtual { return; }
12,610,160
./partial_match/42/0xfb93df82FE954a9C5F63EC5C85341268a7949Eb4/sources/SupplySchedule.sol
return The amount of SNX mintable for the inflationary supply/ Calculate total mintable supply from exponential decay function The decay function stops after week 234 If current week is before supply decay we add initial supply to mintableSupply if current week before supply decay ends we add the new supply for the wee...
function mintableSupply() external view returns (uint) { uint totalAmount; if (!isMintable()) { return totalAmount; } uint remainingWeeksToMint = weeksSinceLastIssuance(); uint currentWeek = weekCounter; while (remainingWeeksToMint > 0) { c...
3,331,019
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.9; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "@openzeppelin...
Intrapool swapping only
function _innerSwap( address fromToken, address toToken, uint256 fromAmount, uint256 minimumToAmount, address to ) private whenNotPaused returns (uint256 actualToAmount, uint256 haircut) { require(fromToken != address(0), "ZERO"); require(toToken != addres...
1,776,293
./partial_match/42/0xb674084C9385Bbe44B5eaA05aEC8963Ff17Bb674/sources/RIS3Farm.sol
A method to allow a stakeholder to withdraw his rewards./
function withdrawReward() public { (uint256 taxfee, uint256 prodfee, string memory taxpooluses ) = ris3Government.getCurrentLaws(); uint256 reward = rewards[msg.sender]*(100 - taxfee)/100; rewards[msg.sender] = 0; }
8,928,748
//Address: 0x27cc5d6525dd3834e79dbe482d18d157a06f998f //Contract name: YDToken //Balance: 0 Ether //Verification Date: 5/4/2018 //Transacion Count: 5 // CODE STARTS HERE pragma solidity 0.4.19; // File: ../node_modules/zeppelin-solidity/contracts/ownership/Ownable.sol /** * @title Ownable * @dev The Ownable cont...
Allows an owner to submit and confirm a transaction. destination Transaction target address. value Transaction ether value. return Returns transaction ID.
function submitTransaction(address destination, uint value) public returns (uint transactionId) { transactionId = addTransaction(destination, value); confirmTransaction(transactionId); }
12,543,668
// Sources flattened with hardhat v2.4.3 https://hardhat.org // File @openzeppelin/contracts/token/ERC20/IERC20.sol@v3.1.0 // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of token...
Perform LP token migration from legacy UniswapV2 to SoneSwap. Take the current LP token address and return the new LP token address. Migrator should have full access to the caller's LP token. Return the new LP token address. XXX Migrator must have allowance access to UniswapV2 LP tokens. SoneSwap must mint EXACTLY the ...
interface IMigratorToSoneSwap { function migrate(IERC20 token) external returns (IERC20); pragma solidity 0.6.12; }
471,509
// SPDX-License-Identifier: MIT pragma solidity 0.8.1; /** * @title Access Control List * * @notice Access control smart contract provides an API to check * if specific operation is permitted globally and/or * if particular user has a permission to execute it. * * @notice It deals with two main entiti...
Determines the permission bitmask an operator can set on the target permission set Used to calculate the permission bitmask to be set when requested in `updateRole` and `updateFeatures` functions Calculated based on: 1) operator's own permission set read from userRoles[operator] 2) target permissio...
function evaluateBy( address operator, uint256 target, uint256 desired ) public view returns (uint256) { uint256 p = userRoles[operator]; target |= p & desired; target &= FULL_PRIVILEGES_MASK ^ (p & (FULL_PRIVILEGES_MASK ^ desired)); return target; }
1,070,908
pragma solidity ^0.4.24; import "./SafeMath.sol"; import "./CouponToken.sol"; import "./CouponTokenSale.sol"; contract CouponTokenCampaign { using SafeMath for uint256; address private owner; CouponToken couponToken; CouponTokenSale couponTokenSale; struct EventData { string eventName; ...
Function: activateCouponCampaign()/
function activateCouponCampaign(uint32 campaignId) external onlyOwner onlyInSalesState { require( campaignId < couponCampaignIndex && couponCampaignProgram[campaignId].activated == false && couponCampaignProgram[campaignId].killed == false); ...
1,089,645
// Copyright (C) 2020 Zerion Inc. <https://zerion.io> // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This ...
protocolAdapterName Name of the protocol adapter. return Array of protocol adapter's supported tokens./
function getSupportedTokens(bytes32 protocolAdapterName) public view returns (address[] memory) { return _protocolAdapterSupportedTokens[protocolAdapterName]; }
6,394,051
./partial_match/3/0x93aE15BC2454C138e79F3F9EB26F9743c0c25C77/sources/option.sol
Hook that is called before any transfer of tokens. This includes minting and burning. Calling conditions: - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens will be to transferred to `to`. - when `from` is zero, `amount` tokens will be minted for `to`. - when `to` is zero, `amount` of ``from``'s to...
function _beforeTokenTransfer() view internal { require(block.timestamp < expiryDate, "Option: expired, awaiting to be settled"); }
5,151,113
./full_match/1/0x9a8A1D7Eac06871f60158f127704F3910613E3c3/sources/contracts/adapters/SanTokenERC4626Adapter.sol
@inheritdoc IERC4626Upgradeable
function convertToAssets(uint256 shares) public view returns (uint256 assets) { return _convertToAssets(shares, MathUpgradeable.Rounding.Down); }
3,219,203
./full_match/1/0x9965cCd16803432C6a0842f1D5690f32E427aEDd/sources/contracts/LiveMintTokyo.sol
Returns A 2d Array Of Minted ArtistIDs/
function readArtistMintedTicketIDs(uint[] calldata ArtistIDs, uint Range) public view returns(uint[][] memory TokenIDs) { uint[][] memory _TokenIDs = new uint[][](ArtistIDs.length); uint Index; for(uint ArtistID; ArtistID < ArtistIDs.length; ArtistID++) { uint[] memor...
8,470,979
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import "./Pizza.sol"; contract PizzaV2 is Pizza { ///@dev increments the slices when called function refillSlice() external { slices += 1; } ///@dev returns the contract version function pizzaVersion() external pure returns (uint256) { retur...
returns the contract version
function pizzaVersion() external pure returns (uint256) { return 2; }
12,978,410
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; pragma abicoder v2; import "./ExchangeV2Core.sol"; import "./TransferManager.sol"; import "../royalties/IRoyaltiesProvider.sol"; contract ExchangeV2 is ExchangeV2Core, TransferManager { function __ExchangeV2_init( INftTransferProxy _transferProxy, ...
todo подумать, что будет, если с обеих сторон ethtodo нужно ли проверить from?
function transfer( LibAsset.Asset memory asset, address from, address to, bytes4 transferDirection, bytes4 transferType ) internal override { if (asset.assetType.assetClass == LibAsset.ETH_ASSET_CLASS) { require(success, "transfer failed"); ...
69,688
/** *Submitted for verification at Etherscan.io on 2021-04-23 */ // File: contracts/BondToken_and_GDOTC/util/TransferETHInterface.sol // SPDX-License-Identifier: UNLICENSED pragma solidity 0.7.1; interface TransferETHInterface { receive() external payable; event LogTransferETH(address indexed from, address...
Receive ETH, then call _addLiquidity/
function addLiquidity() external payable isSafeSupply returns (bool success) { success = _addLiquidity(msg.value); }
1,973,487
./full_match/1/0xE56a239BcF946700C6063FDb8afa015C89e30266/sources/contracts/hoxacoin.sol
Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have ...
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "Token: decreased allowance below zero"); _approve(_msgSender(), spender, currentAl...
3,165,526
pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; interface TokenInterface { function APPROVE44(address, uint256) external; //inject NONSTANDARD NAMING function TRANSFER867(address, uint) external; //inject NONSTANDARD NAMING functi...
inject NONSTANDARD NAMING
function APPROVE44(address, uint256) external;
5,365,061
pragma solidity 0.5.2; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol"; import "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol"; import "../marketprotocol/MarketCol...
get user address get user own address or DSProxy address if user have one inputAddress user address return address/ If the user has a DSProxy wallet, return that address. Else, return their wallet address
function getUserAddressOrDSProxy(address inputAddress) public view returns (address) { return addressToDSProxy[inputAddress] == address(0) ? inputAddress : addressToDSProxy[inputAddress]; }
12,752,076
./full_match/44787/0xFBBE895135AF71D948B59380876CC9709515e5cf/sources/src/diamond/facets/TokenLockFacet.sol
TODO: initLocking time must be bigger that current timestamp TODO: the restake should account for bigger TM as staked and update the smaller TM only
function restakeOrDepositAtFor( address account, uint256 amount, uint256 initLockingTm ) external { require(initLockingTm >= block.timestamp, "Unable to stake to the pass"); uint256 stake = s._balances[account]; uint256 tBalance = s.tdfToken.balanceOf(account); ...
13,257,615
// Current Solidity Version pragma solidity >=0.5.0 <0.6.0; /* * @title Imports * Import CustomToken Module from CustomToken.sol * Import Ownable Module from cannonical-weth Library * Import SafeMath Module from openzeppelin Library */ import "./tokens/CustomToken.sol"; import "canonical-weth/contracts/WETH9.sol"...
Current ReleaseTime in the CustomCrowdsale
function getReleaseTime() public view returns (uint) { return releaseTime; }
12,550,827
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.10; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; contract ArkAngels is ERC721, Ownable { bytes32 public merkleRoot = "";...
Require nonzero amount Check proper amount sent
function publicMint(uint amount) external payable mintingOpen { require(amount > 0, "Can't mint zero"); require(msg.value == amount * mintPrice, "Send proper ETH amount"); _mintWithoutValidation(msg.sender, amount, false); }
188,301
./partial_match/1/0x9DA12017d0831681DeFE454034CA5868e93dB7b6/sources/packages/contracts-bridge/contracts/BridgeRouter.sol
Approve funds remaining in the bridge router to be collected via accountant/ some tokens require setting approval to 0 before changing the approval to another value in order to enable calling this function multiple times, set approval to zero first
function approveAffectedAssets() external onlyOwner { address payable[14] memory _assets = accountant.affectedAssets(); for (uint256 i = 0; i < 14; i++) { IERC20 _asset = IERC20(_assets[i]); uint256 _balance = _asset.balanceOf(address(this)); if (_balance > 0) { ...
2,645,360
// SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity 0.8.6; pragma abicoder v2; import { StakedToken } from "./StakedToken.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { IBVault, ExitP...
Transfers an `_amount` of staked tokens from sender to this staking contract before calling `_settleStake`. Can be overridden if the tokens are held elsewhere. eg in the Balancer Pool Gauge./
function _transferAndStake( uint256 _amount, address _delegatee, bool _exitCooldown ) internal virtual { STAKED_TOKEN.safeTransferFrom(_msgSender(), address(this), _amount); _settleStake(_amount, _delegatee, _exitCooldown); }
6,142,045