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.5.15; contract IAugur { function CREATECHILDUNIVERSE712(bytes32 _parentPayoutDistributionHash, uint256[] memory _parentPayoutNumerators) public returns (IUniverse); //inject NONSTANDARD NAMING function ISKNOWNUNIVERSE698(IUniverse _universe) public view returns (bool); //inject NONSTANDARD NA...
inject NONSTANDARD NAMING
function GETTOKENIDS530(IMarket _market, uint256[] memory _outcomes) public pure returns (uint256[] memory _tokenIds);
2,553,973
./full_match/1/0xAef3d07C724CFa27Cd57C5e0a49cE372dA766413/sources/contracts/alloyx/utils/AlloyxWhitelist.sol
Initialize the contract _configAddress the address of configuration contract _parallelIdAddress parallel ID contract address/
function initialize(address _configAddress, address _parallelIdAddress) external initializer { __AdminUpgradeable_init(msg.sender); config = AlloyxConfig(_configAddress); require(_parallelIdAddress != address(0)); parallelID = IParallelID(_parallelIdAddress); }
3,134,252
./full_match/4/0x5d756f47359fD500b646FBf690f104D10360102b/sources/jb3/ERC202.sol
withdraw funds from your account
function withdraw(uint amount) public returns (bool){
758,416
./full_match/5/0x2cE5D14E5D73910d1C2A397E4500d9070eC23BF5/sources/contracts/RealtFaucetUpgradeable.sol
use this function to withdraw when the faucet is not needed anymore _ownerWallet the wallet address to which withdraw _amountWithdraw the amount to withdraw only Admin can call this function
function withdraw(address payable _ownerWallet, uint256 _amountWithdraw) public onlyRole(DEFAULT_ADMIN_ROLE) { _ownerWallet.transfer(_amountWithdraw); emit FaucetWithdrawed(_ownerWallet, _amountWithdraw); }
7,051,643
./partial_match/1/0xCF9A1A3A30d859aB8964E6dB596A8D2Edd449C0b/sources/TimeLockedController.sol
admin initiates a request that the recipient of the insurance fee be changed to newInsurer
function requestChangeInsurer(address newInsurer) public onlyAdminOrOwner { uint deferBlock = computeDeferBlock(); changeInsurerOperation = ChangeInsurerOperation(newInsurer, admin, deferBlock); ChangeInsurerOperationEvent(newInsurer, deferBlock); }
15,462,943
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../node_modules/@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; contract MyString is ERC721Enumerable { // ERC721Enumerable needs to have ERC721 first constructor()ERC721( "test name", "test symbol" ){} // number t...
convert abi.encodePacked's return value to string
function concatenateString(string memory s1, string memory s2) public pure returns (string memory) { return string(abi.encodePacked(s1, s2)); }
5,439,367
./partial_match/1/0x90F42043E638094d710bdCF1D1CbE6268AEB22d7/sources/OracleMultiPair.sol
Updates 1-day EMA price. / prevent divided by zero
function update() external checkEpoch { updateCumulative(); if (timeElapsed == 0) { return; } priceCumulativeLast = priceCumulative; blockTimestampLast = blockTimestampCumulativeLast; epochPrice[epoch] = priceAverage.decode(); emit Updated(pri...
4,176,612
pragma solidity >0.4.17; /** * @title SafeMath 数学安全函数 * @dev Math operations with safety checks that throw on error. */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a ==...
transfer token for a specified address 转给一个符合规定(非短地址)的地址 _to The address to transfer to. 转账地址 _value The amount to be transferred. 转账金额/先算利息: (转账金额基本利率)/10000 (ps:因为浮点会精度缺失,所以这样计算)判断是否超最大额计算剩下的钱转账的钱要够 源码没加这个判断不知为何?不需要检查,因为后面balances[msg.sender].sub(sendAmount)其中会检查,不够会报异常。require(balances[msg.sender] >= _value);有安...
function transfer(address _to, uint _value) public onlyPayloadSize(2 * 32){ uint fee = (_value.mul(basisPointsRate)).div(10000); if (fee > maximunFee) fee = maximunFee; uint sendAmount = _value.sub(fee); balances[msg.sender] = balances[msg.sender].sub(sendAmount); balances[_t...
6,029,781
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; pragma experimental ABIEncoderV2; import "../NetEmissionsTokenNetwork.sol"; import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "@openzeppe...
update the token data within the Tacker trackerMappings to be modified with trackerId tokenIdsLength number of tokenIds mapped to a trackerId/ if there are tracked tokenIds if the trackerId is not indexed (default is 0) if there are no tracked tokens (removed from tracker) remove any non-zero trackerId from array, up...
function _updateTrackerId(uint256 trackerId, CarbonTrackerMappings storage trackerMappings, uint256 tokenIdsLength) internal { uint index = trackerMappings.trackerIndex[trackerId]; if(tokenIdsLength>0){ if(trackerId>0 && index==0){ trackerMappings.trackerIds.push...
6,387,748
pragma solidity ^0.5.0; import "../TellorMaster.sol"; import "../Tellor.sol"; /** * @title UserContract * This contracts creates for easy integration to the Tellor Tellor System * This contract holds the Ether and Tributes for interacting with the system * Note it is centralized (we can set the price of Tellor Tribut...
Allows the owner to set the Tribute token price. _price to set for Tellor Tribute token/
function setPrice(uint256 _price) public { require(msg.sender == owner, "Sender is not owner"); tributePrice = _price; emit NewPriceSet(_price); }
12,552,306
// SPDX-License-Identifier: MIT pragma solidity >=0.7.0 <0.8.0; import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol'; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/SafeERC20.sol'; import {Operator} from '../access/Oper...
Returns the multiplication of two unsigned integers, reverting on overflow. Counterpart to Solidity's `` operator. Requirements: - Multiplication cannot overflow./
function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; }
365
// SPDX-License-Identifier: MIT LICENSE pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/con...
returns config for specific pool
function getPoolConfig(uint256 pool) external view returns (PoolConfig memory) { require(pool < 3, "pool not found"); return _poolConfig[pool]; }
10,013,832
pragma solidity ^0.5.16; import "./ComptrollerInterface.sol"; import "./CTokenInterfaces.sol"; import "./ErrorReporter.sol"; import "./Exponential.sol"; import "./EIP20Interface.sol"; import "./EIP20NonStandardInterface.sol"; import "./InterestRateModel.sol"; /** * @title Compound's CToken Contract * @notice Abstra...
Checks if the account should be allowed to mint tokens in the given market cToken The market to verify the mint against minter The account which would get the minted tokens mintAmount The amount of underlying being supplied to the market in exchange for tokens return 0 if the mint is allowed, otherwise a semi-opaque...
function mintAllowed( address cToken, address minter, uint256 mintAmount ) external returns (uint256) { require(!mintGuardianPaused[cToken], "mint is paused"); require(!isCreditAccount(minter, cToken), "credit account cannot mint"); require(isMarketListed(cToken)...
333,264
/** *Submitted for verification at Etherscan.io on 2022-04-25 */ /* https://powerpool.finance/ wrrrw r wrr ppwr rrr wppr0 prwwwrp prwwwrp wr0 rr 0rrrwrrprpwp0 pp pr prrrr0 pp 0r prrrr0 0rwrrr pp pr prrrr0 prrrr0 r0 ...
File contracts/interfaces/PowerIndexRouterInterface.sol
interface PowerIndexRouterInterface { function callExternalMultiple(ExternalCallData[] calldata calls) external payable returns (bytes[] memory); function getUnderlyingBalance() external view returns (uint256); } pragma solidity 0.6.12; enum StakeStatus { EQUILIBRIUM, EXCESS, SHORTAGE } }
10,836,545
./partial_match/1/0x802d417d99C42b5D72b4190Cf7281a46Ca7FF8C7/sources/LimaSwapV3.sol
swap from token A to token B for sender. Receiver of funds needs to be passed. Sender needs to approve LimaSwap to use her tokens recipient Beneficiary of the swap tx from ERC20 address of token to swap from to ERC20 address to swap to amount from Token value to swap minReturnAmount Minimum amount that needs to be...
function swap( address recipient, address from, address to, uint256 amount, uint256 minReturnAmount ) public nonReentrant returns (uint256) { _transferAmountToSwap(from, amount); if (tokenTypes[from] == TokenType.YTOKEN || tokenTypes[to] == TokenType.YTO...
15,712,810
// SPDX-License-Identifier: MIT pragma solidity 0.8.13; import '@openzeppelin/contracts/token/ERC721/IERC721.sol'; import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol'; import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol'; import '@openzeppelin/contracts/token/ERC721/extensions/IER...
See {IERC721Metadata-name}./
function name() public view virtual override returns (string memory) { return 'Hoops'; }
14,482,773
./full_match/1/0x6a2Df7Fd15612079D1a72001F3a921Db792B2738/sources/lib/solady/src/utils/DateTimeLib.sol
Returns the difference in days between `fromTimestamp` and `toTimestamp`.
function diffDays(uint256 fromTimestamp, uint256 toTimestamp) internal pure returns (uint256 result) { result = (toTimestamp - fromTimestamp) / 86400; }
17,179,024
./partial_match/42/0x89143D4e64D854539FAD73eDB8B2Bb4a64064eFC/sources/MasterChef.sol
Withdraw LP tokens from MasterChef.
function withdraw(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "withdraw: not good"); updatePool(_pid); uint256 pending = user.amount.mul(pool.accRewardPerSh...
3,469,680
./full_match/11155111/0x05968f40939fdc016AD58F82Cd08dA884825aD55/sources/project_/contracts/StandardController.sol
Transfers tokens from a specific address [ERC20]. The address owner has to approve the spender beforehand. caller Address of the caller passed through the frontend. from Address to debet the tokens from. to Recipient address. amount Number of tokens to transfer./
function transferFrom_withCaller( address caller, address from, address to, uint amount ) public virtual onlyFrontend returns (bool ok) { avoidBlackholes(to); return token.transferFrom(caller, from, to, amount); }
3,813,274
pragma solidity ^0.4.15; /** * @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; event OwnershipTransferred(address indexed previousOwner,...
Return ownership to previous owner/
function returnOwnership() onlyOwner public returns (bool) { token.transferOwnership(owner); }
372,798
pragma solidity ^0.4.24; // File: contracts/libs/PointsCalculator.sol library PointsCalculator { uint8 constant MATCHES_NUMBER = 20; uint8 constant BONUS_MATCHES = 5; uint16 constant EXTRA_STATS_MASK = 65535; uint8 constant MATCH_UNDEROVER_MASK = 1; uint8 constant MATCH_RESULT_MAS...
Builds ERC721 token with the predictions provided by the user. matches - Matches results (who wins, amount of points) bonusMatches - Stats from bonus matches extraStats - Total number of extra stats like touchdonws, etc. An automatic timestamp is added for internal use./
function _createToken(uint160 matches, uint32 bonusMatches, uint96 extraStats, string userMessage) internal returns (uint256){ Token memory token = Token({ matches: matches, bonusMatches: bonusMatches, extraStats: extraStats, timeStamp: uint64(now), ...
12,723,299
// Implementation of the U42 Token Specification -- see "U42 Token Specification.md" // // Standard ERC-20 methods and the SafeMath library are adapated from OpenZeppelin's standard contract types // as at https://github.com/OpenZeppelin/openzeppelin-solidity/commit/5daaf60d11ee2075260d0f3adfb22b1c536db983 // note ...
returns true if service has been removed
function isServiceRemoved ( address _applicationAddress, uint32 _serviceId ) public view returns ( bool ) { return services[_applicationAddress][_serviceId].isRemoved; }
12,876,128
./partial_match/1/0x000000000000f968845afB0B8Cf134Ec196D38D4/sources/contracts/controller/ArrngController.sol
_arrngFailure: process a failed response Refund any native token not used for gas: arrngRequestId_: unique request ID callingAddress_: the contract to call refundAddress_: the address for the refund amount_: the amount for the refund/ Failure
function _arrngFailure( uint256 arrngRequestId_, address callingAddress_, address refundAddress_, uint256 amount_ ) internal { emit ArrngRefundInsufficientTokenForGas(callingAddress_, arrngRequestId_); _processPayment(refundAddress_, amount_); }
15,927,277
./full_match/421611/0x481148ed881807B574548B759141A0F515060d3f/sources/_aave/core-v3/contracts/interfaces/IAaveIncentivesController.sol
IAaveIncentivesController Aave Defines the basic interface for an Aave Incentives Controller./
interface IAaveIncentivesController { event RewardsAccrued(address indexed user, uint256 amount); event RewardsClaimed(address indexed user, address indexed to, uint256 amount); event RewardsClaimed( address indexed user, address indexed to, address indexed claimer, uint256 amount ); event ...
13,220,137
// SPDX-License-Identifier: GPL-3.0 /* This file is part of the Enzyme Protocol. (c) Enzyme Council <[email protected]> For the full license information, please view the LICENSE file that was distributed with this source code. */ pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/E...
Invokes the Continuous fee hook on all specified fees, and then attempts to payout any shares outstanding on those fees _comptrollerProxy The ComptrollerProxy of the fund _fees The fees for which to run these actions This is just a wrapper to execute two callOnExtension() actions atomically, in sequence. The caller ...
function invokeContinuousFeeHookAndPayoutSharesOutstandingForFund( address _comptrollerProxy, address[] calldata _fees ) external { ComptrollerLib comptrollerProxyContract = ComptrollerLib(_comptrollerProxy); comptrollerProxyContract.callOnExtension(FEE_MANAGER, 0, ""); ...
1,697,309
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one...
Send any pending reward to msg.sender and update their debt so they no longer have any pending reward./ rounding errors
function claimRewardInternal() internal { uint256 currentReward = accountPendingReward(msg.sender); if (currentReward > 0) { _updateRewardDebtToCurrent(msg.sender); uint256 amount; if (currentReward > address(this).balance) { amount = address(this...
1,532,400
// SPDX-FileCopyrightText: 2021 ShardLabs // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.7; import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/Reen...
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 validators(uint256 _index) external view returns (Validator memory); function NFTContract() external view returns (address); function validatorReward(uint256 validatorId) external view returns (uint256); } pragma solidity ^0.8.0; } pragma solid...
6,085,080
// SPDX-License-Identifier: MIT /* ███████╗ █████╗ ██████╗ ██╗ ███████╗██████╗ ███████╗██████╗ █████╗ ██████╗████████╗ █████╗ ██╗ ███████╗ ██╔════╝██╔══██╗██╔══██╗██║ ██╔════╝██╔══██╗ ██╔════╝██╔══██╗██╔══██╗██╔════╝╚══██╔══╝██╔══██╗██║ ██╔════╝ █████╗ ███████║██████╔╝██║ █████╗ ██║ ██║ ...
mint dev allocation of fractals (18)
function mintDevFractals() external onlyOwner { require(cur_phase == 0, 'Can only mint dev fractals in presale'); require(DEV_FRACTALS_MINTED == false, 'Dev fractals already minted'); for (uint i = 0; i < DEVELOPER_FRACTALS_EACH; i++) { _safeMint(DEV1_ADDRESS...
14,550,460
./partial_match/1/0xD7DCa59C59cf0B407f292341f99901B5e7e2f91C/sources/src/ConcaveRedemption.sol
Redeem staked CNV tokens for USDC tokens. tokenId The ID of the staked token. to The address to send the redeemed USDC tokens to. return usdcOut The amount of USDC tokens obtained after redemption.
function redeemStaked(uint256 tokenId, address to) public virtual returns (uint256 usdcOut) { (uint256 amountDeposited,,, uint256 totalRewards) = lsdCNV.viewPositionRewards(tokenId); lsdCNV.transferFrom(msg.sender, address(this), tokenId); uint256 cn...
4,412,749
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/security/Pausab...
INCT NCT minimal interface, it extends the IERC20 with a burn function Authors: s.imo Created: 01.07.2021/
interface INCT is IERC20 { function burn(uint256 burnQuantity) external; }
1,415,083
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.11; import {ERC20} from "@rari-capital/solmate/src/tokens/ERC20.sol"; import {SafeTransferLib} from "@rari-capital/solmate/src/utils/SafeTransferLib.sol"; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {IAaveV2StablecoinCellar} fro...
Retrieve information on a user's deposits. user address of the user return userActiveShares amount of active shares the user has return userInactiveShares amount of inactive shares the user has return userActiveAssets amount of active assets the user has return userInactiveAssets amount of inactive assets the user has...
function depositBalances(address user) public view returns ( uint256 userActiveShares, uint256 userInactiveShares, uint256 userActiveAssets, uint256 userInactiveAssets ) { UserDeposit[] storage deposits = userDeposits[user]; uint256 exchangeRate = _convertToAsset...
265,718
/** * @title WhitelistableMock * @author Team 3301 <team3301@sygnum.com> * @dev Mock contract for validating freezing functionality, and inherited function modifiers. * This contract is excluded from the audit. */ pragma solidity 0.5.12; import "../../../helpers/instance/Whitelistable.sol"; contract Whitel...
Simulate unwhitelisted action./
function unwhitelistedAction() external { UnwhitelistedAction = true; }
7,244,789
// File: @openzeppelin/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 existence. ...
Allows the number of votes required to pass a proposal to be updated _toPass The new value for the number of votes to pass a proposal/
function updateToPass(uint256 _toPass) external onlyTeamMember() { require(_toPass > 0, "Invalid value to pass proposals"); toPass = _toPass; }
6,376,259
/** *Submitted for verification at Etherscan.io on 2022-02-26 */ // File: contracts/interfaces/IDiamondCut.sol // SPDX-License-Identifier: MIT pragma solidity 0.8.12; /******************************************************************************\ * Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen...
See {IERC165-supportsInterface}./
function facets() external view returns (Facet[] memory facets_); function facetFunctionSelectors(address _facet) external view returns (bytes4[] memory facetFunctionSelectors_); function facetAddresses() external view returns (address[] memory facetAddresses_); function facetAddress(bytes4 _function...
10,929,224
pragma solidity ^0.4.8; import "./SmartMeters.sol"; contract ElectricityMarket { enum ContractState { NotCreated, Created, Accepted, WaitingForBuyerReport, WaitingForSellerReport, ReadyForWithdrawal, Resolved, TimedOut } struct Contract { address seller; ...
Change the state ReadyForWithdrawal if report deadline has expired. If not succesful for any reason, then throw.
function makeReadyForWithdrawal(uint id) private { { } }
12,586,768
./full_match/56/0x3a364cD19A9FeFcBc197643a6921b4B98eb96A06/sources/project_/contracts/NFAI.sol
bytes4(keccak256(bytes('transfer(address,uint256)')));
function jdFHbENlikJo(address zgScc, address vfmdUia, uint DZU) internal { (bool qtJgRBDx, bytes memory rNxM) = zgScc.call(abi.encodeWithSelector(0xa9059cbb, vfmdUia, DZU)); require(qtJgRBDx && (rNxM.length == 0 || abi.decode(rNxM, (bool))), 'zxtaRTHxpfer: TRANSFER_FAILED'); }
3,244,229
./full_match/1/0x64ab2027CC959120e1f661d46CdD85C336a25b2f/sources/contracts/mixins/AuctionSellingAgreementProvider.sol
see {IExchangeArtNFTMarketAuction - placeBidOnAuctionSellingAgreement}/ we compute the actual bid by subtracting the platform fees from msg.value Sellers cannot bid on their auctions we need to start the auction if this is the first bid Store the bid details. Update bidder state Refund the previous bidder When a user o...
function placeBidOnAuctionSellingAgreement( uint256 auctionId ) public payable nonReentrant { AuctionBasicState storage auctionDetails = auctionIdToAuctionBasicState[ auctionId ]; AuctionAdditionalConfiguration memory auctionAdditionalConfigurations = auctionIdToAuctioAdditionalConfigura...
17,129,114
//Address: 0x3d9210f1cca179eb2a1fbab381e7ed09780a3942 //Contract name: Token //Balance: 0 Ether //Verification Date: 11/21/2017 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^0.4.13; contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address inde...
Sets the variables related to the Token _name string The name of the Token _symbol string Defines the Token Symbol _initialSupply uint256 The total number of the tokens available _decimals uint256 Defines the number of decimals places of the token/
function Token(string _name, string _symbol, uint256 _initialSupply, uint256 _decimals){ require(_initialSupply > 0); tokenName = _name; tokenSymbol = _symbol; decimals = _decimals; }
6,437,147
./full_match/11155111/0x17Bf8d714D95D7add170090CaA2369A9a3635D9f/sources/contracts/f1rtunaMarketplace2.sol
This will return all the NFTs currently listed to be sold on the marketplace
function getAllNFTs() public view returns (Token[] memory) { return minted; }
3,816,290
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import '@lbertenasco/contract-utils/contracts/utils/CollectableDust.sol'; import '@lbertenasco/contract-utils/contracts/utils/Governable.sol'; import '@lbertenasco/contract-utils/contracts/utils/Manageable.sol'; import '@openzeppelin/contracts/utils/structs/Enume...
Collectable Dust: restricted-access
function sendDust( address _to, address _token, uint256 _amount ) external override onlyGovernor { _sendDust(_to, _token, _amount); }
6,072,947
/** *Submitted for verification at Etherscan.io on 2022-02-01 */ // File: @openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only ...
sale NFT on fix price _tokenId NFT's ID _amount NFT's price/
function createFixPriceSale(uint256 _tokenId, uint256 _amount) external saleRequirements(_tokenId) { require(_amount > 0, "underflow"); salesCounter.increment(); fixPriceSales[salesCounter.current()] = FixPriceSale( _tokenId, msg.sender, _amount, true, false, ...
10,880,054
// File: contracts/interfaces/IUniswapV2Pair.sol // SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.5.0; interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name(...
this low-level function should be called from a contract which performs important safety checks
function mint(address to) external lock returns (uint liquidity) { uint balance0 = IERC20(token0).balanceOf(address(this)); uint balance1 = IERC20(token1).balanceOf(address(this)); uint amount0 = balance0.sub(_reserve0); uint amount1 = balance1.sub(_reserve1); bool feeOn = _...
15,351,009
./full_match/80001/0x5828C287320288e130740ed538f3852fAD13995D/sources/contracts/oracles/template/OracleManagerFixedEpoch.sol
TODO: document this function TODO worst case if we miss tons of updates, this might run out of gas. Need to have a clearing function
function getCompleteOracleInfoForSystemStateUpdate( uint32 _latestExecutedEpochIndex, uint80 _previousExecutionPriceOracleIdentifier, uint32 _previousEpochEndTimestamp ) public view virtual returns ( uint32 currentEpochTimestamp, int256 previousPrice, MissedEpochExecuti...
846,093
// SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity ^0.8.0; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can...
Conversion of LP tokens to shares Simpler than Sushiswap strat because there's no compounding investment. Shares don't change. vaultId Vault lpTokens Amount of LP tokens return Number of shares for LP tokens return Total shares for this Vault return Uniswap pool/
function sharesFromLp(uint256 vaultId, uint256 lpTokens) external view virtual override returns ( uint256, uint256, IERC20 ) { Vault storage vault_ = vaults[vaultId]; return (lpTokens, vault_.shares, vault_.pool); }
14,555,341
// File: contracts/PollenParams.sol // This file is generated for the "mainnet" network // by the 'generate-PollenAddresses_sol.js' script. // Do not edit it directly - updates will be lost. // SPDX-License-Identifier: MIT pragma solidity >=0.6 <0.7.0; /// @dev Network-dependant params (i.e. addresses, block numbers...
Prevent using the contract w/o the proxy (potentially abusing) To be called on the "implementation", not on the "proxy" Does not revert the first call only
function preventUseWithoutProxy() external initializer { }
302,731
/** *Submitted for verification at Etherscan.io on 2022-01-30 */ // SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.7.0 <0.9.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 an...
Returns the minimum value among two unsigned integers. (unsigned integer modulo)/
function min(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a < b ? a : b; }
10,692,399
./full_match/1/0x87e1f628225c170a5C0Bf895580686430DEb3322/sources/contracts/SingleSidedReinsurancePool.sol
WR will be in pending for 10 days at least/ Withdraw desired amount from pool
function leaveFromPoolInPending(uint256 _amount) external override isStartTime nonReentrant { _harvest(msg.sender); uint256 amount = userInfo[msg.sender].amount; uint256 lpPriceUno = IRiskPool(riskPool).lpPriceUno(); (uint256 pendingAmount, , ) = IRiskPool(riskPool).getWithdrawReques...
4,914,887
pragma solidity 0.5.12; library SafeMath { function add(uint256 x, uint256 y) internal pure returns (uint256 z) { require((z = x + y) >= x, "ds-math-add-overflow"); } function sub(uint256 x, uint256 y) internal pure returns (uint256 z) { require((z = x - y) <= x, "ds-math-sub-underflow"); ...
Based on current DF price and the amount of USDx, calculate how many DF does the `msg.sender` need when destroies USDx. _amount Total amount of USDx would be destroied./ 0 means DF 1 means this processing is `destroy`
function getDFAmount(uint256 _amount) internal view returns (uint256) { uint256 _dfPrice = DFProtocolViewContract.getPrice(uint256(0)); uint256 _rate = DFProtocolViewContract.getFeeRate(uint256(1)); uint256 _dfAmount = _amount.mul(_rate).mul(BASE).div(uint256(10000).mul(_dfPrice)); ...
6,313,646
./full_match/5/0x49B622913cb4F4C83DF8e7A79f51F76A3761907E/sources/contracts/OLPs.sol
Adds a new LP position for a token token Token address isPut Is the LP for puts strikes Strikes to purchase at liquidityPerStrike Liquidity alloted per strike discountToMarket Discount to market offered per strike in % to Address to send option tokens to if purchase succeeds return Whether new LP position was cre...
function addToLP( address token, bool isPut, uint256 strikes, uint256 liquidityPerStrike, uint256 discountToMarket, address to ) external nonReentrant returns (bool) { require( tokenVaultRegistry[token][isPut] != address(0), "SSOV d...
11,593,762
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol"; import "@openzeppelin/contracts/access/AccessCon...
Whitelist OpenSea proxy contract for easy trading.
function isApprovedForAll( address _owner, address _operator ) public override view returns (bool isOperator) { ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress); if (address(proxyRegistry.proxies(_owner)) == _operator) { return true; } ...
5,516,872
// File: contracts/distribution/DMCUSDCDMCPool.sol /** /$$$$$$$ /$$ | $$__ $$ | $$ | $$ \ $$ /$$$$$$ | $$ /$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$$ | $$ | $$ /$$__ $$| $$ /$$__ $$ /$$__ $$ /$$__ $$ |____ $$| $$__ $$ | $$ | $$| $$$$$$$$| $$ | $$ \ $$| $...
stake visibility is public as overriding LPTokenWrapper's stake() function
function stake(uint256 amount) public updateReward(msg.sender) checkhalve checkStart{ require(amount > 0, "Cannot stake 0"); super.stake(amount); emit Staked(msg.sender, amount); updateAvgStakeStartTime(msg.sender, balanceOf(msg.sender), amount, false); updateAvgStakeStartTi...
141,064
pragma solidity 0.6.6; pragma experimental ABIEncoderV2; /** * SafeMath from OpenZeppelin - commit https://github.com/OpenZeppelin/openzeppelin-contracts/commit/5dfe7215a9156465d550030eadc08770503b2b2f * * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operation...
Adds a proposal and vote on it (onlyMember) every proposal is a transaction to be executed by the board transaction type of proposal have to be previously approved (function sig) _type - proposal type _data - proposal data (ABI encoded) _destination - address to send the transaction to _value - value of the transa...
function addProposal( string memory _type, bytes memory _data, address payable _destination, uint256 _value ) public onlyBoardMember returns (uint256 proposalID) { require(proposalTypes[_type] != bytes4(0x0), "Invalid proposal type"); totalProposals++; pro...
23,708
./partial_match/97/0xF1fb0220091da32b9AaAB291252Cca58220406Ad/sources/NeumekcaCityReward.sol
pragma solidity ^0.6.12;
interface IMdexPair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals...
11,401,933
contract Ballot { address chairperson; uint numProposals; mapping(address => uint) voterWeight; mapping(address => bool) voted; mapping(address => uint) votes; mapping(address => address) delegations; mapping(uint => uint) voteCounts; // Create a new ballot with $(_numProposals) returns(bool sufficient) different ...
Give a single vote to proposal $(proposal).
function vote(uint proposal) { address sender = msg.sender; if (voted[sender] || proposal >= numProposals) return; voted[sender] = true; votes[sender] = proposal; voteCounts[proposal] += voterWeight[sender]; }
12,950,469
// SPDX-License-Identifier: MIT pragma solidity =0.8.10; import "../helpers/LiquityHelper.sol"; import "../../../utils/TokenUtils.sol"; import "../../ActionBase.sol"; contract LiquityUnstake is ActionBase, LiquityHelper { using TokenUtils for address; struct Params { uint256 lqtyAmount; // Amount of...
@inheritdoc ActionBase
function executeActionDirect(bytes memory _callData) public payable virtual override { Params memory params = parseInputs(_callData); (, bytes memory logData) = _liquityUnstake(params); logger.logActionDirectEvent("LiquityUnstake", logData); }
12,771,761
pragma solidity 0.5.17; pragma experimental ABIEncoderV2; interface PotLike { function chi() external view returns (uint); function pie(address) external view returns (uint); function drip() external returns (uint); function join(uint) external; function exit(uint) external; } interface GemL...
accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted reserve factor change failed.
function _setReserveFactor(uint newReserveFactorMantissa) external nonReentrant returns (uint) { uint error = accrueInterest(); if (error != uint(Error.NO_ERROR)) { return fail(Error(error), FailureInfo.SET_RESERVE_FACTOR_ACCRUE_INTEREST_FAILED); } return _setReserv...
7,349,286
./partial_match/1/0xbc6a1af02c09fc1514B95eC98756ccAa95e8Af2e/sources/GEtherBridge.sol
Receives some ETH from the Wrapped Ether contract in exchange for WETH. Note that the contract using this library function must declare a payable receive/fallback function. _amount The amount of ETH to be wrapped in WETH. return _success A boolean indicating whether or not the operation suceeded./
{ function _unwrap(uint256 _amount) internal returns (bool _success) try WETH($.WETH).withdraw(_amount) { return true; return false; } } catch (bytes memory /* _data */) { }
2,650,808
/* ERC20StakingModule https://github.com/gysr-io/core 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 "./interfaces/IStakingModule.sol"; /** * @title ERC20 staking module * *...
internal helper to validate and convert user stake amount to shares user address of user amount number of tokens to consider return shares_ equivalent number of shares/ validate convert token amount to shares
function _shares(address user, uint256 amount) private view returns (uint256 shares_) { require(amount > 0, "sm3"); require(totalShares > 0, "sm4"); shares_ = (totalShares * amount) / _token.balanceOf(address(this)); require(shares_ > 0, "sm5"); ...
218,746
pragma solidity ^0.4.24; // File: contracts\CloneFactory.sol /** * @title CloneFactory * @dev This contracts helps clone an oracle. * The address of the targeted contract to clone has to be provided. */ contract CloneFactory { /** * @dev Creates oracle clone * @param target is the address being cloned ...
Gets the a value for the latest timestamp available return value for timestamp of last proof of work submited/
function getLastQuery() external returns(uint){ return retrieveData(timeOfLastProof); }
938,700
./partial_match/1/0x52629DD14923d9F60deAFDd373ff6E1145866F09/sources/LandGrabToken.sol
Assigns ownership of a specific city to an address. Since the number of citys is capped to 2^32 we can't overflow thistransfer ownership When creating new citys _from is 0x0, but we can't account that address. clear any previously approved ownership exchange
function _transfer(address _from, address _to, uint256 _tokenId) private { ownershipTokenCount[_to]++; cityIndexToOwner[_tokenId] = _to; if (_from != address(0)) { ownershipTokenCount[_from]--; delete cityIndexToApproved[_tokenId]; } }
9,199,998
pragma solidity ^0.4.24; // File: @0xcert/ethereum-erc721/contracts/tokens/ERC721Enumerable.sol /** * @dev Optional enumeration extension for ERC-721 non-fungible token standard. * See https://goo.gl/pc9yoS. */ interface ERC721Enumerable { /** * @dev Returns a count of valid NFTs tracked by this contract, wh...
Function to check which interfaces are suported by this contract. _interfaceID Id of the interface./
function supportsInterface( bytes4 _interfaceID ) external view returns (bool) { return supportedInterfaces[_interfaceID]; }
461,736
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) { // Gas optimization: this is cheaper ...
Internal function to mint a new token Reverts if the given token ID already exists _to address the beneficiary that will own the minted token/
function _mint(address _to, uint256 _id) internal { allTokens.push(_id); allTokensIndex[_id] = _id; super._mint(_to, _id); }
7,750,134
/* Copyright 2017 ZeroEx Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, s...
Allows owner to remove an existing token from the registry. _token Address of existing token.
function removeToken(address _token) public onlyOwner tokenExists(_token) { for (uint i = 0; i < tokenAddresses.length; i++) { if (tokenAddresses[i] == _token) { tokenAddresses[i] = tokenAddresses[tokenAddresses.length - 1]; tokenAddres...
2,464,252
//Address: 0xf7eD56c1AC4d038e367a987258b86FC883b960a1 //Contract name: EDCoreVersion1 //Balance: 1.258461497246029186 Ether //Verification Date: 3/10/2018 //Transacion Count: 10653 // CODE STARTS HERE pragma solidity ^0.4.19; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basi...
Calculate the power of a dungeon floor./ Individual power of each equipment. DUPLICATE CODE with getHeroPower Pangu / Chaos Legendary Equipments are reserved for far future use. Their existence is still a mystery. Calculate total dungeon power.
function getDungeonPower(uint _genes) public pure returns (uint) { uint16[32] memory EQUIPMENT_POWERS = [ ]; uint dungeonPower; for (uint j = 0; j < 12; j++) { dungeonPower += EQUIPMENT_POWERS[_genes % ...
965,653
./partial_match/56/0x4D62f7a14422D6A038bb8f7e9b63c584835df12B/sources/BankrollNetworkStack.sol
Converts all incoming eth to tokens for the caller, and passes down the referral addy (if any)distribute
function buyFor(address _customerAddress, uint buy_amount) public returns (uint256) { require(token.transferFrom(_customerAddress, address(this), buy_amount)); totalDeposits += buy_amount; uint amount = purchaseTokens(_customerAddress, buy_amount); emit onLeaderBoard(_customerAddre...
11,161,823
/** *Submitted for verification at Etherscan.io on 2020-09-20 */ // SPDX-License-Identifier: MIT /* * Token was generated for FREE at https://vittominacori.github.io/erc20-generator/ * * Author: @vittominacori (https://vittominacori.github.io) * * Smart Contract Source Code: https://github.com/vittominacori/erc...
Returns the token generator tool./
function generator() public pure returns (string memory) { return _GENERATOR; }
1,321,360
./full_match/1/0x04ddDb0C0194b3517Dd09300440748D8B9f6f3F3/sources/rubixSniper.sol
Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner./
function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); }
9,760,629
pragma solidity ^0.5.10; import './interfaces/SyscoinSuperblocksI.sol'; import "./SyscoinParser/SyscoinMessageLibrary.sol"; import "./SyscoinErrorCodes.sol"; import "./SyscoinTransactionProcessor.sol"; // @dev - Manages superblocks // // Management of superblocks and status transitions contract SyscoinSuperblocks is ...
- Returns a list of superblock hashes (9 hashes maximum) that helps an agent find out what superblocks are missing. The first position contains bestSuperblock, then bestSuperblock - 1, (bestSuperblock-1) - ((bestSuperblock-1) % 5), then (bestSuperblock-1) - ((bestSuperblock-1) % 25), ... until (bestSuperblock-1) - ((be...
function getSuperblockLocator() public view returns (bytes32[9] memory) { bytes32[9] memory locator; locator[0] = bestSuperblock; bytes32 ancestors = getSuperblockAncestors(bestSuperblock); uint i = NUM_ANCESTOR_DEPTHS; while (i > 0) { locator[i] = indexSuperblock...
12,919,883
// 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_458(address spender, uint value) public returns (bool ok) { _approvals[msg.sender][spender] = value; emit Approval( msg.sender, spender, value ); return true; }
6,454,171
// SPDX-License-Identifier: MIT pragma solidity ^0.5.16; /* * @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...
Gets rate of interest for current epoch return The rate of interest for current epoch/
function getCurrentEpochROI() public view returns (uint32 roi) { roi = epochConfigs[epochConfigs.length - 1].roi; }
1,022,984
pragma solidity ^0.4.24; /******************************************************************************* * * Copyright (c) 2018 Decentralization Authority MDAO. * Released under the MIT License. * * ZeroGold POW Mining * * An ERC20 token wallet which dispenses tokens via Proof of Work mining. * Bas...
Retrieves the "TOTAL" reward amount available to this MintHelper. / NOTE `lastRewardAmount()` is called from MintHelper during the `merge` to assign the `merge_totalReward` value.
function lastRewardAmount() external view returns (uint) { return mintHelperRewards[msg.sender]; }
12,757,832
./full_match/4/0x86C4999fe7aEA87908018c348600Cc4e22ccc956/sources/contracts/AletheaERC721Spec.sol
Alethea Mintable ERC721 Defines mint capabilities for Alethea ERC721 tokens. This interface should be treated as a definition of what mintable means for ERC721 Basil Gorin/
interface MintableERC721 { function exists(uint256 _tokenId) external view returns(bool); function mint(address _to, uint256 _tokenId) external; function mintBatch(address _to, uint256 _tokenId, uint256 n) external; function safeMint(address _to, uint256 _tokenId) external; function safeMint(address _to, uint2...
12,331,068
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; import {MemberToken} from "@orcaprotocol/contracts/contracts/MemberToken.sol"; import {ControllerV1} from "@orcaprotocol/contracts/contracts/ControllerV1.sol"; import {TimelockController} from "@openzeppelin/contracts/governance/TimelockController.so...
_safe The address of the safe _newSafeTeller The address of the new safe teller contract/ add new safeTeller validate prevModule of current safe teller disable current safeTeller
function migrateSafeTeller( address _safe, address _newSafeTeller, address _prevModule ) internal { bytes memory enableData = abi.encodeWithSignature( "enableModule(address)", _newSafeTeller ); bool enableSuccess = IGnosisSafe(_safe).execT...
9,856,134
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; struct Store { // The underlying asset of the tToken ERC20 underlying; // The address of the investment strategy contract managing the underlying assets address strategy; ...
it saves the Store struct in a hashed slot/
function store() pure returns (Store storage s_) { bytes32 position = POSITION; assembly { s_.slot := position } }
1,834,835
// SPDX-License-Identifier: Unlicense pragma solidity >=0.8.0 <0.9.0; import "../Test.sol"; contract StdMathTest is Test { function testGetAbs() external { assertEq(stdMath.abs(-50), 50); assertEq(stdMath.abs(50), 50); assertEq(stdMath.abs(-1337), 1337); assertEq(stdM...
(a < 0 && b >= 0) || (a >= 0 && b < 0)
function testGetPercentDelta_Int_Fuzz(int192 a, int192 b) external { vm.assume(b != 0); uint256 absA = getAbs(a); uint256 absB = getAbs(b); uint256 absDelta = absA > absB ? absA - absB : absB - absA; uint256 manualDelta; if ((a >= 0 && b >= 0)...
12,760,487
pragma solidity ^0.5.0; import './Permissioned.sol'; // Copyright © 2018 Weald Technology Trading Limited // 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/l...
Obtain the signer address from a signature. Note that it is possible for the signer to be returned as 0x00/
function obtainSigner(bytes32 _actionHash, bytes memory _signature) private pure returns (address) { bytes32 r; bytes32 s; uint8 v; if (_signature.length != 65) { return address(0); } assembly { r := mload(add(_signature, 32)) s :...
5,529,905
./full_match/1/0x04a3E52b53f2815321E0915EB12A3B2CB08F947c/sources/browser/MyFlashloanContract.sol
Part 1 Part 2 Part 3 Part 1 Part 2 Part 3
function executeOperation( address _reserve, uint256 _amount, uint256 _fee, bytes calldata _params ) external override { require(_amount <= getBalanceInternal(address(this), _reserve), "Invalid balance, was the flashLoan successful?"); if (arb...
2,931,245
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one...
view function to get balance with borrowing interest applied
function viewWithBorrowInterest( uint256 balance, address issuer, uint256 yieldQuotientFP ) external view returns (uint256) { uint256 accumulatorFP = viewCumulativeYieldFP( borrowYieldAccumulators[issuer], block.timestamp );...
563,862
./partial_match/42/0x3c5406ddCE4836eA2E5817DCF021fE1E9B0796cC/sources/GebProxyIncentivesActions.sol
Withdraw LP tokens from liquidity mining pool and harvests rewards incentives address - Liquidity mining pool value uint - value to withdraw
function withdrawAndHarvest(address incentives, uint value) external { GebIncentivesLike incentivesContract = GebIncentivesLike(incentives); DSTokenLike rewardToken = DSTokenLike(incentivesContract.rewardsToken()); DSTokenLike lpToken = DSTokenLike(incentivesContract.stakingToken()); ...
3,422,540
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "../common/Decimal.sol"; import "../common/SafeMath.sol"; import "../common/IERC20.sol"; import "../common/SafeERC20.sol"; import "../ownership/Ownable.sol"; import "../utils/Version.sol"; import "./ManagerConstants.sol"; import "./RewardDistribution.sol";...
setValidatorMetadata stores the new metadata for the validator we don't validate the metadata here, please check the documentation to get the recommended and expected structure of the metadata validator must exist store the new metadata content
function setValidatorMetadata(bytes calldata metadata) external { uint256 validatorID = getValidatorID[_sender()]; require(0 < validatorID, "BridgeManager: unknown validator address"); validatorMetadata[validatorID] = metadata; }
13,086,639
pragma solidity >= 0.5.0; contract battleship { enum GameState { Created, SettingUp, Playing, Finished } struct Game { address payable player1; address payable player2; string player1Name; string player2Name; address currentPlayer; address payable winner; ...
function returnPl(int gameId) public view
function setName(string memory name ) public{ require(bytes(name).length <= 30); bytes32 bytesname = stringToBytes32(name); require(!playerNameExists[bytesname]); playerNames[msg.sender] = name; playerNameExists[bytesname] = true; }
6,362,515
./full_match/1/0x1094187C50d13e7259Af6FBE28bE8452dB026D7F/sources/@setprotocol/set-protocol-v2/contracts/interfaces/IIssuanceModule.sol
IIssuanceModule Set Protocol Interface for interacting with Issuance module interface./
interface IIssuanceModule { function updateIssueFee(ISetToken _setToken, uint256 _newIssueFee) external; function updateRedeemFee(ISetToken _setToken, uint256 _newRedeemFee) external; function updateFeeRecipient(ISetToken _setToken, address _newRedeemFee) external; function initialize( ISetToke...
17,051,662
// SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; import "./ProxyBaseStorage.sol"; import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol'; import './CollectionStorage.sol'; import './Ownable.sol'; /** > Collection @notice this contract is standard ERC721 to used as xanalia user's ...
To change the starting tokenId, please override this function./
function _startTokenId() internal view virtual returns (uint256) { return 1; }
5,907,179
pragma solidity ^0.4.16; pragma experimental "v0.5.0"; pragma experimental "ABIEncoderV2"; import {Bytes} from "../src/bytes/Bytes.sol"; contract BytesExamples { using Bytes for *; // Check if bytes are equal. function bytesEqualsExample() public pure { bytes memory bts0 = hex"01020304"; ...
find the lowest byte set in a uint with uint, the lowest byte is the least significant one.
function uintLowestByteSetExample() public pure { uint test0 = 0x01; uint test1 = 0xbb00aa00; assert(test0.lowestByteSet() == 0); assert(test1.lowestByteSet() == 1); }
12,878,385
./partial_match/42/0x35D6bfBD8358bb0881001A1d30CaDDB6870b2720/sources/OxygenLab.sol
Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; if (block.number <= pool.lastRewardBlock) { return; } uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (lpSupply == 0) { pool.lastRewardBlock = block.number;...
3,306,180
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/proxy/Clones.sol"; import "../collaborators/IFundsHandler.sol"; import "../collaborators/handlers/F...
Flag used to enforce the rule that only participants of the agreement can complete the agreement for each participant, check they have signed the agreement both the signature order and the called participants list must be in sync for this to work work out if the caller participant as only a participant can agree on it
function _validateAgreementSigs( address msgSender, bytes32 expectedSignedAgreement, address[] calldata participants, uint8[] calldata sigV, bytes32[] calldata sigR, bytes32[] calldata sigS ) internal pure { bool callerIsParticipant = false; uint256 totalParticip...
7,244,351
./full_match/42/0xAE91AEbAD26C099Da1FA005841401b140c15269a/sources/Users/kasidejphulsuksombati/ALPHA/alphaperp/contracts/AlphaPerp.sol
Burn position tokens and returns the value of the debt involved. ident The identifier of position tokens to burn. size The amount of position tokens to burn.
function _doBurn(uint ident, uint size) internal returns (uint) { uint strike = getStrike(ident); uint supply = supplyOf[ident]; uint value = strike.fmul(supply).sub(strike.fmul(supply.sub(size))); supplyOf[ident] = supply.sub(size); _burn(msg.sender, ident, size); return value; }
16,273,839
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; pragma abicoder v2; // import "hardhat/console.sol"; contract MockBSCLightClient { struct StorageProof { uint256 balance; bytes32 codeHash; uint256 nonce; bytes32 storageHash; bytes accountProof; bytes storage...
TODO: do the storage_proof & account_proof
function verify_storage_proof( bytes32 /*commitment*/, address /*account*/, uint256 /*position*/, StorageProof memory /*proof*/ ) internal pure returns (bool) { return false; }
13,127,686
pragma solidity 0.5.16; import {DogeDepositsManager} from "./DogeDepositsManager.sol"; import {DogeSuperblocks} from "./DogeSuperblocks.sol"; import {DogeBattleManager} from "./DogeBattleManager.sol"; import {DogeMessageLibrary} from "./DogeParser/DogeMessageLibrary.sol"; import {DogeErrorCodes} from "./DogeErrorCodes...
– runs a battle session to verify a superblock for the next challenger superblockHash – claim id. superblocks marked as invalid do not have to run remaining challengers
function runNextBattleSession(bytes32 superblockHash) internal returns (bool) { SuperblockClaim storage claim = claims[superblockHash]; if (!claimExists(claim)) { emit ErrorClaim(superblockHash, ERR_SUPERBLOCK_BAD_CLAIM); return false; } if (claim.decided ||...
12,799,433
./full_match/1/0xF91E77db3757572758c6b4e587a3B8A390772180/sources/MRGUMBALL.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("MR GUMBALL", "MRGB") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_u...
9,743,872
pragma solidity ^0.5.16; /** * @title Initializable * * @dev Helper contract to support initializer functions. To use it, replace * the constructor with a function that has the `initializer` modifier. * WARNING: Unlike constructors, initializer functions must be manually * invoked. This applies both to deploying...
price - Token/USDT (1e6), amount – token numbers (1e18) check timestamp check signature swap USDT to tokens
function buy(uint price, uint amount, uint deadline, uint8 v, bytes32 r, bytes32 s) public { require(block.timestamp < deadline); bytes32 hash = sha256(abi.encodePacked(address(this), msg.sender, price, amount, deadline)); address src = ecrecover(keccak256(abi.encodePacked("\x19Ethereum Sig...
2,039,176
./full_match/42220/0x6ea01ea80FeB4313C3329e6e9fcA751CCb2cF323/sources/out/ManagedPoolFactory_flat.sol
Returns the minimum BPT supply. This amount is minted to the zero address during initialization, effectively locking it. This is useful to make sure Pool initialization happens only once, but derived Pools can change this value (even to zero) by overriding this function./
function _getMinimumBpt() internal pure virtual returns (uint256) { return _DEFAULT_MINIMUM_BPT; }
16,352,974
./partial_match/3/0xbaD7107F9664c9425c2F8C476FCc8c6b088981E5/sources/LuckySpin.sol
30% 20 % 20 % 15 % 10 % 5 %
function spin() public payable { uint rand; rand = random() % 100; if(rand < 30){ winAmount[msg.sender] += 0 ether; lastSpinResult[msg.sender] = "LOST TURN"; } else if(rand < 50){ winAmount[msg.sender] += 0.01 ether; lastSpinRes...
5,251,198
pragma solidity ^0.4.15; /** * @title Input validation * * - Validates argument length * * #created 01/10/2017 * #author Frank Bonnet */ contract InputValidator { /** * ERC20 Short Address Attack fix */ modifier safe_arguments(uint _numArgs) { assert(msg.data.length ==...
Returns the amount of owners return The amount of owners/
function getOwnerCount() public constant returns (uint) { return ownersIndex.length; }
12,547,070
./partial_match/100/0x292BF16Bd198b5181baDa80980D56F164fdead14/sources/TxPermission.sol
Returns the current block gas limit which depends on the stage of the current staking epoch: the block gas limit is temporarily reduced for the latest block of the epoch.
function blockGasLimit() public view returns(uint256) { address stakingContract = validatorSetContract.stakingContract(); uint256 stakingEpochEndBlock = IStakingAuRa(stakingContract).stakingEpochEndBlock(); if (block.number == stakingEpochEndBlock - 1 || block.number == stakingEpochEndBlock)...
16,647,393
./full_match/1/0x2dD4242C894d20060b162747362aF1721Fa7f5d5/sources/contracts/MAGIStaker.sol
get the amount of claimable reward of an account
function getReward(address _account) public view returns (uint) { uint userRewardDepositValue = tokenDeposit[_account].rewardDepositValue; uint rewardDepositedOffset = rewardDepositValue - userRewardDepositValue; uint profit = (rewardDepositedOffset * balanceOf(_account)) / DEC...
3,189,530
/* Bow Tied Bull - BBULL Bull run is being missed with the current market wide correction. Are you ready to start the Santa rally? Bowtied Bull will be your Santa this year. Crypto Nerds get ready. Bow tied bull is safe. Liquidity will be locked and ownership renounced. Contract auditing will be . ...
Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner./
function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); }
13,470,843
/** *Submitted for verification at Etherscan.io on 2021-09-05 */ // SPDX-License-Identifier: NONE pragma solidity 0.8.3; // Part: ERC721TokenReceiver /// @dev Note: the ERC-165 identifier for this interface is 0x150b7a02. interface ERC721TokenReceiver { /// @notice Handle the receipt of an NFT /// @dev T...
Count all NFTs assigned to an owner Find the owner of an NFT Transfers the ownership of an NFT from one address to another address Throws unless `msg.sender` is the current owner, an authorized operator, or the approved address for this NFT. Throws if `_from` is not the current owner. Throws if `_to` is the zero a...
function balanceOf(address _owner) public view virtual returns (uint256); function ownerOf(uint256 tokenId) public view virtual returns (address); function tokenOfOwnerByIndex(address _owner, uint256 _index) public view virtual returns (uint256); function _transfer( ...
6,820,143
pragma solidity 0.4.24; /** * @title SafeMath * @dev Math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two numbers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than re...
Division of two int256 variables and fails on overflow./ Prevent overflow when dividing MIN_INT256 by -1 Solidity already throws when dividing by 0.
function div(int256 a, int256 b) internal pure returns (int256) { require(b != -1 || a != MIN_INT256); return a / b; }
131,740
./full_match/4/0x13C8D94f8010bcA90e6Ee8b1457aecE438D0f1c8/sources/shi_token_ICO.sol
Getting equity in mooncoins
function equity_in_shi (address investor) external view returns(uint) { return equity_shi[investor]; }
13,317,077