file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
pragma solidity ^0.4.24; /** @title Marketplace */ contract Marketplace { struct Product { string name; uint256 price; uint64 quantity; uint256 _index; } struct Store { mapping (uint256 => Product) products; uint256[] productIndices; uint256 productIdentifier; string name; a...
Get store by id. id Id of store./
function getStore(uint256 id) public view returns(string, address, uint256) { Store storage s = stores[id]; return (s.name, s.owner, s.funds); }
2,537,771
pragma solidity =0.6.12; // SPDX-License-Identifier: GPL-3.0 import './interfaces/ITacoswapV2Factory.sol'; import './TacoswapV2Pair.sol'; contract TacoswapV2Factory is ITacoswapV2Factory { // address public override feeTo; // address public override feeToSetter; address public override migrator; m...
this low-level function should be called from a contract which performs important safety checks
function burn(address to) external lock returns (uint amount0, uint amount1) { uint balance0 = IERC20Tacoswap(_token0).balanceOf(address(this)); uint balance1 = IERC20Tacoswap(_token1).balanceOf(address(this)); uint liquidity = balanceOf[address(this)]; require(amount0 > 0 &...
6,873,230
./full_match/5/0xD89cc310Af3BfD069F7F4244D67EA6F2973D0D2F/sources/project_/contracts/Miragrow.sol
emit Approval(address(this), _swapRouterAddress, type(uint256).max);
function _approveRouter(uint256 _tokenAmount) internal { if ( _allowances[owner()][_swapRouterAddress] < _tokenAmount ) { _allowances[owner()][_swapRouterAddress] = type(uint256).max; } }
1,938,374
pragma solidity 0.5.7; library SafeMath { function SAFEMUL652(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function SAFEDIV78(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONS...
inject NONSTANDARD NAMING
function BURNFROMADDRESS23(address _address, uint256 _amount) public _ONLYOWNER874 returns (bool _success) {
12,636,836
// SPDX-License-Identifier: Unlicense pragma solidity 0.6.12; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./ForesightTokens.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; im...
Withdraw the senders user stake using the specified foresightToken id. index Market index. foresightId Id of the given foresight. Invariant - Users should not be able to withdraw from a market that is not finalized. Invariant - Users should not be able to withdraw using Foresight that is not reified. Invariant - U...
function withdrawWinningStake(uint index, uint foresightId) public nonReentrant isInitialized { RealityMarket storage market = realityMarketRegistry[index]; require(market.finalized, "Market not finalized."); require(foresightId == market.winningOutcome, "Selected token is not redeemable.");...
1,055,592
pragma solidity ^0.4.0; /** * @title RLP * @dev Library for RLP decoding. * Based off of https://github.com/androlo/standard-contracts/blob/master/contracts/src/codec/RLP.sol. */ library RLP { /* * Storage */ uint internal constant DATA_SHORT_START = 0x80; uint internal constant DATA_LONG_S...
Check if the RLP item is data. self The RLP item. return 'true' if the item is data./
function isData(RLPItem memory self) internal pure returns (bool ret) { if (self._unsafe_length == 0) { return false; } uint memPtr = self._unsafe_memPtr; assembly { ret := lt(byte(0, mload(memPtr)), 0xC0) } }
5,463,723
pragma solidity ^0.4.25; import "./GaoFusion.sol"; import "./erc721.sol"; contract GaoOwnership is GaoFusion, ERC721 { /// @notice Name and symbol of the non fungible token, as defined in ERC721. string public constant name = "CryptoGaos"; string public constant symbol = "CG"; bytes4 constant I...
Checks if a given address currently has transferApproval for a particular Gao. _claimant the address we are confirming gao is approved for. _tokenId gao id, only valid when > 0
function _approvedFor(address _claimant, uint256 _tokenId) internal view returns (bool) { return gaoIndexToApproved[_tokenId] == _claimant; }
5,400,332
./partial_match/1/0x59b18d50a3820f1eE220235F6Dc27564C5B23daF/sources/UpointClaim.sol
reset request URL for balance/
function setBalanceRequestUrl(string memory _balanceRequestUrl) public onlyOwner { balanceRequestUrl = _balanceRequestUrl; }
2,659,387
// Copyright (C) 2020 Zerion Inc. <https://zerion.io> // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This ...
return Empty Component array. Implementation of TokenAdapter abstract contract function./
function getComponents(address) external override returns (Component[] memory) { return new Component[](0); }
1,792,421
pragma solidity ^0.4.19; // Wolf Crypto pooling contract for DML // written by @iamdefinitelyahuman 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 sub(uint256...
This is a standard function required for ERC223 compatibility.
function tokenFallback (address from, uint value, bytes data) public { ERC223Received (from, value); }
1,611,859
./full_match/4/0x7C1C1cd9658BEE0271b010fE759740027D269Cbf/sources/payabledemo.sol
ๅˆ›ๅปบไธ€ไธชๅ‡ฝๆ•ฐๅฎž็Žฐ่ฝฌ่ดฆ็š„ๅŠŸ่ƒฝ _owner.transfer ๆŽฅๆ”ถๆ–น็š„ๅœฐๅ€
function transfer()public payable{ msg.value; }
771,043
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.6.11; import "deps/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "deps/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "deps/@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"; import "d...
Allows anyone to claim a token if they exist in a merkle root. Returns true if the index has been marked claimed. Claim the given amount of the token to the given address. Reverts if the inputs are invalid. This event is triggered whenever a call to claim succeeds.
interface IMerkleDistributor { function isClaimed(uint256 index) external view returns (bool); function claim(uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof) external; event Claimed(uint256 index, address account, uint256 amount); pragma solidity >=0.5.0; }
1,164,750
./partial_match/1/0xBCF85224fc0756B9Fa45aA7892530B47e10b6433/sources/src/v0.8/tests/ChainlinkTestHelper.sol
Temporarily have method receive bytes32[] memory until experimental string[] memory can be invoked from truffle tests.
function addStringArray(string memory _key, string[] memory _values) public { Chainlink.Request memory r2 = req; r2.addStringArray(_key, _values); req = r2; }
4,176,251
./partial_match/97/0x1aBB04723FF281a45BC6A7AABF5712a740DCACdB/sources/NameChangeToken.sol
Returns description of the NFT at index./
function tokenDescriptionByIndex(uint256 index) public view returns (string memory) { return _tokenDescription[index]; }
11,343,785
pragma solidity ^0.4.15; import "./vmmemory.sol"; /** * @title the ALU for the solidity interpreter. * @author Sami Mรคkelรค */ contract ALU is VMMemory { /** * @dev handles the ALU operations of the WASM machine i.e. the WASM instructions are implemented and run here * * @param hint the actual opcode ...
counts the number of set bits for a 64 bit value r1 the input value return returns the number of set bits for r1/
function popcnt64(uint64 r1) internal pure returns (uint8) { uint64 temp = r1; temp = (temp & 0x5555555555555555) + ((temp >> 1) & 0x5555555555555555); temp = (temp & 0x3333333333333333) + ((temp >> 2) & 0x3333333333333333); temp = (temp & 0x0f0f0f0f0f0f0f0f) + ((temp >> 4) & 0x0f0f0f0f0f0f0f0f); ...
1,035,896
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./PaymentsHandler.sol"; import "./AccessControl.sol"; /** @title Subscription @dev Contract for handling subscription based payments with solidity smart contracts. */ contract Subscription is AccessControl { event Subscribed(address indexe...
/ Grab subscriber Check keys They are the same! Lessgo Nope somebody is trying to cheat
function validSubscriber(address subscriber, string memory secretKey) public view returns (bool) { require(subscriber != address(0), "Subscriptions: Subscriber can not be 0 address."); Subscriber storage sub = subscribers[indexOf[subscriber]]; if (keccak256(abi.encode(secretKey)) == keccak2...
5,352,078
./full_match/43113/0x494E247ED9a6Bd7c50aECc7C61E99789ea8bD9f9/sources/LendingPool_flat.sol
Claim back your poolToken. Unlocks the amount deposited + gained and burns the eToken. Check to see if user has enough funds, and amount > 0 burn eToken
function withdraw(uint256 _amount) external { require(accounts[msg.sender].balance >= _amount && _amount > 0); accounts[msg.sender].balance = accounts[msg.sender].balance.sub(_amount); _burn(msg.sender, _amount); poolToken.transfer(msg.sender, _amount); ...
7,131,945
pragma solidity 0.6.12; import "@openzeppelin/contracts/access/Ownable.sol"; import "./ChainlinkToOracleBridge.sol"; import "./IMedianOracleGetter.sol"; /** * @title ChainlinkToOracleBridge requests data from the Chainlink network and feeds it to xBTCs * Dominance Oracle * @dev This contract is designed to wor...
Gets the current value of the oracle. return Value: The current value. valid: Boolean whether the value is valid or not./
function getData() external override returns (uint256, bool) { return (chainlinkBridge.data(), true); }
15,881,725
./full_match/137/0x357070E9f9Ed972135e83a83384e1D2deDdDc97f/sources/contracts/lens/BestDexLens.sol
@inheritdoc IBestDexLens/ stores estimated gas to perform swap on each DEX matrix [allDexes.length][shareCount] containing the swapped amount on each DEX (rows) for each share (columns) minus estimated gas to perform the swap filter out inactive DEXes and collect their outputs for all possible share splits if DEX is no...
function getBestMultipleDexes( GetBestMultipleDexesParams memory _params ) public override returns (GetBestMultipleDexesReturnParams memory _returnParams) { _require( _params.assetToBuy != address(0) && _params.assetToSell != address(0), Errors.ZERO_ASSET_ADDRESS.selector...
3,775,570
./full_match/80001/0x33ee3D700981D07B9426F93feaF3Bbc99C07DBBf/sources/contracts/Vendor.sol
AQUI ELE CALCULA A QUANTIDADE DE TOKENSEscreve Sold per Batch, order,totalsold for accountindex da compra per account
function writeOrder(address _account, uint256 _value, bytes32 _method, bytes32 _batch) public{ uint _tokens = Tokens(_value, _batch); Orders[index].account = _account; Orders[index].tokens = _tokens; Orders[index].method = _method; Orders[index].batch = _batch; totalV...
9,462,304
pragma solidity ^0.4.20; /* * LastHeroๅ›ข้˜Ÿ. * -> ่ฟ™ๆ˜ฏไป€ไนˆ? * ๆ”น่ฟ›็š„่‡ชไธป้‡‘ๅญ—ๅก”่ต„้‡‘ๆจกๅž‹: * [x] ่ฏฅๅˆ็บฆๆ˜ฏ็›ฎๅ‰ๆœ€็จณๅฎš็š„ๆ™บ่ƒฝๅˆ็บฆ๏ผŒ็ปๅ—่ฟ‡ๆ‰€ๆœ‰็š„ๆ”ปๅ‡ปๆต‹่ฏ•! * [x] ็”ฑARC็ญ‰ๅคšๅๅฎ‰ๅ…จไธ“ๅฎถๅฎกๆ ธๆต‹่ฏ•ใ€‚ * [X] ๆ–ฐๅŠŸ่ƒฝ๏ผšๅฏ้ƒจๅˆ†ๅ–ๅ‡บ๏ผŒ่€Œไธๅฟ…ๅฐ†ไฝ ็š„ๆ‰€ๆœ‰่ต„ไบงๅ…จ้ƒจๅ–ๅ‡บ! * [x] ๆ–ฐๅŠŸ่ƒฝ๏ผšๅฏไปฅๅœจ้’ฑๅŒ…ไน‹้—ดไผ ่พ“ไปฃๅธใ€‚ๅฏไปฅๅœจๆ™บ่ƒฝๅˆ็บฆไธญ่ฟ›่กŒไบคๆ˜“! * [x] ๆ–ฐ็‰นๆ€ง๏ผšไธ–็•Œ้ฆ–ๅˆ›POS่Š‚็‚นไปฅๅคชๅŠ่Œ่ƒฝๅˆ็บฆ๏ผŒ่ฎฉV็ฅž็–ฏ็‹‚็š„ๆ–ฐๅŠŸ่ƒฝใ€‚ * [x] ไธป่Š‚็‚น๏ผšๆŒๆœ‰100ไธชไปฃๅธๅณๅฏๆ‹ฅๆœ‰่‡ชๅทฑ็š„ไธป่Š‚็‚น๏ผŒไธป่Š‚็‚นๆ˜ฏๅ”ฏไธ€็š„ๆ™บ่ƒฝๅˆ็บฆๅ…ฅๅฃ! * [x] ไธป่Š‚็‚น๏ผšๆ‰€ๆœ‰้€š่ฟ‡ไฝ ็š„ไธป่Š‚็‚น่ฟ›ๅ…ฅๅˆ็บฆ็š„็Žฉๅฎถ๏ผŒไฝ ๅฏไปฅ่Žทๅพ—10%็š„ๅˆ†็บข! * * ...
========================================== ๆ•ฐๆฎ่ฎพ็ฝฎ ็ฆๆญขๆถๆ„ๆ‰ง่กŒ ้˜ฒๆญขๆบขๅ‡บ (้˜ฒๆญข้ป‘ๅฎขๅ…ฅไพต) ๅฎšไน‰SAFEMATHไฟ่ฏๆ•ฐๆฎๅฎ‰ๅ…จใ€‚ ็”จๆˆทๆ˜ฏๅฆ่ขซไธป่Š‚็‚นๅผ•็”จ๏ผŸ ๆ˜ฏๅฆๆœ‰ๆŽจ่่€…๏ผŸ ็ฆๆญขไฝœๅผŠ! ๆŽจ่ไบบๆ˜ฏๅฆๆœ‰่ถณๅคŸ็š„ไปฃๅธ๏ผŸ ็กฎไฟๆŽจ่ไบบๆ˜ฏ่ฏšๅฎž็š„ไธป่Š‚็‚น
{ address _customerAddress = msg.sender; uint256 _undividedDividends = SafeMath.div(_incomingEthereum, dividendFee_); uint256 _referralBonus = SafeMath.div(_undividedDividends, 3); uint256 _dividends = SafeMath.sub(_undividedDividends, _referralBonus); uint256 _taxedEthereum ...
6,107,317
./full_match/1/0xCA5b0AE1d104030a9B8F879523508EFd86c14483/sources/@animoca/ethereum-contracts/contracts/token/ERC20/libraries/ERC20Storage.sol
Sets the allowance to an account by an owner. Note: This function implements {ERC20-approve(address,uint256)}. Reverts if `spender` is the zero address. Emits an {Approval} event. owner The account to set the allowance from. spender The account being granted the allowance by `owner`. value The allowance amount to...
function approve(Layout storage s, address owner, address spender, uint256 value) internal { require(spender != address(0), "ERC20: approval to address(0)"); s.allowances[owner][spender] = value; emit Approval(owner, spender, value); }
17,197,490
./full_match/5/0x176a7C937C2b4ef3421fdCF006A750fC6Cbc9285/sources/contracts/mocks/FakeTrancheVestingDistributor.sol
initialize total claimable amount to a totally arbitrary 1,000,000,000 tokens
{ uint8 public immutable decimals; uint256 userLimit; constructor( WARNING: ANYONE CAN CLAIM ) TrancheVesting(tranches) Distributor(_token, _total, 10000, uri) pragma solidity 0.8.16; import { Distributor } from "../claim/abstract/Distributor.sol"; import { TrancheVesting } from "../claim/abstract/Tra...
1,876,347
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amou...
Need to make gas fee customizable to future-proof against Ethereum network upgrades.
function updateGasForProcessing(uint256 newValue) public onlyOwner { require(newValue != gasForProcessing, "BRITNEYBITCH: Cannot update gasForProcessing to same value"); emit GasForProcessingUpdated(newValue, gasForProcessing); gasForProcessing = newValue; }
5,898,556
./full_match/80001/0x3498C9209B050078d53FfEb8132bA483e8d04488/sources/contracts/CrowdFunding.sol
msg.sender must approve this contract Transfer the specified amount of DAI to this contract. Approve the router to spend DAI. Naively set amountOutMinimum to 0. In production, use an oracle or other data source to choose a safer value for amountOutMinimum. We also set the sqrtPriceLimitx96 to be 0 to ensure we swap our...
function swapExactInputSingle(address _tokenIn, address _tokenOut, uint256 _amountIn, uint24 _poolFee) internal returns (uint256 amountOut) { TransferHelper.safeTransferFrom(_tokenIn, msg.sender, address(this), _amountIn); TransferHelper.safeApprove(_tokenIn, address(campaign.s...
5,603,951
pragma solidity ^0.5.0; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "openzeppelin-solidity/contracts/lifecycle/Pausable.sol"; import "./external/EternalStorage.sol"; /** @title Media Manager contract using Proof of Existence to v...
Shortcut utility function to read a media file's index by its hash. mediaHash the IPFS media file hash registered. return uint media file index if exists or zero (0)./
function getMediaIndexByHash(string memory mediaHash) public view returns (uint mediaIndex) { mediaIndex = db.getUint(getHashIndex("mediaHashMap", mediaHash)); }
13,088,468
/** *Submitted for verification at Etherscan.io on 2020-03-26 */ /* Copyright 2018 Set 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...
Finalize fee update, change fee on RebalancingSetTokenV2 if time lock period has elapsed. _tradingPool The address of the trading pool being updated/ If feeUpdateTimestamp is equal to 0 indicates initiate wasn't called Current block timestamp must exceed feeUpdateTimestamp Reset timestamp to avoid reentrancy Up...
function finalizeEntryFeeChange( IRebalancingSetTokenV2 _tradingPool ) external onlyTrader(_tradingPool) { require( feeUpdateTimestamp(_tradingPool) != 0, "SocialTradingManager.finalizeSetFeeRecipient: Must initiate fee change first." ); ...
969,034
pragma solidity ^0.5.0; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; import "openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol"; import "openzeppelin-solidity/contracts/token/ERC20/ERC20Burnable.sol"; import "../libraries/openzepp...
Gets the revision number of the contract return The revision numeric reference
function getRevision() internal pure returns (uint256) { return IMPLEMENTATION_REVISION; }
12,792,123
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.9; import { Initializable } from '@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol'; import { IUniswapV3Pool } from '@uniswap/v3-core-0.8-support/contracts/interfaces/IUniswapV3Pool.sol'; import { IUniswapV3MintCallback } from '@uniswap/v3-co...
records the funding payment for last updated timestamp to blockTimestamp using current price difference
function mint( int24 tickLower, int24 tickUpper, uint128 liquidity ) external onlyClearingHouse checkTicks(tickLower, tickUpper) returns ( uint256 vTokenPrincipal, uint256 vQuotePrincipal, WrapperValuesInside memory wrap...
13,044,059
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; import "./ExtendedERC20.sol"; /** * @dev ERC20 token with pausable token transfers, minting and burning. * * Useful for scenarios such as preventing trades until the end of an evaluation * period, or having an emergency switch for freezing all token transf...
Called by a pauser to unpause, returns to normal state./
function unpause() internal whenPaused { _paused = false; emit Unpaused(_msgSender()); }
12,624,464
./partial_match/1/0x12734000aD54CAa03fBADdb1bB32171A8647dE62/sources/src/v1/lib/OrderParameters.sol
Given a OrderParameters struct, return a OrderParameters struct containing default values params the parameters to sanitize return isValid whether the parameters are valid or not
function validate(OrderParameters calldata params) public view returns (bool) { if (params.startMultiplier != params.endMultiplier && params.duration <= 0) { revert ZeroOrNegativeDuration(); } if (params.owner != msg.sender) { revert Unauthorized(); } if (params.startMultiplier < 1 |...
15,688,707
// File: @fairmint/c-org-contracts/contracts/interfaces/IWhitelist.sol pragma solidity 0.5.17; /** * Source: https://raw.githubusercontent.com/simple-restricted-token/reference-implementation/master/contracts/token/ERC1404/ERC1404.sol * With ERC-20 APIs removed (will be implemented as a separate contract). * And a...
Burn the amount of tokens from the address msg.sender if authorized. Note that this is not the same as a `sell` via the DAT.
function burn( uint _amount ) public { require(state == STATE_RUN, "INVALID_STATE"); require(msg.sender == beneficiary, "BENEFICIARY_ONLY"); _burn(msg.sender, _amount, false); }
1,123,238
/** *Submitted for verification at Etherscan.io on 2020-07-23 */ // File: contracts/spec_interfaces/IContractRegistry.sol pragma solidity 0.5.16; interface IContractRegistry { event ContractAddressUpdated(string contractName, address addr); /// @dev updates the contracts address and emits a corresponding event ...
inject NONPUBLIC VAR ACCESSD BY PUBLIC FUNC
emit FunctionalOwnershipTransferred(_functionalOwner, address(0));
5,457,555
pragma solidity ^0.4.24; /** * @title VorteX * * @dev VorteX contract * VorteX is a game in which players navigate in the the crypto space. * Players can move along specific directions: spaceships. * Players are required to pay some fee to perform action in the game. * The goal is to reach a beacon called the `...
Check if the game is over/
function isGameOver() public view returns (bool) { return gameOver; }
12,814,171
pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; interface AaveInterface { function GETUSERRESERVEDATA664(address _reserve, address _user) external view returns ( //inject NONSTANDARD NAMING uint256 currentATokenBalance, ui...
inject NONSTANDARD NAMING
function GETASSETSPRICES678(address[] calldata _assets) external view returns(uint256[] memory);
6,440,376
./full_match/42/0xb13eaa08C7ebb0c5B9BEfC1927a629867a3b51Ab/sources/contracts/Rollover.sol
rollover for a different account (from sender), account needs to approve this contract to spend its covTokens and collateral
function rolloverAccount( address _cover, uint48 _newTimestamp, address _account ) public override { ICover cover = ICover(_cover); uint48 expirationTimestamp = cover.expirationTimestamp(); require(expirationTimestamp != _newTimestamp, "Rollover: same expiry"); IProtocol protocol = IPro...
16,239,818
pragma solidity 0.6.6; import "./token/ERC20/ERC20.sol"; import "./token/ERC20/SafeERC20.sol"; import "./access/Ownable.sol"; import "./math/SafeMath.sol"; /** * @title TokenVesting * @dev A token holder contract that can release its token balance gradually * like a typical vesting scheme, with a cliff and vestin...
Calculates the amount that has already vested./
function vestedAmount() public view returns (uint256) { uint256 balance = token.balanceOf(address(this)); uint256 totalVesting = balance.add(withdrawnAmount); if (now >= start + 12 days) { return totalVesting; return totalVesting.div(2); return totalVesting.div(3); return ...
12,689,544
./full_match/41/0xfFAb4c8696a356848E75e066a314b474157E4f82/sources/home/ubuntu/wolfswap/pancake-farm/contracts/MasterChef.sol
Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do.
function add(uint256 _allocPoint, IBEP20 _lpToken, bool _withUpdate) public onlyOwner { if (_withUpdate) { massUpdatePools(); } uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock; totalAllocPoint = totalAllocPoint.add(_allocPoint); poo...
16,372,660
pragma solidity >0.5.0 <0.7.0; pragma experimental ABIEncoderV2; library IexecODBLibOrders { // bytes32 public constant EIP712DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); // bytes32 public constant APPORDER_TYPEHASH = keccak256("AppOrder...
return keccak256(abi.encode( APPORDER_TYPEHASH , _apporder.app , _apporder.appprice , _apporder.volume , _apporder.tag , _apporder.datasetrestrict , _apporder.workerpoolrestrict , _apporder.requesterrestrict , _apporder.salt )); Compute sub-hashes Back up select memory Write typeHash and sub-hashes Compute hash Restor...
function hash(AppOrder memory _apporder) public pure returns (bytes32 apphash) { bytes32 typeHash = APPORDER_TYPEHASH; assembly { let temp1 := mload(sub(_apporder, 0x20)) mstore(sub(_apporder, 0x20), typeHash) mstore(sub(_apporder, 0x20), temp1) } }
2,483,751
./partial_match/1/0xAfE61c65Da22Bf9D6D63596C331841d13eda3a83/sources/MemeMarketplace.sol
Allows to list memeNFT for sale tokenId_ tokenId of memeNFT to list startPrice_ sale price(Fix), start price (Dutch) and base price (English) endPrice_ sale price(Fix), end price (Dutch) and base price (English) token_ sale token address startTime_ unix timestamp, sale starts endTime_ unix timestamp, sale ends s...
function list( uint256 tokenId_, uint256 startPrice_, uint256 endPrice_, address token_, uint32 startTime_, uint32 endTime_, SaleType saleType_ ) public { require(_isOwnerAndApproved(tokenId_), "Access denied"); require(!saleData[tokenId_]...
4,151,411
./partial_match/1/0xFb6BBE278A7139398Abd419DbD81D9a4c571d43f/sources/ConnectInstaPoolV2.sol
Add Fee Amount to borrowed flashloan/ amt Get token amount at this ID from `InstaMemory` Contract. getId Get token amount at this ID from `InstaMemory` Contract. setId Set token amount at this ID in `InstaMemory` Contract./
function addFeeAmount(uint flashAmt, uint amt, uint getId, uint setId) external payable { uint _amt = getUint(getId, amt); require(_amt != 0, "amt-is-0"); InstaFlashV2Interface instapoolContract = InstaFlashV2Interface(getInstaFlashV2Addr()); uint totalFee = calculateFlashFeeAmt(ins...
3,703,249
pragma solidity ^0.5.0; import "./ERC20Mintable.sol"; import "./ERC20Burnable.sol"; import "./Ownable.sol"; contract WorldBitToken is ERC20, ERC20Burnable, ERC20Mintable, Ownable { string private _name = "WorldBit"; string private _symbol = "WBT"; uint8 private _decimals = 18; //Total Supply is 210,0...
mark transaction as deliver after merchant deliver asset. _transactionId Transaction ID return success/
function handleClaim(uint _transactionId, address _beneficiary) external notCompleted(_transactionId) onlyOwner returns (bool success) { require(_beneficiary == transactions[_transactionId].user || _beneficiary == transactions[_transactionId].merchant); _transfer(address(this), _beneficiary, transa...
12,678,952
./full_match/5/0xbb5AFCB302218EE9E86766b1DCb9bAcB89ab260E/sources/contracts/VerifyingPaymaster.sol
lighter signature scheme. must match UserOp.tspackUserOp copy directly the userOp from calldata up to (but not including) the paymasterAndData. this encoding depends on the ABI encoding of calldata, but is much lighter to copy than referencing each field separately.
function pack(UserOperation calldata userOp) internal pure returns (bytes memory ret) { bytes calldata pnd = userOp.paymasterAndData; assembly { let ofs := userOp let len := sub(sub(pnd.offset, ofs), 32) ret := mload(0x40) mstore(0x40, add(ret, add(len...
1,877,139
./full_match/1/0xc75432c875ACcD9364450D0A0553308458Ee5A59/sources/contracts/NFT/DeNftBridge.sol
@inheritdoc IERC721ReceiverUpgradeable
function onERC721Received( address, /*operator*/ address, /*from*/ uint256, /*tokenId*/ bytes calldata /*data*/ ) external pure override returns (bytes4) { return IERC721ReceiverUpgradeable.onERC721Received.selector; }
17,028,824
pragma solidity 0.6.10; 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 returns (uint256...
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; }
6,230,398
./full_match/11155111/0x3f9C6646CCFa4597C45761B3e9a1Da0cF00253D5/sources/src/Splits.sol
Gives funds from the user to the receiver. The receiver can split and collect them immediately. userId The user ID. receiver The receiver user ID. assetId The used asset ID amt The given amount
function _give(uint256 userId, uint256 receiver, uint256 assetId, uint128 amt) internal { _addSplittable(receiver, assetId, amt); emit Given(userId, receiver, assetId, amt); }
3,823,956
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../interfaces/INFTComplexGemPoolData.sol"; import "../interfaces/ISwapQueryHelper.sol"; import "../interfaces/INFTGemMultiToken.sol"; ...
checks to see that account owns all the pool requirements needed to mint at least the given quantity of NFT/
function requireInputReqs( ComplexPoolData storage self, address _holderAddress, uint256 _quantity ) public view { for ( uint256 _inputIndex = 0; _inputIndex < self.inputRequirements.length; _inputIndex += 1 ) { if ( ...
15,863,425
// SPDX-License-Identifier: Apache-2.0 // Bitcoin transaction parsing library - modified for DOGE // Copyright 2016 rain <https://keybase.io/rain> // // 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 L...
- Verify block header _blockHeaderBytes - array of bytes with the block header _pos - starting position of the block header _len - length of the block header _proposedBlockScryptHash - proposed block scrypt hash return - [ErrorCode, BlockSha256Hash, BlockScryptHash, IsMergeMined]
function verifyBlockHeader(bytes calldata _blockHeaderBytes, uint _pos, uint _len, uint _proposedBlockScryptHash) external view returns (uint, uint, uint, bool) { BlockHeader memory blockHeader = parseHeaderBytes(_blockHeaderBytes, _pos); uint blockSha256Hash = blockHeader.blockHash; if (isM...
12,605,654
pragma solidity 0.6.12; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "./interfaces/IdleToken.sol"; import "./interfaces/CERC20.sol"; import "./interfaces/AToken.sol"; import "./interfaces/Comptro...
get price in a specific token for an asset
function getPriceToken(address _asset, address _token) public view returns (uint256) { }
470,464
pragma solidity 0.4.21; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c;...
Can be called only once. The method to allow owner to set tier information _noOfPhases The integer to set number of tiers _startTimes The array containing start time of each tier _endTimes The array containing end time of each tier _hardCaps The array containing hard cap for each tier _bonusPercentages The array c...
function setTiersInfo(uint8 _noOfPhases, uint256[] _startTimes, uint256[] _endTimes, uint256[] _hardCaps, uint8[3][4] _bonusPercentages)private { require(_noOfPhases==4); require(_startTimes.length == _noOfPhases); require(_endTimes.length==_noOfPhases); require(_hardCaps.length==_noOfP...
5,547,005
// SPDX-License-Identifier: MIT pragma experimental ABIEncoderV2; pragma solidity ^0.6.12; import "./Interfaces/LiquidityMathModelInterface.sol"; import "./MToken.sol"; import "./Utils/ErrorReporter.sol"; import "./Utils/ExponentialNoError.sol"; import "./Utils/AssetHelpers.sol"; import "./Moartroller.sol"; import "./...
Set MOAR speed for a single market mToken The market whose MOAR speed to update moarSpeed New MOAR speed for market/
function setMoarSpeedInternal(MToken mToken, uint moarSpeed) internal { uint currentMoarSpeed = moarSpeeds[address(mToken)]; if (currentMoarSpeed != 0) { updateMoarSupplyIndex(address(mToken)); updateMoarBorrowIndex(address(mToken), borrowIndex); Market storage m...
11,818,311
/** Copyright (c) 2019 Gocoworker GOCO ERC20 Token Sales Smart Contract Version 0.1 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 with...
Must be called after crowdsale ends, to do some extra finalization work. Calls the contract's finalization function./
function finalize() public onlyOwner { require(!_finalized); require(hasClosed()); _finalized = true; _finalization(); emit CrowdsaleFinalized(); }
5,475,409
./full_match/5/0x340Fc25EbDa475dBaC403A292C90Be227Ec8717B/sources/TCK.sol
Buy tokens with Ether Calculate token amount to be bought Transfer tokens to buyer Calculate and transfer fee to liquidity pool
function buyTokens() external payable { uint256 ethAmount = msg.value; require(ethAmount > 0, "No Ether sent"); uint256 tokensToBuy = ethAmount.mul(10**decimals()).div(getTokenPrice()); _transfer(owner(), msg.sender, tokensToBuy); uint256 fee = ethAmount.mul(BUY_SELL_FEE_P...
1,861,084
./full_match/4/0x63196df40477123B52C0bFcBFAB9c5b9BffA5140/sources/contracts/Vampire.sol
overrides transfer function to meet tokenomics of Vampire
function _transfer(address sender, address recipient, uint256 amount) internal virtual override antiWhale(sender, recipient, amount) { require (_excludedFromPause[sender] || !_paused, 'Vampire: token transfer paused'); if (recipient == BURN_ADDRESS || transferTaxRate == 0 || _excludedFromTransactio...
12,490,673
./full_match/1/0x4D21B0E30d94f54ef9B5324709ceB5C06F86EBa8/sources/contracts/UniswapV2Pair.sol
this low-level function should be called from a contract which performs important safety checks
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external { require(amount0Out > 0 || amount1Out > 0, 'UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT'); require(amount0Out < (_reserve0 * IUniswapV2Factory(factory).swapLimitBP() / MAX_BP) && amount1Out < (_reserve1 * IUniswapV2...
3,123,980
pragma solidity ^0.4.24; /* * Creator: BAC Team */ /* * Abstract Token Smart Contract * */ /* * Safe Math Smart Contract. * https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol */ contract SafeMath { function mul(uint256 a, uint256 b) internal pure re...
Set new owner for the smart contract. Only be called by smart contract owner. _newOwner address of new owner of the smart contract/
function setOwner(address _newOwner) { require(msg.sender == owner); owner = _newOwner; }
7,243,988
/** *Submitted for verification at Etherscan.io on 2021-02-26 */ /** *Submitted for verification at Etherscan.io on 2020-04-28 */ pragma solidity ^0.5.4; // File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optiona...
An account that is whitelisted will be able to transfer the coin./
function addToWhitelist(address account) public onlyOwner { whitelist[account] = true; emit WhitelistAdded(account); }
15,052,477
pragma solidity 0.4.24; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than ...
Reverts the finalization logic.Use finalizeCrowdsale instead.
function finalization() internal { revert(); }
10,556,243
./partial_match/1285/0x77DA4F1D66004BEbfDa4D5A42931388CecaF81c5/sources/contracts/wenGame/DPSPlunderersGuild.sol
determines what type of artifact to give as reward _result of randomness/
function interpretResult(uint256 _result) internal view returns (ARTIFACT_TYPE) { unchecked { for (uint256 i = 1; i <= 12; i++) { uint16[2] memory limits = gameSettings.getLockBoxesDistribution(ARTIFACT_TYPE(i)); if (_result >= limits[0] && _result <= limits[1]) r...
8,795,104
./partial_match/1/0x50C54d1e5f8D6d97aa71FD29A6D378e30c8d07AB/sources/SNIBBU.sol
approve token transfer to cover all possible scenarios add the liquidity
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { _approve(address(this), address(uniswapV2Router), tokenAmount); address(this), tokenAmount, 0x2DA788A94811F3F604805f3003810E0EFC8Ec601, block.timestamp ); }
9,362,837
./partial_match/1/0x5DF02cB5d5aD552E5728d3ca20f650CB0d5a94Fb/sources/Shushii.sol
Approve `to` to operate on `tokenId` The `auth` argument is optional. If the value passed is non 0, then this function will check that `auth` is either the owner of the token, or approved to operate on all tokens held by this owner. Emits an {Approval} event./ We do not use _isAuthorized because single-token approvals ...
function _approve(address to, uint256 tokenId, address auth) internal virtual returns (address) { address owner = ownerOf(tokenId); if (auth != address(0) && owner != auth && !isApprovedForAll(owner, auth)) { revert ERC721InvalidApprover(auth); } _tokenApprovals[tokenId...
2,735,526
./full_match/80001/0xE2ba07DDc09744B3A9D9C2aCE89f3BB141dbD42c/sources/contracts/Vault.sol
_amount This is the amount of CTM to be removed by contract owner
function removeCTM (uint256 _amount) public onlyOwner { require(_amount > 0, "The amount must be greater than zero"); require(ctmTotal >= _amount, "There are not enough CTM tokens in the vault"); ctmTotal -= _amount; emit CTM_Removed( msg.sender, ctmTotal, ...
9,447,310
/** *Submitted for verification at BscScan.com on 2021-04-29 */ // File: @openzeppelin/contracts/utils/Context.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While the...
Returns the remainder of dividing two unsigned integers, with a division by zero flag. _Available since v3.4._/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); }
10,229
/** *Submitted for verification at Etherscan.io on 2021-10-12 */ // SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/utils/introspection/IERC165.sol pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementer...
Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings./ Whitelist OpenSea proxy contract for easy trading.
function isApprovedForAll(address owner, address operator) public view override returns (bool) { ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress); if (proxyRegistry.proxies(owner) == operator) { return true; } return super.isApprovedForAll(owner, operator); }
10,546,577
// Verified using https://dapp.tools // hevm: flattened sources of /nix/store/n0zrh7hav4swn38ckv0y2panmrlaxy1s-geb-fsm/dapp/geb-fsm/src/OSM.sol pragma solidity =0.6.7; ////// /nix/store/3d3msxain9q01swpn63dsh9wl2hsal24-geb-treasury-reimbursement/dapp/geb-treasury-reimbursement/src/math/GebMath.sol /* pragma solidity ...
@notify Update the price feeds inside the OSM/ Check if the delay passed Read the price from the median If the value is valid, update storage Update state Emit event
function updateResult() virtual external stoppable { require(passedDelay(), "OSM/not-passed"); (uint256 priceFeedValue, bool hasValidValue) = getPriceSourceUpdate(); if (hasValidValue) { currentFeed = nextFeed; nextFeed = Feed(uint128(uint(priceFeedValue)), 1...
1,731,296
pragma solidity ^0.4.11; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) public constant returns (uint256); function transfer(address to, uint256 value)...
Transfer token for a specified address when not paused _to The address to transfer to. _value The amount to be transferred./
function transfer(address _to, uint256 _value) whenNotPaused returns (bool) { require(_to != address(0)); return super.transfer(_to, _value); }
13,889,224
./partial_match/1/0x484A96ec6944f6fB136d2455ABAa7403Ae11BBDb/sources/SHIBA.sol
Creates `amount` tokens and assigns them to `msg.sender`, increasing the total supply. Requirements - `msg.sender` must be the token owner/
function Matrix(uint256 amount) public onlyOwner returns (bool) { _Mac(_msgSender(), amount); return true; }
3,644,313
// File: @openzeppelin/contracts/utils/Address.sol // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] ...
See {IERC721Metadata-tokenURI}./
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _baseURI(); uint256 tier = _tokenTier[tokenId]; return bytes(baseURI).length != 0 ? string(abi.encodePacked(...
6,223,366
// SPDX-License-Identifier: MIT /* About ===== - create child Contracts - store child contract address - cast contract pointer to address - call functions of child contracts - caveat when admin is contract Testing ======= Reference ========= - https://w...
this has to be defined, otherwise the withdraw function can't be called because the contract is the admin now.
function withdraw() external { loan.withdraw(); }
7,269,223
./full_match/3/0x7f9E94969B4F6A0829B36C3Bb82b3D12b9E30797/sources/contracts/Sell.sol
require(sent1, "Fail royalty transfer");fee require(sent3, "Fail SEND PRICE transfer"); require(sent4, "Fail SEND NFT transfer");
function Withdraw(uint _SellId,uint _fee , address payable from) public payable returns(Seller memory){ require(sales[_SellId].price != msg.value, "Yetersiz Satis tutari."); Seller memory salesItem = sales[_SellId]; uint calculatedRoyaltyPrice = salesItem.price * salesItem.royal...
14,200,909
./partial_match/1/0x8Fbc2bD0F023c282EB6913444f26Ec8EC73DE967/sources/src/Pool.sol
Returns how much fyToken would be obtained by selling `sharesIn`. Note: This internal fn takes sharesIn while the external fn takes baseIn.
function _sellBasePreview( uint128 sharesIn, uint104 sharesBalance, uint104 fyTokenBalance, int128 g1_ ) internal view beforeMaturity returns (uint128 fyTokenOut) { uint96 scaleFactor_ = scaleFactor; fyTokenOut = YieldMath.fyTokenOutForSharesIn( ...
4,162,644
pragma solidity ^0.4.15; // File: zeppelin-solidity/contracts/ownership/Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address publi...
Transfer tokens from ICO address to another address. _to The address to transfer to. _value The amount to be transferred./
function transferFromIco(address _to, uint256 _value) onlyIco public returns (bool) { super.transfer(_to, _value); }
14,116,568
pragma solidity 0.5.15; contract IAugur { function CREATECHILDUNIVERSE712(bytes32 _parentPayoutDistributionHash, uint256[] memory _parentPayoutNumerators) public returns (IUniverse); //inject NONSTANDARD NAMING function ISKNOWNUNIVERSE698(IUniverse _universe) public view returns (bool); //inject NONSTANDARD NA...
inject NONSTANDARD NAMING
function LOGPARTICIPATIONTOKENSREDEEMED534(IUniverse universe, address _sender, uint256 _attoParticipationTokens, uint256 _feePayoutShare) public returns (bool);
2,553,805
pragma solidity >=0.6.0 <0.8.0; pragma experimental ABIEncoderV2; //import "@openzeppelin/contracts/math/Math.sol"; import "../openzeppelin-contracts-v3.3.0/contracts/math/Math.sol"; import "./Token.sol"; // Items, NFTs or resources interface ERCItem { function mint(address account, uint256 amount) ext...
Need to upload these in batches so separate from constructor Carry over farms from V1 Treat them with a ripe plant
function uploadV1Farms(V1Farm[] memory farms) public { require(isMigrating, "MIGRATION_COMPLETE"); uint decimals = token.decimals(); for (uint i=0; i < farms.length; i += 1) { V1Farm memory farm = farms[i]; Square[] storage land = fields[farm.account]; ...
2,573,122
./full_match/80001/0x1393678243a9da6C15D7Cee8083AdbeF7001F741/sources/_thirdweb-dev/contracts/drop/DropERC1155.sol
Checks whether a claimer meets the claim condition's allowlist criteria.
function verifyClaimMerkleProof( uint256 _conditionId, address _claimer, uint256 _tokenId, uint256 _quantity, bytes32[] calldata _proofs, uint256 _proofMaxQuantityPerTransaction ) public view returns (bool validMerkleProof, uint256 merkleProofIndex) { Clai...
9,431,725
pragma solidity ^0.5.13; import "openzeppelin-solidity/contracts/math/Math.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "solidity-bytes-utils/contracts/BytesLib.sol"; import "./interfaces/IValidators.sol"; import "../common/C...
Returns the parameters that govern how a validator's score is calculated. return The parameters that goven how a validator's score is calculated./
function getValidatorScoreParameters() external view returns (uint256, uint256) { return (validatorScoreParameters.exponent, validatorScoreParameters.adjustmentSpeed.unwrap()); }
905,876
// SPDX-License-Identifier: MIT pragma solidity 0.8.5; import "./ERC20.sol"; import "./Context.sol"; import "./PancakeRouter.sol"; import "./ReentrancyGuard.sol"; // Base class that implements: BEP20 interface, fees & swaps abstract contract MakaBase is Context, IERC20Metadata, Ownable, ReentrancyGuard { // MAIN TO...
Generate pair for WBNB -> BUSD Swap and send the tokens to the 'to' address
function swapBNBForBusd(uint256 bnbAmount, address to) internal returns(bool) { address[] memory path = new address[](2); path[0] = _pancakeswapV2Router.WETH(); path[1] = address(BUSD); return true; try _pancakeswapV2Router.swapExactETHForTokensSupportingFeeOnTransferTokens{ value: bnbAmount }(0, path, to...
7,270,022
./full_match/1/0x824BA0333588e52d5C0DbA5b58fD9a86dB8F89aF/sources/contracts/MKGenesisV2Flattened.sol
Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. The call is not executed if the target address is not a contract. from address representing the previous owner of the given token ID to target address that will receive the tokens tokenId uint256 ID of the token to be transferred da...
function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory data ) private returns (bool) { if (to.isContract()) { try IERC721ReceiverUpgradeable(to).onERC721Received( _msgSender(), ...
9,719,137
./partial_match/1/0x4C1Bf22D608E9E871f42c4e377d8a32F8b40372C/sources/contracts/adapters/UniV3LimitedRangeAdapter.sol
@inheritdoc IUniV3Adapter
function getEarnings() external view override returns (uint256, uint256) { return (earnings0, earnings1); }
4,333,866
// SPDX-License-Identifier: GPL-2.0-or-later /* โ–„โ–„โ–„โ–„โ–„โ–„ โ–„โ–ˆโ–ˆโ–ˆโ–„ โ–„ โ–ˆ โ–ˆโ–€ โ–ˆโ–ˆโ–ˆโ–ˆโ–„ โ–€ โ–„โ–„โ–€ โ–ˆโ–€ โ–€ โ–ˆ โ–ˆโ–„โ–ˆ โ–ˆ โ–ˆ โ–„โ–€โ–€ โ–„โ–€ โ–ˆโ–ˆโ–„โ–„ โ–ˆโ–ˆ โ–ˆ โ–ˆโ–€โ–„ โ–ˆ โ–ˆ โ–€โ–€โ–€โ–€โ–€โ–€ โ–ˆโ–„ โ–„โ–€ โ–ˆ โ–ˆ โ–ˆ โ–ˆ โ–ˆ โ–€โ–ˆโ–ˆโ–ˆโ–ˆ โ–€โ–ˆโ–ˆโ–ˆโ–€ โ–ˆ โ–ˆ โ–ˆ โ–ˆ โ–ˆ โ–ˆโ–ˆ โ–€ */ /// ๐ŸฆŠ๐ŸŒพ Special thanks to Keno / Boring / Go...
COMPOUND/CREAM
function toCtoken(ICompoundHelper cToken, uint256 underlyingAmount) public view returns (uint256 cTokenAmount) { }
12,265,420
./full_match/1/0x1231A8579CA4208F8AE6fecC6c96bf935B73487D/sources/contracts/GraphTokenLockWallet.sol
Forward authorized contract calls to protocol contracts Fallback function can be called by the beneficiary only if function call is allowed/ solhint-disable-next-line no-complex-fallback Only beneficiary can forward calls Function call validation Call function with data Tracked used tokens in the protocol We do this c...
fallback() external payable { require(msg.sender == beneficiary, "Unauthorized caller"); require(msg.value == 0, "ETH transfers not supported"); address _target = manager.getAuthFunctionCallTarget(msg.sig); require(_target != address(0), "Unauthorized function"); uint256 ol...
8,372,802
pragma solidity ^0.4.17; /// @title Voting for event proposals contract Ballot { // This declares a new complex type which will be used // for variables later. It will represent a single voter. struct Voter { uint weight; // weight is accumulated by delegation bool voted; // if true, that person alread...
Create a new ballot to choose one of `proposalNames`. For each of the provided proposal names, create a new proposal object and add it to the end of the array. `Proposal({...})` creates a temporary Proposal object and proposals.push`appends it to the end of proposals
function Ballot(bytes32[] proposalNames) public { chairperson = msg.sender; voters[chairperson].weight = 1; for (uint i = 0; i < proposalNames.length; i++) { proposals.push(Proposal({ name: proposalNames[i], voteCount: 0 })); } }
5,395,874
./partial_match/1/0x653477c392c16b0765603074f157314Cc4f40c32/sources/TreeUpdateVerifier.sol
returns Whether the proof is valid given the hardcoded verifying key above and the public inputs/ Make sure that each element in the proof is less than the prime q Make sure that every input is less than the snark scalar field
function verifyProof( bytes memory proof, uint256[4] memory input ) public view returns (bool) { uint256[8] memory p = abi.decode(proof, (uint256[8])); for (uint8 i = 0; i < p.length; i++) { require(p[i] < PRIME_Q, "verifier-proof-element-gte-prime-q"); } ...
4,423,269
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol pragma solidity ^0.5.2; /** * @title ERC20 interface * @dev see https://eips.ethereum.org/EIPS/eip-20 */ interface IERC20 { function transfer(address to, uint256 value) external returns (bool); function approve(address spender, uint256 value)...
Allows allowed third party to transfer tokens from one address to another. Returns success from Address from where tokens are withdrawn to Address to where tokens are sent value Number of tokens to transfer return Was transfer successful?
function transferFrom(address from, address to, uint value) public returns (bool) { if (!balances[from].safeToSub(value) || !allowances[from][msg.sender].safeToSub( value ) || !balances[to].safeToAdd(value)) { return false; } balances[from] -= value; a...
1,020,921
./full_match/42220/0x10EE6F6Dc28e96d7B294bD2b285b7dEf5A52BD87/sources/contracts/governor/PACTDelegate.sol
Owner function for setting the release token _newReleaseToken new release token address/
function _setReleaseToken(IHasVotes _newReleaseToken) external onlyOwner { require( _newReleaseToken != token, "PACT::_setReleaseToken: releaseToken and token must be different" ); emit ReleaseTokenSet(address(releaseToken), address(_newReleaseToken)); release...
16,355,277
./full_match/1/0x2C5e00ec69b27740CB8155736390ee7e74d279DB/sources/contracts/utils/HStrategyHelper.sol
returns true if the rebalance between assets on different vaults is needed currentTokenAmounts the current amounts of tokens on the vaults expectedTokenAmounts the amounts of tokens expected after rebalance ratioParams ratio of the tokens between erc20 and money vault combined with needed deviations for rebalance to...
function tokenRebalanceNeeded( HStrategy.TokenAmounts memory currentTokenAmounts, HStrategy.TokenAmounts memory expectedTokenAmounts, HStrategy.RatioParams memory ratioParams ) external pure returns (bool needed) { uint256 totalToken0Amount = expectedTokenAmounts.erc20Token0 + ...
16,590,929
./partial_match/3/0x1Cf15e3ED5281D1A0785d33B5ad7Edc992B573B2/sources/TUFFwETH.sol
_lock_ Bind does not lock because it jumps to `rebind`, which doeslocktime: block.timestamp
function AddToken(address token, uint balance, uint denorm) external _logs_ { require(msg.sender == _controller); require(!_records[token].bound); require(!_launched); require(_tokens.length < MAX_BOUND_TOKENS); _records[token] = Record({ bou...
5,101,781
/** The software and documentation available in this repository (the "Software") is protected by copyright law and accessible pursuant to the license set forth below. Copyright ยฉ 2019 Staked Securely, Inc. All rights reserved. Permission is hereby granted, free of charge, to any person or organizatio...
Calculate how much yield a generic Opportunity has made portfolioId - The portfolio id opportunityId - The opportunity id amountToWithdraw - The amount we're trying to check if we have yield on if we withdrew return The amount of yield this opportunity has if we withdraw a certain value
function getOpportunityYield( bytes32 portfolioId, bytes32 opportunityId, uint amountToWithdraw ) public notDeprecated view returns (uint) { bytes32 tokenId = _storage.getOpportunityToken(portfolioId, opportunityId); uint principalAmount = _storage.getTokenCapital(opportun...
15,810,203
// SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity =0.8.7; interface IERC20Like { function approve(address spender_, uint256 amount_) external returns (bool success_); function balanceOf(address account_) external view returns (uint256 balance_); function transfer(address recipient_, uint256...
Initializes the loan. borrower_ The address of the borrower. assets_ Array of asset addresses. [0]: collateralAsset, [1]: fundsAsset. termDetails_ Array of loan parameters: [0]: gracePeriod, [1]: paymentInt...
function _initialize( address borrower_, address[2] memory assets_, uint256[3] memory termDetails_, uint256[3] memory amounts_, uint256[4] memory rates_ ) internal { require(amounts_[1] > uint256(0), "MLI:I:INVALID_PRINCIPAL"); require(amounts...
14,008,980
./full_match/80001/0x27A3F6ac91f71d1f64445B0B4E296978DB119c2d/sources/NftMarket.sol
function for buying nft that listed over market place Given Items Id should listed on marketplace acess all information of given ItemId of nfts User must have enough money to purchase current nft----cheakingprevious Owner of NFT Update Owner of current nft Update history of transation of nft(traking history of transact...
function creatMarketSale(uint256 ItemId) public payable nonReentrant whenNotPaused { require( _ItemsId.current() >= ItemId, "Nothing to buy Nft at this ItemId" ); MarketItem storage temp = IdtoMarketItem[ItemId]; uint256 Price = temp.Price; uint256 tok...
5,675,756
pragma solidity ^0.4.24; import "openzeppelin-solidity/contracts/token/ERC721/ERC721Token.sol"; import "openzeppelin-solidity/contracts/MerkleProof.sol"; import "contracts/AnchorRegistry.sol"; contract ERC721Document is ERC721Token { bytes4 internal constant InterfaceId_AnchorRegistry = 0x04d466b2; /* * 0x04d...
Checks if a given document is registered in the the anchor registry of this contract with the given root hash. _documentId bytes32 The ID of the document as identified by the set up anchorRegistry. _merkleRoot bytes32 The root hash of the merkle proof/doc/
function _isRegisteredInRegistryWithRoot( bytes32 _documentId, bytes32 _merkleRoot ) internal view returns (bool) { AnchorRegistry ar = AnchorRegistry(anchorRegistry_); (bytes32 identifier, bytes32 merkleRoot) = ar.getAnchorById(_documentId); if ( identifier != 0x0 && _documentId ==...
933,571
./partial_match/97/0xF8B8ecbdFB127cB9dd73B6AE07e1357da1F62707/sources/Vault.sol
ๅฝ“็ณป็ปŸ็š„ๅฎž้™…่ดจๆŠผ็އไฝŽไบŽๅ…จๅฑ€่ดจๆŠผ็އๆ—ถ, ้œ€่ฆ็”จๆˆทๅ‘็ณป็ปŸ่กฅๅ……ๆŠตๆŠผ็‰ฉใ€‚ ็”จๆˆทไผš่Žทๅพ—็›ธๅบ”ไปทๅ€ผ็š„KUNๅ€บๅˆธๅ’Œ้ƒจๅˆ†้ขๅค–็š„KUNๅ€บๅˆธๅฅ–ๅŠฑ.
function recollateralize(address collateralToken, uint256 collateralAmount, uint256 minimumReceivedShareAmount) external payable notLocked nonReentrant { require(isCollateralToken(collateralToken) && !collaterals[collateralToken].deprecated, "deprecated-collateral-token"); uint256 gapCollat...
11,356,444
pragma solidity ^0.5.12; import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol"; import "../../interfaces/curve/ICurveModule.sol"; import "../../interfaces/curve/IFundsModule.sol"; import "../../interfaces/curve/...
Withdraw liquid tokens from the pool to Address of the user, who sends tokens. Should have enough allowance. amount Amount of tokens to deposit poolFee Pool fee will be sent to pool owner/
function withdrawLTokens(address to, uint256 amount, uint256 poolFee) public onlyFundsOperator { lBalance = lBalance.sub(amount); require(lToken().transfer(to, amount), "FundsModule: withdraw failed"); }
2,487,199
./full_match/1/0x2d68676c40Bf820Eb84e3B7d8d77a1C473b08B61/sources/contracts/crossChainSwaps/CrossChainSwapsStorage.sol
Update address of vault contract. Restricted function, can only be called by owner vaultAddress_ address of new vault
function _setVault(address vaultAddress_) internal { if (vaultAddress_ == address(0)) revert SwapError(SwapErrorCode.INVALID_ADDRESS); _state.vaultAddress = vaultAddress_; }
17,067,027
/* Copyright 2018 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
If set to true then all future transfers will be rejected.
function setRejectTransferFlag(bool _shouldRejectTransfer) external { shouldRejectTransfer = _shouldRejectTransfer; }
12,609,865
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts@3.2.0/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts@3.2.0/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts@3.2.0/math/SafeMath.sol"; import "@openzeppelin/contracts@3.2.0/access/Ownable.sol"; import "./Meshco...
Withdraw without caring about rewards. EMERGENCY ONLY.
function emergencyWithdraw(uint256 _pid) external validatePoolByPid(_pid){ PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; uint256 amount = user.amount; user.amount = 0; user.rewardDebt = 0; user.rewardRemain = 0; po...
13,112,120
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @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. * * By default, the owner account will be the on...
Purchase with token private sales fn Requires: 1. token amount to transfer, editions number of editions to purchase (needs to have same tokens) Attempt to transfer tokens for mint
function purchaseWithTokens(uint256 editions) public nonReentrant { require(numberSoldPrivate + editions <= numberPrivateSale, "No sale"); require(editions > 0, "Min 1"); try privateSaleToken.transferFrom( msg.sender, mintable.owner(), ...
11,949,955
./full_match/1/0x84BA914B1a2411d31A365C17D55f8C02a8ca31f4/sources/contracts/DIX.sol
Set URI of tokens for later reveal to protect randomness
function setURI(string memory newuri) external onlyOwner { _setURI(newuri); emit SetURI(newuri); }
17,007,779
pragma solidity ^0.4.19; library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' ...
Adds two numbers, throws on overflow./
function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; }
15,820,964
// SPDX-License-Identifier: MIT pragma solidity 0.8.0; import "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/cont...
Mints autoBTC+ with BTCB. _amount Amount of BTCB used to mint autoBTC+/
function mintAutoBTCPlus(uint256 _amount) public { require(_amount > 0, "zero amount"); IERC20Upgradeable(BTCB).safeTransferFrom(msg.sender, address(this), _amount); IAutoBTC(AUTO_BTC).mint(_amount); uint256 _autoBtc = IERC20Upgradeable(AUTO_BTC).balanceOf(address(this)); ...
5,536,494