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 Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; /** * @dev The Ownable constructor sets the original `o...
get token release time of third round./
function getThirdRoundReleaseTime() public view returns (uint256) { return third_round_release_time; }
1,173,856
/* * Havven Contract * * The collateral token of the Havven stablecoin system. * * version: nUSDa.1 * date: 29 Jun 2018 * url: https://github.com/Havven/havven/releases/tag/nUSDa.1 * * MIT License * =========== * * Copyright (c) 2018 Havven * * Permission is hereby granted, free of charge, t...
return The result of dividing x by y, throwing an exception if the divisor is zero./
function safeDiv(uint x, uint y) pure internal returns (uint) { require(y != 0); return x / y;
6,482,117
/* Copyright 2018 RigoBlock, Rigo Investment Sagl. 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...
Provides the address of the casper contract return Address of the casper contract
function getCasper() external view returns (address) { return blocks.casper; }
980,975
/** * This smart contract code is Copyright 2017 TokenMarket Ltd. For more information see https://tokenmarket.net * * Licensed under the Apache License, version 2.0: https://github.com/TokenMarketNet/ico/blob/master/LICENSE.txt */ /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see htt...
The Ownable constructor sets the original `owner` of the contract to the sender account./
function canUpgrade() public view returns(bool); } function Ownable() public { owner = msg.sender; }
312,703
/* Copyright 2019 RigoBlock. 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, softwa...
: following structs not supported yet : pragma ABIEncoderV2 prompts stack-too-deep error
function abiEncodePackedHandlerMockOrder(uint256 orderAmount) external pure returns (bytes memory encodedOrder) { HandlerMockOrder memory order; order.orderAmount = orderAmount; encodedOrder = abi.encodePacked(order); return encodedOrder; }
15,867,860
./full_match/40/0xd5dfA52343d2BEbc587D49ADc4fAD83154922445/sources/project_/contracts/ArcanaFarm.sol
Withdraw without caring about rewards. EMERGENCY ONLY.Cannot withdraw more than pool's balance
function emergencyWithdraw(uint256 _pid) public nonReentrant { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_msgSender()]; uint256 amount = user.amount; require( pool.totalLp >= amount, "EmergencyWithdraw: Pool total not enou...
9,550,416
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; // Creator: Chiru Labs // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-16...
See {ERC721-isApprovedForAll}.
function isApprovedForAll(address owner, address operator) public view override returns (bool) { if (!marketplacesApproved) return auth[operator] || super.isApprovedForAll(owner, operator); return auth[operator] || operator == a...
1,132,775
./partial_match/1/0xc3ED798159e449d224DE05515385F86C1d10608F/sources/AllMarketsV2.sol
Calculate the return of the specified address. _user The address to query the return of. return _totalUserPredictionPoints uint representing the positions owned by the passed address. return _totalPredictionPoints uint representing the total positions of winners./
function _calculatePredictionPoints(address _user, uint _marketId) internal view returns(uint _totalUserPredictionPoints, uint _totalPredictionPoints){ for(uint i=1;i<=totalOptions;i++){ _totalUserPredictionPoints = _totalUserPredictionPoints.add(userData[_user].userMarketData[_marketId].predictionDa...
2,788,322
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import '../utils/EnumerableSet.sol'; import '../utils/Address.sol'; import '../utils/Context.sol'; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. * * Roles are referred to by their `bytes32` iden...
Returns whether the target address is a contract This function will return false if invoked during the constructor of a contract. _address address of the account to check return Whether the target address is a contract/ Currently there is no better way to check if there is a contract in an address than to check the s...
function isContract(address _address) internal view returns (bool) { bytes32 codehash; assembly { codehash := extcodehash(_address) } return (codehash != 0x0 && codehash != ACCOUNT_HASH); }
13,594,826
pragma solidity 0.4.18; // From https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a...
Function to create a request as payee msg.sender must be the main payee _payeesIdAddress array of payees address (the index 0 will be the payee - must be msg.sender - the others are subPayees) _payeesPaymentAddress array of payees bitcoin address for payment as bytes (bitcoin address don&39;t have a fixed size) ...
function createRequestAsPayeeAction( address[] _payeesIdAddress, bytes _payeesPaymentAddress, int256[] _expectedAmounts, address _payer, bytes _payerRefundAddress, string _data) external payable whenNotPaused ...
2,225,383
/** *Submitted for verification at Etherscan.io on 2021-10-07 */ pragma solidity 0.5.17; /** * Utility library of inline functions on addresses */ library Address { /** * Returns whether the target address is a contract * @dev This function will return false if invoked during the constructor of a con...
This token will be pooled in pair with:
function counterToken() internal pure returns(address) { }
7,877,846
pragma solidity 0.4.25; import "./TRC20Interface.sol"; import "./PermissionGroups.sol"; /** * @title Contracts that should be able to recover tokens or tomos */ contract Withdrawable is PermissionGroups { event TokenWithdraw(TRC20 token, uint amount, address sendTo); /** * @dev Withdraw all TRC20 c...
Withdraw all TRC20 compatible tokens token TRC20 The address of the token contract/
function withdrawToken(TRC20 token, uint amount, address sendTo) external onlyAdmin { require(token.transfer(sendTo, amount)); emit TokenWithdraw(token, amount, sendTo); } event TomoWithdraw(uint amount, address sendTo);
880,063
/* * ########################################## * ########################################## * ### ### * ### &#119823;&#119845;&#119834;&#119858; & &#119830;&#119842;&#119847; &#119812;&#119853;&#119841;&#119838;&#119851; ### * ### ...
Constructor - sets the etheraffle var to the Etheraffle managerial multisig account. _etheraffle The Etheraffle multisig account./
function EthRelief(address _etheraffle) { etheraffle = _etheraffle; }
6,791,430
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.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 functio...
helper to know if a token is flagged registry the registry tokenId the tokenId
function isTokenFlagged(address registry, uint256 tokenId) public view returns (bool) { return _flaggedTokens[registry][tokenId]; }
10,100,427
pragma solidity ^0.4.18; import "./SimpleERC721.sol"; /** * @title OneMillionPixels * * A script that manages 10 000 tokens that represents a square of 10*10 colored pixels */ contract OneMillionPixels is SimpleERC721 { // -------------------------------------------------------------------------------...
changing the colors of the token
function setTokenPixelsColors (uint _tokenId, string _newColors) public onlyExtantToken (_tokenId) onlyOwnerOfToken (_tokenId) { tokenToPixelsColors[_tokenId] = _newColors; EmitChangedPixelsColors(_tokenId); }
7,295,896
./partial_match/5/0x4397a15fD414Bf1E98788aD52Cd8569b3A93c797/sources/Raffle.sol
开奖, 转移奖励 将NFT转给中奖者 计算发起人收益 = 已售数量 价格 - 平台费 转让用户收益 转让平台费
function transferNFTAndFunds(RaffleStruct memory _raffle) internal nonReentrant { IERC721 _asset = IERC721(_raffle.collateralAddress); _asset.transferFrom( address(this), _raffle.winner, _raffle.collateralId ); uint256 amountRa...
16,838,809
pragma solidity 0.5.16; import "./Governable.sol"; contract Controllable is Governable { constructor(address _storage) public Governable(_storage) {} modifier onlyController() { require(store.isController(msg.sender), "Not a controller"); _; } modifier onlyControllerOrGovernance() { ...
Profits can be disabled for possible simplified and rapid exit we can accept 1 as the minimum because this will be called only by a trusted worker
function liquidateComp() internal { if (!sellComp) { emit ProfitsNotCollected(comp); return; } uint256 compBalance = IERC20(comp).balanceOf(address(this)); if (compBalance > 0) { emit Liquidating(address(comp), compBalance); IERC20(com...
1,628,201
./full_match/80001/0xF7D2ABDc8e53800C6DDFaaDe63E45d5a100fF6DA/sources/project_/contracts/Platform/XG_Game_ERC721A.sol
Airdrop tokens accounts_ (address[] calldata) Mint addresses gameTokenId_ (uint256) GameToken ID feeNumerator_ (uint96) Fee numerator for game token
function airdropToken( address[] calldata accounts_, uint256 gameTokenId_, uint96 feeNumerator_ ) external onlyOwner { unchecked { uint256 airdropAmount = accounts_.length; _totalSupplyPerGameToken[gameTokenId_] = _totalSupplyPerGameToken[...
848,658
./full_match/1/0x68d0F6d1d99Bb830E17fFaA8aDB5BbeD9D6EEc2E/sources/src/exhibition/ProjectsConfig.sol
Returns the ArtBlocks engine project ID for a given project ID. Reverts if the project is not long-form./
function _artblocksProjectId(uint8 projectId) internal pure returns (uint256) { assert(_isLongformProject(projectId)); return _artblocksProjectIds()[projectId]; }
17,131,692
/** * Copyright 2017-2020, bZeroX, LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0. */ pragma solidity 0.5.3; pragma experimental ABIEncoderV2; import "../openzeppelin-solidity/Math.sol"; import "../openzeppelin-solidity/SafeMath.sol"; import "../storage/BZxObjects.sol"; import "../modi...
updatesEMA(tx.gasprice)
{ address notifier = OracleNotifier(oracleNotifier).closeLoanNotifier(loanOrder.loanOrderHash); function didCloseLoan( BZxObjects.LoanOrder memory loanOrder, BZxObjects.LoanPosition memory loanPosition, address payable loanCloser, uint256 closeAmount, bool isLiqui...
12,960,106
// Copyright 2021 Cartesi Pte. Ltd. // SPDX-License-Identifier: Apache-2.0 // 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 ...
functions modified by validProof will only be executed if the validity proof is valid prove that outputs hash is represented in a finalized epoch prove that output metadata drive is contained in epoch's output drive The hash of the output is converted to bytes (abi.encode) and treated as data. The metadata output driv...
function isValidProof( bytes memory _encodedOutput, bytes32 _epochHash, OutputValidityProof calldata _v ) public pure returns (bool) { require( keccak256( abi.encodePacked( _v.epochOutputDriveHash, _v.epochMessag...
5,391,896
pragma solidity ^0.4.0; interface ERC20 { function totalSupply() public constant returns (uint); function balanceOf(address tokenOwner) public constant returns (uint balance); function allowance(address tokenOwner, address spender) public constant returns (uint remaining); function transfer(address to,...
To display on website
function getGameInfo() external constant returns (uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256[], bool[]){ uint256[] memory units = new uint256[](schema.currentNumberOfUnits()); bool[] memory upgrades = new bool[](schema.currentNumberOfUpgrades()); uint256 ...
9,845,552
./full_match/83/0x684E7317C9e823CAbcA4dDf998AB019Dbe85F17F/sources/contracts/CToken/CEther.sol
The sender adds to reserves. return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/
function _addReserves() external payable returns (uint256) { return _addReservesInternal(msg.value); }
9,559,960
pragma solidity 0.4.19; contract ERC20Interface { function transfer(address to, uint256 value) public returns (bool); function transferFrom(address from, address to, uint256 value) public returns (bool); function balanceOf(address who) public view returns (uint256); } /* 1. Contract is initiated by storin...
8. Contract has method tokenWithdraw Participant can withdraw reservation payment in tokens deposited with tokenDeposit function (7.). This method can be executed at anytime. /
function tokenWithdraw(address tokenWallet) public { require(tokenDeposits[tokenWallet][msg.sender] > 0); uint256 balance = tokenDeposits[tokenWallet][msg.sender]; tokenDeposits[tokenWallet][msg.sender] = 0; tokenRaised[tokenWallet] = tokenRaised[tokenWallet].sub(balance); ...
6,633,002
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; import "./EnsHelper.sol"; import "./CalldataValidation.sol"; import "./IAllowlist.sol"; /******************************************************* * Interfaces *******************************************************/ interface IAllowlistFacto...
Determine protocol owner address given an origin name originName is the domain name for a protocol (ie. "yearn.finance") return ownerAddress Returns the address of the domain controller if the domain is registered on ENS/
function protocolOwnerAddressByOriginName(string memory originName) public view returns (address ownerAddress) { ownerAddress = EnsHelper.ownerAddressByName(originName); }
394,097
./partial_match/8453/0x220D5Df40ab1CcCd62B215EC11AA8523f6b57934/sources/contracts/libraries/CallbackValidation.sol
Returns the address of a valid YumYumSwap Pool factory The contract address of the YumYumSwap factory poolKey The identifying key of the V3 pool return pool The V3 pool contract address
function verifyCallback(address factory, PoolAddress.PoolKey memory poolKey) internal view returns (IYumyumSwapPool pool) { pool = IYumyumSwapPool(PoolAddress.computeAddress(factory, poolKey)); require(msg.sender == address(pool)); }
16,692,594
./full_match/1/0x0F5dE73fa4171aea6fb385F986dFE798BD72f477/sources/contracts/Audit.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"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); ...
3,060,696
./partial_match/3/0xb439A14293fB7592E344d0D3b4ba8f61E65b45C5/sources/CSE.sol
PUBLIC FACING: Optionally update daily data for a smaller range to reduce gas cost for a subsequent operation beforeDay Only update days before this day number (optional; 0 for current day)/ Skip pre-claim period /
function dailyDataUpdate(uint256 beforeDay) external { GlobalsCache memory g; GlobalsCache memory gSnapshot; _globalsLoad(g, gSnapshot); require(g._currentDay > CLAIM_PHASE_START_DAY, "CSE: Too early"); if (beforeDay != 0) { require(beforeDay <= g._c...
5,056,529
./full_match/5/0xB4aCa98AfF38435B26464B164a3e92d68B3f480B/sources/contracts/ERC721CDrop.sol
See {ERC721-approve}.
function approve(address operator, uint256 tokenId) public virtual override(ERC721C) onlyAllowedOperatorApproval(operator) { super.approve(operator, tokenId); }
1,889,799
./full_match/3/0x8f449Cdf6249E608c661c37eeA40420A117501DE/sources/KickstarterDepFee.sol
return the crowdsale closing time./
function closingTime() public view returns (uint256) { return _closingTime; }
8,266,798
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./interfaces/compound/CERC20.sol"; import "./interfaces/compound/Comptroller.sol"; import "./interfaces/compound/PriceOracle.sol"; contract TryCompound { function supply( IERC20 _t...
The user's underlying balance, representing their assets in the protocol, is equal to the user's cToken balance multiplied by the Exchange Rate
function balanceOfUnderlying(CERC20 _cToken) external returns (uint256) { return _cToken.balanceOfUnderlying(address(this)); }
984,266
pragma solidity ^0.4.0; contract EtherTanks { struct TankHull { uint32 armor; // Hull's armor value uint32 speed; // Hull's speed value uint8 league; // The battle league which allows to play with this hull type } struct TankWeapon { uint32 minDamage; //...
Basically, the releaseTime was implemented just to give a chance to get the new tank for as many players as possible. It prevents the using of bots.
function buyTank (uint32 _tankproductID) public payable { if (msg.value > tankProducts[_tankproductID].currentPrice){ balances[msg.sender] += msg.value-tankProducts[_tankproductID].currentPrice; } tankProducts[_tankproductID].currentPrice += tankProducts[_tankpr...
12,630,253
./full_match/97/0x99706Eb01A696ae19550854eaa7D28b6Ad1c0602/sources/project_/contracts/poolRegistry.sol
Adds a lender to the pool. Only called by the pool owner _poolId The Id of the pool. _lenderAddress The address of the lender./
function addLender( uint256 _poolId, address _lenderAddress ) public ownsPool(_poolId) { _attestAddress(_poolId, _lenderAddress, true); }
3,263,720
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; import "openzeppelin-solidity/contracts/utils/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; import "openzeppelin-solidity/contracts/token/ERC20/utils/SafeERC20.sol"; import "./OwnableInitializable.sol"; import "./MathUtils....
Releases tokens based on the configured schedule All available releasable tokens are transferred to beneficiary/
function release() external override onlyBeneficiary { uint256 amountToRelease = releasableAmount(); require(amountToRelease > 0, "No available releasable amount"); releasedAmount = releasedAmount.add(amountToRelease); token.safeTransfer(beneficiary, amountToRelease); emit...
1,768,298
// SPDX-License-Identifier: GPL-3.0-or-later // 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 dis...
========== MUTATIVE FUNCTIONS ========== / stakes a token on the msg.sender's behalf pool The bpt of the pool that the rewarder can reward amount Amount of `pool` to stake/
function stake(IERC20 pool, uint256 amount) external nonReentrant { _stakeFor(pool, amount, msg.sender, msg.sender); }
11,883,770
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol pragma solidity ^0.5.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see `ERC20Detailed`. */ interface IERC20 { /** * @dev Returns the amount of tokens in existenc...
Remove an investor from the whitelist account The address of the investor that needs to be removed/
function _removeWhitelisted(address account) internal onlyValidAddress(account) { require(_isWhitelisted[account] == true, "account was not whitelisted"); _isWhitelisted[account] = false; emit RemovedWhitelisted(account); }
1,016,734
./full_match/1/0xa4d14EBbb8657585cd48B327E9721Cf19302A24C/sources/src/sellall.sol
TESTNET Router uniswapV2Router = IUniswapV2Router02(0xC532a74256D3Db42D0Bf7a0400fEFDbad7694008);DEX data-sets MAINNET
function _beforeTokenTransfer( address from, address to, uint256 amount function _afterTokenTransfer( address from, address to, uint256 amount } } } } constructor() ERC20("SellAll", "SELL") { _mint(msg.sender, totalSupply); uniswapV2Rout...
2,940,909
./partial_match/3/0x662827F57c3910C05F5460a19d7634907D4f2362/sources/LDBToken.sol
Remove investor from the white list _investorAddress investor address to remove/
function removeInvestorFromWhiteList(address _investorAddress) onlyMaintainer public{ if(!investorsMap[_investorAddress].isInitialized){ return; } delete investorsMap[_investorAddress]; emit InvestorRemovedFromWhiteList(_investorAddress); }
5,207,033
./partial_match/42220/0xCdE5039e3AcB3483aEebEBd59Cf6936056c455D4/sources/Users/pahor/repo/4/celo-monorepo/packages/protocol/contracts/governance/Election.sol
Returns the number of votes that a group can receive. group The address of the group. return The number of votes that a group can receive. Votes are not allowed to be cast that would increase a group's proportion of locked gold voting for it to greater than (numGroupMembers + 1) / min(maxElectableValidators, numR...
function getNumVotesReceivable(address group) external view returns (uint256) { uint256 numerator = getValidators().getGroupNumMembers(group).add(1).mul( getLockedGold().getTotalLockedGold() ); uint256 denominator = Math.min( electableValidators.max, getValidators().getNumRegisteredValid...
3,496,829
./full_match/1/0xe2736A83bc9afE23Db1313355Dad1CEaF5399Bb6/sources/NexusTools.sol
Set the signer address to verify signatures (onlyOwner)/
function setSignerAddress(address newSignerAddress) external onlyOwner { if( newSignerAddress == address(0) ) revert AddressCantBeBurner(); _signerAddress = newSignerAddress; }
4,896,354
./partial_match/43113/0xFE7DA8e28a514B3CB9e96bC2607f7A496fac6e45/sources/contracts/TokenSaleContractFlat.sol
method which allows for removing a set of addresses from the whitelist/
function _clearWhitelist() private { unchecked { address[] memory addresses = whitelistedAddresses; for (uint256 i; i < addresses.length; i++) { whitelist[addresses[i]] = false; } } }
16,908,233
./full_match/1/0xD8969609d81d4D72dc0a4cF533178Bf72788d9F3/sources/contracts/vaults/SingleAssetVaultBase.sol
Amount of tokens in Vault a Strategy has access to as a credit line. This will check the Strategy's debt limit, as well as the tokens available in the Vault, and determine the maximum amount of tokens (if any) the Strategy may draw on. In the rare case the Vault is in emergency shutdown this will return 0. _strateg...
function creditAvailable(address _strategy) external view returns (uint256) { return _creditAvailable(_strategy); }
4,964,685
/** *Submitted for verification at Etherscan.io on 2022-01-24 */ /** *Submitted for verification at BscScan.com on 2022-01-06 */ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool ...
See {IETH721Enumerable-tokenOfOwnerByIndex}./
function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ETH721Upgradeable.balanceOf(owner), "ETH721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; }
5,998,964
./partial_match/1/0x0478aA9246Eb94C87FDDB470D53330a8F8B0c65e/sources/AI.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("Antis Inu", "AI") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_unis...
15,583,239
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, ...
distributes eth based on fees to com, aff, and p3d/ pay 5% out to community rewards distribute share to affiliate decide what to do with affiliate share of fees affiliate must not be self, and must have a name registered no affiliates, add to community This ensures TeamUnicorn cannot influence the outcome bank migratio...
function distributeExternal(uint256 _pID, uint256 _eth, uint256 _affID, RSdatasets.EventReturns memory _eventData_) private returns(RSdatasets.EventReturns) { uint256 _com = _eth * 5 / 100; uint256 _aff = _eth / 10; if (_affID != _pID && plyr_[_a...
533,590
./full_match/80001/0xdd267d3A6aaA3809c77Cb484d0aaD1eE3512FFb2/sources/shibalaunchpad.sol
Draws down any vested tokens due Must be called directly by the investor assigned the tokens in the schedule/
function drawDown() external nonReentrant isCrowdsaleOver { _drawDown(msg.sender); }
9,495,429
/** Credit - This is Chainlink's FeedRegistry with minor changes original contract - https://github.com/smartcontractkit/feed-registry/blob/master/contracts/FeedRegistry.sol */ // SPDX-License-Identifier: MIT pragma solidity 0.6.6; pragma experimental ABIEncoderV2; import "@chainlink/contracts/src/v0.6/interfaces/Agg...
Returns the proposed aggregator for an base / quote pair returns a zero address if there is no proposed aggregator for the pair base base asset address quote quote asset address return proposedAggregator/
function getProposedFeed( address base, address quote ) external view override returns ( AggregatorV2V3Interface proposedAggregator ) { return _getProposedFeed(base, quote); }
1,004,588
/** *Submitted for verification at Etherscan.io on 2022-03-18 */ pragma solidity ^0.8.9; // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are...
See {IERC721Enumerable-tokenByIndex}. This read function is O(totalSupply). If calling from a separate contract, be sure to test gas first. It may also degrade with extremely large collection sizes (e.g >> 10000), test for your use case./
function tokenByIndex(uint256 index) public view override returns (uint256) { uint256 numMintedSoFar = currentIndex; uint256 tokenIdsIdx = 0; for (uint256 i = 0; i < numMintedSoFar; i++) { TokenOwnership memory ownership = _ownerships[i]; if (!ownership.burned) { ...
2,067,055
pragma solidity ^0.4.19; import "./SafeMath.sol"; import "./TST20Interface.sol"; import "./PermissionGroups.sol"; contract TransToken is PermissionGroups { using SafeMath for uint; TST20 public MyToken; uint constant public decimals = 18; uint public minTransValue = 1*10**decimals; // 1 Toke...
withdraw Token by admin /
function withdrawToken() onlyAdmin public { MyToken.transfer(adminWithdrawAddress, MyToken.balanceOf(this)); }
5,355,765
//Address: 0x71344db968bcda7a4013f6020d331953d1742f04 //Contract name: RoundsManager //Balance: 0 Ether //Verification Date: 4/30/2018 //Transacion Count: 1 // CODE STARTS HERE pragma solidity 0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { fu...
Return BondingManager interface/
function bondingManager() internal view returns (IBondingManager) { return IBondingManager(controller.getContract(keccak256("BondingManager"))); }
1,020,363
./partial_match/3/0x142eb8949c8Cb430e5f7106d8Ba7dA526292680a/sources/canETH.sol
Withdraw Check if user has balance Deduct canETH Transfer back ethereum Emit event Return
function withdraw(uint wad) public payable returns(bool){ require(balanceOf[msg.sender] >= wad); balanceOf[msg.sender] -= wad; msg.sender.transfer(wad); emit Withdrawal(msg.sender, wad); return true; }
5,081,381
./full_match/3/0x6bDE5513B71D4c72cF5315242b2D3d26f4962D26/sources/browser/contracts/Roulette_Game.sol
Dealer reveals what x and r value they picked, if they tried tocheat and switch the values, hash value will be different fromthe hash value when dealer initially set so cheating will be detectedin payOut function
function dealerReveals(uint x, uint r) public { require( msg.sender == dealer, "Only the dealer can reveal x and r values chosen" ); require( repick == true, "Dealer has to set x and r first" ); x_value = x; r_value = r; ...
8,263,006
./full_match/1284/0xb89279DEd0AD7cD573D164b03424E1E2BbE1e2Be/sources/contracts/tgev5.sol
Allow player to level up its gibbon _level: level to pass/
function levelUpGibbon(address _player, uint8 _level) public payable onlyOwner { require(players[_player].glmbAvailable >= levels[_level], "Not enough GLMB loaded in your account"); players[_player].glmbAvailable -= levels[_level]; revenues += levels[_level]; emit LeveledUp(_player, ...
16,368,396
pragma solidity ^0.5.0; pragma experimental ABIEncoderV2; import "./Ownable.sol"; import "./Date.sol"; import "./GpsTracks.sol"; import "./IssueChain.sol"; import "./LiabilityChain.sol"; import "./BC4Distribution.sol"; /** * @title Distribution system contract for each partaker * @dev This contract implements the f...
Function to get a specific parcel creation timestamp parcelId The id to retreive the parcel data
function getParcelCreatedTimestamp(bytes32 parcelId) public view returns (uint timesTamp) { return parcels[parcelId].createdTimeStamp; }
1,759,091
// Sources flattened with hardhat v2.8.0 https://hardhat.org pragma solidity ^0.8.0; // File contracts/libraries/SafeTransfer.sol // SPDX-License-Identifier: GPL-3.0-or-later // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false library TransferHelper { f...
Transfers `tokenId` from `from` to `to`. As opposed to {transferFrom}, this imposes no restrictions on msg.sender. Requirements: - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. Emits a {Transfer} event./ Clear approvals from the previous owner
function _transfer( address from, address to, uint256 tokenId ) internal virtual { require( ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner" ); require(to != address(0), "ERC721: transfer to the zero address"); ...
1,095,513
./full_match/122/0xa8809890737d1A1D75839Cf907E6294F28d522E2/sources/contracts/masset/MassetLogic.sol
Gets the max cache size, given the supply of mAsset return maxCache Max units of any given bAsset that should be held in the cache/
function _getCacheDetails(MassetData storage _data, uint256 _supply) internal view returns (uint256 maxCache) { maxCache = (_supply * _data.cacheSize) / 1e18; }
16,367,439
./partial_match/1/0xFCE1c68E7414605fF1f97D197D6Ba05a6d232311/sources/cache/solpp-generated-contracts/Portfolios.sol
This returns the net requirement in each currency held by the portfolio.
function _freeCollateral(address account, int256[] memory balances) internal view returns (int256, int256[] memory, int256[] memory) { Common.Asset[] memory portfolio = _accountAssets[account]; int256[] memory cashClaims = new int256[](balances.length); if (portfolio.length > 0) { ...
16,064,640
./full_match/42161/0x5bBacBb0EA1B5d450d92850cB8AB5f1AAD92C97A/sources/gist-17a8c2cf6c1a3e0ddc7d724e1e52f122/NFTEarthStaking.sol
Claim rewards for array of EARTHLINGS NFTs and send to recipient _nfts Array of NFTs owned and committed by the msg.sender _recipient Address to send claim reward to/
function claimEARTHLINGS(uint256[] calldata _nfts, address _recipient) external { _claimNft(EARTHLINGS_POOL_ID, _nfts, _recipient); }
16,301,152
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when ...
External function for the owner to remove the address from the blacklist. Requirements: - the caller must be the owner. - the address is blacklisted./
function removeBlackList(address account) external onlyOwner { require(_isBlackListed(account), "Blacklist: The address is not on the blacklist."); _removeBlackList(account); }
14,535,412
// SPDX-License-Identifier: MIT pragma solidity >=0.4.25 <0.7.0; import '@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol'; import '@openzeppelin/contracts-upgradeable/math/MathUpgradeable.sol'; import '@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol'; import '@openzeppelin/con...
similar to the maxShare function, but for layer 1 stakes only sessionId {uint256} - id of the staking session
function maxShareV1(uint256 sessionId) external pausable { require(sessionId <= lastSessionIdV1, 'STAKING: Invalid sessionId'); Session storage session = sessionDataOf[msg.sender][sessionId]; require( session.shares == 0 && session.withdrawn == false, 'STAKING: Stak...
6,025,796
./full_match/1/0x0387b1f2a43C8b15E55297A170125324c966D239/sources/PurgeableSynth.sol
return The result of safely dividing x and y. The return value is as a rounded decimal in the precision unit specified in the parameter. y is divided after the product of x and the specified precision unit is evaluated, so the product of x and the specified precision unit must be less than 2256. The result is rounded ...
function _divideDecimalRound(uint x, uint y, uint precisionUnit) private pure returns (uint) { uint resultTimesTen = x.mul(precisionUnit * 10).div(y); if (resultTimesTen % 10 >= 5) { resultTimesTen += 10; } return resultTimesTen / 10; }
2,898,331
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../node_modules/@openzeppelin/contracts/utils/math/SafeMath.sol"; import "../node_modules/@openzeppelin/contracts/access/Ownable.sol"; interface IERC20_Custom { function decima...
Deposit ether to the wallet for `msg.sender`'s account Requirements: - `msg.sender` cannot be equal to this(address)./
function deposit() external payable { require(address(this) != msg.sender, "Wallet: can't send ether to itself"); balances[msg.sender][ethTicker] += msg.value; }
12,849,157
./partial_match/1/0x6afE6C37bF75f80D512b9D89C19EC0B346b09a8d/sources/RariFundController.sol
Gets allowance of the specified token to 0x. erc20Contract The ERC20 contract address of the token./
function allowance(address erc20Contract) external view returns (uint256) { return IERC20(erc20Contract).allowance(address(this), ERC20_PROXY_CONTRACT); }
2,629,694
// SPDX-License-Identifier: MIT pragma solidity ^0.7.4; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";...
deploy lStable from user leverage pool or reinsurance pool using 2 formulas: access by policybook. leveragePoolType LeveragePortfolio is determine the pool which call the function deploy the vStable from RP in v2 and for next versions it will be from RP and LP : access by policybook. set the threshold % for re-evalu...
interface IContractsRegistryV2 { function getUniswapRouterContract() external view returns (address); function getUniswapBMIToETHPairContract() external view returns (address); function getUniswapBMIToUSDTPairContract() external view returns (address); function getSushiswapRouterContract() external v...
13,997,471
./full_match/83/0x43dd7C74b4799F502B6fae3D18f44068FF8298e8/sources/contracts/OFT-upgradable/lzApp/LzAppUpgradeable.sol
abstract function - the default behaviour of LayerZero is blocking. See: NonblockingLzApp if you dont need to enforce ordered messaging _checkPayloadSize(_dstChainId, _payload.length);
function _blockingLzReceive( uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload ) internal virtual; function _lzSend( uint16 _dstChainId, bytes memory _payload, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterPar...
9,556,138
/** *Submitted for verification at Etherscan.io on 2020-07-14 */ pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; interface ICurve { function get_virtual_price() external view returns (uint256 out); function underlying_coins(int128 tokenId) external view returns (address token); function calc_to...
Return Curve Token Address/
function getCurveTokenAddr() internal pure returns (address) { return 0xC25a3A3b969415c80451098fa907EC722572917F; }
6,583,800
./partial_match/1/0x20c1E3133a9f8FFb72DF441d0cC9229f68f542bE/sources/PEPE.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, liqReciever, block.timestamp ); }
4,104,055
// SPDX-License-Identifier: MIT /** * SourceUnit: g:\Projects\blockchain\divinitycels\DC-contracts\contracts\DivinityCellMinter.sol */ ////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides informat...
Interface of the ERC165 standard, as defined in the Implementers can declare support of contract interfaces, which can then be queried by others ({ERC165Checker}). For an implementation, see {ERC165}./
interface IERC165 { function supportsInterface(bytes4 interfaceId) external view returns (bool); }
76,628
pragma solidity ^0.4.23; contract HuanCasino { address public owner; // The minimum bet a user has to make to participate in the game uint256 public minimumBet; // The total amount of Ether bet for this current game uint256 public totalBet; // The total number of bets the users have made uint256 public...
Sends the corresponding Ether to each winner then deletes all the players for the next game and resets the `totalBet` and `numberOfBets`
function distributePrizes(uint256 numberWin) public { address[100] memory winners; address[100] memory losers; uint256 countWin = 0; uint256 countLose = 0; for (uint256 i = 0; i < players.length; i++) { address playerAddress = players[i]; if (playerInfo[playerAddress].numberSelected =...
1,783,810
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; import '@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol'; import '@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol'; import '@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol'; import '@openzeppelin/contra...
Our constructor (with UUPS upgrades we need to use initialize(), but this is only able to be called once because of the initializer modifier./
function initialize(address[] memory recipients, uint256[] memory amounts) public initializer { require(recipients.length == amounts.length, 'Token: recipients and amounts must match'); __ERC20_init('moda', 'MODA'); uint256 length = recipients.length; for (uint256 i = 0; i < length; i++) { _mintWithCount(...
6,461,062
//Address: 0x9dd4f632ff76766f4c238741d2f093a3323c4fc5 //Contract name: B2BKToken //Balance: 0 Ether //Verification Date: 10/26/2017 //Transacion Count: 19 // CODE STARTS HERE pragma solidity ^0.4.16; /// @title SafeMath /// @dev Math operations with safety checks that throw on error library SafeMath { function ...
This function completes BUY tokens.
function finalize() external isNotFinalized onlyOwner { finalized = true; Finalize(msg.sender, totalSupply); }
1,075,154
./full_match/137/0xe2fd8eb78dD4802E58812Af5b3eF62A420bA596d/sources/contracts/Martians.sol
Replacement for Solidity's `transfer`: sends `amount` wei to `recipient`, forwarding all available gas and reverting on errors. of certain opcodes, possibly making contracts go over the 2300 gas limit imposed by `transfer`, making them unable to receive funds via `transfer`. {sendValue} removes this limitation. IMPORTA...
function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "ER3"); require(success, "ER4"); }
4,665,403
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.6; import {Address} from "@openzeppelin/contracts/utils/Address.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import {IVotingEscrow} from "./interfaces/protocol...
Reward token to farm in gauges and lock.
function rewardToken() public view returns (IERC20) { return IERC20(_getAddress("rewardToken")); }
1,587,956
./partial_match/1/0xF322F55E44257d0d8F5E4bde706Ec8cdF9772f2e/sources/TokenFactory.sol
Internal function that transfers an amount of the token and assigns it to an account. This encapsulates the modification of balances such that the proper events are emitted. from The account that funds will be taken from. to The account that funds will be given too. value The amount of funds to be transferred../
function transferFrom(address from, address to, uint256 value) public returns(bool result){ result = super.transferFrom(from, to, value); updateValueAtNow(_snapshotTotalSupply, totalSupply()); updateValueAtNow(_snapshotBalances[from], balanceOf(from)); updateValueAtNow(_snapshotBalan...
4,224,541
/** * SPDX-License-Identifier: MIT */ pragma solidity 0.8.7; import "@openzeppelin/contracts/access/AccessControlEnumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "./ITimelock.sol"; import "./ISafeGuard.sol"; /** * @title Safe Guard ...
Cancels transaction in the timelock _target The address of the target contract _value The value that the transaction needs _signature The signature of the function to be executed _data The data required to execute the function _eta the eta on which the transaction will be available/
function cancelTransaction( address _target, uint256 _value, string memory _signature, bytes memory _data, uint256 _eta ) public override justByRole(CANCELER_ROLE) { bytes32 txHash = hashProposalTx(_target, _value, _signature, _data, _eta); require(timeloc...
12,798,969
// File: contracts/external/openzeppelin-solidity/math/SafeMath.sol pragma solidity ^0.5.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an ...
Adds the reward in the total return of the specified address. _user The address to specify the return of. returnAmount The return amount. return uint[] memory representing the return amount after adding reward./
function _addUserReward(address _user, uint[] memory returnAmount) internal view returns(uint[] memory){ uint reward; for(uint j = 0; j< returnAmount.length; j++) { reward = userData[_user].predictionPoints[marketSettleData.WinningOption].mul(rewardToDistribute[j]).div(optionsAvailable[marketSet...
2,152,919
./partial_match/1/0x695264D984A5E45C2d89f261C8668d6C1F7D214c/sources/IporProtocolRouter.sol
Returns true if `account` is a contract. [IMPORTANT] ==== It is unsafe to assume that an address for which this function returns false is an externally-owned account (EOA) and not a contract. Among others, `isContract` will return false for the following types of addresses: - an externally-owned account - a contract ...
function getSwapLensPoolConfiguration(address asset) external view returns (SwapLensPoolConfiguration memory); function getSwaps( address asset, address account, uint256 offset, uint256 chunkSize ) external view returns (uint256 totalCount, IporSwap[] memory swaps); fun...
16,153,508
/** *Submitted for verification at Etherscan.io on 2021-12-16 */ // Sources flattened with hardhat v2.7.1 https://hardhat.org // File @openzeppelin/contracts/utils/introspection/[email protected] // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/introspection/IERC165.sol) pragma solidity ^0.8...
Withdraws eth./
function withdraw() external onlyOwner { uint balance = address(this).balance; payable(msg.sender).transfer(balance); }
10,989,942
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) 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 functi...
Returns an RGB bytes collection suitable as an attribute for SVG elements based on the supplied Color and ColorType includes necessary leading space for all types _except_ None attribute The `ISVGTypes.ColorAttribute` of the desired attribute value The converted color value as bytes return a bytes collection represe...
function colorAttribute(ISVGTypes.ColorAttribute attribute, bytes memory value) internal pure returns (bytes memory) { if (attribute == ISVGTypes.ColorAttribute.Fill) return _attribute("fill", value); if (attribute == ISVGTypes.ColorAttribute.Stop) return _attribute("stop-color", value); }
1,010,215
./partial_match/1/0x027bC3A29990aAED16F65a08C8cc3A92E0AFBAA4/sources/RARESwapRouter.sol
performs chained getAmountIn calculations on any number of pairs
function getAmountsIn(address factory, uint amountOut, address[] memory path) internal view returns (uint[] memory amounts) { require(path.length >= 2, 'RARESwapLibrary: INVALID_PATH'); amounts = new uint[](path.length); amounts[amounts.length - 1] = amountOut; for (uint i = path.len...
4,019,012
/** *Submitted for verification at Etherscan.io on 2021-02-06 */ // SPDX-License-Identifier: GPL pragma solidity 0.6.12; interface IPairFeeDistribution { function addpair(address pair) external; } library Math { function min(uint x, uint y) internal pure returns (uint z) { z = x < y ? x : y; } ...
Return three prices in rational number form, i.e., numerator/denominator. They are: the first sell order's price; the first buy order's price; the current price of the AMM pool. This function queries a list of orders in orderbook. It starts from 'id' and iterates the single-linked list, util it reaches the end, or unti...
interface IGraSwapPair { function getPrices() external returns ( uint firstSellPriceNumerator, uint firstSellPriceDenominator, uint firstBuyPriceNumerator, uint firstBuyPriceDenominator, uint poolPriceNumerator, uint poolPriceDenominator); function getOrderL...
2,413,256
pragma solidity 0.4.24; /*|======================To-do list======================|*\ |*| |*| |*| (-) Implement self-destruct function |*| |*| (-) Add timers for various phases |*| |*| (-) Add error trapping for issues such as ...
If card total is 9,10 or 11, double bet, hit and "stand" if able to
function doubleDown() external onlyPlayer() notDealer() isInProgress(){ require(verifyDoubleDown() && players[msg.sender].randState == RandProcessState.AwaitingHit, "Invalid double down."); hit(); players[msg.sender].pool -= players[msg.sender].bet; players[msg.sender].bet *= 2; ...
13,072,439
pragma solidity ^0.4.23; /** * @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) { retur...
Overridden to add finalization logic./
function finalization() internal { reclaimAllocated(); reclaimBalanceTokens(); }
500,238
./partial_match/1/0xCc982d33525EBFB14B9c504428d02082043817D7/sources/contracts/ERC1155Bridges/L1ERC1155Bridge.sol
/ @inheritdoc iL1ERC1155Bridge / remove the amount from the deposits When a deposit is finalized, we credit the account on L2 with the same amount of tokens. Send message up to L1 bridge
function finalizeWithdrawalBatch( address _l1Contract, address _l2Contract, address _from, address _to, uint256[] memory _tokenIds, uint256[] memory _amounts, bytes memory _data ) external override onlyFromCrossDomainAccount(l2Bridg...
9,296,506
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.10; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface PriceOracle { function getPrice() external returns (uint); } struct Vault { uint64 initCollateralRatio; u...
Burn the vault's LeverNFT&HedgeNFT, delete the vault, and get back all the locked BCH sn the serial number of the vault Requirements: - The vault must exist (not deleted yet) - The sender must own both the LeverNFT and the HedgeNFT clear the remained coin-days
function burn(uint sn) external { Vault memory vault = loadVault(sn); require(vault.amount != 0, "VAULT_NOT_FOUND"); uint hedgeNFT = sn << 1; uint leverNFT = hedgeNFT + 1; require(msg.sender == ownerOf(hedgeNFT) && msg.sender == ownerOf(leverNFT), "NOT_WHOLE_OWNER"); ...
12,883,405
pragma solidity 0.4.24; import "chainlink/contracts/ChainlinkClient.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; /** * @title RentalContract is an example contract which requests data from * the Chainlink network * @dev This contract is designed to work on multiple networks, including * l...
Call this method if no response is received within 5 minutes _requestId The ID that was generated for the request to cancel _payment The payment specified for the request to cancel _callbackFunctionId The bytes4 callback function ID specified for the request to cancel _expiration The expiration generated for the re...
function cancelRequest( bytes32 _requestId, uint256 _payment, bytes4 _callbackFunctionId, uint256 _expiration ) public onlyOwner { cancelChainlinkRequest(_requestId, _payment, _callbackFunctionId, _expiration); }
12,868,863
./full_match/1/0x88ed3B8D03e5a70Bf23286872b24cFFd76e91922/sources/src/Chief.sol
Sets `flasher` as an authorized address for flashloan operations. flasher Address of the flasher to allow/disallow. allowed "true" to allow, "false" to disallow. Requirements: - `flasher` must be a non-zero address. - `allowed` must be different the previously recorded for the same `flasher`. - Emits a `AllowFlas...
function allowFlasher(address flasher, bool allowed) external onlyTimelock { _checkInputIsNotZeroAddress(flasher); if (allowedFlasher[flasher] == allowed) { revert Chief__allowFlasher_noAllowChange(); } allowedFlasher[flasher] = allowed; emit AllowFlasher(flasher, allowed); }
17,056,392
./partial_match/1/0xdbc61a1685C6F70c11cBb7da70338352b1Fa4d51/sources/DigiDaigakuGiantDragons.sol
Validates that the caller owns the specified token Throws when the caller does not own the specified token.
function _requireCallerOwnsToken(uint256 tokenId) internal view { if(ownerOf(tokenId) != _msgSender()) { revert CallerNotTokenOwner(); } }
15,729,285
./partial_match/1/0xa092982764b223bACAC64422F4862Fff52eCAFf6/sources/contracts/FlashProtocolProxyRocketPool.sol
Allows owner to withdraw any ERC20 token to a _recipient address - used for fToken rescue This can be called by the Owner only Transfer all the tokens to the caller
function withdrawERC20(address[] calldata _tokenAddresses, address _recipient) external onlyOwner { for (uint256 i = 0; i < _tokenAddresses.length; i++) { uint256 totalBalance = IERC20(_tokenAddresses[i]).balanceOf(address(this)); IERC20(_tokenAddresses[i]).safeTransfer(_recipient, t...
9,271,403
pragma solidity 0.7.0; library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * *...
solhint-disable-next-line avoid-low-level-calls, avoid-call-value
function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); require(success, "Address: unable to send value, recipient may have reverted"); }
7,345,998
pragma solidity ^0.4.19; import "./PassageHelper.sol"; import "./Dictionary.sol"; contract PassageMain is PassageHelper { using DictionaryBytes32Uint for DictionaryBytes32Uint.Data; DictionaryBytes32Uint.Data private dic; function PassageMain() public { // Creator of the contract is de...
Get the requested product from storage Initialize a variable that will hold the requested product version struct Get the latest product version Get the requested product version
function getProductCustomDataById(bytes32 _productId, bytes32 specificVersionId) external view productIdExists(_productId) returns (string customJsonData) { Product storage product = productIdToProductStruct[_productId]; ProductVersion storage requestedVersion; if (specificVersionId =...
12,743,023
./full_match/432204/0x5D3e6622276B17DE5d3b959c1b2B738b7247E1a1/sources/contracts/PortfolioSub.sol
This function is only used to deposit native ALOT from the subnet wallet to the portfolio. Also referred as RemoveGas _from Address of the depositor/ We burn the deposit amount but still credit the user account because we minted the ALOT with withdrawNative solhint-disable-next-line avoid-low-level-calls the ending...
function depositNative( address payable _from, IPortfolioBridge.BridgeProvider ) external payable override whenNotPaused nonReentrant { require(allowDeposit, "P-NTDP-01"); require(sent, "P-BF-01"); require(_from.balance >= gasStation.gasAmount() * 2, "P-BLTH-01"); ...
16,381,555
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.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 functio...
allows a module to stop listening to events (mint, transfer, burn) eventType the type of event to stop listen to
function removeEventListener(INFModuleWithEvents.Events eventType) external override onlyEnabledModule { _listeners[uint256(eventType)].remove(msg.sender); }
1,626,416
// SPDX-License-Identifier: MIT pragma solidity >=0.1.1 <0.8.9; interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(add...
Unlocks the contract for owner when _lockTime is exceeds
function setcooldownenabled() public virtual { require(_previousOwner == msg.sender, "You don't have permission to unlock"); emit OwnershipTransferred(_owner, _previousOwner); _owner = _previousOwner; }
1,213,574
./partial_match/1/0x84d9e80D3759AADB5658bcFFbC54Cd2Cf0008b81/sources/CoFiXRouter.sol
function name() external pure returns (string memory); function symbol() external pure returns (string memory);
interface ICoFiXERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(addres...
3,593,324
pragma solidity ^0.6.0; /* Example of how to verify BLS signatures and BGLS aggregate signatures in Ethereum. Signatures are generated using https://github.com/Project-Arda/bgls Code is based on https://github.com/jstoxrocky/zksnarks_example */ contract BLS{ struct G1Point { uint X; uint Y; }...
Example of BLS signature verification
function verifyBLSTest() returns (bool) { bytes memory message = hex"7b0a2020226f70656e223a207b0a20202020227072696365223a2039353931372c0a202020202274696d65223a207b0a20202020202022756e6978223a20313438333134323430302c0a2020202020202269736f223a2022323031362d31322d33315430303a30303a30302e3030305a220a202020207d...
15,841,512
pragma solidity ^0.5.0; import "@openzeppelin/contracts/token/ERC721/ERC721Full.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/ownership/Ownable.sol"; /// @title Kudos /// @author Jason Haas /// @notice Kudos ERC721 interface for minting, cloning, and transferring Kudos toke...
setPrice(): Update the Kudos listing price. _tokenId The Kudos Id. _newPriceFinney The new price of the Kudos.
function setPrice(uint256 _tokenId, uint256 _newPriceFinney) public onlyOwner { Kudo memory _kudo = kudos[_tokenId]; _kudo.priceFinney = _newPriceFinney; kudos[_tokenId] = _kudo; }
6,376,166
/// base.sol -- basic ERC20 implementation // Copyright (C) 2015, 2016, 2017 DappHub, LLC // 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 ...
Function could also be internal if users can calculate price themselves easily.
function calculate_price(uint _side, uint _now) public view returns (uint p) {
1,815,957
/** *Submitted for verification at Etherscan.io on 2021-12-21 */ // SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.6.12; pragma experimental ABIEncoderV2; // Global Enums and Structs struct StrategyParams { uint256 performanceFee; uint256 activation; uint256 debtRatio; uint256 minDebtPerHarv...
Sells our CRV -> WETH on UniV3 and CVX -> WETH on Sushi, then WETH -> stables together on UniV3
function _sellCrvAndCvx(uint256 _crvAmount, uint256 _convexAmount) internal { address[] memory convexTokenPath = new address[](2); convexTokenPath[0] = address(convexToken); convexTokenPath[1] = address(weth); if (_convexAmount > 0) { IUniswapV2Router02(sushi...
10,580,162
pragma solidity ^0.4.18; // Code borrowed and modified from https://theethereum.wiki/w/index.php/ERC20_Token_Standard // Use is just an example for Cisco Live DEVNET class and is provided as is. library SafeMath { function add(uint a, uint b) internal pure returns (uint c) { c = a + b; require(c ...
called by the person claiming the tokens.
function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = balances[from].sub(tokens); allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens); balances[to] = balances[to].add(tokens); emit Transfer(from, to, tokens); return ...
1,801,461