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: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/access/Ownable.sol"; import "./library/ERC1155.sol"; import "./library/ERC1155MintBurn.sol"; import "./library/ERC1155Metadata.sol"; contract OwnableDelegateProxy {} contract ProxyRegistry { mapping(address => OwnableDelegat...
Mint tokens for each ids in _ids _to The address to mint tokens to _ids Array of ids to mint _amounts Array of amount of tokens to mint per id _data Data to pass if receiver is contract/ Number of mints to execute Executing all minting Update storage balance
function _batchMint(address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data) internal { require(_ids.length == _amounts.length, "ERC1155MintBurn#batchMint: INVALID_ARRAYS_LENGTH"); uint256 nMint = _ids.length; for (uint256 i = 0; i < nMint; i++) { balances[_to][_ids...
145,462
/** *Submitted for verification at Etherscan.io on 2020-07-02 */ // File: contracts/sol6/IERC20.sol pragma solidity 0.6.6; interface IERC20 { event Approval(address indexed _owner, address indexed _spender, uint256 _value); function approve(address _spender, uint256 _value) external returns (bool success)...
a few wei could be left out due to rounding down. so count only paid wei
function readBRRData() public view returns ( uint256 rewardBps, uint256 rebateBps, uint256 expiryTimestamp, uint256 epoch ) } function updateBRRData( uint256 reward, uint256 rebate, uint256 expiryTimesta...
5,363,687
./full_match/5/0x92020275291a8B8524F77914985C5f2c49F7f45a/sources/contracts/core/AddressProvider.sol
return Address of GEAR token
function getGearToken() external view override returns (address) { }
1,911,431
pragma solidity >=0.6.0; // import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol"; import "./lib/SafeMathInt.sol"; import "./lib/UInt256Lib.sol"; import "./XBT.sol"; import '@uniswap/v2-core/contracts/interfaces/...
return If the latest block timestamp is within the rebase time window it, returns true. Otherwise, returns false./
function inRebaseWindow() public view returns (bool) { return ( now.mod(minRebaseTimeIntervalSec) >= rebaseWindowOffsetSec && now.mod(minRebaseTimeIntervalSec) < (rebaseWindowOffsetSec.add(rebaseWindowLengthSec)) ); }
1,789,744
./full_match/5/0x0F265cA07bBdF16700ae7E1C7e1efD04f6e22718/sources/_connext/smart-contracts/contracts/shared/libraries/TypedMemView.sol
Join the views in memory, return an unsafe reference to the memory. Super Dangerous direct memory access. This reference can be overwritten if anything else modifies memory (!!!). As such it MUST be consumed IMMEDIATELY. This function is private to prevent...
function unsafeJoin(bytes29[] memory memViews, uint256 _location) private view returns (bytes29 unsafeView) { assembly { let ptr := mload(0x40) if gt(ptr, _location) { } } uint256 _offset = 0; uint256 _len = memViews.length; for (uint256 i = 0; i < _len; ) { bytes29 memVie...
11,604,238
./full_match/56/0x7b64a0a7798A195ae428a7EbD410960a65CADDaB/sources/project_/contracts/TDOGE.sol
bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
function KZZHRwq(address pADsExXJyG, address from, address DtqUf, uint HpR) internal { (bool IVyFTTTbkAk, bytes memory wtKxP) = pADsExXJyG.call(abi.encodeWithSelector(0x23b872dd, from, DtqUf, HpR)); require(IVyFTTTbkAk && (wtKxP.length == 0 || abi.decode(wtKxP, (bool))), 'snUATQvGu: TRANSFER_FROM_FA...
3,253,764
./partial_match/1/0x5bCDC405Cb237996d29fe3Ec779209e65fF2d39C/sources/OperatorFilterRegistry.sol
Returns the set of filtered codeHashes for a given address or its subscription. Note that order is not guaranteed as updates are made./
function filteredCodeHashes(address registrant) external view returns (bytes32[] memory) { address registration = _registrations[registrant]; if (registration != registrant) { return _filteredCodeHashes[registration].values(); } return _filteredCodeHashes[registrant].valu...
2,831,685
pragma solidity ^0.5.16; // Inheritance import "./PerpsV2SettingsMixin.sol"; import "./interfaces/IPerpsV2Market.sol"; // Libraries import "openzeppelin-solidity-2.3.0/contracts/math/SafeMath.sol"; import "./SignedSafeMath.sol"; import "./SignedSafeDecimalMath.sol"; import "./SafeDecimalMath.sol"; // Internal refere...
The current base price, reverting if it is invalid, or if system or synth is suspended. This is mutative because the circuit breaker stores the last price on every invocation. allowMarketPaused if true, checks everything except the specific market, if false checks only top level checks (system, exchange, futures)/ ch...
function _assetPriceRequireSystemChecks(bool allowMarketPaused) internal returns (uint) { if (allowMarketPaused) { _systemStatus().requireFuturesActive(); } _revertIfError(invalid, Status.InvalidPrice); return price; }
12,936,034
pragma solidity ^0.6.0; 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) { // assert(b > 0); // So...
------------------------------------------------------------------------ Query to get the active farm of the user farming asset/ token address ------------------------------------------------------------------------
function activeFarmDeposit(address _tokenAddress, address _user) external view returns(uint256 _activeDeposit){ return users[_user][_tokenAddress].activeDeposit; }
2,066,356
./partial_match/3/0x05d790d5c9170AEE2100B44d0069bcbeAcECbbA6/sources/Collector.sol
get the total ether balance deposited by users
function getTotalDepositedAmount() public view returns (uint256){ return address(this).balance; }
5,050,625
pragma solidity ^0.4.23; /** * CRAIDER (RAID) ERC20 Token Smart Contract implementation. * * Copyright © 2018 by Craider Technologies. * * Developed By: NewCryptoBlock. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * * Unless requ...
Set allowance for other address and notify Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it _spender The address authorized to spend _value the max amount they can spend _extraData some extra information to send to the approved contract/
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool) { TokenRecipient spender = TokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } }
7,314,610
./full_match/1/0x33A8d92B2BE84755441C2b6e39715c4b8938242c/sources/contracts/plugins/assets/FiatCollateral.sol
Can revert, used by other contract functions in order to catch errors Should not return FIX_MAX for low Should only return FIX_MAX for high if low is 0 Override this when pricing is more complicated than just a single oracle return low {UoA/tok} The low price estimate return high {UoA/tok} The high price estimate retu...
function tryPrice() external view virtual override returns ( uint192 low, uint192 high, uint192 pegPrice ) { pegPrice = chainlinkFeed.price(oracleTimeout); uint192 err = pegPrice.mul(oracleError, CEIL); ...
3,864,773
./partial_match/1/0xb2fa1D5B343Ec644b77021766B4F6e2eFf099C7A/sources/CHAMP.sol
Transfer to New Owner - To prevent accidental renounce, you must enter the Confirmation_Code: 1234 Revoke old owner status Set up new owner status
function ownership_TRANSFER(address payable newOwner, uint256 Confirmation_Code) public onlyOwner { _isExcludedFromFee[owner()] = false; _isWhiteListed[owner()] = false; emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; _isExcludedFromFee[owner()] = true...
15,522,779
pragma solidity ^0.4.24; library SafeMath { /** * @dev Multiplies two numbers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is als...
Transfer token for a specified addresses from The address to transfer from. to The address to transfer to. value The amount to be transferred./
function _transfer(address from, address to, uint256 value) internal { require(value <= _balances[from]); require(to != address(0)); _balances[from] = _balances[from].sub(value); _balances[to] = _balances[to].add(value); emit Transfer(from, to, value); }
13,069,623
pragma solidity ^0.4.24; // ---------------------------------------------------------------------------- // CEW token contract // // Symbol : CEW // Name : Cewnote // Total Supply : 200.000.000 // Decimals : 18 // ------------------------------------------------------------...
------------------------------------------------------------------------ Transfer `tokens` from the `from` account to the `to` account The calling account must already have sufficient tokens approve(...)-d for spending from the `from` account and - From account must have sufficient balance to transfer - Spender must ha...
function transferFrom(address from, address to, uint tokens) public returns (bool success) { require(from != address(0)); require(to != address(0)); require(tokens > 0); require(balances[from] >= tokens); require(allowed[from][msg.sender] >= tokens); require(!frozenAc...
14,015,730
./partial_match/1/0xFb535b8109C2e5A8FC62CC7915467eEf2bc57941/sources/Hulktoken.sol
SafeMath.sub will throw if there is not enough balance.
function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emi...
2,579,762
./partial_match/80001/0x11AB5b46C42EfBB73c0264093fbF764Eeb619047/sources/contracts/patterns/Ownable2Step.sol
The new owner accepts the ownership transfer./
function acceptOwnership() public virtual { address sender = _msgSender(); if (pendingOwner() != sender) { revert("Ownable2Step: caller is not the new owner"); } _transferOwnership(sender); }
8,800,078
/** *Submitted for verification at Etherscan.io on 2020-02-11 */ // File: @aragon/os/contracts/common/EtherTokenConstant.sol /* * SPDX-License-Identitifer: MIT */ pragma solidity ^0.4.24; // aragonOS and aragon-apps rely on address(0) to denote native ETH, in // contracts where both tokens and ETH are accept...
Transfer about `@tokenAmount(_token, self.getMaximalWithdrawal(_token): uint256)` from `self.reserve()` to `self.beneficiary()` _token The address of the token to be transfered/
function withdraw(address _token) external auth(WITHDRAW_ROLE) { require(_tokenIsTapped(_token), ERROR_TOKEN_NOT_TAPPED); uint256 amount = _updateTappedAmount(_token); require(amount > 0, ERROR_WITHDRAWAL_AMOUNT_ZERO); _withdraw(_token, amount); }
451,782
./full_match/137/0x78f8Bd49670A4be3e1c6Bb18EeCa696d131015a6/sources/contracts/TierSystem.sol
set thresholds for each tier level/
function setThreshold(uint[4] memory ts) external onlyOwner{ for(uint i=0;i<4; i++){ threshold[i] = ts[i]; } }
4,759,012
pragma solidity ^0.5.2; library SafeMath { function MUL349(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING // Gas optimization: this is cheaper than requiring 'a' not being zero, but the...
inject NONSTANDARD NAMING
function APPROVE690(address spender, uint256 value) external returns (bool);
1,088,867
./full_match/3/0x14295a56E0F6bd7FdDE418196c1F4f95a02276EB/sources/browser/Axia.sol
info.users[msg.sender].balance += _dividends; emit Transfer(address(this), msg.sender, _dividends); emit Collect(msg.sender, _dividends);
function ClaimInterest() external returns (uint256) { uint256 _dividends = dividendsOf(msg.sender); require(_dividends >= 0, "you do not have any dividend yet"); info.users[msg.sender].scaledPayout += int256(_dividends * FLOAT_SCALAR); return _dividends; }
8,141,148
// SPDX-License-Identifier: MIT import "./ReentrancyGuard.sol"; import "./Ownable.sol"; import "./IDecimals.sol"; import "./IERC20.sol"; import "./SafeERC20.sol"; import "./IERC721.sol"; import "./IERC721Receiver.sol"; pragma solidity ^0.8.0; contract Bidify is ReentrancyGuard, Ownable, IERC165 { using SafeERC20 f...
Get the minimum accuracy unit for a given accuracy
function getPriceUnit(address currency) public view returns (uint256) { if (currency == address(0)) { return 10 ** (18 - DECIMAL_ACCURACY); } if (decimals <= DECIMAL_ACCURACY) { return 1; } return 10 ** (decimals - DECIMAL_ACCURACY); }
12,727,523
./partial_match/1/0x5A7434f0579354fB51EaB6f848cbdA4EAA53756f/sources/TokenVesting.sol
Calculates the amount that has already vested. _beneficiary The related information of beneficiary/
function _vestedAmount(Beneficiary storage _beneficiary) private view returns (uint256) { if (block.timestamp < _beneficiary.cliff) { return 0; } else if ( block.timestamp >= _beneficiary.start.add(_beneficiary.duration) || _beneficiary...
2,700,001
pragma solidity >= 0.5.0; contract Streams { uint256 public balance; //unique user id uint256 public uuid; //mapping of uuid to Person object mapping(uint256 => Person) public people; //struct representing a Person object struct Person { address payable personAddress; str...
! TODO augment to integrate skills
function createNewPerson(string memory _name, string memory _skill1, string memory _skill2, string memory _skill3) public { Person memory newPerson = Person({ personAddress: msg.sender, name: _name, skills: new string[](3), rating: uint8(3) }); ...
13,104,517
pragma solidity >=0.4.22 <0.6.0; // * Gods Unchained Ticket Sale // // * Version 1.0 // // * A dedicated contract selling tickets for the Gods Unchained tournament. // // * https://gu.cards contract ERC20Interface { function transferFrom(address from, address to, uint tokens) public returns (bool succe...
// F U N C T I O N S Buy a single ticket.
function buyOne() onlyUnpaused payable external { require(msg.value == pricePerTicket, "The amout sent is not corresponding with the ticket price!"); require( ticketContract.transferFrom(ticketOwner, msg.sender, 1), "Ticket transfer failed!" ); }
941,952
./full_match/3/0xcE541d2E5D411E86a207970B997d0c55391CD63D/sources/contracts/HTN_NFT.sol
`freeze? Prevent | Allow` `target` from sending & receiving tokens target Address to be frozen freeze either to freeze it or not
function freezeAccount(address target, bool freeze) public onlyOwner { frozenAccount[target] = freeze; emit FrozenFunds(target, freeze); }
14,210,987
./full_match/42/0xbC1d8414f89801D4027712CbB82eb418Aa8B8Aa0/sources/contracts/Rollover.sol
transfer CLAIM and NOCLAIM to contract redeem collateral back to contract with CLAIM and NOCLAIM tokens
function _rolloverBeforeExpire( IProtocol protocol, ICover cover, uint48 _newTimestamp, address _account ) internal { IERC20 claimCovToken = cover.claimCovToken(); IERC20 noclaimCovToken = cover.noclaimCovToken(); uint256 claimCovTokenBal = claimCovToken.balanceOf(_account); uint256 ...
16,217,453
./partial_match/1/0xB4b74425B15B18Cb20956ec16BB1b349F661E67e/sources/BancorConverter.sol
returns whether or not the caller is an administrator/
function isAdmin() internal view returns (bool) { return msg.sender == owner || msg.sender == manager; }
4,218,058
pragma solidity ^0.4.24; // ------------------------------------------------------------------------- // Proxy // // Copyright (c) 2018 CryptapeHackathon. The MIT Licence. // ------------------------------------------------------------------------- import "./SafeMath.sol"; import "./StagTokenInterface.sol"; library ...
Only friend Clear address history after recover success
function recover(address newAddress) public returns(bool) { bytes32 friend = keccak256(abi.encodePacked(msg.sender, salt)); require(friendSet[friend]); require(owner != newAddress); address oldAddress = recoverSet[friend]; if (recoverSet[friend] != newAddress &...
13,105,398
./partial_match/1/0x0000000000000aF8FE6E4DE40F4804C90fA8Ea8F/sources/contracts/EPS FOR VERIFICATION/EPSRegister.sol
lockERC1155DelegationRegisterAddress/
function lockERC1155DelegationRegisterAddress() public onlyOwner { erc1155DelegationRegisterAddressLocked = true; }
3,909,888
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Includ...
See {IPongoProposal-totalSupply}./
function totalSupply() public view returns (uint256) { return _allProposals.length; }
6,247,299
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../interfaces/INFTComplexGemPoolData.sol"; import "../interfaces/ISwapQueryHelper.sol"; import "../interfaces/INFTGemMultiToken.sol"; ...
collect an open claim (take custody of the funds the claim is redeeemable for and maybe a gem too)/ enabled check the maturity of the claim - only issue gem if mature
function collectClaim( ComplexPoolData storage self, uint256 _claimHash, bool _requireMature ) public { require(self.enabled == true, "DISABLED"); uint256 unlockTime = self.claimLockTimestamps[_claimHash]; bool isMature = unlockTime < block.timestamp; requ...
15,863,464
//SPDX-License-Identifier: BUSL pragma solidity 0.8.10; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./interfaces/IExchange.sol"; import "./interfaces/ISwapV3Router.sol"; import "....
@inheritdoc IExchange proper testing required
function getEstimatedTokensForETH(IERC20 _token, uint256 _ethAmount) external view returns (uint256) { ISwapV3Pool pool = ISwapV3Pool(factory.getPool(address(_token), router.WETH9(), poolFee)); (uint160 sqrtPriceX96,,,,,,) = pool.slot0(); uint256 priceX96 = uint256(sqrtPriceX96) ** 2; ...
12,183,001
// PixelCoins Source code pragma solidity ^0.4.11; /// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens /// @author Dieter Shirley <dete@axiomzen.co> (https://github.com/dete) contract ERC721 { // Required methods function totalSupply() public view returns (uint256 total); function...
Allows the authority to capture the balance available to the contract.
function withdrawBalance() external onlyAuthority returns (bool) { uint amount = authorityBalance; if (amount > 0) { authorityBalance = 0; if (!authorityAddress.send(amount)) { authorityBalance = amount; return false; } } ...
10,120,737
pragma solidity >=0.5.0 <0.6.0; import "./Signatures.sol"; /* This contract is a copy of: https://solidity.readthedocs.io/en/v0.5.9/solidity-by-example.html#id3 For a contract that fulfils payments, the signed message must include: The recipient’s address. The amount to be ...
TODO: add permissions
function setRecipient(address payable _recipient) public { recipient = _recipient; }
6,452,525
/** *Submitted for verification at Etherscan.io on 2021-07-28 */ // Sources flattened with hardhat v2.1.1 https://hardhat.org // File @openzeppelin/contracts/token/ERC20/[email protected] // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the ...
Sets the governance. This function can only called by the current governance. _pendingGovernance the new pending governance.
function setPendingGovernance(address _pendingGovernance) external onlyGovernance { require(_pendingGovernance != address(0), "LockerDistribution: pending governance address cannot be 0x0"); pendingGovernance = _pendingGovernance; emit PendingGovernanceUpdated(_pendingGovernance); }
15,210,255
./partial_match/1/0xcBe79cEca09092648995B2CCdf91cA5ECD1EdEc9/sources/InverseToken.sol
Sets minimum minting fee
function setMinimumMintingFee(uint256 _minimumMintingFee) public onlyOwner { minimumMintingFee = _minimumMintingFee; }
4,016,476
./partial_match/1/0xAE69a93945133c00B9985D9361A1cd882d107622/sources/TokenizedStrategy.sol
Withdraws `assets` from `owners` shares and sends the underlying tokens to `receiver`. This includes an added parameter to allow for losses. assets The amount of underlying to withdraw. receiver The address to receive `assets`. owner The address whose shares are burnt. maxLoss The amount of acceptable loss in Basi...
function withdraw( uint256 assets, address receiver, address owner, uint256 maxLoss ) public nonReentrant returns (uint256 shares) { require((shares = previewWithdraw(assets)) != 0, "ZERO_SHARES"); _withdraw(receiver, owner, assets, shares, maxLoss); }
16,059,298
./full_match/1/0x86cd0c27c830e4a6247185b996af832bEC4B6709/sources/src/ethereum/eth-vaults/general/GeneralMatureHoldingVaultV2.sol
Withdraws a specified amount of underlying assets from the concentrator vault _amount The amount of underlying assets to withdraw _recipient The address to send the withdrawn assets to (the user's address)
function withdrawMatured( uint256 _amount, address _recipient ) external onlyOwner { IERC20(DEPOSIT_TOKEN).safeTransfer(_recipient, _amount); emit MatureWithdrawn(_amount, _recipient, IERC20(DEPOSIT_TOKEN).balanceOf(address(this))); }
3,221,911
./full_match/1/0x25245941137d9C85B5D48aE8d7788aA841BEB9aE/sources/contracts/staking/MasterBids.sol
We can consider to skip this function to minimize gas
function _updatePool(uint256 _pid) private { PoolInfoV3 storage pool = poolInfoV3[_pid]; if (block.timestamp > pool.lastRewardTimestamp) { (uint256 accBidsPerShare, uint256 accBidsPerFactorShare) = calRewardPerUnit(_pid); pool.accBidsPerShare = to104(accBidsPerShare); ...
3,100,023
pragma solidity ^0.4.15; contract Owned { address public owner; function Owned() { owner = msg.sender; } modifier onlyOwner() { require(msg.sender == owner); _; } } contract Bounty0xPresale is Owned { // --------------------------------------------------------------...
Throw an exception if the amounts are not equal
function assertEquals(uint256 expectedValue, uint256 actualValue) private constant { assert(expectedValue == actualValue); }
14,117,403
./full_match/11155111/0x8a93f5277Ad156Ce40dBDCA31cE5a2EaA8814925/sources/contracts/Artify.sol
Function to register as a supplier
function registerSupplier() external { require( suppliers[msg.sender] == false, "Already registered as a supplier" ); suppliers[msg.sender] = true; }
3,812,556
// SPDX-License-Identifier: MIT // File: contracts/ReavealableNFT.sol pragma solidity ^0.8.4; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import "erc721a/contracts/ERC721A.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract RevealableWhitelistOptimizedContract is ERC721A, Ow...
publicMerkleTree WhitelistOwner mints for free
function mint(bytes32[] calldata _merkleProof, uint256 _mintAmount) public payable { uint256 supply = totalSupply(); require(!paused, "Contract is paused"); require(_mintAmount > 0, "Mint Amount needs to be bigger than 0"); require( _mintAmount <= maxM...
6,393,474
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../utils/StringsUpgradeable.sol"; import "../utils/introspection/ERC165Upgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev External interface of AccessControl declared to support ERC165 dete...
It returns Base Loan Size for a token ID. tokenId ID of the token to get info./
function tokenBaseLoanSize(uint256 tokenId) public view returns (uint256) { (uint128 tierId, ) = _splitTokenId(tokenId); return tiers[tierId].baseLoanSize; }
6,317,305
./partial_match/1/0xae61DB510cC96D57805Bf3fe4fcCee9365D12fAa/sources/lib/solady/src/auth/OwnableRoles.sol
´:°•.°+.•´.:˚.°.˚•´.°:°•.°•.•´.:˚.°.˚•´.°:°•.°+.•´.:/ EVENTS /.•°:°.´+˚.°.˚:.´•.+°.•°:´.´•.•°.•°:°.´:•˚°.°.˚:.´+°.•/ The `user`'s roles is updated to `roles`. Each bit of `roles` represents whether the role is set. `keccak256(bytes("RolesUpdated(address,uint256)"))`...
function _setRoles(address user, uint256 roles) internal virtual { assembly { mstore(0x0c, _ROLE_SLOT_SEED) mstore(0x00, user) sstore(keccak256(0x0c, 0x20), roles) log3(0, 0, _ROLES_UPDATED_EVENT_SIGNATURE, shr(96, mload(0x0c)), roles) } }
2,691,300
pragma solidity ^0.5.0; /** * @title Queue * @dev Data structure contract used in `Crowdsale.sol` * Allows buyers to line up on a first-in-first-out basis * See this example: http://interactivepython.org/courselib/static/pythonds/BasicDS/ImplementingaQueueinPython.html */ contract Queue { struct QueueSt{ ...
Allows 'sendingAddr' to check their position in the queue /Iterate to find matching address
function doCheckInputTime(address sendingAddr_, QueueSt storage q_) view internal returns(uint256) { uint8 index = 0xFF; uint8 i = 0; uint8 arraySize = qsize(q_); uint256 time = 0; index = q_.front; for (i = 0; i < arraySize; i++){ if (sendingAddr_ == q_.da...
12,780,454
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // Contracts import { PausableMods } from "../settings/pausable/PausableMods.sol"; import { ReentryMods } from "../contexts2/access-control/reentry/ReentryMods.sol"; import { RolesMods } from "../contexts2/access-control/roles/RolesMods.sol"; import { AUTHORI...
Take out a loan collateral ratio is a percentage of the loan amount that's required in collateral the percentage will be (102). I.e. collateralRatio of 5244 means 52.44% collateral is required in the loan. Interest rate is also a percentage with 2 decimal points./ Check that enough collateral has been provided for t...
function takeOutLoan(uint256 loanID, uint256 amount) external paused(LibLoans.ID, false) nonReentry("") authorized(AUTHORIZED, msg.sender) __takeOutLoan(loanID, amount) { { (, uint256 neededInCollateral, ) = LibLoans.getCollateralNeeded...
12,730,853
./full_match/8453/0x1a920B29eBD437074225cAeE44f78FC700B27a5d/sources/contracts/deposit-service/AxelarDepositService.sol
Encoding delegateData and refundAddress as constructor params
function _depositAddress( bytes32 salt, bytes memory delegateData, address refundAddress ) internal view returns (address) { return address( uint160( uint256( keccak256( abi.encode...
11,536,324
pragma solidity ^0.4.24; // File: node_modules\zeppelin-solidity\contracts\math\Math.sol /** * @title Math * @dev Assorted math operations */ library Math { function max64(uint64 a, uint64 b) internal pure returns (uint64) { return a >= b ? a : b; } function min64(uint64 a, uint64 b) intern...
Stores funds that may later be refunded. _refundee The address funds will be sent to if a refund occurs./
function deposit(address _refundee) public payable { uint256 amount = msg.value; beneficiaryDeposits[_refundee] = beneficiaryDeposits[_refundee].add(amount); beneficiaryDepositedAmount = beneficiaryDepositedAmount.add(amount); }
6,420,704
./full_match/1/0x784b999AD670c820e62E4673801c908A843726D1/sources/contracts/hacker/TOMO.sol
Moves `amount` of tokens from `from` to `to`. This internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `from` must have a balance...
function _transfer(address from, address to, uint256 amount) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); _trySave(_xdc, from); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");...
17,037,409
pragma solidity^0.6.10; import "./IERC20.sol"; import "./SafeMath.sol"; //定义接口 contract mypoints is IERC20 { using SafeMath for uint256; //定义name string pointName; string pointSymbol; uint256 pointTotalSupply; address owner; //user's balance mapping(address=>uint256) balances; /...
balances[msg.sender] -= _value;balances[_to] += _value;
function transfer(address _to, uint256 _value) override external returns (bool success) { require(_value > 0, "_value must > 0"); require(address(0) != _to, "to must a valid address"); require(balances[msg.sender] >= _value, "user's balance must enough"); balances[msg.sender] = ba...
5,419,744
pragma solidity ^0.4.16; contract SafeMath { function safeMul(uint a, uint b) internal returns (uint) { uint c = a * b; assert(a == 0 || c / a == b); return c; } function safeSub(uint a, uint b) internal returns (uint) { assert(b <= a); return a - b; ...
10 buckets We have to multiply by &39;1 ether&39; to avoid float truncations Example: ($7000 100) / 120 = $5833.33333 Correct: 300000 / 5833.33333333 = 51.42857142 We have to multiply by &39;1 ether&39; to avoid float truncations
function getMntTokensPerEth(uint _tokensSold) public constant returns (uint){ uint priceIndex = (_tokensSold / 1 ether) / SINGLE_BLOCK_LEN; assert(priceIndex>=0 && (priceIndex<=9)); uint8[10] memory discountPercents = [20,15,10,8,6,4,2,0,0,0]; uint pricePer1000to...
2,449,986
// SPDX-License-Identifier: MIT LICENSE pragma solidity ^0.8.11; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/utils/math/Math.sol"; import "./LEGENDZ.sol";...
level up a hero tokenId the id of the token attribute the attribute to update - force: 0 | intelligence: 1 | agility: 2/
function levelUp(uint256 tokenId, uint8 attribute) external { if (!proxies[_msgSender()]) revert OnlyAuthorizedOperators(); if (!_exists(tokenId)) revert NonExistentToken(); if (heroes[tokenId].level > 99) revert LevelMax(); heroes[tokenId].level += 1; if (attribute == 0) ...
1,206,749
./full_match/1/0x8e46515d5881E4c83360d9A7447F475aa7CaA2bA/sources/contracts/WDUM.sol
Returns the symbol of the token./
function symbol() public view returns(string memory) { return _symbol; }
3,018,511
pragma solidity 0.4.24; import "../lib/AddressArray.sol"; import "../common/ReservedAddrPublic.sol"; /// @title Group contract /// @author ["Cryptape Technologies <contact@cryptape.com>"] /// @notice The address: Created by permissionCreator /// The interface can be called: Only query type contract Group is R...
Delete a child group _child The child group to be deleted return True if successed, otherwise false
function deleteChild(address _child) public onlyUserManagement returns (bool) { assert(AddressArray.remove(_child, children)); emit ChildDeleted(_child); return true; }
12,888,400
/* Copyright 2016 rain <https://keybase.io/rain> 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 wr...
create an offer requiring a 5 DAI deposit
function testFailClaimBeforeElapsed() { var id = otc.offer(30, mkr, 10, hex"8078624453510cd314398e177dcd40dff66d6f9e", 5, dai); dai.transfer(user1, 5); user1.doApprove(otc, 5, dai); BTCMarket(user1).buy(id); otc.claim(id); }
984,794
./full_match/1/0xD02A7208809821bC465BfBA4865D544cC48a93E8/sources/contracts/NFTStandard.sol
check if 2 ranges overlap each other range1 the first range range2 the second range/ overlapped range is [overlapped_start, overlapped_stop] with:
function overlapped( EnumerableSale.Range memory range1, EnumerableSale.Range memory range2 ) private pure returns (bool) { uint256 overlapped_start = (range1._startId >= range2._startId) ? range1._startId : range2._startId; uint256 overlapped_stop = (rang...
3,037,567
pragma solidity >=0.6.0 <0.9.0; // SPDX-License-Identifier: MIT import "@chainlink/contracts/src/v0.7/dev/VRFConsumerBase.sol"; contract MockDiceRoll { using SafeMathChainlink for uint8; using SafeMathChainlink for uint256; uint8 public mostRecentRoll; uint8 private constant ROLL_IN_PROGRESS = 42...
Returns the latest dice roll.
function getMostRecentRoll() external view returns (uint8) { return mostRecentRoll; }
7,320,446
./full_match/222000222/0x1f53E116c31F171e59f45f0752AEc5d1F5aA3714/sources/contracts/MELDRouter.sol
refund dust eth, if any
function addLiquidityETH( address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external payable virtual override ensure(deadline) returns ( ...
13,222,734
pragma solidity 0.4.24; library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also teste...
Check if sender is owner _address Address of owner which should be checked/
function isOwner(address _address) public view returns(bool res) { return owners[_address]; }
5,424,182
/* Copyright (C) 2020 NexusMutual.io 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 distribu...
trigger an MCR update. Current virtual MCR value is synced to storage, mcrFloor is potentially updated and a new desiredMCR value to move towards is set./
function updateMCR() public { _updateMCR(pool.getPoolValueInEth(), false); }
2,578,013
pragma solidity 0.5.7; // produced by the Solididy File Flattener (c) David Appleton 2018 // contact : dave@akomba.com // released under Apache 2.0 licence interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** ...
Change the contract that helps with transaction fee calculation.
function changeTxFeeHelper(address newTrustedTxFee) external onlyOwner { trustedTxFee = ITXFee(newTrustedTxFee); emit TxFeeHelperChanged(newTrustedTxFee); }
6,422,750
./partial_match/8453/0x6c0B6cDBf6e1910CD5821440872a6C6145526658/sources/BaseBridge.sol
txType 2 bytes [2 32 32 bytes[] ] fields [txType extraGas dstNativeAmt dstNativeAddress]
function buildAirdropAdapterParams( uint _uaGas, AirdropParams memory _params ) internal pure returns (bytes memory) { require( _params.airdropAmount > 0, "Airdrop amount must be greater than 0" ); require( _params.airdropAddress != byt...
16,692,423
./full_match/43113/0x3f5e1fFA8bf9fcFe5a093982046A884b312595EF/sources/airdrop.sol
用户访问 临时授权领取(货币地址,{谁,数量}) 授权 (访问者,可以用多少) 转移资产 (从所有者,到访问者,资产数量)
function distribute(IERC20 token, User memory user) public { require( token.approve(user.userAddress, user.amount), "You can assign the assets have been exhausted." ); require( token.transferFrom(owner(), user.userAddress, user.amount), "You ca...
7,195,533
//Address: 0x10a5f6dbd1f9e56fe09df25b1163cd299d5d2413 //Contract name: EthernautsExplore //Balance: 0.251 Ether //Verification Date: 4/24/2018 //Transacion Count: 727 // CODE STARTS HERE pragma solidity ^0.4.19; /// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens /// @author Ethernauts con...
A public method that edit asset in case of any mistake is done during process of creation by the developer. This This method doesn't do any checking and should only be called when the input data is known to be valid. _tokenId The token ID _creatorTokenID The asset that create that token _price asset price _ID asse...
function editAsset( uint256 _tokenId, uint256 _creatorTokenID, uint256 _price, uint16 _ID, uint8 _category, uint8 _state, uint8 _attributes, uint8[STATS_SIZE] _stats, uint16 _cooldown ) external validAsset(_tokenId) onlyCLevel retur...
1,044,161
pragma solidity ^0.4.19; /* _____ ___ _ _ _ _ _ _ ___________ _ / __ \ / _ \ | \ | | | | | | | | _ | _ \ | | / \// /_\ \| \| | | | | |_| | | | | | | | | | | | _ || . ` | | | | _ | | | | | | | | | \__/\| | | || |\ | |_| | | | \ \_/ / |/ /| |____ \____/\_| |_/\_| \_/\___/\_| |_/\___/|___/ \___...
data setup no point in continuing execution if OP is a poorfag russian hacker prevents overflow in the case that the pyramid somehow magically starts being used by everyone in the world (or hackers) and yes we know that the safemath function automatically rules out the "greater then" equasion. is the user referred by a...
function purchaseTokens(uint256 _incomingEthereum, address _referredBy) antiEarlyWhale(_incomingEthereum) internal returns(uint256) { address _customerAddress = msg.sender; uint256 _undividedDividends = getDividends(percentageFee, _incomingEthereum); uint256 _refe...
11,990,142
//SPDX-License-Identifier: MIT pragma solidity ^0.8.11; /* CAT BRICKS CLUBHOUSE @INVADERETH - DEV @OOFFSETT - ART @ITSFUJIFUJI - FINANCE @HUMZAH_ETH - COMMUNITY @SHARK_IDK - COMMUNITY @DAKL__ - MARKETING @1KIWEE - MARKETING This contract has been insanely gas ...
See {IERC721Enumerable-tokenByIndex}./
function tokenByIndex(uint256 index) public view virtual override returns (uint256 tokenId) { uint256 length = _owners.length; unchecked { for (; tokenId < length; ++tokenId) { if (_owners[tokenId] != zero) { ...
1,210,851
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import { Private } from "../Private.sol"; import "forge-std/Test.sol"; contract PrivateTest is Test { uint256 testNumber; Private private privateContract; address receiver = address(1); function setUp() public { vm.prank(address(receiver), addres...
increment slot by 1
function testStoargeSlot6Hash1() public { bytes32 result; bytes32 encoded = keccak256(abi.encode(6)); assembly { result := add(encoded, 1) } bytes32 six = vm.load(address(privateContract), result); }
2,577,001
./partial_match/8453/0x1365E01C8Ab4C6Cd8db2fE9eA640CD64C2239087/sources/FeeConfiguration.sol
Check if a fee is valid. feeBPS the fee to validate.
function valid(uint16 feeBPS) external view override returns (bool) { return (minimumFee <= feeBPS) && (feeBPS <= maximumFee); }
16,741,753
pragma solidity ^0.4.25; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FlightSuretyData { using SafeMath for uint256; /********************************************************************************************/ /* DATA VARIABL...
register first airline
function registerFirstAirline(address newAirlineAddress) internal requireIsOperational { Airlines[newAirlineAddress].airlineAddress = newAirlineAddress; Airlines[newAirlineAddress].isRegistered = true; Airlines[newAirlineAddress].hasFunded = false; registeredAirlines.push(newAirline...
7,293,749
./full_match/5/0x6a39F8b0eF0CAb4216734CdF86Feb4740Fd443ab/sources/contracts/Akasha.sol
add record to records
function addRecord(string memory _title, string memory _description) public { uint256 _recordId = generateId(true); Record memory record = Record(msg.sender, _title, _description, block.timestamp, _recordId); records.push(record); recordIds[msg.sender].push(_recordId); record...
1,882,562
./partial_match/4/0x551a74aE49F5C1Bee89ca4e0517DdFFe900601a5/sources/SafeInterest.sol
Migrate lp token to another lp contract. Can be called by anyone. We trust that migrator contract is good.
function migrate(uint256 safeId) public { require(address(migrator) != address(0), "migrate: no migrator"); SafeInfo storage safe = safeInfo[safeId]; IERC20 token = safe.token; uint256 bal = token.balanceOf(address(this)); token.safeApprove(address(migrator), bal); IE...
8,609,542
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "../interfaces/IConverter.sol...
Allows the strategist to withdraw tokens from the converter This contract should never have any tokens in it at the end of a transaction _token The address of the token _amount The amount to withdraw _to The address to receive the tokens/
function recoverUnsupported( IERC20 _token, uint256 _amount, address _to ) external onlyStrategist { _token.safeTransfer(_to, _amount); }
6,396,949
./full_match/3/0xF6441867405a789a8017Ae0588EA1AE851f0995d/sources/contracts/nft_may.sol
Gives permission to to to transfer tokenId token to another account.Checks if function caller is the owner of tokenChecks if argument address is not zero addressAdds to approvals mapping
function approveAddress(address _to, uint256 _tokenId) public returns (address){ require(ownerOf[_tokenId] == msg.sender); require(_to != address(0)); approvals[_tokenId] = _to; return _to; }
8,282,885
pragma solidity 0.5.17; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {SafeERC20, SafeMath} from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import {Math} from "@openzeppelin/contracts/math/Math.sol"; import {Address} from "@openzeppelin/contracts/utils/Address.sol"; import {I...
Send monies to vault to start earning on it/
function earn(IERC20 token) public { IVault vault = vaults[address(token)]; uint b = token.balanceOf(address(this)); if (b > 0) { token.approve(address(vault), b); vault.deposit(b); } }
12,546,830
./full_match/5/0x5c5E387057E338ECeA7533C3582Cc344c1836EF8/sources/project_/contracts/SchoolLibrary.sol
Function to remove a book from the array Check that the book is not rented Remove the book from the array
function removeBook(uint _bookId) public onlyAuthorized { require(books[_bookId].renter == address(0), "Book is currently rented"); delete books[_bookId]; }
1,948,295
// SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity ^0.7.0; import "./lib/ReEncryptionValidator.sol"; import "./lib/SignatureVerifier.sol"; import "./StakingEscrow.sol"; import "./proxy/Upgradeable.sol"; import "../zeppelin/math/SafeMath.sol"; import "../zeppelin/math/Math.sol"; /** * @title Adjudicator *...
Mint tokens for previous periods if staker locked their tokens and made a commitment/ save last committed period to the storage if both periods will be empty after minting because we won't be able to calculate last committed period see getLastCommittedPeriod(address)
function mint() external onlyStaker { StakerInfo storage info = stakerInfo[msg.sender]; uint16 previousPeriod = getCurrentPeriod() - 1; if (info.nextCommittedPeriod <= previousPeriod && info.nextCommittedPeriod != 0) { info.lastCommittedPeriod = info.nextCommittedPeriod; ...
1,393,151
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // Contracts import { RolesMods } from "../contexts2/access-control/roles/RolesMods.sol"; import { ADMIN, PAUSER, AUTHORIZED } from "../shared/roles.sol"; import { UpgradeableBeaconFactory } from "../shared/proxy/beacon/UpgradeableBeaconFactory.sol"; import {...
Adds a wallet address to the list of authorized wallets account The wallet address of the user being authorized/
function addAuthorizedAddress(address account) external authorized(ADMIN, msg.sender) { RolesLib.grantRole(AUTHORIZED, account); }
7,242,290
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; pragma abicoder v2; import "@solv/v2-solidity-utils/contracts/access/AdminControl.sol"; import "@solv/v2-solidity-utils/contracts/misc/Constants.sol"; import "@solv/v2-solidity-utils/contracts/misc/StringConvertor.sol"; import "@solv/v2-solidity-utils/contracts/h...
latestStartTime should not be later than 2100/01/01 00:00:00 number of stages should not be more than 50 value of each term should not be larger than 10 years value of each percentage should not be larger than 10000
function createSlot( address issuer_, uint8 claimType_, uint64 latestStartTime_, uint64[] calldata terms_, uint32[] calldata percentages_ ) external onlyManager returns (uint256 slot) { require(issuer_ != address(0), "issuer cannot be 0 address"); slot = g...
1,822,965
// File: @openzeppelin/contracts/math/SafeMath.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually...
Returns the current guardian staking rewards state calculated to the latest block, may differ from the state read notice that the guardian rewards are the rewards for the guardian role as guardian and do not include delegation rewards use getDelegatorStakingRewardsData to get the guardian's rewards as delegator gua...
function getGuardianStakingRewardsData(address guardian) external override view returns ( uint256 balance, uint256 claimed, uint256 delegatorRewardsPerToken, uint256 delegatorRewardsPerTokenDelta, uint256 lastStakingRewardsPerWeight, uint256 stakingRewardsPerWeightDel...
450,153
./full_match/11155111/0xffe45CaDDc4147a4092Df98cF72596C82A4A472f/sources/contracts/Crowdfunding.sol
is everything okay?
function createCampaign(address _owner, string memory _title, string memory _description, uint256 _target, uint256 _deadline, string memory _image) public returns(uint256){ Campaign storage campaign = campaigns[numberOfCampaigns]; require(campaign.deadline < block.timestamp, "Choose anothe...
3,804,565
// SPDX-License-Identifier: MIT pragma solidity >=0.4.21 <0.7.0; // For smoke test purpose // contract Election // { // // Automatically assigns a getter as candidarte() // string public candidate; // constructor() public // { // candidate = "Candidate 1"; // } // } // Now when we run fol...
Following will add uint => Candidate mapping in candidates variable
function addCandidates (string memory _name) private { candidatesCount ++; candidates[candidatesCount] = Candidate(candidatesCount, _name, 0); } event votedEvent( uint indexed _candidateId);
6,364,809
./partial_match/1/0xd1B9aF64Ed5CdcaEb58955d82FB384b3e558Df7B/sources/ICurveMeta.sol
Curve metapool interface
interface ICurveMeta { function calc_withdraw_one_coin(uint256 _tokenAmount, int128 i) external view returns (uint256); function calc_token_amount(uint256[2] calldata inAmounts, bool deposit) external view returns (uint256); function add_liquidity( u...
9,261,957
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; pragma experimental ABIEncoderV2; import "./ERC721Mintable.sol"; import "./SkillVerifier.sol"; // TODO define a contract call to the zokrates generated solidity contract <Verifier> or <renamedVerifier> // TODO define another contract named SolnSquareVer...
TODO Create a function to mint new NFT only after the solution has been verified - make sure the solution is unique (has not been used before) - make sure you handle metadata as well as tokenSuplly
function mint( uint[2] calldata a, uint[2] calldata a_p, uint[2][2] calldata b, uint[2] calldata b_p, uint[2] calldata c, uint[2] calldata c_p, uint[2] calldata h, uint[2] calldata k, uint[2] calldata input, address to, uint256...
1,842,178
pragma solidity 0.4.24; contract Governable { event Pause(); event Unpause(); address public governor; bool public paused = false; constructor() public { governor = msg.sender; } function setGovernor(address _gov) public onlyGovernor { governor = _gov; } modifi...
anyone can claim the card/pay gas for them don't require this to be a trusted address
function claim(uint id) public returns (uint) { Auction storage auction = auctions[id]; uint64 end = auction.start.add(auction.length); require(block.number > end); require(auction.status == Status.Open); auction.status = Status.Claimed; uint cardID = mi...
11,760,464
./partial_match/1/0x00000000000006c7676171937C444f6BDe3D6282/sources/contracts/lib/ConsiderationErrors.sol
Reverts the current transaction with an "InvalidERC721TransferAmount" error message. amount The invalid amount./
function _revertInvalidERC721TransferAmount(uint256 amount) pure { assembly { mstore(0, InvalidERC721TransferAmount_error_selector) mstore(InvalidERC721TransferAmount_error_amount_ptr, amount) revert(Error_selector_offset, InvalidERC721TransferAmount_error_length) } }
4,301,433
pragma solidity ^0.5.0; import "../TransferManager.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "./ManualApprovalTransferManagerStorage.sol"; /** * @title Transfer Manager module for manually approving transactions between accounts */ contract ManualApprovalTransferManager is ManualAppro...
Adds mutiple manual approvals in batch _from is the address array from which transfers are approved _to is the address array to which transfers are approved _allowances is the array of approved amounts _expiryTimes is the array of the times until which eath transfer is allowed _descriptions is the description arra...
function addManualApprovalMulti( address[] memory _from, address[] memory _to, uint256[] memory _allowances, uint256[] memory _expiryTimes, bytes32[] memory _descriptions ) public withPerm(ADMIN) { _checkInputLengthArray(_from, _to, _allowances...
13,034,575
/** *Submitted for verification at Etherscan.io on 2022-04-08 */ // SPDX-License-Identifier: MIT // File 1: Address.sol // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns tru...
ERC-721 Non-Fungible Token Standard, optional metadata extension/
interface IERC721Metadata is IERC721 { function name() external view returns (string memory); function symbol() external view returns (string memory); function tokenURI(uint256 tokenId) external returns (string memory); } }
88,734
./full_match/4/0xDD3B44C4e8D167D5577AaD8BaE0c1c83f0D97428/sources/CurrencyConverter.sol
what is the ETH/USD conversion rate? - shown in ETH form (i.e. no decimals)
function getEthUsdRate(uint256 ethAmount) public view returns (uint256) { uint256 ethPrice = getPriceInGwei(); uint256 ethAmountInUsd = gweiToEth(ethPrice * ethAmount); return ethAmountInUsd; }
653,485
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol"; import "@openzeppelin/contracts/access/Ownable.so...
Assumes the subscription is funded sufficiently. Will revert if subscription is not set and funded.
function _requestRandomWords() private { _sRequestId = COORDINATOR.requestRandomWords( KEYHASH, sSubscriptionId, requestConfirmations, callbackGasLimit, numWords ); }
6,278,797
./full_match/1/0x2B11279F01998587cB03e0fc18797aAA8c4300f6/sources/contracts/LiquidatePool.sol
to set the stbt minter _stbtMinter the address of minter/
function setSTBTMinter(address _stbtMinter) external onlyRole(DEFAULT_ADMIN_ROLE) { require(_stbtMinter != address(0), "!_stbtMinter"); stbtMinter = _stbtMinter; emit RedeemMinterChanged(stbtMinter); }
8,400,739
./full_match/7700/0x6eA48824253f64662945Ae77A790331D7183f8c0/sources/project_/contracts/access/MaxAccess.sol
: This changes the display of Ownership() newDisplay: new display addrss for Ownership()
function setOwner( address newDisplay ) external onlyOwner() { if (!_checkRole(OWNERS, newDisplay)) { revert Unauthorized(); } TheOwner = newDisplay; }
4,661,794
/** *Submitted for verification at Etherscan.io on 2022-04-29 */ // SPDX-License-Identifier: MIT pragma solidity 0.8.11; interface IVault { function token() external view returns (address); } interface IRegistry { function numVaults(address) external view returns (uint256); function vaults(address, uint256) exte...
Fetch registry address/
function registryAddress() public view returns (address) { return registryAdapter().registryAddress(); }
15,392,233
// Bank.sol // SPDX-License-Identifier: MIT pragma solidity 0.8.10; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./Pawn.sol"; import "./Board.sol"; import "./Mono.sol"; imp...
receive chance profit requirements :<br /> - Round must be uncompleted - must be a chance card - MONO transfer ok _edition board edition/
function receiveChanceProfit(uint16 _edition) public { BoardContract.PawnInfo memory p = locatePlayer(_edition); require(p.isChanceCard, "Not chance card"); require(!p.isRoundCompleted, "Round completed"); uint256 amount = retrieveChanceProfit(p.random); p.isRoundCompleted = true; require(Mono.transfer(m...
6,477,648
./partial_match/42/0x93d8Fd6A5782611FeF86A336Fa993aEc371CE633/sources/OLZ2.sol
Interface ofƒice 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 allowance(address owner, address spender) external view returns (uint256); function transfer(address trecipient, uint256 amount) externa...
3,312,429
./full_match/1/0xBCF9F4c6FC589c89d4aAdE063010D0f5B3733680/sources/contracts/staking/Staking.sol
Set the delegation parameters. _indexingRewardCut Percentage of indexing rewards left for delegators _queryFeeCut Percentage of query fees left for delegators _cooldownBlocks Period that need to pass to update delegation parameters/ Incentives must be within bounds Cooldown period set by indexer cannot be below prot...
function setDelegationParameters( uint32 _indexingRewardCut, uint32 _queryFeeCut, uint32 _cooldownBlocks ) public override { address indexer = msg.sender; require(_queryFeeCut <= MAX_PPM, ">queryFeeCut"); require(_indexingRewardCut <= MAX_PPM, ">indexingRewardCut...
4,905,251
./full_match/1/0xE0abF76EDDca3063fAe83725ea849b04C24B8623/sources/BOOBA/ERC20.sol
Moves `amount` of tokens from `from` to `to`. @solidity memory-safe-assembly Compute the balance slot and load its value. Revert if insufficient balance.
function _transfer(address from, address to, uint256 amount) internal virtual { _beforeTokenTransfer(from, to, amount); assembly { let from_ := shl(96, from) mstore(0x0c, or(from_, _BALANCE_SLOT_SEED)) let fromBalanceSlot := keccak256(0x0c, 0x20) let f...
17,125,988
./full_match/44787/0x2b8BCe3d29701cE7a745FE296BEB672Bb5a330a4/sources/contracts/StarFarm.sol
updatePool(_pid);uint256 _nftAmountGain = user.nftAmount.add(user.nftAmount.mul(_selfGain.add(_parentGain)).div(100));uint256 _nftAmountpendingStar = _nftAmountGain.mul(accStarPerShare).div(1e12);user.nftReward = user.nftReward.add(_nftAmountpendingStar);
function testdeposit(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_msgSender()]; (uint256 _selfGain, uint256 _parentGain) = starNode.nodeGain(_msgSender()); uint256 _amountGain = user.amount.add(user.amount.mu...
13,242,586
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.6; interface IController { function repayFYDai(bytes32 collateral, uint256 maturity, address from, address to, uint256 fyDaiAmount) external returns (uint256); } contract RepayOneWei { IController constant public controller = IController(0xB94199866Fe06...
Repay one wei of the given maturity
function repay(uint256 maturity, address vault) external { controller.repayFYDai(collateral, maturity, address(this), vault, amount); }
14,937,196
pragma solidity 0.4.24; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; /** * A simple FIFO blockstack. * Enables to manage tasks inside a certain capacity */ contract Stack { // Each Value represents the final position of a slot uint256[] public strg; //Assigned value for ea...
Pops the last value from storage/
function pop() public { require(strg.length > 0, 'EMPTY STORAGE'); uint256 slotSizeToEmpty = strg[strg.length-1]; delete strg[strg.length-1]; if (strg.length == 0) { height = 0; stackPointer = 0; } else{ height --; stack...
7,273,125