file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./partial_match/1/0xa52966d88586E708B128Bc22e7A8B7900A7918AC/sources/RobotTradingIco.sol
Send tokens to Partner.
function sendTokensToPartner() onlyManager whenInitialized { require(!sentTokensToPartner); uint tokensSold = add(roundData[0].soldTokens, roundData[1].soldTokens); tokensToPartner = sub(partnerTokens,tokensSold); robottradingToken.emitTokens(accPartner, partnerTokens); sen...
3,656,069
./full_match/1/0x253d7d47d400158A067B5F8512a0F49F37b672fc/sources/contracts/registry/proxy/OwnedUpgradeabilityProxy.sol
Event to show ownership has been transferred previousOwner representing the address of the previous owner newOwner representing the address of the new owner/ This event will be emitted every time the implementation gets upgraded implementation_ representing the address of the upgraded implementation/ Tells the add...
function implementation() override(Proxy, OwnedUpgradeabilityStorage) public view returns (address) { return _implementation; }
4,871,012
./partial_match/5/0xdE4c870F36a614E44bd00f987B22F4c4D48718F3/sources/contracts/base/MetawinERC721Extensions/MetawinERC721Vault.sol
[Tx][External] Toggle the staking status of the input tokens/
function vault_toggleStaking(uint256[] calldata tokenIds) external { uint256 n = tokenIds.length; for (uint256 i = 0; i < n; ++i) { vault_toggleStaking(tokenIds[i]); } }
16,866,998
pragma solidity ^0.4.24; import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "./IVoting.sol"; /** * @title Voting * @dev Simple majority voting system that allows anyone to propose an offer for an NFT held within the Issuance shares sy...
Fire a "proposal accepted" event TODO: pay out payment type to each address in proportion to the holdings of each shareholder TODO: instead of transfer tokens back to voters, burn the tokens TODO: NOTE THAT NEITHER OF THE ABOVE WILL BE POSSIBLE FROM WITHIN THIS CONTRACT. WILL HAVE TO CALL INTO THE Issuance CONTRACT Tr...
function acceptCurrentProposal() private { emit ProposalAccepted(_currentProposal.yay, _currentProposal.nay); IERC20 paymentContract = IERC20(_currentProposal.paymentType); paymentContract.transferFrom(this, _issuance, _currentProposal.paymentAmount); delete _currentPropos...
955,013
pragma solidity ^0.5.0; import "./supports-interface.sol"; // checks if an address is a contract library Address { function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2...
transfers the ownership of a token from one address to another the caller is responsible to confirm that _to is capable of receiving tokens or else the token may be permanently lostclear approval for token
function transferFrom(address _from, address _to, uint256 _tokenId) external payable canTransfer(_tokenId) validToken(_tokenId) { address tokenOwner = idToOwner[_tokenId]; require(tokenOwner == _from); require(_to != address(0)); if (idToApproval[_tokenId] != address(0)) { ...
6,394,193
./full_match/56/0x530ee73931772634f3fD51D138f8FE9D7dF9bB79/sources/arbitrage_bot.sol
Verifica se un'operazione di arbitraggio è profittevole
function isProfitableArbitrage( address token, uint256 amountIn, uint256 pancakeFee, uint256 mdexFee, uint256 biswapFee ) internal view returns (bool) { uint256 pancakeAmountOut = IPancakeRouter02(pancakeRouterAddress) .getAmountsOut(amountIn, getPanca...
3,259,914
//SPDX-License-Identifier: MIT pragma solidity =0.7.6; pragma abicoder v2; import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol"; import {Address} from "@openzeppe...
deposit uniswap position token into a vault to increase collateral ratio _vaultId id of the vault _uniTokenId uniswap position token id/
function depositUniPositionToken(uint256 _vaultId, uint256 _uniTokenId) external notPaused nonReentrant { _checkVaultId(_vaultId); _applyFunding(); VaultLib.Vault memory cachedVault = vaults[_vaultId]; _depositUniPositionToken(cachedVault, msg.sender, _vaultId, _uniTokenId); ...
13,123,555
./partial_match/42/0x3F4F9412199D296d77B9896650B7646B08F6FDE3/sources/BotGainsProtocolStorage.sol
add user withdraw current capitalif successful remove their capital from this pool completelyupdate users
function userWithdrawCurrentCapital() public payable isUnlocked{ userWithdrawCapitalOnCycle(cycle); USER_FRAGS_ON_CYCLE[cycle][msg.sender] = 0; userExistOnCycle[cycle][msg.sender] = false; }
9,048,931
// SPDX-License-Identifier: MIT pragma solidity =0.8.10; import "../../ActionBase.sol"; import "../../../utils/TokenUtils.sol"; import "./helpers/UniV3Helper.sol"; /// @title Collects tokensOwed from a position represented by tokenId contract UniCollectV3 is ActionBase, UniV3Helper { using TokenUtils for address...
collects from tokensOwed on position, sends to recipient, up to amountMax return amount0 sent to the recipient
function _uniCollect(IUniswapV3NonfungiblePositionManager.CollectParams memory _uniData) internal returns ( uint256 amount0, uint256 amount1, bytes memory logData ) { (amount0, amount1) = positionManager.collect(_uniData); logData = abi...
975,216
pragma solidity ^0.5.16; interface IERC20 { function TOTALSUPPLY529() external view returns (uint); //inject NONSTANDARD NAMING function BALANCEOF13(address account) external vi...
inject NONSTANDARD NAMING
function SAFETRANSFERFROM836(IERC20 token, address from, address to, uint value) internal {
1,780,095
./full_match/1/0xFA5Cbd7199f9098CB464d2DDc2c3efF7F20F533A/sources/contracts/Dolls.sol
walletofOwner return tokens id owned by the given address This read function is O(totalSupply). If calling from a separate contract, be sure to test gas first. It may also degrade with extremely large collection sizes (e.g >> 10000), test for your use case./index starting @ 1
function walletOfOwner(address queryAddress) external view returns (uint256[] memory){ uint256 ownerTokenCount = balanceOf(queryAddress); uint256[] memory ownedTokenIds = new uint256[](ownerTokenCount); uint256 currentTokenId = 1; uint256 ownedTokenIndex = 0; while ( ownedTo...
9,693,295
./full_match/1/0x9C1dC986D786534c13Ec32eFA6C7A1631898d102/sources/inari1.sol
Helper function to approve this contract to spend and bridge more tokens among DeFi contracts.
function approveTokenBridge(IERC20[] calldata underlying, address[] calldata cToken) external { for (uint256 i = 0; i < underlying.length; i++) { } }
3,116,952
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IERC20 { function TOTALSUPPLY267() exte...
inject NONSTANDARD NAMING
function SAFETRANSFER627(IERC20 token, address to, uint256 value) internal {
13,085,328
// File: @openzeppelin/contracts/utils/cryptography/ECDSA.sol pragma solidity ^0.8.0; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { /** ...
This will begin The Great Naming Ceremony The Great Naming Ceremony will last approximately 5 days
function setNamingBlock(uint256 blockNumber) public onlyOwner { require(namingBlockStart == 0, "PxG: Naming ceremony has already begun"); namingBlockStart = blockNumber; namingBlockEnd = blockNumber + (6357 * 3); }
1,281,204
./full_match/1/0x625943e971AfEd73d872bcc52A439faD71Fea520/sources/contracts/diamond/BaseStorage.sol
solhint-disable-next-line no-inline-assembly
function layout() internal pure returns (Layout storage ds) { bytes32 position = STORAGE_SLOT; assembly { ds.slot := position } }
4,906,889
./partial_match/1/0x1C810A301EFEb2515a6bAB2225D362deE9cdc0c7/sources/AVEC.sol
make sure we have the requested tokens setupExchange tokens
function memberConvertAVECtoONUS(uint256 tokens) public { bytes32 _propertyUniqueID = transferingPropertyid_[msg.sender]; uint256 _propertyBalanceLedger = propertyBalanceLedger_[_propertyUniqueID][msg.sender]; uint256 _value = tokens; upda...
3,644,142
pragma solidity ^0.6.0; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.1.0/contracts/math/SafeMath.sol"; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.1.0/contracts/access/Ownable.sol"; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.1.0/contracts...
check pool exist check end time check holder
function bidPoolJoin(uint32 _id, uint256 _value) takerFee(_value) payable public { require(msg.value > 0, "check value, value must be gt 0"); require(_value <= msg.value, "check value, value must be le msg.value"); BidPool storage _pool = bidPools[_id]; require(_poo...
14,019,901
./full_match/11155111/0xe9BF8462eA32893661bA3Ab1739ED3e0e68856f8/sources/src/lending/Lender.sol
@inheritdoc ILender Checking whether the borrower has available funds for debt payment Debt wasn't repaid, we need to decrease the ratio of this borrower
function reportNegativeDebtManagement(uint256 loss, uint256 debtPayment) external override onlyBorrowers updateLastReportTime nonReentrant { require(_borrowerFreeAssets(msg.sender) >= debtPayment, "Not enough assets for payment"); if (loss > 0) { ...
3,794,549
./full_match/4/0xACb0299196d8E49eb9dd25038ff21F1e14b29f4b/sources/contracts/CoinFlip.sol
pre-deteremine the flip outcome If I guessed correctly, submit my guess If I guess incorrectly, submit the opposite
function hackFlip(bool _guess) public { uint256 blockValue = uint256(blockhash(block.number-1)); uint256 coinFlip = blockValue / FACTOR; bool side = coinFlip == 1 ? true : false; if (side == _guess) { originalContract.flip(_guess); originalContract.flip(!_guess); } }
12,291,650
./full_match/1/0x7af62458e41E2F490D2Df54A8FeDc56fFedB8c17/sources/lib/solady/src/utils/RedBlackTreeLib.sol
Returns a pointer to the largest value in the tree. If the tree is empty, the returned pointer will be empty.
function last(Tree storage tree) internal view returns (bytes32 result) { result = _end(tree, _BITPOS_RIGHT); }
3,202,734
// SPDX-License-Identifier: GPL-3.0 /// @title The Rakuten Monkey Sponsors Club auction house // LICENSE // AuctionHouse.sol is a modified version of Zora's AuctionHouse.sol: // https://github.com/ourzora/auction-house/blob/54a12ec1a6cf562e49f0a4917990474b11350a2d/contracts/AuctionHouse.sol // // AuctionHouse.sol sour...
Set the auction duration. Only callable by the owner./
function setDuration(uint256 _duration) external onlyOwner { duration = _duration; emit AuctionDurationUpdated(_duration); }
1,156,718
pragma solidity 0.7.2; // SPDX-License-Identifier: JPLv1.2-NRS Public License; Special Conditions with IVT being the Token, ItoVault the copyright holder import "./SafeMath.sol"; import "./GeneralToken.sol"; contract VaultSystem { using SafeMath for uint256; event loguint(string name, uint value); ...
Double Entry Accounting
function repayvSPY(uint _vSPYRepayE18) public { require(_vSPYRepayE18 < 10 ** 30, "Protective max bound for uint argument"); vSPYToken.ownerApprove(msg.sender, _vSPYRepayE18); vSPYDebtE18[msg.sender] = vSPYDebtE18[msg.sender].sub( _vSPYRepayE18 ); outstandingvSPYE1...
1,523,033
pragma solidity ^0.4.24; // File: openzeppelin-solidity/contracts/math/SafeMath.sol /** * @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...
/ winner gets back their full staked deposit, and dispensationPctloser's stake
function resolveChallenge(bytes32 _propID) private { ParamProposal memory prop = proposals[_propID]; Challenge storage challenge = challenges[prop.challengeID]; uint reward = challengeWinnerReward(prop.challengeID); challenge.winningTokens = voting.getTotalNumberOfTokensForWinningOption(prop.c...
1,142,517
pragma solidity 0.5.10; import "../interfaces/IBlockRewardAuRa.sol"; import "../interfaces/IERC677.sol"; import "../interfaces/IStakingAuRa.sol"; import "../interfaces/IValidatorSetAuRa.sol"; import "../upgradeability/UpgradeableOwned.sol"; import "../libs/SafeMath.sol"; /// @dev Implements staking and withdrawal lo...
Returns the max number of candidates (including validators). See the MAX_CANDIDATES constant. Needed mostly for unit tests.
function _getMaxCandidates() internal pure returns(uint256) { return MAX_CANDIDATES; }
978,196
/** *Submitted for verification at Etherscan.io on 2021-12-23 */ // Sources flattened with hardhat v2.6.8 https://hardhat.org // SPDX-License-Identifier: MIT // File @openzeppelin/contracts/utils/[email protected] pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context,...
Internal natural logarithm (ln(a)) with signed 18 decimal fixed point argument./ Since ln(a^k) = k ln(a), we can compute ln(a) as ln(a) = ln((1/a)^(-1)) = - ln((1/a)). If a is less than one, 1/a will be greater than one, and this if statement will not be entered in the recursive call. Fixed point division requires mul...
function _ln(int256 a) private pure returns (int256) { if (a < ONE_18) { return (-_ln((ONE_18 * ONE_18) / a)); } int256 sum = 0; if (a >= a0 * ONE_18) { sum += x0; } if (a >= a1 * ONE_18) { sum += x1; } a *= 100; if (a >= a2) { a = (a * ONE_20) / a2; ...
2,108,222
/* ⚠⚠⚠ WARNING WARNING WARNING ⚠⚠⚠ This is a TARGET contract - DO NOT CONNECT TO IT DIRECTLY IN YOUR CONTRACTS or DAPPS! This contract has an associated PROXY that MUST be used for all integrations - this TARGET will be REPLACED in an upcoming Synthetix release! The proxy can be found by looking up the PROXY propert...
The resolver must call this function whenver it updates its state Note: can only be invoked once the resolver has all the targets needed added
function rebuildCache() public { bytes32[] memory requiredAddresses = resolverAddressesRequired(); for (uint i = 0; i < requiredAddresses.length; i++) { bytes32 name = requiredAddresses[i]; address destination = resolver.requireAndGetAddress( name, ...
84,640
./partial_match/1/0xD0C6e59B50C32530C627107F50Acc71958C4341F/sources/contracts/loans/direct/loanTypes/DirectLoanFixedOffer.sol
This function is called by the borrower when accepting a lender's offer to begin a loan. _loanTerms - The main Loan Terms struct. This data is saved upon loan creation on loanIdToLoan. _loanExtras - The main Loan Terms struct. This data is saved upon loan creation on loanIdToLoanExtras. _offer - The offer made by th...
function _acceptOffer( LoanTerms memory _loanTerms, LoanExtras memory _loanExtras, Offer memory _offer, Signature memory _signature ) internal virtual returns (uint32) { if (_nonceHasBeenUsedForUser[_signature.signer][_signature.nonce]) { revert InvalidNonce()...
2,861,862
// SPDX-License-Identifier: MIT pragma solidity 0.8.0; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/contracts...
Deposit the staked token into liquidity gauge. _amount Amount of staked token to deposit./ -1 means deposit all
function deposit(uint256 _amount) external nonReentrant { require(_amount > 0, "zero amount"); if (_amount == uint256(int256(-1))) { _amount = IERC20Upgradeable(token).balanceOf(msg.sender); } _checkpoint(msg.sender); _checkpointRewards(msg.sender); uint...
6,413,580
/** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceO...
See {IERC721-ownerOf}./
function ownerOf(uint256 tokenId) external view returns (address) { return tokenId == _tokenId ? _owner : address(0); }
14,702,394
./partial_match/1/0xeAb0992B3D82B136E0Eb3df5bb0d80B62A300cB2/sources/Giraffles.sol
Gets current NFT Price/
function getNFTPrice() public view returns (uint256) { return price; }
3,694,096
contract IOwnable { function getOwner() public view returns (address); function transferOwnership(address _newOwner) public returns (bool); } contract IERC20 { function totalSupply() public view returns (uint256); function balanceOf(address owner) public view returns (uint256); function tra...
return The forking market for the associated universe if one exists/
function getForkingMarket() public view returns (IMarket) { return universe.getForkingMarket(); }
1,040,710
./full_match/5/0x88E6A8bA858c86D4c395ed44797fA6Abf3a99fa7/sources/src/TwoSlots.sol
Used to update an existing buy type order. _contestID ID of contest where order need an update. _orderID ID of order to update. _newQuantityToBuy Defines the new quantity of option to buy. _newPricePerOption Defines the new price to be offered for each token.
function updateBuyOrder(uint256 _contestID, uint256 _orderID, uint256 _newQuantityToBuy, uint256 _newPricePerOption) external whenNotPaused isContestSecondaryMarket(_contestID) isOwnerOfOrder(_contestID, _orderID) isBuyOrderUpdateRequestValid(_contestID, _orderID, _newQuantit...
11,622,831
pragma solidity ^0.5.16; import "./ERC721.sol"; import "./ITitleEscrow.sol"; import "./ITitleEscrowCreator.sol"; contract HasNamedBeneficiary is Context { address public beneficiary; constructor(address _beneficiary) internal { beneficiary = _beneficiary; } modifier onlyBeneficiary() { require(isBen...
Buying back the token. This function is called by the importer. After payment, the importer will immediately become the new holder of the token.
function buyBackToken() public payable isHoldingToken { require(buyBackPrice > 0, "TitleEscrow buyBackToken: buyBackPrice was not set, thus you cannot buy"); require( msg.value >= buyBackPrice, "TitleEscrow buyBackToken: have not received enough funds to buy back the token" ); require(msg....
13,103,358
./full_match/80001/0xfDCd9058C3C52f2E4ED718Aeb18966a0ca246C86/sources/contracts/ERC721NESDrop.sol
perform safe mint and stake/
function _safemintAndStake(address to, uint256 quantity) internal { uint256 startTokenId = _currentIndex; for (uint256 i = 0; i < quantity; i++) { startTokenId++; tokenToIsStaked[startTokenId] = true; } _safeMint(to, quantity, ""); }
838,285
pragma solidity ^0.4.21; // File: contracts/Oracle/DSAuth.sol contract DSAuthority { function canCall( address src, address dst, bytes4 sig ) public view returns (bool); } contract DSAuthEvents { event LogSetAuthority (address indexed authority); event LogSetOwner (address indexed owner);...
gives the owner the possibility to put the Interface into an emergencyMode, which will output always a price of 600 USD. This gives everyone time to set up a new pricefeed.
function raiseEmergency(bool _emergencyMode) public onlyOwner() { emergencyMode = _emergencyMode; }
1,725,036
./partial_match/4/0xC3FeaA0309Fd9C86d2aD7D7220D91c37d474C960/sources/VotingContract.sol
Добавление нового голосвания/
function addBallot(uint start, uint end, string[] memory names) public { require( msg.sender == administrator, "Only adminestrator can add ballot." ); Ballot memory newBallot; newBallot.startTime = start; newBallot.endTime = end; newBa...
8,657,555
pragma solidity ^0.4.25; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FlightSuretyData { using SafeMath for uint256; using SafeMath for uint32; /********************************************************************************************/ /* ...
Check if it is an airline
function isAirline ( address airlineAddress ) external view returns(bool) { bool status = false; for(uint i=0; i < airlinesReg...
12,737,959
./partial_match/1/0xb9Fb1A6fa14a8296b1DE7a2653b1fE6c9DFC1dcB/sources/Market.sol
_payoutDistributionHash The payout distribution hash for a Dispute Crowdsourcer contract for this round of disputing return The associated Dispute Crowdsourcer contract for this round of disputing/
function getCrowdsourcer(bytes32 _payoutDistributionHash) public view returns (IDisputeCrowdsourcer) { IDisputeCrowdsourcer _crowdsourcer = IDisputeCrowdsourcer(crowdsourcers[_payoutDistributionHash]); if (_crowdsourcer != IDisputeCrowdsourcer(0) && _crowdsourcer.getCrowdsourcerGeneration() == crowd...
9,130,548
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, ...
Function for a loot bag holder to mint genesis mana Check that the loot token ID is in range Check that the inventory ID is in rangeDecrement by one to match arrays Check that the msgSender owns the token that is being claimed Check that Gensis Mana has not already been claimed
function claimByLootId(uint256 lootTokenId, uint8 inventoryId) external nonReentrant { require( lootTokenId >= 1 && lootTokenId <= 8000, "LOOT_TOKEN_ID_OUT_OF_RANGE" ); require( inventoryId >= 1 && inventoryId <= 8, "INVENTORY_ID_OUT_O...
1,323,809
./partial_match/56/0xEd64Eb8Aee82A0dBb616400D930e57F2D3d21E51/sources/SOTAExchange.sol
get path for exchange ETH->BNB->USDT via Uniswap/
function getPathFromTokenToUSDT(address token) private view returns (address[] memory) { address[] memory path = new address[](3); if (token == bnb || token == busd) { path[0] = token; path[1] = usdt; path[0] = token; path[1] = bnb; path[2]...
11,177,658
./partial_match/1/0xFa9209888d186068319Af23Fbf1cD6361e003400/sources/STI.sol
See {BEP20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. NOTE: Does not update the allowance if the current allowance is the maximum `uint256`. Requirements: - `sender` and `recipient` cannot be the zero address. - `...
function transferFrom( address sender, address recipient, uint256 amount ) public override returns (bool) { uint256 currentAllowance = _allowances[sender][_msgSender()]; if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "BEP20: t...
2,667,861
// 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...
Removes a list of primitives from the feed _primitives The primitives to remove
function removePrimitives(address[] calldata _primitives) external onlyDispatcherOwner { require(_primitives.length > 0, "removePrimitives: _primitives cannot be empty"); for (uint256 i; i < _primitives.length; i++) { require( primitiveToAggregatorInfo[_primitives[i]].ag...
1,697,536
/** *Submitted for verification at Etherscan.io on 2021-03-11 */ //SPDX-License-Identifier: None // File contracts/interfaces/IERC3156FlashBorrower.sol pragma solidity ^0.8.0; interface IERC3156FlashBorrower { /** * @dev Receive a flash loan. * @param initiator The initiator of the loan. * @param to...
make sure _borrower is liquidatable scope to avoid stack too deep error
function liquidate( address _flashLoanToken, address _cErc20, address _borrower, uint256 _amount, address _cTokenCollateral, IRouter _dolaRouter, IRouter _exitRouter, uint256 _minProfit, uint256 _deadline ) external { require( ...
7,620,957
//Address: 0x904249766b2ccf6795d7b34441cc0bcae5cb7640 //Contract name: NectarController //Balance: 0 Ether //Verification Date: 2/13/2018 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^0.4.18; /* Copyright 2016, Jordi Baylina This program is free software: you can redistribute it and/or modify ...
getFeeToTokenConversion - Controller could be changed in the future to update this function _contributed - The value of fees contributed during the window FYI this assumes a fixed maker trading fee of 0.1% In the case where different fee schedules were used for maker discounts i.e. 0.025% - 4 times the number of token...
function getFeeToTokenConversion(uint256 _contributed) public constant returns (uint256) { uint calculationBlock = windowFinalBlock[currentWindow()-1]; uint256 previousSupply = tokenContract.totalSupplyAt(calculationBlock); uint256 initialSupply = tokenContract.totalSupplyAt(windowFinalBlo...
6,429,986
pragma solidity 0.7.4; pragma experimental ABIEncoderV2; import "../utils/Ownable.sol"; import "@0xsequence/erc-1155/contracts/tokens/ERC1155PackedBalance/ERC1155MintBurnPackedBalance.sol"; import "@0xsequence/erc-1155/contracts/tokens/ERC1155/ERC1155Metadata.sol"; import "@0xsequence/erc-1155/contracts/tokens/ERC298...
Will forever prevent new mint permissions for provided ids THIS ACTION IS IRREVERSIBLE, USE WITH CAUTION In order to forever restrict minting of certain ids to a set of factories, one first needs to call `addMintPermission()` for the corresponding factory and the corresponding ids, then call this method to ...
function lockRangeMintPermissions(AssetRange memory _range) public onlyOwner() { lockedRanges.push(_range); emit RangeLocked(_range); } |__________________________________*/
1,764,893
./full_match/1/0x9AEd78FC8daF454afD8cF50466c22ccDf545865b/sources/contracts/ExtraRewardStash.sol
Returns the length of the tokenList
function tokenCount() external view returns (uint256) { return tokenList.length; }
3,148,134
pragma solidity ^0.5.8; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "./SortedFractionMedianList.sol"; import "./interfaces/ISortedOracles.sol"; import "../common/Initializable.sol"; /** * @title Maintains a sorted list of oracle ...
Returns the key for the lesser element in the timestamp list. token The address of the token for which the Celo Gold exchange rate is being reported. oracle The address of the oracle to sort into the timestamp list. return The key of the lesser element in the list./
function getLesserTimestampKey(address token, address oracle) private view returns(address) { address head = timestamps[token].head; if (head == oracle) { return timestamps[token].elements[head].lesserKey; return head; } }
916,634
pragma solidity ^0.6.0; ...
inject NONSTANDARD NAMING
function LOG40(string memory p0, address p1, string memory p2, address p3) internal view {
1,019,079
// SPDX-License-Identifier: GPL-3.0 /** * @title Complete the Punks: Project * @dev Per-project contract for managing Bodies + Legs * @author earlybail.eth | Cranky Brain Labs * @notice #GetBodied #LegsFuknGooo */ /* ;╟██▓▒ :╟██▓▒ ,φ▒╣╬╬╩╩Γ ╙╩╬╬╬▓▒░ ...
Draw token ID. Generate an index. Mod. If we haven't already drawn this index, use it directly as tokenId. Otherwise, pull the tokenId we cached at this index last time. Cache this index with the tail of remainingTokenCount. Decrement remaining tokens. Return with optional start offset.
function drawTokenId () private returns (uint256) { uint256 num = uint256( keccak256( abi.encode( _msgSender(), name(), symbol(), blockhash(block.number - 1), block.number, ...
13,613,551
./full_match/80001/0xf093EE3b51B4485692E59f736752aB573d8c6126/sources/contracts/IndradexMultiExternalVault.sol
Set the external balance only for the specified token./
function setTokenExternalBalance(address token, uint256 newExternalBalance) external onlyOwner onlyPresentToken(token) { tokenInfo[token].externalBalance = newExternalBalance; }
9,508,065
./partial_match/1/0x3C09431f869ae10d6cF4Fb91e87a37D757a41571/sources/UtilityETH.sol
set income _income Income address/
function setIncomeToken(IERC20 _income) external onlyOwner { income = _income; }
9,368,363
./full_match/80001/0x07500150a67Cd261e248fA81DDE2dc140659AdF4/sources/contracts/market/template/MarketTieredLeverage.sol
Allows users to redeem float pool token assets for a market. To prevent front-running these redeems are executed on the next price update from the oracle. amount Amount of payment tokens in that token's lowest denominationfor which to redeem pool token assets at next price.
function redeemFloatPool(uint112 amount) external { _redeem(amount, msg.sender, IMarketCommon.PoolType.SHORT, 0); } ╚═════════════════════╝*/
9,434,554
./partial_match/97/0x20c9b863Bb37013B2e851B7812976237cc3412C3/sources/MasterChef.sol
Safe wst transfer function, just in case if rounding error causes pool to not have enough WSTs.
function safeWstTransfer(address _to, uint256 _amount) internal { uint256 wstBal = wst.balanceOf(address(this)); if (_amount > wstBal) { wst.transfer(_to, wstBal); wst.transfer(_to, _amount); } }
11,425,127
// File: @openzeppelin/contracts/math/SafeMath.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.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...
Finalizes the initialization and revokes the initializationAdmin role
function initializationComplete() external onlyInitializationAdmin { _initializationAdmin = address(0); emit InitializationComplete(); }
173,611
pragma solidity ^0.4.4; contract ProofOfExistence { function ProofOfExistence() { // constructor } mapping (bytes32 => bool) proofs; // store a proof of existence in the contract state function storeProof(bytes32 proof) { proofs[proof] = true; } // calculate and store the proof for a document ...
store a proof of existence in the contract state
function storeProof(bytes32 proof) { proofs[proof] = true; }
910,518
/** *Submitted for verification at Etherscan.io on 2022-04-15 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external...
The default value for the NFT recipient is the highest bidder/
{ address nftRecipient = nftContractAuctions[_nftContractAddress][ _tokenId ].nftRecipient; function _resetBids(address _nftContractAddress, uint256 _tokenId) internal } function _getNftRecipient(address _nftContractAddress, uint256 _tokenId) internal ...
10,989,563
./full_match/4/0x5780cB0DB5637956c16CB6C7be2642e7fE1D2e40/sources/numbers_0303/numbers-0303.sol
require( _msgSender() == owner );
function mint(string memory _uri) public payable returns(bool) { require(nftid < 100); require(msg.value == getPrice() ); if(getIsUsedMetadata(_uri)) { return false; } _safeMint( _msgSender() , nftid); currentURI = _uri; _setTokenURI( nftid...
12,347,257
/** *Submitted for verification at BscScan.com on 2022-03-08 */ pragma solidity ^0.6.12; // SPDX-License-Identifier: Unlicensed interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address reci...
SPDX-License-Identifier: Unlicensed
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external vi...
14,033,294
./partial_match/1/0x702ecF93156962e9ffE53FeaD114Dbd54209B796/sources/ERC1155LazyPayableClaim.sol
solhint-disable-next-line
function _transferFunds(address erc20, uint256 cost, address payable recipient, uint16 mintCount, bool merkle) internal { uint256 payableCost; if (erc20 != ADDRESS_ZERO) { require(IERC20(erc20).transferFrom(msg.sender, recipient, cost*mintCount), "Insufficient funds"); payabl...
3,681,584
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./interfaces/PLBTStaking/IPLBTStaking.sol"; import "./interfaces/DAO/IDAO.sol"; import "./sushiswap/IUniswapV2Router02.sol"; import "./gysr...
@inheritdoc IPool/
function usage() external view override returns (uint256) { return _reward.usage(); }
558,629
./full_match/1/0xE6cC6bf6c404fCe83aDdcC0c3dEB58b669fEE70E/sources/localhost/exchange/wrappers/UniswapWrapper.sol
Return a rate for which we can buy an amount of tokens _srcAddr From token _destAddr To token _destAmount To amount return uint Rate
function getBuyRate(address _srcAddr, address _destAddr, uint _destAmount) public view returns (uint) { if(_srcAddr == WETH_ADDRESS) { address uniswapTokenAddress = UniswapFactoryInterface(UNISWAP_FACTORY).getExchange(_destAddr); return wdiv(UniswapExchangeInterface(uniswapTokenAddre...
16,467,094
/* This file is part of The Colony Network. The Colony Network 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. The Colony Netwo...
Initialise the task update reviewers Initialise the root domain
function initialiseColony(address _address) public { require(colonyNetworkAddress == 0x0); colonyNetworkAddress = _address; potCount = 1; domainCount += 1; IColonyNetwork colonyNetwork = IColonyNetwork(colonyNetworkAddress); uint256 rootLocalSkill = colonyNetwork.getSkillCount(); domains...
14,048,656
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.7.0 <0.9.0; import "./Owner.sol"; contract TransferMoneyToContract is Owner{ address payable myAddress = payable(address (this)); uint gasFee = 0.0002 ether; //When money is sent from the DApp, tell me via an event event MoneySentToAlex(ad...
So as the owner of this contracti want to be able to externally change the gas fee of this contrcat when i wantthat why i inherited Ownerbut because changing a global variable will always need gas fee, am contemplating making gas fee static or finding a better way to make it better!
function changeFee (uint32 newFee) external isOwner { gasFee = newFee * 1 ether; }
6,354,098
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; contract MathLibrary { //=== add two floating points. Input and output are all unsigned integers function addFloat(string memory _str1, string memory _str2) public pure returns ( uint256 wp, uint256 dp, ...
=== Separates decimal number (string) to whole number (uint) and decimal (uint) parts
function uintToString(uint256 _i) private pure returns (string memory str) { if (_i == 0) return "0"; uint256 j = _i; uint256 length; length = lengthOfUint(j); bytes memory bstr = new bytes(length); uint256 k = length; j = _i; while (j != 0) { ...
1,805,414
pragma solidity 0.4.18; /** * @title Multisignature wallet * @dev Allows multiple parties to agree on transactions before execution * @author Stefan George <stefan.george@consensys.net> * @author Jakub Stefanski (https://github.com/jstefanski) */ contract MultiSigWallet { uint256 constant public ...
Replace the owner with a new owner Transaction has to be sent by wallet owner The address of owner to be replaced newOwner The address of new owner/
function replaceOwner(address owner, address newOwner) public onlyWallet onlyOwnerExists(owner) onlyOwnerDoesNotExist(newOwner) { for (uint256 i = 0; i < owners.length; i++) { if (owners[i] == owner) { owners[i] = newOwner; brea...
13,015,742
pragma solidity ^0.8.10; // SPDX-License-Identifier: MIT import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract SimpleToken is ERC20 { constructor(string memory name,string memory symbol,uint256 initialSupply) public ERC20(name, symbol) { ...
user must enter KYC info to engage with contract
function KYC()public OnlyDebtor {}
12,813,680
./full_match/43114/0x39FeB4B69C97608c985919CEB4a77eAe45bD86aa/sources/contracts/testSwap.sol
amount of tokens we are sending inthe minimum amount of tokens we want out of the tradelist of token addresses we are going to trade in. this is necessary to calculate amountsthis is the address we are going to send the output tokens tothe last time that the trade is valid for
interface IPangolinRouter { function WAVAX() external pure returns (address); function getAmountsOut(uint256 amountIn, address[] memory path) external view returns (uint256[] memory amounts); function swapExactTokensForTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata ...
4,559,129
pragma solidity ^0.4.24; import "./NFTokenMetadata.sol"; contract CustomToken is NFTokenMetadata { address public owner; constructor(string _name, string _symbol) public { owner = msg.sender; nftName = _name; nftSymbol = _symbol; } // owner can mint arbitrary tokens function mint(address _own...
owner can mint arbitrary tokens
function mint(address _owner, uint256 _id, string _uri) external { require(msg.sender == owner); super._mint(_owner, _id); super._setTokenUri(_id, _uri); }
1,006,954
./partial_match/11155111/0x5c156dBdAcFe756D1c28f9DA4d9927f5fbdaA92e/sources/contracts/GachaNFT.sol
Filter offers based on maxPrice
function selectRandomNFT(uint256 maxPrice) external view returns (uint256) { require(availableTokenIds.length() > 0, "No NFTs available"); uint256[] memory filteredOffers = new uint256[]( availableTokenIds.length() ); uint256 count = 0; for (uint256 i = 0; i < av...
3,535,740
// File: contracts/ERC721/ERC721ReceiverDraft.sol pragma solidity ^0.5.10; /// @title ERC721ReceiverDraft /// @dev Interface for any contract that wants to support safeTransfers from /// ERC721 asset contracts. /// @dev Note: this is the interface defined from /// https://github.com/ethereum/EIPs/commit/2bddd126d...
The shared initialization code used to setup the contract state regardless of whether or not the clone pattern is being used. _authorizedAddress the initial authorized address, must not be zero! _cosigner the initial cosigning address for `_authorizedAddress`, can be equal to `_authorizedAddress` _recoveryAddress t...
function init(address _authorizedAddress, uint256 _cosigner, address _recoveryAddress) public onlyOnce { require(_authorizedAddress != _recoveryAddress, "Do not use the recovery address as an authorized address."); require(address(_cosigner) != _recoveryAddress, "Do not use the recovery address as a...
93,698
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; interface IERC20 { function transfer(address recipient, uint256 amount) external returns (bool); } interface IStrategy { function owner() external view returns (address); function renounceOwnership() external; function transferOwnership(address n...
Remove from list of allowed depositors _strategy address depositor address/
function removeDepositor(address _strategy, address depositor) external onlyManager { IStrategy(_strategy).removeDepositor(depositor); emit RemoveDepositor(_strategy, depositor); }
6,461,580
./partial_match/1/0x90c711867Db88f2F3ee413bEa5e37c0B30da50E7/sources/DumbledoreJongUnKnuckles69Neko.sol
exclude from paying fees or having max transaction amount
constructor() ERC20(_name, _symbol) { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_uniswap...
9,153,101
./full_match/421613/0x45BC1632c9d4b3F9465A1100C7F4F3c6Cf36CDc0/sources/src/FlatSmolBrain.sol
Use this function to get free erc721 token /
function _beforeTokenTransfer( address from, address to, uint256 tokenId function _afterTokenTransfer( address from, address to, uint256 tokenId } pragma solidity ^0.8.13; function freemint() external returns (uint256) { _mint(msg.sender, nftId); ...
11,578,721
./full_match/42/0xB970fD75b24eEB1aFa1ee7A18cadc311a5828980/sources/uniswap-solidity-example/flatten/Flattened.sol
convert to Weirequire(DAI.transferFrom(msg.sender, address(this), amountIn), 'transferFrom failed.');emit GetDestAmount(amounts[1]);
function uniswapSwap(uint256 daiAmount) public payable { uint256 amountIn = daiAmount; address kovanDAI = address(0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa); IERC20 DAI= IERC20(kovanDAI); address uniswapRouterAddress = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; IUn...
9,565,834
./full_match/4/0x2ca60d89144D4cdf85dA87af4FE12aBF9265F28C/sources/contracts/MyERC721Token.sol
Unpauses all token transfers. See {ERC721Pausable} and {Pausable-_unpause}. Requirements: - the caller must have the `PAUSER_ROLE`./
function unpause() public virtual { require(ownerAddress == _msgSender(), "Must be owner"); _unpause(); }
12,390,889
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/ut...
Mint a TNFP token for a given NFT
function mint( string memory tokenURI, address nftAddress, uint256 nftTokenId, uint256 amount, uint productType ) public onlyNftOwner(msg.sender, nftAddress, nftTokenId) returns (uint256) { return _finaliseMint( ...
9,999,769
./partial_match/83/0x7473a3E6f3d7A4F33F59345E971D2d04d1fe299F/sources/Bridge.sol
Encode varint sint32. n Number return Marshaled bytes https:developers.google.com/protocol-buffers/docs/encodingsigned_integers
function encode_sint32(int32 n) internal pure returns (bytes memory) { uint32 mask = 0; if (n < 0) { mask -= 1; } uint32 zigzag_val = (uint32(n) << 1) ^ mask; return encode_varint(zigzag_val); }
8,828,729
// File: openzeppelin-solidity/contracts/utils/math/SafeMath.sol // OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wra...
Used to reserve capsules for owner once called
function _mintSingleCapsule() private { uint newTokenID = supply.current(); _safeMint(msg.sender, newTokenID); supply.increment(); }
13,780,038
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; /* Provides counters that can only be incremented, decremented, or reset. - Example uses: to track the number of elements in a mapping, issuing ERC721 ids, or counting request ids. - Include with 'using Counters for Counters.Counter;' ...
Decrements (decreases) counter by 1.
function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } }
12,844,712
./full_match/1/0x07B3DD2B07613eF877cF6392a971D00E36Fe2Ee2/sources/contracts/ForgeV1.sol
require(userbalance on dynaset) for all tokens execpt the redeem token Swap the tokens and send them to the user address if the tokenOut == redeemToken the funds will be transfered outsede this for loop
function redeem( uint256 forgeId, uint256 amount, address redeemToken, uint256 minimumAmountOut ) public nonReentrant { ForgeInfo memory forge = forgeInfo[forgeId]; require(forge.withdrawEnabled, "ERR_WITHDRAW_DISABLED"); UserInfo storage user = userInfo[...
16,609,184
// File: @openzeppelin/contracts/utils/Strings.sol // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal...
whitelisted & mint < 2
function mintPresale(uint numberOfTokens) public payable { require(PRESALE_ACTIVE, "Pre-sale must be active to mint"); if( presaleWhitelist[msg.sender] && presaleMint[msg.sender] < 2 ){ require(presaleMinted+numberOfTokens <= PRESALE_LIMIT, "Purchase would exceed max supply of tokens"); ...
10,435,715
./partial_match/1/0x664Bb90E1B75Bb555e09006284664C4ee379B982/sources/BFYC.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("Bored Frog Yacht Club", "BFYC") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswap...
4,258,120
// SPDX-License-Identifier: MIT pragma solidity ^0.7.5; import "../interfaces/IBondDepository.sol"; import "../interfaces/IERC721.sol"; import "../interfaces/INFTXVault.sol"; import "../interfaces/INFTXVaultFactory.sol"; import "../interfaces/zaps/IMintAndBond.sol"; import "../libraries/ReentrancyGuard.sol"; import "...
the index of the note is the next in the user's array the new note is pushed to the user's array
function _addToTimelock(address _vault, uint256 _remaining, address _user) internal returns (uint256 index_) { uint48 expiry = uint48(block.timestamp) + timelock; index_ = notes[_user][_vault].length; notes[_user][_vault].push( Note({ amount: _remaining, matured: expiry, va...
5,747,041
/** *Submitted for verification at Etherscan.io on 2021-02-02 */ // File: @openzeppelin/contracts/math/SafeMath.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overf...
returns a protected liquidity from the store _id protected liquidity id _provider authorized provider return protected liquidity/
function protectedLiquidity(uint256 _id, address _provider) internal view returns (ProtectedLiquidity memory) { ProtectedLiquidity memory liquidity = protectedLiquidity(_id); require(liquidity.provider == _provider, "ERR_ACCESS_DENIED"); return liquidity; }
2,294,305
pragma solidity 0.5.10; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; /** * @title Commit-Reveal Voting logic for use/adaptation in commit-reveal voting contracts * @author TruSet * @dev The functions that change state are all internal, so to make use of this logic * this contract must be subclasse...
Closes the reveal period, or reverts if it is not currently open _pollID Bytes32 identifier associated with target poll/
function _haltRevealPeriod(bytes32 _pollID) internal { require(revealPeriodActive(_pollID), "Reveal period must be active"); pollMap[_pollID].revealsHaltedAt = block.timestamp; emit RevealPeriodHalted(_pollID, msg.sender, block.timestamp); }
1,798,973
./full_match/1/0xA3C66393049fAB4830C330Dfe658f94A4de0A122/sources/contracts/Inscription.sol
Returns the URL of the inscription./
function inscriptionURL(uint256 inscriptionId) public view virtual override returns (string memory) { return ""; }
2,994,219
./partial_match/1/0x7D1f2DC0876776d12F7Aee6c18f16b41C175744D/sources/HARVEY.sol
Update token fees (max set to initial fee)/
function updateFees( uint256 fundingFee, uint256 liquidityFee, uint256 burnFee ) external teamOROwner { require(fundingFee.add(liquidityFee).add(burnFee) <= 10); _fundingFee = fundingFee; _liquidityFee = liquidityFee; _burnFee = burnFee; totalFees ...
16,040,496
pragma solidity ^0.4.20; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } funct...
Decrease the amount of tokens that an owner allowed to a spender. approve should be called when allowed[_spender] == 0. To decrement allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO Token.sol _spender The address which will spend the funds. ...
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(ms...
5,832,637
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "@openzeppelin/contracts/interfaces/IERC2981.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol"; import "@openz...
Get swap details _itemId Swap id/
function getSwap(bytes32 _itemId) public view returns(Swap memory) { Swap storage item = _swaps[_itemId]; return item; }
7,212,248
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/interfaces/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "./TimeLockedS...
Admin-only to force unstake a user's tokens. _user The user to force withdraw _amount The amount to force withdraw
function forceUnstake(address _user, uint256 _amount) external onlyOwner { tls.forceUnstake(_user, _amount); }
5,800,441
./full_match/5/0x1eF1F851689b6494f4eE6563c1979B5b018be51d/sources/data/source/raiden/TokenNetwork.sol
Returns the channel specific data. channel_identifier Identifier for the channel on which this operation takes place participant1 Address of a channel participant participant2 Address of the other channel participant return Channel settle_block_number and state The contract cannot really distinguish Settled and Rem...
function getChannelInfo( uint256 channel_identifier, address participant1, address participant2 ) external view returns (uint256, ChannelState) { bytes32 unlock_key1; bytes32 unlock_key2; Channel storage channel = channels[channel_iden...
1,868,275
./partial_match/1/0x2F1d72761b120aA1a7A88b2B662F7E4C63F20C76/sources/@violetprotocol/erc721extendable/contracts/extensions/base/receiver/IOnReceiveLogic.sol
see {IExtension-getInterface}/
function getInterface() public virtual override returns (Interface[] memory interfaces) { interfaces = new Interface[](1); bytes4[] memory functions = new bytes4[](1); functions[0] = IOnReceiveLogic._checkOnERC721Received.selector; interfaces[0] = Interface(type(IOnReceiveLogic).in...
15,623,862
/** *Submitted for verification at Etherscan.io on 2022-02-22 */ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (byt...
See {IERC721Metadata-tokenURI}./
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), 'ERC721Metadata: URI query for nonexistent token'); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())...
19,424
// SPDX-License-Identifier: MIT pragma solidity ^0.6.8; import '@openzeppelin/contracts/GSN/Context.sol'; import '@openzeppelin/contracts/access/AccessControl.sol'; import './StakableTokenWrapper.sol'; import '../ERC1155/CryptoKombatCollection.sol'; contract LpPool is Context, StakableTokenWrapper, AccessControl { ...
See {IERC1155-safeTransferFrom}./
function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) public virtual override { require(to != address(0), 'ERC1155: transfer to the zero address'); require( from == _msgSender() || isApprovedForAll...
197,692
./partial_match/1/0x6637f59689C70eBCb0F01EC2D0b8D0567aD6171B/sources/contracts/OSM/SetPackable.sol
Directly sets the extra data for the ownership data `index`./ Cast `extraData` with assembly to avoid redundant masking.
function _setExtraDataAt(PackableData storage self, uint256 index, uint24 extraData) public { uint256 packed = self._packedOwnerships[index]; if (packed == 0) revert OwnershipNotInitializedForExtraData(); uint256 extraDataCasted; assembly { extraDataCasted := extraData ...
15,589,638
./full_match/1/0x7af62458e41E2F490D2Df54A8FeDc56fFedB8c17/sources/lib/solady/src/utils/SafeTransferLib.sol
Sends all of ERC20 `token` from `from` to `to`. Reverts upon failure. The `from` account must have at least `amount` approved for the current contract to manage. @solidity memory-safe-assembly Store the function selector of `TransferFromFailed()`. Revert with (offset, size). Store the function selector of `TransferFrom...
function safeTransferAllFrom(address token, address from, address to) internal returns (uint256 amount) { assembly { if iszero( staticcall(gas(), token, 0x1c, 0x24, 0x60, 0x20) ) ) { mstore(0x00, 0x7939f424) ...
3,203,078
pragma solidity ^0.4.19; import "./RLP.sol"; import "./MinHeapLib.sol"; import "./ArrayLib.sol"; contract PlasmaChainManager { using ArrayLib for uint256[]; using RLP for bytes; using RLP for RLP.RLPItem; using RLP for RLP.Iterator; using MinHeapLib for MinHeapLib.Heap; bytes PersonalMessagePr...
Append the new header.
function submitBlockHeader(bytes header) public returns (bool success) { require(header.length == blockHeaderLength); bytes32 blockNumber; bytes32 previousHash; bytes32 merkleRoot; bytes32 sigR; bytes32 sigS; bytes1 sigV; assembly { let da...
882,635
./full_match/137/0xABBB4d0074C0361fBf7e07FD3d4d4e9cCCB9128f/sources/contracts/libraries/LimitOrderLibrary.sol
Sets the open conditions for a LimitOrder. _order The limit order. openConditionsMap The mapping of order IDs to open conditions. openConditions The array of open conditions. primexDNS The instance of the Primex DNS contract./
function setOpenConditions( LimitOrderLibrary.LimitOrder memory _order, mapping(uint256 => Condition[]) storage openConditionsMap, Condition[] memory openConditions, IPrimexDNS primexDNS ) public { _require(hasNoConditionManagerTypeDuplicates(openConditions), Errors.SHOUL...
4,668,643
./full_match/3/0x403E360BC3A7d94B0B4D8c3435C00789c5D42Aed/sources/browser/Lottery1.sol
Show who won the bet. YOUR CODE HERE Ensure that the betting has concluded before this function is called. If so, return the address of the selected winner.
function showWinner() external view returns(address) { require(curr_bets == NUM_BETS); return winner; }
14,251,167
pragma solidity ^0.8.0; pragma experimental ABIEncoderV2; //SPDX-License-Identifier: MIT import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/access...
sets geojson metadata for all plots. Can only be called by the owner of the smart contract. The uri's metadata must contain a geojson object with the "features" key changed to "plots". The "plots" value should be an array of geojson polygons. uri The uri of the plot metadata/
function setPlotsMetadata(string calldata uri) external onlyOwner { plotsMetadataUri = uri; emit PlotsMetadataUpdated(uri); }
15,842,383