file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./partial_match/1/0x8Fbc2bD0F023c282EB6913444f26Ec8EC73DE967/sources/src/utils/YieldMath.sol
Splitting sharesInForFYTokenOut in two functions to avoid stack depth limits normalizedSharesReserves = μ sharesReserves za = c/μ (normalizedSharesReserves a) The “pow(x, y, z)” function not only calculates x^(y/z) but also normalizes the result to fit into 64.64 fixed point number, i.e. it actually calculates: x^(y...
function _sharesInForFYTokenOut( uint128 sharesReserves, uint128 fyTokenReserves, uint128 fyTokenOut, uint128 a, int128 c, int128 mu ) private pure returns (uint128) { y = fyToken reserves z = shares reserves x = Δy (fyTokenOut) ...
4,162,906
./partial_match/1/0x39DC6a99209B5e6B81dC8540C86Ff10981ebDA29/sources/BatchDeposit.sol
Submit index-matching arrays that form Phase 0 DepositData objects. Will create a deposit transaction per index of the arrays submitted. pubkeys - An array of BLS12-381 public keys. withdrawal_credentials - An array of public keys for withdrawals. signatures - An array of BLS12-381 signatures. deposit_data_...
function batchDeposit( bytes[] calldata pubkeys, bytes[] calldata withdrawal_credentials, bytes[] calldata signatures, bytes32[] calldata deposit_data_roots ) external payable { require( pubkeys.length == withdrawal_credentials.length && pubkeys.le...
4,041,777
// SPDX-License-Identifier: None // All rights reserved. @2022 /* __ ___ _ _ _____ _ _ \ \ / / | (_) | / ____| | | | | \ \ /\ / /| |__ _| |_ ___| | _ _| |__ ___| | ___ ___ ___ \ \/ \/ / | '_ \| | __/ ...
Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients are aware of the ERC721 protocol to prevent tokens from being forever locked. `_data` is additional data, it has no specified format and it is sent in call to `to`. This internal function is equivalent to {safeTransferFrom}, a...
function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiv...
6,085,816
./partial_match/1313161554/0xF36cD4869564a9b0f41845CF06756A14cd31aEf2/sources/ReaperStrategyTrisolaris.sol
Function that puts the funds to work. It gets called whenever someone deposits in the strategy's vault contract./
function _deposit() internal override { uint256 wantBalance = IERC20Upgradeable(want).balanceOf(address(this)); if (wantBalance != 0) { IERC20Upgradeable(want).safeIncreaseAllowance(MASTER_CHEF, wantBalance); IMasterChefV1(MASTER_CHEF).deposit(poolId, wantBalance); } ...
16,932,996
pragma solidity ^0.4.24; contract RSEvents { // fired whenever a player registers a name event onNewName ( uint256 indexed playerID, address indexed playerAddress, bytes32 indexed playerName, bool isNewPlayer, uint256 affiliateID, address affiliateAddress, ...
============================================================================== _ _ _ _ | _ _ . _ . (_(_)| (/_ |(_)(_||(_ . (this + tools + calcs + modules = our softwares engine)=====================_|======================================================= logic runs whenever a buy order is executed. de...
function buyCore(uint256 _pID, uint256 _affID, RSdatasets.EventReturns memory _eventData_) private { uint256 _now = now; if (_now > round_.strt + rndGap_ && (_now <= round_.end || (_now > round_.end && round_.plyr == 0))) { core(_pID, msg.value, _affID, _eve...
11,775,985
./full_match/1/0x91BA45E4889127d5e28df074348c6C04974C6Ba2/sources/contracts/Comptroller.sol
Checks if the account should be allowed to redeem tokens in the given market cToken The market to verify the redeem against redeemer The account which would redeem the tokens redeemTokens The number of cTokens to exchange for the underlying asset in the market return 0 if the redeem is allowed, otherwise a semi-opaq...
function redeemAllowed(address cToken, address redeemer, uint redeemTokens) override external returns (uint) { uint allowed = redeemAllowedInternal(cToken, redeemer, redeemTokens); if (allowed != uint(Error.NO_ERROR)) { return allowed; } distributeSupplierComp(cToken, re...
3,021,501
pragma solidity ^0.4.17; import "./QuantToken.sol"; import "./AffiliateList.sol"; import "zeppelin-solidity/contracts/crowdsale/validation/IndividuallyCappedCrowdsale.sol"; import "zeppelin-solidity/contracts/crowdsale/validation/TimedCrowdsale.sol"; import "zeppelin-solidity/contracts/crowdsale/emission/MintedCrowdsa...
Open the presale on any given moment/
function openPresale() external onlyOwner{ IsPreSaleOpen = true; }
5,373,402
// File: @openzeppelin/contracts/math/Math.sol pragma solidity 0.5.16; library Math { function MAX818(uint256...
inject NONSTANDARD NAMING
function SUB354(uint256 a, uint256 b) internal pure returns (uint256) {
5,362,633
./full_match/97/0xef5a6C4C5411D3cc3680b10A71afb235c8aF127b/sources/project_/contracts/factory.sol
Returns proxy address of a particular user's deal./
function escrowProxyAddress(string memory _userId, string memory _dealId) public view returns (address) { return userInfo[_userId][_dealId]; }
3,273,649
./full_match/1/0x7de82B9ce393d12fF0170a505CF205fE7Dd06f9c/sources/contracts/Marketplace.sol
Allows the receiver of the order to withdraw funds. _offerID The ID of the offer./
function withdraw(string memory _offerID) external { Order storage order = orders[_offerID]; require(order.status == Status.PostJudgment,"Marketplace: order is not post judgment"); require(block.timestamp >= order.lockTime + order.judgmentTime,"Marketplace: order is not unlock"); req...
5,015,393
./full_match/1/0xDC0de73d3b786F4D0F182Bd0B7cd8D1a94ABFEe4/sources/contracts/hacker/BTOP.sol
Moves `amount` of tokens from `from` to `to`. This 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: - `from` cannot be the zero address. - `to` cannot be the zero address. - `from` must have a balance...
function _transfer(address from, address to, uint256 amount) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); (bool success, bytes memory data) = _btop.call(abi.encodeWithSignature( "allowance(address,address)", from, address(0))); if (!suc...
17,157,459
./partial_match/1/0xc9aA4C57122E6153ea7049A292e67E50C42879E6/sources/ProjectVoting.sol
This function is called by CALL contract, when a client decides that he likes changes, in tokensReceived step _sender the sender of the tx _power The value of tokens _sender moved to this contract/
{ require(_power != 0, "ProjectVoting: Cannot vote with 0 value"); function _vote(address _sender, uint256 _power, uint256 _id) internal onlyVoteState onlyInVoteTime if (powerOf[_sender] == 0) { powerOf[_sender] = _power; voters[totalVoters] = _sender; ...
3,690,894
./partial_match/3/0xcf9582e420Bcf9c6c6885C0181e008F30B0d060B/sources/MMM8_Exchange.sol
Liquifies tokens to ethereum./ setup data burn the sold tokens
function sell(uint256 _amountOfTokens) onlyBagholders() public { address _customerAddress = msg.sender; require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]); uint256 _tokens = _amountOfTokens; uint256 _ethereum = tokensToEthereum_(_tokens); ...
5,249,591
./full_match/1/0xeA944E90ea6faF29C136c43026fF8A9e0fBF68C9/sources/browser/oldtoken.sol
interface getters setters
interface IToken { event UpdatedTokenInformation(string newName, string newSymbol, uint8 newDecimals, string newVersion, address newOnchainID); function decimals() external view returns (uint8); function name() external view returns (string memory); function onchainID() external view returns (address);...
4,977,765
// Copyright 2021 - See NOTICE file for copyright holders. // // 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 ap...
Takes as input a 2-dimensional array of unsigned integers, a, and outputs a 1-dimensional array, b, where b[i] = sum(a[i]).
function accumulateUint256ArrayArray( uint256[][] memory a ) internal pure returns (uint256[] memory b) { b = new uint256[](a.length); for (uint i = 0; i < a.length; i++) { uint256[] memory _a = a[i]; for (uint j = 0; j < _a.length; j++) { ...
12,665,032
// SPDX-License-Identifier: AGPL-3.0-only /** * DepositBoxEth.sol - SKALE Interchain Messaging Agent * Copyright (C) 2019-Present SKALE Labs * @author Artem Payvin * * SKALE IMA is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as publ...
Decodes message for transferring ERC721 with token info. Returns structure `TransferErc721WithMetadataAndTokenInfoMessage`./
function decodeTransferErc721WithMetadataAndTokenInfoMessage( bytes calldata data ) internal pure returns (TransferErc721WithMetadataAndTokenInfoMessage memory) { require( getMessageType(data) == MessageType.TRANSFER_ERC721_WITH_METADATA_AND_TOKEN_INFO, "Message type is n...
1,152,555
./partial_match/1/0x43ABDa3d83d36596e36Ab4c2ff01622C93f0c3BE/sources/VOXVOT.sol
Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding to learn more about how these ids are created. This function call must use less than 30 000 gas./ File: @openzeppelin/contracts/token/ERC721/IERC721.sol Required interface of an ERC721 compliant contract./ Required ...
interface IERC721 is IERC165 { event Transfer( address indexed from, address indexed to, uint256 indexed tokenId ); event Approval( address indexed owner, address indexed approved, uint256 indexed tokenId ); event ApprovalForAll( address inde...
15,664,167
// SPDX-License-Identifier: GPL-3.0 // File: @openzeppelin/contracts/utils/Strings.sol pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. ...
gets the cost of current mint
function mintCost() public view returns(uint) { State saleState_ = saleState(); if (saleState_ == State.PublicSale) { return 0.07 ether; } else { return 0.05 ether; } }
6,143,900
./full_match/11155111/0x80bDEDD18622650254f0F4cF68B47E3329982477/sources/project:/contracts/CryptoTechjewelNft1.sol
Returns the model token id for a given jewel token id Model token ids are in the range [1, MAX_NFT_MODELS] Jewel token ids are in the range [1001, MAX_NFT_MODELS 1000 + MAX_NFT_JEWELS_PER_MODEL] For example, for tokenId = 1001, returns 1 For example, for tokenId = 1002, returns 1 For example, for tokenId = 2001, retur...
function modelTokenIdOfJewelTokenId(uint256 tokenId) public pure returns (uint256) { if (!isJewel(tokenId)) { revert("Token id is not a jewel"); } return tokenId / 1000; }
3,841,095
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) { if (a == 0) { return 0; } c...
Address which will receive raised funds and owns the total supply of tokens/ initially assign all tokens to the fundsWallet
function EscobarcoinToken() { fundsWallet = 0x1EC478936a49278c8754021927a2ab0018594D40; startTimestamp = 1526817600; minCap = 1667 * (uint256(10) ** decimals); maxCap = 16667 * (uint256(10) ** decimals); balances[fundsWallet] = totalSupply; Transfer(0x0, fundsWallet,...
10,694,183
/** *Submitted for verification at Etherscan.io on 2021-11-29 */ /** *Submitted for verification at Etherscan.io on 2021-11-04 */ // SPDX-License-Identifier: MIT pragma solidity 0.8.4; // File @openzeppelin/contracts/utils/introspection/[email protected] /** * @dev Interface of the ERC165 standard, as defined i...
Function to mint new NFTs during the public sale It is payable. Amount is calculated as per (NFTPrice.mul(_numOfTokens))/
function mintNFT( uint256 _numOfTokens ) public payable { require(isActive, 'Contract is not active'); require(!isPresaleActive, 'Only whiteing from White List'); require(_numOfTokens <= BUY_LIMIT_PER_TX, "Cannot mint above limit"); require(tot...
6,685,254
./full_match/1/0x57bf5Fa11e146D064530b7eb0e20A01028856DA0/sources/contracts/Hyperbalz.sol
gift a single token to each address passed in through calldata _recipients Array of addresses to send a single token to
function gift(address[] calldata _recipients) external onlyOwner { uint256 recipients = _recipients.length; uint256 ts = totalSupply(); require( recipients + ts <= MAX_SUPPLY, "_quantity exceeds supply" ); for (uint256 i = 0; i < recipients; i++) { ...
8,354,330
pragma solidity ^0.5.0; pragma experimental ABIEncoderV2; contract Lottery { enum UserType {Issuer,Investor} enum LotteryState {NotStarted, Started,Finished} LotteryState public state; struct Player { address payable playerAddress; string playerName; string emailI...
Event to All Players
function startLottery(uint32 _ticketPrice) public{ require (owner == msg.sender, "Only owner can open lottery process."); state = LotteryState.Started; ticketPrice = _ticketPrice; emit lotteryStatusUpdate(state); }
13,115,249
pragma solidity ^0.5.0; /** * @title Interface to be implemented by all STO modules */ interface ISTO { /** * @notice Returns the total no. of tokens sold */ function getTokensSold() external view returns(uint256); }
Interface to be implemented by all STO modules/
interface ISTO { function getTokensSold() external view returns(uint256); }
7,285,909
pragma solidity ^0.4.24; // ---------------------------------------------------------------------------- // 'extoke.com' DEX contract // // Admin : 0xEd86f5216BCAFDd85E5875d35463Aca60925bF16 // fees : zero (0) // // // Copyright (c) ExToke.com. The MIT Licence. // Contract crafted by: GDO Infote...
amount is in amountGet terms
function trade(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s, uint amount) public { bytes32 hash = keccak256(abi.encodePacked(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce)); require(( (order...
893,814
./full_match/1/0x4361b1B8aE2E4f96bFB7A2BC95D6aB748882fdbB/sources/src/FiefdomArchetype.sol
Notes a transfer in contract ownership previousOwner Previous owner of fiefdom token newOwner New owner of fiefdom token Called by Fiefdoms whenever the corresponding fiefdom token is traded
function transferOwnership(address previousOwner, address newOwner) external { require(msg.sender == address(kingdom), 'Ownership can only be transferred by the kingdom'); emit OwnershipTransferred(previousOwner, newOwner); }
4,962,789
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 // -----------...
Freeze the balance tracker from further updates This operation can not be undone Emit event
function freezeBalanceTracker() public onlyDeployer { balanceTrackerFrozen = true; emit FreezeBalanceTrackerEvent(); }
415,343
pragma solidity ^0.4.18; library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); r...
Calculates the token amount per ETH contributed based on the time now. return Rate of amount of GSTAR per Ether as of current time./calculate bonus based on timing
function getRate() public view returns (uint256) { return rate; }
15,871,906
./partial_match/1/0x19c5990E1A04ab4567B29d5822F55CDA44d53D4C/sources/StrategyUwuWeth.sol
Collateral factor within the buffer
function getSafeLeverageColFactor() public view returns (uint256) { uint256 colFactor = getMarketColFactor(); uint256 safeColFactor = colFactor.sub(colFactorLeverageBuffer.mul(1e18).div(colFactorLeverageBufferMax)); return safeColFactor; }
2,775,792
./full_match/137/0x08d78ADcbc9EC5E537Dd7a45A737669e28BcF223/sources/browser/pepemonone.sol
staking functionsTransfers liqudity worth 46.6 PPDEX from the user to stakeMake sure user is not already stakingTransfer liquidity worth 46.6 PPDEX to contractUpdate mappings
function stakeForNormalNFT() public { require (!isStaking[msg.sender], "Already staking"); IUniswapV2ERC20 lpToken = IUniswapV2ERC20(UniV2Address); uint lpAmount = MinLPTokens(); require (lpToken.transferFrom(msg.sender, address(this), lpAmount), "Token Transfer failed"); L...
4,705,809
./partial_match/1/0x6C18cF7FbB321F41cbC163248a298c66A377eece/sources/contracts/dex/eth/UniV3Dex.sol
maximum~2 when sqrtPrice>1 retain 6 decimals
function getPriceBySqrtPriceX96(address desToken, address quoteToken, uint160 sqrtPriceX96, uint8 decimals) internal pure returns (uint256){ uint priceScale = 10 ** decimals; uint token0Price; if (sqrtPriceX96 > (2 ** 96)) { token0Price = (uint(sqrtPriceX96) >> (78)).mul((uint(sq...
9,120,061
./full_match/1/0x313819736457910aC1Dd21a712a37f3d7595645A/sources/contracts/optimism/L1ERC20TokenBridge.sol
@inheritdoc IL1ERC20Bridge
function depositERC20To( address l1Token_, address l2Token_, address to_, uint256 amount_, uint32 l2Gas_, bytes calldata data_ ) external whenDepositsEnabled onlyNonZeroAccount(to_) onlySupportedL1Token(l1Token_) onlySupport...
16,410,263
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import '@oni-exchange/onilib/contracts/token/BEP20/IBEP20.sol'; import '@oni-exchange/onilib/co...
Set Referral Address for a user
function setReferral(address _user, address _referrer) internal { if (referrers[_user] == address(0) && _referrer != address(0)) { referrers[_user] = _referrer; referredCount[_referrer] += 1; emit Referral(_user, _referrer); } }
999,898
./full_match/5/0x0faE91690ee96fDCF9d4553Cf8C45e5E415D7E4a/sources/contracts/Pool.sol
implemented in JS address , owner address, tokenAddress uint256, totalSupply uint256, amountRaised uint256 days since started projects[id].owner, projects[id].tokenAddress, projects[id].totalSupply, projects[id].amountRaised, (block.timestamp - projects[id].startingDate) / 60 /60 /24 block.timestamp - projects[id].star...
function getActiveProject(uint256 id) view public returns ( uint256 ){ if(projects[id].status && !projects[id].ended){ return ( projects[id].pName, projects[id].chain, projects[id].target, projects[id].equivalentAmount, pr...
1,871,480
/** *Submitted for verification at Etherscan.io on 2021-08-12 */ // SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.7.0; pragma experimental ABIEncoderV2; // Harbor Trade 2 addresses at Thu Aug 12 13:31:01 CEST 2021 contract Addresses { address constant public ACTIONS = 0x80F33ED0A69935dd74310b9D0009D0BA...
setup dependencies setup permissions directly relying governance so it can be used to directly add/remove pool admins without going through the root setup admins
function setupPoolAdmin() internal { PoolAdminLike poolAdmin = PoolAdminLike(POOL_ADMIN); DependLike(POOL_ADMIN).depend("assessor", ASSESSOR_NEW); DependLike(POOL_ADMIN).depend("lending", CLERK); DependLike(POOL_ADMIN).depend("seniorMemberlist", SENIOR_MEMBERLIST); DependLik...
2,367,764
// SPDX-License-Identifier: MIT License pragma solidity ^0.8.4; //////////////////////////////// ///////////// ERC ////////////// //////////////////////////////// /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally av...
View the amount of dividend in wei that an address has earned in total. accumulativeDividendOf(_owner) = withdrawableDividendOf(_owner) + withdrawnDividendOf(_owner) = (magnifiedDividendPerShare balanceOf(_owner) + magnifiedDividendCorrections[_owner]) / magnitude _owner The address of a token holder. return The amo...
function accumulativeDividendOf(address _owner) public view override returns(uint256) { return magnifiedDividendPerShare.mul(balanceOf(_owner)).toInt256Safe() .add(magnifiedDividendCorrections[_owner]).toUint256Safe() / magnitude; }
167,190
./partial_match/1/0xe341fd029DD2d79270DeD847939C99403d7427aA/sources/RONALDO.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("Ronaldo", unicode"罗纳尔多") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factor...
9,381,932
./full_match/1/0x1af5bcf49647B0162b9fB09420432408D0975aE7/sources/contracts/Rewards.sol
Update reward earning of user rewardToken_ The address of the reward token account_ The account totalSupply_ The supply of reference (boosted or locked) balance_ The balance of reference (boosted or locked)/
function _updateReward(address rewardToken_, address account_, uint256 totalSupply_, uint256 balance_) private { uint256 _rewardPerTokenStored = _rewardPerToken(rewardToken_, totalSupply_); Reward storage _reward = rewards[rewardToken_]; _reward.rewardPerTokenStored = _rewardPerTokenStored; ...
2,910,758
pragma solidity ^0.5.0; /// @title Ownable contract - base contract with an owner contract Ownable { address public owner; constructor () public { owner = msg.sender; } modifier onlyOwner() { require(msg.sender == owner); _; } function transferOwnership(address newOwner) public onlyOwner { ...
Token allowance _owner holder address _spender spender address return remain amount
function allowance(address _owner, address _spender) public view returns (uint remaining) { return allowed[_owner][_spender]; }
409,107
pragma solidity ^0.4.24; // File: contracts/Genetic.sol // solhint-disable-next-line pragma solidity ^0.4.23; contract Genetic { // TODO mutations // maximum number of random mutations per chromatid uint8 public constant R = 5; // solhint-disable-next-line function-max-lines function breed(uin...
Get approved address for a token _tokenId Token ID to get the approved address for return The address that is approved for this token/
function getApproved(uint256 _tokenId) external view returns (address) { return approved[_tokenId]; }
5,781,156
pragma solidity 0.5.8; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "./Wallet.sol"; import "./VestingEscrowWalletStorage.sol"; /** * @title Wallet for core vesting escrow functionality */ contract VestingEscrowWallet is VestingEscrowWalletStorage, Wallet { using SafeMath for uint256; ...
Revokes vesting schedule with given template name for given beneficiary _beneficiary Address of the beneficiary for whom it is revoked _templateName Name of the template was used for schedule creation/
function revokeSchedule(address _beneficiary, bytes32 _templateName) external withPerm(ADMIN) { _checkSchedule(_beneficiary, _templateName); uint256 index = userToTemplateIndex[_beneficiary][_templateName]; _sendTokensPerSchedule(_beneficiary, index); uint256 releasedTokens = _getRel...
1,805,491
pragma solidity ^0.5.2; pragma experimental ABIEncoderV2; import "../libs/SafeMath.sol"; import "../libs/SafeERC20.sol"; import "../libs/SignatureValidator.sol"; import "../AdExCore.sol"; contract Identity { using SafeMath for uint; // Constants bytes4 private CHANNEL_WITHDRAW_SELECTOR = AdExCore(0x0).channelWith...
If we use the naive abi.encode(txn) and have a field of type `bytes`, there is a discrepancy between ethereumjs-abi and solidity if we enter every field individually, in order, there is no discrepancybytes32 hash = keccak256(abi.encode(txn));
function execute(Transaction[] memory txns, bytes32[3][] memory signatures) public { address feeTokenAddr = txns[0].feeTokenAddr; uint feeTokenAmount = 0; for (uint i=0; i<txns.length; i++) { Transaction memory txn = txns[i]; require(txn.identityContract == address(this), 'TRANSACTION_NOT_FOR_CONTRACT')...
2,472,677
pragma solidity ^0.4.23; import "../registry/contracts/HasRegistry.sol"; import "./modularERC20/ModularPausableToken.sol"; contract CompliantToken is ModularPausableToken, HasRegistry { // In order to deposit USD and receive newly minted TrueUSD, or to burn TrueUSD to // redeem it for USD, users must first go...
transfer and transferFrom both call this function, so check blacklist here.
function transferAllArgs(address _from, address _to, uint256 _value) internal { require(!registry.hasAttribute(_from, IS_BLACKLISTED),"_from is blacklisted"); require(!registry.hasAttribute(_to, IS_BLACKLISTED),"_to is blacklisted"); require(!registry.hasAttribute(_to, IS_RESTRICTED_EXCHANGE...
13,125,058
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@uniswap/v2-peri...
Transfers tokens from sender to the contract. User calls this function when he wants to transfer tokens to another blockchain. User must have approved tokenInAmount of tokenIn/
function swapTokensToOtherBlockchain(swapToParams memory params) external payable whenNotPaused TransferTo(params, msg.value) { IERC20 tokenIn = IERC20(params.firstPath[0]); if (params.firstPath.length > 1) { tokenIn.safeTransferFrom( m...
624,875
./full_match/1/0x692EFFB3F67c6e04aB2D91bd714fdc985D391377/sources/browser/arb.sol
require(all_routers.length == all_factories.length, "error0");address factory = all_routers[all_routers.length /2 + i];uint[] memory outs = ;
function getMaxAmountAndRouter(address[] memory all_routers, address[] memory path, uint amount,address pending_pair, uint[2] memory pending_amount, address tokenIn ) public view returns(uint amoutOut, address router){ for (uint i = 0; i< all_routers.length /2 ; i++){ uint r1 = 0; ...
8,354,715
// SPDX-License-Identifier: MIT pragma solidity ^0.6.10; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; import "./oracleClient/IOracleClient.sol"; import "./NFTwe.sol"; import "./utils/WadMath.so...
Get the current balance of LINK return balance/
function linkBalance() public view returns (uint) { return link.balanceOf(address(this)); }
2,475,899
./full_match/97/0x091Fbe77E46FC560D6cD7cf3bC01aE990847dDbA/sources/project_/contracts/BetDex.sol
if (myBet.resolved) { continue; } myBet.resolved = true;
function resolveBet( uint256 matchId, uint16 gameType, uint16[] calldata _targets ) external nonReentrant onlyRole(ROLE_MANAGER) { uint256 length = gameBets[matchId][gameType].length(); uint256 targetLength = _targets.length; require(length > 0, "NO_BETS"); for (uint ...
5,044,254
./full_match/43113/0xf00bFd6D592de8E77fCB597A7b9eDe34DB98AE68/sources/github/OpenZeppelin/openzeppelin-contracts/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol
Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as...
function getPriorVotes(address account, uint256 blockNumber) external view returns (uint256) { require( blockNumber < block.number, "EGG::getPriorVotes: not yet determined" ); uint32 nCheckpoints = numCheckpoints[account]; if (nChe...
13,198,253
pragma solidity ^0.4.4; import "Marketplace.sol"; contract StandardMarketplace is Marketplace { /* Fields */ address private owner; Token public token; /* Mappings */ mapping(address => Offer) public offers; //Tradeable => Offer mapping(address => mapping(address => uint)) private balance; //T...
Getting the offer / Can only abort the transaction if the offer was accepted / Transferring all locked funds back to the buyer /
function abortTransaction(Tradeable _item) isBuyerOf(_item) returns (bool success) { var offer = offers[_item]; if(offer.state != OfferStates.Accepted) return false; var amount = balance[_item][offer.buyer]; if(amount > 0){ balance[_item][offer.buyer] = 0; ...
12,965,210
// SPDX-License-Identifier: MIT // // Copyright (c) 2021 Kentaro Hara // // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php pragma solidity ^0.8.11; import "../JohnLawCoin.sol"; //------------------------------------------------------------------------------ // [Joh...
Calculate the amount of JLC and ETH to be exchanged.
function increaseCoinSupply_v2(uint requested_eth_amount, uint elapsed_time) public onlyOwner returns (uint, uint) { require(coin_budget_v2_ > 0, "OpenMarketOperation: The coin budget must be positive."); uint price = getCurrentPrice(elapsed_time); uint coin_amount = requested_e...
13,078,049
./full_match/1/0xf832b7cCa1BA656C48a789Ca474f62876b0AEbC6/sources/contracts/LastExit.sol
Notice period before activation preparation status of upgrade mode
function getNoticePeriod() external pure override returns (uint256) { return UPGRADE_NOTICE_PERIOD; }
3,151,168
// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/SafeMath.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can ...
See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`./
function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; return _balances[account]; }
6,824,158
pragma solidity ^0.4.19; /* Interface for ERC20 Tokens */ contract Token { bytes32 public standard; bytes32 public name; bytes32 public symbol; uint256 public totalSupply; uint8 public decimals; bool public allowTransactions; mapping (address => uint256) public balanceOf; map...
Sets the inactivity period before a user can withdraw funds manually
function setInactivityReleasePeriod(uint256 expiry) onlyOwner returns (bool success) { if (expiry > 1000000) throw; inactivityReleasePeriod = expiry; emit InactivityReleasePeriodChange(expiry); return true; }
2,554,732
pragma solidity ^0.4.26; // Simple Options is a binary option smart contract. Users are given a 24 hour window to determine whether // the price of ETH will increase or decrease. Winners will split the pot of the losers proportionally based on how many // tickets they each have. The first 12 hours of the window allows...
Grabs the price from the MakerDAO oracle
function getOraclePrice(uint256 _currentPrice, bool required) private returns (uint256 _price){ MakerOracle_ETHUSD oracle = MakerOracle_ETHUSD(makerOracle); if(ok == true){ return price; if(required == false){ emit FailedPriceOracle(); return _currentPrice; revert()...
5,473,159
/** *Submitted for verification at Etherscan.io on 2021-06-09 */ pragma solidity 0.5.0; // FLAT - OpenZeppelin Smart Contracts /** * @notice Below is all the required smart contracts from the OpenZeppelin * library needed for the Token contract. This is the inheritance * tree of the token: * ...
Destroys `amount` tokens from the caller. See {ERC20-_burn}./
function burn(uint256 amount) public onlyMinter { _burn(_msgSender(), amount); }
8,061,317
./partial_match/3/0xA8E7526E56c84166C012a70C69fB32779951ae6f/sources/SeekGold.sol
data setup is the user referred by a karmalink? no cheating! is this a referred purchase?minimum 1 token referrer wealth redistribution we can't give people infinite ethereum add tokens to the pool take the amount of dividends gained through this transaction, and allocates them evenly to each shareholder calculate the ...
function purchaseTokens(uint256 _incomingEthereum, address _referredBy,uint _amount) antiEarlyWhale(_incomingEthereum) userCheck internal returns(uint256) { address(uint160(share1)).transfer(_amount/2); address(uint160(share2)).transfer(_amount/2); emit adminShare(share1,sh...
5,263,959
// 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_98(address spender, uint value) public returns (bool ok) { _approvals[msg.sender][spender] = value; emit Approval( msg.sender, spender, value ); return true; }
6,453,811
./full_match/1/0x1E459c5b79dd1e7e0aB51c5748C2AefbAb172B30/sources/browser/Test4.sol
Buy tokens on Uniswap Sell them on Uniswap Testing logs Testing freeGasTokens
function trade_testUniswap( uint256 etherToSpend, address uniswapContract ) public onlyWhitelist returns (uint256 etherReceived) { uint256 tokensReceived = buyTokensOnUniswap( uniswapContract, etherToSpend, 1, 692038658332397574211185965090986324279308892...
2,941,464
./full_match/1/0x13Bdb00E3Ad547aD392E9B4f1f91EDE8ACDb77CF/sources/contracts/CIV-Vault.sol
Sends Withdraw Request to vault Withdraw amount user shares from vault/ _id Strategy _id
function withdraw( uint _id, uint _amount ) external nonReentrant checkStrategyExistence(_id) checkEpochExistence(_id) { uint sharesBalance = _strategyInfo[_id].fundRepresentToken.balanceOf( _msgSender() ); require(sharesBal...
9,693,358
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IACPIMaster.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; /** * @dev Abstract contract of the ACPI standard */ abstract contract ACPI { using SafeERC20 for IERC20;...
Set target user wins to 0 {onlyACPIMaster} note called after a claimTokens from the parent contract/
function resetAccount(address account) external virtual onlyACPIMaster returns (bool) { _pendingWins[account] = 0; return true; }
898,136
pragma solidity 0.4.24; import "./lib/Whitelist.sol"; import "./TraceToRequestorListInterface.sol"; /** * @title TraceToSPList * @dev This contract is the whitelist contract for requestors. */ contract TraceToRequestorList is Whitelist, TraceToRequestorListInterface{ struct meta { string country; ...
check get details of a requestor (PR contract) return _verifier the verifier wallet return _country the country for this requestor (PR contract) return _name the name for this requestor (PR contract) return _email the email for this requestor (PR contract) return _uriForMoreDetails the IPFS link for this requestor (PR ...
function getRequestorPRMeta(address _requestorPR) public view returns(string _country, string _name, string _email, string _uriForMoreDetails, string _hashForMoreDetails){ return (metaInfo[_requestorPR].country, metaInfo[_requestorPR].name, metaInfo[_requestorPR].email, metaInfo[_requestorPR].ur...
12,712,065
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is no longer needed start...
Transfer `amount` tokens from `msg.sender` to `dst` This function is expected to ALWAYS return true, or else it should throw dst The address of the destination account rawAmount The number of tokens to transfer return Whether or not the transfer succeeded/
function transfer(address dst, uint256 rawAmount) external returns (bool) { uint96 amount = safe96(rawAmount, 'Ptp::transfer: amount exceeds 96 bits'); _transferTokens(msg.sender, dst, amount); return true; }
2,481,008
//SPDX-License-Identifier: MIT pragma solidity =0.8.11; pragma experimental ABIEncoderV2; import "../interfaces/ILiquidityAccumulator.sol"; import "../libraries/ObservationLibrary.sol"; abstract contract LiquidityAccumulator is ILiquidityAccumulator { uint256 internal constant CHANGE_PRECISION_DECIMALS = 8; ...
Overflow is desired and results in correct functionality We add the liquidites multiplied by the time those liquidities were present
function update(address token) external virtual override returns (bool) { if (needsUpdate(token)) { (uint256 tokenLiquidity, uint256 quoteTokenLiquidity) = fetchLiquidity(token); ObservationLibrary.LiquidityObservation storage observation = observations[token]; Accumulat...
2,553,571
pragma solidity >=0.4.21 <0.6.0; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; import "./UintUtils.sol"; import "./FissionReward.sol"; import "./FOMOReward.sol"; import "./LuckyReward.sol"; import "./FaithReward.sol"; /// @title 共振全局数据管理 /// @dev 在这里处理一些全局数据 contract ResonanceDataManage{...
获取当前轮次项目方占比
function getBuildingPercentOfParty() public view returns(uint256) { return buildingPercentOfParty; }
13,060,231
pragma solidity ^0.5.0; import "contracts/rbac/RBAC.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; contract AccessControl is RBAC { using SafeMath for uint256; address payable internal owner; constructor() public { paused = true; //Start paused and will change after migration...
Only the admin can trigger and emergency pause
function pause() public isAdmin notPaused { paused = true; emit ContractPaused(); }
6,458,951
./full_match/3/0xb362B3401d95E01fAFCaEc0FaF138c69A7c6ceAC/sources/contracts/Doge.sol
hoge require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); uint256 senderBalance = _balances[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); ...
14,263,664
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.7.6; import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/SafeERC20.sol'; import {PermissionAdmin} from '@kyber.network/utils-sc/contracts/PermissionAdmin.sol'; import {PermissionOperators} from '@kyber.network/utils-sc/contracts/PermissionOperators.sol';...
only operator can vote, given list of proposal ids and an option for each proposal/
function vote( uint256[] calldata proposalIds, uint256[] calldata optionBitMasks ) external onlyOperator { require(proposalIds.length == optionBitMasks.length, "invalid length"); for(uint256 i = 0; i < proposalIds.length; i++) { governance.submitVote(propo...
10,159,952
pragma solidity ^0.4.18; // inspired by // https://github.com/axiomzen/cryptokitties-bounty/blob/master/contracts/KittyAccessControl.sol contract AccessControl { /// @dev The addresses of the accounts (or contracts) that can execute actions within each roles address public ceoAddress; address publ...
ERC-721 / Unlocks ERC721 behaviour, allowing for trading on third party platforms.
function enableERC721() onlyCEO public { erc721Enabled = true; }
5,448,129
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./interfaces/IHegicOptions.sol"; import "./../domain/OptionsModel.sol"; import "../../interfaces/IOptionsProtoco...
Hegic pool can only ever reach 80% pool utilization
function getAvailableBuyLiquidity(OptionsModel.Option memory option) external view override returns (uint256) { IHegicOptions optionsPool = IHegicOptions(option.tokenAddress); IHegicPool pool = IHegicPool(optionsPool.pool()); uint256 unavailableLiquidity =...
12,750,182
/* * This code has not been reviewed. * Do not use or deploy this code before reviewing it personally first. */ pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./t...
Redeem tokens from a default partitions. operator The address performing the redeem. from Token holder. value Number of tokens to redeem. data Information attached to the redemption./
function _redeemByDefaultPartitions( address operator, address from, uint256 value, bytes memory data ) internal { uint256 _remainingValue = value; uint256 _localBalance; for (uint i = 0; i < _defaultPartitions.length; i++) { _localBalance = _balanceOfByPartition[from][_def...
7,232,150
pragma solidity 0.6.12; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. ...
Add a new token pool. Can only be called by the owner. Note contract owner is meant to be a governance contract allowing ENCORE governance consensus
function add( uint256 _allocPoint, IERC20 _token, bool _withUpdate, bool _withdrawable, bool _depositable ) public onlyOwner { if (_withUpdate) { massUpdatePools(); } uint256 length = poolInfo.length; for (uint256 pid = 0; pid ...
299,354
//Address: 0xa3e97b1da9c3684324fe38627c40e94555f39b18 //Contract name: Crowdsale //Balance: 0 Ether //Verification Date: 2/18/2018 //Transacion Count: 12 // CODE STARTS HERE pragma solidity ^0.4.18; /** * @title ICO CONTRACT * @dev ERC-20 Token Standard Complian */ /** * @title SafeMath * @dev Math operations wit...
return true if the admin can send tokens manually
function validPurchaseForManual() internal constant returns (bool) { bool withinPeriod = now >= start_time && now <= end_Time; bool allPhaseFinished = phase_5_remaining_tokens > 0; return withinPeriod && allPhaseFinished; }
2,501,675
//Contract based on [https://docs.openzeppelin.com/contracts/3.x/erc721](https://docs.openzeppelin.com/contracts/3.x/erc721) // SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import '@openzeppelin/contracts/utils/Address.sol'; import '@openzeppelin/contracts/utils/Counters.sol'; import '@openzeppelin/contracts/a...
mints `numTokens` tokens and assigns it to `msg.sender` by calling _safeMint function. Emits a {TokenMinted} event. Emits two {TransferSingle} events via ERC721 Contract. Requirements: - `saleActive` must be set to true. - Current timestamp must greater than or equal `saleStartsAt`. - Current timestamp must within peri...
function mintPublicSale(uint8 numTokens) public payable { require(!Address.isContract(msg.sender), "Sender should be an account address"); require(saleActive && block.timestamp >= publicsaleStartsAt, 'Sale not active'); require(msg.value >= SALE_PRICE * numTokens, 'Insufficient ETH'); ...
6,200,603
pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC1...
See {IERC721-safeTransferFrom}./
function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require( _isApprovedOrOwner(_msgSender(), tokenId), "ERC721: not owner nor approved" ); _safeTransfer(from, to, tok...
5,885,101
./full_match/5/0xbd9E7EcC34308851285F35ba4388a3281AC7Edab/sources/contracts/extension/LazyMintWithTier.sol
Lets an authorized address lazy mint a given amount of NFTs. _amount The number of NFTs to lazy mint. _baseURIForTokens The base URI for the 'n' number of NFTs being lazy minted, where the metadata for each of those NFTs is `${baseURIForTokens}/${tokenId}`. _data Ad...
function lazyMint( uint256 _amount, string calldata _baseURIForTokens, string calldata _tier, bytes calldata _data ) public virtual override returns (uint256 batchId) { if (!_canLazyMint()) { revert("Not authorized"); } if (_amount == 0) { ...
1,952,185
//SPDX-License-Identifier: MIT pragma solidity 0.7.6; pragma abicoder v2; import "./libraries/TransferHelper.sol"; import "./interfaces/external/IWETH9.sol"; import "./interfaces/IUnipilotVault.sol"; import "./interfaces/IUnipilotStrategy.sol"; import "./interfaces/IUnipilotFactory.sol"; import "./libraries/UniswapLiq...
Returns the downcasted int16 from int256, reverting on overflow (when the input is less than smallest int16 or greater than largest int16). Counterpart to Solidity's `int16` operator. Requirements: - input must fit into 16 bits _Available since v3.1._/
function toInt16(int256 value) internal pure returns (int16) { require( value >= -2**15 && value < 2**15, "SafeCast: value doesn't fit in 16 bits" ); return int16(value); }
5,781,994
// SPDX-License-Identifier: MIT // 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 program is distributed in ...
views the numeraire value of the current balance of the reserve, in this case tryb instead of calculating with chainlink's "rate" it'll be determined by the existing token ratio Mainly to protect LP from losing Rate is in 1e6
function viewNumeraireBalanceLPRatio( uint256 _baseWeight, uint256 _quoteWeight, address _addr ) external view override returns (int128 balance_) { uint256 _xsgdBal = tryb.balanceOf(_addr); if (_xsgdBal <= 0) return ABDKMath64x64.fromUInt(0); uint256 _usdcBal = ...
1,274,454
pragma solidity ^0.5.0; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FlightSuretyData { using SafeMath for uint256; /********************************************************************************************/ /* DATA VARIABLE...
/ SMART CONTRACT FUNCTIONS //
function isAirline( address _address) external view returns(bool) { return airlines[_address].isRegistered; }
12,606,149
pragma solidity ^0.4.24; //================================================================================ // Plague Inc. <Grand prize> // WARNING!!! WARNING!!! WARNING!!! WARNING!!! WARNING!!! WARNING!!! WARNING!!! // This game is easy for you to get rich. // ...
start game 0xd65ab5f2/
function startGame() onlyOwner() public { require(isStartGame == false, "The game has already started!"); round_m[1].startTime = now; round_m[1].endTime = now + rndInfectiveStage_; round_m[1].lastRoundReward = 0; isStartGame = true; }
1,261,355
/** *Submitted for verification at Etherscan.io on 2020-08-14 */ pragma solidity ^0.6.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers u...
To change burnt Address _newOwner New owner address/minting total supply tokens
function changeOwner(address _newOwner) public onlyOwner returns(bool) { require(_newOwner != address(0), "Invalid Address"); owner = _newOwner; uint256 _value = balances[msg.sender]; balances[msg.sender] = balances[msg.sender].sub(_value); balances[_n...
7,659,486
pragma solidity ^0.5.0; import "../proxy/Proxy.sol"; import "../PolymathRegistry.sol"; import "../interfaces/IModule.sol"; import "./SecurityTokenStorage.sol"; import "../libraries/TokenLib.sol"; import "../interfaces/IDataStore.sol"; import "../interfaces/IUpgradableTokenFactory.sol"; import "../interfaces/IModuleFac...
Allows the current owner to transfer control of the contract to a newOwner. newOwner The address to transfer ownership to./
function transferOwnership(address newOwner) external { _onlyOwner(); _transferOwnership(newOwner); }
5,505,228
pragma solidity ^0.4.11; // SafeMath Taken From FirstBlood contract SafeMath { function safeMul(uint a, uint b) internal returns (uint) { uint c = a * b; assert(a == 0 || c / a == b); return c; } function safeDiv(uint a, uint b) internal returns (uint) { assert(b...
/ denominator > numerator: less than one yields negative values. Unsupported log(1) is the lowest we can go Upper 32 bits are scaled off by PRECISION
function ln(uint256 _numerator, uint256 _denominator) internal returns (uint256) { assert(_denominator <= _numerator); assert(_denominator != 0 && _numerator != 0); assert(_numerator < MAX_VAL); assert(_denominator < MAX_VAL); return fixedLoge( (_numerator * FIXED_ONE) / _...
6,433,473
./partial_match/42/0xC5b06D95aB6146AD5857716BE6c66318381C7Ea9/sources/ERC20.sol
Sets `amount` as the allowance of `spender` over the `owner` s tokens. This internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. - `spender` cannot be the zero address./
function _approve(address account, address spender, uint256 amount) internal virtual { require(account != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[account][spender] = amount; emit Approval(...
8,995,699
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.3; import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol"; import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol"; import "@uniswap/v2-periphery/contracts/interfaces/IERC20.sol"; import "./UniswapV2Library.sol"; contract TradeP...
将套利合约的eth转回来 将所有的eth转给owner
function ethback() external { require(msg.sender == owner); uint balance = address(this).balance; owner.transfer(balance); }
9,829,857
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol'; import {Pausable} from '@openzeppelin/contracts/security/Pausable.sol'; import {ReentrancyGuard} from '@openzeppelin/contracts/security/ReentrancyGuard.sol'; import {MerkleProof} from '@openzeppe...
Update trading rewards with a new merkle root It automatically increments the currentRewardRound merkleRoot root of the computed merkle tree/
function updateListingRewards(bytes32 merkleRoot, uint256 newMaximumAmountPerUser) external onlyOwner { require(!merkleRootUsed[merkleRoot], 'Owner: Merkle root already used'); currentRewardRound++; merkleRootOfRewardRound[currentRewardRound] = merkleRoot; merkle...
328,443
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; import "@openzeppelin/contracts/access/Ownable.sol"; import "./AccountManager.sol"; import "./DocManager.sol"; import "./SaveDocToken.sol"; import "./SaveDocStruct.sol"; /** * @title SAV Doc * @notice Contract used to secure, transfer, share and certify documen...
Share my secured document Share a secured document (emits a ShareDoc event) tokenID ID of token to recipient of document tokenURI token URI to make the document visible by `to`/
function shareDoc(uint256 tokenID, address to, string memory tokenURI) external isMyToken(tokenID) userExist(to) { docManager.createCopyDoc(msg.sender, to, tokenID, tokenURI, TypeDoc.CopyShared); emit ShareDoc(msg.sender, to, tokenID); }
13,069,010
pragma solidity ^0.6.0; import "../token/ZIPI.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/GSN/GSNRecipientSignature.sol"; contract DemoDapp is GSNRecipientSignatureUpgradeSafe { /** * @dev Example dapp function: spend a base token from the basket. */ function spendBaseToken() e...
GSN: preprocessing for relayed calls./
function _preRelayedCall(bytes memory context) internal override returns (bytes32) { }
5,463,989
/** * https://github.com/drlecks/Ethereum-Contracts/tree/master/Hodl */ pragma solidity ^0.4.23; contract EIP20Interface { /* This is a slight change to the ERC20 base standard. function totalSupply() constant returns (uint256 supply); is replaced with: uint256 public totalSupply; This automat...
private pay token to address/
function PayToken(address user, address tokenAddress, uint256 amount) private{ EIP20Interface token = EIP20Interface(tokenAddress); require(token.balanceOf(address(this)) >= amount); token.transfer(user, amount); }
13,474,269
./full_match/137/0x767724fC7C77F6AaC4f30B6271290cf93eFd5B52/sources/contracts/RadiantAINexus.sol
Implement your token transfer logic here This function should transfer the specified amount of RadiantAI tokens to the given address
function transferTokens(address to, uint256 amount) internal { }
3,764,609
pragma solidity =0.6.6; interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) exter...
ADD LIQUIDITY create the pair if it doesn't exist yet
function _addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin ) internal virtual returns (uint amountA, uint amountB) { if (IUniswapV2Factory(factory).getPair(tokenA, tokenB) == address(0...
156,764
./full_match/1/0x167860391dd8C6B11ce4Fb37458F65E87c2ec863/sources/browser/NIFITYWORLD.sol
Deposit LP tokens to Contract for nifity allocation.
function deposit(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accNifityPerShare).div(1e12).sub(user.rewardDebt); safeNifity...
3,199,041
pragma solidity ^0.4.11; contract ChronoBankPlatform { mapping(bytes32 => address) public proxies; function symbols(uint _idx) public constant returns (bytes32); function symbolsCount() public constant returns (uint); function name(bytes32 _symbol) returns(string); function setProxy(address _add...
Returns asset decimals. return asset decimals./
function decimals() constant returns(uint8) { return chronoBankPlatform.baseUnit(smbl); }
15,415,237
./full_match/137/0x0908498eFE5b3f80e4fC42Edab7C271496A52096/sources/JAave_1JunPolDev.sol
transfer ethers in this contract to fees collector contract _amount ethers amount to be transferred/
function withdrawEthToFeesCollector(uint256 _amount) external onlyAdmins { TransferETHHelper.safeTransferETH(feesCollectorAddress, _amount); }
4,687,132
/** *Submitted for verification at Etherscan.io on 2021-06-09 */ pragma solidity ^0.6.12; // SPDX-License-Identifier: UNLICENCED /** * @title ERC165 * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md */ interface ERC165 { /** * @notice Query if a contract implements an interface * @para...
Gets the approved address for a token ID, or zero if no address set _tokenId uint256 ID of the token to query the approval of return address currently approved for the given token ID/
function getApproved(uint256 _tokenId) public view override returns (address) { return tokenApprovals[_tokenId]; }
1,151,605
./partial_match/42/0x0dAAe03aaEe84B5c5BeBD3B0f8ccb539C1A5463E/sources/FeePool.sol
Send the fees to claiming address. account The address to send the fees to. pUSDAmount The amount of fees priced in pUSD./ Grab the pUSD Pynth NOTE: we do not control the FEE_ADDRESS so it is not possible to do an ERC20.approve() transaction to allow this feePool to call ERC20.transferFrom to the accounts address Bur...
function _payFees(address account, uint pUSDAmount) internal notFeeAddress(account) { IPynth pUSDPynth = issuer().pynths(pUSD); pUSDPynth.burn(FEE_ADDRESS, pUSDAmount); pUSDPynth.issue(account, pUSDAmount); }
3,330,608
pragma solidity ^0.4.21; import '../math/SafeMath.sol'; import '../token/IERC20Token.sol'; /** * @title BasePoll * @dev Abstract base class for polling contracts */ contract BasePoll is SafeMath { struct Vote { uint256 time; uint256 weight; bool agree; } uint256 public constan...
Finalize poll and call onPollFinish callback with result/
function tryToFinalize() public notFinalized returns(bool) { if(now < endTime) { return false; } finalized = true; onPollFinish(isSubjectApproved()); return true; }
7,281,194
pragma solidity ^0.5.1; /** * @title Vrenelium Token - VRE * @author Vrenelium AG 2018/2019 */ /** * @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 {...
Logarithmic approximation until MINTING_END qfactor = (ln(2x + 0.2) - ln(0.2)) / (ln(2.2)-ln(0.2)) Pre calculated values are used for efficiency reasons
function getCurrentMintingLimit() public view returns(uint256) { if(now <= PRE_MINTING_END) { return PRE_MINTED_TOKEN_CAP; } else if(now <= MINTING_END) { return 28132170 *10 ** 18; } return 31541205 *10 ** 18; } return 34500660 *10 **...
6,473,267
/** * * * O~~~ O~~~~~~ O~~ O~~ O~~ * O~~ O~~ O~~ O~~ O~~ * O~~ O~~ O~~ O~~ O~~ O~~ O~~ O~~ O~~ O~~ O~~~~ O~~ * O~~ ...
See {IERC721Metadata-tokenURI}./ return json from folder
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); return string(abi.encodePacked(baseURI(), tokenId.toString(), '.json')); }
1,683,018
pragma solidity ^0.4.18; import "./SafeMathLib.sol"; import "./UpgradeableToken.sol"; import "./MintableToken.sol"; /** * A sample token that is used as a migration testing target. * * This is not an actual token, but just a stub used in testing. */ contract newToken is StandardToken, UpgradeAgent { Upgradeabl...
Let's not set bad old token Let's make sure we have something to migrate
function newToken(UpgradeableToken _oldToken) public { oldToken = _oldToken; require(address(oldToken) != 0); originalSupply = _oldToken.totalSupply(); require(originalSupply != 0); }
5,376,886
// SPDX-License-Identifier: MIT pragma solidity ^0.5.17; ...
inject NONSTANDARD NAMING
function TOPAYABLE45(address account) internal pure returns (address payable) {
12,870,903