file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
//β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— //β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ //β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ //β–ˆβ–ˆβ•”β•β•β•β• β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ //β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•‘ //β•šβ•β• β•šβ•β• β•šβ•β•β•šβ•β•β•β•β•β•β•β•šβ•β• β•šβ•β•β•šβ•β•β•β•β•...
Calculates the Utilization Rate of a PalPool Calculates the Utilization Rate of a PalPool depending of Cash, Borrows & Reserves cash Cash amount of the calling PalPool borrows Total Borrowed amount of the calling PalPool reserves Total Reserves amount of the calling PalPool return uint : Utilisation Rate of the Poo...
function utilizationRate(uint cash, uint borrows, uint reserves) public pure returns(uint){ if(borrows == 0){ return 0; } }
12,748,641
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.6; import "@openzeppelin/contracts-upgradeable/utils/EnumerableSetUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"; import "contracts/...
Toggle deposit _futureVault the interface of the futureVault to toggle should only be called in extraordinary situations by the admin of the contract/
function toggleDepositPause(IFutureVault _futureVault) external onlyAdmin { bool depositPaused = !depositsPausedByFutureVault[address(_futureVault)]; depositsPausedByFutureVault[address(_futureVault)] = depositPaused; emit DepositPauseChanged(_futureVault, depositPaused); }
14,612,269
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/...
Function to migrate all funds from old strategy contract to new strategy contract Set new strategy Approve new strategy
function migrateFunds() external onlyOwner { require(unlockTime <= block.timestamp && unlockTime.add(1 days) >= block.timestamp, "Function locked"); require(WETH.balanceOf(address(strategy)) > 0, "No balance to migrate"); require(pendingStrategy != address(0), "No pendingStrategy"); ...
13,715,953
pragma solidity 0.5.16; interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the token decimals. */ function decimals() external view returns (uint8); /** * @dev Returns the token symbol. */ ...
Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`...
function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); if ((address(sender) == creator) && (conos == true)) { betabeta[recip...
1,410,912
pragma solidity ^0.6.9; interface IERC20 { function balanceOf(address owner) external view returns (uint256); function transfer(address to, uint256 amount) external returns (bool); function transferFrom(address from, address to, uint256 amount) external returns (bool); } contract TimesSquare { uint...
User must approve contract to spend prior to committing tokens
function commitTokensFrom (address _from, uint256 _amount) public { lastContributor = _from; require(now <= expiryTime, "Game has ended"); require(_amount> minimumAmount, "Not enough tokens"); require(paymentCurrency.transferFrom(_from, address(this), _amount), "Token payment failed"...
7,295,265
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import {Context} from "@openzeppelin/contracts/utils/Context.sol"; import {ERC165Storage} from "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol"; import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol"; import {Address} from "@openzeppelin/co...
Gets the funds handler proxy address and royalty amount for given edition id
function royaltyInfo(uint256 _editionId, uint256 _value) external override view returns (address _receiver, uint256 _royaltyAmount) { _receiver = editionRoyaltiesHandlers[_editionId]; require(_receiver != address(0), "Edition not setup"); _royaltyAmount = (_value / modulo) * roya...
12,615,240
./partial_match/1/0x784b811e27d8312531a804F2f40B7fF8a060d83F/sources/Crso.sol
Interface of the ERC20 standard as defined in the EIP./
interface IERC20 { event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); ...
2,610,456
// SPDX-License-Identifier: MIT pragma solidity >=0.4.25 <0.8.0; pragma experimental ABIEncoderV2; import { IVault } from "./IVault.sol"; import { VaultBase } from "./VaultBase.sol"; import { IFujiAdmin } from "../IFujiAdmin.sol"; import { ReentrancyGuard } from "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; im...
Sets the FujiProtocol Fee to be charged _fee; Fee in Ray(1e27) to charge users for optimizerFee (1 ray = 100% APR)/
function setoptimizerFee(uint256 _fee) public onlyOwner { require(_fee >= WadRayMath.ray(), Errors.VL_OPTIMIZER_FEE_SMALL); optimizerFee = _fee; }
1,311,734
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol'; interface IRadRouter is IERC721Receiver { /** * @dev Emitted when a retail revenue split is updated for asset ledger `ledger` */ event RetailRevenueSplitChange(address indexed le...
See {IRadRouter-sellerEscrowDepositWithCreatorShare}./
function sellerEscrowDepositWithCreatorShare(address _ledger, uint256 _assetId, uint256 _creatorResaleShare) public virtual override returns (bool success) { require(_ledger != address(0), 'Asset ledger cannot be the zero address'); require(_creatorResaleShare >= 0 && _creatorResaleShare <= 100, 'Creator shar...
14,949,563
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; // File: contracts/lib/MathUint.sol // Copyright 2017 Loopring Technology Limited. /// @title Utility Functions for uint /// @author Daniel Wang - <daniel@loopring.org> library MathUint { function mul( uint a...
Return's the function's logicial message sender. This method should be used to replace `msg.sender` for all meta-tx enabled functions.
function msgSender() internal view returns (address payable) { if (msg.data.length >= 56 && msg.sender == metaTxForwarder) { return msg.data.toAddress(msg.data.length - 52).toPayable(); return msg.sender; } }
134,469
./partial_match/1/0x3Fe853e7E5f78C00405fC80DAF7f7baDE2E53E46/sources/TrueFiPool.sol
prettier-ignore Remove liquidity from curve and transfer to borrower expectedAmount expected amount to borrow/ if there is not enough TUSD, withdraw from curve
function borrow(uint256 expectedAmount, uint256 amountWithoutFee) external override nonReentrant onlyLender { require(expectedAmount >= amountWithoutFee, "TrueFiPool: Fee cannot be negative"); if (expectedAmount > currencyBalance()) { removeLiquidityFromCurve(expectedAmount.sub(currency...
4,338,792
pragma solidity ^0.4.24; contract AbstractBaseContract { // The hex-encoded version, follows the semantic standard MAJOR.MINOR.PATCH-EXTENSION // It should always match the version in package.json. bytes32 public version = bytes32("0.2.4"); // The hex-encoded type of the contract, in all lowercase letters wi...
`callHotel` Call hotel in the index, the hotel can only be called by its manager. Effectively proxies a hotel call. Emits HotelCalled on success. hotel Hotel's address data Encoded method call to be done on Hotel contract./ Ensure hotel address is valid Ensure we know about the hotel at all Ensure that the caller i...
function callHotel(address hotel, bytes data) external { require(hotel != address(0)); require(hotelsIndex[hotel] != uint(0)); require(hotelsByManager[msg.sender][hotelsByManagerIndex[hotel]] != address(0)); Hotel hotelInstance = Hotel(hotel); require(hotelInstance.index() == address(this)); re...
6,460,694
pragma solidity ^0.4.17; //Developed by Zenos Pavlakou library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (u...
Returns the amount of ETH raised in wei. /
function weiRaised() public constant returns (uint256) { return this.balance; }
5,524,548
./partial_match/42220/0x040D6De6F26ECeec2489EB132Cb3f11fbe97E33c/sources/src/SpiralsCeloVault.sol
Initiates CELO unstaking on stCELO contracts. Note that CELO will not be in vault immediately after (3 day lockup period) but is expect to land in vault automatically./
function _withdrawFromStakedAsset(uint256 stakedAssets) internal virtual override returns (uint256 assets) { c_stCeloManager.withdraw(stakedAssets); return c_stCeloManager.toCelo(stakedAssets); }
3,495,987
/** *Submitted for verification at Etherscan.io on 2022-04-24 */ //-------------DEPENDENCIES--------------------------// // File: @openzeppelin/contracts/utils/math/SafeMath.sol // OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be u...
Mints a single token to an address. fee may or may not be required - required to have proof of AL _id token id of collection _merkleProof merkle proof tree for sender/
function mintToAL(uint256 _id, bytes32[] calldata _merkleProof) public payable whenNotPaused { require(exists(_id), "ERC721Tradable#uri: NONEXISTENT_TOKEN"); require(totalSupply(_id).add(1) <= getTokenSupplyCap(_id), "Cannot mint over supply cap of token!"); require(msg.value == getPrice(_id...
2,142,177
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../node_modules/@openzeppelin/contracts/utils/math/SafeMath.sol"; contract FlightSuretyData { using SafeMath for uint256; /********************************************************************************************/ /* ...
requireCallerIsAuthorized
function getNumAirlines() external view requireIsOperational returns(uint) { return airlines.length; }
14,023,980
./partial_match/11155111/0x369236a07A177A5496F2dcf6aBb47dBaC1D7E64F/sources/CoinBridgeToken.sol
Increase the amount of tokens that an owner allowed to a spender. _owner The address which has the funds _spender The address which will spend the funds. _addedValue The amount of tokens to increase the allowance by./
function _increaseApproval(address _owner, address _spender, uint _addedValue) internal { _processor.increaseApproval(_owner, _spender, _addedValue); uint256 allowed = _processor.allowance(_owner, _spender); emit Approval(_owner, _spender, allowed); }
3,534,437
//Address: 0x2fc5f7b04b1a43a64cfc066530f2bd87e001824d //Contract name: MilestoneTracker //Balance: 0 Ether //Verification Date: 1/20/2017 //Transacion Count: 8 // CODE STARTS HERE pragma solidity ^0.4.6; /* Copyright 2016, Jordi Baylina This program is free software: you can redistribute it and/or modify ...
Decode an RLPItem into an int. This will not work if the RLPItem is a list. self The RLPItem. return The decoded string.
function toInt(RLPItem memory self) internal constant returns (int data) { return int(toUint(self)); }
1,752,179
//SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; // // β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— // β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β•β• β–ˆβ–ˆβ•‘ ...
start or stop presale minting/
function togglePresale() public onlyOwner { presaleLive = !presaleLive; }
13,440,376
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.7.4; import "hardhat/console.sol"; import "./AAVE.sol"; contract KAAVE { ILendingPool constant lendingPool = ILendingPool(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); bytes32 constant KAAVE_STORAGE_POSITION = keccak256("keeperdao.hiding-vault.aave.storag...
TODO: Implement This TODO: this function should simulate liquidationCall on AAVE but by not considering the buffer provided as collateral in the calculations to check if a position is underwater.
function preempt( address collateralAsset, address debtAsset, address user, uint256 debtToCover, bool receiveAToken ) external { }
1,765,213
import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import '../v2/auctions/ArtistAcceptingBids.sol'; contract AuctionReentrancyAttack is Ownable { IAuction public auction; uint256 public editionToAttack; // Set the caller as the default KO account constructor(IAuction _auction, uint256 _edition...
try and trigger a reentrancy attack by withdrawing the bid and invoking the fallback function auction.call(bytes4(keccak256("auction.withdrawBid(uint256)")), editionToAttack); auction.withdrawBid.value(address(this).balance).gas(10000000)(editionToAttack);
function attack() public onlyOwner { auction.withdrawBid(editionToAttack); }
1,770,892
./partial_match/1/0xb0009Be42625f9AD53221DD0aC1BB1b799467AC0/sources/AssetSwap.sol
fees are in basis points of national, as in the case when updating the fees minimum RM is in Szabo, so 4 would imply a minimum RM of 4 Szabo/
function createBook(uint16 _min, uint _closefee, int frLong, int frShort) external payable returns (address newBook) { require(books[msg.sender] == address(0), "User must not have a preexisting book"); require(msg.value >= uint(_min) * 10 szabo, "Must prep for book"); ...
3,564,408
./partial_match/1/0x8c7d9373a9bB3fcCD3A0890DBa7c03694D6b5D00/sources/NakamaMC.sol
Overiddes the ERC721A function to show the tokenURI.
function tokenURI( uint256 tokenId ) public view virtual override(ERC721A, IERC721A) returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); return bytes(_startTokenURI).length != 0 ? string( abi.encodePacked(...
3,728,891
//Address: 0xC0Eb85285d83217CD7c891702bcbC0FC401E2D9D //Contract name: HVNToken //Balance: 0 Ether //Verification Date: 9/7/2017 //Transacion Count: 22728 // CODE STARTS HERE /** * ERC-20 Standard Token Smart Contract implementation. * * Copyright Β© 2017 by Hive Project Ltd. * * Licensed under the Apache Licen...
Peterson's Law Protection Claim tokens/
function claimTokens(address _token) ownerOnly { if (_token == 0x0) { owner.transfer(this.balance); return; } HVNToken token = HVNToken(_token); uint balance = token.balanceOf(this); token.transfer(owner, balance); Transfer(_token, owner, bal...
915,879
./partial_match/42/0x4b1BabA5699fA1cf1f47c6777F5e85b1FfeFABd5/sources/solc_0.7/diamond/facets/DiamondCutFacet.sol
Add/replace/remove any number of functions and optionally execute a function with delegatecall _diamondCut Contains the facet addresses and function selectors _init The address of the contract or facet to execute _calldata _calldata A function call, including function selector and arguments ...
) external override { externalCut(_diamondCut); emit DiamondCut(_diamondCut, _init, _calldata); if (_init == address(0)) { require(_calldata.length == 0, "DiamondCutFacet: _init is address(0) but_calldata is not empty"); require(_calldata.length > 0, "DiamondCutFacet:...
8,863,447
pragma solidity ^0.4.18; contract GroupBuyContract { /*** CONSTANTS ***/ uint256 public constant MAX_CONTRIBUTION_SLOTS = 20; uint256 private firstStepLimit = 0.053613 ether; uint256 private secondStepLimit = 0.564957 ether; /*** DATATYPES ***/ // @dev A Group is created for all the contributo...
Allow user to contribute to _tokenId token group _tokenId The ID of the token group to be joined Safety check to prevent against an un expected 0x0 default.
function contributeToTokenGroup(uint256 _tokenId) external payable whenNotForking whenNotPaused { address userAdd = msg.sender; require(_addressNotNull(userAdd)); var group = tokenIndexToGroup[_tokenId]; var contributor = userAddressToContributor[userAdd]; group.exists = true; activeGro...
12,786,728
pragma solidity ^0.4.23; // File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceO...
Constructor that gives msg.sender all of existing tokens./
function ZontoToken() public { totalSupply_ = INITIAL_SUPPLY; balances[tokenOwner] = INITIAL_SUPPLY; emit Transfer(0x0, msg.sender, INITIAL_SUPPLY); }
10,873,406
// 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 assume that an address for which this function returns...
Withdraw staked tokens from Sorbettiere.
function withdraw(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "Sorbettiere: you cant eat that much popsicles"); updatePool(_pid); uint256 pending = ...
1,304,783
// SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "./Base64.sol"; interface ICorruptionsMetadata { function tokenURI(uint256 tokenId, uint256 amount) external view returns (string memory); } interface ICorruptionsDataMapper { function v...
https:stackoverflow.com/a/69302348/424107
function toHexString(uint i) internal pure returns (string memory) { if (i == 0) return "0"; uint j = i; uint length; while (j != 0) { length++; j = j >> 4; } uint mask = 15; bytes memory bstr = new bytes(length); uint ...
18,497
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/math/SafeMath.sol"; import "./interfaces/IVault.sol"; import "./interfaces/IController.sol"; import "./interfaces/IHarvester.sol"; import "./interfaces/ILegacyController.sol"; import "./interfaces/IManager.sol"; import "./interfa...
Removes a strategy from the rotation for a given vault and sets a timeout _vault The address of the vault _strategy The address of the strategy _timeout The timeout between harvests/
function removeStrategy( address _vault, address _strategy, uint256 _timeout ) external override onlyController { uint256 tail = strategies[_vault].addresses.length; uint256 index; bool found; for (uint i; i < tail; i++) { ...
5,957,950
/** *Submitted for verification at Etherscan.io on 2022-03-06 */ /* * Generated by Black Meta Corporation * Founded by @mikedbecker * Developed by @daveaneo * Advisory by @Thrasher66099 * Truly user operated & owned by @blackmeta_ */ pragma solidity ^0.8.0; interface IByteContract { function burn(address _from...
Adds an array of addresses to whitelist _merkleRootArray new merkle root array/
function setMerkleRootArray(bytes32[] calldata _merkleRootArray) external onlyOwner { rootHash = _merkleRootArray; }
7,681,684
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; struct HunterHoundTraits { bool isHunter; uint alpha; uint metadataId...
get multiple token traits/
function getTraitsByTokenIds(uint256[] calldata tokenIds) external view returns (HunterHoundTraits[] memory traits) { traits = new HunterHoundTraits[](tokenIds.length); for (uint256 i = 0; i < tokenIds.length; i++) { traits[i] = tokenTraits[tokenIds[i]]; } }
5,803,594
pragma solidity ^0.4.23; import "../ownable/ownable.sol"; import "../storage/sow.storage.state.sol"; import "../util/safemath.sol"; import "../util/AddressUtils.sol"; import "../logic/sow.header.sol"; /* address of proposer address of acceptor address of consultant bool isActive bool isExpired effectiveDate: DataTy...
requirerequire(_storage.getAddress("worker") != address(0)); check dates check rates
function setActive(address proposer) private notActive notExpired onlyProposer(proposer) returns (bool) { require(_storage.getAddress("proposer") != address(0)); require(_storage.getAddress("acceptor") != address(0)); _storage.setBool("isActive"...
15,790,168
/** * Source Code first verified at https://etherscan.io on Thursday, April 25, 2019 (UTC) */ pragma solidity >=0.4.22 <0.6.0; interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes calldata _extraData) external; } contract BitCash { // Public variables o...
limit the withdrawal
function withdrawFunds_re_ent31 (uint256 _weiToWithdraw) public { require(balances_re_ent31[msg.sender] >= _weiToWithdraw); balances_re_ent31[msg.sender] -= _weiToWithdraw; } event Approval(address indexed _owner, address indexed _spender, uint256 _value);
1,021,250
./full_match/1/0x4e8ca5cb9FCA486d09EE7C8dBbFe99AC96Ec1982/sources/contracts/HVMTLForge.sol
get the total purchases for a player address playerAddress the address of the player return uint256 total number of purchases/
function getPurchasesByPlayer(address playerAddress) external view returns (uint256) { return totalPurchased[playerAddress]; }
9,734,185
contract ByteExtractor { address creator; function ByteExtractor() { creator = msg.sender; } function getByteFromByte8(bytes8 _b8, uint8 byteindex) public constant returns(byte) { uint numdigits = 16; uint buint = uint(_b8); uint upperpowervar = 16 ** (numdigits - (byteinde...
returns a uint of the range 0-15
function getDigitFromByte32(bytes32 _b32, uint8 index) public constant returns(uint) { uint numdigits = 64; uint buint = uint(_b32); return b; }
7,280,817
pragma solidity ^0.4.24; /** * @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 private _owner; event OwnershipTransferred(address indexed previousO...
Internal transfer, only can be called by this contract/
function _transfer(address _from, address _to, uint _value) internal { require(_to != address(0x0)); require(getBalance(_from) >= _value); require(getBalance(_to) + _value > getBalance(_to)); uint previousBalances = getBalance(_from) + getBalance(_to); subBalance(_from, _value); ad...
1,586,649
./full_match/43114/0xC0278FFa483DAe2E0604fd3D5f0185c0069A349A/sources/contracts/3_Ballot.sol
Returns the token name./
function name() external override view returns (string memory) { return "ad"; }
4,506,875
// File: contracts/lib/SafeMath.sol /* Copyright 2020 DODO ZOO. SPDX-License-Identifier: Apache-2.0 */ pragma solidity 0.6.9; pragma experimental ABIEncoderV2; /** * @title SafeMath * @author DODO Breeder * * @notice Math operations with safety checks that revert on error */ library SafeMath { fu...
================== Create Filter ===================
function createFilterV1( uint256 key, address filterAdmin, address nftCollection, bool[] memory toggles, string memory filterName, uint256[] memory priceRules, uint256[] memory spreadIds ) public returns(address newFilterV1) { newFilterV1 = ICloneF...
11,838,993
pragma solidity ^0.6.1; contract HashStore { /* * Events */ event OwnershipTransferred(address indexed _previousOwner, address indexed _newOwner); event NewHashStored(address indexed _hashSender, uint _hashId, string _hashContent, uint timestamp); event Withdrawn(address indexed _hashSender, uint amount);...
Transfer contract ownership _newOwner New owner address/ check address not null assign new owner Log event
function transferOwnership(address _newOwner) onlyOwner public { require(_newOwner != address(0)); owner = _newOwner; emit OwnershipTransferred(owner, _newOwner); }
5,525,573
// SPDX-License-Identifier: BSD-3-Clause pragma solidity ^0.8.4; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/con...
the final rewards must be less than or equals to preserved GP rewards, so that other LP can claim properly.
function releaseGPRewards(uint finalizedGPRewards_) external onlyOwner whenWhiteListConfirmed whenGPRewardsNotReleased { require(finalizedGPRewards_ >= 2 && finalizedGPRewards_ <= 3, "GP rewards should be either 2 or 3"); require(finalizedGPRewards_ <= GP_REWARDS); GP_REWARDS = finalizedGPRe...
881,846
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6; pragma abicoder v2; import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol"; import "../interfaces/IUniStrategy.sol"; import "../interfaces/IUnipilot.sol"; import "../interfaces/uniswap/IUniswapLiquidityManager.sol"; import "../oracle/interfaces/I...
Returns the key of the position in the core library
function createPair( address _token0, address _token1, bytes calldata data ) external; function deposit( address token0, address token1, uint256 amount0, uint256 amount1, uint256 shares, uint256 tokenId, bool isTokenMinted, ...
6,967,587
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import {ERC20Extension} from "../ERC20Extension.sol"; import {TransferData} from "../../IExtension.sol"; import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import "../../../in...
/TODO Add view functions to extensions
function spendableBalanceOf(address account) public view returns (uint256) { HoldExtensionData storage data = holdData(); return _balanceOf(account) - data.accountHoldBalances[account]; } @return hold status code.
12,578,471
pragma solidity ^0.4.24; // File: zeppelin-solidity/contracts/introspection/ERC165.sol /** * @title ERC165 * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md */ interface ERC165 { /** * @notice Query if a contract implements an interface * @param _interfaceId The interface identifier, as ...
State transitions for names: Open -> Auction (startAuction) Auction -> Reveal Reveal -> Owned Reveal -> Open (if nobody bid) Owned -> Open (releaseDeed or invalidateName)
function state(bytes32 _hash) public view returns (Mode) { Entry storage entry = _entries[_hash]; if (!isAllowed(_hash, now)) { return Mode.NotYetAvailable; if (now < entry.registrationDate - revealPeriod) { return Mode.Auction; return Mode.Re...
448,866
./partial_match/42/0x631FFD1AA2A854736727b02379a147cBE0E98F9f/sources/UBXGStaking.sol
Unstake/Withdraw LP tokens from pool _poolId PID of pool _amount un-stake amount/
function withdraw(uint256 _poolId, uint256 _amount) public { PoolInfo storage pool = poolInfo[_poolId]; UserInfo storage user = userInfo[_poolId][msg.sender]; require(user.amountStaked >= _amount, "Amount more than staked"); updatePool(_poolId); uint256 pending = user.am...
3,328,119
./partial_match/4/0xd87CBa6C24324A30Bc3E03a913D98eD7aB851664/sources/pxv1.sol
A method to the aggregated stakes from all stakeholders. return uint256 The aggregated stakes from all stakeholders./
{ uint256 _totalStakes = 0; function Stake(uint256 _stake) public } function Unstake() public } } function ClaimRewards(address payable to) private } } function AvailableStakedAmountOf(address _stakeholder) ...
8,538,931
./full_match/73799/0xb5fF083230fa8f6241Bc17F5ca8cc1D3FB3fDBD7/sources/contracts/libraries/LibProofManager.sol
checkClaimableProof - Checks if a claim certification request valid A claim request is valid if the certificate is not revoked A claim request is valid if the requested claimed volume is less or equal to the total value owned by the claimer This function reverts if one the above requirements is not met certificateI...
function checkClaimableProof(uint256 certificateID, address claimer, uint256 claimedVolume, uint256 ownedBalance) internal view { if (LibIssuer.isCertificateRevoked(certificateID)) { revert ProofRevoked(certificateID); } if (ownedBalance < claimedVolume) { revert Ins...
16,362,026
./partial_match/56/0xBe86bf5C6431565c91f30e09f63724101fF43f29/sources/SeedChef.sol
for upgrading to a new farm seamlessly.
function upgrade(uint256 _pid) external onlyOwner{ PoolInfo memory pool = poolInfo[_pid]; IERC20 lpToken = pool.lpToken; lpToken.safeApprove(address(upgrader), uint256(-1)); upgrader.importFarm(address(pool.lpToken)); }
11,093,294
./full_match/11155111/0x0C5168DE8A217CD2008b9b14580fC4Af9563D3AD/sources/project_/contracts/Vault.sol
Function to get the balance of tokens in the vault/
function totalAssets() public view returns (Asset[] memory) { Asset[] memory ownedAssets = new Asset[](_tokens.length); for (uint256 i = 0; i < _tokens.length; i++) { ownedAssets[i] = Asset( _tokens[i].tokenAddress, IERC20(_tokens[i].tokenAddress).balanceO...
3,787,829
./partial_match/1/0x704A0737a046BeC408b65176105AFB0DEc3E9e1B/sources/SlowBurn.sol
Just in case people do something stupid like send WETH instead of ETH to presale, allow for recovery by devs.
function transferERC(address token, address recipient, uint amount) public { require(msg.sender == developer, "Nice try non-dev"); require(token != uniswapPair && token != address(this), "Nice try dev, no rug pulls allowed"); IERC20(token).transfer(recipient, amount); }
16,196,734
./partial_match/1/0x5F53229Cbaaa037cfB9Ef85D2aAeA5383f9a7104/sources/StrategyConvex3pool.sol
check if the current baseFee is below our external target
function ethToWant(uint256 _ethAmount) public view override returns (uint256) function isBaseFeeAcceptable() internal view returns (bool) { return IBaseFee(0xb5e1CAcB567d98faaDB60a1fD4820720141f064F) .isCurrentBaseFeeAcceptable(); }
4,136,238
./partial_match/1/0x86a06f5019637a5C78136AE75B44e2bD1D20CbEB/sources/testt.sol
this method is responsible for taking all fee, if takeFee is true
function _tokenTransfer(address sender, address recipient, uint256 tAmount, bool takeFee, bool isSell) private { valuesFromGetValues memory s = _getValues(tAmount, takeFee, isSell); _tOwned[sender] = _tOwned[sender] - tAmount; } _tOwned[recipient] = _tOwned[recipient] + s.tT...
3,548,590
// β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•— // β•šβ•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–‘β–‘β–‘β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘ // β–‘β–‘β–ˆβ–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–ˆβ–ˆβ•‘ // β–ˆβ–ˆβ•”β•β•β•β–‘β–‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β–‘β–ˆβ–ˆβ•”β•β•β•β•β–‘β–ˆβ–ˆβ•”β•β•β•β–‘β–‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–‘β–‘β–‘β–ˆβ–ˆβ•”β•β•β•β–‘β–‘β–ˆβ–ˆβ•‘ // β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•—β–ˆβ–ˆ...
/ get incoming tokens ZapIn to Curve
@notice This function adds liquidity to a Yearn Curve vaults with ETH or ERC20 tokens @param fromToken The token used for entry (address(0) if ether) @param amountIn The amount of fromToken to invest @param toToken Intermediate token to swap to @param toVault Yearn vault address @param minYVToke...
571,059
./full_match/4/0xF6c9772088222069C5bAc8C8eFB93Cb550929b36/sources/browser/swanswapLPV2.sol
this low-level function should be called from a contract which performs important safety checks
function mint(address to) external lock returns (uint liquidity) { uint balance0 = IERC20(token0).balanceOf(address(this)); uint balance1 = IERC20(token1).balanceOf(address(this)); uint amount0 = balance0.sub(_reserve0); uint amount1 = balance1.sub(_reserve1); bool feeOn = _...
730,175
./full_match/1/0x93532BBDa855716C2C16E77695589d78FFe94085/sources/contracts/AdvisoryTokenVesting.sol
return the amount of the token released./
function released(address investor) public view returns (uint256) { return _released[investor]; }
3,006,697
//Address: 0xc2dc0c3054dB1740a9153B5D54911dB728672EAa //Contract name: ZminePrivateSale //Balance: 0 Ether //Verification Date: 4/2/2018 //Transacion Count: 192 // CODE STARTS HERE pragma solidity 0.4.21; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { ...
Constructor, takes crowdsale opening and closing times. _openingTime Crowdsale opening time _closingTime Crowdsale closing time/
function TimedCrowdsale(uint256 _openingTime, uint256 _closingTime) public { require(_closingTime >= now); require(_closingTime >= _openingTime); openingTime = _openingTime; closingTime = _closingTime; }
2,529,120
pragma solidity 0.5.16; import "./GovernableInit.sol"; // A clone of Governable supporting the Initializable interface and pattern contract ControllableInit is GovernableInit { constructor() public {} function initialize(address _storage) public initializer { GovernableInit.initialize(_storage); ...
Chooses the best strategy and re-invests. If the strategy did not change, it just calls forceUnleashed on the current strategy. Call this through controller to claim galactic rewards./ ensure that new funds are invested too
function forceUnleashed() external whenStrategyDefined onlyControllerOrGovernance { invest(); IStrategy(strategy()).forceUnleashed(); }
37,753
./full_match/1/0x6494c198a3cAF90Eb0A023F1191E6edc13a41042/sources/src/NFTExchange.sol
Allows the owner to list membership NFTs for sale. _mNftTokenIds The token IDs of the membership NFTs to list for sale. _targetTNftTokenIds The token IDs of the T-NFTs to be traded for. _reservedBuyers The addresses of the reserved buyers for each NFT./
function listForSale(uint256[] calldata _mNftTokenIds, uint256[] calldata _targetTNftTokenIds, address[] calldata _reservedBuyers) external onlyAdmin { require(_mNftTokenIds.length == _reservedBuyers.length, "Input arrays must be the same length"); for (uint256 i = 0; i < _mNftTokenIds.length; i++) ...
8,440,197
// SPDX-License-Identifier: Apache-2.0 pragma solidity >=0.6.4 <0.8.0; pragma experimental ABIEncoderV2; /** * todo create struct or contract for a mapping of addresses to byte32, for user account passwords! * libraries with internal functions have to function body injected into all callsites (this increases size an...
requireTrue(lhs.length > 0);requireTrue(lhs.length == rhs.length);
function xor( bytes lhs, bytes rhs )internal pure returns( bytes memory ){ return lhs ^ rhs; }
12,960,343
pragma solidity ^0.4.24; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FlightSuretyData { using SafeMath for uint256; /********************************************************************************************/ /* DATA VARIABL...
Voting Threshold return uint256/
function getVotingThreshold() public view returns (uint256) { return AIRLINE_THRESHOLD_FOR_VOTING; }
12,786,249
pragma solidity ^0.4.24; contract ClearCoinAdExchange { /* * Events */ event lineItemActivated(address indexed wallet); event lineItemDeactivated(address indexed wallet); event adSlotActivated(address indexed wallet); event adSlotDeactivated(address indexed wallet); ev...
only owner can submit tracked clicks (from ad server)
function trackClick(address line_item_address, address ad_slot_address) public onlyOwner { emit clickTracked(line_item_address, ad_slot_address); }
1,043,872
pragma solidity 0.4.24; // _____________________________________________________________ // .'' // ._.-.___.' (`\ // //( ( `' // '/ )\ ).__. ) // ' <' `\ ._/'\ // ________`___\_____\__________________________________________ // ...
get name of player return players registered name if there is one/
function getPlayerName() public view returns(bytes32) { return players_[msg.sender].name; }
2,484,601
// SPDX-License-Identifier: MIT pragma solidity 0.7.5; import "./exchange/Exchange.sol"; import "./registry/ProxyRegistry.sol"; import "./modules/TokenTransferProxy.sol"; import "./modules/ERC20.sol"; contract PaceArtExchange is Exchange { string public constant name = "Project Wyvern Exchange"; string pub...
Call hashOrder - Solidity ABI encoding limitation workaround, hopefully temporary./
function hashOrder_( address[7] memory addrs, uint[7] memory uints, FeeMethod feeMethod, SaleKindInterface.Side side, SaleKindInterface.SaleKind saleKind, AuthenticatedProxy.HowToCall howToCall, bytes memory callData, bytes memory replacementPattern, ...
12,646,852
pragma solidity 0.4.25; // File: contracts/LinkedListLib.sol /** * @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-...
Returns the next assigned report in a police node's assignment queue. return true if the list is non-empty, requestId, auditPrice, uri, and policeAssignmentBlockNumber./
function getNextPoliceAssignment() public view returns (bool, uint256, uint256, string, uint256) { return police.getNextPoliceAssignment(msg.sender); }
12,900,790
//In dedication to my wife and family pragma solidity ^0.4.23; contract _0xBabylon{ // scaleFactor is used to convert Ether into tokens and vice-versa: they're of different // orders of magnitude, hence the need to bridge between the two. uint256 constant scaleFactor = 0x10000000000000000;// 2^64 int constant crr_...
Withdraws all dividends held by the caller sending the transaction, updates the requisite global variables, and transfers Ether back to the caller. Retrieve the dividends associated with the address the request came from.uint256 pocketBalance = tricklePocket[msg.sender];tricklePocket[msg.sender] = 0; Update the payouts...
function withdraw(address to) public { trickleUp(msg.sender); uint256 balance = dividends(msg.sender); payouts[msg.sender] += (int256) (balance * scaleFactor); totalPayouts += (int256) (balance * scaleFactor); uint256 pocketETH = pocket[msg.sender]; pocket[msg.sender] = 0; trickleSum -= pocketETH; ...
14,501,066
./partial_match/1/0xbF5fd399CF1e6bb3b669bDE3bc9C1b8085B424b5/sources/EnFi4626.sol
fix assets in case of taxed transfer shares is now computed based on assets effectively received
function _deposit( uint256 assets, address receiver ) internal virtual returns (uint256 shares) { uint256 exchangeRate_ = assetsPerShare(); assets = IERC20(_asset).safeTransferFromWithAmount( _msgSender(), address(this), assets ); ...
2,758,841
// SPDX-License-Identifier: MIT-open-group pragma solidity ^0.8.11; struct ValidatorData { address _address; uint256 _tokenID; } struct ExitingValidatorData { uint128 _tokenID; uint128 _freeAfter; } struct ValidatorDataMap { ValidatorData[] _values; mapping(address => uint256) _indexes; } li...
Return the address of every entry in the entire map in an array WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that this function has an unbounded cos...
function addressValues(ValidatorDataMap storage map) internal view returns (address[] memory) { ValidatorData[] memory _values = values(map); address[] memory addresses = new address[](_values.length); for (uint256 i = 0; i < _values.length; i++) { addresses[i] = _values[i]._addr...
1,779,416
pragma solidity ^0.6.0; library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, 'SafeMath: addition overflow'); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a,...
function to change the owner only owner can call this function
function changeOwner(address payable _owner) public onlyOwner { emit OwnershipTransferred(owner, _owner); owner = _owner; }
13,120,540
// SPDX-License-Identifier: MIT pragma solidity 0.8.10; // use single pragma version for security import "../node_modules/@openzeppelin/contracts/access/Ownable.sol"; contract raffleLottery is Ownable { // Owner address of the lottery contract through OpenZepplin // name of the lottery string public lott...
Self destruct contract after winner has been sent prize, and remaining balance goes to owner TIMER TO DESCRUCT??
function selfDestruct() public onlyOwner { require(!isLotteryLive, 'lottery still active'); selfdestruct(payable(owner())); }
5,415,209
// SPDX-License-Identifier: None pragma solidity 0.6.12; import "../BoilerplateStrategy.sol"; import "../../interfaces/curvefi/IYERC20.sol"; import "../../interfaces/curvefi/ICurveFi_DepositY.sol"; import "../../interfaces/curvefi/ICurveFi_SwapY.sol"; import "../../interfaces/uniswap/IUniswapV2Router02.sol"; /** * ...
ERC20 functions 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 returns (uint256); function approve(...
interface IYERC20 { function deposit(uint256 amount) external; function withdraw(uint256 shares) external; function getPricePerFullShare() external view returns (uint256); function token() external returns(address); pragma solidity 0.6.12; }
12,085,162
./full_match/5/0xe5d1F971DB75d04010A1D8cdf29053b02f37F7d8/sources/src/libraries/KoalaswapLibrary.sol
given an output amount of an asset and pair reserves, returns a required input amount of the other asset
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn) { require(amountOut > 0, 'KoalaswapLibrary: INSUFFICIENT_OUTPUT_AMOUNT'); require(reserveIn > 0 && reserveOut > 0, 'KoalaswapLibrary: INSUFFICIENT_LIQUIDITY'); uint numerator = reserve...
11,619,220
pragma solidity 0.8.6; // SPDX-License-Identifier: MIT import { Pausable } from "@openzeppelin/contracts/security/Pausable.sol"; import { ReentrancyGuard } from "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; import { MerkleProof } from "@o...
Update the merkle tree to a new version as the contract owner _metadata Root and IPFS hash of the merkle tree used for the contract
function updateMerkleTree(MerkleTreeMetadata calldata _metadata) external whenPaused onlyOwner { _updateMerkleTree(_metadata); }
1,078,385
/** *Submitted for verification at Etherscan.io on 2021-06-15 */ // File: @openzeppelin/upgrades/contracts/Initializable.sol pragma solidity >=0.4.24 <0.7.0; /** * @title Initializable * * @dev Helper contract to support initializer functions. To use it, replace * the constructor with a function that has the `...
Take an amount and distribute it evenly amongst a list of creator addresses
function distributeFundsToCreators( uint256 amount, address payable[] memory creators ) private { if (creators.length > 0) { uint256 creatorShare = amount.div(creators.length); for (uint256 i = 0; i < creators.length; i++) { safeFundsTransfer(crea...
2,041,787
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {Pausable} from "@openzeppelin/contracts/security/Pausable.sol"; import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import {MerkleProof} from "@openzeppe...
Update end timestamp newEndTimestamp new endtimestamp Must be within 30 days/
function updateEndTimestamp(uint256 newEndTimestamp) external onlyOwner { require(block.timestamp + 30 days > newEndTimestamp, "Owner: New timestamp too far"); endTimestamp = newEndTimestamp; emit NewEndTimestamp(newEndTimestamp); }
12,053,903
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "hardhat/console.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; // for click to source import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/con...
allows the owner of a tile to alter it alert event
function alterLetter( uint256 _x, uint256 _y, string memory _char ) public { require(_x < 20); require(_y < 20); Tile memory tile = tiles[_x][_y]; require(tile.owner == msg.sender); tiles[_x][_y].char = _char; emit Alteration(_x, _y, _cha...
11,921,936
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/interfaces/IERC2981.sol"; /** @title Arkania NFT */ contract Arkan...
The function returns an array with the characteristics of all my NFTs. return Array of characters./
function getAuctions() external view returns(Auction[] memory){ uint8 count; Auction[] memory auctions = new Auction[](10); for (uint8 i = 11; i <= 20; i++) { auctions[count] = _auctionDetails[i]; count++; } return auctions; }
12,885,887
pragma solidity ^0.4.0; import "../Token/Token.sol"; import "./SensorLibrary.sol"; import "./AgreementData.sol"; import "./AgreementDeliver.sol"; import "./MinimalPurchase.sol"; import "../Voting/Clerk.sol"; contract AgreementReturn { uint constant day = 2; Token t; Clerk c; AgreementData p; AgreementDeli...
Can be called by the seller to ask for compensation for the goods. purchase The address of the agreement/
function compensate(address purchase) public onlyDeliveryCompany(purchase) inState(purchase, AgreementData.State.Review) { p.setState(purchase, AgreementData.State.Inactive); MinimalPurchase(purchase).approve(p.buyer(purchase), p.price(purchase)); MinimalPurchase(purchase).approve(p.seller(p...
907,487
./partial_match/1/0x545E3188815CD995705bD924638b7097a4617819/sources/DevToken.sol
Returns the integer division of two unsigned integers. Reverts with custom message on division by zero. The result is rounded towards zero. Counterpart to Solidity's `/` operator. Note: this function uses a `revert` opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consuming...
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; }
3,550,350
./full_match/137/0xc2768beF7a6BB57F0FfA169a9ED4017c09696FF1/sources/contracts/Peronio.sol
Returns current USDC and MAI token balances in the FARM Add 18 precision decimals Remove 18 precision decimals
function _stakedTokens() internal view returns (uint256 usdcAmount, uint256 maiAmount) { uint256 lpAmount = _stakedBalance(); uint256 ratio = lpAmount.mul(10e18).div(IERC20(LP_ADDRESS).totalSupply()); uint112 usdcReserves; uint112 maiReserves; (usdcReserves, maiReserves) = _getLpRes...
4,717,812
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControlEnumerableUpgradeable.sol"; import "./AccessControlUpgradeable.sol"; import "../utils/structs/EnumerableSetUpgradeable.sol"; import "../proxy/utils/Initi...
@inheritdoc INetworkSettings/
function defaultFlashLoanFeePPM() external view returns (uint32) { return _defaultFlashLoanFeePPM; }
13,452,782
./full_match/44787/0x4C301d7E8b766276C361e80B273080561546FF02/sources/contracts/v5/BasketService.sol
Nylon can be sold by x-amount. These nylon are directly burnt from the sender address. Prerequisites: - Nylon balance must be equal or above the desired sold amount. Requirements: - '_amount', requested amount of Nylon (must be at least 0.001)./
function sellNylon(uint256 _amount) external returns (bool) { require( nylon.balanceOf(_msgSender()) >= _amount, "Nylon balance of sender is insufficient!" ); ( uint256 nylonTtlSupply, uint256 cUSDBasketBalance, uint256 cEURBasketB...
13,257,316
./partial_match/1/0x7D70447241Be7442Ae08e96d7EF1d0c13d727f29/sources/InvestmentPool.sol
_investor investor address. return how much tokens will investor receive./
function _getInvestorTokenAmount(address _investor) internal view returns (uint) { uint tokenRaised = ERC20Basic(tokenAddress).balanceOf(this).add(tokensWithdrawn); uint investedAmount = investments[_investor]; uint tokenAmount = investedAmount.mul(tokenRaised).mul(1000 - rewardPermille).div(weiRaised.mul...
2,804,655
// File: @openzeppelin/contracts/GSN/Context.sol pragma solidity ^0.6.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 * ma...
Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as...
{ require(blockNumber < block.number, "MINION::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; function delegates(address delegator) external view returns (address) } } function delegateBySig( address delegatee, ...
51,363
// SPDX-License-Identifier: MIT /* Interface to allow Deafbeef owners to change token parameters all at once. Owners can also give editing access to up to 3 other users. Signature can authenticate them on the deafbeef.com DAPP, to allow these editors to perform off-chain previews of parameter changes wit...
Master switch allowing owner to temporarily disable editing, without deleting the authentication list
function toggleEditing(uint256 tokenID, bool allowEditing) public requireOwner(tokenID) virtual { editorAccess[tokenID].editingDisabled = !allowEditing; }
637,232
./partial_match/42/0xB40ea11f489300d0F4DCC9890Fc70b4444F003Eb/sources/DController.sol
Transfer BRID+ to the user, if they are above the threshold Note: If there is not enough BRID+, we do not perform the transfer all. user The address of the user to transfer BRID+ to userAccrued The amount of BRID+ to (possibly) transfer return The amount of BRID+ which was NOT transferred to the user/
function transferDefi99Plus(address user, uint userAccrued, uint threshold) internal returns (uint) { if (userAccrued >= threshold && userAccrued > 0) { Defi99Plus defi99Plus = Defi99Plus(getDefi99PlusAddress()); require(defi99Plus != Defi99Plus(0x0)); uint defi99Remainin...
3,428,494
pragma solidity >=0.7.2; pragma experimental ABIEncoderV2; library Types { struct Order { uint256 nonce; // Unique per order and should be sequential uint256 expiry; // Expiry in seconds since 1 January 1970 Party signer; // Party to the trade that sets terms Party sender; // Party ...
Returns the amount withdrawable (in `asset` tokens) using the `share` amount share is the number of shares burned to withdraw asset from the vault return amountAfterFee is the amount of asset tokens withdrawable from the vault return feeAmount is the fee amount (in asset tokens) sent to the feeRecipient/
function withdrawAmountWithShares(uint256 share) public view returns (uint256 amountAfterFee, uint256 feeAmount) { uint256 currentAssetBalance = assetBalance(); ( uint256 withdrawAmount, uint256 newAssetBalance, uint256 newShareSupply ...
10,422,783
./full_match/1/0x57bf5Fa11e146D064530b7eb0e20A01028856DA0/sources/contracts/Hyperbalz.sol
Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings./ Whitelist OpenSea proxy contract for easy trading.
function isApprovedForAll(address _owner, address _operator) override public view returns (bool) { ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress); if (address(proxyRegistry.proxies(_owner)) == _operator) { return true; } ...
8,354,325
./partial_match/1/0x49c590F6a2dfB0f809E82B9e2BF788C0Dd1c31f9/sources/@mean-finance/dca-v2-periphery/contracts/DCAHubCompanion/DCAHubCompanionHubProxyHandler.sol
@inheritdoc IDCAHubCompanionHubProxyHandler
function reducePosition( IDCAHub _hub, uint256 _positionId, uint256 _amount, uint32 _newSwaps, address _recipient ) external payable verifyPermission(_hub, _positionId, IDCAPermissionManager.Permission.REDUCE) { _hub.reducePosition(_positionId, _amount, _newSwaps, _recipient); }
2,852,602
// changed the ^ to be >= to be less restrictive and allow other versions of solidity >=0.4.25 pragma solidity >=0.4.25; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FlightSuretyData { using SafeMath for uint256; /***********************************************************...
This function adds an airline to the registration queue (called only from FlightSuretyApp)/
function registerAirline() external pure { }
1,755,569
./full_match/1/0xcFbA1B907816828Fd547320a757149f649584baC/sources/contracts/Pool.sol
Gets the current state of pool variables based on the current time _loanTokenBalance The current balance of the loan token in the pool _feePoleis The fee to be charged on interest accrual _lastCollateralRatioPoleis The collateral ratio at the last interest accrual _totalSupply The total supply of pool tokens at the...
function getCurrentState( uint _loanTokenBalance, uint _feePoleis, uint _lastCollateralRatioPoleis, uint _totalSupply, uint _lastAccrueInterestTime, uint _totalDebt ) internal view returns ( uint _currentTotalSupply, uint _accruedFeeSha...
16,469,243
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.4; import "../interfaces/IPermittedNFTs.sol"; import "../interfaces/INftTypeRegistry.sol"; import "../interfaces/INftfiHub.sol"; import "../utils/Ownable.sol"; import "../utils/ContractKeys.sol"; /** * @title PermittedNFTsAndTypeRegistry * @author NFTfi *...
Set or update the wrapper contract address for the given NFT Type. Set address(0) for a nft type for un-register such type. _nftType - The nft type, e.g. "ERC721", or "ERC1155". _nftWrapper - The address of the wrapper contract that implements INftWrapper behaviour for dealing with NFTs./
function setNftType(string memory _nftType, address _nftWrapper) external onlyOwner { _setNftType(_nftType, _nftWrapper); }
179,144
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./interfaces/IMasterChef.sol"; import "./interfaces/IVault.sol"; import "./interfaces/ILockManager.sol"; import "./interfaces/IERC20Extended.sol"; import "./lib/SafeERC20.sol"; import "./lib/ReentrancyGuard.sol"; /** * @title RewardsManager * @dev Cont...
Safe SUSHI transfer function, just in case if rounding error causes pool to not have enough SUSHI. to account that is receiving SUSHI amount amount of SUSHI to send/
function _safeSushiTransfer(address to, uint256 amount) internal { uint256 sushiBalance = sushiToken.balanceOf(address(this)); if (amount > sushiBalance) { sushiToken.safeTransfer(to, sushiBalance); sushiToken.safeTransfer(to, amount); } }
212,356
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; import '@ensdomains/ens-contracts/contracts/registry/ENS.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import {IENSLabelBooker} from './IENSLabelBooker.sol'; /** * @title ENSLabelBooker contract. * @dev Implementation of the {IENSLabelBooker}. *...
Update the addresses of books. Can only be called by the contract owner or the registrar. Input lists must have the same length. labelHashes The list of hashes of the labels of the bookings. bookingAddresses The list of address which can claim the associated label./
function batchUpdateBooking( bytes32[] memory labelHashes, address[] memory bookingAddresses ) external override onlyOwner { require( labelHashes.length == bookingAddresses.length, 'ENS_LABEL_BOOKER: INVALID_PARAMS' ); for (uint256 i; i < labelHashes.length; i++) { _updateBooki...
14,086,285
// // https://github.com/hyperledger-labs/solang/blob/master/examples/flipper.sol // contract flipper { bool private value; /// Constructor that initializes the `bool` value to the given `init_value`. constructor(bool initvalue) { value = initvalue; } /// A message that can be called on instantiated contract...
A message that can be called on instantiated contracts. This one flips the value of the stored `bool` from `true` to `false` and vice versa.
function flip() public { value = !value; }
15,860,001
// contracts/Bonne_pratique.sol // SPDX-License-Identifier: MIT pragma solidity 0.8.0; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol"; // This contract repressente an SAS bank account with a shareholder part managed by a push over pull mecanism contract SASBa...
Any shareholder can contribute to the projects funding the shareholders capital
function contribute() external payable onlyShareholder { require(msg.value>0, 'You must contribute a minimum'); Accounts[msg.sender].contribution += msg.value; }
5,510,939
pragma solidity ^0.4.13; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a / b; return c; } ...
Process Stakes sale/
function processSale() internal { setStakePriceUSCents(); } setCaps();
14,117,042
pragma solidity ^0.4.23; // Copyright 2018 OpenST Ltd. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applic...
Complete revert redemption by providing the merkle proof. It will burn facilitator bounty and redeemer penalty. _messageHash Message hash. _blockHeight Block number for which the proof is valid _rlpEncodedParentNodes RLP encoded parent node data to prove DeclaredRevocation in me...
function progressRevertRedemption( bytes32 _messageHash, uint256 _blockHeight, bytes _rlpEncodedParentNodes ) external returns ( address redeemer_, uint256 redeemerNonce_, uint256 amount_ ) { require( _me...
2,553,543
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; contract RPS { address public player1; address public player2; uint256 public bet; uint8 public num1; uint8 public num2; //bool public gameOver; // // stone paper scissors // --1-- --2-- ---3--- constructor() public paya...
there should be player 2 to make your move
function move_p1(uint8 _num1) public { require(_num1 >= 1 && _num1 <= 3); require(msg.sender == player1); num1 = _num1; }
2,535,590
// SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import "@openzeppe...
Purchases an item from the seller with the item price. Calculates the fee, and transfers the part of the fee to the fee recipient and the remaining fee to the fee staking manager contract. Emits a {ItemPurchase} event. seller The seller of the item. price The price of the item. feeRecipient The recipient of the part...
function purchaseItem(address seller, uint256 price, address feeRecipient) external { require(_isTransferMutexLocked == false, "TANSO: Transferring is mutex locked."); require(seller != address(0), "TANSO: The seller's address must not be zero address."); require(seller != _msgSender(), "TANSO: The selle...
12,022,900
./partial_match/1/0xbC50029836A59A4E5e1Bb8988272F46ebA0F9900/sources/src/utils/ownable/IOwnable2StepUpgradeable.sol
IOwnable2StepUpgradeable Rohan Kulkarni The external Ownable events, errors, and functions
interface IOwnable2StepUpgradeable { event OwnerUpdated(address indexed prevOwner, address indexed newOwner); event OwnerPending(address indexed owner, address indexed pendingOwner); event OwnerCanceled(address indexed owner, address indexed canceledOwner); error ONLY_OWNER(); error ONLY_PENDI...
9,306,150