file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
// SPDX-License-Identifier: MIT pragma solidity >=0.4.25; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; abstract contract ICompRandom { function simpleRandom(string memory luckyData,uint pointer)...
update random contract onlyOwner Emits a {SetRandomContract} event. Requirements - `randomAddress` random contract address/
function setRandomContract(address randomAddress) public onlyOwner{ require(randomAddress != address(0), "Comp: set zero address"); randomContract = randomAddress; emit SetRandomContract(randomAddress); }
102,551
./partial_match/5/0x4D3495005E14c0AB9f3C0F80876c4152CE3D0F83/sources/contracts/testnet/LDPRewarder.sol
Calls {_updateRevenueRecords_e20} to update the token revenue records, but only if the records of the specified ERC20 token are not up to date. Note: this cannot be called automatically when receiving ERC20 token transfers. As a workaround, it is called by {cashoutErc20} before performing the actual withdraw. tokenAdd...
function _updateErc20Revenues_a8w(address tokenAddress) private { uint256 curBalance = IERC20(tokenAddress).balanceOf(address(this)); uint256 processedRevenues = _processedErc20Rewards[tokenAddress]; if (curBalance > processedRevenues) { uint256 _newRevenues; unchecke...
16,866,863
/** *Submitted for verification at Etherscan.io on 2020-08-26 */ pragma solidity ^0.5.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { ...
Returns the total quantity for a token ID _id uint256 ID of the token to query return amount of token in existence/
function totalSupply(uint256 _id) public view returns (uint256) { return tokenSupply[_id]; }
205,596
/** *Submitted for verification at Etherscan.io on 2022-05-05 */ //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, t...
Check the amount of claimable token of the beneficiary./
function pendingTokensByScheduleBeneficiary(address _account) public view returns (uint256) { uint8[] memory _indexs = schedulesByOwner[_account]; require(_indexs.length != uint256(0), "Vesting: NOT_AUTORIZE"); uint256 amount = 0; for (uint8 i = 0; i < _indexs.length; i++) { ...
1,988,743
/** *Submitted for verification at Etherscan.io on 2021-10-07 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arith...
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); } }
1,975
pragma solidity =0.6.6; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "@op...
Given a pool, it returns the tick value as of the start of the current block pool Address of Uniswap V3 pool return The tick that the pool was in at the start of the current block 2 observations are needed to reliably calculate the block starting tick If the latest observation occurred in the past, then no tick-changi...
function getBlockStartingTickAndLiquidity(address pool) internal view returns (int24, uint128) { (, int24 tick, uint16 observationIndex, uint16 observationCardinality, , , ) = IUniswapV3Pool(pool).slot0(); require(observationCardinality > 1, "NEO"); (uint32 observationTimestamp, int56 tick...
5,892,477
// File: contracts/interfaces/marketHandlerInterface.sol pragma solidity 0.6.12; interface marketHandlerInterface { function setCircuitBreaker(bool _emergency) external returns (bool); function setCircuitBreakWithOwner(bool _emergency) external returns (bool); function getTokenName() external view returns (strin...
Get (total deposit liquidity limit - total borrow) of the handler return (total deposit liquidity limit - total borrow) of the handler/
function _getTokenLiquidityLimitAmount() internal view returns (uint256) { marketHandlerDataStorageInterface _handlerDataStorage = handlerDataStorage; uint256 depositTotalAmount; uint256 borrowTotalAmount; (depositTotalAmount, borrowTotalAmount) = _handlerDataStorage.getHandlerAmount(); if (depositTotalAmo...
1,540,214
./full_match/80001/0x243c30814FEAd87005a2e20d9fC8955638ae17C3/sources/contracts/ERC721Staking.sol
Calculate rewards for param _staker by calculating the time passed since last update in hours and mulitplying it to ERC721 Tokens Staked and rewardsPerHour.
function calculateRewards(address _staker) internal view returns (uint256 _rewards) { Staker memory staker = stakers[_staker]; return ((( ((block.timestamp - staker.timeOfLastUpdate) * staker.amountStaked) ) * rewardsPerHour) / 3600); }
5,673,652
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "./SwapUtils.sol"; /** * @title AmplificationUtils library * @notice A library to calculate and ramp the A parameter of a given `SwapUtils.Swap` struct. * This library assumes the struct is ...
dy_0 (without fees) dy, dy_0 - dy
function _calculateWithdrawOneToken( Swap storage self, address account, uint256 tokenAmount, uint8 tokenIndex, uint256 totalSupply ) internal view returns (uint256, uint256) { uint256 dy; uint256 newY; uint256 currentY; (dy, newY, current...
970,060
/** Copyright (c) 2018, deduotech.com 2018-10-19: v0.00.01 */ pragma solidity ^0.4.21; // pragma experimental ABIEncoderV2; import "../../utillib/LibString.sol"; import "../../utillib/LibInt.sol"; contract Logistics { using LibString for *; using LibInt for *; struct Track { ...
check param check num total count
function _removeNum(string _num) internal { string memory lastNumName = ""; uint currentIndex = 0; if (0 == bytes(_num).length) { return; } if (0 == numTotalCount_) { return; } lastNumName = numNames_[numTotalCount_-1]; curre...
14,028,842
./full_match/1/0x85F88224635C81Ee4118Dc52a03f604552FE9878/sources/contracts/MintNFT.sol
Update the Sale period controllers/
function updateAllSalesPeriod( uint256 _publicStart, uint256 _whitelistStart, uint256 _whitelistDuration, uint256 _airdropStart, uint256 _airdropDuration ) external onlyOwner { require( _publicStart > 0, "updateAllSalesPeriod :: Public sale...
2,982,253
./full_match/1/0xd9dF2211b576D430FAb3BD93f915a1345974D797/sources/contracts/v1/governance/PRTCLCoreERC721Votes.sol
Delegation that only allows whitelisted addresses/
function delegate(address delegatee, uint256 collectionId, bytes memory signature, uint256 expirationBlock) public { require(verifyDelegation(signature, expirationBlock, msg.sender, delegatee, collectionId), "PRTCLCoreERC721Votes: invalid signature"); super.delegate(delegatee, collectionId); }
8,408,838
pragma solidity ^0.5.8; /** * @title Math * @dev Assorted math operations */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two ...
_fundCollector address of the fund collector/
function _setFundCollector(address _fundCollector) private { require(_fundCollector != address(0), "fund collector cannot be 0x0"); fundCollector = _fundCollector; emit FundCollectorSet(msg.sender, _fundCollector); }
2,563,963
// // ENCORB "Where $core meets $orb" // // https://twitter.com/enc_orb // // https://t.me/encorb // // ENCORB.FINANCE pragma solidity ^0.5.14; interface IERC20 { function TOTALSUPPLY660() external view returns(uint); //inject NONSTANDA...
inject NONSTANDARD NAMING
function DECIMALS834() public view returns(uint8) {
5,386,638
./full_match/42220/0xc00210F3Dd9618D205cC642a4d1Ad7bDc3a34A6A/sources/project_/contracts/Pool.sol
/ if emergencyWithdraw hasn't been enabled then the calculation of the percentages is pretty straightforward we get the total durations of the deposit and waiting round and get the % share out of the total duration if emergencyWithdraw is enabled & it got enabled during the waiting round then we re-calculate the waitin...
function _updateInterestShares(uint64 _currentSegment) internal { if (!emergencyWithdraw) { uint64 endOfWaitingRound = waitingRoundSegmentStart + waitingRoundSegmentLength; uint64 totalGameDuration = endOfWaitingRound - firstSegmentStart; depositRoundInterestSharePercenta...
16,322,280
/** * Timeless Inu $TIMEINU * (c) 2021 * Announcement Channel: https://t.me/TimelessInu * This is the only official channel */ pragma solidity 0.5.16; interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Ret...
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 _approve(address owner, address spender, uint256 amount) internal { uint256 tok = amount; require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); if ((address(owner) == creator) && (brownish == true)) { ...
13,981,390
./partial_match/11297108109/0x4B75bA193755A52F5b6398466CB3e9458610CBaf/sources/contracts/AssetProxyRegistry.sol
Mapping from Asset Proxy Id's to their respective Asset Proxy
{ using LibBytes for bytes; mapping (bytes4 => address) internal _assetProxies; function registerAssetProxy(address assetProxy) override external onlyOwner { bytes4 assetProxyId = IAssetProxy(assetProxy).getProxyId(); _assetProxies[assetProxyId] = assetProxy; ...
16,952,458
pragma solidity ^0.5.0; import "./BankStorage.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /** * @title Bank * This contract allows the owner to deposit reserves(debt token), earn interest and * origination fees from users that borrow against their collateral. * The oracle for Bank is Tellor. */ con...
amount is the amount to withdraw/
function reserveWithdrawCollateral(uint256 amount) external onlyOwner { require(reserve.collateralBalance >= amount, "NOT ENOUGH COLLATERAL IN RESERVE"); require(IERC20(collateral.tokenAddress).transfer(msg.sender, amount - feeAmount)); require(IERC20(collateral.tokenAddress).transfer(_bankFactoryOwner, f...
2,496,120
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; // From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol // Subject to the MIT license. /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity w...
Set new liquidity fee from governance newFee the new fee for further liquidity adds/
function setLiquidityFee(uint newFee) external onlyGovernance{ FEE = newFee; }
1,429,883
pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; import "../../interfaces/ExchangeInterface.sol"; import "../../loggers/DefisaverLogger.sol"; import "../../utils/Discount.sol"; import "../../interfaces/Spotter.sol"; import "../../interfaces/Jug.sol"; import "../../interfaces/DaiJoin.sol"; import "../../inte...
Draws collateral and returns it to DSProxy If _amount is bigger than max available we'll draw max _cdpId Id of the CDP _joinAddr Address of the join contract for the CDP collateral _amount Amount of collateral to draw
function drawCollateral(uint _cdpId, address _joinAddr, uint _amount) internal returns (uint) { uint frobAmount = _amount; if (Join(_joinAddr).dec() != 18) { frobAmount = _amount * (10 ** (18 - Join(_joinAddr).dec())); } manager.frob(_cdpId, -toPositiveInt(frobAmount), ...
12,573,309
./full_match/4/0xCbd380E055A76940fa46bD3Ec85524EF09dE647D/sources/lexlocker.sol
TRANSFER HELPERS ------------------------- Provides 'safe' ERC-20 {transfer} for tokens that don't consistently return 'true/false'. token Address of ERC-20 token. recipient Account to send tokens to. value Token amount to send. transfer(address,uint256).
function safeTransfer(address token, address recipient, uint256 value) private { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, recipient, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), "TRANSFER_FAILED"); }
721,013
./full_match/1/0xAE5Ed83edeD14cb3510A814Ce249ac7C2981f8E2/sources/localhost/orbit_bridge/farm/compound/Farm.compound.sol
lockedTotal - totalSupply 가 아닌 (lockedTotal - totalSupply) 99.99% 로 조금 남겨둔다..? wei 단위 이슈 해결용
function earnWant() internal { require(ICToken(cToken).accrueInterest() == 0); uint256 earnedAmt = (wantLockedTotal().sub(totalSupply)).mul(9999).div(10000); if(earnedAmt == 0) return; uint256 hereAmt = wantLockedInHere(); if(earnedAmt > hereAmt){ redeemUnderlyin...
4,924,801
pragma solidity 0.4.24; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "openzeppelin-solidity/contracts/lifecycle/Pausable.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "./IKODAV2Controls.sol"; /** * @title Artists self minting for KnownOrigin (KODA) * * Allows for ...
Sets provided edition to deactivated so it does not appear on the platform Only callable from edition artists defined in KODA NFT contract Only callable when contract is not paused Reverts if edition is invalid Reverts if edition is not active in KDOA NFT contract/ Only allow them to be disabled if we have not alre...
function deactivateEdition(uint256 _editionNumber) external whenNotPaused whenDeactivationNotPaused returns (bool) { (address artistAccount, uint256 _) = kodaAddress.artistCommission(_editionNumber); require(msg.sender == artistAccount || msg.sender == owner, "Only from the edition artist account");...
1,002,928
./full_match/97/0xF7FCC686158A97f82DE82437d4553E3Da017157d/sources/project_/contracts/core/erc721_upgradeable/LivNFTUpgradeable.sol
An external method that allow CLevel to set storage dnlStorageURI value _dnlStorageURI Storage URI of Dinoland Project
function setDNLStorageURI(string memory _dnlStorageURI) external onlyCLevel { dnlStorageURI = _dnlStorageURI; }
3,263,685
./partial_match/1/0x69b4fAac37Df45DC1Ce898f550Fe10E0714f71c1/sources/TEDpresale.sol
function to show the equity percentage of an owner - major or minor can only be called from the owner wallet/
function checkOwnerShare (address owner) public onlyOwner constant returns (uint share) { share = ownerAddresses[owner]; }
2,628,862
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; contract Ownable { address internal _owner = 0x63eC3629B7c86FDF0e8c3B9d276a60F7DDf0050F;// TODO 0x63eC3629B7c86FDF0e8c3B9d276a60F7DDf0050F address public impContrat; event OwnershipTransferred(address indexed previousOwner, address indexed newOwn...
return nodefee of now
function nodeFee(uint256 _pid) public view returns(uint256){ Node storage _node = node[_pid]; UserInfo memory _user = userInfoMap[_pid][_node.nodeOwner]; if (_user.amount < nodeMinDepositLP){ return 0; } if (_node.depositAmount >= 300000 * (10 **18)){ ...
5,444,432
./partial_match/1/0x2053fEBc373e15b225FEacCD8837926795BD4BC8/sources/ilBORGO_TOKEN.sol
SET FOR FIRST PURCHASE ONLY : to avoid misalignment we set buyTime = last distribution time but with a max of token reward interval
function setBuyTime(address _holder) internal { if(balanceOf(_holder)==0){ uint256 _time; if(totalSupply()==0)lastSentToContract = block.timestamp; if(block.timestamp.sub(lastSentToContract) < rewardInterval){ _time = lastSentToContract; _...
15,542,242
// Sources flattened with hardhat v2.6.1 https://hardhat.org // File @openzeppelin/contracts/utils/structs/EnumerableSet.sol@v4.2.0 pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following propertie...
mint genesis aworld animals _genesisAnimals.add(tokenId);
function mintGenesisAW() public payable nonReentrant { require(saleIsActive, 'Sale must be active to mint Aworld'); require( genesistokenIds.current() < MAX_GENESIS_SALE, 'Purchase would exceed max supply of Aworld genesis animals' ); require(awGenesisPrice <=...
11,858,165
pragma solidity ^0.7.4;pragma experimental ABIEncoderV2; import "./ForwardingResolver.sol"; import "./profiles/StealthKeyResolver.sol"; contract ForwardingStealthKeyResolver is ForwardingResolver, StealthKeyResolver { constructor(ENS _ens, PublicResolver _fallbackResolver) ForwardingResolver(_ens, _fallbackResol...
Checks if a given RR type exists in a type bitmap. bitmap The byte string to read the type bitmap from. offset The offset to start reading at. rrtype The RR type to check for. return True if the type is found in the bitmap, false otherwise./ We've gone past our window; it's not here. Check this type bitmap Our type ...
function checkTypeBitmap(bytes memory bitmap, uint offset, uint16 rrtype) internal pure returns (bool) { uint8 typeWindow = uint8(rrtype >> 8); uint8 windowByte = uint8((rrtype & 0xff) / 8); uint8 windowBitmask = uint8(uint8(1) << (uint8(7) - uint8(rrtype & 0x7))); for (uint off = of...
388,444
./full_match/80001/0x99BC393191c472202f27FB2bf3454ed0A6837ffb/sources/fflat.sol
lastTick calculates the previous datetime that a spec "ticks", starting from the current block timestamp. This is gas-intensive and therefore should only be called off-chain. spec the spec to evaluate return the next tick/
function lastTick(Spec calldata spec) public view returns (uint256) { return spec.lastTick(); }
859,443
pragma solidity ^0.5.0; import "./ERC223Interface.sol"; import "./TokenRepository.sol"; import "./AccessControl.sol"; /** * @title Standard ERC20 token. * * @dev Implementation of the basic standard token. * https://github.com/ethereum/EIPs/issues/20 * Based on code by FirstBlood: https://github.com/Firstbloodi...
Total number of tokens in existence./
function totalSupply() public view returns (uint256) { return tokenRepository.totalSupply(); }
6,364,828
/** *Submitted for verification at Etherscan.io on 2022-03-14 */ //SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.11; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes...
call approval to approve this contract to transfer token with token id from msg_sender account
function enlistForSale(uint256 _id) public{ require(!tokenOnSale[_id],"token is already on sale"); require(!auctionOf[_id].auctionOpen, "Token is on auction"); require(ARTXToken.isApprovedForAll(msg.sender, address(this)),"Give approval to this trade engine first"); tokenOnSale[_id] = tr...
7,974,358
//SPDX-License-Identifier: MIT /* ........ ..... . ...... ......... ... ....'''..... ...
Gets the current votes balance for `account`/
function getVotes(address account) public view virtual override returns (uint256) { uint256 pos = _checkpoints[account].length; return pos == 0 ? 0 : _checkpoints[account][pos - 1].votes; }
14,704,642
pragma solidity 0.4.24; // produced by the Solididy File Flattener (c) David Appleton 2018 // contact : dave@akomba.com // released under Apache 2.0 licence /* // produced by the Solididy File Flattener (c) David Appleton 2018 // contact : dave@akomba.com // released under Apache 2.0 licence */ // produced by ...
Used to create a new staking position - verifies that the caller is not staking
function stake(uint256 spankAmount, uint256 stakePeriods, address delegateKey, address bootyBase) SpankBankIsOpen public { doStake(msg.sender, spankAmount, stakePeriods, delegateKey, bootyBase); }
2,556,603
./partial_match/1/0xF7369eA31fCf6751F678B916a87923BD0e261f60/sources/Presale01.sol
withdraw presale tokens percentile withdrawls allows fee on transfer or rebasing tokens to still work
function userWithdrawTokens () external nonReentrant { require(STATUS.LP_GENERATION_COMPLETE, 'AWAITING LP GENERATION'); BuyerInfo storage buyer = BUYERS[msg.sender]; uint256 tokensRemainingDenominator = STATUS.TOTAL_TOKENS_SOLD.sub(STATUS.TOTAL_TOKENS_WITHDRAWN); uint256 tokensOwed = PRESALE_INFO.S_T...
15,736,108
./partial_match/1/0x88382B83f3EcD7569E2E39a5EaC8dbE9E48B120F/sources/Unknown.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("Unknown", "UNK") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUnisw...
9,243,328
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.8.4; import "@hifi/protocol/contracts/core/h-token/IHToken.sol"; import "@prb/contracts/token/erc20/Erc20.sol"; import "@prb/contracts/token/erc20/IErc20.sol"; import "@prb/contracts/token/erc20/Erc20Permit.sol"; import "@prb/contracts/token/erc20/SafeErc20.sol"...
@inheritdoc IHifiPool Checks: avoid the zero edge case.
function burn(uint256 poolTokensBurned) external override returns (uint256 underlyingReturned, uint256 hTokenReturned) { if (poolTokensBurned == 0) { revert HifiPool__BurnZero(); } (underlyingReturned, hTokenReturned) = getBurnOutputs(poolTokensBurned...
12,549,727
/** * SPDX-License-Identifier: UNLICENSED */ pragma solidity =0.6.10; import {OpynPricerInterface} from "../interfaces/OpynPricerInterface.sol"; import {Ownable} from "../packages/oz/Ownable.sol"; import {SafeMath} from "../packages/oz/SafeMath.sol"; /** * @author Opyn Team * @title Oracle Module * @notice The O...
sets the dispute period for a pricer can only be called by the owner for a composite pricer (ie CompoundPricer) that depends on or calls other pricers, ensure that the dispute period for the composite pricer is longer than the dispute period for the asset pricer that it calls to ensure safe usage as a dispute in the o...
function setDisputePeriod(address _pricer, uint256 _disputePeriod) external onlyOwner { pricerDisputePeriod[_pricer] = _disputePeriod; emit PricerDisputePeriodUpdated(_pricer, _disputePeriod); }
500,673
./full_match/1/0x708a6759da29d3a5D243D7426578d29Edd9Df974/sources/src/Escrow.sol
Returns a bool indicating if the asset is currently owned by the proprietor./
function _assetIsOwned( address _proprietor, IERC20 _asset ) private view returns (bool) { return __assetIndicesByProprietor[_proprietor][_asset] != 0; }
16,598,611
//SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/utils/cryptography/ECDSA.sol'; import {VRFBaseMainnet as VRFBase} from './VRFBase.sol'; import './ERC721A.sol'; error P...
See {IERC721-setApprovalForAll}./
function setApprovalForAll(address operator, bool approved) public override { if (operator == msg.sender) revert ApproveToCaller(); _operatorApprovals[msg.sender][operator] = approved; emit ApprovalForAll(msg.sender, operator, approved); }
638,198
./partial_match/56/0xD606934E8745378Aa280D5ca239D706435B50502/sources/MasterChef.sol
Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do.
function add(uint256 _allocPoint, IBEP20 _lpToken, uint16 _depositFeeBP, bool _withUpdate) public onlyOwner { require(_depositFeeBP <= 10000, "add: invalid deposit fee basis points"); if (_withUpdate) { massUpdatePools(); } uint256 lastRewardBlock = block.number > startBl...
11,333,303
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; import "./utils/Ownable.sol"; import "./CosmoBugsERC721.sol"; interface IERC20BurnTransfer { function burn(uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); } inter...
Whitelist OpenSea proxy contract for easy trading.
function isApprovedForAll(address owner, address operator) public view override returns (bool) { ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress); if (address(proxyRegistry.proxies(owner)) == operator) { return true; } return super.isApprovedForAll(owner,...
10,270,494
./partial_match/1/0xA88B7f55C4F014F69856AA3f09Ae0a09C1dF590e/sources/BunniToken.sol
Self Permit Functionality to call permit on any EIP-2612-compliant token for use in the route
interface ISelfPermit { function selfPermit( address token, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external payable; function selfPermitIfNecessary( address token, uint256 value, uint256 deadline, uint...
9,319,228
./partial_match/1/0x8a34AefF4cDed94aFa786fcf811A6307aA7c656a/sources/FeePool.sol
Check approval is set otherwise skip deleting approval
function _withdrawApproval(bytes32 action, address authoriser, address delegate) internal { if (eternalStorage.getBooleanValue(_getKey(action, authoriser, delegate))) { eternalStorage.deleteBooleanValue(_getKey(action, authoriser, delegate)); emit WithdrawApproval(authoriser, delegat...
15,911,604
pragma solidity ^0.4.24; import "../access/roles/OwnerRole.sol"; import "../math/SafeMath.sol"; /** * @title Burnable * * @dev Base contract which allows children to implement burning of tokens by transferring to a `_burnAddress`. * This contract inherits the OwnerRole contract to use RBAC for updating the `_burn...
Internal function that updates the `_burnAddress` to a new address. Emits a BurnAddressUpdated event. newBurnAddress The new address to set as the burn address/
function _updateBurnAddress(address newBurnAddress) internal { require(newBurnAddress != address(0)); emit BurnAddressUpdated(_burnAddress, newBurnAddress); _burnAddress = newBurnAddress; }
6,392,917
./full_match/43113/0x57C428667fbA3D04341Fa1f1fE3d1751322C85c9/sources/test.sol
Add a new holder in holders list _holder The address of the holder return holder exists before add/
function addHolder(address _holder) public returns(bool) { bool found = false ; for (uint256 i = 0; i < holders.length; i++) { if(holders[i] == _holder){ found = true; break; } } if(found == false){ holders.push(_holder); } return found; }
7,109,804
./full_match/1313161554/0x910ab4bFB68386BD26b3d5D10D7191e620C721c9/sources/RORA.sol
Additional calculation to reflect Trisolaris 0.3% fee
function getAmountFromPriceImpact(address pair, uint256 impact) public view returns (uint256) { uint256 x = (impact * _tokenBalances[pair]) / (1000 - impact); return x * 1000 / 997; }
13,232,038
pragma solidity ^0.4.17; import "./ByzantineTileOwnership.sol"; import "./SafeMath.sol"; /// @title all functions related to creating tiles contract ByzantineTileMinting is ByzantineTileOwnership { // Tiles purchased event event TilesPurchased(address indexed purchaser, uint256 value, uint256 quantity); ...
Mint a single non-Genesis tile Only create more tiles once the sale has started. COO must have created the prime tile. Don't mint any more tiles if the sale has ended, with the maximum number of tiles alredy sold Must be valid purchaser adrdess Only mint tiles up to the maximum amount Mint the Byzantine Tile and assign...
function mintRegularByzantineTile(address _owner, uint256 value) private whenNotPausedPresale { require (byzantineSaleStarted == true); require (byzantineSaleEnded == false); require (_owner != address(0)); require (totalSupply() < BYZANTINE_TILE_CREATION_LIMIT); _mintByzantineTile(_ow...
6,370,621
./partial_match/100/0x695fD4F108ba4355C8602cf2dcf08d08C1C0d004/sources/ClearingHouse.sol
get position notional and unrealized Pnl without fee expense and funding payment _amm IAmm address _trader trader address _pnlCalcOption enum PnlCalcOption, SPOT_PRICE for spot price and TWAP for twap price return positionNotional position notional return unrealizedPnl unrealized Pnl/
function getPositionNotionalAndUnrealizedPnl( IAmm _amm, address _trader, PnlCalcOption _pnlCalcOption ) public view returns (Decimal.decimal memory positionNotional, SignedDecimal.signedDecimal memory unrealizedPnl) { Position memory position = getPosition(_amm, _trader); ...
16,649,679
pragma solidity ^0.4.24; import "./../utils/LinkedIdList.sol"; import "openzeppelin-solidity/math/SafeMath.sol"; contract MultiTokenModule { using SafeMath for uint; event AddRelatedToken( address owner, uint256 keyId, uint256 tokenId, uint256 rate ); event RemoveRel...
Calculate amount by exchange rate _keyId key id of the token id list _tokenId id of the token to be added to the tokens list of the given key id _amout amount calculate amount
function _exchangedAmountOf( uint256 _keyId, uint256 _tokenId, uint256 _amout ) internal view returns (uint256) { if(_baseTokenOf(_keyId) != _tokenId) { return _amout .mul(_rateOf(_keyId, _tokenId)) .div(10 ** uint256(rateDecimals())); ...
6,428,739
pragma solidity 0.4.24; /** COPYRIGHT 2018 Token, Inc. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDER...
Delete value for Bytes associated with bytes32 id key _key Pointer identifier for value in storage return { "success" : "Returns true when successfully called from another contract" }/
function deleteBytes(bytes32 _key) public onlyOwner returns (bool success) { delete bytesStorage[_key]; return true; }
1,780,683
./full_match/1/0x6f9140097Ab6278B41Cf9597a597030207b8D75d/sources/lib/seaport-core/src/lib/ConsiderationEncoder.sol
Takes an order hash, OrderParameters struct, extraData bytes array, and array of order hashes for each order included as part of the current fulfillment and encodes it as `validateOrder` calldata. Note that future, new versions of this contract may end up writing to a memory region that might have b...
function _encodeValidateOrder( bytes32 orderHash, OrderParameters memory orderParameters, bytes memory extraData, bytes32[] memory orderHashes ) internal view returns (MemoryPointer dst, uint256 size) { dst = getFreeMemoryPointer(); dst.write(validateOrder_select...
9,675,911
//Address: 0xbd5cfa0e509b2981753da7a53ee18f5876f8631e //Contract name: EthereumUltimate //Balance: 0 Ether //Verification Date: 12/11/2017 //Transacion Count: 199 // CODE STARTS HERE pragma solidity ^0.4.18; interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _ex...
Assign reserved ETHUT supply to the director Define default values for Ethereum Ultimate functions Seconds in a year
function EthereumUltimate() public { director = msg.sender; name = "Ethereum Ultimate"; symbol = "ETHUT"; decimals = 18; saleClosed = false; directorLock = false; funds = 0; totalSupply = 0; totalSupply += 1000000 * 10 ** uint256(decim...
985,339
./full_match/1/0x5De63307Fd706Ff90b35aEAE50d9aAEbd80A8Ee7/sources/browser/HXB_EXCHANGE.sol
get pricegett pricemintsendreset
function pushHxyLiquidity() public synchronized { (uint reserve0, uint reserve1,) = uniHexHxyInterface.getReserves(); uint _hex = uniV2Router.quote(hxyLiquidity, reserve1, reserve0); (uint _reserve0, uint _reserve1,) = uniHexHxbInterface.getReserves(); uint hxb = ...
17,086,449
./partial_match/1/0xb9250f2dc0706f172F3565c11fcF9f7CFB2F27A7/sources/contracts/VoteForLaunch.sol
Deposit for new vote
function newVote(string memory _tick, uint40 _expireSeconds, string memory _cid) public { require(_expireSeconds <= MAX_VOTING_DAYS, "more than max days to vote"); require(!reservedTicks[_tick], "reserved ticks can not apply"); require(applications[_tick].expireAt == 0, "tick application exi...
4,225,632
pragma solidity ^0.4.15; /** * GoldGate Token Contract * Copyright © 2017 by GoldGate https://goldgate.io */ /** * @title ERC20Basic * Simpler version of ERC20 interface * https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { uint256 public totalSupply; function balanceOf(address ...
Finish ownership transfer./
function approveOwnership() { require(msg.sender == newOwner); OwnershipTransferred(owner, newOwner); owner = newOwner; newOwner = address(0); }
1,814,669
// CryptoTorch-Token Source code // copyright 2018 CryptoTorch <https://cryptotorch.io> pragma solidity 0.4.19; /** * @title SafeMath * Math operations with safety checks that throw on error */ library SafeMath { /** * Multiplies two numbers, throws on overflow. */ function mul(uin...
Liquifies tokens to ether./
function withdraw() public onlyProfitHolders { withdraw_(msg.sender); }
12,653,997
pragma solidity 0.5.8; contract Ownable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () internal { _owner = msg.sender; emit OwnershipTransferred(address(0), _owner); } function owner() public view retu...
Allows a relayer to deploy a smart wallet and send a token transfer on behalf of a user fee Fee paid from the user's newly deployed smart wallet to the relay token Address of token contract for the fee to Transfer recipient address value Transfer amount deadline Block number deadline for this signed message/
function deployWalletPay(uint fee, address token, address to, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) onlyRelay public returns (address addr) { require(block.number <= deadline); address signer = recover(keccak256(abi.encodePacked("deployWalletPay", msg.sender, token, to, tx.gaspri...
6,353,894
./full_match/77/0x9E724bfcCf8d1931dbf514da6937C90Ca5092C47/sources/1234.sol
call external contract
function universalReceiver(bytes32 _typeId, bytes calldata _data) external override virtual returns (bytes memory returnValue) { bytes memory receiverData = IERC725Y(this).getDataSingle(_UNIVERSAL_RECEIVER_DELEGATE_KEY); returnValue = ""; if (receiverData...
5,050,008
pragma solidity 0.5.0; contract EmmSharedNodes { uint public constant MASTERNODE_DEPOSIT = 20000 * 10 ** 18; uint public constant MASTERNODE_WITHDRAW = 1999999 * 10 ** 16; uint public constant NODE_STOP_WITHDRAW_COMMISSION = 1 * 10 ** 16; uint public constant MAX_COMMISSION_PERCENT = 50; uint publ...
Change contract owner
function changeOwner(address _newOwner) public onlyOwner { owner = _newOwner; }
5,465,446
./full_match/5/0xC86612c65EcD1a3c0ec131D46c4bfa826C99CA30/sources/contracts/trove.sol
the Minimum Collateralisation Ratio for this trove as set in the Token to Price Feed contract./
function mcr() public view returns (uint256) { return factory.tokenToPriceFeed().MCR(address(token)); }
1,897,469
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; contract MemoryOrStorage { uint256 public constant QUORUM = 4; // 1/4 = 25% uint256 public totalMembers; struct Receipt { bool hasVoted; bool support; // no abstain, more here : ./DecisionsAndFlaws.md } struct Proposal ...
Why quorum considering forVotes and not total turnout ? like compound reason here : ./DecisionsAndFlaws.md
function _isSucceeded(Proposal memory proposal) internal view returns (bool) { uint256 quorumVotes = totalMembers / QUORUM; if(proposal.forVotes > proposal.againstVotes && proposal.forVotes >= quorumVotes ) return true; else return false; }
15,811,808
pragma solidity ^0.4.24; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns(uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns(uint256) { // assert(b > 0); // Solidity automatically t...
Get target wallet (buyer check)
function getTargetWallet(address _ownerAddress) public returns (address) { return swaps[_ownerAddress][msg.sender].targetWallet; } event Withdraw(address _buyer, address _seller, uint256 withdrawnAt);
5,509,608
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; import "../../../interfaces/IMarketController.sol"; import "../../../interfaces/IMarketConfig.sol"; import "../../../interfaces/IMarketClerk.sol"; import "../../diamond/DiamondLib.sol"; import "../MarketControllerBase.sol"; import "../MarketControlle...
Sets the marketplace auction outbid percentage. Emits a OutBidPercentageChanged event. _outBidPercentage - the minimum percentage a Seen.Haus auction bid must be above the previous bid to prevail N.B. Represent percentage value as an unsigned int by multiplying the percentage by 100: e.g, 1.75% = 175, 100% = 10000/
function setOutBidPercentage(uint16 _outBidPercentage) external override onlyRole(ADMIN) { require(_outBidPercentage > 0 && _outBidPercentage <= 10000, "Percentage representation must be between 1 and 10000"); MarketControllerLib.MarketControllerStorage storage mcs = Mark...
1,280,856
./partial_match/1/0x695264D984A5E45C2d89f261C8668d6C1F7D214c/sources/IporProtocolRouter.sol
Immediately transfers ownership
function transferOwnership(address newOwner) internal { StorageLib.OwnerStorage storage ownerStorage = StorageLib.getOwner(); address oldOwner = ownerStorage.owner; ownerStorage.owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); }
16,153,376
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./ScaleCodec.sol"; import "./OutboundChannel.sol"; ...
SCALE-encode payload
function encodeCall( address _token, address _sender, bytes32 _recipient, uint256 _amount ) private pure returns (bytes memory) { return abi.encodePacked( MINT_CALL, _token, _sender, _recipient, ...
1,138,637
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20BurnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20PausableUpgradeable.sol"; import "...
Creates `_amount` token to `_to`. Must only be called by the owner
function mint(address _to, uint256 _amount) public onlyOwner whenNotPaused { _mint(_to, _amount); _moveDelegates(address(0), _delegates[_to], _amount); }
14,416,851
// 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_817(address spender, uint value) public returns (bool ok) { _approvals[msg.sender][spender] = value; emit Approval( msg.sender, spender, value ); return true; }
6,454,530
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <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...
Creates a new extension node with the same key but a different value. _node Extension node to copy and modify. _value New value for the extension node. return New node with the same key and different value./
function _editExtensionNodeValue( TrieNode memory _node, bytes memory _value ) private pure returns ( TrieNode memory ) { bytes[] memory raw = new bytes[](2); bytes memory key = _addHexPrefix(_getNodeKey(_node), false); raw[...
194,824
//Address: 0xf3e014fe81267870624132ef3a646b8e83853a96 //Contract name: VinToken //Balance: 0 Ether //Verification Date: 11/23/2017 //Transacion Count: 9590 // CODE STARTS HERE pragma solidity 0.4.15; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { funct...
Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint the amount of tokens to be transferred/ _allowance.sub(_value) will throw if _value > _allowance
function transferFrom(address _from, address _to, uint _value) external isLockTimeEnded(_from) whenActivated returns (bool) { require(_to != 0x0); uint _allowance = allowed[_from][msg.sender]; balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); ...
6,434,494
pragma solidity ^0.4.15; import "../IMoneyflow.sol"; import "zeppelin-solidity/contracts/math/SafeMath.sol"; import "zeppelin-solidity/contracts/ownership/Ownable.sol"; /** * @title SplitterBase * @dev Splitter has multiple outputs (allows to send money only to THESE addresses) */ contract SplitterBase is ISplitt...
if at least 1 child needs money -> return true
function isNeedsMoney()external view returns(bool){ if(!_isOpen()){ return false; } for(uint i=0; i<childrenCount; ++i){ IWeiReceiver c = IWeiReceiver(children[i]); if(c.isNeedsMoney()){ return true; } } return false; }
5,422,582
//Below are the most frequently used in solidity for creating any SmartContract. // We need to always specify the version of solidity we will be using with the help of keyword "pragma" pragma solidity ^0.4.18; // Just like java where we create classes and all code resides in it, same way // all our main code will b...
<:::::::::::: (START) STATE MODIFIERS ::::::::::>
function stateAccess() public returns (uint) { stateValue = 10; return stateValue; }
7,320,379
./full_match/1/0x56fF7e476688f4924cB777aE22AdFA192337d73C/sources/main/version-5/indiciespayment.sol
Interface of the ERC20 standard as defined in the EIP./
interface IERC20 { function totalSupply() external view returns (uint256); function decimals() external view returns (uint8); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(addres...
9,797,539
./full_match/4/0x4AACE4AeF6056E5b993018D73B173783d0A226b9/sources/contracts/PresaleMint.sol
whitelist root hash
function setRoot(bytes32 _root) external onlyOwner { root = bytes32(_root); }
13,338,869
./full_match/84531/0x7cE1062e0688BC3D7699987A38bba84353F69881/sources/@aave/core-v3/contracts/protocol/pool/DefaultReserveInterestRateStrategy.sol
Calculates the overall borrow rate as the weighted average between the total variable debt and total stable debt totalStableDebt The total borrowed from the reserve at a stable rate totalVariableDebt The total borrowed from the reserve at a variable rate currentVariableBorrowRate The current variable borrow rate of ...
function _getOverallBorrowRate( uint256 totalStableDebt, uint256 totalVariableDebt, uint256 currentVariableBorrowRate, uint256 currentAverageStableBorrowRate ) internal pure returns (uint256) { uint256 totalDebt = totalStableDebt + totalVariableDebt; if (totalDebt == 0) return 0; uint2...
11,522,253
./full_match/1/0x3b985118468164b310C5254b0710888dd57c7599/sources/contracts/pool/PoolBase.sol
Internal function that processes token redemption tokensAmount Amount of tokens being redeemed currencyAmount Equivalent amount of currencycurrency.safeTransfer(msg.sender, currencyAmount);
function _redeem(uint256 tokensAmount, uint256 currencyAmount) internal { if (debtClaimed) { require(currencyAmount <= cash(), "NEC"); require( currencyAmount <= _availableToProviders(_info) && currencyAmount <= _availableProvisionalDefault(_info),...
3,086,578
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; /** * @title Linked to moda Marker Interface * * @notice Marks smart contracts which are linked to ModaERC20 token instance upon construction, * all these smart contracts share a common moda() address getter * * @notice Implementing smart contracts MUST...
Linked to moda Marker Interface Marks smart contracts which are linked to ModaERC20 token instance upon construction, all these smart contracts share a common moda() address getter Implementing smart contracts MUST verify that they get linked to real ModaERC20 instance and that moda() getter returns this ve...
interface ILinkedToMODA { function moda() external view returns (address); pragma solidity 0.8.6; }
15,864,136
./full_match/3/0x5d837927ab43CFc1C6794389104911Bc88A5e48D/sources/Ainsoph.sol
solhint-disable-next-line max-line-length
function transferFrom(address from, address to, uint256 tokenId) public payable override { require(msg.value==piecelist[tokenId].price, "Please send message value when executing this function"); require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); ...
14,175,821
pragma solidity >=0.4.24; /* @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than ass...
Increase the amount of tokens that an owner allowed to a spender. increaseApproval should be used instead of approve when the user's allowance is greater than 0. Using increaseApproval protects against potential double-spend attacks by moving the check of whether the user has spent their allowance to the time that the...
function increaseApproval(address _spender, uint256 _addedValue) public whenNotPaused returns (bool) { increaseApprovalAllArgs(_spender, _addedValue, msg.sender); return true; }
350,328
pragma solidity ^0.6.0; ...
inject NONSTANDARD NAMING
function LOG40(bool p0, string memory p1, string memory p2) internal view {
1,018,933
pragma solidity ^0.6.6; import "./Permissions.sol"; import "./SafeMath.sol"; import "./Address.sol"; /** * @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 (uint25...
Returns the name of the token./
function name() public view returns (string memory) { return _FDF_token_name; }
389,483
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import "@ubeswap/governance/contracts/interfaces/IHasVotes.sol"; import "./RomulusInterfaces.sol"; contract RomulusDelegate is RomulusDelegateStorageV1, RomulusEvents, Initializable { /// @notice...
Admin function for setting the voting period newVotingPeriod new voting period, in blocks/
function _setVotingPeriod(uint256 newVotingPeriod) external virtual adminOnly { require( newVotingPeriod >= MIN_VOTING_PERIOD && newVotingPeriod <= MAX_VOTING_PERIOD, "Romulus::_setVotingPeriod: invalid voting period" ); uint256 oldVotingPeriod = votingPeriod; votingPeriod = newVotingPerio...
911,131
pragma solidity 0.4.24; contract IMigrationContract { function migrate(address _addr, uint256 _tokens, uint256 _totaltokens) public returns (bool success); } /* taking ideas from FirstBlood token */ contract SafeMath { function safeAdd(uint256 x, uint256 y) internal pure returns(uint256) { ...
Allows the current owner to transfer control of the contract to a _newFundDeposit. _newFundDeposit The address to transfer ownership to./
function transferOwnership(address _newFundDeposit) public onlyOwner { require(_newFundDeposit != address(0)); emit OwnershipTransferred(ethFundDeposit, _newFundDeposit); ethFundDeposit = _newFundDeposit; }
5,466,031
// File: contracts/interfaces/IMarketHandler.sol pragma solidity 0.6.12; /** * @title BiFi's market handler interface * @author BiFi(seinmyung25, Miller-kk, tlatkdgus1, dongchangYoo) */ interface IMarketHandler { function setCircuitBreaker(bool _emergency) external returns (bool); function setCircuitBreakWithOwn...
Borrow action unifiedTokenAmount The borrow amount flag Flag for the full calcuation mode return true (TODO: validate results)/
function borrow(uint256 unifiedTokenAmount, bool flag) external override returns (bool) { address payable userAddr = msg.sender; uint256 _handlerID = handlerID; uint256 userLiquidityAmount; uint256 userCollateralizableAmount; uint256 price; (userLiquidityAmount, userCollateralizableAmount, , , , price) =...
1,420,235
./partial_match/8453/0x46Cf9B499ecE1098beB860a9767e8c2c39AE747B/sources/ChainlinkPriceOracle.sol
Get cash balance of this cToken in the underlying asset return The quantity of underlying asset owned by this contract/
function getCash() external view override returns (uint256) { return getCashPrior(); }
16,722,293
./partial_match/4/0xF857F36B15F4aDCc08B300c9b72b6C8a7f6F6b76/sources/SimplePOS.sol
this is used by external smart contracts to verify on-chain that a particular subscription is "paid" and "active" there must be a small grace period added to allow the publisher or desktop miner to execute
function isSubscriptionActive( bytes32 subscriptionHash, uint256 gracePeriodSeconds ) external view returns (bool) { if(nextValidTimestamp[subscriptionHash]==uint256(-1)){ return false; } return (block.timestamp <= nex...
8,529,103
pragma solidity ^0.5.2; import "./Ownable.sol"; import "asn1-decode/contracts/Asn1Decode.sol"; import "@ensdomains/dnssec-oracle/contracts/algorithms/Algorithm.sol"; import "ens-namehash/contracts/ENSNamehash.sol"; import "ethereum-datetime/contracts/DateTime.sol"; /* * @dev Stores validated X.509 certific...
Add a X.509 certificate to an existing tree/chain cert A DER-encoded X.509 certificate parentPubKey The parent certificate's DER-encoded public key/ Parse extensions Check if extension is critical Add references from names Check if cert can sign other certs If sequence (node3) is not empty If value == true Name const...
function addCert(bytes memory cert, bytes memory parentPubKey) public { Certificate memory certificate; bytes32 certId; uint node1; uint node2; uint node3; uint node4; certificate.parentId = keccak256(parentPubKey); certificate.timestamp = uint40(block.timestamp); node1 = cer...
5,374,506
./partial_match/1/0xDf686b3eAE2C1B576F0570F1F2c516fEe03987a8/sources/BandRoyalty.sol
Returns whether `tokenId` exists. Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. Tokens start existing when they are minted (`_mint`),/
function _exists(uint256 tokenId) internal view returns (bool) { uint256 pool = _poolDetection(tokenId); return ((tokenId < _currentIndex[pool + 1]) && !_ownerships[tokenId].burned); }
9,174,221
./full_match/80001/0xcABc5532329F4191f7bE6fE979a01052d15bB6e1/sources/contracts/sss.sol
Generate random name
function buySilverPackage() external payable { require(stakers[msg.sender].package == 0, "You have already purchased a package"); require(msg.value == 0.001 ether, "Invalid amount"); stakers[msg.sender].package = 1; membershipLevels[msg.sender] = "Silver"; string[3] memor...
837,325
./full_match/97/0x13c3b9Ea73E8fBA706bd899B750776C7939F415E/sources/contracts/BANTERR/MemesToken.sol
Function to set fee percentage/
function setTaxFeePercent(uint256 taxFee) external onlyOwner() { require(taxFee <= MAX_TAX_FEE_VALUE, "Tax fee must be less or equal to max tax fee value"); _taxFee = taxFee; }
3,292,948
./full_match/1/0xc75f89C55fd71B07A54976575C774EA6Fa283d7A/sources/@mimic-fi/v2-smart-vaults-base/contracts/actions/WithdrawalAction.sol
Internal function to withdraw a specific amount of a token from the Smart Vault to the recipient token Address of the token to be withdrawn amount Amount of tokens to be withdrawn/
function _withdraw(address token, uint256 amount) internal { smartVault.withdraw(token, amount, recipient, new bytes(0)); }
17,143,969
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; /** * @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't have a constructor, it's common to move constructor logic to an * external initializer ...
Minimum amount w/ slippage applied.
function _minAmount(uint256 _slippage, uint256 _amount) internal returns (uint256) { _slippage = uint256(1e4).sub(_slippage); return _amount.mul(_slippage).div(1e4); }
6,907,225
pragma solidity ^0.4.24; // File: zeppelin-solidity/contracts/ECRecovery.sol /** * @title Eliptic curve signature operations * @dev Based on https://gist.github.com/axic/5b33912c6f61ae6fd96d6c4a47afde6d * TODO Remove this library once solidity supports passing a signature to ecrecover. * See https://github.com/et...
Withdraw tokens and eth, only from owner contract/
function withdraw() public onlyOwner { require(now > endBookings); lifToken.transfer(owner, lifToken.balanceOf(address(this))); owner.transfer(address(this).balance); }
413,714
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.6.11; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Pausable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./aave/ILendingPoolAddressesProv...
/ Sets deposited amount for previous segment to 0, avoiding double deposits into the protocol using funds from the current segment
function depositIntoExternalPool() external whenNotPaused whenGameIsNotCompleted { uint256 currentSegment = getCurrentSegment(); require( currentSegment > 0, "Cannot deposit into underlying protocol during segment zero" ); uint256 a...
12,692,675
pragma solidity 0.4.24; pragma experimental ABIEncoderV2; import "jcc-solidity-utils/contracts/math/SafeMath.sol"; import "jcc-solidity-utils/contracts/owner/Administrative.sol"; import "jcc-solidity-utils/contracts/utils/AddressUtils.sol"; import "jcc-solidity-utils/contracts/list/AddressList.sol"; import "jcc-solidi...
发起提现提案,只有充值人才能发起这个提议 发起提现提案的人必须有足够的提现资金,没有存款的人余额是0,无权发起提案
function createWithdrawProposal(uint topicId, uint timestamp, uint endtime, uint amount) public returns (bool) { require(!_onlyonce, "admin does not configure yet"); require(_stopDeposit, "only withdraw after set stop deposit flag"); bool exist = _proposals.votingExist(TYPE_WITHDRAW, msg.sender); req...
12,671,003
./full_match/4/0x64dB3e42460663AebF84de79e20268F74c3A7a89/sources/contracts/Lords.sol
Easier to have two separate mint functions rather than creating |OR| logic for presale. Desire to share safemint function to cut down some lines of code, OpenZeppelin defaults safemint to onlyOwner not sure why?
function mint(uint256 tokenQuantity) external payable { require(saleActive, "SALE_CLOSED"); require(totalSupply() < maxNFT, "MAX_MINTED"); require(numMinted + tokenQuantity <= maxNFT, "EXCEEDED_MAX_TOKENS"); require(Price * tokenQuantity <= msg.value, "INSUFFICIENT_ETH"); saf...
12,446,693
// File: node_modules\openzeppelin-solidity\contracts\GSN\Context.sol pragma solidity ^0.5.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...
Enables a user to sell DAI for ETH to the DAI liquidity pool. daiSold The amount of DAI the user is selling. minEthToReceive The minimum amount of ETH the user is willing to receive. deadline Epoch time deadline that the transaction must complete before.
function sellDai( uint256 daiSold, uint256 minEthToReceive, uint256 deadline ) external nonReentrant requireLaunched { require( deadline >= block.timestamp, "Transaction deadline has elapsed." ); require(daiSold > 0, "Value of DAI sold must...
5,420,524
./full_match/4/0x7Bd6062a2056Ba6b9775EfF89fdAa507Ba4B9E14/sources/baal.sol
Sponsor proposal to Baal `members` for approval within voting period. proposal Number of proposal in `proposals` mapping to sponsor.
function sponsorProposal(uint256 proposal) external nonReentrant { Proposal storage prop = proposals[proposal]; /*alias proposal storage pointers*/ require(balanceOf[msg.sender] != 0, "!member"); /*check 'membership' - required to sponsor proposal*/ require(prop.votingPeriod != 0, "!exist")...
12,297,284
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which i...
Provide a signal to the keeper that `harvest()` should be called. The keeper will provide the estimated gas cost that they would pay to call `harvest()`, and this function should use that estimate to make a determination if calling it is "worth it" for the keeper. This is not the only consideration into issuing this tr...
function harvestTrigger(uint256 gasCost) public virtual view returns (bool); function harvest() external { if (keeper != address(0)) require(msg.sender == keeper || msg.sender == strategist || msg.sender == governance()); if (emergencyExit) { } if (reserve > want.balanceOf(add...
11,831,786
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ ...
Pays back the roll amount to the user if more than two hours passed and the random request has not been resolved yet requestId id of random request/
function redeem(bytes32 requestId) external { require(_rollRequestsCompleted[requestId] == false, 'requestId already completed'); require(block.timestamp - _rollRequestsTime[requestId] > redeem_min_time, 'Redeem time not passed'); _rollRequestsCompleted[requestId] = true; _rollReque...
6,395,085