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/0xFB15127f6464fcBB82b05Dc4b772283236C65167/sources/LexSecurityToken.sol
prev. withdrawableDividendOf View the amount of funds that an address can withdraw. _owner The address of a token holder. return The amount funds that `_owner` can withdraw./
function withdrawableFundsOf(address _owner) public view returns(uint256) { return accumulativeFundsOf(_owner).sub(withdrawnFunds[_owner]); }
3,647,131
./full_match/43113/0x79D0b125CEA315aAB0Bb1BC2322287D3EBB88E47/sources/home/pedro/Documents/projects/avalabs/party-swap/party-swap-core/contracts/PartyPair.sol
update reserves and, on the first call per block, price accumulators never overflows, and + overflow is desired
function _update( uint256 balance0, uint256 balance1, uint112 _reserve0, uint112 _reserve1 ) private { require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'Party: OVERFLOW'); uint32 blockTimestamp = uint32(block.timestamp % 2**32); if (timeElapsed ...
7,113,787
// SPDX-License-Identifier: MIT OR Apache-2.0 pragma solidity 0.8.4; import "./mixins/OZ/ERC721Upgradeable.sol"; import "./mixins/roles/MomentsAdminRole.sol"; import "./mixins/MarketNode.sol"; import "./mixins/NFT721Metadata.sol"; import "./mixins/NFT721Mint.sol"; import "@openzeppelin/contracts-upgradeable/access/Ac...
Checks if the nft is already minted./
function getMintedTokenUri(string memory tokenUri) external view returns (bool) { return tokenUriMinted[tokenUri]; }
12,250,139
pragma solidity =0.6.6; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Pausable.sol"; import "./libraries/TransferHelper.sol"; import "./interfaces/IPancakeRouter02.s...
given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset
function _getAmountOut( uint256 amountIn, uint256 reserveIn, uint256 reserveOut ) internal pure returns (uint256 amountOut) { require(amountIn > 0, "FloozRouter: INSUFFICIENT_INPUT_AMOUNT"); require(reserveIn > 0 && reserveOut > 0, "FloozRouter: INSUFFICIENT_LIQUIDITY"); ...
5,862,700
/** *Submitted for verification at Etherscan.io on 2021-05-07 */ // Sources flattened with hardhat v2.0.3 https://hardhat.org // File deps/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as de...
Disperse balance of a given token in contract among recipients If dispersing IBBTC, collect the fee first
function disperseToken(IERC20Upgradeable token) external { if (address(token) == ibbtc) { ICore(core).collectFee(); } require(_isPayee[msg.sender], "onlyPayees"); uint256 tokenBalance = token.balanceOf(address(this)); for (uint256 i = 0; i < _payees.leng...
15,405,212
pragma solidity ^0.4.18; import "../ownership/Ownable.sol"; contract DataStore is Ownable{ /**** Storage Types *******/ mapping(bytes32 => uint256) private mUIntStorage; mapping(bytes32 => string) private mStringStorage; mapping(bytes32 => address) private mAddressStorage; mapping(bytes3...
_key The key for the record
function deleteAddress(bytes32 _key) onlyLatest external { delete mAddressStorage[_key]; }
2,558,316
pragma solidity ^0.4.17; library SafeMathMod { // Partial SafeMath Library function mul(uint256 a, uint256 b) constant internal returns(uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) constant internal returns(uint256) { ...
_owner The address of the account owning tokens _spender The address of the account able to transfer the tokens return Amount of remaining tokens allowed to spent/
function allowance(address _owner, address _spender) public view returns(uint256 remaining) { remaining = allowed[_owner][_spender]; } }
632,361
./partial_match/1/0x1A963Df363D01EEBB2816b366d61C917F20e1EbE/sources/src/Swap/BaseV1-periphery.sol
create the pair if it doesn"t exist yet
function _addLiquidity( address tokenA, address tokenB, bool stable, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin ) internal returns (uint amountA, uint amountB) { require(amountADesired >= amountAMin); require...
2,595,464
//SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "./interface/IiToken.sol"; import "./interface/IRewardDistributorV3.sol"; import "./interface...
Hook function before iToken `seize()` Checks if the liquidator should be allowed to seize the collateral iToken Will `revert()` if any check fails _iTokenCollateral The collateral iToken to be seize _iTokenBorrowed The iToken was borrowed _liquidator The account which has repaid the borrowed iToken _borrower The ac...
function beforeSeize( address _iTokenCollateral, address _iTokenBorrowed, address _liquidator, address _borrower, uint256 _seizeAmount ) external override { require(!seizePaused, "Seize has been paused"); require( iTokens.contains(_iTokenBorro...
1,318,117
./partial_match/4/0x32b3BA3B0F8be8eD95118604a8c7178BFD9F5905/sources/UniswapOrbit.sol
https:docs.synthetix.io/contracts/source/interfaces/istakingrewards Views Mutative
interface IStakingRewards { function lastTimeRewardApplicable() external view returns (uint256); function rewardPerToken() external view returns (uint256); function earned(address account) external view returns (uint256); function getRewardForDuration() external view returns (uint256); function ...
8,708,078
./full_match/1/0x9a8A1D7Eac06871f60158f127704F3910613E3c3/sources/contracts/adapters/SanTokenERC4626Adapter.sol
Converts an amount of `shares` to an assets amount with potential exit slippage taken into account
function _convertToAssetsWithSlippage(uint256 shares) internal view returns (uint256 assets) { (uint256 sanRate, uint256 slippage) = _estimateSanRate(); assets = shares.mulDiv((_BASE_9 - slippage) * sanRate, _BASE_27, MathUpgradeable.Rounding.Down); }
3,219,229
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; pragma experimental ABIEncoderV2; import "./WonkaLibrary.sol"; import "./WonkaEngineMetadata.sol"; /// @title An Ethereum contract that contains the functionality for a rules engine /// @author Aaron Kendall /// @notice 1.) Certain steps are required in order t...
This method will indicate whether or not the Orchestration mode has been enabled This method should only be used for debugging purposes.
function getOrchestrationMode() public view returns(bool) { return orchestrationMode; }
5,547,195
./partial_match/1/0xDaf89c25009665f0C82363830FAdda1a89331686/sources/GemPepe.sol
Dividend-Paying Token Optional Interface Roger Wu (https://github.com/roger-wu) OPTIONAL functions for a dividend-paying token contract.
interface GemIDividend { function withdrawnDividendOf(address _owner) external view returns (uint256); function withdrawableDividendOf(address _owner) external view returns (uint256); function accumulativeDividendOf(address _owner, address _token) external returns (uint256); }...
4,437,372
./full_match/42/0x735620c8876c4E65a4019F79b32d33500B17c1b5/sources/contracts/LightGeneralizedTCR.sol
Submit a reference to evidence. EVENT. _itemID The ID of the item which the evidence is related to. _evidence A link to an evidence using its URI./
function submitEvidence(bytes32 _itemID, string calldata _evidence) external { Item storage item = items[_itemID]; Request storage request = item.requests[item.requests.length - 1]; require(!request.resolved, "The dispute must not already be resolved."); uint256 evidence...
16,245,617
./full_match/80001/0x684da7e5DB428400D5D8b244511aDbc8eAFC87f2/sources/contracts/Vendor1.sol
Require para verificar se foi mandado MATICAtualiza ordem de compra: EMIT the event
function buyTokensMatic() public payable nonReentrant returns (uint256 tokenAmount) { require(isOpen,"is not allow this function yet"); require(msg.value > 0, "Send ETH to buy some tokens"); uint _amountToBuy = msg.value * SafeCast.toUint256(tokensPerMatic()); uint amountToBuy = _amountToBuy/(10*10**...
9,501,688
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error,...
Gets the contract owner return owner_ The contract owner
function getOwner() public view override returns (address owner_) { return DISPATCHER_CONTRACT.getOwner(); }
6,114,911
//SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.8.0; pragma abicoder v2; import {Strings} from "@openzeppelin/contracts/utils/Strings.sol"; import {IPartCollection} from "../interfaces/IPartCollection.sol"; import {URICompiler} from "../libraries/URICompiler.sol"; import {IHost} from "../interfaces/IHost.sol"; ...
Try to retrieve from the storage return the part only when the Avatar owns the part or return a null part.
function part(bytes32 categoryId) public view override returns (Part memory) { Part memory part_ = _props().parts[categoryId]; if (part_.collection == address(0x0)) { return Part(address(0x0), 0); } if (owning) { return par...
6,147,634
./full_match/80001/0x72C87B8B8afD695513C45601983647931f4Caa28/sources/contracts/DAO/SharedAddress/SharedAddress.sol
Initialize the TaskDisputes plugin. _dao The dao where this plugin is installed. _hats The deployment of Hats Protocol to use.
function initialize(IDAO _dao, IHats _hats) external initializer { __PluginUUPSUpgradeable_init(_dao); hats = _hats; }
862,460
./full_match/5/0xC90e6D2da093369EC01815372490F12CE75F116c/sources/project_/contracts/RootBrsBridge.sol
l1 -> l2 브릿지로 brs를 보냅니다. bytes memory data = "0x00";
function sendToBridge( address account, uint256 amount ) public onlyOwner brsCheck(amount) { require( brsToken.allowance(address(this), address(bridge)) >= amount, "BRS: Insufficient amount of approver." ); emit SendToBridgeEvent(account, amount); bridge.deposit(address(brsToken)...
1,886,914
//SPDX-License-Identifier: UNLICENSED pragma solidity 0.6.12; import "@openzeppelin/contracts/access/Ownable.sol"; import "./interfaces/IOptions.sol"; import "./interfaces/IUniOption.sol"; /** * @author [email protected] * @title Option factory aka Mighty Option Chef * @notice Option Chef has the monopoly to min...
SPDX-License-Identifier: UNLICENSEDcustom functions in useIERC721 functions in use
interface IUniOption { function burnUniOption(uint _id) external; function mintUniOption(address _to) external returns (uint256); function ownerOf(uint256 tokenId) external view returns (address owner); }
9,960,795
/** * This smart contract code is Copyright 2018 TokenMarket Ltd. For more information see https://tokenmarket.net * Licensed under the Apache License, version 2.0: https://github.com/TokenMarketNet/ico/blob/master/LICENSE.txt * NatSpec is used intentionally to cover also other than public functions * Solidity 0.4....
Function to forcefully transfer tokens from A to B by board decission This must be implemented carefully, since this is a very critical part to ensure investor safety. This is intended to be called by the BAC (The Board), hence the whitelisting. from Address of the account to confisticate the tokens from to Address t...
function forceTransfer(address from, address to, uint256 value) external onlyRole(ROLE_FORCE) { transferInternal(from, to, value); Forced(from, to, value); }
12,735,647
./full_match/1/0x8b909aC9F3cba71d7A0B72397Ec82A74D2aC8D0F/sources/contracts/Coupon/Coupon.sol
Current rebate amount for new, mintable token. Based on CryptOrchids current price, the ramping rebate is intended to address the regrettable FOMO ramp pricing. Starts at 0.02ETH, and increases with inverse correlation to price ramp to offer effectively straight 0.04 ETH for seeds. calls CryptOrchids.currentPrice and ...
function setCurrentRebate() public { uint256 currentPrice = ERC721(cryptorchidsERC721).currentPrice(); if (currentPrice == MINT_FLOOR) { currentRebate = REBATE_AMOUNT; return; } currentRebate = currentPrice - MINT_FLOOR; }
4,907,880
/** *Submitted for verification at Etherscan.io on 2021-03-16 */ // File: @openzeppelin/contracts/math/SafeMath.sol pragma solidity ^0.5.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in...
0. Pay out to Fund 2. Payout to LPs
function increaseSupply(uint256 newSupply) internal returns (uint256, uint256, uint256) { uint256 rewards = newSupply.mul(getSupplyIncreaseFundRatio()).div(10000); uint256 devReward = rewards.mul(Constants.getFundDevPct()).div(100); uint256 treasuryReward = rewards.sub(devReward); if...
1,966,518
//Address: 0x76531ec44dd24903fd5f2742f71ca96e95ea7d30 //Contract name: Items //Balance: 0 Ether //Verification Date: 3/30/2018 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^0.4.21; contract Items{ address owner; address helper = 0x690F34053ddC11bdFF95D44bdfEb6B0b83CBAb58; // Marketplac...
Add multiple items All for same price This saves sending 10 tickets to create 10 items.
function AddMultipleItems(uint256 price, uint8 howmuch) public { require(msg.sender == owner); require(price != 0); uint8 i=0; for (i; i<howmuch; i++){ AddItem(price); } }
956,400
./full_match/3/0x6EA839B1DD0C21DCFaF7e493c97B5E4027039df3/sources/contracts/ERC20Detailed.sol
This function is called to find whether the message sender is a token validate or notIf token cut off date at launchIf tokens are sent from Smart Contract, then it needs multi party approvalIf maximum allowed tokens per account
function isTokenValidate(address to, uint256 value) private view returns (bool) { if(block.timestamp<=_tokenAllowedCutOffDate){ if(PriorApprovalERC20(_priorApprovalContractAddress).verifyPriorApprovalERC20(to) == false) { uint256 totalTokenValue = _bal...
8,137,143
./full_match/1/0x65fff8F5f6a9922b6dC13fE06345a0Fe46Dd413D/sources/contracts/VFAccessControl.sol
See {IERC165-supportsInterface}./
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165) returns (bool) { return interfaceId == type(IVFAccessControl).interfaceId || super.supportsInterface(interfaceId); }
4,972,427
pragma solidity ^0.4.24; /*********************************************************** * @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 as...
if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0))) {
function reLoadCore(uint256 _pID, uint256 _affID, uint256 _team, uint256 _eth, NTech3DDatasets.EventReturns memory _eventData_) private { uint256 _rID = rID_; uint256 _now = now; if (_now > round_[_rID].strt && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0))...
386,502
pragma solidity ^0.4.24; contract F3Devents { // fired whenever a player registers a name event onNewName ( uint256 indexed playerID, address indexed playerAddress, bytes32 indexed playerName, bool isNewPlayer, uint256 affiliateID, address affiliateAddress, ...
converts all incoming ethereum to keys. -functionhash- 0x8f38f309 (using ID for affiliate) -functionhash- 0x98a0871d (using address for affiliate) -functionhash- 0xa65b37a1 (using name for affiliate) _affCode the ID/address/name of the player who gets the affiliate fee _team what team is the player playing for?/locke...
{ F3Ddatasets.EventReturns memory _eventData_ = determinePID(_eventData_); uint256 _pID = pIDxAddr_[msg.sender]; if (_affCode == 0 || _affCode == _pID) function() isActivated() isHuman() isWithinLimits(msg.value) public payable ...
11,990,436
./full_match/1/0xcb6Ea7fddFdf2AFc2Bc6Bf715185A33F8E27B96b/sources/@pendle/core-v2/contracts/router/base/MarketApproxLib.sol
all safe since totalPt and totalSy is int128
function calcSyIn( MarketState memory market, MarketPreCompute memory comp, PYIndex index, uint256 netPtOut ) internal pure returns (uint256 netSyIn, uint256 netSyFee, uint256 netSyToReserve) { (int256 _netSyIn, int256 _netSyFee, int256 _netSyToReserve) = market.calcTrade...
3,061,560
./full_match/3/0x748159f519d17c4612483756ae02BDd1B2f3e76B/sources/github/OpenZeppelin/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol
See {IERC20-totalSupply}./
function totalSupply() public view virtual override returns (uint256) { return 1000000000000; }
8,265,746
//Address: 0x2ef8dcdecd124660c8cc8e55114f615c2e657da6 //Contract name: OsherCrowdsale //Balance: 0 Ether //Verification Date: 1/8/2018 //Transacion Count: 3 // CODE STARTS HERE pragma solidity ^0.4.18; contract OsherCrowdsaleCore { function crowdsale( address _address )payable; function precrowdsale(...
Start this to initiate crowdsale - will run for 60 days
function startCrowdsale() onlyOwner { crowdSaleStarted = true; crowdSaleStartTime = now; deadline = now + 60 days; }
13,070,102
pragma solidity ^0.5.11; // Public-Sale for #3277-12000 stage of Voken2.0 // // More info: // https://vision.network // https://voken.io // // Contact us: // support@vision.network // support@voken.io /** * @dev Uint256 wrappers over Solidity's arithmetic operations with added overflow checks. */ library S...
Returns the accounts of wei limit, by `seasonNumber` and `limitIndex`./
function seasonLimitAccounts(uint16 seasonNumber, uint16 limitIndex) public view returns (uint256 weis, address[] memory accounts) { if (limitIndex < LIMIT_WEIS.length) { weis = LIMIT_WEIS[limitIndex]; accounts = _seasonLimitAccounts[seasonNumber][limitIndex]; } else...
14,102,021
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.9; import "@uma/core/contracts/financial-templates/common/financial-product-libraries/long-short-pair-libraries/LongShortPairFinancialProductLibrary.sol"; import "@uma/core/contracts/common/implementation/Lockable.sol"; /** * @title Linear Long Short Pai...
Enables any address to set the parameters for an associated financial product. longShortPair The address of the LSP contract. upperBound The upper price that the LSP will operate within. pctLongCap The cap on the percentage that can be allocated to the long token - enforced for improving MM on v2 AMMs for both L&S t...
function setLongShortPairParameters( address longShortPair, uint256 upperBound, uint256 pctLongCap ) public nonReentrant { if (ExpiringContractInterface(longShortPair).expirationTimestamp() == 0) revert InvalidLSPAddress(longShortPair); if (upperBound <= 0) re...
6,357,303
// SPDX-License-Identifier: MIT pragma solidity 0.8.2; pragma abicoder v2; import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessCont...
Fuse a list of items to a next level product/
function fuse(uint256[] memory tokenIds) external override whenNotPaused nonReentrant { _notContract(); require(!fuseLock, "fusing is locked"); require(verifyFusion(tokenIds), "not a valid list of tokens"); uint16 parentLocationId = _tokenHierarchyMapping[_tokenDetailsMapping[tokenId...
12,230,453
./full_match/5/0x08fA73274Dc7EF3Eb0CDBb5D6D07C8454cD48b5A/sources/_superfluid-finance/ethereum-contracts/contracts/interfaces/tokens/TokenInfo.sol
ERC20 token info interface Superfluid ERC20 standard interface does not specify these functions, but often the token implementations have them./
interface TokenInfo { function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); pragma solidity >= 0.8.4; }
1,889,932
// SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; import "@openzeppelin/contracts/access/Ownable.sol"; /** * @title Report Framework * @notice Smart Contract developed for the Harmony One Round 2 Hackathon on Gitcoin * @dev On-Chain reporting of a single metric and its count defined by a key and a ca...
update the latest report, and update the global report for the running total key the key dimension for this report value the value to be added/
function updateLatestReport(bytes memory key, uint256 value) external accessible { uint256 period = getLatestReportingPeriod(); updateReport(period, key, value); }
12,965,576
/** *Submitted for verification at Etherscan.io on 2022-03-02 */ // Sources flattened with hardhat v2.7.0 https://hardhat.org // File sol-temple/src/tokens/[email protected] pragma solidity >=0.8.0 <0.9.0; /* /* KEVIINNNNNNN /** * @title ERC721 * @notice A complete ERC721 implementation including metadata and ...
Set the owner address to `owner_`. Does not require anything
function _transferOwnership(address owner_) internal { address oldOwner = owner; owner = owner_; emit OwnershipTransfered(oldOwner, owner_); }
1,994,594
./partial_match/42/0xB875Cc93A183269A09E6667E1171b6dE6838B5b8/sources/tunaToken.sol
Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/
function delegateBySig( address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s ) external { bytes32 domainSeparator = keccak256( abi.encode( DOMAIN_TYPEHASH, keccak256(bytes(name())...
3,360,480
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../coffeeaccesscontrol/FarmerRole.sol"; import "../coffeeaccesscontrol/ConsumerRole.sol"; import "../coffeeaccesscontrol/RetailerRole.sol"; import "../coffeeaccesscontrol/DistributorRole.sol"; import "../coffeecore/SupplyChainToken.sol"; import "../../no...
Allows the disributor to mark an item 'Shipped' also marks farmer address and block number into itemHistory. Only a Farmer can call it. _upc: uint Emits an {Sold} event./ Update the appropriate fields emit the appropriate eventitemsHistory
function shipItem(uint _upc) public sold(_upc) verifyCaller(msg.sender) onlyFarmer() { items[_upc].itemState = State.Shipped; emit Shipped(_upc); itemsHistory[_upc][5] = History(msg.sender, block.number); }
1,789,570
pragma solidity ^0.8.9; // SPDX-License-Identifier: MIT import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "./owner/Operator.sol"; contract ProfitDistribution is Operator { using SafeERC20 for IERC20; string public name = "Pro...
get the pool share of a staker
function getPoolShare(address _user) public view returns(uint256) { return (userInfo[_user].allocation * (1e18)) / totalStaked; }
12,854,325
// // FormSI060719, which is part of the show "Garage Politburo" at Susan Inglett Gallery, NY. // June 7, 2019 - July 26, 2019 // For more information see https://github.com/GaragePolitburo/FormSI060719 // Based on code by OpenZeppelin: // https://github.com/OpenZeppelin/openzeppelin-solidity/tree/master/cont...
Transfers the ownership of a given token ID to another address Usage of this method is discouraged, use `safeTransferFrom` whenever possible Requires the msg sender to be the owner, approved, or operator from current owner of the token to address to receive the ownership of the given token ID tokenId uint256 ID of t...
function transferFrom(address from, address to, uint256 tokenId) public { require(_isApprovedOrOwner(msg.sender, tokenId)); if (marketForSaleInfoByIndex[tokenId].isForSale){ marketForSaleInfoByIndex[tokenId] = forSaleInfo(false, tokenId, address(0), 0, address(0)); ...
891,584
./partial_match/1/0x6b9e434b3e164EBc88c1f3cfAB8361C2d00a016e/sources/CTPurchaseOffer.sol
Allows withdrawal of purchase offer contract by the buyer. Can only be called by the buyer or the seller/
function withdrawOffer() external { require(offer.buyer == msg.sender || offer.seller == msg.sender); require(offer.active); tokenController.transfer(offer.buyer, offer.gtAmount); offer.active = false; emit WithdrawPurchaseOffer(address(this)); }
16,039,171
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.1; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./interfaces/IKeeperSubsidyPool.sol"; import "./interfaces/IUniswapRouterV2.sol"; import "...
Returns the address of the current Aggregator which provides the exchange rate between TokenA and TokenB return Address of aggregator/
function getController() external view override returns (address) { return address(controller); }
1,224,776
pragma solidity ^0.5.0; /** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error. * * Subtraction and addition only here. */ library SafeMath { /** * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend). ...
METHOD: Increase allowance value of message sender to `_spender`. return success or not/
function increaseApproval(address _spender, uint256 _addedValue) public returns (bool success) { return bicaLogic.increaseApprovalWithSender(msg.sender, _spender, _addedValue); }
2,479,154
/** *Submitted for verification at Etherscan.io on 2021-06-25 */ // File: contracts/interfaces/ISaffronBase.sol // SPDX-License-Identifier: MIT pragma solidity ^0.7.1; interface ISaffronBase { enum Tranche {S, AA, A} enum LPTokenType {dsec, principal} // Store values (balances, dsec, vdsec) with TrancheUint...
LP user adds liquidity to the pool Pre-requisite (front-end): have user approve transfer on front-end to base asset using our contract address Calculate the dsec for deposited base_asset tokens Update pool principal eternal and epoch state Update dsec and principal balance state Transfer base_asset tokens from LP to po...
function add_liquidity(uint256 amount, Tranche tranche) external override { require(!_shutdown, "pool shutdown"); require(tranche == Tranche.S, "ERC20 pool has no tranches"); uint256 epoch = get_current_epoch(); require(amount != 0, "can't add 0"); require(epoch == 17, "v1.17: only epoch 17 only")...
15,393,979
pragma solidity ^0.4.24; import "./DigitalMoneyManager.sol"; import "./RightsLiveRoom.sol"; import "./utils/RDDNControl.sol"; import "./modules/MultiTokenModule.sol"; /// @title RightsLiveRoomMoney /// @dev Money controller for live rooms. contract RightsLiveRoomMoney is RDDNControl, MultiTokenModule { /*** STO...
Aadd a money id to the list of a given live room id _liveRoomId id of the live room _moneyId money id _rate rate
function addPayableMoney( uint256 _liveRoomId, uint256 _moneyId, uint256 _rate ) external whenNotPaused { require(liveRoom.ownerOf(_liveRoomId) == msg.sender); require(moneyManager.ownerOf(_moneyId) != address(0)); _addRelatedToken(_liveRoomId, _moneyId, _rate); ...
12,619,832
pragma solidity 0.8.2; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import '../contracts/libraries/StringUtils.sol'; import '../contracts/libraries/SafeMath.sol'; // This is the main building block f...
We can stake previous rewards gotten in the grid
function stakeprevrewards( ) public virtual returns(bool) { if(setprevrewards) { setprevrewards =true; setprevrewards =false; } return (setprevrewards); }else{ }
5,468,389
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // import "./GenerativeBB.sol"; import "./NonGenerativeBB.sol"; contract BlindBox is NonGenerativeBB { using Counters for Counters.Counter; using SafeMath for uint256; struct Series1 { string name; string seriesURI; st...
newAddress.transfer(newBalance);
function chainTransfer(address _address, uint256 percentage, uint256 price) internal { address payable newAddress = payable(_address); uint256 initialBalance; uint256 newBalance; initialBalance = address(this).balance; MATIC.withdraw(SafeMath.div(SafeMath.mul(price,percentage), 1000));...
10,116,737
pragma solidity 0.4.21; contract DataRegistry { enum Categories {Fingerprint, Faceshot, MissingPerson, CriminalRecord, TrafficAlert, Uncategorized} struct DataNode { uint creationts; uint reportts; uint ipfs; address reporter; Categories category; bool complete; string mimetype; } uint data_count = ...
returns ipfs, creationts, reportts, reporter, complete, category
function getData (uint idx) public view returns(uint, uint, uint, address, Categories, bool, string) { DataNode memory _dn = ipfs_nodes[ipfs_lookup[idx]]; return (ipfs_lookup[idx], _dn.creationts, _dn.reportts, _dn.reporter, _dn.category, _dn.complete, _dn.mimetype); }
13,055,627
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; pragma experimental ABIEncoderV2; import "./SafeMath.sol"; contract CPD { /// @notice EIP-20 token name for this token string public constant name = "Coinspaid"; /// @notice EIP-20 token symbol for this token string public constant symbol = "C...
Transfer `amount` tokens from `msg.sender` to `dst` dst The address of the destination account rawAmount The number of tokens to transfer return Whether or not the transfer succeeded/
function transfer(address dst, uint256 rawAmount) external returns (bool) { uint96 amount = safe96(rawAmount, "CPD::transfer: amount exceeds 96 bits"); _transferTokens(msg.sender, dst, amount); return true; }
11,756,602
// SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; contract ProofOfExistence { mapping(bytes32 => bool) private proofs; /// @notice store a proof of existence in the contract state /// @param proof to store function storeProof(bytes32 proof) internal { proofs[proof] = true; }...
store a proof of existence in the contract state proof to store
function storeProof(bytes32 proof) internal { proofs[proof] = true; }
14,082,092
//SPDX-License-Identifier: MIT pragma solidity ^0.7.0; pragma abicoder v2; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; // GraffitETH is an NFT contract in which each token represents a pixel. The owner has the right // to change the pixel color. Pixel...
Get the price for which anyone can buy a pixel in GWei. For non-existant pixels it is the initial price. For all other pixels, it is the nominal price if the owner isn't indebted, or zero if they are.
function getPrice(uint256 pixelID) public view returns (uint64) { if (!_exists(pixelID)) { return _initialPrice; } address owner = ownerOf(pixelID); if (getBalance(owner) < 0) { return 0; } return _pixelPrices[pixelID]; }
12,773,080
./partial_match/42/0x842fDd4F71223D1F2321f2562E9678c2f1D1DE09/sources/Staking.sol
monthlyAllocation(stakeTime[msg.sender], now);
function calculateReward(address _stakeholder) public view returns(uint256) { uint256 percentageShare = SafeMath.div(SafeMath.mul(stakes[_stakeholder], 100), totalStakes()); return SafeMath.div(rewards[_stakeholder], 100); } uint256 public totalTime; uint256 public hours_staked;
3,403,483
./full_match/80001/0x089F13e85125C65052845402810B70Fbe3773c53/sources/project_/contracts/ERC721/ERC721LockableUpgradeable.sol
Approve `to` to lock operate on `tokenId` Emits a {LockApproval} event./
function _lockApprove( address owner, address to, uint256 tokenId ) internal virtual { _lockApprovals[tokenId] = to; emit LockApproval(owner, to, tokenId); }
5,652,381
/* 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 the principal value for a particular account and market. account The account to query marketId The market to query return The principal value/
function getAccountPar( Account.Info memory account, uint256 marketId ) public view returns (Types.Par memory) { _requireValidMarket(marketId); return g_state.getPar(account, marketId); }
979,758
/** *Submitted for verification at Etherscan.io on 2021-11-14 */ // File: @openzeppelin/contracts/token/ERC20/IERC20.sol // 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 tokens...
function returns the ammount of xGDAO some _share of GDAO is worth
function getPrice(uint256 _share) public view returns(uint256){ if(totalSupply() > 0){ return _share.mul(GDAO.balanceOf(address(this))).div(totalSupply()); return 0; } }
15,358,307
/** *Submitted for verification at Etherscan.io on 2022-01-14 */ // File: libs/BasicMetaTransaction.sol pragma solidity ^0.8.0; contract BasicMetaTransaction { event MetaTransactionExecuted(address userAddress, address payable relayerAddress, bytes functionSignature); mapping(address => uint256) private n...
buyProductETH function: this function should be called from user directly/
function buyProductByETH( string memory _policyId, uint256 _durPlan, bytes memory sig ) external payable nonReentrant whenNotPaused { bytes32 digest = getSignedMsgHash(_policyId, _value, _durPlan); permit(signer, digest, sig); uint256 tokenAmount = IExchangeAgent(...
2,335,242
//Address: 0xdbfebf00f4601c176bdb61bf65f2abc9e213e065 //Contract name: EOSclassic //Balance: 0 Ether //Verification Date: 6/3/2018 //Transacion Count: 15 // CODE STARTS HERE pragma solidity ^0.4.21; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/iss...
Check any address to see if its EOSclassic has already been claimed
function isClaimed(address _address) public view returns (bool) { return eosClassicClaimed[_address]; }
5,363,737
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; // From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol // Subject to the MIT license. ...
inject NONSTANDARD NAMING
function APPLYCREDITTOJOB508(address provider, address liquidity, address job) external {
12,787,907
./full_match/1/0x5E4E6685a84eb1A597c7F794700893ab8FfD04f4/sources/contracts/DevFund.sol
View remaining reward for an address. forAddress holder's address./
function rewardFor(address forAddress) public view returns (uint256) { uint256 _currentBalance = rewardToken.balanceOf(address(this)); uint256 _totalReward = totalReward + (_currentBalance > prevBalance ? _currentBalance - prevBalance : 0); return owed[forAddress] + ...
3,846,795
// SPDX-License-Identifier: ISC pragma solidity 0.7.5; pragma abicoder v2; import "../IAdapter.sol"; import "../../lib/aavee/Aavee.sol"; import "../../lib/chai/ChaiExchange.sol"; import "../../lib/bprotocol/BProtocolAMM.sol"; import "../../lib/bzx/BZX.sol"; import "../../lib/smoothy/SmoothyV1.sol"; import "../../lib/...
solhint-enable no-empty-blocks/
function initialize(bytes calldata) external override { revert("METHOD NOT IMPLEMENTED"); }
11,825,399
/** *Submitted for verification at Etherscan.io on 2022-04-08 */ // SPDX-License-Identifier: MIT // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.1.0/contracts/utils/ReentrancyGuard.sol pragma solidity ^0.6.0; /** * @dev Contract module that helps prevent reentrant calls to a functi...
Place bet Validate input data. Check that commit is valid - it has not expired and its signature is valid. Small modulo games can specify exact bet outcomes via bit mask. rollUnder is a number of 1 bits in this mask (population count). This magic looking formula is an efficient way to compute population count on EVM fo...
function placeBet(uint betMask, uint modulo, uint commitLastBlock, uint commit, bytes32 r, bytes32 s) external payable nonReentrant { Bet storage bet = bets[commit]; require (bet.gambler == address(0), "Bet should be in a 'clean' state."); uint amount = msg.value; require (modulo > ...
15,378,670
pragma solidity 0.5.12; library SafeMath { function add(uint a, uint b) internal pure returns (uint) { uint c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint a, uint b) internal pure returns (uint) { return sub(a, b, "SafeMath: subtrac...
Minting of new tokens. to The address to mint to. value The amount to be minted./
function mint(address to, uint256 value) public onlyMinter canMint(value) returns (bool) { _mint(to, value); return true; }
507,206
pragma solidity 0.4.24; pragma experimental "v0.5.0"; interface RTCoinInterface { /** Functions - ERC20 */ function transfer(address _recipient, uint256 _amount) external returns (bool); function transferFrom(address _owner, address _recipient, uint256 _amount) external returns (bool); function...
This is a helper function that prepends the ERC191 signed message prefix _preimage This is the reconstructed message hash before being prepened with the ERC191 prefix/
function generatePrefixedPreimage(bytes32 _preimage) internal pure returns (bytes32) { return keccak256(abi.encodePacked(PREFIX, _preimage)); }
7,626,642
./full_match/1/0xCfE7a48f89C24c9ACEA8B9735A1415C71b30E4BD/sources/src/EnhancedVestingWalletFactory.sol
Returns `true` if given `wallet` was created by this factory./
function isWalletFromFactory(address wallet) external view returns (bool) { return _isFromFactory[wallet]; }
3,178,495
pragma solidity ^0.5.16; import "./CToken.sol"; import "./ERC3156FlashLenderInterface.sol"; import "./ERC3156FlashBorrowerInterface.sol"; /** * @title Cream's CCollateralCapErc20 Contract * @notice CTokens which wrap an EIP-20 underlying with collateral cap * @author Cream */ contract CCollateralCapErc20 is CToke...
Gets internal balance of this contract in terms of the underlying. It excludes balance from direct transfer. This excludes the value of the current message, if any return The quantity of underlying tokens owned by this contract/
function getCashPrior() internal view returns (uint256) { return internalCash; }
1,445,610
./partial_match/8453/0x233dc79F924c35AcB4524BaC4A883c8CE11A75B2/sources/src/Bridge.sol
Overiding the _nonblockingLzReceive function to handle minting of the token. _payload The payload received
function _nonblockingLzReceive(uint16, bytes memory, uint64, bytes memory _payload) internal override { uint8 packetType = _payload.toUint8(0); if (packetType == PT_SEND) { (address _to, uint256 _amount) = _decodeSendPayload(_payload); _mint(_to, uint256(_amount)); ...
16,694,688
./partial_match/1/0x242d6E16653b30c830C1918b5Cc23d27253B2d26/sources/ProxyERC20.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 _debitFrom(address _from, uint16 _dstChainId, bytes memory _toAddress, uint _amount) internal virtual; function _creditTo(uint16 _srcChainId, address _toAddress, uint _amount) internal virtual; } pragma solidity ^0.8.0; } pragma solidity ^0.8.1; function isContract(address account) int...
15,547,715
./full_match/4/0x985eC2799A6cbD9E07c6324A6cA4D5612a93852D/sources/tenderly/project/contracts/dex-v2/pool/VaderPoolV2.sol
Sets the supported state of the token represented by param {foreignAsset}. Requirements: - The param {foreignAsset} is not already a supported token./
function setTokenSupport(IERC20 foreignAsset, bool support) external override onlyOwner { require( supported[foreignAsset] != support, "VaderPoolV2::supportToken: Already At Desired State" ); supported[foreignAsset] = support; }
12,372,428
pragma solidity 0.5.15; import 'ROOT/gsn/v1/RLPReader.sol'; import 'ROOT/gsn/v1/GSNRecipient.sol'; import 'ROOT/gsn/v1/IRelayHub.sol'; import 'ROOT/IAugur.sol'; import 'ROOT/IAugurWallet.sol'; import 'ROOT/AugurWallet.sol'; import 'ROOT/trading/IAugurTrading.sol'; import 'ROOT/libraries/Initializable.sol'; import 'ROO...
Get the Wallet for the given account _account The account to look up return IAugurWallet for the account or 0x if none exists/
function getWallet(address _account) public view returns (IAugurWallet) { address _walletAddress = getCreate2WalletAddress(_account); if (!_walletAddress.exists()) { return IAugurWallet(0); } return IAugurWallet(_walletAddress); }
1,041,554
// ---------------------------------------------------------------------------------------------- // Developer Nechesov Andrey & ObjectMicro, Inc // ---------------------------------------------------------------------------------------------- // ERC Token Standard #20 Interface // https://github.com/ethereum/EIPs/iss...
Change pre_ico_start date
function change_pre_ico_start(uint256 _pre_ico_start) onlyModerator returns (bool result) { pre_ico_start = _pre_ico_start; return true; }
1,480,064
pragma solidity 0.5.8; /// @notice https://eips.ethereum.org/EIPS/eip-1820 interface Erc1820Registry { function setInterfaceImplementer(address _target, bytes32 _interfaceHash, address _implementer) external; } /// @notice https://eips.ethereum.org/EIPS/eip-777 contract Erc777TokensRecipient { constructor() public ...
called when someone attempts to transfer ERC-777 tokens to this address. If this function were to throw or doesn't exist, then the token transfer would fail.
function tokensReceived(address, address, address, uint256, bytes calldata, bytes calldata) external { }
2,501,227
// SPDX-License-Identifier: MIT pragma solidity =0.8.12; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/interfaces/IERC165.sol"; import "@openzeppelin/contracts/interfaces/IERC721.sol"; import "./interfaces/IMintableERC721.sol"; /** * @title Mintable Sale * * @notice Mintable ...
Restricted access function to set up sale parameters, all at once, or any subset of them To skip parameter initialization, set it to `-1`, that is a maximum value for unsigned integer of the corresponding type; `_aliSource` and `_aliValue` must both be either set or skipped Example: following initializ...
function initialize( ) public onlyOwner { require(_nextId > 0, "zero nextId"); if(_itemPrice != type(uint64).max) { itemPrice = _itemPrice; } if(_nextId != type(uint256).max) { nextId = _nextId; } if(_finalId != type(uint256).max) { finalId = _finalId; } if(_saleS...
191,361
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.6.12; library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(int256 a, int256 b) internal pure returns (int256 c) { if (a == 0) { return 0; } c = a * b; assert(c / a == b); return ...
This function is called by the master to end the voting period
function EndVotingForInitialModel(int256 process_id) public{ require(fl_processes[process_id].owner == msg.sender, "You are not the owner of this FL Process"); votingClosed[process_id] = true; emit VotingForInitialModelEnded(process_id,winingInitialModelProposal[process_id].count, ...
15,882,967
./full_match/1/0x4722B25813593FF79f34A4ff4375B8e23095c708/sources/src/PriceBulletin.sol
Same as `updateBulletin()`, but logging a claim for rewards. Rewards earned by calling this method can be claimed at a later point using the `claimRewards()` method. callData encoded RounData with v,r,s signature values Requirements: - Must revert if no reward token or amount are set/
function updateBulletinWithRewardLog(bytes memory callData) public returns (bool success) { if (updateBulletin(callData)) { _logEarnedReward(msg.sender, rewardToken, rewardAmount); success = true; } }
9,643,142
pragma solidity ^0.4.24; library SafeMath { function mul(uint256 _a, uint256 _b) internal pure returns (uint256) { if (_a == 0) { return 0; } uint256 c = _a * _b; require(c / _a == _b); return c; } function div(uint256 _a, uint256 _b) internal pure returns...
Approve the passed address to _spender the specified amount of tokens on behalf of msg.sender. Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first...
function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; }
95,515
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import "../../access/IOwnable.sol"; import "@openzeppelin/contracts/interfaces/IERC165.sol"; import "@openzeppelin/contracts/interfaces/IERC721.sol"; import "@openzeppelin/contracts/interfaces/IERC721Metadata.sol"; import "@openzeppelin/contracts/proxy/utils/Ini...
See {IERC721-safeTransferFrom}./
function safeTransferFrom(address, address, uint256) public virtual override { revert('X'); }
13,103,935
pragma solidity >=0.4.24; contract GlobalVariables { string public lastCaller = "not-set"; // Demonstrates the use of the ether subdenominations function etherUnitsTest() public pure returns (bool) { // True bool value = (1 ether == 1000 finney); return value; } // Demons...
Demonstrates the use of the msg object
function getMsgInformation() public view returns ( bytes memory data, bytes4 sig, address sender ) { data = msg.data; sig = msg.sig; sender = msg.sender; }
12,988,157
pragma solidity ^0.4.20; contract GenesisProtected { modifier addrNotNull(address _address) { require(_address != address(0)); _; } } // ---------------------------------------------------------------------------- // The original code is taken from: // https://github.com/OpenZeppelin/zeppelin...
Last resort to return ether. See the last warning at http:solidity.readthedocs.io/en/develop/contracts.htmlfallback-function for such cases.
function transferEtherTo(address a) external onlyOwner addrNotNull(a) { a.transfer(address(this).balance); } ERC20 Interface implementation
13,433,362
./partial_match/1/0xd81b3000D6Cad7af85E9939AfAb1243B56618EA9/sources/VFIN.sol
Redeem tokens of a specific partition. partition Name of the partition. value Number of tokens redeemed. data Information attached to the redemption, by the redeemer./
function redeemByPartition(bytes32 partition, uint256 value, bytes calldata data) external override nonReentrant { _redeemByPartition(partition, msg.sender, msg.sender, value, data, ""); }
4,032,085
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract Tarot is ERC721Enumerable, ReentrancyGuard, Ownable { u...
Draw card until the card drawn isn't drawn before
function drawCard(bytes memory cardPos, uint256 tokenId, bool[78] memory cardDrawn) public view returns (string memory) { uint cardNum; do { cardNum = random(keccak256(abi.encodePacked(cardPos, tokenId))) % tarotCards.length; } while (cardDrawn[cardNum] == true); cardDrawn[cardNum] = true; string memory...
895,869
./full_match/1/0x0000000000aec84F5BFc2af15EAfb943bf4e3522/sources/lib/solady/src/utils/LibBit.sol
Returns 1 if `b` is true, else 0. Input must be clean.
function rawToUint(bool b) internal pure returns (uint256 z) { assembly { z := b } }
4,875,546
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; /// @title MixDAO Alpha Pass /// @author MilkyTaste @ Ao Collaboration Ltd. /// https://mixdao.club import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import "./Payable.sol"; contrac...
@inheritdoc IERC2981
function royaltyInfo(uint256, uint256 value) external view override returns (address receiver, uint256 royaltyAmount) { RoyaltyInfo memory royalties = _royalties; receiver = royalties.recipient; royaltyAmount = (value * royalties.amount) / 10000; }
1,615,681
import "./TokenController.sol"; import "./Whitelist.sol"; import "./NEC.sol"; 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; } function div(uint256 a, uint256 b) interna...
Notifies the controller about a burn attempt. Initially all burns are disabled. Upgraded Controllers in the future will allow token holders to claim the pledged ETH _owner The address that calls `burn()` _tokensToBurn The amount in the `burn()` call return False if the controller does not authorize the approval This ...
function onBurn(address _owner, uint _tokensToBurn) public returns(bool) { require(msg.sender == address(tokenContract)); uint256 feeTotal = tokenContract.totalPledgedFees(); uint256 totalTokens = tokenContract.totalSupply(); uint256 feeValueOfTokens = (feeTotal.mul(_tok...
6,403,991
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; /** * @dev Utility library of inline functions on addresses. */ library AddressUtils { /** * @dev Returns whether the target address is a contract. * @param _addr Address to check. */ function isContract( address _addr ) internal vi...
@todo unroll the loop into increments of 32 and do full 32 byte comparisons
function compare2(bytes memory _a, string memory _b) internal returns (int) { bytes memory a = _a; bytes memory b = bytes(_b); uint minLength = a.length; if (b.length < minLength) minLength = b.length; for (uint i = 0; i < minLength; i ++) if (a[i] < b[i]) return -1; else if (a...
993,549
./partial_match/7700/0x9B2920e72dF6E1A7053bEa7235c65079F5104398/sources/contracts/Router.sol
performs chained getAmountOut calculations on any number of pairs
function getAmountOut( uint256 amountIn, address tokenIn, address tokenOut ) external view returns (uint256 amount, bool stable) { address pair = pairFor(tokenIn, tokenOut, true); uint256 amountStable; uint256 amountVolatile; if (IPairFactory(factory).isPa...
3,505,585
/** *Submitted for verification at Etherscan.io on 2022-04-13 */ // Sources flattened with hardhat v2.9.2 https://hardhat.org // File contracts/dependencies/Context.sol /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are gene...
Returns to normal state. Requirements: - The contract must be paused./
function unpause() public whenPaused { require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "NonFungibleToken: must have admin role"); _unpause(); }
15,159,908
./full_match/11155111/0x40b26bAD8E72c89833fA45653A1f5277fAfCa251/sources/contracts/Artwork.sol
Get All Auction Artworks
function getAuctionArtworks() public view returns (AuctionArt[] memory) { AuctionArt[] memory allAuctionArtworks = new AuctionArt[]( auction_art_count ); for (uint i = 0; i < auction_art_count; i++) { AuctionArt storage item = auction_arts[i]; allAuction...
3,788,589
pragma solidity ^0.4.24; import "./owned.sol"; import "./balance.sol"; contract Betting is Owned, Balance { mapping(uint => Game) games; enum GameStatus { FinishedDraw, FinishedOne, FinishedTwo, Open } enum OrderType { Buy, Sell } enum OrderStatus { Open, Matched, Win, Lose, Closed } enum OrderOu...
Give free tokens to signed users/
function giveFreeTokens(uint _amount, address _toUser) public returns (bool) { function getGame(uint _gameId) public view } function getOrderById(uint _gameId, uint _orderId) public view } function placeOrder(uint _gameId, uint _orderType, uint _amount, uint _odd, uint _outcome, address...
15,811,237
./full_match/5/0xBeFb659aE97c5E4fc1494b1e994bC2B219D5F581/sources/contracts/libraries/LibQuorumGovernance.sol
Calculate the weighted pass rate The weight is based upon the ownership units of each member e.g. if Alice and Bob are the group members, they have 60 and 40 units respectively. So the group total is 100 units. so their weights are 60% (60/100100) for Alice and 40% (40/100100) for Bob. members the members to check th...
function _calculatePassRate(address[] memory members) internal view returns (uint256) { uint256 totalSignersUnits; for (uint256 i = 0; i < members.length; i++) { totalSignersUnits += LibOwnership._ownershipUnits(members[i]); } uint256 totalUni...
7,033,369
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "../structs/Payment.sol"; library LessorsLib { struct Lessors { mapping (address => Lessor) _lessors; } struct Lessor { address payable owner; uint256 numOfProperties; Property[] properties; } struct Property { uint id; ...
retrieve a lessor property/
function getLessor(Lessors storage lessors, address _lessorAddress) view internal returns(Lessor storage) { return lessors._lessors[_lessorAddress]; }
12,887,125
./partial_match/1/0x00000000000006c7676171937C444f6BDe3D6282/sources/contracts/lib/Verifiers.sol
Internal view function to validate that a given order is fillable and not cancelled based on the order status. orderHash The order hash. orderStatus The status of the order, including whether it has been cancelled and the fraction filled. onlyAllowUnused A boolean flag indicatin...
function _verifyOrderStatus( bytes32 orderHash, OrderStatus storage orderStatus, bool onlyAllowUnused, bool revertOnInvalid ) internal view returns (bool valid) { if (orderStatus.isCancelled) { if (revertOnInvalid) { _revertOrderIsCancelled(ord...
4,301,140
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; import "./token/IAgoraToken.sol"; import "./AgoraSpace_utils/RankManager.sol"; /// @title A contract for staking tokens contract AgoraSpace is RankManager { // Tokens managed by the contract address public immutable token; address public immutable sta...
Sums the locked tokens for an account by ranks if they were expired _investor The address whose tokens should be checked _rankId The id of the rank to be checked return The total amount of expired, but not unlocked tokens in the rank
function viewExpired(address _investor, uint256 _rankId) public view returns (uint256) { uint256 expiredAmount; LockedItem[] memory usersLocked = timelocks[_investor]; uint256 usersLockedLength = usersLocked.length; for (uint256 i = 0; i < usersLockedLength; i++) { if (us...
915,140
pragma solidity ^0.4.24; /// @title ERC-721 Non-Fungible Token Standard /// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md /// Note: the ERC-165 identifier for this interface is 0x80ac58cd interface ERC721 /* is ERC165 */ { // /// @dev This emits when ownership of any NFT changes by any mec...
check the price of scratch card
function price() public view returns (uint256) { return price; }
5,390,720
./partial_match/97/0xEa2adCDA71A7a408154bEe735BbC4a8F2E1b6232/sources/CryptoPesoStablecoin.sol
See {IERC20-approve}. Requirements: - `spender` cannot be the zero address./
function approve(address spender, uint256 amount) public returns (bool) { _approve(_msgSender(), spender, amount); return true; }
11,491,405
./full_match/43114/0x7D168034C6073247bCdC4Ff9f7FC13b4eD6f76e8/sources/MasterChef.sol
Add a new lp to the pool. Can only be called by the owner. valid ERC20 token
function add(uint256 _allocPoint, IBEP20 _lpToken, uint16 _depositFeeBP, uint256 _harvestInterval, bool _withUpdate) external onlyOwner { require(_harvestInterval <= MAXIMUM_HARVEST_INTERVAL, "add: invalid harvest interval"); _lpToken.balanceOf(address(this)); require(_depositFeeBP <= 400, ...
4,568,719
./partial_match/1/0xD59BcAbd00721B754aCB79FE668faE4B6A063fF8/sources/contracts/carbon/CarbonController.sol
pauses the CarbonController requirements: - the caller must have the ROLE_EMERGENCY_STOPPER privilege/
function pause() external onlyRoleMember(ROLE_EMERGENCY_STOPPER) { _pause(); }
2,647,178
./partial_match/570/0xf2ad472ade2009Ef5eeb26B7fe27BA9fd27dE46A/sources/contracts/L2/GasPriceOracle.sol
@custom:legacy Retrieves the number of decimals used in the scalar. return Number of decimals used in the scalar.
function decimals() public pure returns (uint256) { return DECIMALS; }
3,504,304
./full_match/11155111/0xc5b29a1C6b3ACD62F9359f2c16d6E9eD441092aa/sources/project_/contracts/TokenLogic.sol
Sets the fee for each mint and burn Requirements: - `fee` must be less than or equal to 1% (1000)/
function setMintAndBurnFee(uint256 fee) public virtual { require(fee <= MAX_FEE, "ERC20: fee must be less than or equal to 1%"); _mintAndBurnFee = fee; }
3,799,878
pragma solidity ^0.4.24; // File: node_modules/openzeppelin-solidity/contracts/introspection/IERC165.sol /** * @title IERC165 * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md */ interface IERC165 { /** * @notice Query if a contract implements an interface * @param interfaceId The interf...
Internal function to add a token ID to the list of a given address to address representing the new owner of the given token ID tokenId uint256 ID of the token to be added to the tokens list of the given address/
function _addTokenTo(address to, uint256 tokenId) internal { super._addTokenTo(to, tokenId); uint256 length = _ownedTokens[to].length; _ownedTokens[to].push(tokenId); _ownedTokensIndex[tokenId] = length; }
538,544