file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.13; import "./NFT.t.sol"; import "../MinimalProxy.sol"; import "forge-std/Test.sol"; contract MinimalProxyTest is Test, Factory { NFT internal nft; function setUp() public { nft = new NFT(); } function testDeploy() public { vm.expectEmit(t...
The event we expect
function testDeploy() public { emit Deployed( msg.sender, address(nft), "Sample token", "SAMPLE" ); address deployedContract = deploy(address(nft), "Sample token", "SAMPLE"); assertEq(NFT(deployedContract).owner(), msg.sender); assertEq(NFT(deployedContract).name(), "Sample...
2,507,337
pragma solidity ^0.4.24; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); ...
check Permissions before transfer
function transfer(address _to, uint256 _value) public returns (bool) { require(checkPermissions(msg.sender)); super.transfer(_to, _value); }
246,446
// SPDX-License-Identifier: MIT /* β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β•β•β• β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β• β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β•šβ•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β• β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β•šβ•β•β•β•β•β• β•šβ•β•β•β•β•β•β•β•šβ•β•β•β•β•β• β•šβ•β• β•šβ•β•β•šβ•β•β•β•β•β•...
Function that shows the current circulating balance return Returns circulating balance/
function circBalance() public view returns (uint256) { uint256 totalSupply = debase.totalSupply(); return totalSupply .sub(debase.balanceOf(address(policy))) .sub(debase.balanceOf(burnPool1)) .sub(debase.balanceOf(burnPool2)); }
1,329,949
./full_match/1/0x5537f945D8c3FCFDc1b8DECEEBD220FAD26aFdA8/sources/contracts/ComposableStablePool.sol
This is called from the base class `_swapGivenOut`, so at this point the amount has been adjusted for swap fees, and balances have had scaling applied. This will only be called for regular (non-BPT) swaps, so forward to `onRegularSwap`./
function _onSwapGivenOut( SwapRequest memory request, uint256[] memory registeredBalances, uint256 registeredIndexIn, uint256 registeredIndexOut ) internal virtual override returns (uint256) { return _onRegularSwap( request.amount, ...
4,901,425
./full_match/432204/0xDD23b1253020B8C66DB630fc091D1cC3E984A878/sources/contracts/TradePairs.sol
Calculates the commission and updates the order state after an execution Updates the `totalAmount`, `quantityFilled`, `totalFee` and the status of the order. Commissions are rounded down based on evm and display decimals to avoid DUST _orderId order id to update _price execution price (Can be better than o...
function handleExecution( bytes32 _orderId, uint256 _price, uint256 _quantity, uint8 _rate ) private returns (uint256) { Order storage order = orderMap[_orderId]; TradePair storage tradePair = tradePairMap[order.tradePairId]; order.quantityFilled = order.q...
16,381,183
// SPDX-License-Identifier: GPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is dis...
BPT out, so we round down overall. First loop calculates the sum of all token balances, which will be used to calculate the current weights of each token, relative to this sum Check if the balance ratio is greater than the ideal ratio to charge fees or not No need to use checked arithmetic for the swap fee, it is guara...
function _calcBptOutGivenExactTokensIn( uint256 amp, uint256[] memory balances, uint256[] memory amountsIn, uint256 bptTotalSupply, uint256 swapFeePercentage ) internal pure returns (uint256) { uint256 sumBalances = 0; for (uint256 i = 0; i < balances.len...
277,648
./full_match/80001/0xA5978Df9a664C56d62313EE9EAaC7930977164E4/sources/contracts/past-versions/UnlockV12.sol
Create an upgradeable lock using a specific PublicLock version data bytes containing the call to initialize the lock template (refer to createUpgradeableLock for more details) _lockVersion the version of the lock to use/ assign the new Lock
function createUpgradeableLockAtVersion( bytes memory data, uint16 _lockVersion ) public returns (address) { if(proxyAdminAddress == address(0)){ revert Unlock__MISSING_PROXY_ADMIN(); } if(publicLockImpl == address(0)){ revert Unlock__MISSING_LOCK_TEMPLATE(); } publicLo...
5,588,042
pragma solidity ^0.4.24; pragma experimental "v0.5.0"; import {IndexedOrderedSetLib} from "./IndexedOrderedSetLib.sol"; import {Authorized} from "./Authority.sol"; /// @title Database contract for a package index. /// @author Tim Coulter <tim.coulter@consensys.net>, Piper Merriam <pipermerriam@gmail.com> contract R...
Returns string version identifier from the version of the given release hash. versionHash the version hash
function getVersion(bytes32 versionHash) public view onlyIfVersionExists(versionHash) returns (string) { return _recordedVersions[versionHash]; }
12,834,403
./full_match/137/0x86c18085B8949FF3DC53eC5c3a3a143CCFbC960a/sources/contracts/Mad_Honey/ERC721M.sol
Sets token base URI./
function setBaseURI(string calldata baseURI) external onlyOwner { if (_baseURIPermanent) revert CannotUpdatePermanentBaseURI(); _currentBaseURI = baseURI; emit SetBaseURI(baseURI); }
4,678,075
pragma solidity ^0.4.23; /** * The ENS registry contract. */ contract ENS { struct Record { address owner; address resolver; } mapping(bytes32=>Record) records; // Logged when the owner of a node assigns a new owner to a subnode. event NewOwner(bytes32 indexed node, byte...
Returns the address of the resolver for the specified node./
function resolver(bytes32 node) constant returns (address) { return records[node].resolver; }
1,066,423
./partial_match/1/0x26C57E09E699C827F7Cb616498EEaFC6d4179903/sources/LiquidityProtection.sol
updates the minimum network token compensation can only be called by the contract owner _minCompensation new minimum compensation/
function setMinNetworkCompensation(uint256 _minCompensation) external ownerOnly { emit MinNetworkCompensationUpdated(minNetworkCompensation, _minCompensation); minNetworkCompensation = _minCompensation; }
9,376,926
./partial_match/1/0xe37bb96500478285acE5F9F13f9d96dcbB10F263/sources/contracts/MorningsLimitedEditions.flatten.sol
Overrde `OperatorFilterer._operatorFilteringEnabled` to return whether the operator filtering is enabled in this contract./
function _operatorFilteringEnabled() internal view virtual override returns (bool) { return operatorFilteringEnabled; } ------------------------------------------------------------------------ */
16,029,689
./full_match/4/0xb12C54487464fB560BC550C9E6b075bfd2A5Ff44/sources/TaalSwap/BakeryToken.sol
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...
function getPriorVotes(address account, uint256 blockNumber) external view returns (uint256) { require(blockNumber < block.number, 'BAKE::getPriorVotes: not yet determined'); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return 0; } if ...
718,859
/** *Submitted for verification at Etherscan.io on 2021-08-17 */ pragma solidity >=0.7.2; pragma experimental ABIEncoderV2; interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of...
Withdraw from V1 vault to V1 vault Waive fee if registered in vault registry share is the number of vault shares to be burned vault is the address of destination V1 vault/ Send assets to new vault rather than user
function withdrawToV1Vault(uint256 share, address vault) external nonReentrant { require(vault != address(0), "!vault"); require(share > 0, "!share"); bool feeless = registry.canWithdrawForFree(address(this), vault); require(feeless, "Feeless withdraw to vault no...
15,164,597
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol"; import "../libraries/SafeCastExtended.sol"; import "../interfaces/IERC721Mintable.sol"; /** * @title Listings Library * @author JaboiNads * @notice Encapsulates functionality for lis...
Removes the specified listing from storage. self The data set to operate on. listingId The id of the listing to remove. This function will revert if the listing does not exist./
function removeListing( Data storage self, uint48 listingId ) internal { Listing storage listing = get(self, listingId); _removeListing(self, listing.token, listing.tokenId, listingId); }
13,121,073
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; import "./base/Controllable.sol"; import "sol-temple/src/tokens/ERC721.sol"; import "sol-temple/src/tokens/ERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; /// @title Ape Runners RUN /// @au...
Internal minting logic.
function _mint(address to_, uint256 value_) internal { _beforeTokenTransfer(address(0), to_, value_); totalSupply += value_; unchecked { balanceOf[to_] += value_; } emit Transfer(address(0), to_, value_); _afterTokenTransfer(address(0), to_, value_); }
13,632,955
./full_match/314/0x7b7f1f85F599b63432F5D782041c25Dad354f999/sources/node_modules/@openzeppelin/contracts/governance/Governor.sol
See {IGovernor-queue}./
function queue( address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash ) public virtual returns (uint256) { uint256 proposalId = hashProposal(targets, values, calldatas, descriptionHash); _validateStateBitmap(proposal...
8,083,704
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; import {IERC721Metadata} from "./../interfaces/IERC721Metadata.sol"; import {ERC721Storage} from "./../libraries/ERC721Storage.sol"; import {ERC721ContractMetadataStorage} from "./../libraries/ERC721ContractMetadataStorage.sol"; import {TokenMetadataWithBaseURISt...
Gets the base metadata URI. return baseURI The base metadata URI.
function baseMetadataURI() external view returns (string memory baseURI) { return TokenMetadataWithBaseURIStorage.layout().baseMetadataURI(); }
13,119,487
pragma solidity ^0.5.17; interface IERC20 { function TOTALSUPPLY3() external view returns (uint256); //inject NONSTANDARD NAMING function BALANCEOF367(address account) external view returns (uint256); //inject NONSTANDARD NAMING function TR...
inject NONSTANDARD NAMING
function BALANCEOF367() public view returns (uint) {
12,996,909
./full_match/137/0xC505362eF38aA0DeCa5b14ebeE84A898950DB0Da/sources/contracts/BONQ-staking.sol
returns fee from borrowing the amount _amount amount to borrow return uint256 resulting fee
function getBorrowingFee(uint256 _amount) public view override returns (uint256) { return (_amount * BONQMath.min(MAX_BORROWING_RATE, (PERCENT_05 + calcDecayedBaseRate(baseRate)))) / DECIMAL_PRECISION; }
4,745,163
pragma solidity 0.4.15; import './ownership/multiowned.sol'; import './crowdsale/FixedTimeBonuses.sol'; import './crowdsale/FundsRegistry.sol'; import './crowdsale/InvestmentAnalytics.sol'; import './security/ArgumentsChecker.sol'; import './STQToken.sol'; import 'zeppelin-solidity/contracts/ReentrancyGuard.sol'; impo...
to be overridden in tests
function getMinFunds() internal constant returns (uint) { return c_MinFunds; }
12,662,743
./full_match/80001/0x947ae5b7F4794BAC5492DE8A592ce70a172F08f1/sources/contracts/BourbonNBlockchainRewards.sol
uint256 totalSupply = dropERC721.totalSupply(); require(amount > 0, 'Reward amount must be strictly positive'); injections.push(Injection(block.timestamp, amount)); erc20.transferFrom(msg.sender, address(this), amount);
function injectRewards(uint256 amount) public onlyRole(INJECTION_ROLE) { uint256 totalSupply = 1; for (uint256 i = 0; i < totalSupply; i++) { address owner = dropERC721.ownerOf(dropERC721.tokenByIndex(i)); balances[owner] += amount / totalSupply; } }
9,537,095
/** *Submitted for verification at Etherscan.io on 2021-05-16 */ // File: @openzeppelin/contracts/math/SafeMath.sol pragma solidity ^0.7.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * i...
Try to send native tokens to the address. If it fails, it will force the transfer by creating a selfdestruct contract _receiver address that will receive the native tokens _value the amount of native tokens to send/
function safeSendValue(address payable _receiver, uint256 _value) internal { if (!(_receiver).send(_value)) { } }
2,001,438
pragma solidity ^0.4.24; /** * cx mode of fomo3d */ //============================================================================== // _ _ _ _|_ _ . // (/_\/(/_| | | _\ . //============================================================================== contract F3Devents { // fired whenever a player...
essentially the same as buy, but instead of you sending ether from your wallet, it uses your unwithdrawn earnings. -functionhash- 0x349cdcac (using ID for affiliate) -functionhash- 0x82bfc739 (using address for affiliate) -functionhash- 0x079ce327 (using name for affiliate) _affCode the ID/address/name of the player w...
function reLoadXid(uint256 _affCode, uint256 _team, uint256 _eth) isActivated() isHuman() isWithinLimits(_eth) public { F3Ddatasets.EventReturns memory _eventData_; uint256 _pID = pIDxAddr_[msg.sender]; _affCode = determineAffID(_pID,_affCode); ...
9,849,247
./full_match/4/0xCb444455b6b51CD1aa99681E09C430Ef14CAB2d7/sources/Scrambles.sol
Widthdraw Ether from contract. _to the address to send to _amount the amount to withdraw/
function withdrawEther(address payable _to, uint256 _amount) public onlyOwner { _to.transfer(_amount); }
773,333
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@ope...
Add a new payee to the contract. account The address of the payee to add. shares_ The number of shares owned by the payee./
function _setPayee(address account, uint256 shares_) private { require(account != address(0), "PaymentSplitter: account is the zero address"); _teamShares -= _shares[account]; _shares[account] = shares_; _teamShares += _shares[account]; emit PayeeAdded(account, shares_); ...
14,325,355
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; contract GearToken is ERC721, Ownable { constructor(string memory _name, string memory _symbol) ERC721(_name, _symbol) {} uint256...
Minting/creation stage of the token
function _createGear(string memory _name) internal { uint256 randDna = _createRandomNum(10**16); Gear memory newGear = Gear(_name, COUNTER, randDna, 1, randRarity); emit NewGear(msg.sender, COUNTER, randDna); COUNTER++; }
1,036,333
./partial_match/1/0x46d81377EDA197f24ea58C636336569216b58D1f/sources/contracts/POPS_teamWallet_shares.sol
[Tx][Private] Add new shareholder
function addShareholder(address newShareholder) private returns(bool added){ added=true; super._beforeTokenTransfer(from, to, amount); }
16,033,986
./partial_match/1/0xA17b1712dBA02a7Ba477b5b161Cc526BEd404b66/sources/Axe.sol
generate the uniswap pair path of token -> weth make the swap
function swapTokensForEth(uint256 tokenAmount) private { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeO...
4,121,248
./full_match/4/0x7D3c59CCaFFbc8e98b52b8c2672dF6A1A9203978/sources/contracts/Vesting.sol
claims user's tokens allocations corresponding allocations for rounds proof Merkle tree proof allocations + msg.sender -> leaf emit Claim(block.timestamp, msg.sender, rounds[i].name, amount);
function claim(uint256[] calldata allocations, bytes32[] calldata proof) external isStarted { bytes32 leaf = keccak256(abi.encode(allocations, msg.sender)); if (!proof.verify(ROOT, leaf)) revert WrongProof(); uint256 length = rounds.length; uint256 totalAmount = ...
12,394,846
pragma solidity ^0.4.24; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256...
send back locked ETH if needed /send back locked ETH
function refund(address _to) onlyOwner { }
12,602,014
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IToken is IERC20{ function decimals() external view returns (uint); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as def...
Unwraps a autoUnwrappable hedge contracts in exchange for a fee (if called by Keep3r) tokenId HedgeContract to be unwrapped rewardRecipient address of the recipient of the fees in exchange of autoExercise return reward that keep3r will receive/
function autoUnwrap(uint tokenId, address rewardRecipient) public override returns (uint reward) { require(isAutoUnwrapable(tokenId), "!not-unwrapable"); _unwrap(tokenId); if(address(msg.sender).isContract() && msg.sender == keep3r) reward = pool.payKeep3r(rewardRecipient); }
1,201,481
/** *Submitted for verification at Etherscan.io on 2022-04-15 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.9; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * ...
Emitted when the implementation is upgraded./
constructor() { assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1)); StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = 0xe45e2871206f722ffFFaBB958933b240cDFf564e; emit Upgraded(0xe45e2871206f722ffFFaBB958933b240cDFf564e); Address.fu...
7,843,925
// SPDX-License-Identifier: MIT pragma solidity =0.7.6; pragma experimental ABIEncoderV2; interface IERC20 { function totalSupply() external view returns (uint256 supply); function balanceOf(address _owner) external view returns (uint256 balance); function transfer(address _to, uint256 _value) exte...
Common interface for the SortedTroves Doubly Linked List. --- Events --- --- Functions ---
interface ISortedTroves { event SortedTrovesAddressChanged(address _sortedDoublyLLAddress); event BorrowerOperationsAddressChanged(address _borrowerOperationsAddress); event NodeAdded(address _id, uint _NICR); event NodeRemoved(address _id); function setParams(uint256 _size, address _Tro...
1,156,981
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@chainlink/contracts/src/v0.8/interfaces/KeeperCompatibleInterface.sol"; import "../interfac...
Utility function that checks if the lottery is empty or not. return True if the lottery is empty, otherwise False/
function isLotteryEmpty() public view returns (bool) { if (ticket.totalSupply() > 0) return false; return true; }
2,512,253
pragma solidity ^0.4.23; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { retur...
Internal function to clear current approval of a given token ID Reverts if the given address is not indeed the owner of the token _owner owner of the token _tokenId uint256 ID of the token to be transferred/
function clearApproval(address _owner, uint256 _tokenId) internal { require(ownerOf(_tokenId) == _owner); if (tokenApprovals[_tokenId] != address(0)) { tokenApprovals[_tokenId] = address(0); emit Approval(_owner, address(0), _tokenId); } }
2,379,334
pragma solidity 0.4.11; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of &quot;user permissions&quot;. */ contract Ownable { address public owner; /** * @dev The Ownable constructor sets t...
Allows the owner to enable the trading. This can not be undone/
function startTrading() onlyOwner { tradingStarted = true; }
986,433
/** *Submitted for verification at Etherscan.io on 2020-08-14 */ pragma solidity ^0.5.16; contract CTokenStorage { /** * @dev Guard variable for re-entrancy checks */ bool internal _notEntered; /** * @notice EIP-20 token name for this token */ string public name; /** * ...
Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer. Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer. newPendingAdmin New pending admin. return uint 0=success, otherwise a failure (see ErrorReporter.sol f...
function _setPendingAdmin(address payable newPendingAdmin) external returns (uint) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_PENDING_ADMIN_OWNER_CHECK); return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.REDEEM_TRANSFER_OUT_NOT_POSSIBLE); doTransferOut(redeemer, vars.red...
13,105,069
./full_match/69/0xCbe047C5b7FeA3Ef235A133ADE3Eb14100DFe038/sources/contracts/L2BridgeWrapper.sol
NOTE: _amount + _fee will burn on L2.
function fastWithdraw( address _l1Token, address _l2Token, address _to, uint256 _amount, uint256 _fee, uint32 _l1Gas, bytes calldata _data ) external { require( _origin == msg.sender, "INVALID_ORIGIN" ); ...
13,238,568
./partial_match/1/0xA8981895890378b612798bA26D7fb2b3dd99ef6f/sources/contracts/PackwoodERC721V2.sol
updates the status for breed. _status status in boolean. Requirements: - only owner can update value./
function updateSelfBreedStatus(bool _status) external onlyOwner returns (bool) { selfBreedStatus = _status; return selfBreedStatus; }
9,257,033
pragma solidity ^0.4.21; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint...
Event for token purchase logging purchaser who paid for the tokens beneficiary who got the tokens value weis paid for purchase amount amount of tokens purchased/
function Crowdsale() public { maxTokens = 500000000; maxEther = 10000 * 1 ether; rate = 12908; wallet = 0xb382C19879d39E38B4fa77fE047FAdadE002fdAB; token = createTokenContract(); }
1,671,606
pragma solidity ^0.4.18; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner...
transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./ SafeMath.sub will throw if there is not enough balance.
function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); require(transfersEnabledOverride[msg.sender] || transfersEnabled); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add...
6,010,098
interface Proxyable { function doPublicSomething() external returns (uint256); } // This is meant to be the simplest multisig I could whip up. // Any bugs were not intentional and not part of the hack. ;) contract MyLittleProxyMultisig { // The owners mapping(address => bool) _owners; uint _ownerCoun...
Any owner may call this to destroy this contract, rendering the upgradable contract no-longer-upgradable; this is the desirable long-term plan which is unstoppable if any owner thinks it's time.
function relinquish() public { require(_owners[msg.sender], "only an owner may permanently deactivate upgrades"); emit Relinquished(msg.sender); selfdestruct(address(0)); }
12,890,687
./full_match/4/0xDdCd5129291e3776834E6b7515f77a09F2D14DE1/sources/contracts/NostraSwapPair.sol
this low-level function should be called from a contract which performs important safety checks scope for reserve{0,1}Adjusted, avoids stack too deep errors Check for arbitrage opportunities Assume eth is token0 scope for _token{0,1}, avoids stack too deep errors
function swap( uint amount0Out, uint amount1Out, address to, bytes calldata data ) external lock { require(amount0Out > 0 || amount1Out > 0, 'NostraSwap: INSUFFICIENT_OUTPUT_AMOUNT'); require(amount0Out < _reserve0 && amount1Out < _reserve1, 'NostraSwap: INSUFFICI...
12,531,019
pragma solidity ^0.4.15; /* Copyright 2017, Roderik van der Veer (SettleMint) Copyright 2017, Jorge Izquierdo (Aragon Foundation) Copyright 2017, Jordi Baylina (Giveth) Based on MiniMeToken.sol from https://github.com/Giveth/minime Original contract from https://github.com/aragon/aragon-network-token/blob/m...
`doPayment()` is an internal function that sends the ether that this contract receives to the `vault` and creates tokens in the address of the `_owner` assuming the EarlyTokenSale is still accepting funds _owner The address that will hold the newly created tokens Antispam do not allow contracts to game the system li...
function doPayment(address _owner) internal returns(bool success) { require(tx.gasprice <= maxGasPrice); require(!isContract(msg.sender)); require(getBlockNumber().sub(lastCallBlock[msg.sender]) >= maxCallFrequency); lastCallBlock[msg.sender] = getBlockNumber(); if (msg.sen...
10,662,358
./full_match/42/0x725DDa8A778B507bA02a7F56146a2D5D7f5740CE/sources/home/didi/src/sf/streaming-faucet/contracts/StreamingFaucet.sol
can be called by any account currently not receiving a stream from this faucet opens a stream with the configured stream to the message sender
function startStreamToSender() public { address receiver = msg.sender; (,int96 curFlowRate,,) = _cfa.getFlow(token, address(this), receiver); require(curFlowRate == 0, "StreamingFaucet: stream already open"); _sfHost.callAgreement( _cfa, abi.encodeWithSelect...
9,598,161
./partial_match/1/0xA1d70A18B4b7AA0EA47F1f04AC706CF0e132A0Ff/sources/ParitexGlobal.sol
"Consume a nonce": return the current value and increment. _Available since v4.1._/
function _useNonce( address owner ) internal virtual returns (uint256 current) { CountersUpgradeable.Counter storage nonce = _nonces[owner]; current = nonce.current(); nonce.increment(); } uint256[49] private __gap;
16,090,372
./full_match/1/0xfB2Bfc368a7edfD51aa2cbEC513ad50edEa74E84/sources/contracts/cctp/SynapseCCTP.sol
Calculates the unique identifier of the request. Merge the destination domain and the request version into a single uint256. Use assembly to return hash of the prefix and the request hash. We are using scratch space to avoid unnecessary memory expansion. solhint-disable-next-line no-inline-assembly Store prefix in memo...
function _requestID( uint32 destinationDomain, uint32 requestVersion, bytes memory formattedRequest ) internal pure returns (bytes32 requestID) { uint256 prefix = (uint256(destinationDomain) << 32) | requestVersion; bytes32 requestHash = keccak256(formattedRequest); ...
5,006,486
./partial_match/42/0xacDc4B7b2BeC9A68EBCf7c7B109Fba1C07556a7A/sources/HRToken.sol
Gets the balance of the specified address. _owner The address to query the the balance of. return An uint256 representing the amount owned by the passed address./
function balanceOf(address _owner) public view returns (uint256 balance) { return balances[_owner]; }
3,447,102
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol"; import "./interfaces/ILnAsset....
Adjust total underlying debt stat Buy underlying with lUSD Calculate fees & liquidation reward (extra debt to repay)
function _closeShortPosition( address user, uint256 positionId, uint256 amount, address to, bool isLiquidation ) private returns ( uint256 fees, uint256 underlyingPrice, uint256 liquidationReward ) { ...
1,796,659
/* 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...
Transfer non-exchanged underlying tokens from caller, mint cTokens and deposit to the Vault under sender to the caller _setAddress Address of the Set _quantity Quantity of the Set to issue/ Get SetToken details Calculate the number of natural units required. Note: validateExchangeIssuanceParams ensures quanti...
function mintCTokensFromCaller( address _setAddress, uint256 _quantity ) private { ISetToken baseSet = ISetToken(_setAddress); address[] memory baseSetComponents = baseSet.getComponents(); uint256[] memory baseSetUnits = baseSet.getUnits(); uint256 ba...
1,046,428
/** *Submitted for verification at Etherscan.io on 2020-07-08 */ // File: contracts/IERC165.sol pragma solidity ^0.5.11; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be ...
Token URIs / Internal function to set the token URI for a given token. Reverts if the token ID does not exist. tokenId uint256 ID of the token to set its URI uri string URI to assign/
function _setTokenURI(uint256 tokenId, string memory uri) internal { require( _exists(tokenId), "NON_EXISTENT_TOKEN" ); _tokenURIs[tokenId] = uri; }
922,018
/** *Submitted for verification at Etherscan.io on 2022-02-01 */ // File: @openzeppelin/contracts/utils/structs/EnumerableSet.sol // OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol) pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[se...
Creates a new token for `msg.sender`. Its token ID will be automatically assigned (and available on the emitted {IERC721-Transfer} event), and the token URI autogenerated based on the base URI passed at construction. See {ERC721-_mint}. Requirements: - the caller must have the `MINTER_ROLE` role./
function mint(string memory _tokenURI, address _to) external { require( hasRole(MINTER_ROLE, msg.sender), "NinfaNFT: Must have MINTER_ROLE to mint" }
2,010,682
/** *Submitted for verification at Etherscan.io on 2022-01-21 */ // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implemente...
Transfers crypto from sender to the contract. User calls this function when he wants to transfer tokens to another blockchain./
function swapCryptoToOtherBlockchainInch(swapToParams memory params) external payable whenNotPaused TransferTo(params, msg.value) { IERC20 Transit = IERC20(address(uint160(uint256(RubicAddresses[numOfThisBlockchain])))); uint cryptoWithoutFee = msg.value - blockc...
2,381,886
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/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 functi...
SPDX-License-Identifier: MIT
interface RoyaltiesV2 { event RoyaltiesSet(uint256 tokenId, LibPart.Part royalties); function getVindergoodV2Royalties(uint256 id) external view returns (LibPart.Part memory); }
5,818,727
./partial_match/1/0xd999D5a20294ec90c4f792F63820112E22E61059/sources/contracts/Sale/FomoMarketplace.sol
Method for offering item _nftAddress NFT contract address _tokenId TokenId _payToken Paying token _quantity Quantity of items _pricePerItem Price per item _deadline Offer expiration
function createOffer( address _nftAddress, uint256 _tokenId, IERC20 _payToken, uint256 _quantity, uint256 _pricePerItem, uint256 _deadline ) external { require( _supportERC721(_nftAddress) || _supportERC1155(_nftAddress), "Invalid N...
3,711,124
pragma solidity >=0.5.0 <0.6.0; /* - Disposal station? - how can information come from the outside world? E.g. when you throw trash bag in a bin, can information about serialNumberBin and weight of the trash bag be collected automatically and then immediately used (there are sensors placed in bins)? -> ask profe...
The following two functions are just to check if everything has worked fine
function showStartTime () public view returns (uint) { return start; }
1,792,916
./full_match/11155111/0xe8d6b05482360dae8414Af7DE73848D857D10C78/sources/project_/contracts/Minter.sol
update period can only be called once per cycle (1 week) uint _growth = calculate_growth(weekly);
function update_period() external returns (uint) { uint _period = active_period; _period = (block.timestamp / WEEK) * WEEK; active_period = _period; weekly = weekly_emission(); uint _treasuryEmissions = (treasuryRate * weekly) / PRECISION; uint _e...
3,823,016
pragma solidity ^0.4.19; import './interfaces/ERC20.sol'; import './libraries/SafeMath.sol'; import './utils/Ownable.sol'; import './utils/Secured.sol'; import './libraries/CryptoDollarStorageProxy.sol'; import './libraries/CryptoFiatStorageProxy.sol'; contract CryptoDollar is Secured { using SafeMath for uint256...
Standard ERC20 allowance function _owner {address} _spender {address} return remaining {uint256}/
function allowance(address _owner, address _spender) public constant returns (uint256) { return store.getAllowance(_owner, _spender); }
13,032,541
./partial_match/56/0xe34Ae4996783945c90804ef7b5d170C97f80efc1/sources/FlaskMasterFarmer.sol
lock 95% of reward if it come from bounus time
function _harvest(uint256 _pid) internal { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accflaskPerShare).div(1e12).sub(user.rewardDebt); uint256 masterBal = ...
11,053,638
//SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.9; import "../client/node_modules/@openzeppelin/contracts/security/ReentrancyGuard.sol"; contract PardnaConfig { // ARRAYS User[] public users; Pardna[] public pardnas; // MAPPINGS mapping (address => uint256[]) public pardnasParticipati...
Initializing automatic attributes Initializing calculated attributes
function createNewPardna2(Pardna memory _pardna,uint256 _duration, uint256 _lateJoinThreshold, User memory _caller, string memory _name) private{ _pardna.isActive = true; _pardna.totalPurse = 0; _pardna.numThrows = 0; _pardna.totalMembers = _pardna.members.length; _pardna.ope...
2,544,734
./full_match/1/0x6f9140097Ab6278B41Cf9597a597030207b8D75d/sources/lib/seaport-core/src/lib/BasicOrderFulfiller.sol
Internal function to transfer Ether (or other native tokens) to a given recipient as part of basic order fulfillment. Note that conduits are not utilized for native tokens as the transferred amount must be provided as msg.value. Also note that this function may only be safely called as part of basic...
function _transferNativeTokensAndFinalize() internal { uint256 nativeTokensRemaining = msg.value; uint256 amount; address payable to; uint256 totalAdditionalRecipientsDataSize; assembly { amount := calldataload(BasicOrder_considerationAmount_cdPtr) to...
9,676,221
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "./in...
all the details are hard coded/
function initialize(IERC20Upgradeable _leagueToken, uint256 _startAfter) public initializer { require(_startAfter > 0, "Invalid startTime"); _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); _setupRole(VESTER_ROLE, _msgSender()); uint256 _startTime = block.timestamp + _startAfter; ...
12,206,300
./partial_match/1/0x67c5F13c56aEb40fd9a937214E5429dAf8A0CfC9/sources/contracts/CegaState.sol
Operator admin has the ability to remove products productName is the name of the product to be removed/ Swap last element with element at index, then pop to delete product
function removeProduct(string memory productName) public onlyRole(OPERATOR_ADMIN_ROLE) { bool found = false; uint256 index = 0; for (uint256 i = 0; i < productNames.length; i++) { if (keccak256(abi.encodePacked(productNames[i])) == keccak256(abi.encodePacked(productName))) { ...
15,753,139
./partial_match/1/0x7917b6f2C5deC4021Ed5D0ff3e5bb27A69B2eaCf/sources/contracts/ForceMove.sol
Validates input for several external methods. Validates input for several external methods. numParticipants Length of the participants array numStates Number of states submitted numSigs Number of signatures submitted numWhoSignedWhats whoSignedWhat.length/
function requireValidInput( uint256 numParticipants, uint256 numStates, uint256 numSigs, uint256 numWhoSignedWhats ) public pure returns (bool) { require( (numParticipants >= numStates) && (numStates > 0), 'ForceMove | You must submit at least one ...
9,354,513
./full_match/4/0x727388B8cB233337c8619e887E1896f1B576C431/sources/contracts/JBETHPaymentTerminalStore.sol
/ The holder must have the specified number of the project's tokens. The current funding cycle must not be paused. If the funding cycle has configured a data source, use it to derive a claim amount and memo. The amount being claimed must be within the project's balance. The amount being claimed must be at least as much...
function recordRedemptionFor( address _holder, uint256 _projectId, uint256 _tokenCount, uint256 _minReturnedWei, address payable _beneficiary, string memory _memo, bytes memory _delegateMetadata ) external onlyAssociatedPaymentTerminal returns ( JBFundingCycle memory fu...
693,928
pragma solidity ^0.4.11; contract AuctionItem { string public auctionName; address public owner; bool auctionEnded = false; event NewHighestBid( address newHighBidder, uint newHighBid, string squak ); uint public currentHighestBid = 0; ...
allow people using MetaMask/Cipher et. al. to specifically set a taunting message ;)
function bid(string _squak) payable higherBid auctionNotOver { highBidder.transfer(currentHighestBid); currentHighestBid = msg.value; highBidder = msg.sender; squak = _squak; NewHighestBid(msg.sender, msg.value, _squak); }
1,754,667
pragma solidity 0.5.16; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "../hardworkInterfa...
Withdraws everything from all the vaults/
function withdrawAllToVault() external restricted { for (uint256 i = 0; i < withdrawalOrder.length; i++) { if (IStrategy(withdrawalOrder[i]).investedUnderlyingBalance() > 0) { IStrategy(withdrawalOrder[i]).withdrawAllToVault(); } } uint256 actualBalance = IERC20(underlying).balanceOf(a...
5,399,004
pragma solidity ^0.4.18; // File: zeppelin-solidity/contracts/ownership/Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; ...
CONSTRUCTOR Initialize the Seele Token _minter The SeeleCrowdSale Contract _maxTotalSupply total supply token/
function SeeleToken(address _minter, address _admin, uint _maxTotalSupply) public validAddress(_admin) validAddress(_minter) { minter = _minter; totalSupply = _maxTotalSupply; claimedFlag = false; paused = true; transferOwnership(_admin); ...
331,978
./full_match/84531/0x70eE98D80439a1D3bd5f5eCC9D20217751FE60ca/sources/contracts/CryptoDickbuttsRandom.sol
Background Skin Body Hat Eyes Mouth Nose Hand Shoes Butt Dick Special
function _randomMeta(uint64 seed) private pure returns (uint8[] memory meta) { meta = new uint8[](12); PRNG.Source src = PRNG.newSource(keccak256(abi.encodePacked(seed))); meta[0] = uint8(PRNG.readLessThan(src, 8, 8)); meta[1] = 181 + uint8(PRNG.readLess...
14,321,161
// SPDX-License-Identifier: MIT pragma solidity ^0.8.3; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "./interfaces/IERC1155Ubiquity.sol"; import "./interfaces/IMetaPool.sol"; imp...
deposit uAD-3CRV LP tokens for a duration to receive bonding shares _lpsAmount of LP token to send _weeks during lp token will be held weeks act as a multiplier for the amount of bonding shares to be received update the accumulated lp rewards per shares transfer lp token to the bonding contract calculate the amount ...
function deposit(uint256 _lpsAmount, uint256 _weeks) external whenNotPaused returns (uint256 _id) { require( 1 <= _weeks && _weeks <= 208, "Bonding: duration must be between 1 and 208 weeks" ); ITWAPOracle(manager.twapOracleAddress()).updat...
980,032
pragma solidity 0.5.11; //SEC fix compiler version import "@openzeppelin/upgrades/contracts/Initializable.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/lifecycle/Pausable.sol"; import "@openzeppelin/contracts-ethereum...
FIXME it needs to be called getTokensOfBorrower? query all the token Ids currently borrowed by a user return uint256[] an array of tokenId borrowed by a user/
function getTokensOfBearer() public view returns (uint256[] memory) { return _bearedTokens[msg.sender]; }
12,882,638
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; import "./CompoundPCVDepositBase.sol"; interface CErc20 { function mint(uint256 amount) external returns (uint256); function underlying() external returns (address); } /// @title ERC-20 implementation for a Compound PCV Deposit /// @author...
deposit ERC-20 tokens to Compound Compound returns non-zero when there is an error
function deposit() external override whenNotPaused { uint256 amount = token.balanceOf(address(this)); token.approve(address(cToken), amount); require(CErc20(address(cToken)).mint(amount) == 0, "ERC20CompoundPCVDeposit: deposit error"); emit Depo...
1,459,363
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; // Some parts: Apache-2.0 // ==== sha3_c.c BEGIN ===================================================================================================================== //////////////////////////////////////// // A) The following code was imported from "fips202.c...
/ Subtract polynomial g from polynomial f./
function mq_poly_sub(bytes memory /*uint16**/ f, bytes memory /*uint16**/ g, uint32 logn) private pure { uint32 u; uint32 n; n = uint32(1) << logn; for (u = 0; u < n; u++) { uint16 tmp1 = byte_array_uint16_get(f,u); uint16 tmp2 = byte_array_uint...
1,775,414
./partial_match/1/0x43eA73168B8f192dBDEC088DA29F2C5E517f6fcB/sources/contracts-verify/KUMASwap.sol
Claims a KUMA Bonds NFT from this contract for a CloneBond. Can only by called by a KUMA_SWAP_CLAIM_ROLE address. tokenId Claimed bond tokenId./
function claimBond(uint256 tokenId) external onlyRole(Roles.KUMA_SWAP_CLAIM_ROLE.toGranularRole(_riskCategory)) { IKUMAAddressProvider KUMAAddressProvider = _KUMAAddressProvider; if (_cloneBonds[tokenId] == 0) { revert Errors.BOND_NOT_AVAILABLE_FOR_CLAIM(); } uint256 gB...
15,921,087
./full_match/80001/0x3967d7B159b3cd47332d089e6825910babA46749/sources/_openzeppelin/contracts/utils/structs/EnumerableMap.sol
Returns true if the key is in the map. O(1)./
function contains(AddressToUintMap storage map, address key) internal view returns (bool) { return contains(map._inner, bytes32(uint256(uint160(key)))); }
839,274
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import '@openzeppelin/contracts/utils/Context.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/token/ERC20/ERC20.sol'; import '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol'; import '@openzeppelin/contr...
governance can withdraw all stuck funds in emergency case _token - IERC20Metadata token that should be fully withdraw from Zunami/
function withdrawStuckToken(IERC20Metadata _token) external onlyOwner { uint256 tokenBalance = _token.balanceOf(address(this)); _token.safeTransfer(_msgSender(), tokenBalance); }
1,433,827
./partial_match/1/0x39dCCA7984B22cCB0347DeEAeEaaEE6e6Ce9ba9F/sources/yBXTBToken.sol
---------------------------------------------------------------------------- Standard ERC20 implementations ---------------------------------------------------------------------------- Read
function totalSupply() public override view returns (uint) { return totalSupplyAmount.subSafe(balances[address(0)]); }
4,084,332
./partial_match/1/0xF68FfFC8A2cD678562Fc73f13FDA8044e57fA574/sources/contracts/erc721/ERC721Base.sol
Unregisters a minter minter Minter to unregister/
function unregisterMinter(address minter) external onlyOwner nonReentrant { if (!_minters.remove(minter)) { _revert(MinterRegistrationInvalid.selector); } emit MinterRegistrationChanged(minter, false); observability.emitMinterRegistrationChanged(minter, false); }
3,719,846
./partial_match/5/0x523371408DCc722e70cb53C3800b355fd9485e05/sources/SGT.sol
Approve `spender` to transfer up to `amount` from `src` This will overwrite the approval amount for `spender` spender The address of the account which may transfer tokens rawAmount The number of tokens that are approved (2^256-1 means infinite) return Whether or not the approval succeeded/
function approve(address spender, uint rawAmount) external returns (bool) { uint96 amount; if (rawAmount == uint(-1)) { amount = uint96(-1); amount = safe96(rawAmount, "SharedStake::approve: amount exceeds 96 bits"); } allowances[msg.sender][spender] = amount...
16,854,363
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // Reference // https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/drafts/TokenVesting.sol // Adapted to the above compiler version import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contrac...
return the duration of the token vesting./
function duration() external view returns (uint256) { return _duration; }
1,491,455
pragma solidity ^0.5.13; import { StakedToken } from "./StakedToken.sol"; import "./StakedTokenProxy.sol"; import "./Proxy/OwnedUpgradeabilityProxy.sol"; /** * @title StakingOpportunityFactory * @dev A Registry for creating staking opportunities. * Creates and tracks instances of StakedTokens (staking opportuniti...
Gets attribute value and forwards to real registry _account accout to request value from. _attribute attribute requested/
function getAttributeValue(address _account, bytes32 _attribute) external view returns (uint256) { return registry.getAttributeValue(_account, _attribute); }
12,972,763
// File: IERC20.sol pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address re...
Interface of the ERC20 standard as defined in the EIP./
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external...
12,108,578
// SPDX-License-Identifier: MIT pragma solidity 0.7.5; /** * @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 * false is...
Returns the total supply of DYDX token at a specific block number. blockNumber Blocknumber at which to fetch DYDX token supply. return Total DYDX token supply at block number./ Iterate in reverse over the total supply snapshots, up to index 1.
function _getTotalSupplyAt(uint256 blockNumber) internal view returns (uint256) { IDydxToken dydxToken = IDydxToken(DYDX_TOKEN); uint256 snapshotsCount = dydxToken._totalSupplySnapshotsCount(); for (uint256 i = snapshotsCount - 1; i != 0; i--) { GovernancePowerDelegationERC20Mixin.Snapshot memory s...
13,754,386
/** *Submitted for verification at Etherscan.io on 2021-08-20 */ // Sources flattened with hardhat v2.4.3 https://hardhat.org // File @openzeppelin/contracts/utils/introspection/[emailΒ protected] // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in th...
Disable early minting/
function disableEarlyMinting() external onlyOwner { require(earlyMinting, "Early minting already disabled"); earlyMinting = false; }
2,425,311
//SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/con...
Set the address of the Lucidia Dreams Smart Contract _address New address
function setLucidia(address _address) public onlyOwner { lucidia = _address; }
6,011,290
./partial_match/1/0x8B4953DCCd3EE51DA1E146fd8FecA4C21458238C/sources/Vault.sol
Harvest profits from the vault's strategy. Harvesting adds profits to the vault's balance and deducts fees. No performance fees are charged on profit used to repay debt. return `true` if successful./ we made profits
function harvest() public onlyAdmin returns (bool) { IStrategy strategy = getStrategy(); if (address(strategy) == address(0)) { return false; } strategy.harvest(); uint256 strategistShare = 0; uint256 allocatedUnderlying = strategy.balance(); ui...
4,339,107
./full_match/80001/0xe78D2f06d7Ad0cDC884D7DDB65e4BCEdbD212298/sources/_solidstate/contracts/token/ERC20/permit/IERC2612.sol
ERC2612 interface/
interface IERC2612 is IERC2612Internal { function DOMAIN_SEPARATOR() external view returns (bytes32 domainSeparator); function nonces(address owner) external view returns (uint256); function permit( address owner, address spender, uint256 amount, uint256 deadline, u...
9,525,815
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.8.4; import {ILendPoolAddressesProvider} from "../interfaces/ILendPoolAddressesProvider.sol"; import {ILendPoolConfigurator} from "../interfaces/ILendPoolConfigurator.sol"; import {ILendPool} from "../interfaces/ILendPool.sol"; import {IBToken} from "../interfaces...
calculates the total supply of the specific bToken since the balance of every single user increases over time, the total supply does that too. return the current total supply/
function totalSupply() public view override returns (uint256) { uint256 currentSupplyScaled = super.totalSupply(); if (currentSupplyScaled == 0) { return 0; } ILendPool pool = _getLendPool(); return currentSupplyScaled.rayMul(pool.getReserveNormalizedIncome(_underlyingAsset)); }
6,907,877
./partial_match/1/0xfdB5Dee856A2709F9D356ABb6A38c391c6eBCe6C/sources/CountdownGriefingEscrow_Factory.sol
Validate if address matches the stored creator. caller address to validate. return validity bool true if matching address.
function isCreator(address caller) internal view returns (bool validity) { return (caller == getCreator()); }
4,386,786
./full_match/3/0x546e15f2489048D9cE72558eF844F5C27926c615/sources/contracts/ERAC.sol
Set the URI of a Uniform Resource Identifier (URI) for an ERAC Note: If not set, the default URI is the ID string of the token Entry parameters: TokenID: ERAC Token ID newTokenURI: The new URI to set return: no return value;Failure returns an error message and a full rollback to the pre-call state permission control...
function setTokenURI(uint256 tokenId, string memory newTokenURI) public onlyOwner { require(_exists(tokenId), "ERAC: URI set of nonexistent token"); _setTokenURI(tokenId, newTokenURI); }
14,195,452
pragma solidity ^0.5.0; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "./aave/contracts/interfaces/IPriceOracleGetter.sol"; import "./aave/contracts/interfaces/IChainlinkAggregator.sol"; import "./aave/contracts/libraries/EthAddres...
Internal function to set the balancer pool tokens _bpoolAddress The address of the balancer pool
function internalSetBalancerPooltokens(address _bpoolAddress) internal { IBPool m_bpool = IBPool(_bpoolAddress); address[] memory tokens = m_bpool.getFinalTokens(); for(uint256 i=0;i<tokens.length;i++) { balancerPoolTokens.push(tokens[i]); balancerPoolTokensDecimals[t...
15,806,179
// SPDX-License-Identifier: MIT pragma solidity ^0.8.3; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20...
Returns rewarded token address _stakeID Id of the stake pool _rewardID Id of the reward return Token contract
function getRewardTokenContract(uint _stakeID, uint _rewardID) internal view returns(IERC20){ return IERC20(poolRewardList[_stakeID][_rewardID].tokenAddress); }
13,084,400
./partial_match/1/0x7c53C97098CCc75337abCdb6e840b641258B8C07/sources/StrategyConvexagEUR_EUROC.sol
Set optimal token to sell harvested funds for depositing to Curve.
function setOptimal(uint256 _optimal) external onlyVaultManagers { if (_optimal == 0) { targetEuro = address(ageur); uniEuroFee = 100; targetEuro = address(euroc); uniEuroFee = 500; revert("incorrect token"); } }
3,981,090
./full_match/1/0xD360c4eEd8D02c6D43Dab90466159F580C0F68BB/sources/contracts/core/libraries/TwabLib.sol
Sets a new TWAB Observation at the next available index and returns the new account details. Note that if _currentTime is before the last observation timestamp, it appears as an overflow _twabs The twabs array to insert into _accountDetails The current account details _currentTime The current time return accountDet...
function _nextTwab( ObservationLib.Observation[MAX_CARDINALITY] storage _twabs, AccountDetails memory _accountDetails, uint32 _currentTime ) private returns ( AccountDetails memory accountDetails, ObservationLib.Observation memory twab, ...
2,912,404
./partial_match/1/0x9EBA9Df9F850362D85d064673379958896c8416A/sources/Token.sol
------------------------------------------------------------------------ Returns the amount of tokens approved by the owner that can be transferred to the spender's account ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public override view returns (uint256 remaining) { return allowed[tokenOwner][spender]; } uint256 tokenRatePerEth = 1333;
2,774,955
pragma solidity ^0.4.24; import "./ERC20Interface.sol"; import "./EIP918Interface.sol"; import "./Owned.sol"; import "./Admin.sol"; import "./ApproveAndCallFallBack.sol"; import "./SafeMath.sol"; import "./ExtendedMath.sol"; import "./0xCATE_v2.sol"; // ----------------------------------------------------------------...
--- Migrate deprecated contract tokens to this one. ---require(ERC20Interface(deprecatedContractAddress).allowance(msg.sender, address(this)) >= tokens, "Contract needs approval to use transferFrom");
function migrateDeprecatedTokens () public whenTransfersEnabled whenMigrationEnabled { uint256 tokens = ERC20Interface(deprecatedContractAddress).balanceOf(msg.sender); receiveApproval(msg.sender, tokens, deprecatedContractAddress, ""); }
12,647,175
./full_match/11155111/0x96aF7EA8Ef83f53c976eb1fC87C7B649f6438C09/sources/contracts/PatientDataManagement.sol
Docto or Patient addPrescription doctors[msg.sender].imgUrl.push(url);
function addPrescription(address _user, string memory url) external { if (accounts[msg.sender] == uint256(EntityType.Doctor)) { require(doctors[msg.sender].isAdded, "Doctor doesn't exist"); if (accounts[_user] == uint256(EntityType.Pathologist)) { pathologist...
3,795,706
// SPDX-License-Identifier: MIT pragma solidity 0.8.13; /** * @title The house Of coin minting contract. * @author daigaro.eth * @notice Allows users with acceptable reserves to mint backedAsset. * @notice Allows user to burn their minted asset to release their reserve. * @dev Contracts are split into state an...
Check current maxMintableAmount with current price Compute health ratio
function _computeUserHealthRatio( uint256 reserveBal, uint256 mintedCoinBal, IHouseOfReserveState.Factor memory collatRatio, uint256 price ) internal view returns (uint256 healthRatio) { uint256 reserveBalreducedByFactor = (reserveBal * collatRatio.denominator...
12,834,368
/** *Submitted for verification at Etherscan.io on 2022-03-15 */ // SPDX-License-Identifier: GPL-3.0-or-later // Sources flattened with hardhat v2.6.1 https://hardhat.org // File @openzeppelin/contracts/token/ERC20/[emailΒ protected] // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol) pragma so...
Get the balance of the hop lp./
function _hopLpBalance() internal view returns (uint256) { return hopLp.balanceOf(address(this)); }
2,187,038