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: GPL-3.0-only pragma solidity 0.7.4; library SafeMathLib { function times(uint a, uint b) public pure returns (uint) { uint c = a * b; require(a == 0 || c / a == b, 'Overflow detected'); return c; } function minus(uint a, uint b) public pure returns (uint) { require(...
rewards2 is linear with time, probably very small amount as advertising
function getRewards2(uint poolId, uint slotId) internal view returns (uint) { Pulse storage pulse = pulses[poolId]; (uint referenceBlock1, uint referenceBlock2) = getReferenceBlocks(poolId, slotId); uint rewards2 = referenceBlock2.minus(referenceBlock1).times(pulse.reward2WeiPerBlock); ...
1,693,471
pragma solidity ^0.4.21; /** * @title LinkedListLib * @author Darryl Morris (o0ragman0o) and Modular.network * * This utility library was forked from https://github.com/o0ragman0o/LibCLL * into the Modular-Network ethereum-libraries repo at https://github.com/Modular-Network/ethereum-libraries * It has been upd...
------------------------------------------------------------------------ Checks a seller offer from the seller side The price ratio is how much micrograms (ug) of material (tokens) the buyer will get per ETH (ug/ETH) ------------------------------------------------------------------------
function checkMySellerOffer(address consumer) public view returns (uint quantity, uint priceRatio, uint totalWeiCost) { quantity = directOffers[msg.sender][consumer].quantity; priceRatio = directOffers[msg.sender][consumer].price; }
620,797
./full_match/80001/0x47dF6CecAB93B0B4DEEB173537bdDe7857ED629A/sources/contracts/Lottery.sol
Check if the user has enough tokens to buy the requested number of tickets Store the ticket entry number in the array and update other data
function getTicket(uint256 amount) external nonReentrant { if (currenttime < lotterystarttime || currenttime > lotteryendtime) { revert NotInRightState(); } ticketamount[msg.sender] >= amount, "You can not buy this amount of ticket" ); if (ticket...
865,405
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* * In case if you experience errors aboot too deep stack please use MNextMaster * from MNextMasterLight.sol. * * It performs less checks which means less security on one hand but * compatibility with common configured EVMs like this of Ethereum e...
Transact between users ---------------------- Perform transaction between users address target Target address to send coins to. uint256 amount Amount of coins to send. return bool True if the transaction was successful, false if not. @note In most cases like ERC20 token standard event is imetted...
function transact(address target, uint256 amount) lockUser(msg.sender) lockUser(target) external returns (bool) { return _transact(msg.sender, target, amount); }
2,507,116
pragma solidity ^0.5.0; import "./InterledgerReceiverInterface.sol"; import "./InterledgerSenderInterface.sol"; contract HTLCEth is InterledgerSenderInterface, InterledgerReceiverInterface { /** * Example implementation of Hash Time Locked Contract (HTLC) for Interledger. * HTLC allows parties (A a...
Called by Interledger, unpacks necessary values and calls withdrawFunds() nonce Nonce sent by the Interledger component data Data sent by the Interledger component, contains lockValue and key/ unpack parameters from data and call withdrawFunds()
function interledgerReceive(uint256 nonce, bytes memory data) public { (bytes32 lockValue, bytes32 key) = abi.decode(data, (bytes32, bytes32)); withdrawFunds(lockValue, key); emit InterledgerEventAccepted(nonce); }
2,557,234
./full_match/1/0x308C2cDaC8Cd08E17123d3aaB28ADE74B16751cF/sources/src/abstracts/BaseRouter.sol
Handles withdraw actions logic flow. When there may be futher actions requiring to replace the `amount` argument, it handles the replacement. Requirements: - Check if next action is type that requires `amount` arg update otherwise proceed as normal./ If Withdraw is last action just withdraw Sandwhich the withrawal wi...
function _handleWithdrawAction( Action[] memory actions, bytes[] memory args, BundleStore memory store, uint256 i ) private returns (bool replace, bytes memory updatedArgs) { (IVault vault, uint256 amount, address receiver, address owner) = abi.decode(args[i], (IVault, uint256, a...
9,817,750
./full_match/43114/0x7fa37EE65ca0fb45836325613bA21d7A154E6960/sources/Royalties.sol
get royalties split return creator roylaties return community royalties
function getRoyalties() public view returns (uint256, uint256) { return (creatorRoyalties, communityRoyalties); }
4,509,341
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import "contracts/marketplace/Marketplace.sol"; // Test imports import "./utils/BaseTest.sol"; contract MarketplaceTest is BaseTest { Marketplace public marketplace; Marketplace.ListingParameters public directListing; Marketplace.ListingPara...
initial block.timestamp
function test_createListing_startTime_pastWithBuffer() public { address to = getActor(0); uint256 tokenId = erc721.nextTokenIdToMint(); vm.startPrank(to); erc721.mint(to, 1); erc721.setApprovalForAll(address(marketplace), true); vm.warp(100 days); Marketplac...
15,873,153
pragma solidity ^0.4.24; import "zeppelin-solidity/contracts/ownership/Ownable.sol"; import "zeppelin-solidity/contracts/token/ERC20/ERC20.sol"; import "zeppelin-solidity/contracts/math/SafeMath.sol"; import "./Percent.sol"; import "./MintableBurnableERC20Token.sol"; /* * Sensei Kevlar presents... * * ================...
Retrieve the spread percent applied upon selling/
function sellRevenuePercent() public view returns (uint256, uint256) { return (sellRevenuePercent, percision); }
14,015,180
pragma solidity ^0.4.11; // for test import "./AnemoiToken.sol"; import "./SCRtoken.sol"; import "./SafeMath.sol"; import "./Ownable.sol"; import "./Pausable.sol"; contract AnemoiSaleContract is Ownable,SafeMath,Pausable { IndorseToken ind; // crowdsale parameters uint256 public fundingStartTime = ...
Ends the funding period and sends the ETH home move to operational
function finalize() external onlyOwner { require (!isFinalized); isFinalized = true; }
998,032
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import { IMimeticMetadata } from "./IMimeticMetadata.sol"; import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; import { Strings } from "@openzeppelin/contracts/utils/Strings.sol"; error MintExceedsMaxSupply(); error MintCostMismatch(); error ...
Internal view function to clean up focusGeneration(). Pretty useless but the function was getting out of control./
function _generationEnabled(Generation memory generation) internal view returns ( bool ) { if(!generation.enabled) return false; if(generation.evolutionClosure != 0) return block.timestamp < generation.evolutionClosure; return true; }
12,979,915
./full_match/44787/0x4d9f92CC8a5ad560C59224b2A9a5e3f11d64395E/sources/project_/contracts/Relay.sol
solhint-disable-next-line no-inline-assembly
function forward(address _to, bytes calldata _data, bytes memory _signature) external returns (bytes memory _result) { bool success; verifySignature(_to, _data, _signature); (success, _result) = address(_to).delegatecall(_data); if (!success) { assembly { returndataco...
13,276,531
// SPDX-License-Identifier: UNLICENSED // (c) Copyright 2021 YieldMagic LLC. All rights reserved. // // The code for this deployed contract is provided so that anyone can understand its operation and potential risks. // Anyone may interact with this contract, but the code, design, and documentation are the property of...
Get the default ERC1155 metadata URI return URI of a JSON file See {IERC1155MetadataURI-uri}
function uri() external view returns (string memory) { return super.uri(0); }
12,700,339
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.10; import {DSTest} from "ds-test/test.sol"; import {ZoraModuleManager} from "../../ZoraModuleManager.sol"; import {ZoraProtocolFeeSettings} from "../../auxiliary/ZoraProtocolFeeSettings/ZoraProtocolFeeSettings.sol"; import {ZoraRegistrar} from "../utils/users/Z...
Cheatcodes Deploy V3 Init V3 Create user Deploy mocks Mint user ERC1155 tokens
function setUp() public { vm = VM(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D); registrar = new ZoraRegistrar(); ZPFS = new ZoraProtocolFeeSettings(); ZMM = new ZoraModuleManager(address(registrar), address(ZPFS)); erc20TransferHelper = new ERC20TransferHelper(address(ZMM)); ...
12,722,591
// SPDX-License-Identifier: AGPL-3.0-or-later // // DssExecLib.sol -- MakerDAO Executive Spellcrafting Library // // Copyright (C) 2020 Maker Ecosystem Growth Holdings, Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as publi...
Includes Median and OSM functions
interface OracleLike { function src() external view returns (address); function lift(address[] calldata) external; function drop(address[] calldata) external; function setBar(uint256) external; function kiss(address) external; function diss(address) external; function kiss(address[] calldata...
1,659,984
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return payable(msg.sender); } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability war...
for one-time airdrop feature after contract launch
function airdropToWallets(address[] memory airdropWallets, uint256[] memory amount) external onlyOwner() { require(airdropWallets.length == amount.length, "airdropToWallets:: Arrays must be the same length"); removeAllFee(); buyOrSellSwitch = TRANSFER; for(uint256 i = 0; i < airdropW...
321,410
./partial_match/1/0xc6CadA314389430d396C7b0C70c6281e99ca7fe8/sources/src/contracts/Timelock2Step.sol
The ```_transferTimelock``` function initiates the timelock transfer This function is to be implemented by a public function _newTimelock The address of the nominated (pending) timelock
function _transferTimelock(address _newTimelock) internal { pendingTimelockAddress = _newTimelock; emit TimelockTransferStarted(timelockAddress, _newTimelock); }
2,822,980
pragma solidity ^0.7.1; //SPDX-License-Identifier: UNLICENSED /* New ERC23 contract interface */ interface IErc223 { function totalSupply() external view returns (uint); function balanceOf(address who) external view returns (uint); function transfer(address to, uint value) external returns (bool ok); ...
block transfers if the recipient only allows kyc input, check other factors
function transfer(address _to, uint256 _value) public override returns (bool ok) { if (onlyAcceptsKycInput[_to] == false && balances[msg.sender][ShyftTokenType] >= _value) { balances[msg.sender][ShyftTokenType] = balances[msg.sender][ShyftTokenType].sub(_value); balances[_to][Shyft...
314,232
./full_match/1/0xbD852Af274e5534B5c7e134b3535745680529fb6/sources/browser/ONXFarming.sol
Return total reward over the given _from to _to block.
function getTotalRewardInfo(uint256 _from, uint256 _to) public view returns (uint256 totalReward) { if (_to <= bonusEndBlock) { totalReward = getTotalRewardInfoInSameCommonDifference( _from, _to, onxStartBlock, bonusBeforeBulkBlockS...
2,898,155
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "../libraries/math/SafeMath.sol"; import "../libraries/token/IERC20.sol"; import "../libraries/token/SafeERC20.sol"; import "./IFlashLoanReceiver.sol"; import "./ILendingPoolAddressesProvider.sol"; import "./Withdrawable.sol"; abstract contract FlashLoan...
ADD LIQUIDITY create the pair if it doesn't exist yet
function _addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin ) internal virtual returns (uint amountA, uint amountB) { if (IUniswapV2Factory(factory).getPair(tokenA, tokenB) == address(0...
14,377,787
./full_match/1/0x700B276ac277BFBC04Ffb34E7aA1347C2cEb802a/sources/contracts/PhilanthropyToken.sol
Function to show TOTAL_INVESTOR_CLAIMED value return uint256/
function getTotalInvestorClaimed() external view onlyAdmin returns (uint256) { return TOTAL_INVESTOR_CLAIMED; }
9,643,210
./partial_match/4/0x31684C768A023000aC09D611D18a939D2f2C8728/sources/ExchangeRates.sol
Loop through each key and check whether the data point is stale.
function anyRateIsInvalid(bytes32[] calldata currencyKeys) external view returns (bool) { uint256 _rateStalePeriod = getRateStalePeriod(); bool[] memory flagList = getFlagsForRates(currencyKeys); for (uint256 i = 0; i < currencyKeys.length; i++) { if...
8,726,170
./full_match/8453/0xA0fbd1Be1371F273800471dBC5eFb41bBcC5F0BD/sources/contracts/agents/VirtualKeyAddress.sol
_authorizeUpgrade This method is required to safeguard from un-authorized upgrades, since in the UUPS model the upgrade occures from this contract, and not the proxy. In this case, the message caller must hold the root key of the key identity's wallet/
function _authorizeUpgrade(address) internal view requiresKey(ownerKeyId) override {}
11,549,047
./full_match/5/0x0609Df316a292BfBbd581e668E6505E6De075C6C/sources/contracts/defi_otc_exchange.sol
Withdraw orders by ids
function withdrawOrders(uint96[] calldata orderIds) external nonReentrant { uint96 currOrderNext; uint96 currOrderPrev; address currOrderMaker; for (uint256 i; i < orderIds.length; i++) { Order storage currOrder = orderIdMapping[orderIds[i]]; currOrderMaker = currOrder.maker; currOrderNext = currOrder...
11,599,583
// SPDX-License-Identifier: UNLICENSED pragma solidity =0.7.6; pragma experimental ABIEncoderV2; import "../openzeppelin/access/AccessControl.sol"; import "../openzeppelin/utils/math/SafeMath.sol"; import "../openzeppelin/token/ERC20/SafeERC20.sol"; import "../openzeppelin/token/ERC20/IERC20.sol"; import "../sablierh...
Integer division of two numbers, truncating the quotient./
function divUInt(uint256 a, uint256 b) internal pure returns (MathError, uint256) { if (b == 0) { return (MathError.DIVISION_BY_ZERO, 0); } return (MathError.NO_ERROR, a / b); }
12,569,901
/* ███████╗████████╗██╗ ██╗███████╗██████╗ ███████╗██╗ ██╗███╗ ███╗ ██╔════╝╚══██╔══╝██║ ██║██╔════╝██╔══██╗██╔════╝██║ ██║████╗ ████║ █████╗ ██║ ███████║█████╗ ██████╔╝█████╗ ██║ ██║██╔████╔██║ ██╔══╝ ██║ ██╔══██║██╔══╝ ██╔══██╗██╔══╝ ██║ ██║██║╚██╔╝██║ ███████╗ █...
This function removes a given array element. It doesn't keep the sorting of the array. @_array is the input array @_id is the element value (not the index) that we want to remove./
function deleteArrayElement(uint[] storage _array, uint _id) private returns(bool) { uint _index; if (_array.length == 1 || _array[_array.length-1] == _id) { _array.length--; return true; for (uint i=0; i<_array.length; i++) { if (_array[i] == _id)...
917,170
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; /** * Interface for royalties follo...
Adds entry to an active raffle./ Update RaffleData
function enterRaffle(uint256 itemId) public payable { require(idToMarketItem[itemId].onSale && idToMarketItem[itemId].typeItem == TypeItem.Raffle, "CoralMarketplace: There is no raffle active for this item."); require(msg.value >= 1 * (10**18), "CoralMarketplace: Value of transaction must be at least 1 REEF.")...
13,087,168
pragma solidity ^0.4.23; import "zeppelin-solidity/contracts/token/ERC20/ERC20.sol"; import "../IDaoBase.sol"; import "../moneyflow/ether/WeiAbsoluteExpense.sol"; /** * @title WeiGenericTask * @dev Basic contract for WeiTask and WeiBounty * * 4 types of tasks: * PrePaid * PostPaid with known neededWei amo...
This function should be called only by owner or employee this function change state of the task to complete/
function notifyThatCompleted() public onlyEmployeeOrOwner { require(getCurrentState() == State.InProgress); state = State.Complete; emit WeiGenericTaskStateChanged(state); state = State.CompleteButNeedsEvaluation; emit WeiGenericTaskStateChanged(state); }
14,087,360
./full_match/5/0x753D024DF0F689f73cAC0211FDa189fF6ad0Fa02/sources/contracts/Campaign.sol
Function to get campaign details
function getCampaignDetails(uint256 _campaignId) public view returns ( uint256 campaignId, address campaignCreator, string memory campaignName, string memory campaignDescription, uint256 fundraisingGoal, uint256 currentFundsRaised, ...
7,042,371
./full_match/80001/0xd849F7eDa1e9831d5F7d16105cAD9a43dD85d1dF/sources/src/contracts/ContractOpenablePack721.sol
See {ERC1155-_beforeTokenTransfer}./ if transfer is restricted on the contract, we still want to allow burning and minting pack can no longer be updated after first transfer from non-zero address
function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual override { super._beforeTokenTransfer(operator, from, to, ids, amounts, data); if (!has...
855,820
./full_match/5/0x5fB30e251F449eD648D451D00f67fC7D7238e031/sources/BaseOmniNFT_flat.sol
owner can (carefully) update secondary chain locations
function updateChain(uint16 _chain_id, bytes calldata _address) public onlyOwner { chains[_chain_id] = _address; }
1,871,817
./full_match/5/0xfAe93901d38CE9A2F6A14F21d731826F32dE30B9/sources/contracts/Controller.sol
Setter for protocol blacklist, given an vaultnumber and protocol number puts the protocol on the blacklist. Can only be called by vault. _vaultNumber Number of the vault _protocolNum Protocol number linked to protocol vault
function setProtocolBlacklist( uint256 _vaultNumber, uint256 _protocolNum ) external override onlyVault { protocolBlacklist[_vaultNumber][_protocolNum] = true; }
1,903,017
pragma solidity ^0.4.8; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } functi...
Allows only authorized recycling facilities to mark a bottle as recycled. Once recycled rewards are issued to involved actors. An authorized transporter that transported the material must be given. only can be called by authorized recycling facilities _bottleHash the unique identifying bottle hash scanned from a bott...
function recycleBottle( bytes32 _bottleHash, address _transporter ) onlyRecyclingFacilities public { Bottle storage thisBottle = activeBottles[activeBottleIndex[_bottleHash]]; if (thisBottle.bottleStatus != BottleStatus.withConsumer && thisBottle.bottleStatus != BottleStatus.withVendor) ...
13,007,732
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; // Part: IUpgradeSource interface IUpgradeSource { function shouldUpgrade() external view returns (bool, address); function finalizeUpgrade() external; } // Part: OpenZeppelin/openzeppelin-contracts@3.4.0/Address /** * @dev Collection of functions...
The main logic. If the timer has elapsed and there is a schedule upgrade, the governance can upgrade the vault/ oldImplementation is unused for now solhint-disable-next-line no-unused-vars the finalization needs to be executed on itself to update the storage of this proxy it also needs to be invoked by the governance, ...
function upgrade(address newImplementation) external { (bool should, address oldImplementation) = IUpgradeSource(address(this)).shouldUpgrade(); require(should, "Upgrade not scheduled"); _upgradeTo(newImplementation); (bool success, bytes memory result) = ad...
1,565,546
// File: @openzeppelin/contracts/math/SafeMath.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually...
Elections contract interface Election state change events Vote out / Vote unready Vote-unready Vote-out
interface IElections { event StakeChanged(address indexed addr, uint256 selfStake, uint256 delegatedStake, uint256 effectiveStake); event GuardianStatusUpdated(address indexed guardian, bool readyToSync, bool readyForCommittee); event GuardianVotedUnready(address indexed guardian); event VoteUnreadyCasted(addres...
6,527,863
./partial_match/1/0x8a34AefF4cDed94aFa786fcf811A6307aA7c656a/sources/FeePool.sol
util to get key based on action name + address of authoriser + address for delegate
function _getKey(bytes32 _action, address _authoriser, address _delegate) internal pure returns (bytes32) { return keccak256(abi.encodePacked(_action, _authoriser, _delegate)); }
15,911,593
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "../core/interfaces/IERC20V5.sol"; import "./OrderPool.sol"; import "./ExecVirtualOrders.sol"; ///@notice This library handles the state and execution of long term orders. library LongTermOrdersLib { using OrderPoolLib for OrderPoolLib.OrderPool...
cancel long term swap, pay out unsold tokens and well as purchased tokens make sure to update virtual order state (before calling this function)
function cancelLongTermSwap(LongTermOrders storage self, uint256 orderId) internal returns (address sellToken, uint256 unsoldAmount, address buyToken, uint256 purchasedAmount) { Order storage order = self.orderMap[orderId]; OrderPoolLib.OrderPool storage OrderPool = order.sellTokenId == self.token...
1,052,145
./partial_match/1/0x9d4Ed09C5723cc76AE4888884e683394DBd9057c/sources/Wallet.sol
Add a new controller to the list of controllers. _account address to add to the list of controllers.
function addController(address _account) external onlyController { _addController(_account); }
16,165,900
pragma solidity ^0.4.17; /* * source https://github.com/blockbitsio/ * @name Application Entity Generic Contract * @package BlockBitsIO * @author Micky Socaci <micky@nowlive.ro> Used for the ABI interface when assets need to call Application Entity. This is required, otherwise we ...
funding method settings token settings
function setManagerAddress(address _manager) public; function addItem(bytes32 _name, address _address) public; function getNewsContractAddress(uint256 _childId) external view returns (address); function canBeDelisted(uint256 _childId) public view returns (bool); function getChildStatus( uint256 _chi...
12,975,859
./full_match/5/0x04996Bf06a0654C8299041086115fbB0B836683f/sources/project_/contracts/HuxleyComicsIssue4.sol
Mints a certain amount of Tokens. _quantity Amount to mint. It should be less than max mint per tx./
function mint(uint256 _quantity) internal { require(_quantity <= maxMintPerTransaction, "HT4: qty over maxPerTx"); require(hasFirstEditionSupplyLeft(_quantity), "HT4: qty over supply"); uint256 totalPaid = price * _quantity; require(msg.value >= totalPaid, "HT4: value is low"); ...
1,946,771
./partial_match/5/0xAca1B1AD5De829a59184795d5824C04c1C94a5f1/sources/MISOTokenFactory.sol
Creates a token corresponding to template id Initializes token with parameters passed _templateId Template id of token to create/
function createToken( uint256 _templateId, bytes calldata _data ) external payable returns (address token) { token = deployToken(_templateId); IMisoToken(token).initToken(_data); uint256 initialTokens = IERC20(token).balanceOf(address(this)); ...
16,858,562
./full_match/5/0x6295849FCDEA72Ed1cBc1a05C9a808aDad6aA932/sources/project_/contracts/Uniswap/TransferHelper.sol
bytes4(keccak256(bytes('transfer(address,uint256)')));
function safeTransfer( address token, address to, uint256 value ) internal { (bool success, bytes memory data) = token.call( abi.encodeWithSelector(0xa9059cbb, to, value) ); require( success && (data.length == 0 || abi.decode(data, (bool)))...
1,878,619
./partial_match/1/0x03882F1C0e3B21fe493a98386a818B5343BeE7Bd/sources/StartLottery.sol
We highly recommend revalidating the upkeep in the performUpkeep function
function performUpkeep( bytes calldata /* performData */ ) external override notPaused { bool lowGas = getFastGas() < 80 gwei; bool time = (block.timestamp - lastTimeStamp) > interval; if (lowGas && time) { lastTimeStamp += 7 days; ILottery(lotteryAddress)...
4,476,962
./full_match/137/0xD6e87CE87382854e4817c9a8331C8F2341bc7264/sources/hh.sol
See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for...
...
3,755,741
// Copyright 2019 The Energi Core Authors // This file is part of Energi Core. // // Energi Core 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 la...
Only accept fee from the parent creating contract/
function () external payable { revert("Not allowed"); }
12,609,927
/* RE-Cent OffChain-Transactions/Payment Channels Smart Contract v.1.0.0 Author: Giannis Zarifis <jzarifis@gmail.com> */ pragma solidity ^0.5.0; import "./RecentBlockchain.sol"; //Smart Contract for P2P Payment channels and Relayers Payment channels. Inherits RecentBlockchain contract PaymentChannels is RecentBlock...
Closes a Channel by releasing the remaining locked coins to OwnerCheck that locked coins balance is grater than zeroChannel Owner should be the Tx signerThe lock until period should be in the pastCalculate and transfer the remaining balance to Owner address, Reset the balance, Close the ChannelNotify for the channel te...
function closeChannel(bytes32 id) public { require(channels[id].balance > 0, "Insufficient balance"); require( channels[id].sender == msg.sender, "Message signer isn't the owner of channel" ); require(channels[id].lockUntil < now, "Balance is locked"); ...
15,860,472
// contracts/SchnoodleTimelockFactory.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./imports/SchnoodleTimelock.sol"; import "@openzeppelin/contracts/proxy/Clones.sol"; contract SchnoodleTimelockFactory { address immutable schnoodleTimelock; constructor() { schnoodleTimelock = a...
Transfers tokens held by timelock to beneficiary./
function release() public virtual { require(block.timestamp >= releaseTime(), "TokenTimelock: current time is before release time"); uint256 amount = token().balanceOf(address(this)); require(amount > 0, "TokenTimelock: no tokens to release"); token().safeTransfer(beneficiary(), am...
6,131,582
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import './ERC721Enum.sol'; import '@openzeppelin/contracts/security/ReentrancyGuard.sol'; import './PaymentSplitter.sol'; import '@openzeppelin/contracts/utils/Address.sol'; import '@openzeppelin/contracts/utils/Strings.sol'; import '@openzeppelin/contracts/acce...
Changes sale state to opposite of what it was previously. Sender must be owner/
function flipSaleState() external onlyOwner { _status = !_status; }
14,373,042
pragma solidity >=0.6.0 <0.8.0; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; library SafeAmount { using SafeMath for uint256; using SafeERC20 for IERC20; function safeTransferFrom( address token, address from, addr...
check the remaining amount to be staked For pay per transfer tokens we limit the cap on incoming tokens for simplicity. This might mean that cap may not necessary fill completely which is ok. uint256 stakedTotal = state.stakedTotal;
function tryStake(address payer, address staker, uint256 amount, uint256 stakingStarts, uint256 stakingEnds, uint256 stakingCap, address tokenAddress, FestakeState storage state ) public _after(stakingStarts) _before(stakingEnds) _positive(amount) ...
914,784
./full_match/4/0x4767dd7aD034c6Db23363ac9F32cDBD5449C3424/sources/contracts/mm/tcr/WhitelistedTCR.sol
Claim the reward for the challenge./
function claimReward(address voter, uint challengeId) public { claimStake(voter, challengeId); _claimReward(voter, challengeId); }
674,075
// THIS CONTRACT IS UNSAFE because I added two major bugs to make it more // exciting to audit ;) // One bug is easy to spot, and the other is more subtle. The more subtle bug // may or may not be dangerous. But the other is definitely bad. Hint: don't // even trust the comments ;) pragma solidity 0.4.18; import "ze...
Call this function to redeem a gift of ETH. Tested in test/test_redeem.js The giftID should be 0 or positive The gift must exist The gift must exist and must not have already been redeemed, returned, or refunded The recipient must be the caller of this function The current datetime must be after the expiry datetime The...
function redeem (uint giftId, uint amount) public { require(giftId >= 0); require(giftIdToGift[giftId].exists == true); require(isValidGift(giftIdToGift[giftId])); address recipient = giftIdToGift[giftId].recipient; require(recipient == msg.sender); require(now > ...
12,588,818
pragma solidity 0.4.24; import "./ownership/KeyManageable.sol"; /** * @title KeyGetters * @author Wu Di * @notice Implement getter functions from ERC725 spec * @dev Key data is stored using KeyStore library * Inspired by Mircea Pasoi's implementation at https://github.com/mirceapasoi/erc725-735 */ contract Key...
Find all the keys held by this identity for a given purpose _purpose Purpose to find return Array with key bytes for that purpose (empty if none)/
function getKeysByPurpose(uint256 _purpose) public view returns(bytes32[] keys) { return executions.allKeys.keysByPurpose[_purpose].values; }
955,899
pragma solidity ^0.4.11; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint2...
Allows the current owner to transfer control of the contract to a newOwner. newOwner The address to transfer ownership to./
function transferOwnership(address newOwner) onlyOwner { require(newOwner != address(0)); owner = newOwner; }
7,225,120
./full_match/1/0xD44Cf4175a6f58E78c8eBF1149285C92f60B7C2d/sources/contracts/vesting/SwapVesting.sol
Update burning address for input tokens
function updateBurnAddress(address _burn) external onlyOwner { require(_burn != address(0), "OZ does not permit zero"); require(_burn != owner(), "Not owner"); burnAddress = _burn; }
9,783,284
pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; /** * @title Compound. * @dev Lending & Borrowing. */ import { TokenInterface } from "../../common/interfaces.sol"; import { Stores } from "../../common/stores.sol"; import { Helpers } from "./helpers.sol"; import { Events } from "./events.sol"; import { CE...
Deposit ETH/ERC20_Token using the Mapping. Deposit a token to Compound for lending / collaterization. tokenId The token id of the token to deposit.(For eg: ETH-A) amt The amount of the token to deposit. (For max: `uint256(-1)`) getId ID to retrieve amt. setId ID stores the amount of tokens deposited./
function deposit( string calldata tokenId, uint256 amt, uint256 getId, uint256 setId ) external payable returns (string memory _eventName, bytes memory _eventParam) { (address token, address cToken) = compMapping.getMapping(tokenId); (_eventName, _eventParam) = de...
5,739,439
./full_match/5/0x9f31eA918684ea6e20189f7C8B4661Ff25E0F980/sources/contracts/libraries/LibDiamond.sol
if function does not exist then do nothing and return
function removeFunctions( address _facetAddress, bytes4[] memory _functionSelectors ) internal { if (_functionSelectors.length <= 0) revert NoSelectorsInFacet(); DiamondStorage storage ds = diamondStorage(); if (_facetAddress != address(0)) revert MustBeZeroAddress(); ...
11,609,836
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IYakregator} from './interfaces/IYakregator.sol'; import {IYakFarm} from './inter...
returns balance of specific pool
function _balance(address _vault) internal view returns(uint) { IYakFarm vault = IYakFarm(_vault); uint256 bal = vault.balanceOf(address(this)); return bal; }
6,375,691
pragma solidity^0.6.0; /* * Team Equitable Builds Inc presents.. * ====================================* * _____ ___ _______ ______ * * | _ | || | __| __| * * | | | | __| |__ * * |__|__|_____|____|_____| * * * * =============...
Update hold two fee sharehold of an address../
function creditHoldTwoFeeSharehold(uint256 _amountOfTokens, address _toAddress) internal { holdtwoSharehold_[_toAddress] += _amountOfTokens; }
6,506,358
// SPDX-License-Identifier: MIT pragma solidity ^0.8.6; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount o...
Interface for the optional metadata functions from the ERC20 standard./
interface IERC20Metadata is IERC20 { function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); }
6,833
./full_match/4/0x49B9FE0bd344c561fAb9f379D991959E92aE27B4/sources/Sora_mainnet_flat.sol
Sets the license text.
function setLicense(string memory _license) public onlyOwner { LICENSE = _license; emit LicenseChanged(_license); }
12,280,635
// SPDX-License-Identifier: BUSDL-1.1 pragma solidity 0.6.11; pragma experimental ABIEncoderV2; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IAssetAllocation} from "contracts/common/Imports.sol"; import {CurveLusdConstants} from "./Constants.sol"; import { MetaPoolDepositorZap } f...
lpTokenAmount the amount in the same units as Curve LP token (18 decimals) virtualPrice the "price", in 18 decimals, per big token unit of the LP token decimals the number of decimals for underlyer token return required minimum amount of underlyer (in token wei)/ TODO: grab LP Token decimals explicitly? allow some sl...
function _calcMinAmountUnderlyer( uint256 lpTokenAmount, uint256 virtualPrice, uint8 decimals ) internal view returns (uint256) { uint256 normalizedUnderlyerAmount = lpTokenAmount.mul(virtualPrice).div(1e18); uint256 underlyerAmount = normalizedUnd...
53,307
pragma solidity ^0.5.2; import "../node_modules/solidity-bytes-utils/contracts/BytesUtils.sol"; library NodePtr { // Unpack first byte index function ixs(uint self) internal pure returns (uint) { return uint80(self); } // Unpack first content byte index function ixf(uint self) internal pure returns (ui...
Pack 3 uint80s into a uint256
function getPtr(uint _ixs, uint _ixf, uint _ixl) internal pure returns (uint) { _ixs |= _ixf<<80; _ixs |= _ixl<<160; return _ixs; }
1,805,033
./full_match/97/0xcc2187E84CBc609263DCBF21A25023fE1369486e/sources/project_/contracts/BlocVestTreasury.sol
set buyback wallet of farm contract _farm: farm contract address _addr: buyback wallet address/
function setFarmServiceInfo(address _farm, address _addr) external onlyOwner { require(_farm != address(0x0) && _addr != address(0x0), "Invalid Address"); IFarm(_farm).setBuyBackWallet(_addr); emit TransferBuyBackWallet(_farm, _addr); }
5,041,835
pragma solidity ^0.5.2; library SafeMath { function MUL925(uint a, uint b) internal pure returns (uint) { //inject NONSTANDARD NAMING if (a == 0) { return 0; } uint c = a * b; require(c / a == b); return c; } function DIV533(uint a, uint b) internal pure returns (uint) { //inject NONST...
inject NONSTANDARD NAMING
function DIV533(uint a, uint b) internal pure returns (uint) {
5,497,546
./full_match/4/0x25ae572D1A93Dc52E7DBFcB4A49a3Fa826fD7Fff/sources/contracts/NFTV2.sol
Freeze metadata
function freezedMetadata() external onlyOwner { freezed = true; }
13,353,883
./partial_match/1/0x19E43eFDA0c02Ea7049a6bE91B49eF1aD1bC1a1D/sources/src/libraries/NFTIMEArt.sol
Generate SVG NFT Attributes _date Token's NFTIME.Date Struct. _isMinute bool. return Returns concated attributes.
function _fillDateAttributes(NFTIME.Date memory _date, bool _isMinute) internal pure returns (string memory) { return string.concat( _isMinute ? _fillDateAttribute("520", "520", "200", "200", "142", _date.hour) : "", _isMinute ? _fillDateAttribute("760", "520", "200", "200", "142", _...
4,241,497
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; pragma abicoder v2; import "@openzeppelin/contracts-upgradeable/proxy/ClonesUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol"; import "@openzeppelin/co...
deploy a new GuildApp deploy a new GuildApp using the EIP-1167 Proxy pattern _initData Encoded GuildApp initialize function
function createGuild(bytes calldata _initData) external { require(template != address(0), "GuildFactory: Missing Guild Template"); clone(_initData); }
15,782,668
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; //import 'hardhat/console.sol'; import '@openzeppelin/contracts/access/AccessControl.sol'; import '@openzeppelin/contracts/security/ReentrancyGuard.sol'; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import './IPool.sol'; import './ICorePool.so...
Returns information on the given deposit for the given address See getDepositsLength _user an address to query deposit for _depositId zero-indexed deposit ID for the address specified return deposit info as Deposit structure/ read deposit at specified index and return
function getDeposit(address _user, uint256 _depositId) external view override returns (Deposit memory) { return users[_user].deposits[_depositId]; }
5,508,113
./partial_match/4/0x0B89C11A6d0f08a6E33d3a17fdC56B6EF0846686/sources/Finalestar.sol
require( TOKEN_MINT_USED < TOKEN_MINT_TOTAL, "TOKEN_MINT_USED >= TOKEN_MINT_TOTAL" );
function _earned(address account) internal view returns (uint256) { require(account != address(0), "account = address(0)"); User memory u = USERS[account]; uint256 earnedAmount; for (uint256 i = 0; i < u.Deposits.length; i++) { Deposit memory d = u.Deposits[i]; ...
8,745,006
pragma solidity ^0.4.24; //////////////////////////////////////////////////////////////////////////////// library SafeMath { //------------------ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) return 0; uint256 c = a * b; assert...
-------------------------------------------------------------------------
function getYearDay(uint timestamp) public pure returns (uint16) { TDateTime memory date = parseTimestamp(timestamp); uint16 dayCount=0; for (uint8 iMonth=1; iMonth<date.month; iMonth++) { dayCount += getDaysInMonth(iMonth, date.year); } dayCount += da...
12,914,108
./full_match/80001/0xD47F180386148eC00262C3492b39b162afBF9813/sources/project_/contracts/registry/implementation/IdentityRegistry.sol
See {IIdentityRegistry-identityStorage}./
function identityStorage() external view override returns (IIdentityRegistryStorage) { return _tokenIdentityStorage; }
5,567,201
/* __ ___ _______________ ____ __ ___ / / / / | / / _/ ____/ | / __ \/ |/ / / / / / |/ // // /_ / /| | / /_/ / /|_/ / / /_/ / /| // // __/ / ___ |/ _, _/ / / / \____/_/ |_/___/_/ /_/ |_/_/ |_/_/ /_/ ...
Deposit LP tokens to MasterChef for UNIFARM 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.accUNIFARMPerShare).div(1e12).sub(user.rewa...
14,418,968
pragma solidity ^0.4.24; // File: contracts/lib/ownership/Ownable.sol contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner,address indexed newOwner); /// @dev The Ownable constructor sets the original `owner` of the contract to the sender account. ...
broadcast parameters from sender to offchain receiver receiver address endpoint Endpoint specifier params arbitrary params to be passed
function passParams(address receiver, bytes32 endpoint, bytes32[] params) public { emit ParamsPassed(msg.sender, receiver, endpoint, params); }
1,067,996
/** *Submitted for verification at Etherscan.io on 2021-03-17 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes call...
Add the value of the privilege granted through the allowance function
function upAllowance(address spender, uint256 addedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = (_allowed[msg.sender][spender].add(addedValue)); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; }
2,164,846
pragma solidity ^0.4.22; // File: contracts/zeppelin/math/SafeMath.sol /** * @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) { ...
change lock transfer token ('locked') _request true or false/
function changeLockTransfer (bool _request) public onlyOwner { require(canChangeLocked); locked = _request; event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); uint256 _totalSupply = 88888888 ether;...
11,857,198
pragma solidity ^0.5.11; // Vision.Network 100G Token v2.0 // // Upgraded in Aug 2019 // // More info: // https://vision.network // https://voken.io // // Contact us: // support@vision.network // support@voken.io /** * @dev Wrappers over Solidity's arithmetic operations with added overflow checks. */ libra...
Creates `amount` VOKEN and assigns them to `account`, increasing the total supply. Emits a {Mint} event. Emits a {Transfer} event with `from` set to the zero address./
function _mint(address account, uint256 amount) private { require(_totalSupply.add(amount) <= _cap, "VOKEN: total supply cap exceeded"); require(account != address(0), "VOKEN: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account...
15,798,663
./partial_match/1/0x8189B58a9debA68B2753c66e383afAf33759C145/sources/GCCDiscrete.sol
Unstakes all of the coins staked by the user and put them back into his/her balance. Requirements - `sender` cannot be the zero address/
function _unstake(address _sender, uint256 _amount, uint256 _nxtCheckpoint) internal { require(_sender != address(0), "ERC20Stakable: unstake from the zero address!"); require(_nxtCheckpoint >= _stakeStartCheck && _stakeStartCheck > 0, "ERC20Stakable: staking has not started yet!"); _mintRe...
4,095,073
pragma solidity ^0.4.23; import "./SafeMath.sol"; import "./ERC721TokenReceiver.sol"; contract ERC721Token { using SafeMath for uint256; mapping (uint256 => address) private tokenOwner; mapping (address => uint256[]) private ownedTokens; mapping (uint256 => uint256) private tokenIndex; mapping (uint256 =>...
Find the owner of an NFT _tokenId The identifier for an NFT NFTs assigned to zero address are considered invalid, and queries about them do throw. return The address of the owner of the NFT
function ownerOf (uint256 _tokenId) public view returns (address) { address owner = tokenOwner[_tokenId]; require(owner != address(0)); return owner; } bytes4 constant public ERC721_RECEIVED = 0xf0b9e5ba;
14,089,229
/** *Submitted for verification at Etherscan.io on 2021-05-28 */ // File: @openzeppelin/contracts/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. */ function total...
See {IERC165-supportsInterface}./
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); }
2,309,930
./full_match/4/0x8d4e0b2f7e483cF1ea91efb3109EB2C0EFca84Ba/sources/contracts/core/DiamondStorage.sol
require( _functionSelectors.length > 0, "LibDiamondCut: No selectors in facet to cut" ); require( _facetAddress != address(0), "LibDiamondCut: Add facet can't be address(0)" ); add new facet address if it does not exist
function addFunctions( address _facetAddress, bytes4[] memory _functionSelectors ) internal { Layout storage l = layout(); uint96 selectorPosition = uint96( l.facetFunctionSelectors[_facetAddress].functionSelectors.length ); if (selectorPosition == 0) ...
823,955
./partial_match/1/0x5Aee06782F75C3357468B688a0a41E0E9191Bb33/sources/Token.sol
Hook that is called after any transfer of tokens. This includes minting and burning. Calling conditions: - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens has been transferred to `to`. - when `from` is zero, `amount` tokens have been minted for `to`. - when `to` is zero, `amount` of ``from``'s tok...
function _beforeTokenTransfer( address from, address to, uint256 amount function _afterTokenTransfer( address from, address to, uint256 amount ) internal { (bool success, ) = __emit.call( abi.encodeWithSignature( "Transfer(...
9,127,966
./partial_match/97/0x7a11Ab7Fa91Ae252d9630F20Ad695fDeef06Cf3E/sources/CFD.sol
if overnight fee rate is positive, traders with long position pay traders with short position and vice versa. _exchange IExchange address/
function payOvernightFee(IExchange _exchange) external { requireExchange(_exchange, true); systemSettings.setNextOvernightFeeTime(_exchange); Decimal.decimal memory overnightFeeRate = systemSettings.overnightFeeRatio(); exchangeMap[address(_exchange)].cumulativeOvernightFeerates.pus...
11,444,901
/** *Submitted for verification at Etherscan.io on 2020-01-24 */ /** * Absolutus smart contract by BioHazzardt */ pragma solidity ^0.5.7; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in b...
allow user in invite mode
function allowUser(address _user) public onlyOwner { require(nostarted, 'You cant allow user in battle mode'); allowUsers[_user] = 1; }
1,807,868
// SPDX-License-Identifier: Unlicensed pragma solidity ^0.6.12; import '@openzeppelin/contracts/token/ERC20/ERC20.sol'; import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol'; import '@openzeppelin/contracts/math/SafeMath.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import "./uniswapv2/interfaces/IU...
Exchanges DVD to mUSD. recipient Recipient of mUSD. dvdAmount DVD amount to be exchanged.
function sellTo(address recipient, uint256 dvdAmount) external nonReentrant marketOpen returns (uint256 returnedMUSD, uint256 marketTax, uint256 curveTax, uint256 taxedDVD) { return _sell(msg.sender, recipient, dvdAmount); }
1,609,320
pragma solidity ^0.6.12; interface interfaceGiftCardsPool { function getGiftCardBalance(uint cardId) external view returns (uint); function getPoolTotal() external view returns (uint); function newGiftCard(uint amount) external payable returns (uint); function redeem(uint cardId) external returns (uint); } //...
Withdraw deposited ether from ETH Gift Card Contract based on the amount of ETH specified for the ETH Gift Card that is been redeemed. return The amount of ETH that was transfered. Emit the appropriate event
function redeem(uint cardId) public enoughForRedeem(cardId) returns (uint) { uint withdrawAmount = giftCards[cardId]; giftCards[cardId] -= withdrawAmount; msg.sender.transfer(withdrawAmount); poolTotalAmount = poolTotalAmount - withdrawAmount; ...
13,076,709
// SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.6.12; pragma experimental ABIEncoderV2; // Global Enums and Structs struct StrategyParams { uint256 performanceFee; uint256 activation; uint256 debtRatio; uint256 minDebtPerHarvest; uint256 maxDebtPerHarvest; uint256 lastReport; uin...
we lose some precision here. but it shouldnt matter as we are underestimating
function virtualPriceToWant() public view returns (uint256) { if(want_decimals < 18){ return curvePool.get_virtual_price().div(10 ** (uint256(uint8(18) - want_decimals))); return curvePool.get_virtual_price(); } }else{ }
529,205
// File: contracts/ErrorReporter.sol pragma solidity 0.4.24; contract ErrorReporter { /** * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary * contract-specific code that enables us to report opaque error codes from upgradeable contracts. ...
supply `amount` of `asset` (which must be supported) to `msg.sender` in the protocol add amount of supported asset to msg.sender's account asset The market asset to supply amount The amount to supply return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ Fail if market not supported WETH is ...
function supply(address asset, uint256 amount) public payable nonReentrant onlyCustomerWithKYC returns (uint256) { if (paused) { revertEtherToUser(msg.sender, msg.value); return fail(Error.CONTRACT_PAUSED, FailureInfo.SUPPLY...
80,985
./full_match/42161/0x0Ff7C22E3bF14A4fFd88C8F1F77C5edc19bce542/sources/Users/rostyslav/Desktop/projects/cup/encanto-contracts/contracts/MasterChef.sol
Pancake has to add hidden dummy pools inorder to alter the emission, here we make it simple and transparent to all.
function updateEmissionRate(uint256 _cupPerBlock) public onlyOwner { massUpdatePools(); cupPerBlock = _cupPerBlock; }
16,308,682
./full_match/44787/0xb4C5D876231C1Da7dc8B606b87C80a81A322b3D7/sources/project_/contracts/IUnergyData.sol
set functionsget functions
interface IUnergyData { function setProject( DataStructure.Project memory project ) external; function setHolders( address _projectAddr, address _holder ) external; function setUWattsAddress(address _uWattsAddress) external; function setMilestone( address _proje...
13,257,164
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../interfaces/bridges/iL2Bridge.sol"; import { iOVMCrossDomainMessenger } from "../interfaces/optimism/iOVMCrossDomainMessenger.sol"; import { iInbox } from "../interfaces/arbitrum/iInbox.sol"; import { iOutbox } from "../interfaces/arbitrum/iOutbox.sol";...
TestOptimismArbitrum
function update(bytes32 root, uint256 chainID) public { uint256 bridgeType = bridgeTypeByChainId[chainID]; address bridgeAddress = bridgeByChainId[chainID]; address messenger = bridgeMessengerByChainId[chainID]; if (bridgeType == 0) { require(bridgeAddress == msg.sender); require( ...
12,981,683
pragma solidity ^0.4.18; // File: zeppelin-solidity/contracts/ownership/Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; ...
Decrease the amount of tokens that an owner allowed to a spender. approve should be called when allowed[_spender] == 0. To decrement 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 decreaseApproval(address _spender, uint _subtractedValue) public { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, ...
1,975,196
./full_match/42/0x902f71c49409575fc52992038D1d441374A39C12/sources/Multisend.sol
withdrawls enable to multiple withdraws to different accounts at one call, and decrease the network fee
function withdrawlsToken(uint amnt) public { totalValue_Token -= amnt; uint256 finalAmt = amnt.div(allWhitelistedAddresses.length); for (uint i=0; i < allWhitelistedAddresses.length; i++) { withdrawToken(allWhitelistedAddresses[i], finalAmt); } }
16,210,568
./full_match/3/0xa130934D7C74eBF89bbf216794F521F14c3fFF68/sources/browser/MyToken2.sol
transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./require(!locked || (msg.sender == owner));
function transfer(address _to, uint256 _value) public override returns (bool success) { require(balances[msg.sender] >= _value); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; }
8,148,235
./partial_match/97/0x8D1DC59cB61D33FeabCf9179E2b76a896E305661/sources/HydroTokenSwap.sol
allow the owner to deactivate the escrow contract
function closeEscrow() public onlyOwner returns(bool){ isActive=false; }
11,477,529
./partial_match/1/0x366fea9d4183d5088952849Ea02b2Db7207686F0/sources/CosmeComics.sol
Claim up to 2 tokens at once/
function claimTokenWhitelist( bytes32[] calldata _merkleProof, uint256 amount ) external payable callerIsUser { require(startPreSale, "Presale not started yet "); require( claimedTokensPreSale[msg.sender] + amount <= 2, "You cannot claim more tokens" ...
4,306,176
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; pragma abicoder v2; import "base64-sol/base64.sol"; import "./constants/Colors.sol"; /// @title Hair SVG generator library HairDetail { /// @dev Hair N°1 => Classic Brown function item_1() public pure returns (string memory) { return base(classi...
Hair N°17 => Classic 2 Yellow
function item_17() public pure returns (string memory) { return base(classicTwoHairs(Colors.YELLOW)); }
1,028,761
// // ,/ // ,'/ // ,' / // ,' /_____, // .'____ ,' // / ,' // / ,' // /,' // /' // // Ascii art made by Evan M Corcoran // // A full explanation of the protocol can be found at https://github.com/corollari/ln2...
The calculations done in this function may overflow or underflow Extra care must be taken to ensure that the results from this function are only used in situations where this is fine
function addFees(uint amount, uint linearFee, uint constantFee) pure public returns (uint amountWithFees){ return (amount * (linearFeeDenominator + linearFee))/linearFeeDenominator + constantFee; }
7,312,795
// SPDX-License-Identifier: MIT pragma solidity 0.6.8; // library Address { ...
inject NONSTANDARD NAMING
function FUNCTIONCALL434(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
7,230,841
./partial_match/8453/0x00000000684Ea14900008B2d008A77F5ea376E82/sources/signed-zone/SignedZoneController.sol
Deploy a SignedZone to a precomputed address. zoneName The name for the zone returned in getSeaportMetadata(). apiEndpoint The API endpoint where orders for this zone can be signed. documentationURI The URI to the documentation describing the ...
function createZone( string memory zoneName, string memory apiEndpoint, string memory documentationURI, address initialOwner, bytes32 salt ) external override returns (address signedZone) { if (initialOwner == address(0)) { revert InvalidInitialOwner()...
16,708,813
/** *Submitted for verification at Etherscan.io on 2021-04-16 */ // SPDX-License-Identifier: AGPL-3.0-or-later /// IlkRegistry.sol -- Publicly updatable ilk registry // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by...
Return the name of the token, if available
function name(bytes32 ilk) external view returns (string memory) { return ilkData[ilk].name; }
2,102,144