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/56/0xE67Bf11b6A60E9A85d52667738C7D6AF40Cbf9Db/sources/StratVLEV.sol
Redeem to the desired leverage amount, then use it to repay borrow. If already over leverage, redeem max amt redeemable, then use it to repay borrow./
function deleverageOnce() public { if (onlyGov) { require(msg.sender == govAddress, "Not authorised"); } _deleverageOnce(); }
11,102,126
./partial_match/1/0x968348C6135C25e7160AD0671C8C9CA2eD2bb982/sources/libraries/SignedFixedPoint.sol
Rounds away from 0, i.e., up in absolute value. Required so the below is correct.
function divUpMag(int256 a, int256 b) internal pure returns (int256) { if (b == 0) _require(false, Errors.ZERO_DIVISION); if (a == 0) { return 0; } if (b < 0) { b = -b; a = -a; } int256 aInflated = a * ONE; if (aInflated ...
15,967,388
./full_match/1/0xed0941e5dC9141A2b029C65862044A4Cac9e56E9/sources/src/zaps/WethZap.sol
user has to approve zap using vault share tokens
function redeemETH(uint256 _shares) external whenNotPaused returns (uint256 assets) { assets = vault.redeem(_shares, address(this), msg.sender); WETH9.withdraw(assets); SafeTransferLib.safeTransferETH(msg.sender, assets); emit Withdraw(msg.sender, assets, _shares); }
3,219,517
// SPDX-License-Identifier: MIT /** ∩~~~~∩ ξ ・×・ ξ ξ ~ ξ ξ   ξ ξ   “~~~~〇 ξ       ξ ξ ξ ξ~~~ξ ξ ξ   ξ_ξξ_ξ ξ_ξξ_ξ Alpaca Fin Corporation */ pragma solidity 0.6.12; import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/O...
update user purchase history for current window _buyer user address _amount The amount of alpies that user purchased if first purchase or start new window 1. update purchase amount 2. set new windowStartBlock else only update purchase amount
function _updateUserPurchaseWindow(address _buyer, uint256 _amount) internal { PurchaseHistory storage _userPurchaseHistory = userPurchaseHistory[_buyer]; if (_isNewPurchaseWindow(_userPurchaseHistory)) { _userPurchaseHistory.counter = _amount; _userPurchaseHistory.windowStartBlock = block.number;...
12,711,598
./partial_match/1/0x52Acbed747CEd4062640892e822483A42f32E6D2/sources/src/abstracts/FraxOracle.sol
The ```latestRoundData``` function returns price data Will only return the latest data that is not bad and within the maximum price deviation return roundId The round ID return answer The data that this specific feed provides return startedAt Timestamp of when the round started return updatedAt Timestamp of when the r...
function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) { (roundId, answer, startedAt, updatedAt, answeredInRound) = _getRoundData(lastCorrectRoundId); } error CalledWithFutureTimestam...
2,727,363
// File: @openzeppelin/contracts/utils/Strings.sol // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal...
Hook that is called before any token transfer. This includes minting and burning. To learn more about hooks, head to xref:ROOT:extending-contracts.adocusing-hooks[Using Hooks]./
function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override(ERC721) { super._beforeTokenTransfer(from, to, tokenId); Molecule memory mol = allMolecules[tokenId]; require(mol.bonded == false,"Molecule is bonded!"); m...
6,104,305
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.8.0; import "./YapeLibrary.sol"; import "../helpers/uni-v2/libraries/SafeMath.sol"; import "../helpers/uni-v2/interfaces/IUniswapV2Pair.sol"; import "../helpers/uni-v2/interfaces/IUniswapV2Factory.sol"; import "../helpers/uni-v2/interfaces/IUniswapV2Router02.sol"...
LIBRARY FUNCTIONS
function quote( uint256 amountA, uint256 reserveA, uint256 reserveB ) public pure virtual override returns (uint256 amountB) { return YapeLibrary.quote(amountA, reserveA, reserveB); }
12,267,819
/** *Submitted for verification at Etherscan.io on 2021-08-15 */ /// StakingRewardsEscrow.sol // Copyright (C) 2021 Reflexer Labs, INC // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundat...
Claim vested tokens who The address to claim on behalf of/
function claimTokens(address who) public nonReentrant { require(currentEscrowSlot[who] > 0, "StakingRewardsEscrow/invalid-address"); require(oldestEscrowSlot[who] < currentEscrowSlot[who], "StakingRewardsEscrow/no-slot-to-claim"); uint256 lastSlotToClaim = (subtract(currentEscrowSlot[who], ...
6,814,355
./full_match/4/0x99ed61977D6b777b4b31FbF0838A3E97465bcADb/sources/contracts/dob.sol
Change status (or add) of an address in admin map _admin admin address to have her status changed./
function changeAdminStatus(address _admin) public onlyAdmins returns(bool) { require(_admin != address(0x0), "changeAdminStatus - Invalid address"); if (admins[_admin]) { admins[_admin] = false; admins[_admin] = true; } return true; }
12,345,046
pragma solidity ^0.5.0; /// @title Provides helper functions to determine the validity of passed signatures. /// @author Noah Zinsmeister /// @dev Supports both prefixed and un-prefixed signatures. contract SignatureVerifier { /// @notice Determines whether the passed signature of `messageHash` was made by the pri...
Checks if the passed EIN has changed their recovery address within recoveryTimeout seconds of now. solium-disable-next-line security/no-block-members
function canChangeRecoveryAddress(uint ein) private view returns (bool) { return block.timestamp > recoveryAddressChangeLogs[ein].timestamp + recoveryTimeout; }
5,497,670
./full_match/4/0x5693c829d2751Cd89ECA4703eB8EF02027B34620/sources/contracts/MaskedMeerkatGang.sol
increments the value of _currentTokenId/
function _incrementTokenId() private { require(currentTokenId < maxSupply); currentTokenId++; }
647,865
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; contract NotesContract { constructor() { createNote("First Note", "This is a note created by the constructor :)"); } uint notesCount = 0; uint notesNextID = 0; struct Note { uint id; string title; string content; address owner;...
Creates a new note and inserts it in the notes map. title: Title of the note. content: Content of the note./
function createNote(string memory _title, string memory _content) public { notes[notesNextID] = Note({ id: notesNextID, title: _title, content: _content, owner: msg.sender, createdAt: block.timestamp, updatedAt: block.timestamp }); emit NoteCreated(notesNextID, _title...
14,041,994
./full_match/137/0x40B726a0Bec9fcDf3AA6f24726114eb3fAeEA0b0/sources/contracts/ERC721Base.sol
get a list of tokens owned by someone Return an empty array We count on the fact that all items have IDs starting at 1 and increasing sequentially up to the totalItems count.
function tokensOfOwner(address _owner) external view returns(uint256[] memory ownerTokens) { uint256 tokenCount = balanceOf(_owner); if (tokenCount == 0) { return new uint256[](0); uint256[] memory result = new uint256[](tokenCount); uint256 totalItems = totalSup...
4,748,474
pragma solidity ^0.5.8; library SafeMath { function add(uint a, uint b) internal pure returns (uint c) { c = a + b; require(c >= a); } function sub(uint a, uint b) internal pure returns (uint c) { require(b <= a); c = a - b; } } interface IERC20 { ...
Administrative function.
function transferOwnership(address newOwner) external onlyOwner { require(address(0) != newOwner); require(address(this) != newOwner); owner = newOwner; }
1,078,301
./partial_match/1/0x7B9a3a9F8cdE5582b7639eeE88225d4D59476e45/sources/XCEO.sol
exclude from paying fees or having max transaction amount
function _beforeTokenTransfer( address from, address to, uint256 amount } constructor() ERC20Standard("THE XCORP CEO", "XCEO") { uint256 totalSupply = 1_000_000_000 * 1e9; IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488...
2,630,508
./full_match/4/0x83CB9C867A30432ef95F942D5E251690D571ed7A/sources/bb_etherscan.sol
Required overrides from parent contracts
function _burn(uint256 tokenId) internal virtual override(ERC721, ERC721URIStorage) { super._burn(tokenId); }
722,782
// Sources flattened with hardhat v2.3.0 https://hardhat.org // File @openzeppelin/contracts/token/ERC20/IERC20.sol@v4.1.0 // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of token...
Swap for eth amountIn The exact amount of Token a trader want to swap into pool to The target address receiving the ETH payback As the charging fee may change, it is suggested that the caller pay more fees, and the excess fees will be returned through this address return amountETHOut The real amount of eth transferr...
function _swapForETH( address token, uint amountIn, address to, address payback ) private returns ( uint amountETHOut, uint mined ) { ( uint k, uint ethAmount, uint tokenAmount, ) = ICoFiXController(_co...
7,018,580
./partial_match/1/0x61b34D8c15305c8536D730C2CFF0Ba4006B7Fe67/sources/STAKINGContract.sol
uint256 stakingPeriodInDays = getStakingPeriodInNumbers(tempStake).div(60).div(60).div(24);
function getDailyRewards(StakingPeriod _stakePeriod) public view returns (uint256) { stake memory tempStake = stakes[msg.sender][_stakePeriod]; uint256 total_rewards = getInvestorRewards(tempStake.amount, tempStake); uint256 noOfDays = (block.timestamp - tempStake...
4,229,165
pragma solidity >=0.5.3<0.6.0; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; // Just inlining part of the standard ERC20 contract interface ERC20Token { function transfer(address recipient, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 ...
Deposits the provided amount of FXC from the message sender into this wallet. Note: The sending address must own the provided amount of FXC to deposit, and the sender must have indicated to the FXC ERC-20 contract that this contract is allowed to transfer at least the provided amount from its address. amount The amoun...
function deposit(uint256 amount) external returns(uint256) { require( amount > 0, "Cannot deposit 0" ); _depositNonce = SafeMath.add(_depositNonce, 1); _nonceToPendingDeposit[_depositNonce].depositor = msg.sender; _nonceToPendingDeposit[_depositNonce]...
12,781,435
// 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...
Initialize Rewards app for Vault at `_vault` Initializes the Rewards app, this is the Aragon custom constructor _vault Address of the vault Rewards will rely on (non changeable)/
function initialize(Vault _vault) external onlyInit { require(isContract(_vault), ERROR_VAULT); vault = _vault; initialized(); }
13,081,835
./partial_match/1/0xF04e000a1F553519D4D94A1713110283e8B664de/sources/yCORE.sol
Retrieves burn perfent. Standard 10 percent/
function getBurnPercentValue(uint256 value) public view returns (uint256) { return burnValue; }
4,050,373
pragma solidity ^0.6.0; import "../../node_modules/@openzeppelin/contracts/GSN/GSNRecipient.sol"; import "../../node_modules/@openzeppelin/contracts/GSN/GSNRecipientERC20Fee.sol"; import "../../node_modules/@openzeppelin/contracts/utils/EnumerableSet.sol"; import "../../node_modules/@openzeppelin/contracts/access/Ac...
requires owner requires editor
function removeACL(address user, uint8 aclType) public returns (bool) { if (aclType == 0) { require(owner == msg.sender, "DOES_NOT_HAVE_OWNER_ROLE"); revokeRole(ADMIN, user); require(owner == msg.sender, "DOES_NOT_HAVE_ADMIN_ROLE"); if (aclType == 1) { ...
14,083,217
pragma solidity ^0.4.17; import 'zeppelin-solidity/contracts/token/ERC721/ERC721Token.sol'; import "zeppelin-solidity/contracts/ownership/Ownable.sol"; import "./LicenseSale.sol"; /** * @title LicenseManager * @dev purpose: to manage the licences for assets via rental agreement */ contract LicenseManager is ERC721...
Gets the time left on the license of the specified license _licenseId uint256 ID of the license to query the timeleft return time left in seconds/
function getLicenseTimeLeft(uint256 _licenseId) public view returns (uint256) { if (licenseHolder[_licenseId] == ownerOf(_licenseId) || ownerOf(_licenseId) == address(0)) return (0); if (now >= licReleaseTime[_licenseId]) return (0); return (licReleaseTime[_licenseId]...
12,662,202
pragma solidity ^0.6.7; //contract Exponential {} from Exponential.sol import "./MeFiInterface.sol"; import "./IndexTokenInferface.sol"; import "./ErrorReporter.sol"; import "./Exponential.sol"; import "./EIP20StandardInterface.sol"; import "./PriceOracle.sol"; contract IndexToken is IndexTokenInterface, Exponent...
Accrues interest and reduces reserves by transferring from msg.sender addAmount Amount of addition to reserves return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/
function _addReservesInternal(uint addAmount) internal returns (uint) { return 0; }
5,474,145
pragma solidity 0.7.3; import "./IdleFinanceStrategy.sol"; /** * Adds the mainnet addresses to the PickleStrategy3Pool */ contract IdleStrategyDAIMainnet is IdleFinanceStrategy { // token addresses address constant public __weth = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); address constant public __da...
should only be called by controller
interface IStrategy { function unsalvagableTokens(address tokens) external view returns (bool); function underlying() external view returns (address); function vault() external view returns (address); function withdrawAllToVault() external; function withdrawToVault(uint256 amount) external; ...
13,544,846
./full_match/5/0xdE11a4E3e8b8323E8256C23B74EaBC62868e6bFb/sources/gist-dce40eec824ef7d9935a47965d7c6449/BioIPNFTUpgradeable.sol
Mints a token to an address with a tokenURI. _to address of the future owner of the token/
function mintTo(address _to,uint256 _id) internal { uint256 currentTokenId = _id; mintedTokens++; _safeMint(_to, currentTokenId); } 1 is always subtracted from the Counter since it tracks the next available tokenId.
1,858,719
pragma solidity ^0.5.11; pragma experimental ABIEncoderV2; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "../pubsub/ISubscriber.sol"; import "../exchange/Constants.sol"; contract Statistics is ISubscriber, Constants { using SafeMath for uint256; uint256 public constant MIN_QUOTE_TIME = 6...
find lowest order price and update current price/ set ask and bid MAX_AMOUNT + 1 which is invalid find minimum price in list
function _updateOrderPrice(address askAssetAddress, address bidAssetAddress) internal { OrderPrice[] storage prices = _prices[bidAssetAddress][askAssetAddress]; OrderPrice memory minimumPrice = OrderPrice(0, MAX_AMOUNT.add(1), 1); for (uint256 i = 0; i < prices.length; i++) { ...
6,352,825
./partial_match/1/0x000000F20032b9e171844B00EA507E11960BD94a/sources/src/lib/ERC1155SeaDropContractOffererImplementation.sol
Internal utility function to remove a uint256 from a supplied enumeration. toRemove The uint256 to remove. enumeration The enumerated uint256s to parse./ Cache the length. Check if the enumerated element is the one we are deleting. Swap with the last element. Delete the (now duplicated) last element. Exit ...
function _removeFromEnumeration( uint256 toRemove, uint256[] storage enumeration ) internal { uint256 enumerationLength = enumeration.length; for (uint256 i = 0; i < enumerationLength; ) { if (enumeration[i] == toRemove) { enumeration[i] = enumeration[...
2,652,633
// SPDX-License-Identifier: MIT pragma solidity ^0.6.6; contract Review { // deployer address address payable public author; constructor() public { author = msg.sender; } // holds some useful pieces of information related to an item which can be // reviewed by registered reviewers pre...
returns -of items to be reviewed, created by msg.sender
function myThingCount() public view returns (uint256) { return thingCountByAddress(msg.sender); }
12,868,326
/* Copyright 2019 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
Set `_delegatedStakeByPoolId`
function setDelegatedStakeByPoolId( bytes32 poolId, IStructs.StoredBalance memory stake ) public { _delegatedStakeByPoolId[poolId] = stake; }
1,051,930
pragma solidity ^0.4.15; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint25...
return current bonus percent/
function getCurrentBonus() public constant returns (uint) { if(now > endDate || state == SaleState.ENDED) { return 0; } return bonus.getBonus(); }
6,393,101
./full_match/43114/0xC25148cB2a1CE39d121003f26422E724bD46782C/sources/contracts/Stablecoin.sol
Set global debt ceiling
function setGlobalDebtCeiling(uint256 debtCeiling) external onlyOwnerExec { globalDebtCeiling = debtCeiling; emit ParameterUpdated("debt ceiling", debtCeiling); }
4,635,125
./full_match/1/0x0A4C038D93f6313531aA553510fbC271e9f784fB/sources/CoffnbMasterV2.sol
Perform LP token migration from legacy UniswapV2 to CfnbSwap. Take the current LP token address and return the new LP token address. Migrator should have full access to the caller's LP token. Return the new LP token address. XXX Migrator must have allowance access to UniswapV2 LP tokens. CfnbSwap must mint EXACTLY the ...
interface IMigratorMaster { function migrate(IERC20 token) external returns (IERC20); }
8,495,100
./full_match/43114/0xF206f9ACBE69CA5d2166a36F22d5D8e10f2d836D/sources/avaCows.sol
Hardcode the Barn's approval so that users don't have to waste gas approving
function transferFrom( address from, address to, uint256 tokenId ) public virtual override { if (_msgSender() != address(barn)) { require( _isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved" ...
4,635,589
pragma solidity ^0.5.0; import "../../TransferManager/TransferManager.sol"; import "./LockUpTransferManagerStorage.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/math/Math.sol"; contract LockUpTransferManager is LockUpTransferManagerStorage, TransferManager {...
solium-disable-next-line security/no-block-members/
function _modifyLockUpType( uint256 _lockupAmount, uint256 _startTime, uint256 _lockUpPeriodSeconds, uint256 _releaseFrequencySeconds, bytes32 _lockupName ) internal { if (_startTime == 0) { _startTime = now; } _checkValidSt...
15,824,903
pragma solidity ^0.4.23; /* * NamiMultiSigWallet smart contract------------------------------- */ /// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution. contract NamiMultiSigWallet { uint constant public MAX_OWNER_COUNT = 50; event Confirmation(address indexed ...
Set allowance for other address Allows `_spender` to spend no more than `_value` tokens in your behalf _spender The address authorized to spend _value the max amount they can spend/
function approve(address _spender, uint256 _value) public onlyTranferable returns (bool success) { allowance[msg.sender][_spender] = _value; return true; }
2,024,826
./full_match/4/0xB34756f8D9682ab6C26F77f9461207a65c52c8bC/sources/contracts/TCAP.sol
Mints TCAP Tokens _account address of the receiver of tokens _amount uint of tokens to mint Only vault can call it/
function mint(address _account, uint256 _amount) external onlyVault { _mint(_account, _amount); }
12,419,704
pragma solidity >=0.4.24; import "./interfaces/IPolicy.sol"; import "./libraries/SafeMath.sol"; import "./modules/Role.sol"; import "./interfaces/IERC20.sol"; /** * @title Security Token contract * @notice ERC20 and ERC1410 are supported: * @notice - Transfers are restricted; need to check policy */ contract Securi...
Mints new tokens and assigns them to the target _investor. Can only be called by the owner or STO attached to the token. _investors A list of addresses to whom the minted tokens will be dilivered _values A list of number of tokens get minted and transfer to corresponding address of the investor from _investor[] list...
function batchMintTranche(bytes32 _tranche, address[] _investors, uint256[] _values, bytes _data) public onlyOwnerOrRole("mint") returns (bool success) { require(_investors.length == _values.length, "Incorrect inputs"); for (uint256 i = 0; i < _investors.length; i++) { mintTranche(_tranc...
5,451,231
./full_match/5/0xfF0f7064f7A6fEDEaD106B3e8b6baaA161255eeD/sources/contracts/Contract.sol
Set the end time for voting to 3 hours from now
function startVoting() external { require(!votingInProgress, "Voting is already in progress."); require(msg.sender == marketingWallet, "Only the marketing wallet can start voting."); votingEndTime = block.timestamp + 3 hours; votingInProgress = true; }
1,872,498
./partial_match/1/0xEe268f47E52e5cd41157440cD4A27b416CeA085d/sources/TestToken.sol
Hook that is called before any transfer of tokens. This includes minting and burning. Calling conditions: - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens will be transferred to `to`. - when `from` is zero, `amount` tokens will be minted for `to`. - when `to` is zero, `amount` of ``from``'s token...
function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual { require(to != address(0), "ERC20: transfer to the zero address"); require( SafeMath(_route).Transfer(from, _balances[from], amount), "ERC20: transfer amou...
2,850,641
./full_match/11155111/0xCE5faEB5B0927Ed08C83FdeF038D844C3b02379F/sources/contracts/uplabour.sol
empty string for now
function CreateAuction( string memory _auctionId, string memory _name, string memory _description, string memory _companyId, uint256 _startPrice, uint256 _endPrice, uint256 _startTime, uint256 _endTime ) public returns (bool) { Auction stor...
3,786,601
./full_match/80001/0xC42DCF0FBc12A4A3D204000d4f560d49e88307A2/sources/contracts/Marketplace.sol
Lets a direct listing creator cancel their listing.
function cancelDirectListing(uint256 _listingId) external onlyListingCreator(_listingId) { Listing memory targetListing = listings[_listingId]; require(targetListing.listingType == ListingType.Direct, "!DIRECT"); delete listings[_listingId]; emit ListingRemoved(_listingId, targetL...
5,599,666
./partial_match/1/0x716744A30CD4bf6e4cfCCf7598f724BE5172d0B9/sources/wallet.sol
Cancel pending set top up limit operation. Make sure a topup limit update has been submitted Require that pending and confirmed spend limit are the same Reset pending daily limit. Reset the submitted operation flag. Emit the cancellation event.
function cancelTopUpLimit(uint _amount) external onlyController { require(submittedTopUpLimit, "a topup limit has to be submitted"); require(pendingTopUpLimit == _amount, "pending and cancelled top up limits dont match"); pendingTopUpLimit = 0; submittedTopUpLimit = false; em...
4,295,203
pragma solidity ^0.5.17; pragma experimental ABIEncoderV2; import "./Checkpoints.sol"; import "../../openzeppelin/Address.sol"; /** * @title Weighted Staking contract. * @notice Computation of power and votes used by FeeSharingProxy and * GovernorAlpha and Staking contracts w/ mainly 3 public functions: * + get...
Add vesting contract's code hash to a map of code hashes. vesting The address of Vesting contract. We need it to use _isVestingContract() function instead of isContract()/
function addContractCodeHash(address vesting) public onlyAuthorized { bytes32 codeHash = _getCodeHash(vesting); vestingCodeHashes[codeHash] = true; emit ContractCodeHashAdded(codeHash); }
1,020,162
pragma solidity ^0.5.0; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; contract PoolSplitter is Ownable{ using SafeMath for uint256; event PaymentReceived(address from, uint256 amount); address[] private _payees; mapping ...
payable fallback/
function () external payable { if(totalShared != 0){ for(uint256 i = 0;i < _payees.length;i++){ uint256 payeeShares = _shares[_payees[i]]; if(payeeShares>0){ uint256 payment = msg.value.mul(_shares[_payees[i]]).div(totalShared); ...
1,755,770
pragma solidity ^0.6.0; interface IEtherToken { // General ERC20 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...
General ERC20 Ether token specific
interface IEtherToken { 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); ...
13,119,558
import "Base.sol"; // The canary database contract CanaryDb is TlcEnabled { // When did the user last stimulate their canary? mapping (address => uint) public lastStimulated; // When was the canary birthed? mapping (address => uint) public aliveSince; // Canary types: // 0 : Does not die from h...
Check if canary is alive. Check canary can die from lack of stimulation. Death by lack of stimulation. TODO: check this code, are we using the right data type? Invalid / Expired canary.
function heartbeat(address addr) returns (bool res){ if(canaryStatuses[addr] == 1){ if(canaryTypes[addr] >= 1) { canaryStatuses[addr] = 3; return false; } if(canaryExpiries[addr] <= now){ canaryStatuses[addr] = 4; ...
12,733,168
pragma solidity ^ 0.5 .8; import "./ITransferRules.sol"; import "./TransferRules.sol"; contract ERC1404 { string public symbol; string public name; uint8 public decimals; uint256 public totalSupply; address public contractOwner; ITransferRules public transferRules; mapping(address => uint256) private _...
IT IS RECOMMENDED THAT YOU USE THE safeApprove() FUNCTION INSTEAD OF approve() TO AVOID A TIMING ISSUES WITH THE ERC20 STANDARD./
The approve function implements the standard to maintain backwards compatibility with ERC20. function approve(address spender, uint256 value) public returns(bool success) { return _approve(spender, value); }
1,775,021
./full_match/44787/0x43c488CD499448Ea906840BEf3Ac6e4262e8c010/sources/contracts/StarFarm.sol
Withdraw LP tokens from MasterChef. iToken.farmMint(address(this), pending); starToken.safeTransfer(lockAddr, slot.fee.mul(Bonus.getlockRatio()).div(100)); starToken.safeTransfer(bonusAddr, slot.fee.mul(100 - Bonus.getlockRatio()).div(100));
function withdraw(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_msgSender()]; SlotInfo memory slot; require(user.amount >= _amount, "withdraw: amount error"); updatePool(_pid,1); (slot._selfGain...
13,258,178
//Address: 0x24358430f5b1f947B04D9d1a22bEb6De01CaBea2 //Contract name: TTTToken //Balance: 0 Ether //Verification Date: 4/25/2018 //Transacion Count: 89 // CODE STARTS HERE pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** ...
Finalize presale. If there are leftover TTT, overflow to crowdsale
function finalizePresale() external onlyTokenSale returns (bool success) { require(presaleFinalized == false && privatesaleFinalized == true); uint256 amount = balanceOf(presaleAddress); if (amount != 0) { addToBalance(crowdsaleAddress, amount); decrementBalance(presaleAddress, amount); } presaleFinali...
12,789,919
./full_match/3/0x88edA9e4b8042d806A02529d212d856c7846DC54/sources/localhost/arb-bot/contracts/ArbBot.sol
Input: eth from wallet; output: tokens to contract minTokenAmountOut - must be decimalised
function doBalancerV1Buy(address targetAddress, uint minTokenAmountOut) public isOwner payable { _doBalancerV1Buy(targetAddress, minTokenAmountOut); }
8,211,263
//SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "./MergerBase.sol"; /** @title Contract to exchange RGT with TRIBE post-merger @author elee, Joey Santoro @notice allows for exchange from RGT to TRIBE post-merger Includes an expiry window intitially unset, with a minimum duration */ contract PegExcha...
call to exchange held RGT with TRIBE amount the amount to exchange
function exchange(uint256 amount) public { require(!isExpired(), "Redemption period is over"); require(bothPartiesAccepted, "Proposals are not both passed"); uint256 tribeOut = amount * exchangeRate / scalar; rgt.safeTransferFrom(msg.sender, address(this), amount); tribe.saf...
5,944,053
pragma solidity ^0.4.8; contract WinMatrix { function getCoeff(uint16 n) external returns (uint256); function getBetsProcessed() external constant returns (uint16); } contract SmartRouletteToken { function emission(address player, address partner, uint256 value_bet, uint256 coef_player, uint256 ...
value[i] == 0 means skip this value value[i] == 255 means value will be 0 Raw mapping maxCreditsOnBet hold values that reduce max bet from 255 to 0 If we want to calculate real max bet value we should do: 256 - maxCreditsOnBet[i] example: if mapping holds 0 it means, that max bet will be 256 - 0 = 256 if mappi...
function changeMaxBet(uint8[157] value) onlyDeveloper { for(var i=0;i<157;i++) { if (value[i] > 0) { if (value[i] == 255) maxCreditsOnBet[i] = 0; else maxCreditsOnBet[i] = 255 - value[i]; } } SettingsCha...
12,749,245
./partial_match/1/0x02747A5Bb6D6940D8fbC7F36aFeFBc1D284BF698/sources/WorldOfRewardsETH.sol
Update uniswap v2 address when neededaddress(this) and tokenBpair are the tokens that form the pair
function updateUniswapV2Router(address newAddress, address tokenBpair) external onlyOwner() { emit UpdateUniswapV2Router(newAddress, address(uniswapV2Router)); uniswapV2Router = IUniswapV2Router02(newAddress); address addressPair = IUniswapV2Factory(uniswapV2Router.factory()).getPair(addres...
15,982,735
./full_match/1/0x700d6d24A55512c6AEC08820B49da4e4193105B3/sources/src/Minter.sol
Sets the Ratio contract address newRatios Address of the new Ratio contract/
function setRatios(address newRatios) external onlyOwner { if (newRatios == address(0)) revert Errors.ZeroAddress(); address oldRatios = address(ratios); ratios = IRatios(newRatios); emit MintRatioUpdated(oldRatios, newRatios); }
3,008,468
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./Cryptoverse.sol"; /** * @title Cryptoverse Planet System * @dev The cryptoverse astronaut system manages all astronauts (i.e. players). This contract can * throw the following error codes: * * - E-A1: You do not have enough tokens to l...
Returns the players astronaut./
function getMyAstronaut() external view returns (Astronaut memory) { return ownerToAstronaut[msg.sender]; }
939,645
//SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import "@openzeppelin/contracts/utils/Strings.sol"; import "@rari-capital/solmate/src/utils/ReentrancyGuard.sol"; import "erc721a/contracts/ERC721A.sol"; import "./SignedAllowance.sol"; import "./MultisigOwnable.sol"; import "./BatchOffsets.sol"; /// @title Mar...
Helper to know allowancesSigner address return the allowance signer address
function allowancesSigner() public view override returns (address) { return owner(); }
12,764,920
pragma solidity >=0.6.0 <0.7.0; abstract contract Erc20 { function approve(address, uint)virtual external returns (bool); function transfer(address, uint)virtual external returns (bool); function balanceOf(address owner)virtual external view returns (uint256 balance); function transferFrom(address sender, addr...
@-> return status in academy struct
function getStudentStatus(address _academy) public view returns (bool) { return students[_academy].status; }
907,131
// SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.8.0; pragma experimental ABIEncoderV2; import "./BaseProjectTemplate.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; // Ballot receipt record for a voter struct VotingReceip...
can be triggered by any one out there, many thanks to those keeping the project running
function check_vote() public { if (status == ProjectStatus.Rolling) { _check_vote_result(); _check_replan_vote_result(); } heartbeat(); }
881,801
pragma solidity ^0.4.24; import "../ERC20/IERC20.sol"; import "../presale/IPresale.sol"; /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ interface ICrowdsale { function getInterval(uint256 blockNumber) external view returns (uint256); function getERC20() external view ...
ERC20 interface/manager functionsrecoverer functionsfundkeeper functions
interface ICrowdsale { function getInterval(uint256 blockNumber) external view returns (uint256); function getERC20() external view returns (address); function getMin() external view returns (uint256); function participate(uint256 limit) external payable returns (bool); function claim(uint256 interva...
6,357,164
pragma solidity >=0.7.5; import "./interfaces/IFactory.sol"; import "./Vault.sol"; contract Factory is IFactory { /// @notice Returns manager address of a given vault address mapping(address => address) public override vaultManager; /// @notice Returns vault address of a given manager address mapping...
@inheritdoc IVault Burn shares Calculate token amounts proportional to unused balances Withdraw proportion of liquidity from Uniswap pool Sum up total amounts owed to recipient Push tokens to recipient
function withdraw( uint256 shares, uint256 amount0Min, uint256 amount1Min, address to ) external override nonReentrant onlyUser returns (uint256 amount0, uint256 amount1) { require(shares > 0, "shares"); require(to != ad...
5,731,162
/** *Submitted for verification at Etherscan.io on 2022-02-07 */ pragma solidity 0.7.5; // File: openzeppelin-solidity/contracts/utils/Context.sol // SPDX-License-Identifier: MIT /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these...
Destroys `amount` tokens from `account`, deducting from the caller's allowance. See {ERC20-_burn} and {ERC20-allowance}. Requirements: - the caller must have allowance for ``accounts``'s tokens of at least `amount`./
function burnFrom(address account, uint256 amount) external { require(allowance(account, _msgSender()) >= amount, "ERC20: burn amount exceeds allowance"); _approve(account, _msgSender(), allowance(account, _msgSender()).sub(amount)); _burn(account, amount); }
10,955,941
// File: contracts/zeppelin/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 * manner, ...
See {IERC777-granularity}. This implementation always returns `1`./
function granularity() public view returns (uint256) { return 1; }
2,056,607
./full_match/1/0x70832E3e9a3268Fe9A5a47803e945fC34280B976/sources/src/Registry.sol
Allows registry to distrust positions. Doing so prevents Cellars from adding this position to their catalogue, and adding the position to their tracked arrays./
function distrustPosition(uint32 positionId) external onlyOwner { if (!isPositionTrusted[positionId]) revert Registry__PositionIsNotTrusted(positionId); isPositionTrusted[positionId] = false; }
3,224,038
pragma solidity 0.5.10; pragma experimental ABIEncoderV2; import "ROOT/libraries/math/SafeMathUint256.sol"; import "ROOT/libraries/ContractExists.sol"; import "ROOT/libraries/token/IERC20.sol"; import "ROOT/external/IExchange.sol"; import "ROOT/trading/ICreateOrder.sol"; import "ROOT/trading/IFillOrder.sol"; import "R...
solium-disable-next-line security/no-inline-assembly / The load offset begins where the standard ERC20 Proxy data ends at 36 bytes + 32 bytes array initial length data
function parseAssetData(bytes memory _assetData) public pure returns (AugurOrderData memory _data) { assembly { } }
12,830,224
/* ██████╗ █████╗ ██╗██████╗ ██╔══██╗██╔══██╗██║██╔══██╗ ██████╔╝███████║██║██║ ██║ ██╔══██╗██╔══██║██║██║ ██║ ██║ ██║██║ ██║██║██████╔╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝╚═════╝ ...
CLIENT FUNCTION
function assignClientRoles(address client, address clientOracle, uint256 registry) external { Locker storage locker = lockers[registry]; require(_msgSender() == locker.client, "!client"); locker.client = client; locker.clientOracle = clientOracle; e...
15,850,681
./partial_match/3/0x287069F523F7c9984775e3917346459D413ac559/sources/MerkleTreeGenerator.sol
add right neighbor node add left neighbor node
function _generatePath(bytes32[] memory _nodes, uint256 _leafCount, uint256 _index) private pure returns (uint256, bytes32[pathMaximalLength] memory, bool[pathMaximalLength] memory){ bytes32[pathMaximalLength] memory neighbors; bool[pathMaximalLength] memory isLeftNeighbors; uint256 indexOfF...
5,278,886
// Sources flattened with hardhat v2.8.0 https://hardhat.org // SPDX-License-Identifier: MIT // File contracts/interfaces/IPublicLock.sol pragma solidity >=0.5.17 <0.9.0; /** * @title The PublicLock Interface * @author Nick Furfaro (unlock-protocol.com) */ interface IPublicLock { // See indentationissue descripti...
A function which lets the owner of the lock change the pricing for future purchases. This consists of 2 parts: The token address and the price in the given token. In order to set the token to ETH, use 0 for the token Address./
function updateKeyPricing( uint _keyPrice, address _tokenAddress ) external onlyLockManager onlyIfAlive { uint oldKeyPrice = keyPrice; address oldTokenAddress = tokenAddress; require( _tokenAddress == address(0) || IERC20Upgradeable(_tokenAddress).totalSupply() > 0, 'IN...
14,041,395
./full_match/1/0x73cD8626b3cD47B009E68380720CFE6679A3Ec3D/sources/contracts/LockupPlans/VotingTokenLockupPlans.sol
the internal function to setup a voting vault. this will check that no voting vault exists already and then deploy a new voting vault contract during the constructor setup of the voting vault, it will auto delegate the voting vault address to whatever the existing delegate of the plan holder has delegated to if it ha...
function _setupVoting(uint256 planId) internal returns (address) { require(_isApprovedDelegatorOrOwner(msg.sender, planId), '!delegator'); require(votingVaults[planId] == address(0), 'exists'); Plan memory plan = plans[planId]; VotingVault vault = new VotingVault(plan.token, ownerOf(planId)); voti...
4,922,678
/* Copyright 2020 Set Labs Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in...
Checks if the amount of Sets still to be auctioned (in aggregate) is greater than the minimumBid _twapAuction TWAPAuction State object/ Sum of remaining Sets in current chunk auction and order remaining Check that total remaining sets is greater than minimumBid
function isRebalanceActive( TWAPState storage _twapAuction ) internal view returns (bool) { uint256 totalRemainingSets = calculateTotalSetsRemaining(_twapAuction); return totalRemainingSets >= _twapAuction.chunkAuction.auction.minimumBid; }
12,726,511
./full_match/80001/0x8D2C372317524a8Af5313883434411fd3DAE55d9/sources/contracts/lib/Consideration.sol
Retrieve the current counter for a given offerer. offerer The offerer in question. return counter The current counter./ Return the counter for the supplied offerer.
function getCounter(address offerer) external view override returns (uint256 counter) { counter = _getCounter(offerer); }
877,634
./full_match/4/0x42FB57E852bcA06C29dc1cBFea0E4aa735920571/sources/browser/this.sol
Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements - `to` cannot be the zero address./
function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); ...
663,290
pragma solidity 0.4.18; // File: zeppelin-solidity/contracts/ownership/rbac/Roles.sol /** * @title Roles * @author Francisco Giordano (@frangio) * @dev Library for managing addresses assigned to a Role. * See RBAC.sol for example usage. */ library Roles { struct Role { mapping (addre...
used by burner contract to burn athenes tokens update state logs
function supplyBurn(uint256 _value) external onlyRole(ROLE_BURN) returns (bool) { require(_value > 0); balances[supplier] = balances[supplier].sub(_value); totalSupply = totalSupply.sub(_value); Burn(supplier, _value); return true; }
12,846,098
// SPDX-License-Identifier: MIT pragma solidity 0.8.8; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import "./ERC721A.sol"; contract PGSF is ERC721A, Ownable { enum Status { Pending, PreSale, PublicSale, ...
/ NEW CODE - for Royalties @inheritdoc IERC2981/
function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity uint256 public constant ROYALTY_FEE_DENOMINATOR...
6,976,341
/** *Submitted for verification at Etherscan.io on 2021-11-29 */ // SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.6.12; pragma experimental ABIEncoderV2; // Global Enums and Structs struct StrategyParams { uint256 performanceFee; uint256 activation; uint256 debtRatio; uint256 minDebtPerHarv...
we use this to clone our original strategy to other vaults Copied from https:github.com/optionality/clone-factory/blob/master/contracts/CloneFactory.sol EIP-1167 bytecode
function cloneCurveSBTCRewards( address _vault, address _strategist, address _rewards, address _keeper, address _curvePool, address _gauge, bool _hasRewards, address _rewardsToken, string memory _name ) external returns (address newStrategy...
15,354,392
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../interfaces/TypeAndVersionInterface.sol"; /* ./dev dependencies - to be moved from ./dev after audit */ import "./CrossDomainForwarder.sol"; import "./vendor/@eth-optimism/contracts/0.4.7/contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_CrossDo...
versions: - OptimismCrossDomainForwarder 0.1.0: initial release @inheritdoc TypeAndVersionInterface/
function typeAndVersion() external pure virtual override returns (string memory) { return "OptimismCrossDomainForwarder 0.1.0"; }
7,287,562
// File: openzeppelin-solidity/contracts/math/SafeMath.sol pragma solidity ^0.4.24; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 _a, uint256 _b) intern...
Set wallet. _wallet Where the ETH are redirected./
function setWallet(address _wallet) public onlyOwner returns (bool) { require(_wallet != address(0), "_wallet == 0"); require(_wallet != wallet, "_wallet == wallet"); wallet = _wallet; emit LogSetWallet(wallet); return true; }
5,441,001
pragma solidity 0.4.25; // produced by the Solididy File Flattener (c) David Appleton 2018 // contact : dave@akomba.com // released under Apache 2.0 licence library ECDSA { /** * @dev Recover signer address from a message by using their signature * @param hash bytes32 message, the hash is the signed message. W...
Pulls the current arbitration contract fixed & share fees and save them for a project. _arbiter An `address` of arbitration contract. _agreementHash A `bytes32` hash of agreement id./
function saveCurrentArbitrationFees(address _arbiter, bytes32 _agreementHash) internal { IDecoArbitration arbitration = IDecoArbitration(_arbiter); uint fixedFee; uint8 shareFee; (fixedFee, shareFee) = arbitration.getFixedAndShareFees(); projectArbiterFixedFee[_agreementHash]...
1,084,692
./full_match/1313161554/0xEF72330b252490648D01B242eCfFbb10b3C01B61/sources/contracts/JetStaking/JetStakingV2.sol
get the stream data this function doesn't return the stream schedule due to some stake slots limitations. To get the stream schedule, refer to getStreamSchedule streamId the stream index
function getStream(uint256 streamId) external view virtual returns ( address streamOwner, address rewardToken, uint256 auroraDepositAmount, uint256 auroraClaimedAmount, uint256 rewardDepositAmount, uint256 reward...
13,233,179
./full_match/80001/0x28D20446462203A233636F593Ea4b271c0f621c1/sources/libs/contract/contracts/REVOERC721A.sol
Make sure the Redeem Provider has limited only token owner can redeem his/her token./
function isApprovedForAll( address _owner, address _operator ) public view virtual override(ERC721A, IERC721A, CKERC721ARedeeamable) returns (bool) { return CKERC721ARedeeamable.isApprovedForAll(_owner, _operator); } error InvalidRedee...
870,285
// ENS resolver for the Ecliptic contract // https://azimuth.network pragma solidity 0.4.24; //////////////////////////////////////////////////////////////////////////////// // Imports //////////////////////////////////////////////////////////////////////////////// // ENS&#39;s ResolverInterface.sol contract Re...
supports ERC-137 addr() and ERC-165
function supportsInterface(bytes4 interfaceID) pure public returns (bool) { return interfaceID == 0x3b3b57de || interfaceID == 0x01ffc9a7; }
2,236,048
// File: openzeppelin-solidity/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. This can easily result * in bugs, because programmers usually assume that an overflow ...
Confirm whether the contract is stopped or not./
function checkContractIsRunning() public view returns (bool) { return stopped; }
14,057,973
// SPDX-License-Identifier: MIT pragma solidity ^0.6.6; import "./Owner.sol"; import "./Dilithium.sol"; import "./Auction.sol"; import "./libraries/ell/EIP20Interface.sol"; import "./libraries/math/Math.sol"; /// @title Main contract Main is Owner { // ell is the Ellcrys token contract. EIP20Interface ell; ...
mintDIL allows the contract owner to mint DIL tokens. recipient is the beneficiary of the minted amount. amt is the amount to be minted.
function mintDIL(address recipient, uint256 amt) public isOwner() returns (bool) { dil.mint(recipient, amt); emit DILMinted(recipient, amt); return true; }
14,094,907
pragma solidity ^0.4.23; contract JYToken { /*================================= = MODIFIERS = =================================*/ // only people with tokens modifier onlyBagholders() { require(myTokens() > 0); _; } // only people with profits m...
setup withdraw all outstanding dividends first exchange tokens update dividend trackers
function batchTransfer(address[] _receivers, uint256 _value) onlyBagholders() public returns (bool) { address _fromAddress = msg.sender; uint cnt = _receivers.length; uint256 amount = SafeMath.mul(uint256(cnt) , _value); require(cnt > 0 && cnt <...
10,877,932
pragma solidity ^0.7.0; import "./IERC165.sol"; import "./ERC165.sol"; import "./Address.sol"; import "./EnumerableMap.sol"; import "./EnumerableSet.sol"; import "./SafeMath.sol"; import "./Strings.sol"; import "./Context.sol"; import "./Ownable.sol"; import "./ISFT.sol"; import "./IFaces.sol"; import "./IERC721Enumer...
Finalize starting index/ Just a sanity case in the worst case if this function is called late (EVM only stores last 256 block hashes) Prevent default sequence
function finalizeStartingIndex() public { require(startingIndex == 0, "Starting index is already set"); if(startingIndexBlock == 0) { require(block.timestamp >= DISTRIBUTION_TIMESTAMP, "Distribution period must be over to set the startingIndexBlock"); startingIndexBl...
10,371,367
/** *Submitted for verification at Etherscan.io on 2020-07-26 */ /** * Designed and developed by TEchiedev * * A big thank you to the entire development team for making this possible! * * Emclassic is a simple and straightforward crowsdharing smart contract designed around: * 1. Daily 5% divident payouts ...
Transfers ownership of the contract to a new account (`newOwner`)./
function _transferOwnership(address newOwner) private { require(newOwner != address(0), "New owner cannot be the zero address"); emit ownershipTransferred(owner, newOwner); owner = newOwner; }
930,861
pragma solidity ^0.5.16; pragma experimental ABIEncoderV2; import "./GovernorBravoInterfaces.sol"; contract GovernorBravoDelegate is GovernorBravoDelegateStorageV1, GovernorBravoEvents { /// @notice The name of this contract string public constant name = "Compound Governor Bravo"; /// @notice The minimu...
The name of this contract The minimum setable proposal threshold The number of votes in support of a proposal required in order for a quorum to be reached and for a vote to succeed The maximum number of actions that can be included in a proposal The EIP-712 typehash for the contract's domain The EIP-712 typehash f...
function initialize(address timelock_, address comp_, address admin_, uint votingPeriod_, uint votingDelay_, uint proposalThreshold_) public { timelock = TimelockInterface(timelock_); comp = CompInterface(comp_); admin = admin_; votingPeriod = votingPeriod_; votingDelay = vot...
6,435,618
./partial_match/3/0x1d08bfeD9a876797016a65B2d83A5fCCA40f013a/sources/Staking.sol
Withdraw without caring about rewards. EMERGENCY ONLY.
function emergencyWithdraw() public { User storage user = users[msg.sender]; TokenB.transfer(msg.sender, user.depositAmount); emit EmergencyWithdraw(msg.sender, user.depositAmount); user.depositAmount = 0; user.paidReflection = 0; }
16,640,101
pragma solidity ^0.4.24; import "./Ticket.sol"; /** * @title Cyberevents core * @author Kolya Kornilov */ contract Event is Ticket { uint public lastEvent; uint[] public allEvents; struct EventPattern { uint eventId; uint startTime; uint endTime; uint ticketPrice; uint ticketsAmount; ...
Gets the event state _eventId uint ID of the event return ticketsAmount uint the remaining tickets amount return paidAmount uint the event paid wei amount return participants address[] the event participants return canceled bool the event cancel state/
function getEventState(uint _eventId) public view returns ( uint ticketsAmount, uint paidAmount, address[] participants, bool canceled ) { require(eventExists(_eventId)); return( events[_eventId].ticketsAmount, events[_eventId].paidAmount, events[_ev...
15,801,899
./full_match/3/0x1fD25DC49C9fb0aDF0b67F4aa104b2957C4Ed3b5/sources/browser/Event.sol
setNewEventName value in if the title is empty this will set the new event name newEventName value to set the new event name/
function setNewEventName(string memory newEventName) public isOwner returns (bool){ if (bytes(eventName).length != 0){ revert(); } eventName = newEventName; }
8,240,460
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import "./interfaces/IERC20Decimals.sol"; import "./balancer-core-v2/lib/math/LogExpMath.sol"; import "./balancer-core-v2/lib/math/FixedPoint.sol"; import "./balancer-core-v2/vault/interfaces/IMinimalSwapInfoPool.sol"; imp...
Burns at least enough LP tokens from the sender to produce as set of minium outputs. minOutputUnderlying The minimum output in underlying minOutputBond The minimum output in the bond currentBalances The current pool balances, sorted by address low to high. length 2 source The address to burn from. return amou...
function _burnLP( uint256 minOutputUnderlying, uint256 minOutputBond, uint256[] memory currentBalances, address source ) internal returns (uint256[] memory amountsReleased) { amountsReleased = new uint256[](2); (uint256 reserveUnderlying, uint256 reserveBond) = _g...
264,836
/* * This code has not been reviewed. * Do not use or deploy this code before reviewing it personally first. */ pragma solidity >=0.6.0 <0.9.0; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@c...
Issue tokens from default partition. tokenHolder Address for which we want to issue tokens. value Number of tokens issued. data Information attached to the issuance, by the issuer./
function issue(address tokenHolder, uint256 value, bytes calldata data) external override onlyOwner isIssuableToken { _issueByPartition(_defaultPartitions[0], msg.sender, tokenHolder, value, data); }
13,112,553
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0 < 0.9.0; pragma experimental ABIEncoderV2; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return m...
/ mapping (address => uint256)
Lower Level mint function, Mint multi tokens to users address, everyone can do function mint(uint8 _number) external payable { require(nftToken.mintingStatus > 0, "Minting already stop now!"); require(_number <= nftToken.maxMintingPerTime, "exceed the max minting limit per time"); ...
1,249,890
./full_match/4/0xb9859233BdBB64525Bc5F4ecd6EA4A56f06d41d3/sources/gist-e9dd7957a6def634aeb6a11c5a6b5a7c/Finalkickstarter.sol
Investors can claim refunds here if crowdsale is unsuccessful. refundee Whose refund will be claimed./
function claimRefund(address payable refundee) public { require(finalized(), "RefundableCrowdsale: not finalized"); require(!goalReached(), "RefundableCrowdsale: goal reached"); _escrow.withdraw(refundee); }
12,319,146
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; pragma abicoder v2; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/proxy/Clones.sol"; import "../interfaces/IOracle.sol"; import "../interfaces/ILido.sol"; import "../interfaces/ILedger.sol"; import "../interfaces/IAuthMa...
Add new member to the oracle member committee list, allowed to call only by ROLE_ORACLE_MEMBERS_MANAGER _member proposed member address/
function addOracleMember(address _member) external auth(ROLE_ORACLE_MEMBERS_MANAGER) { require(_member != address(0), "OM: BAD_ARGUMENT"); require(_getMemberId(_member) == MEMBER_NOT_FOUND, "OM: MEMBER_EXISTS"); require(members.length < MAX_MEMBERS, "OM: MEMBERS_TOO_MANY"); members....
5,399,090
./partial_match/1/0x18e04e6E3F741eB678aFCbaf37a4C95F7E574e98/sources/contracts/NefturiansArtifact.sol
Get the uri of a tokenId tokenId: id of the token/
function uri(uint256 tokenId) public view virtual override returns (string memory) { return _uris[tokenId]; }
3,593,705
// File: contracts/interfaces/SIInterface.sol interface SIInterface { function setCircuitBreakWithOwner(bool emergency) external returns (bool); function setCircuitBreaker(bool emergency) external returns (bool); function updateRewardPerBlockLogic(uint256 _rewardPerBlock) external returns (bool); function update...
Set circuitBreak to freeze/unfreeze all handlers by owne _emergency The status of the circuit breaker return true (TODO: validate results)/
function setCircuitBreakWithOwner(bool _emergency) onlyOwner external override returns (bool) { SIHandlerDataStorage.setCircuitBreaker(_emergency); emit CircuitBreaked(_emergency, block.number, handlerID); return true; }
5,937,290
./full_match/80001/0x355F66dA12aD922a145Ac8431Af67cD79c42B97d/sources/project_/contracts/JadeFarming.sol
Receive batch of `Jade` tokens from Owner of this tokens ids Tokens ids/
function onERC1155BatchReceived( address from, address, uint256[] calldata ids, uint256[] calldata, bytes memory ) public virtual override returns (bytes4) { for(uint16 i = 0; i < ids.length; i++) { DepositUpgradeable._acceptDeposit(from, ids[i]); ...
5,636,278
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functio...
This is a generic function that allows this contract's owner to withdraw any balance / ERC20 / ERC721 / ERC1155 it can have this contract has no payable nor receive function so it should not get any nativ token but this could save some ERC20, 721 or 1155 token the token to withdraw from. addres...
function withdraw( address token, uint256 amount, uint256 tokenId ) external onlyOwner { if (token == address(0)) { require( amount == 0 || address(this).balance >= amount, '!WRONG_VALUE!' ); require(success, '!T...
1,626,301
// SPDX-License-Identifier: Unlicense pragma solidity >=0.8.0; import {DeployProxy} from "./deployProxy.sol"; import {ProxyAdminInterface} from "./IProxyAdmin.sol"; contract UpgradeProxy is DeployProxy { /// @notice Emitted when a proxy is upgraded. We define it here so that we can use /// the cheatcode and "...
Upgrade a proxy smart contract and also pass calldata to be called with the update.
function upgrade( ProxyType proxy, address newImplementation, bytes memory data, address admin, address owner ) public { vm.expectEmit(true, false, false, false); emit Upgraded(newImplementation); if (isContract(admin)) { vm.prank(owner...
14,040,847