file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./partial_match/1/0x2C337F74a52005EdBFb931f82Ba7743189fC8024/sources/contracts/protocol/tokenization/PToken.sol
@inheritdoc IPToken
function transferUnderlyingTo( address target, uint256 amount, DataTypes.TimeLockParams calldata timeLockParams ) external virtual override onlyPool { if (timeLockParams.releaseTime != 0) { ITimeLock timeLock = POOL.TIME_LOCK(); uint256[] memory amounts = ...
4,320,337
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.7.6; pragma abicoder v2; import './SafeMath.sol'; import './AggregatorV3Interface.sol'; import './Wallet.sol'; // Crowdsale contract for ZAPP. Functionalities: // - Timed: opens Jan 14, 2021, 6:00:00PM UTC (1610647200) and closes Feb 14, 2021, 6:00:00PM UTC (1...
return Whether the Bounty Hunter is verified by Zappermint/
function isHunterVerified(address addr) public view returns (bool) { return _wallets[addr].hunter.verified; }
12,585,366
// SPDX-License-Identifier: MIT pragma solidity >=0.7.0 <0.9.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "./AddrArrayLib.sol"; struct CreditLine { uint256 maxCredit; uint256 usedCredit; address owner; address spender; // recipient of the credit line bool exists; } struct Pro...
Used to lock funds up by credit giver (msg.sender) to a certain person they trust, overriding existing credits!/
function setCreditLine(address spender, uint256 amount) public returns (bool) { return setCreditLine(msg.sender, spender, amount); }
5,371,841
pragma solidity ^0.4.21; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) constant returns (uint256); function transfer(address to, uint256 value) re...
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 uint256 the amout of tokens to be transfered/ Check is not needed because sub(_allowance, _value) will already throw if this condition is not met requi...
function transferFrom(address _from, address _to, uint256 _value) returns (bool) { var _allowance = allowed[_from][msg.sender]; balances[_to] = balances[_to].add(_value); balances[_from] = balances[_from].sub(_value); allowed[_from][msg.sender] = _allowance.sub(_value); Transfer(_from, _to, _val...
55,319
./partial_match/3/0xfe84AF11195Ab3bb81399d37c79164359b337Ae6/sources/PrizeDistribution.sol
Returns a competition by ID./
function getCompetition( uint _competitionId ) public competitionExists(_competitionId) view returns ( string memory, address, string memory, uint256, uint256, uint256, bool, uint256, uint256, uint256, uint256 ) { Competition storage competition = competitions[_...
5,254,402
./partial_match/1/0x2f102b13B0e5510e1c64350a56b33769f57C8A62/sources/CommonCents.sol
Set tax wallets/
function setTaxWallets(uint256 taxWalletID, address addr, uint256 percent) external onlyOwner { taxWallets[taxWalletID] = addr; taxWalletAllocs[taxWalletID] = percent; }
2,837,446
./full_match/43114/0xD97B4D013b31df04b6917Dc318D3197169c36bFD/sources/contracts/LongShort.sol
Allows users to shift their position from short to long in a single transaction. To prevent front-running these shifts are executed on the next price update from the oracle. marketIndex An uint32 which uniquely identifies a market. amountSyntheticTokensToShift Amount in wei of synthetic tokens to shift from the short...
function shiftPositionFromShortNextPrice(uint32 marketIndex, uint256 amountSyntheticTokensToShift) external override { shiftPositionNextPrice(marketIndex, amountSyntheticTokensToShift, false); } ╚════════════════════════════════╝*/
4,519,996
// SPDX-License-Identifier: MIT pragma solidity >=0.7.0; pragma abicoder v2; /// @title verifyIPFS /// @author Martin Lundfall (martin.lundfall@gmail.com) library verifyIPFS { bytes constant private prefix1 = hex"0a"; bytes constant private prefix2 = hex"080212"; bytes constant private postfix = hex"18"; bytes...
Compares an IPFS hash with content
function verifyHash(string memory contentString, string memory hash) internal pure returns (bool) { return equal(generateHash(contentString), bytes(hash)); }
1,022,659
./partial_match/137/0x83006b5c56F909A97256a5678Fcc54E2b444528d/sources/contracts/STOA.sol
Returns timestamp for end of period
function getPeriodEnd() external view returns (uint256 timestamp) { timestamp = currentPeriod.end; }
3,522,161
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; pragma abicoder v2; // Inherited allowing for ownership of contract import "./interfaces/ISafemoonLottery.sol"; import "./interfaces/IRandomNumberGenerator.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/access/Ownable.so...
Calculate final price for bulk of tickets _priceTicket: price of a ticket _numberTickets: number of tickets purchased/
function _calculateTotalPriceForBulkTickets( uint256 _priceTicket, uint256 _numberTickets ) internal view returns (uint256) { uint256 discount = _discount(_numberTickets,_priceTicket); uint256 totalCost = _priceTicket *_numberTickets; return totalCost - discount; } ...
13,056,057
/** * Copyright 2017-2020, bZeroX, LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0. */ pragma solidity 0.5.17; pragma experimental ABIEncoderV2; import "../mixins/LiquidationHelper.sol"; import "../interfaces/ILoanPool.sol"; import "./LoanClosingsShared.sol"; /** * @title LoanClosingsR...
Internal function for roll over a loan. Each loan has a duration. In case of a margin trade it is set to 28 days, in case of borrowing, it can be set by the user. On loan openning, the user pays the interest for this duration in advance. If closing early, he gets the excess refunded. If it is not closed before the end ...
function _rollover(bytes32 loanId, bytes memory loanDataBytes) internal { (Loan storage loanLocal, LoanParams storage loanParamsLocal) = _checkLoan(loanId); require(block.timestamp > loanLocal.endTimestamp.sub(3600), "healthy position"); require(loanPoolToUnderlying[loanLocal.lender] != address(0), "invalid lend...
6,409,608
./full_match/5/0x9f6005EeEec2c45f211Eee6CB350d9f1c93E64bC/sources/contracts/SocialNetwork.sol
Remove a connection from the message senders network. It's important to note that the _address parameters should both be encrypted using the message senders public key./
function removeConnection(string memory _address) public { for (uint i = 0; i < connections[msg.sender].length; i++) { if ( keccak256(abi.encodePacked(connections[msg.sender][i])) == keccak256(abi.encodePacked(_address)) ) { connections[msg.sender][i] ...
7,035,317
./partial_match/56/0xD50aAb6B210fe049B6c5262f5A7676204699AB8E/sources/Vault.sol
Withdraw token from the lending and burning ibToken.
function withdraw(uint256 share) external override accrue(0) nonReentrant { uint256 amount = share.mul(totalToken()).div(totalSupply()); _burn(msg.sender, share); if (token == config.getWrappedNativeAddr()) { SafeToken.safeTransfer(token, config.getWNativeRelayer(), amount); WNativeRelayer(uin...
11,079,626
/** *Submitted for verification at Etherscan.io on 2021-04-01 */ // File: contracts\modules\SafeMath.sol pragma solidity =0.5.16; // a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math) library SafeMath { function add(uint x, uint y) internal pure returns (uint ...
Retrieve the unlocked collateral worth, the worth of collateral which currently used for options, priced in USD./
function getUnlockedCollateral()public view returns(uint256){ return safeSubCollateral(getTotalCollateral(),_FPTCoin.getTotalLockedWorth()); }
2,419,749
./full_match/4/0x8edd685CB964A78C1a82C3059F3FAce2BFaA5F3F/sources/contracts/JBTokenStore.sol
/ An amount must be specified. Mint the equivalent amount of ERC20s. Add to the unclaimed balance and total supply.
function mintFor( address _holder, uint256 _projectId, uint256 _amount, bool _preferClaimedTokens ) external override onlyController(_projectId) { if (_amount == 0) { revert TOKEN_AMOUNT_ZERO(); } _token != IJBToken(address(0)); if (_shouldClaimTokens) { _token.mint(...
12,506,105
./partial_match/1/0xcC046Cd809f1cb9102ddb14f389E86765203D61C/sources/FarmMain.sol
require(!setup.active || block.number >= setup.endBlock, "Not valid activation"); set new setup update old setup update new setup update new setup
function _toggleSetup(uint256 setupIndex) private { FarmingSetup storage setup = _setups[setupIndex]; require(block.number > _setupsInfo[setup.infoIndex].startBlock, "Too early for this setup"); if (setup.active && block.number >= setup.endBlock && _setupsInfo[setup.infoIndex].renewTimes =...
4,298,929
/** * Copyright 2017-2019, bZeroX, LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0. */ pragma solidity 0.5.3; pragma experimental ABIEncoderV2; import "../openzeppelin-solidity/Math.sol"; import "../proxy/BZxProxiable.sol"; import "../shared/OrderTakingFunctions.sol"; contract OrderTa...
Approves a hash on-chain using any valid signature type. After presigning a hash, the preSign signature type will become valid for that hash and signer. signer Address that should have signed the hash generated by the loanOrder parameters given. orderAddresses Array of order's makerAddress, loanTokenAddress, int...
function preSign( address signer, address[8] calldata orderAddresses, uint256[11] calldata orderValues, bytes calldata oracleData, bytes calldata signature) external nonReentrant { _preSign( signer, _getLoanOrderHash(orderAd...
12,957,434
./full_match/1/0x970a5540FB72c4932420F430d035df9057C4ff92/sources/contracts/SkrimplesBoneyard.sol
Add a new token to the pool. Can only be called by the owner. DO NOT add the same token more than once. Rewards will be messed up if you do.
function addToken(uint256 _allocPoint, IERC20 _pToken, bool _withUpdate) public { require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Caller is not admin"); if (_withUpdate) { massUpdatePools(); } uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlo...
3,159,032
./full_match/11155111/0x86A85e145ed21247633AdBC545DC30f4eD0E9916/sources/contracts/MetaDisplay.sol
Generate a unique ID for the collection Create the collection object
function createCollection(string memory _id, address _owner, string memory _profile, string memory _cover, string memory _title, string memory _description, string memory _date, string memory _category) public payable { bytes32 collectionId = keccak256(abi.encodePacked(_id)); Collections memory col...
3,802,357
// Dependency file: @openzeppelin/contracts/math/SafeMath.sol // SPDX-License-Identifier: MIT // pragma solidity >=0.6.0 <0.8.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, becau...
Returns the division of two unsigned integers, with a division by zero flag. _Available since v3.4._/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); }
6,285,046
./full_match/1/0xeae422887230C0FFB91Fd8F708f5fdD354C92F2F/sources/contracts/modules/MerkleDropMinter.sol
@inheritdoc IERC165/
function supportsInterface(bytes4 interfaceId) public view override(IERC165, BaseMinter) returns (bool) { return BaseMinter.supportsInterface(interfaceId) || interfaceId == type(IMerkleDropMinter).interfaceId; }
9,817,568
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.11; // @title Blockfunding crowdfunding // @notice A smart contract for development purposes, ready to be used in a crowdfunding application using the Ethereum blockchain // contract Crowdfunding { Project[] private allProjects; // // Eve...
Once a crowdfunding goal has been met, the creator can pay himself the balance None return None, only an event is emitted check if projectEnded, already payed out or not in State RAISED revert
function payOut() external { require(msg.sender == creator, "Only the creator of the project can pay out the raised amount once the funding goal has been met."); require(checkIfProjectEnded() == true, "The goal hasn't been raised yet. Please wait longer and check for the end using checkIfProjectEnd...
7,242,048
// 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_533(address spender, uint value) public returns (bool ok) { _approvals[msg.sender][spender] = value; emit Approval( msg.sender, spender, value ); return true; }
6,454,246
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.6; import {CrowdfundWithEditionsProxy} from "./CrowdfundWithEditionsProxy.sol"; import {CrowdfundWithEditionsLogic} from "./CrowdfundWithEditionsLogic.sol"; import {ICrowdfundWithEditions} from "./interface/ICrowdfundWithEditions.sol"; import {ITributary...
============ Internal Methods ============ This first case is the happy path, so we will keep it efficient. The balance, which includes the current contribution, is less than or equal to cap. Mint equity for the contributor. Editions start at 1, so a "0" edition means the user wants to contribute without purchasing a ...
function _contribute( address payable backer, uint256 editionId, uint256 amount ) private { require(status == Status.FUNDING, "Crowdfund: Funding must be open"); require(amount == msg.value, "Crowdfund: Amount is not value sent"); if (address(this).balance <= fund...
7,002,817
// File: @aragon/os/contracts/common/UnstructuredStorage.sol /* * SPDX-License-Identitifer: MIT */ pragma solidity ^0.4.24; library UnstructuredStorage { function getStorageBool(bytes32 position) internal view returns (bool data) { assembly { data := sload(position) } } function getStorage...
Copy all option addresses
for (uint256 i = 0; i < numberOfOptions; i++) { bytes32 canKey = actions[_actionId].optionKeys[i]; uint256 optionData = uint256(optionAddresses[canKey]); function addAddressesAndActions( uint256 _actionId, bytes script, uint256 numberOfOptions, uint256...
5,443,727
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20SnapshotUpgradeable.sol"; impor...
Returns the number of payments received so far./
function receivedPaymentsCount() public view returns (uint256) { return _received.length; }
12,586,794
./full_match/5/0x1A3e1AD9bF909F97B8703aF906347949520986f7/sources/src/Contract.sol
Returns the metadata URI for the given tokenId.
function uri(uint256 _tokenId) public view virtual override returns (string memory) { string memory batchUri = _getBaseURI(_tokenId); return string(abi.encodePacked(batchUri, _tokenId.toString())); } CLAIM LOGIC address indexed claimer, address indexe...
7,089,870
./full_match/5/0x0F219E04a41194Aa612dc8F7046C5D4B77C7FF61/sources/src/KUMABondToken.sol
See {IERC721-transferFrom}. Adds the following conditions to the call : - Caller, from and to must not be blacklisted - Contract must not be paused/
function transferFrom(address from, address to, uint256 tokenId) public override(ERC721, IERC721) whenNotPaused notBlacklisted(msg.sender) notBlacklisted(from) notBlacklisted(to) { if (!_isApprovedOrOwner(_msgSender(), tokenId)) { revert Errors...
1,923,567
//Address: 0x3f60a98202cf7ac8be9afc077e6c28f2638009f4 //Contract name: RandomLedgerService //Balance: 0 Ether //Verification Date: 8/23/2017 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^0.4.15; //MMMMMMM*~+> Self-documenting smart contract. <+~*M // // MMMMWKkk0KNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM...
Let owner customize defauts. Allow the owner to set max.
function setMax(uint256 _max) onlyOwner public returns (bool) { defaultMax = _max; return true; }
5,410,408
./full_match/7700/0x9B2a63F27661A468E2da22226b64A4914144f195/sources/contracts/mixins/SettleLayer.sol
Handles the single sided settlement of a token or native ETH flow. /
function transactFlow (address debitor, address creditor, int128 flow, address token, uint128 bookedEth, bool useReserves) private { if (isDebit(flow)) { debitUser(debitor, uint128(flow), token, bookedEth, useReserves); creditUser...
4,651,372
/** * Allocations.sol v1.0.0 * * Bilal Arif - https://twitter.com/furusiyya_ * Notary Platform */ pragma solidity ^0.4.16; contract Allocations{ // timestamp when token release is enabled uint256 private releaseTime; mapping (address => uint256) private allocations; function Allocations(){ releas...
returns releaseTime/
function RealeaseTime() external constant returns(uint256){ return releaseTime; }
13,077,095
pragma solidity ^0.4.17; /** * @title Ethereum-Lottery * @dev Simple lottery smart contract to run on the Ethereum * chain. Designed to (hopefully) work well with a web3 front-end. * Source of randomness comes from ethereum block hashes. * */ contract Lottery { event LotteryTicketPurchased(address indexed ...
for now, have ticket purchasing only through functions for sanity purposes
function() payable public { revert(); }
5,477,047
pragma solidity ^0.4.24; import "./FairyOwnership.sol"; // 돈을 지불하고 요정을 업그레이드 하는 기능들 contract FairyPayToUpgrade is FairyOwnership { event CustomLevelUp(uint256 indexed fairyId); event IncreaseHPPointPerLevel(uint256 indexed fairyId); event IncreaseAttackPointPerLevel(uint256 indexed fairyId); event I...
돈을 지불하고 레벨 당 물 속성 증가 포인트를 올립니다. 임의로 포인트를 증가시키는데 드는 포인트당 가격과 비교합니다. 레벨 당 물 속성 증가 포인트를 올립니다. 회사에게 금액의 50%를 지급합니다. 요정의 디자이너에게 금액의 50%를 지급합니다.
function increaseWaterPointPerLevel(uint256 fairyId) whenServiceRunning whenNotBlocked whenNotBlockedFairy(fairyId) onlyMasterOf(fairyId) payable public { Fairy storage fairy = fairies[fairyId]; require(msg.value == increasePointPricePerPoint * fairy.waterPointPerLevel.add(1)); fairy.waterPointPerLevel ...
14,053,565
/** * This smart contract code is Copyright 2017 TokenMarket Ltd. For more information see https://tokenmarket.net * * Licensed under the Apache License, version 2.0: https://github.com/TokenMarketNet/ico/blob/master/LICENSE.txt * ** Code Modified by : TokenMagic ** Change Log: *** Solidity version upgra...
This is for manual testing of multisig wallet interaction /
function setOwnerTestValue(uint val) onlyOwner public { ownerTestValue = val; }
1,815,196
pragma solidity ^0.4.21; contract OraclizeI { address public cbAddress; function query(uint _timestamp, string _datasource, string _arg) external payable returns (bytes32 _id); function query_withGasLimit(uint _timestamp, string _datasource, string _arg, uint _gaslimit) external payable returns (bytes32 _i...
house edge cannot be set > 5%, can be set to zero for promotions
function setHouseEdge(uint8 houseEdgeInThousandthPercents) public { require(msg.sender == OWNER && houseEdgeInThousandthPercents <= 50); HOUSEEDGE_inTHOUSANDTHPERCENTS = houseEdgeInThousandthPercents; }
450,592
/* * Call-Logic: * 1) The fallback function dispataches the call to the multiCall function * 2) The multiCall function calls each head sequentially * 3) The multiCall returns the response (or signals a discrepancy) * 4) The fallback function returns to the caller or pays out the bounty * * | Head1...
Invoked if a head called a function that interacts with the blockchain. Call data format: The last 32 bytes of the call data represent the type of callback: [0 - 4] LOGi [5] CALL [6] BALANCE The rest of the data is structured as follows BALANCE : input [address (32), callType (32)] ...
function headCallback() private { assert(!discrepancy); uint256 callbackType = uint256(msg.data[msg.data.length - 1]); if (DEBUG_MODE) { InCallBack(msg.data.length, callbackType, msg.sender); } uint256 mem = _malloc(msg.data.length); _calldatacopy(mem, ...
12,623,237
pragma solidity ^0.8.0; // File: @openzeppelin/contracts/utils/Context.sol /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * m...
Returns the proper tokenURI only after the startingIndex is finalized./
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); if(startingIndex != 0 && block.timestamp >= REVEAL_TIMESTAMP) { string memory base = baseURI(); if...
1,102,328
./full_match/1/0xc96Bc3886a105021eC3819026aB6dBB39B2a3419/sources/contracts/PurchaseMinter.sol
Mints Singular Artist/
function MintArtist(uint ArtistID, uint Amount) public payable nonReentrant { require(Artists[ArtistID]._Active, "Purchasing Not Active"); require(msg.value == Amount * Artists[ArtistID]._Price, "Invalid Message Value"); require(Amount > 0, "Invalid Amount"); for(uint x; x < Am...
9,760,011
/* - ✔️ Supply Name: Pearl of the Orient Seas - Creating a better life for everyone - ✔️ Symbol: PEARL - ✔️ Anti-Whale System (3% Sell Price Impact) - ✔️ Anti-Serial Selling System (Anti-Dump) - ✔️ Manual Burning and Buyback capability - ✔️ Send to Buyback Wallet per transaction: 2% (Sent on ETH) - ✔️ Send to Marketin...
NOTE Can only be called by the current owner./
function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "CVOwnable: new owner is the zero address"); _setOwner(newOwner); }
12,158,089
// SPDX-License-Identifier: MIT pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /* Interface Imports */ import { iOVM_ECDSAContractAccount } from "../../iOVM/accounts/iOVM_ECDSAContractAccount.sol"; /* Library Imports */ import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol"; import { ...
Returns the subtraction of two unsigned integers, reverting on overflow (when the result is negative). Counterpart to Solidity's `-` operator. Requirements: - Subtraction cannot overflow./
function sub(uint256 a, uint256 b) internal returns (uint256) { return sub(a, b, "Lib_SafeMathWrapper: subtraction overflow"); }
10,429,866
pragma solidity ^0.4.2; // ERC20 Token Interface contract Token { uint256 public totalSupply; function balanceOf(address _owner) public constant returns (uint256 balance); function transfer(address _to, uint256 _value) public returns (bool success); function transferFrom(address _from, address _to, uin...
Gets the (owners address, Ethereum sale price, PXL sale price, last update timestamp, whether its in private mode or not, when it becomes public timestamp, flag) for a PropertyIf it's in private, but it has expired and should be public, set our bool to be public
function getPropertyData(uint16 propertyID, uint256 systemSalePriceETH, uint256 systemSalePricePXL) public view returns(address, uint256, uint256, uint256, bool, uint256, uint8) { Property memory property = properties[propertyID]; bool isInPrivateMode = property.isInPrivateMode; if (isInPriv...
1,158,139
./partial_match/1/0x76c18cc80c9a5262Baf8E0be557c47053C5A3A50/sources/src/aevo/AevoDeposit.sol
Deposit an amount of the l1Token to the accounts balance on L2 using an EIP-2612 permit signature Gets called by a keeper which relays the signature account The account to transfer the tokens from amount Amount of the l1Token to deposit fee Amount of the l1Token to charge as a fee deadline A timestamp, the current...
function deposit(address account, uint256 amount, uint256 fee, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external { l1Token.permit(account, address(this), amount, deadline, v, r, s); l1Token.safeTransferFrom(account, address(this), amount); l1Bridge.depositERC20To(addres...
9,365,202
// SPDX-License-Identifier: MIT /* First satirical on-chain generative text NFT about NFT firsts. Don't sleep on this historic collection. 0xdeafbeef 2021-09-06 */ /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the foll...
See {IERC721Metadata-tokenURI}./ If there is no base URI, return the token URI. If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { return (""); require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory _tokenURI = _tokenURIs[tokenId]; string memory base = baseURI(); if (bytes(ba...
6,280,729
/** * ┌───┐░░░┌┐░┌─┐┌─┐░░░░░┌┐░░░░░ * │┌──┘░░░││░││└┘││░░░░┌┘└┐░░░░ * │└──┬┐┌┬┤│░│┌┐┌┐├──┬─┼┐┌┼┐░┌┐ * │┌──┤└┘├┤│░││││││┌┐│┌┘││││░││ * │└──┼┐┌┤│└┐││││││└┘││░│└┤└─┘│ * └───┘└┘└┴─┘└┘└┘└┴──┴┘░└─┴─┐┌┘ * ░░░░░░░░░░░░░░░░░░░░░░░░┌─┘│░ * ░░░░░░░░░░░░░░░░░░░░░░░░└──┘░ * @author: pickle_rick */ pragma solidity ^0.4.23;...
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 uint256 the amount of tokens to be transferred/
function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from...
5,915,762
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "./Interfaces/ILosslessER...
If address is protected, transfer validation rules have to be run inside the strategy. isTransferAllowed reverts in case transfer can not be done by the defined rules.
function beforeTransfer(address _sender, address _recipient, uint256 _amount) override external { ILERC20 token = ILERC20(msg.sender); if (tokenProtections[token].protections[_sender].isProtected) { tokenProtections[token].protections[_sender].strategy.isTransferAllowed(msg.sender, _send...
14,553,418
/** *Submitted for verification at Etherscan.io on 2022-02-20 */ // SPDX-License-Identifier: MIT pragma solidity =0.8.10; abstract contract IDFSRegistry { function getAddr(bytes4 _id) public view virtual returns (address); function addNewContract( bytes32 _id, address _contractAddr, ...
Enables the subscription for execution if disabled Must own the sub. to be able to enable it _subId Id of subscription to enable
function activateSub( uint _subId ) public { SubStorage(SUB_STORAGE_ADDR).activateSub(_subId); }
7,818,487
./partial_match/1/0x4986d7BEe120DF657fcA29cc11BF0B04836118a2/sources/src/dependencies/openzeppelin/contracts/Ownable.sol
Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner./
function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), 'Ownable: new owner is the zero address'); _transferOwnership(newOwner); }
2,707,193
pragma solidity ^0.4.24; import "./ISTO.sol"; import "../../interfaces/IST20.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; /** * @title STO module for standard capped crowdsale */ contract CappedSTO is ISTO { using SafeMath for uint256; // Address where funds are collected and tokens ar...
low level token purchase DO NOT OVERRIDE _beneficiary Address performing the token purchase/
function buyTokens(address _beneficiary) public payable { require(!paused); require(fundraiseType == FundraiseType.ETH, "ETH should be the mode of investment"); uint256 weiAmount = msg.value; _processTx(_beneficiary, weiAmount); _forwardFunds(); _postValidatePurchas...
14,066,491
./full_match/11155111/0x02233c1B57dB7f7d247c3e4Caf2aC3Aa9B23621b/sources/contracts/CrowdFunding.sol
check if everything is ok
function createCampaign( address _owner, string memory _title, string memory _description, uint256 _target, uint256 _deadline, string memory _image ) public returns (uint256) { Campaign storage campaign = campaigns[numberOfCampaigns]; require( ...
3,796,312
./full_match/1/0x50710b8831A785dbE1375167C6E5B269eE4395c8/sources/contracts/ESVSP721.sol
Burn NFT Revert if caller isn't the esVSP tokenId_ The id of the token to burn/
function burn(uint256 tokenId_) external override { require(_msgSender() == address(esVSP), "not-esvsp"); _burn(tokenId_); }
17,147,698
pragma solidity ^0.4.11; // Token Issue Smart Contract for Bitconch Coin // Symbol : BUS // Name : Bitconch Coin // Total Supply : 50 Billion // Decimal : 18 // Compiler : 0.4.11+commit.68ef5810.Emscripten.clang // Optimazation : Yes // @title SafeMath // @dev Math operations with safety check...
Claim N bought tokens to the investor as the msg sender
function claim() { withdraw(msg.sender); }
6,584,640
pragma solidity ^ 0.5.0; import "zos-lib/contracts/Initializable.sol"; import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; contract ERC20DaiTest is Initializable, ERC20, Ownable { address public vendingMachine; string public name; ...
Function to mint tokens to The address that will receive the minted tokens. amount The amount of tokens to mint. return A boolean that indicates if the operation was successful./
function mint(address to, uint256 amount) public onlyVendingMachine returns (bool) { _mint(to, amount); return true; }
6,445,123
//SPDX-License-Identifier: MIT pragma solidity 0.8.10; import { Messenger_Initializer } from "./CommonTest.t.sol"; import { Lib_CrossDomainUtils } from "../libraries/Lib_CrossDomainUtils.sol"; import { AddressAliasHelper } from "../libraries/AddressAliasHelper.sol"; import { L2ToL1MessagePasser } from "../L2/L2ToL1Me...
the message hash is in the successfulMessages mapping it is not in the received messages mapping
function test_L2MessengerRelayMessageSucceeds() external { address target = address(0xabcd); address sender = address(L1Messenger); address caller = AddressAliasHelper.applyL1ToL2Alias(address(L1Messenger)); vm.expectCall(target, hex"1111"); vm.prank(caller); vm.ex...
12,754,377
./partial_match/56/0x1Bf7fe7568211ecfF68B6bC7CCAd31eCd8fe8092/sources/xWinDefi.sol
perform redemption based on unit redeem and give up all xwin rewards
function emergencyRedeem(uint256 _redeemAmount, address _fundaddress) external nonReentrant onlyEmergency payable { require(IBEP20(_fundaddress).balanceOf(msg.sender) >= _redeemAmount, "Not enough balance to redeem"); TransferHelper.safeTransferFrom(_fundaddress, msg.sender, address(this), ...
11,320,862
./partial_match/1/0xB76BcAD81fF560348c46E07a544Feec03F22D601/sources/YFDMaster.sol
Deposit LP tokens to YFDMaster for YFD allocation.
function deposit(uint256 _pid, uint256 _amount,uint256 _daoData) public checkIfContract{ _deposit(_pid,_amount,IERC20(address(0x0)), _daoData); }
4,283,728
./partial_match/56/0xE4B16FE631CC2c51f27130a1732B6E9E222f6d01/sources/XUSD_TOKEN.sol
Destroys `amount` tokens from `account`.`amount` is then deducted from the caller's allowance. See {_burn} and {_approve}./
function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve(account, _msgSender(), _allowances[account][_msgSender()].XUSD(amount, 'BEP20: burn amount exceeds allowance')); }
11,057,178
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.7.0; import './libraries/UniswapV2Library.sol'; import './libraries/SafeMath.sol'; import './libraries/TransferHelper.sol'; import './interfaces/IUniswapV2Router02.sol'; import './interfaces/IUniswapV2Factory.sol'; import './interfaces/IERC20.sol'; impor...
bytes4(keccak256(bytes('transfer(address,uint256)')));
function safeTransfer(address token, address to, uint value) internal { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED'); }
2,141
//SPDX-License-Identifier: MIT pragma solidity 0.8.10; import { CommonTest } from "./CommonTest.t.sol"; import { ResourceMetering } from "../L1/ResourceMetering.sol"; contract MeterUser is ResourceMetering { function use(uint64 _amount) public metered(_amount) {} } contract ResourceMetering_Test is CommonTest { ...
Base fee increases by 1/8 the difference
function test_useMaxSucceeds() external { uint64 target = uint64(uint256(meter.TARGET_RESOURCE_LIMIT())); uint64 elasticity = uint64(uint256(meter.ELASTICITY_MULTIPLIER())); meter.use(target * elasticity); (uint128 prevBaseFee, uint64 prevBoughtGas, uint64 prevBlockNum) = meter.para...
2,558,127
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.4; import "./PegStabilityModule.sol"; /// @notice ETH PSM that allows separate pausing of mint and redeem /// by the guardian and governor contract MintRedeemPausePSM is PegStabilityModule { /// @notice boolean switch that indicates whether redemp...
sets the referenced oracle newOracle the new oracle to reference
function setOracle(address newOracle) external override onlyGovernor { _setOracle(newOracle); }
292,382
./partial_match/8217/0xEa6E36822227100B8FccBbEd55520c00a17BD160/sources/contracts/Voting.sol
Check if a proposal is passed Note that its return value represents the current voting status, and is subject to change until the voting ends.
function checkQuorum(uint256 proposalId) public view override returns(bool) { Proposal storage p = proposals[proposalId]; (uint256 quorumCount, uint256 quorumPower) = getQuorum(proposalId); uint256 totalVotes = p.totalYes + p.totalNo + p.totalAbstain; bool countPass = (p.voters.len...
16,911,303
pragma solidity ^0.4.11; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface */ contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) public constant returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexe...
Disable the token transfer. This can only be called by the token owner./
function disableTransfer() external onlyOwner { transferEnabled = false; }
12,042,540
// 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...
/ unwrap atoken swap
@notice This function is used to remove liquidity from yVaults @param _toWhomToIssue recipient address @param _ToTokenContractAddress The address of the token to withdraw @param _fromYVaultAddress The address of the vault to exit @param _vaultType Type of underlying token: 0 token; 1 aToken; 2 LP to...
2,082,673
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.5.16; import "./GToken.sol"; import "./ERC3156FlashBorrowerInterface.sol"; import "./ERC3156FlashLenderInterface.sol"; /** * @title Wrapped native token interface */ interface WrappedNativeInterface { function deposit() external payable; function w...
Flash loan funds to a given account. receiver The receiver address for the funds initiator flash loan initiator amount The amount of the funds to be loaned data The other data return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ 1. calculate fee, 1 bips = 1/10000 2. transfer fund to recei...
function flashLoan( ERC3156FlashBorrowerInterface receiver, address initiator, uint256 amount, bytes calldata data ) external nonReentrant returns (bool) { require(amount > 0, "flashLoan amount should be greater than zero"); require(accrueInterest() == uint256(Err...
992,438
// SPDX-License-Identifier: MIT pragma solidity 0.6.11; pragma experimental ABIEncoderV2; // ==================================================================== // | ______ _______ | // | / _____________ __ __ / ____(_____ ____ _____ ________ | // | / /_ ...
We separate out the 1t1, fractional and algorithmic minting functions for gas efficiency
function mint1t1FRAX(uint256 collateral_amount, uint256 FRAX_out_min) external notMintPaused { uint256 collateral_amount_d18 = collateral_amount * (10 ** missing_decimals); require(FRAX.global_collateral_ratio() >= COLLATERAL_RATIO_MAX, "Collateral ratio must be >= 1"); require((collateral_...
221,091
/** *Submitted for verification at Etherscan.io on 2021-05-24 */ // File: @openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol pragma solidity ^0.5.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. T...
Helper function for `xSNX.mint` that calculates token issuance snxBalanceBefore: SNX balance pre-mint ethContributed: ETH payable on mint, less fees nonSnxAssetValue: NAV of non-SNX slice of fund totalSupply: xSNX.totalSupply()/
function calculateTokensToMintWithEth( uint256 snxBalanceBefore, uint256 ethContributed, uint256 nonSnxAssetValue, uint256 totalSupply ) public view returns (uint256) { if (totalSupply == 0) { return getInitialSupply(); } uint256 pricePerToken...
10,546,811
./full_match/43114/0x0Db20d1643112fA00C4D3DDB58369Ad26c1F7c1d/sources/contracts/Strategy.sol
count the number of tokens this strategy currently supports
function disapprovedTokensCount() external view override returns (uint256) { return _disapprovedTokens.length(); }
4,499,938
//Address: 0x54c6acad21fcda13f318268335b10d7b809da327 //Contract name: CoinMarketAlert //Balance: 0 Ether //Verification Date: 10/23/2017 //Transacion Count: 4 // CODE STARTS HERE pragma solidity 0.4.18; // implement safemath as a library library SafeMath { // We use `pure` bbecause it promises that the value fo...
Used to mint tokens, only usable by the contract owner _amount The amount of CMA tokens in wei to mint
function tokenFactory(uint256 _amount) public onlyAdmin returns (bool success) { require(_amount > 0); require(tokenMintingEnabled); require(tokenMint(msg.sender, _amount)); return true; }
13,132,878
pragma solidity ^0.4.24; contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor() public { owner = msg.sender; } modifier onlyOwner() { address sender = msg.sender; address _owner = owner; require(msg....
sale period (includes holidays)
function setSaleDuration(uint _saleDurationInDays) onlyOwner public { saleDuration = _saleDurationInDays; limitDateSale = startTime.add(saleDuration * 1 days); endTime = limitDateSale; }
62,889
./full_match/80001/0xf4f036a18961f7Ab421145bac1f27f0F73BFb643/sources/contracts/Company.sol
add 1 user key to company _companyAddress (string) the email of the company _userAddress (string) the email of the user return all users within the company (string[])/
function addUserKey( address _companyAddress, address _userAddress ) public returns (address[] memory) { company[_companyAddress].userKeys.push(_userAddress); return company[_companyAddress].userKeys; }
5,596,758
/** *Submitted for verification at Etherscan.io on 2022-04-24 */ /** *Submitted for verification at BscScan.com on 2021-06-02 */ // File: @openzeppelin/contracts/utils/Context.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, i...
Returns to normal state Only possible when contract is paused./
function unpause() external onlyOwner { dexTokenVault.unpause(); }
6,747,244
pragma solidity ^0.5.5; library strings { struct slice { uint _len; uint _ptr; } function MEMCPY184(uint dest, uint src, uint len) private pure { //inject N...
inject NONSTANDARD NAMING
function MUL948(uint256 a, uint256 b) internal pure returns (uint256) {
6,431,738
./full_match/3/0xE92cf2f3DC38780FBb5ea5329c3De095E03A097D/sources/contracts/1_Storage.sol
IERC20(token1address).approve(tokenTransferAddress, fromAmount);
function swap(uint256 fromAmount) public { address[] memory callees; bytes memory exchangeData; uint256[] memory startIndexes; uint256[] memory values; address payable beneficiary = payable(address(this)); IParaswap(augustusSwapperAddress).simplBuy({ fro...
14,226,988
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; pragma abicoder v2; import "base64-sol/base64.sol"; import "./Eyes/EyesParts1.sol"; import "./Eyes/EyesParts2.sol"; /// @title Eyes SVG generator library EyesDetail { /// @dev Eyes N°1 => Happy function item_1() public pure returns (string memory) { ...
Eyes N°12 => Stitch
function item_12() public pure returns (string memory) { return base(EyesParts1.item_6(), "Stitch"); }
13,090,121
// SPDX-License-Identifier: MIT pragma solidity 0.8.10; import "../interfaces/IERC721Consumable.sol"; import "../interfaces/IMetaverseConsumableAdapterFacet.sol"; import "../libraries/LibOwnership.sol"; import "../libraries/marketplace/LibMetaverseConsumableAdapter.sol"; import "../libraries/marketplace/LibMarketplace...
Gets the consumable adapter of a metaverse _metaverseRegistry The target metaverse registry (token address)
function consumableAdapter(address _metaverseRegistry) public view returns (address) { return LibMetaverseConsumableAdapter .metaverseConsumableAdapterStorage() .consumableAdapters[_metaverseRegistry]; }
12,913,609
./partial_match/1/0x84Bb947fcEdba6B9C7DCEad42dF07e113bb03007/sources/StaterToken.sol
Give an account access to this role./
function add(Role storage role, address account) internal { require(!has(role, account), "Roles: account already has role"); role.bearer[account] = true; }
3,656,260
// SPDX-License-Identifier: Apache-2.0 // Copyright 2017 Loopring Technology Limited. pragma solidity ^0.7.0; /// @title Ownable /// @author Brecht Devos - <brecht@loopring.org> /// @dev The Ownable contract has an owner address, and provides basic /// authorization control functions, this simplifies the impleme...
Checks if an address is a manger. addr The address to check. return True if the address is a manager, False otherwise.
function isManager(address addr) public view returns (bool) { return isAddressInSet(MANAGER, addr); }
114,235
./full_match/4/0x632a2a5B51f17CE7e0fee110aC401525DF2E5Ce1/sources/contracts/OmnimorphsRinkeby.sol
check if token was fused already
function isFusedTo(uint tokenId) public view returns (uint) { return fusedTokensMap[tokenId]; }
13,324,031
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.4.25 <7.0.0; contract MyContract{ uint public totSuccess = 0; // count of successful transactions /* struct Queue { uint[] items; uint size; uint head; } function create(Queue storage self, uint size) internal { ...
find shortest path with valid balances and execute transaction iterate through parents to get to source user from destination user
function sendAmount(uint user_id_1, uint user_id_2, uint amt) public{ create(q,0); append(q,user_id_1);*/ for(uint j=0;j<100;j++) visited[j] = false; parent[user_id_2] = user_id_2; findPath(user_id_1,amt); if(parent[user_id_2]!=user_id_2){ uint te...
12,605,853
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; ...
Locking period has passed - Locked tokens have turned into tradeable
function claimTokens(address[] receipents) public canClaimed { for (uint i = 0; i < receipents.length; i++) { address receipent = receipents[i]; balances[receipent] = balances[receipent].add(lockedBalances[receipent]); lockedBalances[receipent]...
151,021
// File: @openzeppelin/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 such a direct * man...
Updates the block number of the time of DIP4 release./
function setDIP4GenesisBlock(uint256 _block) external onlyOwner { require(getStorageDIP4GenesisBlock() == 0, "already set the value"); setStorageDIP4GenesisBlock(_block);
7,977,302
// 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. ...
inject NONSTANDARD NAMING
function DISPUTE590(address keeper) external {
12,787,938
/** *Submitted for verification at Etherscan.io on 2021-11-23 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assum...
See {IERC165-supportsInterface}./
function _beforeTokenTransfer( address from, address to, uint256 tokenId } } function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); }
1,983,534
pragma solidity >=0.4.22 <0.7.0; contract ERC20Basic { string public constant name = "R07521606 Token"; string public constant symbol = "R07521606"; uint8 public constant decimals = 18; event Approval(address indexed tokenOwner, address indexed spender, uint tokens); event Transfer(address ind...
transfer by delegate error handler: ensure that the balance is more than the number of tokens to be sent error handler: ensure that the allowance is more than the number of tokens to be sent
function transferFrom(address owner, address buyer, uint numTokens) public returns (bool) { require(numTokens <= balances[owner]); require(numTokens <= allowed[owner][msg.sender]); balances[owner] = balances[owner].sub(numTokens); allowed[owner][msg.sender] = allowed[owner][...
12,922,620
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; // @title: This Shard Does Not Exist // @author: Jonathan Howard ///////////////////////////////////////////////////////////////////////////// // // // ...
Buy the token reserved for your shard Prerequisites: - not at max supply - sale has started - your wallet owns the shard ID in question 137, but the tokenId in its shared contract. If you don't know this ID, your best bet is the website. But it will also be after the final '/'/ Duplicate this here to potentially sav...
function mintWithShard(uint tokenId) external payable nonReentrant { require(hasSaleStarted, "Sale hasn't started"); require(msg.value == SHARD_PRICE, "Ether value required is 0.069"); require(tokenId >= 1229 && tokenId <= 1420, "Enter a sharId from 1229 to 1420"); require(fntnContract.ownerOf(tokenI...
5,964,280
./partial_match/42/0x6AF6B0B22131137C1C581127f46C2d8eC7234EAa/sources/TestTubePool.sol
Interface of the ERC20 standard as defined in the EIP. Does not include the optional functions; to access them see {ERC20Detailed}./
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view re...
3,451,118
// Copyright (C) 2017 DappHub, LLC pragma solidity ^0.4.11; //import "ds-exec/exec.sol"; contract DSExec { function tryExec( address target, bytes calldata, uint value) internal returns (bool call_ret) { return target.call.value(value)(calldata); } function exec( address target, bytes...
selling SELL_HARD_LIMIT tokens ends the sale Soft limit triggers the sale to close in 24 hours
function() payable stoppable note { require(!isContract(msg.sender)); require(msg.value >= 0.01 ether); require(tx.gasprice <= MAX_GAS_PRICE); assert(time() >= startTime && time() < endTime); var toFund = cast(msg.value); var requested = wmul(toFund, PUBLIC_SALE_P...
10,825,277
// SPDX-License-Identifier: MIT pragma solidity =0.8.4; import {SafeMath} from "@openzeppelin/contracts/utils/math/SafeMath.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {GnosisAuction} from "...
Withdraws stETH from vault collateralToken is the address of the collateral token recipient is the recipient withdrawAmount is the withdraw amount in terms of yearn tokens return yieldTokenBalance is the balance of the yield token/
function withdrawYieldToken( address collateralToken, address recipient, uint256 withdrawAmount ) internal returns (uint256) { IERC20 collateral = IERC20(collateralToken); uint256 yieldTokenBalance = collateral.balanceOf(address(this)); uint256 yieldTokensToWithd...
5,809,016
./full_match/1/0xFd3171eCA94a00e40b3671803d899d3FD86c073c/sources/contracts/PerpetualTranche.sol
Fetches the reserve token by index.
function _reserveAt(uint256 i) private view returns (IERC20Upgradeable) { return IERC20Upgradeable(_reserves.at(i)); }
2,949,482
pragma solidity 0.7.6; import "contracts/protocol/futures/RateFuture.sol"; import "contracts/interfaces/platforms/harvest/IiFarm.sol"; /** * @title Contract for yToken Future * @author Gaspard Peduzzi * @notice Handles the future mechanisms for iFarm * @dev Implement directly the stream future abstraction as it f...
Start a new period needs corresponding permissions for sender/ Sender registers an amount of IBT for the next period _user address to register to the future _amount amount of IBT to be registered called by the controller only/ User has no record User has already an existing registration for the next period User ha...
function startNewPeriod() public virtual; function register(address _user, uint256 _amount) public virtual periodsActive depositsEnabled periodsActive { require(hasRole(CONTROLLER_ROLE, msg.sender), "Caller is not allowed to register"); require(_amount > 0, "err_amount"); uint256 nextIn...
13,515,082
pragma solidity ^0.5.0; // Import the `Roles` library import "../milkcore/Ownable.sol"; import "../milkaccesscontrol/PoultererRole.sol"; import "../milkaccesscontrol/DairyfactoryRole.sol"; import "../milkaccesscontrol/DistributorRole.sol"; import "../milkaccesscontrol/RetailerRole.sol"; import "../milkaccesscontrol/Su...
Define a function 'StoreItem' that allows a poulterer to mark an item 'Stored' Update the appropriate fields Emit the appropriate event
function storeItem(uint _upc) public onlyPoulterer() checkUpcInItems (_upc) checkItemState (_upc, State.Obtained, "Milk is not obtained!") { items[_upc].itemState = State.Stored; emit Stored(_upc, msg.sender); }
1,004,317
./full_match/3/0xB491c64B73F769d3C9CA6867d9bAE9C7fbefbF06/sources/browser/ERC20.sol
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 uint256 the amount of tokens to be transferred/ require(value <= _allowed[from][msg.sender]); _allowed[from][msg.sender] = _allowed[from][msg.sender...
function transferFrom( address from, address to, uint256 value ) public returns (bool) { require(value <= _balances[from]); require(from == msg.sender); require(to != address(0)); _balances[from] = _balances[from].sub(value); _balances[to] = _balances[to].add(value); e...
14,190,160
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.4; import "./PegStabilityModule.sol"; /// @notice ETH PSM that allows separate pausing of mint and redeem /// by the guardian and governor contract MintRedeemPausePSM is PegStabilityModule { /// @notice boolean switch that indicates whether redemp...
helper function to get mint amount out based on current market prices will revert if price is outside of bounds and bounded PSM is being used
function _getMintAmountOut(uint256 amountIn) private view returns (uint256 amountFeiOut) { Decimal.D256 memory price = readOracle(); _validatePriceRange(price); Decimal.D256 memory adjustedAmountIn = price.mul(amountIn); amountFeiOut = adjustedAmountIn .mul(Constants.BA...
292,320
pragma solidity ^0.6.0; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "abdk-libraries-solidity/ABDKMath64x64.sol"; import "@openzeppelin/contracts/token/E...
uint256 seed = randoms.getRandomSeed(msg.sender);
function _mintWeaponLogic(uint8 chosenElement) internal { weapons.mint(msg.sender, uint256(keccak256(abi.encodePacked(blockhash(block.number - 1), msg.sender))), chosenElement); }
7,327,113
//Address: 0xab37d7c4a2ae9ad4451aa796171dc8ac0fa429f4 //Contract name: IcoToken //Balance: 0 Ether //Verification Date: 2/2/2018 //Transacion Count: 95 // CODE STARTS HERE //File: node_modules/zeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol pragma solidity ^0.4.18; /** * @title ERC20Basic * @dev Simpler v...
Request payout dividend (claim) (requested by tokenHolder -> pull) dividends that have not been claimed within 330 days expire and cannot be claimed anymore by the token holder./ unclaimed dividend fractions should expire after 330 days and the owner can reclaim that fraction Trigger payout event
function claimDividend() public returns (bool) { require(dividendEndTime > 0 && dividendEndTime.sub(claimTimeout) > now); updateDividend(msg.sender); uint256 payment = unclaimedDividend[msg.sender]; unclaimedDividend[msg.sender] = 0; msg.sender.transfer(payment); ...
13,074,834
./full_match/288/0x6696F07d9D2b0Cac59bf877077f4325079cbd806/sources/contracts/oracle/FluxAggregator.sol
recommended call to add funds to aggregator for oracle payments(if enabled) if funds transferred directly instead, call the updateAvailableFunds method manually after transfer amount the amount to transfer to aggregator/
function addFunds(uint256 amount) public { require(bobaToken.transferFrom(msg.sender, address(this), amount), "token transfer failed"); updateAvailableFunds(); }
7,103,543
//SPDX-License-Identifier: MIT pragma solidity >=0.6.12; import "./Ownable.sol"; import "@api3/airnode-protocol/contracts/AirnodeClient.sol"; contract ShortRequestClient is AirnodeClient, Ownable { // When a request is made, a flag is set for it. When the request is // fulfilled, the flag is reset. As a resu...
Provider's Airnode calls Airnode.sol, which calls back this method. This is why this method is behind onlyAirnode. A statusCode of 0 means the request has been fulfilled sucessfully. You can handle errors by making the same request, making another request, refunding the user, etc.
function fulfill( bytes32 requestId, uint256 statusCode, bytes32 data ) external onlyAirnode() { require(incomingFulfillments[requestId], "No such request made"); delete incomingFulfillments[requestId]; if (statusCode == 0) { ...
5,440,966
./full_match/42/0x3462B85AeE2357f56068d5dD79b02432De061272/sources/home/mitgen/Private_Projects/DeFi/poolRegistry/contracts/utils/EnumerableSet.sol
Add a value to a set. O(1). Returns true if the value was added to the set, that is if it was not already present./ The value is stored at length-1, but we add 1 to all indexes and use 0 as a sentinel value
function _add(Set storage set, bytes32 value, address addressValue) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); set._collection.push(addressValue); set._indexes[value] = set._values.length; return true; return fa...
16,227,671
// SPDX-License-Identifier: GPL-3.0 // solhint-disable no-empty-blocks // solhint-disable not-rely-on-time pragma solidity ^0.8.0; import "./XPowerNftBase.sol"; /** * Abstract base class for staked XPowerNft(s): Contract owner only is allowed * to mint and burn XPowerNftStaked tokens. */ abstract contract XPowerNf...
burn particular amounts of staked NFTs for given address and nft-ids /
function burnBatch( address from, uint256[] memory nftIds, uint256[] memory amounts ) public override onlyOwner { _pushBurnBatch(from, nftIds, amounts); _burnBatch(from, nftIds, amounts); }
1,064,061
./full_match/1/0x42AF47d643cb45D9a482AeD39c0973208f0CFAFF/sources/contracts/protocol/lib/ModuleBase.sol
Returns true if JasperVault must be enabled on the controller and module is registered on the JasperVault/
function isSetValidAndInitialized(IJasperVault _jasperVault) internal view returns(bool) { return controller.isSet(address(_jasperVault)) && _jasperVault.isInitializedModule(address(this)); }
4,962,913
./partial_match/1/0x49F2befF98cE62999792Ec98D0eE4Ad790E7786F/sources/AmplElasticCRP.sol
Update weights in a predetermined way, between startBlock and endBlock, through external cals to pokeWeights bPool - Core BPool the CRP is wrapping newWeights - final weights we want to get to startBlock - when weights should start to change endBlock - when weights will be at their final values minimumWeig...
function updateWeightsGradually( IBPool bPool, GradualUpdateParams storage gradualUpdate, uint[] calldata newWeights, uint startBlock, uint endBlock, uint minimumWeightChangeBlockPeriod ) external { require(BalancerSafeMath.bsub(endBlock, start...
4,085,305