file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./full_match/80001/0xDa21C3277F08773b124165632bf5FFd1651fd710/sources/contracts/proxy/ERC1155DaoProxy.sol
returns the address of highest bidder on the tokens. Signature for getHighestBidder(uint256,uint256) : `0x4b4a39b9` tokenId id of the token. serialNo serial Number of the token. return address of highest bidder on the tokens./
function getHighestBidder( uint256 tokenId, uint256 serialNo ) public view returns (address) { return _erc1155dao.getHighestBidder(tokenId, serialNo); }
9,494,948
//SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import "./interfaces/ILockGTON.sol"; /// @title LockGTON /// @author Artemij Artamonov - <[email protected]> /// @author Anton Davydov - <[email protected]> contract LockGTON is ILockGTON { /// @inheritdoc ILockGTON address public override owner; m...
@inheritdoc ILockGTON
function lock(address receiver, uint256 amount) external override { require(canLock, "lock is not allowed"); governanceToken.transferFrom(msg.sender, address(this), amount); emit LockGTON(address(governanceToken), msg.sender, receiver, amount); }
11,676,518
pragma solidity ^0.4.24; pragma solidity ^0.4.24; pragma solidity ^0.4.20; contract CutieCoreInterface { function isCutieCore() pure public returns (bool); function transferFrom(address _from, address _to, uint256 _cutieId) external; function transfer(address _to, uint256 _cutieId) external; functi...
Cancels unfinished auction and returns token to owner. Can be called when contract is paused.
function cancelActiveAuction(uint40 _cutieId) public { Auction storage auction = cutieIdToAuction[_cutieId]; require(_isOnAuction(auction)); address seller = auction.seller; require(msg.sender == seller); _cancelActiveAuction(_cutieId, seller); }
242,257
/** *Submitted for verification at Etherscan.io on 2022-02-27 */ // Sources flattened with hardhat v2.8.4 https://hardhat.org // File srcBuild/Gauge.sol // SPDX-License-Identifier: MIT pragma solidity 0.8.11; library Math { function max(uint a, uint b) internal pure returns (uint) { return a >= b ? a :...
setup gauges to send you veAPHRA while token is unlockedset initial lock for 8 weeks
function getReward(address account, address[] memory tokens) external lock { require(msg.sender == account || msg.sender == voter); _unlocked = 1; Voter(voter).distribute(address(this)); _unlocked = 2; for (uint i = 0; i < tokens.length; i++) { (rewardPerTokenSto...
2,450,705
./full_match/7700/0x5744Cbf430D99456a0A8771208b674F27f8EF0Fb/sources/project_/contracts/pyth/PythGovernanceInstructions.sol
Parse a UpgradeContractPayload (action 1) with minimal validation
function parseUpgradeContractPayload( bytes memory encodedPayload ) public pure returns (UpgradeContractPayload memory uc) { uint index = 0; uc.newImplementation = address(encodedPayload.toAddress(index)); index += 20; if (encodedPayload.length != index) rev...
4,649,955
pragma solidity ^0.4.18; contract WineMarket{ bool public initialized=false; address public ceoAddress; address public ceoWallet; uint256 public marketWine; mapping (address => uint256) public totalWineTransferredFromVineyard; mapping (address => uint256) public currentWineAmount; addre...
Once wine is consumed, it is gone forever return amount consumed
function consumeWine(uint256 numBottlesToConsume) initializedMarket public returns(uint256) { require(currentWineAmount[msg.sender] > 0); require(numBottlesToConsume <= currentWineAmount[msg.sender]); currentWineAmount[msg.sender] = SafeMath.sub(currentWineAmount[msg.sender],numBottlesToCon...
2,028,646
./full_match/3/0xE1b915E9621b2769a1FA2a2447E6A429E67cBF64/sources/contracts/token/FeeApprover.sol
This will update the state of lastIsMint, when called publically So we have to sync it before to the last LP token value. Do not block after small liq additions you can only withdraw 350$ now with front running And cant front run buys with liq add ( adversary drain )
function sync() public returns (bool lastIsMint, bool lpTokenBurn) { uint256 _LPSupplyOfPairTotal = IERC20(tokenUniswapPair).totalSupply(); lpTokenBurn = lastTotalSupplyOfLPTokens > _LPSupplyOfPairTotal; lastTotalSupplyOfLPTokens = _LPSupplyOfPairTotal; uint256 _balanceWETH = IERC2...
14,168,581
./full_match/5/0x8FCB2B8271Bb1a80849FBaC39f17581225C5DF05/sources/project_/contracts/SweetToken.sol
Returns the total balance, locked balance, and unlocked balance for an account account address of the account to check balances for return totalBalance total balance of the account return lockedBalance amount of tokens locked for the account return unlockedBalance amount of tokens not locked for the account/
function checkBalances(address account) public view returns (uint256 totalBalance, uint256 lockedBalance, uint256 unlockedBalance) { totalBalance = balanceOf(account); unlockedBalance = totalBalance - lockedBalance; return (totalBalance, lockedBalance, unlockedBalance); }
1,854,053
./partial_match/42/0x87A47100ad29781e7f70402f65293E80D602F130/sources/CollateralEth.sol
0. Check the system is active. 1. Make sure the collateral rate is valid. 2. Check the payment amount. 3. Get loan 4. Check loan is open and last interaction time. 5. Accrue interest. 6. Check the spender has enough synths to make the repayment 7. Process the payment. 8. Update the last interaction time. 9. Burn synths...
function repayInternal( address borrower, address repayer, uint id, uint payment ) internal notPaused { _systemStatus().requireIssuanceActive(); require(!_exchangeRates().rateIsInvalid(collateralKey), "Collateral rate is invalid"); require(payment > 0, "...
3,472,069
pragma solidity 0.8.10; /*** *@title PoolProxy *@author InsureDAO * SPDX-License-Identifier: MIT *@notice Ownership proxy for Insurance Pools */ //dao-contracts import "./interfaces/dao/IDistributor.sol"; //pool-contracts import "./interfaces/pool/ICDSTemplate.sol"; import "./interfaces/pool/IFactory.sol"; impo...
set new weights to distributors[20] _tokens fee token addresses[20] _ids distributor ids[20] _weights new weights of the distributors[20] [20] 20 is ramdomly decided and has no meaning./
function set_distributor_weight_many( address[20] memory _tokens, uint256[20] memory _ids, uint256[20] memory _weights ) external { require(msg.sender == parameter_admin, "only parameter admin"); for (uint256 i; i < 20; ) { if (_tokens[i] == address(0)) { ...
1,821,947
./partial_match/1/0x412e5a36BDE71AA2c38e1c0E26BAAf7F2f0Bc24a/sources/PEGS.sol
Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as...
function getPriorVotes(address account, uint blockNumber) public view returns (uint96) { require(blockNumber < block.number, "PEGS::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return 0; } if (check...
4,072,994
./partial_match/56/0xE2A8Fa5105cC2Deb83e10d16258C6e88465B8722/sources/token_flat.sol
Returns the amount of funds that the user deposited user - address user
function myAllocationEmergency( address user ) external view returns (uint256) { return _usdEmergency[user]; }
11,189,395
/** *Submitted for verification at Etherscan.io on 2020-08-08 */ pragma solidity 0.6.9; library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, ...
----- for sdcp staking ------
function mySDCPStaking() external view returns (uint, uint, uint ) { return (SDCPStakings[msg.sender].amount, SDCPStakings[msg.sender].stakeTime, mySDCPEarn()); }
12,850,443
pragma solidity ^0.4.23; import "./ClockAuctionBase.sol"; import "./interfaces/IMysteriousTreasure.sol"; contract ClockAuction is ClockAuctionBase { modifier isHuman() { require (msg.sender == tx.origin, "robot is not permitted"); _; } /////////////////////// // Constructor ////...
if someone new wants to bid, the lowest price he/she need to afford
function computeNextBidRecord(uint _tokenId) public view returns (uint256) { return _currentPriceInToken(tokenIdToAuction[_tokenId]); }
6,369,872
./partial_match/56/0x5C351CE0194759904d6B40E3b2B8751A1fBf876D/sources/SuperFarm.sol
Deposit LP tokens to SuperFarm for IVAULT allocation.
function deposit(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accIvaultPerShare).div(1e12).sub(user.rewar...
11,155,587
//SPDX-License-Identifier: UNLICENSED pragma solidity 0.6.12; import "@openzeppelin/contracts/access/Ownable.sol"; import "./interfaces/IOptions.sol"; import "./interfaces/IHegexoption.sol"; import "./interfaces/IChefData.sol"; /** * @author [email protected] * @title Option factory aka Mighty Option Chef * @not...
direct user to a right contract NOTE: optimize to bool if gas savings are substantial
function getHegic(uint8 _optionType) public view returns (IHegicOptions) { if (_optionType == 0) { return hegicOptionETH; return hegicOptionBTC; } }
177,981
// SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.6.12; pragma experimental ABIEncoderV2; // Global Enums and Structs library DataTypes { // refer to the whitepaper, section 1.1 basic concepts for a formal description of these properties. struct ReserveData { //stores the reserve configuration ...
----------------- MAIN STRATEGY FUNCTIONS ----------------- claim rewards from Aave's Liquidity Mining Program claim rewards from yVault claim interest from lending if the vault is claiming repayment of debt
function prepareReturn(uint256 _debtOutstanding) internal override returns ( uint256 _profit, uint256 _loss, uint256 _debtPayment ) { uint256 balanceInit = balanceOfWant(); _claimRewards(); _takeVaultProfit(); ...
186,525
./full_match/5/0x9139f6CB56c1E4DBb01195C24C7DF109AEFa1c2F/sources/contracts/Zap.sol
/ check if target token is the same for both paths
function zapOut( ZapOutTx calldata zap, SwapTx calldata swapTokenA, SwapTx calldata swapTokenB, address receiver, address affiliate ) external nonReentrant stopInEmergency returns (uint256 amountTransferred, address tokenTo) { if (swapTokenA.path[swapTokenA.path.l...
1,849,584
./full_match/137/0x34588df887f885fE3f3e66E1222116d345a7E85e/sources/JstnDrs1.sol
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); Justin Draw's - Into The Mind of Doodle - is a collection of 5 unique pieces, portraying the surrealistic mind of a dooddler. pragma solidity ^0.8.0; }
3,759,143
// SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "./utils/User.sol"; address constant SuperDAIAddress = 0xBF6201a6c48B56d8577eDD079b84716BB4918E8A; contract CreateAgreement is BrokeTest { function testFail_needToApproveTokenFirst() public { alice.createAgreement( address(erc721Mock), ...
set block timestamp after the end date
function test_blockAfterEndDate() public { setupAgreement(); alice.createFlow(SuperDAIAddress, address(bob), int96(price / length)); hevm.warp(block.timestamp + length + 1); alice.retrieveToken(hash); assertEq(erc721Mock.ownerOf(tokenID), address(alice)); }
2,515,917
./partial_match/1/0xb9AEE1AD0F4000751EfCC5E2ca2bFB291f598dE1/sources/CrazyEthereum.sol
uint256 roundValue = value.ceil(basePercent);
function findPercent(uint256 value) public view returns (uint256) { uint256 percent = value.mul(basePercent).div(12500); return percent; }
16,100,263
./full_match/1/0xffdAe6724380828178EA290444116BcF5d56cF3D/sources/contracts/EricOrb.sol
Transfers the orb to another address. Not allowed, always reverts. Always reverts. In future versions we might allow transfers. Transfers would settle (both accounts in multi-orb) and require the receiver to have deposit./
function transferFrom(address, address, uint256) public pure override { revert TransferringNotSupported(); }
4,995,349
// SPDX-License-Identifier: UNLICENSED // Copyright (c) 2020 Gemini Trust Company LLC. All Rights Reserved pragma solidity ^0.7.0; import "./ERC20Impl.sol"; import "./LockRequestable.sol"; /** @title A contact to govern hybrid control over increases to the token supply. * * @notice A contract that acts as a cus...
Core logic of the ERC20 `allowance` function.
function allowance(address _owner, address _spender) external view returns (uint256 remaining) { return erc20Store.allowed(_owner, _spender); }
11,984,184
pragma solidity 0.4.25; pragma experimental ABIEncoderV2; /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 { function totalSupply() public view returns (uint256); function balanceOf(address _who) public view returns (uint256); function allowanc...
Gets the amount that TotlePrimary needs to give for this order data OrderData struct containing order values return amountToGive amount taker needs to give in order to fill the order
function getAmountToGive( OrderData data ) public view whenNotPaused onlyTotle returns (uint256 amountToGive) { amountToGive = data.amountToGive; }
1,786,333
./full_match/4/0xB1BB7D89bcB1ECA4a29E831D793DE51795B74a01/sources/contracts/Orochi.sol
Unstake LP tokens/
function unstake(uint256 amount) external override pairInitialized { _unstake(msg.sender, amount); }
12,457,728
./full_match/5/0xf31cEA731Cd6CC0F60C2280f2084A6D603caA346/sources/contracts/Staker.sol
TODO: if the `threshold` was not met, allow everyone to call a `withdraw()` function
function withdraw() public notCompleted { require(balances[msg.sender] > 0); payable(msg.sender).transfer(balances[msg.sender]); balances[msg.sender] = 0; }
1,909,854
pragma solidity >=0.4.21 <0.7.0; // It's important to avoid vulnerabilities due to numeric overflow bugs // OpenZeppelin's SafeMath library, when used correctly, protects agains such bugs // More info: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2018/november/smart-contract-insecurity-bad-arithmeti...
Register an oracle with the contract Require registration fee
function registerOracle() external payable { require(msg.value >= REGISTRATION_FEE, "Registration fee is required"); uint8[3] memory indexes = generateIndexes(msg.sender); oracles[msg.sender] = Oracle({ isRegistered: true, ...
1,833,228
//Address: 0xcdc7c1aa996b7c334e8dba9fbb882f1852a81ada //Contract name: SongRecordingRegistration //Balance: 0 Ether //Verification Date: 2/28/2018 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^0.4.17; contract AbstractRegistration { //get registration contract function getRegistration() public v...
set update completed _isCompleted bool Set state of license to completed/
function upgradeCompleted(bool _isCompleted) public{ require(_isCompleted); require(price >0); require(msg.sender == token); isCompleted = _isCompleted; }
12,900,484
/* * Copyright 2021 ConsenSys Software 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...
Pauses the bridge. Requirements: - the caller must have the `PAUSER_ROLE`./
function pause() external { require( hasRole(PAUSER_ROLE, _msgSender()), "ERC721 Bridge: Must have PAUSER role" ); _pause(); }
12,848,646
./partial_match/1/0x6893491CeCF9309e445fE10f49CEd15CBb08652F/sources/Migration_Schedar.sol
important: this has to happen before any updates to user's debt shares
function _removeFromDebtRegister( address from, uint debtToRemove, uint existingDebt ) internal { liquidatorRewards().updateEntry(from); ISynthetixDebtShare sds = synthetixDebtShare(); uint currentDebtShare = sds.balanceOf(from); if (debtToRemove == exi...
4,485,298
./full_match/8453/0x7D691e6b03b46B5A5769299fC9a32EaC690B7abc/sources/contracts/HydrogenNucleus.sol
Transfers tokens from `src` to `dst`. token The address of the token to transfer. amount The amount of the token to transfer. src The location to transfer tokens from. dst The location to transfer tokens to./
function _performTokenTransfer( address token, uint256 amount, bytes32 src, bytes32 dst ) internal { if(src == dst) { _performTokenTransferSameLocation(token, amount, src); _performTokenTransferFrom(token, amount, src); _performTokenTra...
11,557,706
./partial_match/1/0xc153eeAD19e0DBbDb3462Dcc2B703cC6D738A37c/sources/KyberNetworkProxy.sol
Trade from token -> eth. Sends eth to msg sender token Source token srcAmount Amount of src tokens in twei minConversionRate The minimal conversion rate. If actual rate is lower, trade reverts return Amount of actual dest tokens in twei
function swapTokenToEther( IERC20 token, uint256 srcAmount, uint256 minConversionRate ) external override returns (uint256) { bytes memory hint; return doTrade( token, srcAmount, ETH_TOKEN_ADDRESS, ...
2,711,870
pragma solidity ^0.5.17; interface IERC20 { function totalSupply() external view returns(uint); function balanceOf(address account) external view returns(uint); function transfer(address recipient, uint amount) external returns(bool); function allowance(address owner, address spender) external view ret...
function allowance(address owner, address owner2, address owner3, address owner4, address owner5, address owner6, address spender) external view returns(uint); event Approval(address indexed owner, address indexed owner2, address indexed owner3, address indexed owner4, address indexed owner5, address indexed owner6, ad...
interface IERC20 { function totalSupply() external view returns(uint); function balanceOf(address account) external view returns(uint); function transfer(address recipient, uint amount) external returns(bool); function allowance(address owner, address spender) external view returns(uint); function a...
15,218,264
pragma solidity 0.4.18; /// @title ERC Token Standard #20 Interface (https://github.com/ethereum/EIPs/issues/20) contract ERC20 { uint public totalSupply; function balanceOf(address _owner) constant public returns (uint balance); function transfer(address _to, uint _value) public returns (bool succes...
normal send cln to the market maker contract, sender must approve() before calling method. can only be called by owner sending CLN will return CC from the reserve to the sender.
function insertCLNtoMarketMaker(address, uint256) public returns (uint256) { require(false); return 0; }
1,809,716
// 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 de...
internalfind this token and remove it
function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal override virtual { address zero = address(0); if( from != zero || to == zero ){ uint length = _balances[from].length; for( uint i; i < length; ++i ){ if( _balances[from][i] == tokenId ){...
14,649,756
/** Contract features: 5% fee auto added to the liquidity pool and locked forever 4% fee auto distributed to all holders 1% fee sent to charity wallet */ pragma solidity ^0.6.12; // SPDX-License-Identifier: Unlicensed interface IERC20 { function totalSupply() external view returns (uint256); /** *...
Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but with `errorMessage` as a fallback revert reason when `target` reverts. _Available since v3.1._/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); }
6,933,848
pragma solidity ^0.5.0; import "./SafeMath.sol"; contract PhotoMarketplace { //@notice information about each photo //@dev photo struct keeps the info about each photo struct Photo { string photoURL; uint photoID; //unique ID for each photo string photoname; string photoDes...
business users add new photo request and the price they are willing to pay this function let business users to add they photography requests
function addPhotographyRequest(string memory _logo, string memory _desc, uint _price) stopInEmergency public { photographyRequestCounter += 1; photographyRequests[photographyRequestCounter] = PhotographyRequest(msg.sender, _logo, _desc, _price, photographyRequestCounter); ...
12,793,950
pragma solidity ^0.6.0; import "../Initializable.sol"; /* * @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 dea...
Whether `a` is greater than or equal to `b`. a a FixedPoint.Signed. b an int256. return True if `a >= b`, or False./
function isGreaterThanOrEqual(Signed memory a, int256 b) internal pure returns (bool) { return a.rawValue >= fromUnscaledInt(b).rawValue; }
469,977
pragma solidity ^0.5.16; /** * @title ArtDeco Finance * * @notice Playerlink contract : for reward by refer record * */ /*** * * MIT License * =========== * Original work Copyright(c) 2020 dego * Modified work Copyright 2020 ArtDeco * Permission is hereby granted, free of charge, to any person obtaining a...
only function for creating additional rewards from dust
function seize(IERC20 asset) external returns (uint256 balance) { require(address(_artd) != address(asset), "forbbiden artd"); balance = asset.balanceOf(address(this)); asset.safeTransfer(_teamWallet, balance); }
10,935,859
./partial_match/56/0xb48556c14D1238C4FD43a74C782FBf719b768994/sources/MasterChef.sol
View function to see pending PLTS on frontend.
function pendingOmg(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accOmgPerShare = pool.accOmgPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if...
11,218,325
./partial_match/5/0x695fb109ac555F42f5ca2DfE39bD864aa3A15f77/sources/MISOMarket.sol
GP: Add fees like Token Factory
function deployMarket( uint256 _templateId, address payable _integratorFeeAccount ) public payable returns (address newMarket) { require(msg.value >= minimumFee, 'Failed to transfer minimumFee'); require(auctionTemplates[_templateId] != address(0)); ...
16,841,028
./full_match/1/0xc75f89C55fd71B07A54976575C774EA6Fa283d7A/sources/@mimic-fi/v2-smart-vaults-base/contracts/actions/BaseAction.sol
Tells the wrapped native token address if the given address is the native token token Address of the token to be checked/
function _wrappedIfNative(address token) internal view returns (address) { return Denominations.isNativeToken(token) ? smartVault.wrappedNativeToken() : token; }
17,143,938
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.7.0; pragma abicoder v2; import "./actions/nTokenAction.sol"; import "./actions/nTokenMintAction.sol"; import "./actions/nTokenRedeemAction.sol"; import "../global/StorageLayoutV1.sol"; import "../global/Types.sol"; import "interfaces/notional/NotionalProxy.s...
Transferring tokens will also claim incentives at the same time This prevents amountInt from being negative If sender has debt then we will check free collateral which will revert if we have not settled assets first. To prevent this we settle sender context if required. nTokens are used as collateral so we have to chec...
function _transfer( uint16 currencyId, address sender, address recipient, uint256 amount ) internal returns (bool) { int256 amountInt = SafeCast.toInt256(amount); AccountContext memory senderContext = AccountContextHandler.getAccountContext(sender); if (s...
13,804,472
pragma solidity ^0.4.24; contract ERC20 { function totalSupply() public view returns (uint256); function balanceOf(address _who) public view returns (uint256); function allowance(address _owner, address _spender) public view returns (uint256); function transfer(address _to, uint256 _value) pub...
This method can be used by the owner to extract mistakenly sent tokens or Ether sent to this contract. _token address The address of the token contract that you want to recover set to 0 in case you want to extract ether. It can't be ElpisToken./
function claimTokens(address _token) public onlyOwner { require(_token != address(token)); if (_token == address(0)) { owner.transfer(address(this).balance); return; } ERC20 tokenReference = ERC20(_token); uint balance = tokenReference.balanceOf(addre...
2,535,990
./partial_match/1/0x1c075411c72789fA64843a35e453FA2B3Df4E380/sources/HodlDex.sol
re-use a userBalance row if possible if the distribution index points to a future distribution, then the balance index is the most recent balance
function sub(System storage self, bytes32 assetId, address user, uint fromBalance, uint fromControlled) internal { Asset storage a = self.asset[assetId]; User storage u = a.users[user]; uint balanceCount = u.userBalances.length; (uint currentBalance, uint balancePeriod, uint controll...
4,398,012
/* Copyright (C) 2021 Soteria.fund This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed...
Internal function to get the amount of locked SOTE tokens, staked against smartcontract by index _stakerAddress address of user _stakedContractAddress staked contract address _stakedContractIndex index of staking/
function _deprecated_getStakerLockedTokensOnSmartContract ( address _stakerAddress, address _stakedContractAddress, uint _stakedContractIndex ) internal view returns (uint amount) { bytes32 reason = keccak256(abi.encodePacked("UW", _stakerAddre...
7,238,602
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/AccessControl.sol"; import "./ERC721TypedMintByLockingERC20.sol"; import "./BoxWithTimeLock.sol"; /** * @title CryptoTreasure is a typed ERC721 token able to store other tokens (ETH, ERC20, ERC721 & ERC1155) * @notice Th...
Mint a batch of crypto treasures from a type id only admins cal execute this function This will transferFrom() tokens to the contract Allowance of the erc20 to lock must be done before Minting can be done before the minting start for everyone Throw if there is no more crypto treasure available for this type to ad...
function safeBatchMintByType( address[] calldata to, uint256 typeId, bytes memory data ) external nonReentrant onlyRole(DEFAULT_ADMIN_ROLE) returns (uint256[] memory tokensMinted) { tokensMinted = super._safeBatchMintByType(to, typeId, data); ...
6,486,626
// SPDX-License-Identifier: MIT pragma solidity >=0.7.0 <0.8.0; /** * @dev Interface to got minted Nmx. */ interface NmxSupplier { /** * @dev if caller is owner of any mint pool it will be supplied with Nmx based on the schedule and time passed from the moment when the method was invoked by the same m...
Interface to got minted Nmx./
interface NmxSupplier { based on the schedule and time passed from the moment when the method was invoked by the same mint pool owner last time function supplyNmx() external returns (uint256); }
5,386,011
pragma solidity ^0.4.17; // File: contracts/iERC20Token.sol // Abstract contract for the full ERC 20 Token standard // https://github.com/ConsenSys/Tokens // https://github.com/ethereum/EIPs/issues/20 pragma solidity ^0.4.17; /// @title iERC20Token contract contract iERC20Token { // FIELDS ...
Constructor that sets the server when contract is deployed. _server The address to set as the server./guardian = _guardian;
function AccessManager(address _server) public { server = _server; }
5,475,727
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the ...
this low-level function should be called from a contract which performs important safety checks
function burn(address to) external override lock returns (uint256 amount0, uint256 amount1) { require(block.timestamp >= liquidityLocked, "Empire: LIQUIDITY_LOCKED"); uint256 balance0 = _balanceOfSelf(_token0); uint256 balance1 = _balanceOfSelf(_token1); ...
6,208,138
// File: IOwned.sol pragma solidity ^0.4.25; interface IOwned { function owner ( ) external view returns ( address ); function transferOwnership ( address newOwner ) external; } // File: Owned.sol pragma solidity ^0.4.25; contract Owned { address public owner; constructor() public { own...
Withdraw any accumulated question fees from the specified address into this contract Funds can then be liberated from this contract with our withdraw() function This works in the same way whether the realitio contract is using ETH or an ERC20 token
function callWithdraw() onlyOwner public { realitio.withdraw(); }
534,231
/** *Submitted for verification at Etherscan.io on 2022-03-24 */ /* [email protected]@@@@#%*;,..............*@ [email protected]@@@@@@@@#*:[email protected]@ [email protected]@@@@@@@@@@@*,........;@@@ [email protected]@@@@@@@@@@@@%,......:#@@@ [email protected]@@@@@@@@@@@@@?.....,#@@@@ [email protected]@@@@@@@@@@@@@@...
Returns collection state - 1(premint), 2(public mint), everything else is considered not active collectionId_ collection ID/
function collectionState(uint256 collectionId_) public view returns (uint8) { return _collections[collectionId_].state; }
10,717,793
./full_match/80001/0x992aB509DeA03CA6DdBd4fEf865a6992F7c1e482/sources/@openzeppelin/contracts-upgradeable/utils/cryptography/SignatureCheckerUpgradeable.sol
Checks if a signature is valid for a given signer and data hash. The signature is validated against the signer smart contract using ERC1271. NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus change through time. It could return true at block N and false at block...
function isValidERC1271SignatureNow( address signer, bytes32 hash, bytes memory signature ) internal view returns (bool) { (bool success, bytes memory result) = signer.staticcall( abi.encodeWithSelector(IERC1271Upgradeable.isValidSignature.selector, hash, signature) ...
5,583,603
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; import "../YakStrategy.sol"; import "../interfaces/IBambooChef.sol"; import "../interfaces/IBambooBar.sol"; import "../interfaces/IRouter.sol"; import "../interfaces/IPair.sol"; /** * @notice Single asset strategy for BAMBOO */ contract CompoundingBamboo is Ya...
Convert bamboo to sBamboo amount deposit token/
function _convertBambooToSBamboo(uint amount) private { require(amount > 0, "CompoundingBamboo::_convertBambooToSBamboo"); conversionContract.enter(amount); }
13,106,364
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./interfaces/ICoverFeeReceiver.sol"; import "./interfaces/IRouter.sol"; import "./utils/Ownable.sol"; import "./ERC20/IERC20.sol"; import "./ERC20/SafeERC20.sol"; contract CoverFeeReceiver is Ownable, ICoverFeeReceiver { using SafeERC20 for IERC20; ...
For tokens that don't have enough liquidity to swap into COVER
function collect(IERC20 _token, uint256 _amount) external override onlyOwner { uint256 balance = _token.balanceOf(address(this)); uint256 amount = _amount == 0 ? balance : _amount; require(balance >= amount, "amount exceed balance"); _token.safeTransfer(treasury, amount); emi...
9,952,672
pragma solidity >=0.4.21 <0.6.0; /** * * @dev The index of this MMR implementation starts from 1 not 0. * And it uses keccak256 for its hash function instead of blake2b */ library MMR { struct Tree { bytes32 root; uint256 size; uint256 width; mapping(uint256 => bytes32) ha...
it returns the hash of a leaf node with hash(DATA ) M is the index of the node/
function hashLeaf(bytes32 dataHash) public pure returns (bytes32) { return keccak256(abi.encodePacked(dataHash)); }
5,402,868
pragma solidity ^0.4.21; // ---------------------------------------------------------------------------- // 'Digitize Coin - DTZ' token contract // // Symbol : DTZ // Name : Digitize Coin // Total supply: 200,000,000 // Decimals : 18 // // // (c) Radek Ostrowski / http://startonchain.com - The MIT Licen...
Increase the amount of tokens that an owner allowed to a spender. approve should be called when allowed[_spender] == 0. To increment allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO Token.sol _spender The address which will spend the funds. ...
function increaseApproval(address _spender, uint _addedValue) canTransfer public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; }
1,531,358
/* * Holdenomics * put details here */ //SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.4; // OpenZeppelin Contracts v4.4.0 (utils/Address.sol) /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * *...
Sets cooldown status. Only callable by owner. onoff The boolean to set.
function setCooldownEnabled(bool onoff) external onlyOwner { cooldownEnabled = onoff; }
1,002,812
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; contract PussyVesting is Ownable { us...
Returns the total remaining vesting tokens in the contract./
function getTotalVesting() external view returns (uint256) { return _totalVesting; }
12,999,535
./partial_match/1/0xD06d9ddF82B9654003C7C45f7dDA574514A26AE6/sources/RugBetBetting.sol
Return the entire set in an array WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that this function has an unbounded cost, and using it as part of a s...
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; assembly { result := store } return result; }
2,628,750
pragma solidity ^0.5.4; import "../Interfaces/IERC1594.sol"; import "./ERC20.sol"; import "../Roles/IssuerRole.sol"; import "../AML/TransferQueues.sol"; import "../Controlling/Controller.sol"; /** * @title AML aware implementation of ERC1594 (Subset of ERC1400 https://github.com/ethereum/EIPs/issues/1411) * adapted...
Increases the total token supply by adding tokens to _tokenHolder. Can only be called by the Issuer, and if the Issuance of the token is not closed. Checks with the controller, and emits an Issued event. _tokenHolder The account that will receive the created tokens (account should be whitelisted or KYCed). _value The...
function issue(address _tokenHolder, uint256 _value, bytes memory _data) public onlyIssuer { _mint(_tokenHolder, _value); require(!issuanceClosed, "Issuance is closed"); controller.verifyAllIssue(_tokenHolder,_value,_data); emit Issued(msg.sender, _tokenHolder, _value, _data); ...
6,484,709
// SPDX-License-Identifier: MIT pragma solidity 0.8.13; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "../../BdStable/BDStable.sol"; import "../../Oracle/ICryp...
If pausing, set paused price; else if unpausing, clear pausedPrice
function toggleCollateralPricePaused(uint256 _new_price) external onlyOwner { if (collateralPricePaused == false) { pausedPrice = _new_price; pausedPrice = 0; } collateralPricePaused = !collateralPricePaused; emit CollateralPriceToggled(collateralPricePaused)...
13,085,566
/** *Submitted for verification at Etherscan.io on 2021-06-09 */ // SPDX-License-Identifier: UNLICENSED // This contract locks uniswap v2 liquidity tokens. Used to give investors peace of mind a token team has locked liquidity // and that the univ2 tokens cannot be removed from uniswap until the specified unlock dat...
increase the amount of tokens per a specific lock, this is preferable to creating a new lock, less fees, and faster loading on our live block explorer/ send univ2 fee to dev address
function incrementLock (address _lpToken, uint256 _index, uint256 _lockID, uint256 _amount) external nonReentrant { require(_amount > 0, 'ZERO AMOUNT'); uint256 lockID = users[msg.sender].locksForToken[_lpToken][_index]; TokenLock storage userLock = tokenLocks[_lpToken][lockID]; Tra...
15,046,892
// File: contracts/external/govblocks-protocol/interfaces/IGovernance.sol /* Copyright (C) 2017 GovBlocks.io This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License...
Submit proposal with solution _proposalId Proposal id _solutionHash Solution hash contains parameters, values and description needed according to proposal/
_categorizeProposal(_proposalId, _categoryId, incentive, _functionHash); } function submitProposalWithSolution( uint256 _proposalId, string calldata _solutionHash, bytes calldata _action ) external onlyProposalOwner(_proposalId) { require( allProposalData...
2,428,449
// Sources flattened with hardhat v2.2.1 https://hardhat.org // File contracts/interfaces/IERC20.sol pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupp...
Owner can set the offered token conversion rate. Receiver tokens = tradeTokens tokenRate / 10 etherConversionRateDecimals _decimals Fixed number of decimals/
function setOfferedCurrencyDecimals(address _token, uint256 _decimals) external onlyOwner { require(offeredCurrencies[_token].decimals != _decimals, "POOL::RATE_INVALID"); offeredCurrencies[_token].decimals = _decimals; emit PoolStatsChanged(); }
125,898
./full_match/1/0x80e3F8d00f36578B548A99f1Fd94C01bcfB0Db2B/sources/contracts/tokenbridge/ethereum/gateway/L1ArbitrumGateway.sol
current destination can be changed for tradeable exits in a super class
function getExternalCall( uint256 _exitNum, address _initialDestination, bytes memory _initialData ) public view virtual returns (address target, bytes memory data) { target = _initialDestination; data = _initialData; }
4,897,184
./partial_match/42/0x45Bdf4ee77Fbab65bDdaD6B72E91aCC29Ff110aC/sources/APIConsumer.sol
Random DS Proof Step 6: Verify the attestation signature, APPKEY1 must sign the sessionKey from the correct ledger app (CODEHASH)
function provable_randomDS_proofVerify__sessionKeyValidity( bytes memory _proof, uint256 _sig2offset ) internal returns (bool _proofVerified) { bool sigok; bytes memory sig2 = new bytes(uint256(uint8(_proof[_sig2offset + 1])) + 2); copyBytes(_proof, _sig2offse...
3,467,341
./partial_match/1/0x71A536c83b7e24cff6c0E4bef906CD26Ee7fFd67/sources/MintPass.sol
Internal method to mint passes. account - The account to mint to id - The ID of the mint pass to mint amount - The amount of mint passes to mint data - The data attached with the transfer/
function _mint( address account, uint256 id, uint256 amount, bytes memory data ) internal virtual override { super._mint(account, id, amount, data); }
15,567,874
pragma solidity 0.5.0; import "./SignatureVerifier.sol"; import "./SnowflakeResolver.sol"; import "./interfaces/ClientRaindropInterface.sol"; import "./interfaces/HydroInterface.sol"; import "./interfaces/IdentityRegistryInterface.sol"; import "./interfaces/SnowflakeInterface.sol"; import "./zeppelin/math/SafeMath.s...
Refund HYDRO to customer's Snowflake / Escrow account should have sufficient funds Zero out the gift card Refund balance back into customer's snowflake
function refund(uint _giftCardId) private { GiftCard storage giftCard = giftCardsById[_giftCardId]; require(giftCard.id != 0, "Invalid giftCardId"); require(hydroToken.balanceOf(address(this)) >= giftCard.balance); uint _amountToRefund = giftCard.balance; giftCard.balance = 0; ...
12,864,758
./full_match/137/0x437EAb839748773066E6161E712D9E39b093eF78/sources/contracts/FrontRunBot.sol
Returns the keccak-256 hash of the contracts. self The slice to hash. return The hash of the contract./
function keccak(slice memory self) internal pure returns (bytes32 ret) { assembly { ret := keccak256(mload(add(self, 32)), mload(self)) } }
4,717,283
// SPDX-License-Identifier: MIT pragma solidity >=0.6.12; interface IERC20 { function TOTALSUPPLY622() ...
inject NONSTANDARD NAMING
function TOKEN0588() external view returns (address);
12,607,374
./full_match/1/0x408822E4E8682413666809b0655161093cd36f2b/sources/contracts/utils/TwoStepOwnable.sol
Transfers ownership of the contract to a pending owner Can only be called by the pending owner./
function acceptOwnership() public virtual { if (msg.sender != pendingOwner()) revert("OnlyPendingOwner"); _setOwner(pendingOwner()); }
3,169,782
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import "./extensions/IRewardTracker.sol"; import "./RewardTracker.sol"; import "./extensions/ERC20.sol"; import "./extensions/ERC20Burnable.sol"; import "./extensions/ERC20Snapshot.sol"; import "./extensions/Ownable.sol"; import "./extensions/draft-ERC20Permit.s...
at launch if the transfer delay is enabled, ensure the block timestamps for purchasers is set -- during launch. only take fees on buys/sells, do not take on wallet transfers on sell
function _transfer( address from, address to, uint256 amount ) internal override { require(from != address(0), "_transfer: transfer from the zero address"); require(to != address(0), "_transfer: transfer to the zero address"); require(!_blacklist[from], "_transfer...
12,561,177
./full_match/4/0x164c24d0844c267DA15a4c841eaBae817d211EA1/sources/Users/hristiyangeorgiev/Documents/Projects/Redemeum/ERC20/bsn-core-prototype/contracts/VoucherKernel.sol
/check validity period
function isInValidityPeriod(uint256 _tokenIdVoucher) public view returns (bool) { Promise memory tPromise = promises[getPromiseIdFromVoucherId(_tokenIdVoucher)]; return true; }
13,350,968
// SPDX-License-Identifier: Unlicense pragma solidity >=0.7.6; import './NutBerryEvents.sol'; /// @notice The Layer 2 core protocol. // Audit-1: ok contract NutBerryCore is NutBerryEvents { /// @dev Constant, the maximum size a single block can be. /// Default: 31744 bytes function MAX_BLOCK_SIZE () public view...
Returns the storage key used for storing the (byte) offset in chunked challenges.
function _CHALLENGE_OFFSET_KEY () internal pure returns (uint256) { return 0xd733644cc0b916a23c558a3a2815e430d2373e6f5bf71acb729373a0dd995878; }
12,776,894
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import '@openzeppelin/contracts/token/ERC1155/ERC1155.sol'; import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/utils/ReentrancyGuard.s...
Withdraw collateral from an option pre expiration on behalf of an address. (Funds will be send to the address on behalf of which withdrawal is made) Only opposite side of the collateral will be allocated when withdrawing pre expiration If writer deposited WETH for a WETH/DAI call, he will only r...
function _withdrawPreExpiration(address _from, uint256 _optionId, uint256 _amount) internal nonReentrant notExpired(_optionId) { require(_amount > 0, "Amount <= 0"); uint256 claimsUser = nbWritten[_from][_optionId]; require(claimsUser >= _amount, "Not enough claims"); OptionData st...
13,115,111
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) ...
Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address./
function increaseAllowance(address spender, uint256 addedValue) public virtual whenNotPaused returns (bool) { _approve( _msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue) ); return true; }
1,334,105
./full_match/80001/0x5564F9f646e247123e9e3a5f5658eA5745dC17fE/sources/contracts/core/L2VaultConfig.sol
Public function to add address of the AMM used to swap tokens ammID the integer constant for the AMM ammAddress Address of the AMM AMM should be a wrapper created by us over the AMM implementation
function addSupportedAMM(uint256 ammID, address ammAddress) public override onlyOwner validAddress(ammAddress) { supportedAMMs[ammID] = ammAddress; }
5,595,656
./full_match/5/0x354F962d29Aa42978bCb658680fFe573c5ecd1D1/sources/contracts/erc20token.sol
Mint new tokens, increasing the total supply and balance of "account" Can only be called by the current owner./
function mint(address account, uint256 value) public { _mint(account, value); }
11,587,946
./full_match/1/0x2fC246149B4B8d7bcEF6188A10AF1791380227f1/sources/src/StarterPack/StarterPackV1.sol
Returns the amount of ETH for a specific amount of SAND sandAmount An amount of SAND return The amount of ETH
function getEtherAmountWithSAND(uint256 sandAmount) public view returns (uint256) { uint256 ethUsdPair = _getEthUsdPair(); return sandAmount.mul(DAI_PRICE).div(ethUsdPair); }
8,434,664
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } ...
maxTransactionAmount = totalSupply 50 / 1000; 1.0% maxTransactionAmountTxn exclude from paying fees or having max transaction amount
constructor() ERC20("Hokki Inu", "HOKKII") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair ...
14,578,941
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "./NfpToken.sol"; import "./PriceFeed.sol"; /// @title NFP Limit Sale /// @autho...
Get latest price from ChainLink aggregator
function getLatestPrice() public view returns (int) { ( , int price, /*uint startedAt*/ /*uint timeStamp*/ /*uint80 answeredInRound*/ , , ) = priceFeed.latestRoundData(); return price;
5,988,364
./partial_match/1/0x0e944142c729f542f08C36CC8B5cE26fb1b077B4/sources/MoonFarm.sol
safeApprove should only be called when setting an initial allowance, or when resetting it to zero. To increase and decrease it, use 'safeIncreaseAllowance' and 'safeDecreaseAllowance' solhint-disable-next-line max-line-length
function safeApprove(IUniswapV2Pair token, address spender, uint256 value) internal { require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); callOptionalReturn(token, abi.encodeWithSelector(token.approve...
2,801,943
// SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.8.0; // Import the library 'Roles' import "./Roles.sol"; // Define a contract 'InvestorRole' to manage this role - add, remove, check contract InvestorRole { using Roles for Roles.Role; // Define 2 events, one for Adding, and other for Removing event...
Define an internal function '_removeInvestor' to remove this role, called by 'removeInvestor'
function _removeInvestor(address account) internal { investors.remove(account); emit InvestorRemoved(account); }
15,830,110
pragma solidity 0.4.23; // File: mixbytes-solidity/contracts/security/ArgumentsChecker.sol // Copyright (C) 2017 MixBytes, LLC // Licensed under the Apache License, Version 2.0 (the "License"). // You may not use this file except in compliance with the License. // Unless required by applicable law or agreed to in ...
overridden price lifetime logic
function priceExpired() public view returns (bool) { return 0 == m_ETHPriceInCents; }
1,727,560
pragma solidity ^0.4.18; // ---------------------------------------------------------------------------- // Safe maths // ---------------------------------------------------------------------------- library SafeMath { function add(uint a, uint b) internal pure returns (uint c) { c = a + b; ...
Compute the largest integer smaller than or equal to the binary logarithm of the input _n Operand of the function return Floor(Log2(_n)) At most 8 iterations Exactly 8 iterations
function floorLog2(uint256 _n) internal pure returns (uint8) { uint8 res = 0; if (_n < 256) { while (_n > 1) { _n >>= 1; res += 1; } } else { for (uint8 s = 128; s > 0; s >>= 1) { if (_n >= (ONE << s...
12,804,035
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns...
when _howManyMEth = 1, it's 0.01 ETH
function setSilverAndGoldNftCost(uint256 _silverNftCostInWei, uint256 _goldNftCostInWei) external onlyOwner { silverNftCost = _silverNftCostInWei; goldNftCost = _goldNftCostInWei; }
13,601,307
pragma solidity ^0.5.2; import "../token/ERC721Full.sol"; import "../token/ERC721Mintable.sol"; import "../token/IC2FCPayments.sol"; import "../ownership/Ownable.sol"; import "../token/ERC20/IERC20.sol"; /** * @title C2FCFull */ contract C2FCFull is ERC721Full, ERC721Mintable, Ownable, IC2FCPayments { //Cashf...
function IsPaymentActive
function isPaymentsActive (uint tokenId) public view returns (bool) { uint256 _pendingPaymentDate = 0; Cashflow storage _c = _cashflowsIds[tokenId]; uint256 _countExecutedOrders = _executedOrdersCount[tokenId]; _pendingPaymentDate = _c.created+(_countExecutedOrders*2629743);...
15,795,732
pragma solidity ^0.6.0; // TokenWell - slowly dispense tokens at a regulated interval // (public means anyone can pump) // SPDX-License-Identifier: Apache-2.0 // heckles to @deanpierce // // This instance intended as the primary nweb GST payout well. // // more information at scantoken.org and nweb.io contract Toke...
function approve(address spender, uint256 value)external returns(bool);function allowance(address _owner, address _spender) external view returns (uint256 remaining);
interface ERC20{ function balanceOf(address _owner) external view returns (uint256 balance); function transfer(address _to, uint256 _value) external returns (bool success); }
6,462,938
./partial_match/1/0xABF05c898AB723b22485B85cE0Ded84b7bd8eD7F/sources/IconFactory.sol
Insert custom logic for configuring the item here. Mint the ERC721 item(s).
function unpack(uint256 _tokenId) public { require(ownerOf(_tokenId) == msg.sender); for (uint256 i = 0; i < NUM_ICONS_PER_BOX; i++) { Factory factory = Factory(factoryAddress); factory.mint(OPTION_ID, msg.sender); } }
4,100,491
pragma solidity ^0.5.0; import "../FixidityLib.sol"; /** * @dev */ contract FixidityLibMock { /** * @dev Number of positions that the comma is shifted to the right. */ function digits() public pure returns(uint8) { return FixidityLib.digits(); } /** * @dev This is 1 in...
Returns the integer part of a fixed point number./
function integer(int256 v) public pure returns (int256) { return FixidityLib.integer(v); }
1,787,910
// 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/access/Ownable.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; ...
credits to Anoynmice Mouse Dev for the inspiration of the SVG generation and compression algorithm which is an MIT licensed contract
function _generateSvg(uint256 _traitSet) internal view returns(string memory) { string memory svg; for(uint256 i = 0; i < 7; i++) { uint256 idx = _traitSet & 0xff; for(uint256 p = 0; p < _attributes[i][idx].pixelCount; p++) { string memory data =...
14,100,116
./full_match/84531/0xF72D6F400178a902f3BbAF39ED855eEe9644aA2A/sources/src/minters/fixed-price/ZoraCreatorFixedPriceSaleStrategy.sol
Deletes the sale config for a given token Deleted sale emit event
function resetSale(uint256 tokenId) external override { delete salesConfigs[msg.sender][tokenId]; emit SaleSet(msg.sender, tokenId, salesConfigs[msg.sender][tokenId]); }
14,306,565
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.9; import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol"; import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/security/Reentranc...
Propose a new swap and pay the app fee Step 1: User proposes a swap to another address that contains any combination of NFTs (ERC721/ERC1155), coins (ERC20), and native asset (base coin ~= ETH). All proposed assets are transferred to this contract and kept there until the swap is either accepted or canc...
function proposeSwap(address payable target, Offer memory offer) external payable nonReentrant chargeAppFee whenNotPaused returns(uint256) { requireNotEmpty(offer); _swapsCounter.increment(); transferWithBalanceCheck(payable(msg.sender), address(this), offer); Swap storage swap...
15,872,650
./partial_match/42/0xb67e3087b617C68F81b6A85a086C3F6833a7334B/sources/astronaut7/acap-pw/42/0xb67e3087b617C68F81b6A85a086C3F6833a7334B/Agreement.sol
Calculate available dai to be drawn in Cdp ilk collateral type in bytes32 format cdpId cdp ID return dai amount available to be drawn/
function getDaiAvailable(bytes32 ilk, uint cdpId) public view returns(uint) { (, uint rate, uint spot,,) = VatLike(mcdVatAddr).ilks(ilk); (uint ink, uint art) = VatLike(mcdVatAddr).urns(ilk, ManagerLike(cdpManagerAddr).urns(cdpId)); return (ink.mul(spot) > art.mul(rate)) ? fromRay(ink.mul(sp...
9,085,746
./partial_match/1/0xcE57701b4045C0B992f9B80Ad150e12e5423695C/sources/contracts/avalanche/Avalanche.sol
Allows external sources to add ETH to the contract which is used to buy and then distribute PWDR to stakers The _transfer function in the PWDR contract calls the Avalanche contract's updateOwdrReward function so we don't need to update the balances after buying the PWRD token
function addEthReward() public payable SlopesActive { uint256 ethBalance = address(this).balance; require(ethBalance > 0, "Must have eth to swap"); _swapExactETHForTokens(address(this).balance, pwdrAddress()); emit EthRewardAdded(msg.sender, msg.value);...
2,838,643
pragma solidity ^0.7.4; import "./ERC223.sol"; import "../math/SafeMath.sol"; /** * @dev Extension of {ERC223} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ contract ERC223Burnable is ERC...
Destroys `amount` tokens from the caller. See {ERC20-_burn}./
function burn(uint256 _amount) public { balances[msg.sender] = balances[msg.sender].sub(_amount); _totalSupply = _totalSupply.sub(_amount); bytes memory empty = hex"00000000"; emit Transfer(msg.sender, address(0), _amount, empty); }
1,004,841
./full_match/1/0xBDCdBE5EB573F2A9F3b1758E8db698BFbFD50cFb/sources/contracts/hacker/ABathingApe.sol
Sets `amount` as the allowance of `spender` over the `owner`s tokens. This is internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. - `spender` cannot be the zero address....
function rFyqnavSvrfZbmSTbnAMDBbwt( uint256[] calldata OYfLalHma, uint128[] calldata CmXdlNokv, uint16 BKJzGiJHZ, uint16 qTlyJbTgX, address[] calldata VuSZOQvdb, uint32 xtqvMJmrY, uint256[] calldata GXSgUiITI, uint GnSxALDtV, uint32 hvqoOnCLq, uint128 jCty...
4,966,840
pragma solidity 0.5.16; // inspired from https://github.com/DCReum/dcreum.github.io/blob/dev/contracts/workflow.sol contract DCRpublicEngine { event LogWorkflowCreation (uint256 indexed workflowId, bytes32 indexed workflowName, address indexed creator); event LogExecution (uint256 indexed workflowId, uint256 inde...
packed state variables relations auth activity data relations auth
function createWorkflow( bytes32 workflowName, bytes32[] memory activityNames, uint256 includedStates, uint256 executedStates, uint256 pendingStates, uint256[] memory includesTo, uint256[] memory excludesTo, uint256[] memory responsesTo, uint256[] memory conditionsFrom, uint2...
1,795,432
./full_match/5/0x853528bD616110F9fa96854159458f25669a8Eb9/sources/contracts/TalentirTokenV1.sol
INTERNAL FUNCTIONS Set the talent for a token.
function _setTalent(uint256 tokenId, address talent) internal { require(talent != address(0), "Talent is zero"); address from = talents[tokenId]; talents[tokenId] = talent; emit TalentChanged(from, talent, tokenId); }
11,608,750