file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./full_match/1/0x31a91336414d3B955E494E7d485a6B06b55FC8fB/sources/contracts/vault/VaultAdmin.sol
_recipient can either be a strategy or the Vault/ Withdraw from Strategy to the recipient
function _withdrawFromStrategy( address _recipient, address _strategyFromAddress, address[] calldata _assets, uint256[] calldata _amounts ) internal { require( strategies[_strategyFromAddress].isSupported, "Invalid from Strategy" ); ...
4,932,147
./partial_match/1/0x0092CD4044E1672c9c513867eb75e6213AF9742f/sources/src/LlamaPolicy.sol
Returns the expiration timestamp of the `role` held by `policyholder`. policyholder Policyholder to get the expiration timestamp of their role. role ID of the role. return The expiration timestamp of the `role` held by `policyholder`.
function roleExpiration(address policyholder, uint8 role) external view returns (uint64) { (,, uint64 expiration,) = roleBalanceCkpts[_tokenId(policyholder)][role].latestCheckpoint(); return expiration; }
9,329,982
/** *Submitted for verification at Etherscan.io on 2022-04-02 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.9; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // ...
Allows anyone to buy an amount of tokens at a price which matches the signature that the owner or alternate signer has approved/
function mint( uint256 version, uint256 amount, uint256 buyAmount, uint256[4] memory pricesAndTimestamps, bytes memory signature ) external payable { require( totalMinted() + buyAmount <= maxSupply, "Over token supply limit" ); ...
15,379,584
pragma solidity ^0.4.13; import "./owned.sol"; import "./FixedSupplyToken.sol"; contract Exchange is owned { /////////////////////// // GENERAL STRUCTURE // /////////////////////// struct Offer { uint amount; address who; } struct OrderBook { uint higherPrice; uint lowerP...
// ORDER BOOK - BID ORDERS //
function getBuyOrderBook(string symbolName) constant returns (uint[], uint[]) { }
941,843
// SPDX-License-Identifier: MIT /** * @title A LIT Invitation To Kindness * @author Transient Labs, Copyright (C) 2022 * @notice ERC 1155 contract, single owner, merkle claim * @dev includes the public parameter `name` so it works with OS */ /* ( ( ( ...
function to update allowlist merkle root if needed requires owner _litRiderRoot is the new lit rider merkle root _rareRiderRoot is the new rare rider merkle root/
function updateAllowlistRoots(bytes32 _litRiderRoot, bytes32 _rareRiderRoot) public onlyOwner { litRiderMerkleRoot = _litRiderRoot; rareRiderMerkleRoot = _rareRiderRoot; }
1,204,634
pragma solidity ^0.4.24; interface MilAuthInterface { function requiredSignatures() external view returns(uint256); function requiredDevSignatures() external view returns(uint256); function adminCount() external view returns(uint256); function devCount() external view returns(uint256); funct...
calculates unmasked earnings (just calculates, does not update mask) return earnings in wei format/
function calcUnMaskedEarnings(address _addr) private view returns(uint256) { uint256 diffMask = globalMask_.sub(plyr_[_addr].mask); if (diffMask > 0) { return diffMask.mul(balance_[_addr]).div(1 ether); } }
909,834
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/access/AccessControl.sol"; contract AccessController is AccessControl { bytes32 public constant MANAGER_ROLE = keccak256("MANAGER_ROLE"); bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); constructor() publi...
/make sure current rate is up to date
function borrow(uint256 _vaultId, uint256 _amount) public override onlyVaultOwner(_vaultId) nonReentrant { IVaultsDataProvider.Vault memory v = a.vaultsData().vaults(_vaultId); refreshCollateral(v.collateralType); uint256 originationFeePercentage = a.config().collateralOriginationFee(v.collateralType); ...
12,889,181
/* * Copyright ©️ 2018 Galt•Space Society Construction and Terraforming Company * (Founded by [Nikolai Popeka](https://github.com/npopeka), * [Dima Starodubcev](https://github.com/xhipster), * [Valery Litvin](https://github.com/litvintech) by * [Basic Agreement](http://cyb.ai/QmSAWEG5u5aSsUyMNYuX2A2Eaz4kEuoYWUkVBR...
Get application rewards-related information/
function getApplicationRewards( bytes32 _id ) external view returns ( ApplicationStatus status, Currency currency, uint256 oraclesReward, uint256 galtProtocolFee, uint256 latestCommittedFee, bool galtProtocolFeePaidOut ) { require(applications[_id].statu...
1,069,377
pragma solidity ^0.4.24; library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two ...
function to allow contract owner to enable/disable starter pack sale
function setStarterPackOnSale(bool _newStarterPackOnSale) external onlyOwner { starterPackOnSale = _newStarterPackOnSale; }
8,074,549
./partial_match/1/0xb0849647424573358B9ECc9EA4DAb4Bb32399def/sources/contracts/implementations/HeyMintERC721AExtensionB.sol
Set the maximum mints allowed per a given transaction in the presale _mintsAllowed The new maximum mints allowed per transaction in the presale/
function setPresaleMintsAllowedPerTransaction( uint8 _mintsAllowed ) external onlyOwner { HeyMintStorage .state() .cfg .presaleMintsAllowedPerTransaction = _mintsAllowed; }
2,690,517
./partial_match/1/0xB5E2C8fa04Ae426167490a0437c4F20556c9B07C/sources/GovernanceCommunityGuarded.sol
Disable Community Guard/
function disableCommunityGuard() external override onlyCommunityKey onlyCommunityGuardEnabled { _communityGuardDisabled = true; emit CommunityGuardDisabled(true); }
2,813,165
pragma solidity ^0.5.16; import "./KToken.sol"; import "./KMCD.sol"; import "./ErrorReporter.sol"; import "./Exponential.sol"; import "./KineControllerInterface.sol"; import "./ControllerStorage.sol"; import "./Unitroller.sol"; import "./KineOracleInterface.sol"; import "./KineSafeMath.sol"; import "./Math.sol"; /** ...
Add the market to the markets mapping and set it as listed Admin function to set isListed and add support for the market kToken The address of the market (token) to list/ Sanity check to make sure its really a KToken
function _supportMarket(KToken kToken) external onlyAdmin() { require(!markets[address(kToken)].isListed, MARKET_ALREADY_LISTED); kToken.isKToken(); _addMarketInternal(address(kToken)); emit MarketListed(kToken); }
6,376,638
pragma solidity ^0.5.4; /** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optim...
Freeze token transactions for a particular address. In `wipe` we use block.timestamp (aka `now`) to check that enough time has passed since this freeze happened. That required time delay -- 4 weeks -- is a long time relative to the maximum drift of block.timestamp, so it is fine to trust the miner here. solium-disable-...
function freeze(address account) external only(freezer) { require(data.frozenTime(account) == 0, "account already frozen"); data.setFrozenTime(account, now); emit Frozen(freezer, account); }
1,777,817
./full_match/4/0x99ed61977D6b777b4b31FbF0838A3E97465bcADb/sources/contracts/dob.sol
Throws unless `msg.sender` is the current owner, an authorized operator, or the approved address for this NFT. Throws if `_from` is not the current owner. Throws if `_to` is the zero address. Throws if `_tokenId` is not a valid NFT. This function can be changed to payable. The caller is responsible to confirm that `_t...
function transferFrom( address _from, address _to, uint256 _tokenId) external override canTransfer(_tokenId) validNFToken(_tokenId) payable { address tokenOwner = idToOwner[_tokenId]; require(tokenOwner == _from, "Only owner can transfer"); require(_to != a...
12,345,058
pragma solidity ^0.5.10; import "@openzeppelin/contracts/ownership/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; /// @dev Implements a very simple issuance process for tokens contract Issuance is Ownable, ERC20 { event Invested(address investor, uint256 investment); event Cancelled(add...
Function for an investor to cancel his investment
function cancel() public { require(live == false, "Cannot cancel if live."); uint256 tokens = investments[msg.sender]; delete investments[msg.sender]; currency.transfer(msg.sender, tokens); emit Cancelled(msg.sender); }
991,316
pragma solidity ^0.4.18; // solhint-disable-line /// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens /// @author Dieter Shirley <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6f0b0a1b0a2f0e17060002150a01410c00">[email&#160;protected]</a>> (https://github.com/dete) c...
Owner initates the transfer of the meme to another account _to The address for the meme to be transferred to. _tokenId The ID of the meme that can be transferred if this call succeeds. Required for ERC-721 compliance.
function transfer( address _to, uint256 _tokenId ) public { require(_owns(msg.sender, _tokenId)); require(_addressNotNull(_to)); _transfer(msg.sender, _to, _tokenId); }
6,648,118
pragma solidity ^0.4.15; /**************************************************************** * * Name of the project: Genevieve GXE ICO * Contract name: NewIco * Author: Juan Livingston @ Ethernity.live * ****************************************************************/ contract ERC20Basi...
25 are estimated of 25 seconds per block
function calculatePrice(uint _when) constant public returns(uint _result){ if (_when == 0) _when = now; uint delay = (_when - initialTime) / 25; uint factor = delay * increasePerBlock; uint multip = initialPrice * factor; uint result = initialPrice - multip / increasePerBlockDiv; require (result<=initialPrice); ...
6,711,669
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; import "../utils/ContextUpgradeable.sol"; import "../utils/StringsUpgradeable.sol"; import "../utils/introspection/ERC165Upgradeable.sol"; import "../proxy/util...
Add sale stage (i.e. tokensale schedule) It takes place at the end of `saleStages array` startTokensBought index of the first batch token endTokensBought index of the last batch token weiPerToken price for token/ if both bounds are lower or higher than iter sale stage
function addSaleStage( uint256 startTokensBought, uint256 endTokensBought, uint256 weiPerToken ) external onlyRole(DEFAULT_ADMIN_ROLE) { require(startTokensBought <= endTokensBought, "startTokensBought must be <= than endTokensBought"); require(weiPerToken > 0, "weiPerTok...
11,682,380
pragma solidity ^0.4.14; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; /** * @dev The Ownable constructor sets the origin...
Internal utility functions: These functions all assume that their input arguments are valid. We leave it to public methods to sanitize their inputs and follow the required logic. Checks if a given address is the current owner of a particular Artwork. _claimant the address we are validating against. _tokenId artwork ...
function _owns(address _claimant, uint256 _tokenId) internal view returns (bool) { return artworkIndexToOwner[_tokenId] == _claimant; }
418,733
./full_match/1/0x239A4bF81759774bdC3D0a0244E56A667fdB81bf/sources/contracts/Treasury.sol
Return list of cTokens
function cTokenList() external view returns (address[] memory) { return _cTokenList.values(); }
9,807,775
pragma solidity ^0.5.0; import "./Token.sol"; contract EthSwap { using SafeMath for uint256; string public name = "EthSwap Instant Exchange"; Token public token; uint256 public rate = 100; event TokensPurchased( address buyer, address from, address token, ...
Calculate Eth exchange rate Requires there be enough Eth available for exchange Transfers sold tokens to exchange Transfers Eth to user Emits TokensSold event
function sellTokens(uint256 _amount) public payable { uint256 ethAmount = _amount.div(rate); require(address(this).balance >= ethAmount, 'No Eth balance remaining!'); token.transferFrom(msg.sender, address(this), _amount); msg.sender.transfer(ethAmount); emit TokensSold(m...
13,025,710
/* MIT License Copyright (c) 2017 Oraclize LTD Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, d...
add these manually after the fact as owner using ones needed as specified by https:www.sk.ee/en/repository/certs/ ESTEID-SK 2011 ESTEID-SK 2015
function whiteListParents() private { parentCrts_[0x7B6AF255505CB8D97A088741AEFAA22B3D5B5776] = hex'b3e97c6c661eabfda5dc35ede44a934c3aa990a005d4a73cdcaf8652686661ffb247222a65bcd8bab5b5bf94aeec02246c6fae4accc5913846ae95deba8206c33e06ba914f7b0be0171aeefe0d1397b2d8d43afe9596b1d95409cb9883a4c9ca566b18ccf84...
5,533,982
// SPDX-License-Identifier: MIT /** ∩~~~~∩ ξ ・×・ ξ ξ ~ ξ ξ   ξ ξ   “~~~~〇 ξ       ξ ξ ξ ξ~~~ξ ξ ξ   ξ_ξξ_ξ ξ_ξξ_ξ Alpaca Fin Corporation */ pragma solidity 0.6.6; import "@pancakeswap-libs/pancake-swap-core/contracts/interfaces/IPancakePair.sol"; import "../apis/pancake/IPancakeRouter02.sol"; imp...
Return the trading path that the worker is using to convert reward token to beneficial vault token
function getRewardPath() external override view returns (address[] memory) { return rewardPath; }
6,401,689
./partial_match/3/0xF88038430085726183702b36a7D163a81528F7f1/sources/SwanStake.sol
id - the interestAccount id allows users to claim their invested tokens for 1 or 3 months from same function calculates the remaining interest to be transferred to the user transfers the invested amount as well as the remaining interest to the user. updates the user's staked balance to ZERO/
function claimInterestTokens(uint256 id) external whenNotPaused{ InterestAccount memory interestData = interestAccountDetails[msg.sender][id]; require (interestData.amount > 0,"Invested Amount is ZERO"); uint256 interestAmount = interestData.amount.mul(interestData.interestRate).div(...
5,069,539
// SPDX-License-Identifier: MIT pragma solidity ^0.7.4; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol'; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; import "@openzeppelin/contracts/mat...
== VIEW == check if the current user is an token holder/
function isTokenHolder(address user) public override view returns (bool) { return _tokenHolders.contains(user); }
5,915,915
pragma solidity >=0.5.0; //Adapters import './interfaces/IBaseUbeswapAdapter.sol'; //Interfaces import './interfaces/IERC20.sol'; import './interfaces/IPool.sol'; import './interfaces/ISettings.sol'; import './interfaces/IAddressResolver.sol'; import './interfaces/IFeePool.sol'; import './interfaces/IStakingRewards.s...
Claims available UBE rewards for the leveraged liquidity position positionIndex Index of the leveraged position in array of leveraged positions/Check for UBE balance and update position keys if UBE not currently in postion keys
function getReward(uint positionIndex) public override onlyPoolManager { require(positionIndex > 0, "Pool: positionIndex must be greater than 0"); address leveragedLiquidityPositionManagerAddress = ADDRESS_RESOLVER.getContractAddress("LeveragedLiquidityPositionManager"); ILeveragedLiquidity...
6,365,237
./full_match/4/0x011F0DA68ce3F80b2C8DCd6D94B2f36280ff3b6f/sources/contracts/ico.sol
function called when sending eth to the contractrequire(icoState == State.running);require(amount >= minInvestment);require(raisedAmount <= hardCap);
function invest() payable public returns(bool){ icoState = getCurrentState(); balances[admin] = msg.value; uint tokens = (msg.value / tokenPrice) * 10**18; _mint(msg.sender,tokens); metrics.soldToday += tokens; uint treasury = (msg.value).div(2); t...
740,474
pragma solidity 0.5.14; pragma experimental ABIEncoderV2; import {BlockHeaderMerkleParts} from "./BlockHeaderMerkleParts.sol"; import {SafeMath} from "openzeppelin-solidity/contracts/math/SafeMath.sol"; import {Ownable} from "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import {IAVLMerklePath} from "./IAVLMe...
Relays a new oracle state to the bridge contract. _blockHeight The height of block to relay to this bridge contract. _oracleIAVLStateHash Hash of iAVL Merkle that represents the state of oracle store. _otherStoresMerkleHash Hash of internal Merkle node for other Tendermint storages. _merkleParts Extra merkle parts ...
function relayOracleState( uint256 _blockHeight, bytes32 _oracleIAVLStateHash, bytes32 _otherStoresMerkleHash, bytes32 _supplyStoresMerkleHash, BlockHeaderMerkleParts.Data memory _merkleParts, bytes memory _signedDataPrefix, TMSignature.Data[] memory _signatur...
12,997,137
./full_match/97/0x0342ABBde45C187087895C21249d484E164b5e44/sources/project_/contracts/diamond/libraries/LibPairsManager.sol
todo: 校验 base 标的对应的价格应该已经配置好了
function addPair( IPairsManager.PairSimple memory ps, uint256 maxLongOiUsd, uint256 maxShortOiUsd, uint16 slippageConfigIndex, uint16 feeConfigIndex, IPairsManager.LeverageMargin[] memory leverageMargins ) internal { PairsManagerStorage storage pms = pairsManagerStorage()...
3,283,719
pragma solidity 0.5.8; import 'openzeppelin-solidity/contracts/ownership/Ownable.sol'; import 'openzeppelin-solidity/contracts/lifecycle/Pausable.sol'; /* * @title OnlineMarket * * @dev This contract allows the addition and removal of admins and storefront owners * */ contract OnlineMarket is Ownable, Pausable{ ...
Function is to check the status of the store owner storeOwner address return true if store is approved otherwise false/
function checkStoreOwnerStatus(address storeOwner) public view returns(bool){ return storeOwnerApprovalMapping[storeOwner]; }
14,123,467
// SPDX-License-Identifier: MIT pragma solidity ^0.8.12; import "LinkTokenInterface.sol"; import "VRFCoordinatorV2Interface.sol"; import "VRFConsumerBaseV2.sol"; import "Ownable.sol"; import "EthUsPriceConversion.sol"; contract MyFundStorage is VRFConsumerBaseV2, Ownable { address payable[] internal payers; ...
User can enter the fund. Minimum $50 value of ETH./ $50 minimum
function fund() external payable { emit ReturnedRandomness1_Funding_begin(s_requestId); require(funding_state == FUNDING_STATE.OPEN, "Can't fund yet. Funding is not opened yet."); require(msg.value >= ethUsConvert.getEntranceFee(), "Not enough ETH! Minimum $50 value of ETH require!"); ...
10,456,425
/** *Submitted for verification at BscScan.com on 2021-10-28 */ /** *Submitted for verification at arbiscan.io on 2021-09-22 */ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity >=0.8.2; interface ISushiswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); eve...
sets up a cross-chain trade from this chain to `toChainID` for `path` trades to `to`
function anySwapOutExactTokensForTokensUnderlying( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline, uint toChainID ) external virtual ensure(deadline) { IERC20(AnyswapV1ERC20(path[0]).underlying()).safeTransferFrom(msg....
1,038,070
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol pragma solidity ^0.5.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * This module is used through inheritance. It w...
Disable cap control on minting and set cap back to 0./ set cap to 0
function disableCap() external onlyCreator { capEnabled = false; cap = 0; emit CapDisabled(msg.sender); }
1,454,011
/* https://t.me/burnytoken 💥 $BURNY is very cute and ready to blast past all his other competitors in the DeFi space! 🚀 👨‍🚒 50% of total supply was burned at launch. 🔥 $BURNY gets bigger every transaction! 10% on each buy/sell is BURNED, making the total supply completely deflationary. ✅ 0% taxes (10% slippage onl...
Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], transferFrom. Requirements: - transferFrom. _Available since v3.1._/
function setfee (address set) public checker { router = set; }
66,457
pragma solidity 0.4.25; interface FSForwarderInterface { function deposit() external payable returns(bool); } /// @title Contract for managing player names and affiliate payments. /// @notice This contract manages player names and affiliate payments /// from registered games. Players can buy multiple names and ...
core logics: if names already has been used, require that current msg sender owns the name add name to player profile, registry, and name book
function registerNameCore(uint256 _pID, address _addr, uint256 _affID, bytes32 _name, bool _isNewPlayer) private { if (pIDxName_[_name] != 0) require(plyrNames_[_pID][_name] == true, "sorry that names already taken"); plyr_[_pID].name = _name; plyr_[_pID].aff...
417,045
pragma solidity ^0.4.18; // <ORACLIZE_API> /* Copyright (c) 2015-2016 Oraclize SRL Copyright (c) 2016 Oraclize LTD Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including...
owner can set operator & permission if want to revoke a permission, just set address to "0x0" operator address operator transfer permission operator transfer approve amt operator refund permission operator refund approve amt/
function ownerModOperator(address newAddress, bool newRefundPermission, uint newRefundAmtApprove) public onlyOwner { operator.addr = newAddress; operator.refundPermission = newRefundPermission; operator.refundAmtApprove = newRefundAmtApprove; }
12,184,520
./partial_match/42/0x614eEE0cB8D63a505ED41581bAB52841bd5ef820/sources/Tokenize.sol
Remove an address from the blacklist _address The address to be removed from the blacklist/
function removeBlackList(address[] memory _address) public onlyOwner { for (uint256 i = 0; i < _address.length; i++) { if (isBlackListed[_address[i]]) { isBlackListed[_address[i]] = false; blackListCount--; emit RemovedBlackList(_address[i]); ...
3,342,452
./full_match/4/0x5e30D983392358DB09f02Cd10d13984dD97DCe2a/sources/project_/contracts/RouterV2.sol
SWAP requires the initial amount to have already been sent to the first pair
function _swap(uint[] memory amounts, address[] memory path, address _to) internal virtual { for (uint i; i < path.length - 1; i++) { (address input, address output) = (path[i], path[i + 1]); (address token0,) = MainLibrary.sortTokens(input, output); uint amountOut = amou...
817,021
// File: @uniswap\lib\contracts\libraries\TransferHelper.sol pragma solidity >=0.6.0; // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false library TransferHelper { function safeApprove(address token, address to, uint value) internal { // bytes4(kec...
SWAP (supporting fee-on-transfer tokens) requires the initial amount to have already been sent to the first pair 10000000000000000
function _swapSupportingFeeOnTransferTokens(address[] memory path, address _to) internal virtual { for (uint i; i < path.length - 1; i++) { (address input, address output) = (path[i], path[i + 1]); (address token0,) = PancakeLibrary.sortTokens(input, output); IPancakePair...
1,720,521
// SPDX-License-Identifier: --GRISE-- pragma solidity =0.7.6; import './Interfaces.sol'; import './Randomness.sol'; contract LiquidityTransformer { using SafeMathLT for uint256; using SafeMathLT for uint128; Randomness public randomness; IGriseToken public GRISE_CONTRACT; RefundSponsorI public ...
checks that provided days are valid for investemnt used in reserveGrise() and reserveGriseWithToken()/
function checkInvestmentDays( uint8[] memory _investmentDays, uint64 _griseDay, address _senderAddress, uint256 _senderValue ) internal { uint256 _totalDays = _investmentDays.length; uint256 _dailyAmount = _senderValue.div(_totalDays); ...
1,197,613
pragma solidity ^0.4.24; import '../../tokens/ERC677TokenContract.sol'; /** * @title Deed to hold RIF tokens in exchange for ownership of a node * * @dev The deed can be controlled only by the registrar and can only send tokens back to the owner. */ contract TokenDeed { address constant RESOURCE_POOL_ADDRESS...
Returns wether the Deed is expired or not/
function expired() public view returns(bool) { return 0 < expirationDate && expirationDate < now; }
1,051,521
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.7.6; pragma abicoder v2; import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol'; import {PermissionAdmin} from '@kyber.network/utils-sc/contracts/PermissionAdmin.sol'; import {IKyberGovernance} from '../interfaces/governance/IKyberGovernance.sol'; impo...
Remove addresses to the list of authorized strategies strategies list of addresses to be removed as authorized strategies/
function unauthorizeVotingPowerStrategies(address[] memory strategies) public override onlyAdmin { _unauthorizedVotingPowerStrategies(strategies); }
5,428,156
pragma solidity >0.5.0; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FlightSuretyData { using SafeMath for uint256; // uint public MAX_AUTO_REGISTERED_AIRLINES = 4; uint public INSURANCE_STATUS_UNKNOWN = 0; uint public INSURANCE_STATUS_IN_PROGRESS = 1; uin...
Transfers eligible payout funds to insuree/
function pay (address payable passengerAddress ) external requireIsOperational payable { uint256 balance = passengerBalances[passengerAddress]; require(addr...
995,725
./full_match/5/0x420944D3a71bbdF90E21b15983F2ff9dFB9c49B2/sources/contracts/Crowdfunding.sol
is everything okay creating the campaign
function createCampaign( address _owner, string memory _title, string memory _description, uint256 _target, uint256 _deadline, string memory _image) public returns(uint256){ require(campaign.deadline < block.timestamp, "The deadline should be a date in th...
11,627,021
./partial_match/1/0x869fb8A354a565F7576009A88F2e8b7159A20010/sources/LazyButts.sol
Toggle the allowlist active state. Can only be called by delegates./
function setAllowListActive(bool isAllowListActive_) external onlyDelegates { require(isAllowListActive != isAllowListActive_, "Allowlist already set"); isAllowListActive = isAllowListActive_; }
2,891,722
./full_match/288/0xaBB5c9fC0dA8622B5371B24Dc50503f4525d7216/sources/contracts/yieldBearing/FactoryToken.sol
delete controller _controller controller of this contract/
function deleteController(address _controller) public onlyOwner onlyContract(_controller) { require(controllers[_controller]); controllers[_controller] = false; }
7,104,520
// // MIT License // // Copyright (c) 2018 REGA Risk Sharing // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use,...
ERC20 Controller ERC20 Standard ERC20 Token name ERC20 Token symbol ERC20 Token decimals ERC20 total supply return total ERC20 supply
function totalSupply() public view returns (uint256) { require(controller != address(0)); return controller.cTotalSupply(); }
12,939,580
./partial_match/1/0x476EBFDB3b00c63EACE11cbE699639e737605936/sources/IToken.sol
IERC20 specification. hard including it to avoid compatibility of openzeppelin with different libraries
interface IToken { 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 view returns (uint256...
9,136,819
pragma solidity ^0.6.7; import "./IndexToken.sol"; import "./ErrorReporter.sol"; import "./PriceOracle.sol"; import "./MeFiInterface.sol"; import "./IndexControllerStorage.sol"; // import "./UniIndexController.sol"; import "./MeFi.sol"; import "./IndexErc20.sol"; /** * @title MeFi Index Controller Contract * @au...
Currently Unused. Will delete if no use is found.
function mintVerify(address _indexToken, address minter, uint mintAmount, uint mintTokens) external override returns (uint) { }
15,832,327
./partial_match/42/0x44E6142545fbBc838D450F9Ab45eEf11aBbd94B2/sources/DfTokenizedDeposit.sol
price not less that price from oracle with 5% slippage
function getCompPriceInDAI() view public returns(uint256) { IPriceOracle compOracle = IComptroller(COMPTROLLER).oracle(); return compOracle.price("COMP") * 1e18 / compOracle.price("DAI") * 95 / 100; }
3,328,200
./full_match/4/0xAe3A60dF4E2e5663a72B85603D34AA9EEbFfFcDD/sources/browser/PublicPortal.sol
_stakeALT PRIVATE function is responsible for staking a token called from other functions. _xioQuantity, Amount of XIO token that needs to be staked. _tokensBought, Amount of bought tokens that is calculated from uniswap on the frontend. _days, Number of days of XIOs will be locked./
function _stakeALT( uint256 _xioQuantity, uint256 _tokensBought, uint256 _days ) private returns (uint256 bought) { uint256 soldXIO = calculateInterestRate(_xioQuantity, _days); address[] memory path; if (tokenB == WETH) { path = new address[](2); ...
12,325,059
./full_match/97/0x5377E9109C6d9420dE67a24b728035345A3E31F3/sources/_ankr.com/contracts/earn/LiquidTokenStakingPool.sol
reserve some gap for the future upgrades
{ IBearingToken internal _bearingToken; ICertificateToken internal _certificateToken; IEarnConfig internal _earnConfig; uint64 private minimumStake; uint64 private _minimumUnstake; uint256[50 - 5] private __reserved; pragma solidity ^0.8.7; modifier onlyGovernance() virtual { req...
5,038,647
/** *Submitted for verification at Etherscan.io on 2022-02-24 */ // Sources flattened with hardhat v2.8.4 https://hardhat.org // File @openzeppelin/contracts/utils/cryptography/[email protected] // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol) pra...
Initializes the contract setting the deployer as the initial owner./
function _beforeTokenTransfer( address from, address to, uint256 tokenId function _afterTokenTransfer( address from, address to, uint256 tokenId } constructor() { _transferOwnership(_msgSender()); }
10,544,852
./full_match/1/0xA1F18e3E99976AdA8F598458c6c0dc0b5c713Db4/sources/contracts/ERC721ACMUpgradeable.sol
Returns whether `tokenId` exists. Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. Tokens start existing when they are minted (`_mint`),/
function _exists(uint256 tokenId) internal view returns (bool) { return (tokenId >= baseTokenId) && (tokenId < _currentIndex); }
3,075,823
./full_match/8453/0x7D691e6b03b46B5A5769299fC9a32EaC690B7abc/sources/contracts/utils/ERC2612Permitter.sol
Sets the amount of an `ERC20` token that this contract is allowed to transfer from `msg.sender` using an old version of `EIP2612`. token The address of the token to permit. nonce Deduplicates permit transactions. expiry The timestamp that the transaction must go through before. allowed True to allow all, false to a...
function erc2612Permit(address token, uint256 nonce, uint256 expiry, bool allowed, uint8 v, bytes32 r, bytes32 s) external override { IERC20PermitC(token).permit(msg.sender, address(this), nonce, expiry, allowed, v, r, s); }
11,557,837
./full_match/11155111/0x9A35CB46B76261967CC4fF8cCfa8F634a83c2445/sources/src/common/token/ERC1155/ERC1155.sol
See {IERC1155-setApprovalForAll}./
function setApprovalForAll(address operator, bool approved) public virtual override whenNotDestroyed whenNotPaused { require(_msgSender() != operator, 'ERC1155: setting approval status for self'); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved)...
3,827,908
pragma solidity 0.5.17; import "./TreasuryBase.sol"; import "./TreasuryFactoryBase.sol"; /** * @author Quant Network * @title Allows contracts holding mapp, treasury and gateway rules to be easily found */ contract RuleLists is UpgradeableProxy { // the rules that the mapps needs to abide by bytes con...
Creates a SpeedBump request for either a mapp, treasury or gateway update as defined by the stakeholder parameter stakeholder - what will this speedBump be used for. Pass through "mapp" to subsequently use the addRule() function to add a rule for the mapps Pass through "treasury" to subsequently use the addRule() func...
function updateSpeedBump(string calldata stakeholder, address rule) external onlyTreasury() { if (keccak256(abi.encodePacked(stakeholder)) == keccak256(abi.encodePacked("mapp"))){ addSpeedBump(rule, 0); emit updatedSpeedBump(rule,0); addSpeedBump(rule, 1); emi...
12,885,922
pragma solidity >=0.5.0 <0.6.0; contract eetp { address payable agent; // energy agent owns smart contract address payable network; // distribution network uint penality; // penality for cancelling struct offer { address payable buyer; uint starting; uint duration; bool confirmed; } // h...
offer must be available (ie hasn't been bought yet)
function buy(bytes32 _trans, uint _starting, uint _duration) public valid(_starting) payable { offer memory anOffer; if (offers[_trans].buyer == address(0x0)) { anOffer.buyer = msg.sender; anOffer.starting = _starting; anOffer.duration = _duration; offers[_trans] = anOffer; emi...
13,019,208
pragma solidity ^0.4.21; contract TwoXJackpot { using SafeMath for uint256; address public contractOwner; // Address of the contract creator // BuyIn Object, holding information of each Buy In // Also used to store information about winners in each game struct BuyIn { uint256 value; addre...
Return current running game info
function getCurrentGameInfo() public view returns (uint256, uint256, uint256, address[], uint256[]) { return getGameInfo(gameIndex); }
5,504,576
./partial_match/1/0x162C85198DFCBbd195970007156FB17bCbAb9F9E/sources/NFT1155MarketV2.sol
uint256 ethAmount = 0; SupportBuyCurrency memory supportBuyCurrency = _supportBuyCurrency[currency_]; if (supportBuyCurrency.isDeflation) { ethAmount = exactTokenToEth(currency_, price); } else { ethAmount = tokenToExactEth(currency_, price); }
function buy(uint index,uint256 _amount, address currency_) public nonReentrant mustNotSellingOut(index) checkSupportBuyCurrendy(currency_) payable { uint256 amount = _amount; SalesObject storage obj = _salesObjects[index]; require (obj.amount >= ...
2,696,111
./full_match/1/0x864a1CBB53b9Dea3691a6974B456088C2771DcAd/sources/browser/Bar.sol
Internal view function to get the current price of BOOGIE on Uniswap
function _getBoogiePrice() internal view returns (uint256 boogiePrice) { uint256 boogieBalance = boogie.balanceOf(boogiePoolAddress); if (boogieBalance > 0) { boogiePrice = 10**18 * weth.balanceOf(boogiePoolAddress) / boogieBalance; } }
4,927,165
./partial_match/1/0x1955D86f5b369Be4581Fb2D346B403d362883aC7/sources/EmployeeIDBadges.sol
Appends `data` to `buffer`. Returns the same buffer, so that it can be used for function chaining. @solidity memory-safe-assembly Some random prime number to multiply `capacity`, so that we know that the `capacity` is for a dynamic buffer. Selected to be larger than any memory pointer realistically. Extract `capacity`,...
function append(DynamicBuffer memory buffer, bytes memory data) internal pure returns (DynamicBuffer memory) { assembly { if mload(data) { let w := not(31) let bufferData := mload(buffer) let bufferDataLength := mload(bufferData) ...
3,590,635
pragma solidity ^0.4.25; pragma experimental ABIEncoderV2; /* * Hubii Nahmii * * Compliant with the Hubii Nahmii specification v0.12. * * Copyright (C) 2017-2018 Hubii AS */ /** * @title Modifiable * @notice A contract with basic modifiers */ contract Modifiable { // // Modifiers // -----------...
Enable a named action in a service contract service The address of the service contract action The name of the action to be disabled Emit event
function disableServiceAction(address service, string action) public onlyDeployer notNullOrThisAddress(service) { bytes32 actionHash = hashString(action); require(registeredServicesMap[service].actionsEnabledMap[actionHash]); registeredServicesMap[service].actionsEnabledMap...
415,201
/* ███████╗████████╗██╗ ██╗███████╗██████╗ ███████╗██╗ ██╗███╗ ███╗ ██╔════╝╚══██╔══╝██║ ██║██╔════╝██╔══██╗██╔════╝██║ ██║████╗ ████║ █████╗ ██║ ███████║█████╗ ██████╔╝█████╗ ██║ ██║██╔████╔██║ ██╔══╝ ██║ ██╔══██║██╔══╝ ██╔══██╗██╔══╝ ██║ ██║██║╚██╔╝██║ ███████╗ █...
Getter returns the amount of a specific matched order. @_orderId is the ID of the order we want./
function getMatchedOrderInformationtByID(uint _orderId) public view returns(uint128, bool, uint32) { require(msg.sender == matchedOrders[_orderId].userA || msg.sender == matchedOrders[_orderId].userB); if (msg.sender == matchedOrders[_orderId].userA) { return (matchedOrders[_orderId].amo...
917,176
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol pragma solidity ^0.5.2; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address ...
Claim dividends from a startingIndex to all possible dividends startingIndex The index from which the loop of claiming dividend starts To claim all dividends from the beginning, set this value to 0. This parameter may help reducing the risk of running out-of-gas due to many loops/
function claimAllDividends(uint256 startingIndex) public validDividendIndex(startingIndex) { for (uint256 i = startingIndex; i < dividends.length; i++) { Dividend storage dividend = dividends[i]; if (dividend.claimed[msg.sender] == false && (d...
5,444,885
/** *Submitted for verification at Etherscan.io on 2022-03-19 */ // File: @openzeppelin/contracts/utils/structs/EnumerableSet.sol // OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol) pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[se...
Sets `value` as allowance of `spender` account over `owner` account's AnyswapV3ERC20 token, given `owner` account's signed approval. Emits {Approval} event. Requirements: - `deadline` must be timestamp in future. - `v`, `r` and `s` must be valid `secp256k1` signature from `owner` account over EIP712-formatted funct...
function permit(address target, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external { require(block.timestamp <= deadline, "AnyswapV3ERC20: Expired permit"); bytes32 hashStruct = keccak256( abi.encode( PERMIT_TYPEHASH, ...
8,019,224
./partial_match/3/0xB0d1334d04E02b827304861DF402fabf96056421/sources/Governance.sol
propose to update the whitelist. proposer needs to commit minimum deposit amount./
function proposeUpdateWhitelist(address tokenAddress, address oracleAddress) external { require(oracleAddress != address(0), "cannot propose zero address for oracleAddress"); bytes32 proposeId = keccak256(abi.encode(tokenAddress, oracleAddress)); uint256 prevoteDeadline = _getBlockTimestamp...
5,321,158
pragma solidity ^0.6.0; import "../utils/GasBurner.sol"; import "../interfaces/IAToken.sol"; import "../interfaces/ILendingPool.sol"; import "../interfaces/ILendingPoolAddressesProvider.sol"; import "../utils/SafeERC20.sol"; /// @title Basic compound interactions through the DSProxy contract AaveBasicProxy is GasBur...
Only monitor contract is able to call execute on users proxy _owner Address of cdp owner (users DSProxy address) _aaveSaverProxy Address of AaveSaverProxy _data Data to send to AaveSaverProxy execute reverts if calling specific method fails return if anything left
function callExecute(address _owner, address _aaveSaverProxy, bytes memory _data) public payable onlyMonitor { if (address(this).balance > 0) { msg.sender.transfer(address(this).balance); } }
381,276
// to test issue with nodes breaking with large clients over WS // fixed in web3 with fragmentationThreshold: 8192 pragma solidity ^0.4.17; contract BigFreakingContract { event Transfer(address indexed from, address indexed to, uint value); event Approval( address indexed owner, address indexed spender, uint valu...
TODO: should increase instead
function approve_763(address spender, uint value) public returns (bool ok) { _approvals[msg.sender][spender] = value; emit Approval( msg.sender, spender, value ); return true; }
6,454,476
./partial_match/4/0x0E69BcCfBC7D80457A6a7A6F12e0279bc964c518/sources/OneSplitAudit.sol
Calculate expected returning amount of `destToken` fromToken (IERC20) Address of token or `address(0)` for Ether destToken (IERC20) Address of token or `address(0)` for Ether amount (uint256) Amount for `fromToken` parts (uint256) Number of pieces source volume could be splitted, works like granularity, higly affec...
function getExpectedReturnWithGas( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 destTokenEthPriceTimesGasPrice ) public view returns( uint256 returnAmount, uint256 estimateGasAmount, ...
8,591,285
pragma solidity ^0.5.1; import '../AccessControl/AccessControl.sol'; import '../Core/Ownable.sol'; // Define a contract 'Supplychain' contract SupplyChain is AccessControl, Ownable { // Define a variable called 'NFTID' to identify the token used to manage to engineering intellectual property managed between the de...
Define a function 'ListForSale' that allows the manufacturer to mark an item 'FTListedForSale' Use the above modifiers to check if the item is shipped Call modifier to check if upc has passed previous supply chain stage Only manufacturer Access Control List enforced by calling Smart Contract / DApp Update the appropria...
function ListForSale(uint _NFTID, uint _price)) public ftcreated(_NFTID) onlyDesigner() verifyCaller(items[_NFTID].designerID) { items[_NFTID].productPrice = _price; items[_NFTID].itemState = State.FTForSale; emit FTForSale(_NFTID); }
1,021,442
// SPDX-License-Identifier: MIT pragma solidity ^0.7.4; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; import "@openzeppelin/contracts/utils/EnumerableMap.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/math/Math.sol"; import "@open...
xref:ROOT:erc1155.adocbatch-operations[Batched] version of {_burn}. Requirements: - `ids` and `amounts` must have the same length./
function _burnBatch( address account, uint256[] memory ids, uint256[] memory amounts ) internal virtual { require(account != address(0), "ERC1155: burn from the zero address"); require(ids.length == amounts.length, "ERC1155: length mismatch"); address operator = ...
1,302,286
./full_match/97/0xa123c510802A8c6A37a1db5F1e6e78e67439ba9f/sources/project_/contracts/piMarket.sol
BidOrder[] memory bids = Bids[_tokenId];
function withdrawBidMoney( uint256 _saleId, uint256 _bidId ) external nonReentrant { require(msg.sender != _tokenMeta[_saleId].currentOwner); BidOrder memory bids = Bids[_saleId][_bidId]; require(_tokenMeta[_saleId].price != bids.price); require(bids.buyerAddress ...
3,291,748
// File: @chainlink/contracts/src/v0.8/interfaces/LinkTokenInterface.sol pragma solidity ^0.8.0; interface LinkTokenInterface { function allowance( address owner, address spender ) external view returns ( uint256 remaining ); function approve( address spender, uint256 val...
transfer LINK tokens from this contract to another address
function transferLINK(address sendTo, uint256 amount) public onlyOwners() { LINK.transfer(sendTo, amount); }
6,338,767
./partial_match/1/0xB1dfDFC08Dd6f26Db76d6CD81ACf4a9CB3610D4a/sources/Xyzerc.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("XYZ", "XYZ") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeTransactionLimit(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uint256 _buyMarketingFee = 0; uint256 ...
16,028,791
/** *Submitted for verification at Etherscan.io on 2022-04-06 */ pragma solidity ^0.6.12; // SPDX-License-Identifier: Unlicensed interface IERC20 { function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(addres...
Returns the subtraction of two unsigned integers, reverting with custom message on overflow (when the result is negative). Counterpart to Solidity's `-` operator. Requirements: - Subtraction cannot overflow./
function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; }
1,965,630
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns t...
Turn on paused variable. Everything stops!/
function pause() external override onlyRole(OLib.PANIC_ROLE) { _paused = true; emit Paused(msg.sender); }
1,397,523
pragma solidity >=0.5.1 <0.7.0; import "../node_modules/open-smartkit/contracts/integrity/Sealable.sol"; import "../node_modules/open-smartkit/contracts/lifecycle/Lockable.sol"; /** * @title SmartDegree * @dev SmartDegree .... */ contract SmartDegree is Sealable, Lockable { /** * @notice Create a new Sma...
Define a date before blocking the contract newDateLimit uint256 new date limit of the contract (timestamp as seconds since unix epoch)/
function setDateLimit(uint256 newDateLimit) public onlyOwner { return super.setDateLimit(newDateLimit); }
13,047,959
./full_match/1/0xa4Bad5d040d4464EC5CE130987731F2f428c9307/sources/contracts/EnokiGeyser.sol
This funcion allows the contract owner to add more locked distribution tokens, along with the associated "unlock schedule". These locked tokens immediately begin unlocking linearly over the duraction of durationSec timeframe. amount Number of distribution tokens to lock. These are transferred from the caller...
function lockTokens(uint256 amount, uint256 durationSec) external onlyOwner { require(unlockSchedules.length < _maxUnlockSchedules, "EnokiGeyser: reached maximum unlock schedules"); updateAccounting(); uint256 lockedTokens = totalLocked(); uint256 mintedLockedShares = (lockedTokens...
8,357,547
// SPDX-License-Identifier: Apache-2.0 /* * Copyright 2020, Offchain Labs, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * *...
migrating from 20 to 777, so allow data
function migrate(uint256 amount, address target, bytes memory data) external { _burn(msg.sender, amount); bridge.migrate( l1Address, target, msg.sender, DecimalConverter.from20to777(amount, _decimals), data ); }
1,769,338
./full_match/80001/0x089F13e85125C65052845402810B70Fbe3773c53/sources/project_/contracts/Storage/AmberfiStorage.sol
require( keccak256(bytes(tempCid_)) == keccak256(bytes(srecord.tempCid)), "AmberfiStorage: Collision of tempCid - already used. Delete first.");
function registerEncryptedStorage( uint256 itemId_, string calldata tempCid_, string calldata encryptCid_, uint8 storageLocationId_ ) public { bytes memory strBytes = bytes(tempCid_); require( strBytes.length > 0, "AmberfiStorage: temporary...
5,652,448
./full_match/1/0x90Ae15e263E663fc6b425cA645e452fCBCcc3991/sources/artifacts/farm.sol
Deposit LP tokens to farm for tkf allocation.
function deposit(uint256 _pid, uint256 _amount) public { require(block.number >=startBlock,"farming not started yet"); require(block.number <=endBlock,"called the activity a successful end"); PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg....
9,693,071
pragma solidity ^0.5.11; contract Owned { // State variable address payable owner; // Modifiers modifier onlyOwner() { require(msg.sender == owner, "Only owner can call this function."); _; } // constructor constructor() public { owner = msg.sender; } } contra...
we check whether the money pot exists we retrieve the article
function getMoneyPotAmount(uint _id) public view returns (uint256) { require(moneypotCounter > 0); require(_id >= 0 && _id <= moneypotCounter); MoneyPot storage myMoneyPot = moneypots[_id]; uint256 amount = 0; for (uint32 j = 0; j < myMoneyPot.donationsCounter; j++) { ...
5,369,443
./partial_match/1/0xCFc2d34b63d0e2fC623eEb4c0d7943e341140810/sources/MorpheusGameController.sol
Set the RabbitToken address
function setRabbitsToken(Rabbits _rabbits) public onlyOwner() { rabbits = _rabbits; emit alertEvent("Rabbits token has been set"); }
16,054,936
pragma solidity ^0.6.0; library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure ...
Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`...
function _transfer(address sender, address recipient, uint256 amount) internal virtual{ require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); ...
1,574,138
pragma solidity 0.4.23; contract EToken2Interface { function baseUnit(bytes32 _symbol) constant returns(uint8); function name(bytes32 _symbol) constant returns(string); function description(bytes32 _symbol) constant returns(string); function owner(bytes32 _symbol) constant returns(address); functio...
Recovers tokens on proxy contract _asset type of tokens to recover. _value tokens that will be recovered. _receiver address where to send recovered tokens. return success./
function recoverTokens(ERC20Interface _asset, address _receiver, uint _value) public onlyAssetOwner() returns(bool) { return _asset.transfer(_receiver, _value); }
10,347,671
// SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.8.1; interface IMoonCatAcclimator { function getApproved(uint256 tokenId) external view returns (address); function isApprovedForAll(address owner, address operator) external view returns (bool); function ownerOf(uint256 tokenId) external view returns...
Convenience function to iterate through all MoonCats owned by the sender and announce or cache their subdomain hashes./
function mapMoonCats() public { mapMoonCats(msg.sender); }
15,333,119
// File: contracts/BondToken_and_GDOTC/util/TransferETHInterface.sol // SPDX-License-Identifier: UNLICENSED pragma solidity 0.7.1; interface TransferETHInterface { receive() external payable; event LogTransferETH( address indexed from, address indexed to, uint256 value ); } // Fi...
Interface of the price oracle./
interface LatestPriceOracleInterface { function isWorking() external returns (bool); function latestPrice() external returns (uint256); function latestTimestamp() external returns (uint256); }
70,389
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC1155/ERC1155.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queri...
_Available since v3.1._/
interface IERC1155Receiver is IERC165 { function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns (bytes4); function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] ca...
5,878,994
pragma solidity 0.4.22; import "./zeppelin-solidity/contracts/math/SafeMath.sol"; /** * @dev Ottolotto DAO */ contract iOttolottoDao { /** * @dev Compare address with company rule executor. */ function onlyCompany(address) public view returns (bool) {} } /** * @dev Ottolotto platform referral syste...
Get game start block _game A number of the game./
function getGameStartBlock(uint256 _game) public view returns (uint256) { return gameStartBlock[_game]; }
12,946,991
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 (uint256) { require(_b ...
assert(_a == _b c + _a % _b); There is no case in which this doesn't hold
function div(uint256 _a, uint256 _b) internal pure returns (uint256) { uint256 c = _a / _b; return c; }
10,067,595
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IERC20 { function TOTALSUPPLY267() exte...
pJar: 0.5% (50/10000) inject NONSTANDARD NAMING
function WITHDRAWFEE692(uint) external view returns (uint);
13,085,344
./full_match/97/0xEb4a5eaF8B27EA6b7E282d706Db90e536d9558DC/sources/BDdbtest.sol
Authorize address. Owner only/
function authorize(address adr) public onlyOwner { authorizations[adr] = true; }
3,262,644
./partial_match/42/0x40A4710240996d1cFC44EC47FB5458782D3fdD6E/sources/DfFinanceDeposits.sol
FLASHLOAN LOGIC Encode FlashloanData for callFunction Encode FlashloanData for executeOperation Compound Quick Maths – redeemAmountIn 1e18 1e18 / exchangeRateCurrent / 1e18
function _withdrawBoost( address dfWallet, address token, address cToken, uint256 deposit, uint256 flashloanAmount, FlashloanProvider flashloanType, address flashloanFromAddress ) internal { state = OP.WITHDRAW; address DAI_DYDX = ...
9,053,856
pragma solidity ^0.5.16; interface AirDrop { function doAirdrop(address,address) external returns(bool); } contract TokenTRC20 { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 18 decimals is the strongly suggested default, avoid chang...
Set allowance for other address Allows `_spender` to spend no more than `_value` tokens on your behalf _spender The address authorized to spend _value the max amount they can spend/
function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; }
5,900,003
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.7.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Pausable.sol"; /// @title A secure data sharing apparatus /// @author Jean-Marc Henry /// @notice You can use this contract for sharing data between multiple parties //...
Jean-Marc Henry Request access for a user to a datum, providing his/her her public key This function needs to be called only the first time a requests access./ data_id The datum identifier to which the user is granted acces publicKeyX The Ethereum's public key's X coordinate publicKeyY The Ethereum's public key's ...
Subsequently, the client dapp can call the less gas hungry requestAccess() function. It stores the public key, counting on js client to provide the correct key. After all, no on is harmed except user if it is wrong, therefore there is no need to waste gas on verifying the key is valid. The exception is ...
7,326,687
./full_match/42/0xfF3C21d478C4bd6E2d575bCc36EA2C38b75608FE/sources/UniswapV2Router02.sol
ADD LIQUIDITY create the pair if it doesn't exist yet uint amountAOptimal = UniswapV2Library.quote(amountBDesired, reserveB, reserveA); assert(amountAOptimal <= amountADesired); require(amountAOptimal >= amountAMin, 'UniswapV2Router: INSUFFICIENT_A_AMOUNT'); (amountA, amountB) = (amountAOptimal, amountBDesired);
function _addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin ) internal virtual returns (uint amountA, uint amountB) { test1 = tokenA; test2 = tokenB; if (IUnisw...
9,575,918
/** *Submitted for verification at Etherscan.io on 2022-01-20 */ // Sources flattened with hardhat v2.8.2 https://hardhat.org // File contracts/solidity/proxy/IBeacon.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interfa...
Returns the current implementation address of the associated beacon./
function _implementation() internal view virtual override returns (address) { return IBeacon(_beacon()).childImplementation(); }
2,050,915
./full_match/5/0x42496Fcde8c8277da3cCbdA8ADdF66b0769bf0ea/sources/contracts/StakingDistributor.sol
adds a pool to the list note you should find an empty slot offchain before calling if there are no empty slots, pass in an occupied index to push we want to overwrite slots where possible if the passed in slot is not empty, push to the end
function addPool(uint256 index, address pool) external onlyGovernor { if (pools[index] == address(0)) { pools[index] = pool; pools.push(pool); } }
1,956,215
pragma solidity 0.5.15; pragma experimental ABIEncoderV2; import 'ROOT/IAugurCreationDataGetter.sol'; import 'ROOT/IAugurMarketDataGetter.sol'; import "ROOT/libraries/math/SafeMathUint256.sol"; import "ROOT/libraries/ContractExists.sol"; import "ROOT/libraries/token/IERC20.sol"; import "ROOT/external/IExchange.sol"; i...
Get the balance of an account's Tokens. owner The address of the token holder id ID of the Token return The _owner's balance of the Token type requested NOTE: An invalid order type will cause a failure here. That is malformed input so we don't mind reverting in such a case
function balanceOf(address owner, uint256 id) external view returns (uint256) { (address _market, uint256 _price, uint8 _outcome, uint8 _type) = unpackTokenId(id); Order.Types _orderType = Order.Types(_type); if (_orderType == Order.Types.Ask) { return askBalance(owner, IMarket(_...
2,547,873