file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./full_match/80001/0x12e49Ba4c1015Fb655d88ECb965dbf22F1ae34C2/sources/contracts/GameMarkeplace.sol
Get a pool by ID. _categoryId The ID of the category/
function getPool(uint256 _categoryId) public view returns (uint256 id, uint256 categoryId, bool isActive, Item[] memory availableItems, Item[] memory rentedItems) { Pool storage pool = pools[_categoryId]; return (pool.id, pool.categoryId, pool.isActive, pool.availableItems, pool.rentedItems); } ...
5,687,228
pragma solidity 0.4.24; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; /** * @title BetCycleBasic * @dev Basic bet cycle contract. */ contract BetCycleBasic is Ownable { using SafeMath for uint256; /** * @dev Event triggered on s...
Ends bet cycle by sending the balance of the contract to the destination address. destination Destination address. return Whether the balance could be sent or not./
function endBetCycle(address destination) public onlyOwner hasOutcome hasEnded returns (bool) { require( destination != address(0x0), "Destination address cannot be zero address" ); destination.transfer(address(this).balance); return true; }
14,083,259
./full_match/80001/0xd0f330338c533a0394d1533E47a8a4425E0Fd076/sources/contracts/Staking.sol
Header: Calculate staking tokens given for derivative tokens [var] _amount: Amount of derivative tokens [return] outputTokens: Amount of equivalent staking tokens note: Used by _unstake and getUnstakeQuote/
function _GetUnstakeQuote(uint _amount) internal view returns(uint outputTokens){ require(_amount > 0, "Amount must be greater than zero"); require(totalPool > 0, "totalPool is zero"); require(derivativeTokenGiven > 0, "Given derivativeToken is zero"); uint owedRewards = tot...
9,496,563
./full_match/1/0x66938285B15da67A93D80D08f8f2DA665449F08d/sources/contracts/AXLPresale.sol
On presale failure Percentile withdrawls allows fee on transfer or rebasing tokens to still work Refund return;
function userWithdrawBaseTokens () public nonReentrant { BuyerInfo storage buyer = buyers[msg.sender]; uint256 remainingBaseBalance = address(this).balance; require(remainingBaseBalance >= buyer.base, "Nothing to withdraw."); status.base_withdraw = status....
4,929,527
pragma solidity >=0.8.0 <0.9.0; //SPDX-License-Identifier: MIT import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; contract Project is Ownable { using SafeMath for uint256; enum State{ Ongoing, Expired, Completed } // State Variables uin...
Maybe the balance exceeded the goal, so we need to update the goal. emit CreatorPaid(creator, balance);
function payCreator() internal inState(State.Completed) returns(bool) { address payable creator = payable(owner()); uint balance = address(this).balance; goal = balance; if (creator.send(balance)){ return true; } return false; }
6,490,426
// SPDX-License-Identifier: UNLICENSED // Copyright (c) 2020 Gemini Trust Company LLC. All Rights Reserved pragma solidity ^0.7.0; import "./ERC20Impl.sol"; import "./LockRequestable.sol"; /** @title A contact to govern hybrid control over increases to the token supply. * * @notice A contract that acts as a cus...
METHODS (ERC20 sub interface impl.) Core logic of the ERC20 `totalSupply` function.
function totalSupply() external view returns (uint256) { return erc20Store.totalSupply(); }
11,984,111
// 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...
Set the maximum Proof Of Loyalty amount allowed for deposit _maxProof amount for new maximum loyalty reward deposit _maxProof value is multiplied internally by 10e7. Do not multiply before calling! Smallest maximum value is 1000 + _minProof amount. (Ex: If _minProof == 1000 then smallest _maxProof possible is 2000)/...
function setMaxProof(uint256 _maxProof) public onlyOwner whenNotPaused nonReentrant { require(_maxProof >= 2000, 'Invalid amount'); maxAllowed = _maxProof.mul(10e7); }
6,070,153
pragma solidity ^0.4.0; import "./Bits.sol"; import "./ByteUtils.sol"; import "./ECRecovery.sol"; import "./Eip712StructHash.sol"; import "./Math.sol"; import "./Merkle.sol"; import "./PlasmaCore.sol"; import "./PriorityQueue.sol"; import "./PriorityQueueFactory.sol"; import "./RLP.sol"; import "./ERC20.sol"; /** ...
Removes an input from list of exitable outputs in an in-flight transaction. _inFlightTx RLP encoded in-flight transaction being exited. _inFlightTxInputIndex Input that's been spent. _spendingTx RLP encoded transaction that spends the input. _spendingTxInputIndex Which input to the spending transaction spends the i...
function challengeInFlightExitInputSpent( bytes _inFlightTx, uint8 _inFlightTxInputIndex, bytes _spendingTx, uint8 _spendingTxInputIndex, bytes _spendingTxSig ) public { InFlightExit storage inFlightExit = _getInFlightExit(_inFlightTx); requir...
6,432,305
pragma solidity ^0.4.24; // File: contracts/PeriodUtil.sol /** * @title PeriodUtil * * Interface used for Period calculation to allow better automated testing of Fees Contract * * (c) Philip Louw / Zero Carbon Project 2018. The MIT Licence. */ contract PeriodUtil { /** * @dev calculates the Period inde...
Returns the amount of weeks since EPOCH return Week count since EPOCH/
function getWeekIdx() public view returns (uint256) { return periodUtil.getPeriodIdx(now); }
127,776
pragma solidity ^0.4.21; import "openzeppelin-solidity/contracts/ownership/Claimable.sol"; import "../TimeLockedController.sol"; /* Allows for admins to quickly respond to fradulent mints After deploying FastPauseMints and configuring it with TimeLockedController Can pause trueUSD by simply sending any amount of eth...
fallback function used to pause mints when it recieves eth
function() public payable onlyPauseKey { emit Pauser(msg.sender); msg.sender.transfer(msg.value); controllerContract.pauseMints(); }
7,307,607
./full_match/1/0x92344754a9060a52A634B3c6b8118f76baD1A448/sources/contracts/staking/AaveCall.sol
Get repay calldata from ETF Repays a borrowed `_amountNotional` on a specific `_asset` reserve, burning the equivalent debt tokens owned - E.g. User repays 100 USDC, burning 100 variable/stable debt tokens of the `onBehalfOf` address _lendingPool Address of the LendingPool contract _asset The ...
function getRepayCalldata( ILendingPool _lendingPool, address _asset, uint256 _amountNotional, uint256 _interestRateMode, address _onBehalfOf ) internal pure returns (address, uint256, bytes memory) { bytes memory callData = abi.encodeWithSignature( 'repay(address,uint256,uint256,addre...
2,998,043
./full_match/1/0x668434279A7380E4Da683897BB02D8a77B6caE0A/sources/Users/shengdading/git/acSaving/contracts/strategies/StrategyBase.sol
Used to salvage any ETH deposited into the vault by mistake. Only governance or strategist can salvage ETH from the vault. The salvaged ETH is transferred to treasury for futher operation./
function salvage() public onlyStrategist { uint256 amount = address(this).balance; address payable target = payable(IController(controller()).treasury()); require(success, 'ETH salvage failed'); }
8,386,699
// File: @chainlink/contracts/src/v0.8/interfaces/LinkTokenInterface.sol pragma solidity ^0.8.0; interface LinkTokenInterface { function allowance( address owner, address spender ) external view returns ( uint256 remaining ); function approve( address spender, uint256 val...
Generate the random numbers
function bulkGenerateRandomNumbers(uint256[] memory ids) public onlyOperators() { require( LINK.balanceOf(address(this)) >= fee * ids.length, "Not enough LINK" ); for (uint256 i = 0; i < ids.length; i++) { require(ids[i] != 0, "ID cann...
6,338,763
/* Copyright (c) 2018, ZSC Dev Team */ pragma solidity ^0.4.21; import "./sys_gm_base.sol"; /** @title String manager. */ contract SysGmString is SysGmBase { // parameter mapping string struct ParameterValues { uint count_; // index => parameter mapping(uint => bytes32) parameters_;...
Set string. _dbName(bytes32): Name of the database. _userName(bytes32): Name of the user. _enName(bytes32): Name of the entity. _parameter(bytes32): Name of parameter. _value(string): Value of string. return (bool): The result(true/false)./ check holder check register
function setEntityParameterValue( bytes32 _dbName, bytes32 _userName, bytes32 _enName, bytes32 _parameter, string _value) external returns (bool) { _checkHolder(_dbName, _userName, msg.sender); if(false == entitys_[_dbName][_userName][_enName].registers_[_parameter]) { r...
2,486,669
/* ____ __ __ __ _ / __/__ __ ___ / /_ / / ___ / /_ (_)__ __ _\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ / /___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\ /___/ * Synthetix: RewardEscrowV2.sol * * Latest source (may be newer): https://github.com/Synthetixio/synthetix/blob/master/contr...
Internal function to add entry to vestingSchedules and emit event /
function _importVestingEntry(address account, VestingEntries.VestingEntry memory entry) internal { uint entryID = BaseRewardEscrowV2._addVestingEntry(account, entry); emit ImportedVestingEntry(account, entryID, entry.escrowAmount, entry.endTime);
1,819,927
pragma solidity ^0.4.24; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns(uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns(uint256) { // assert(b > 0); // Solidity automatically t...
BTC Owner withdraw money and adds secret key to swap BTC Owner receive +1 reputation
function withdraw(bytes32 _secret, address _ownerAddress) public { Swap memory swap = swaps[_ownerAddress][msg.sender]; require(swap.secretHash == ripemd160(_secret)); require(swap.balance > uint256(0)); require(swap.createdAt.add(SafeTime) > now); swap.targetWallet.transfer(swap.balance); ...
5,509,609
/** *Submitted for verification at Etherscan.io on 2021-11-01 */ // SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. ...
set staking details for tranche B holders, with number, amount and time _trancheNum tranche number _account user's account _stkNum staking detail counter _amount amount of tranche B tokens _time time to be considered the deposit/
function setTrBStakingDetails(uint256 _trancheNum, address _account, uint256 _stkNum, uint256 _amount, uint256 _time) external onlyAdmins { stakeCounterTrB[_account][_trancheNum] = _stkNum; StakingDetails storage details = stakingDetailsTrancheB[_account][_trancheNum][_stkNum]; details.start...
15,089,863
./full_match/42161/0x556D199e955836248098E1c7A5e9a0Fee14a23E6/sources/_layerzerolabs/solidity-examples/contracts/token/onft/IONFT721Core.sol
Interface of the ONFT Core standard/
interface IONFT721Core is IERC165 { event SendToChain(uint16 indexed _dstChainId, address indexed _from, bytes indexed _toAddress, uint[] _tokenIds); event ReceiveFromChain(uint16 indexed _srcChainId, bytes indexed _srcAddress, address indexed _toAddress, uint[] _tokenIds); event CreditStored(bytes32 _hash...
16,299,008
pragma solidity ^0.4.13; library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal constant returns (uint256) { // assert(b > 0); // Solidity autom...
Mint unsold tokens to sale's address & burn them immediately
function finalization() internal { if (goalReached()) { bool capReached = tokenSold >= cap; if (!capReached) { uint256 tokenUnsold = cap.sub(tokenSold); require(token.mint(this, tokenUnsold)); StampifyToken(token).burn(tokenUnsold); ...
12,942,207
./full_match/1/0x7109DeEb07aa9Eed1e2613F88b2f3E1e6C05163f/sources/contracts/feeDistributor/OracleFeeDistributor.sol
Recover ether in a rare case when either service, or client, or referrer refuse to accept ether. _to receiver address _proof Merkle proof (the leaf's sibling, and each non-leaf hash that could not otherwise be calculated without additional leaf nodes) _amountInGwei total CL rewards earned by all validators in GWei (...
function recoverEther( address payable _to, bytes32[] calldata _proof, uint256 _amountInGwei ) external onlyOwner { if (_to == address(0)) { revert FeeDistributor__ZeroAddressEthReceiver(); } this.withdraw(_proof, _amountInGwei); bool su...
3,156,411
./partial_match/1/0x59a3fa712bc01F3Af4E791BFF6A408dea2BbF39f/sources/Users/chichke/Documents/Work/Freelance/RealT/bridge-v2-chichke/contracts/interfaces/IComplianceRegistry.sol
IComplianceRegistry IComplianceRegistry interface/
interface IComplianceRegistry { event AddressAttached(address indexed trustedIntermediary, uint256 indexed userId, address indexed address_); event AddressDetached(address indexed trustedIntermediary, uint256 indexed userId, address indexed address_); function userId(address[] calldata _trustedIntermediaries, a...
2,717,936
pragma solidity >=0.6.12; import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/Saf...
withdrawals[msg.sender] = withdrawals[msg.sender].add(revenue);
function _withdraw(uint256 amountLiquidity, address to) internal virtual { _beforeWithdraw(amountLiquidity, msg.sender, to); uint256 revenue = totalSupply() != 0 ? amountLiquidity.mul(totalCap).div(totalSupply()) : amountLiquidity; require(revenue <= basicToken.balanceOf(address(this)), "Not...
5,366,853
./full_match/43113/0x987dcB6fA8Dfb4aC8a6b9a93bEa121c50684b377/sources/MasterChefRef.sol
Update the swap router. Can only be called by the current operator./
function updateswapRouter() public onlyOperator { swapRouter = IPangolinRouter(0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106); swapPair = IPangolinFactory(swapRouter.factory()).getPair(address(this), swapRouter.WAVAX()); require(swapPair != address(0), "updateswapRouter: Invalid pair address.")...
7,116,712
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.4; import "hardhat/console.sol"; contract TheCryptoPurgePortal { uint256 totalLikes; /** * Emit new messages to the portal. */ event NewMessage(address indexed from, uint256 timestamp, string message); /* * A struct is basically...
msg.sender is the address of the account that called the function
function like() public { totalLikes += 1; console.log("%s has given a like!", msg.sender); }
13,070,843
./partial_match/1/0x842738637f84b4Dac335b832d9890cf8e11DA214/sources/StakingDFL.sol
Similar to EIP20 transfer, except it handles a False success from `transfer` and returns an explanatory error code rather than reverting. If caller has not called checked protocol's balance, this may revert due to insufficient cash held in this contract. If caller has checked protocol's balance prior to this ...
function doTransferOut(address underlying, address to, uint amount) internal { EIP20NonStandardInterface token = EIP20NonStandardInterface(underlying); token.transfer(to, amount); bool success; uint balanceAfter = EIP20Interface(underlying).balanceOf(address(this)); assembly...
2,804,318
./partial_match/82/0x267E10BB464d3937613F60655163D11392829E03/sources/Users/huanglu/workspace/ETHEREUM/venus/chee-protocol/contracts/Governance/CHEE.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, uint blockNumber) public view returns (uint96) { require(blockNumber < block.number, "CHEE::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return 0; } if (check...
16,900,634
/* Copyright 2018 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...
Validate any auction parameters that have library-specific restrictions _auctionPriceParameters Struct containing relevant auction price parameters/ Require pivot price to be greater than 0.5 price denominator Equivalent to oldSet/newSet = 0.5 Require pivot price to be less than 5 price denominator Equivalent to o...
function validateAuctionPriceParameters( RebalancingLibrary.AuctionPriceParameters memory _auctionPriceParameters ) public view { require( _auctionPriceParameters.auctionPivotPrice > priceDivisor.div(MIN_PIVOT_PRICE_DIVISOR), "LinearAuctionPriceCurve.v...
6,349,313
./full_match/42161/0xB35832761433BaD6C66cC56af8AE9362c07BE21b/sources/contracts/Collateral.sol
If hook not set, fees remain within the contract as extra reserves (withdrawable by manager). Converts amount after fee from base token units to collateral token units./
function deposit(address recipient, uint256 baseTokenAmount) external override nonReentrant returns (uint256 collateralMintAmount) { uint256 fee = (baseTokenAmount * _depositFee) / PERCENT_DENOMINATOR; if (_depositFee > 0) { require(fee > 0, "fee = 0"); require(baseTokenAmount > ...
16,298,370
pragma solidity >=0.8.4; import "./ENS.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "../root/Controllable.sol"; // function _claimWithResolver // 1. reverse node가 records_list 어딘가에 있다. // 1)해당 record의 resolver값이 있는 경우 // currentResolver가 해당 resolver를 받아옴. // 지금 인자로 받아온 re...
Transfers ownership of the reverse ENS record associated with the calling account. owner The address to set as the owner of the reverse record in ENS. resolver The address of the resolver to set; 0 to leave unchanged. return The ENS node hash of the reverse record./
function claimWithResolver(address owner, address resolver) public returns (bytes32) { return _claimWithResolver(msg.sender, owner, resolver); }
1,031,081
pragma solidity ^0.5.7; contract SafeTransfer { function _SAFETRANSFER911(ERC20Token _token, address _to, uint256 _value) internal returns (bool result) { //inject NONSTANDARD NAMING _token.TRANSFER494(_to, _value); assembly { ...
inject NONSTANDARD NAMING
function TRANSFEROWNERSHIP770(address _newOwner) external ONLYOWNER677 {
12,593,798
pragma solidity 0.6.12; pragma experimental ABIEncoderV2; contract DSAuthEvents { event LogSetAuthority(address indexed authority); event LogSetOwner(address indexed owner); } contract DSAuth is DSAuthEvents { DSAuthority public authority; address public owner; constructor() public { ...
Format the call data for DSProxy Send Flash loan amount to DSProxy Execute the Close/Change debt operation Send extra to DSProxy
function executeOperation( address _reserve, uint256 _amount, uint256 _fee, bytes calldata _params) external override { (ParamData memory paramData, ExchangeData memory exchangeData) = packFunctionCall(_amount, _fee, _params); ...
7,334,329
// SPDX-License-Identifier: MIT pragma solidity 0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "../metatx/ERC2771Context.sol"; import "../interfaces/ITokenManager.sol"; contract TokenManager is ITokenManager, ERC2771Context, Ownable, Pausabl...
Set DepositConfig for the given combination of toChainId, tokenAddress. This is used while depositing token in Liquidity Pool. Based on the destination chainid min and max deposit amount is checked./
function setDepositConfig( uint256[] memory toChainId, address[] memory tokenAddresses, TokenConfig[] memory tokenConfig ) external onlyOwner { require( (toChainId.length == tokenAddresses.length) && (tokenAddresses.length == tokenConfig.length), " ERR_ARR...
965,293
pragma solidity ^0.4.24; import "zos-lib/contracts/Initializable.sol"; import "openzeppelin-eth/contracts/math/SafeMath.sol"; import "openzeppelin-eth/contracts/token/ERC20/ERC20.sol"; import "openzeppelin-eth/contracts/token/ERC20/SafeERC20.sol"; /** * @title Vouching * @dev Contract for staking tokens to back ent...
Initializer function. Called only once when a proxy for the contract is created. _minimumStake uint256 that defines the minimum initial amount of vouched tokens a dependency can have when being created. _token ERC20 token to be used for vouching on dependencies./
function initialize(ERC20 _token, uint256 _minimumStake, uint256 _appealFee, address _appealsResolver) initializer public { require(_token != address(0), "The token address cannot be zero"); require(_appealsResolver != address(0), "The appeals resolver address cannot be zero"); token_ = _token; appea...
12,554,535
./full_match/80001/0x93606Db8e1340eBa115633Cc8a031D379D7638C6/sources/contracts/dev/vendor/openzeppelin-solidity/v.4.8.0/contracts/utils/SafeCast.sol
Returns the downcasted int144 from int256, reverting on overflow (when the input is less than smallest int144 or greater than largest int144). Counterpart to Solidity's `int144` operator. Requirements: - input must fit into 144 bits _Available since v4.7._/
function toInt144(int256 value) internal pure returns (int144 downcasted) { downcasted = int144(value); require(downcasted == value, "SafeCast: value doesn't fit in 144 bits"); }
5,640,084
pragma solidity 0.5.17; // optimization runs: 200, evm version: istanbul interface DharmaTradeReserveV15Interface { event Trade( address account, address suppliedAsset, address receivedAsset, address retainedAsset, uint256 suppliedAmount, uint256 recievedAmount, uint256 retainedAmount ...
Transfer in sufficient dDai and use it to mint Dai. Trade minted Dai for Ether.
function tradeDDaiForEther( uint256 daiEquivalentAmount, uint256 quotedEtherAmount, uint256 deadline ) external returns (uint256 totalDaiSold, uint256 totalDDaiRedeemed) { totalDDaiRedeemed = _transferAndRedeemDDai(daiEquivalentAmount); totalDaiSold = _tradeDaiForEther( daiEquivalentAmount, quote...
6,602,975
// SPDX-License-Identifier: UNLICENSED pragma solidity >=0.7.0 <0.9.0; import "./test.sol"; import "../contracts/Dao.sol"; import "../contracts/DaoContract.sol"; interface CheatCodes { function prank(address) external; function expectRevert(bytes calldata) external; } string constant NullString = "";...
Add gUsers[1] as an Officer Add gUsers[2] as an Admin Remove gUsers[2] as gUsers[1] who is an Officer
function testRemoveUserAdminAsOfficer() public { addAUserNoImpersonateNoRevert(gUsers[1], AccessType.Officer); addAUserNoImpersonateNoRevert(gUsers[2], AccessType.Admin); assertEq(dao.getUserCount(), 3); removeAUserWithImpersonateNoRevert(gUsers[2], gUsers[1]); assertEq(dao....
14,053,778
./full_match/1/0x992F6c414A6DA6A7470dfB9D61eFc6639e9fbb0E/sources/browser/MerkleThreeVerification.sol
internal helpers for convert address
function addressToString(address x) internal pure returns (string memory) { bytes memory b = new bytes(20); for (uint i = 0; i < 20; i++) b[i] = byte(uint8(uint(x) / (2**(8*(19 - i))))); return string(b); }
2,929,482
// SPDX-License-Identifier: MIT // Author: Pagzi Tech Inc | 2022 // Pagzi Pass - Exclusive | 2022 pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata....
external Verify allowlist requirements
function mint(bytes32[] calldata _merkleProof) external payable checkPrice checkDate { require(claimed[msg.sender] != true, "Address has no allowance!"); bytes32 leaf = keccak256(abi.encodePacked(msg.sender)); require(MerkleProof.verify(_merkleProof, merkleRoot, leaf), "Invalid merkle proof!...
1,302,094
/* solhint-disable func-order */ pragma solidity ^0.4.24; import "./BimodalLib.sol"; import "./MerkleVerifier.sol"; import "./SafeMath/SafeMathLib32.sol"; import "./SafeMath/SafeMathLib256.sol"; /** * This library contains the challenge-response implementations of NOCUST. */ library ChallengeLib { using SafeMath...
======================================================================== ======================================================================== ======================================================================== ==================================== WITHDRAWAL Challenge ==========================================...
function slashWithdrawalWithProofOfMinimumAvailableBalance( BimodalLib.Ledger storage ledger, ERC20 token, address withdrawer, uint256[2] markerEonAvailable, bytes32[2] rs, uint8 v ) public returns (uint256[2] amounts) { uint256 latestEon = ledger.currentEon(); require( ...
12,584,745
./partial_match/1/0x242b6973414Bc668C4537fBfd05986beAFdE6315/sources/ChainlinkOracle.sol
getRoundData and latestRoundData should both raise "No data present" if they do not have data to report, instead of returning unset values which could be misinterpreted as actual reported values.
interface AggregatorV3Interface { function decimals() external view returns (uint8); function description() external view returns (string memory); function version() external view returns (uint256); function getRoundData(uint80 _roundId) external view returns ( uin...
4,415,823
./full_match/1/0x7049386F00BB8e1f7c41c8B7124b9DaF539Abc59/sources/contracts/ERC721/FairFellaz.sol
Override primary sale receiver/
function changePrimarySaleReceiver( address newPrimarySaleReceiver ) external { if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) revert UnauthorisedUser(); if (newPrimarySaleReceiver == address(0)) revert ZeroAddress(); _primarySaleReceiver = newPrimarySaleReceiver; emit New...
3,013,191
//sol Wallet // Multi-sig, daily-limited account proxy/wallet. // @authors: // Gav Wood <g@ethdev.com> // inheritable "property" contract that enables methods to be protected by requiring the acquiescence of either a // single, or, crucially, each of a number of, designated owners. // usage: // use modifiers onlyown...
(re)sets the daily limit. needs many of the owners to confirm. doesn't alter the amount already spent today.
function resetSpentToday() external onlyowners(sha3(msg.sig)) { m_spentToday = 0; }
1,847,781
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.6.6; import "./BToken.sol"; import "./BMath.sol"; // Core contract; can't be changed. So disable solhint (reminder for v2) /* solhint-disable func-order */ /* solhint-disable event-name-camelcase */ contract BPool is BBronze, BToken, BMath { struct...
Burn an amount of new tokens, and subtract them from the balance (and total supply) Emit a transfer amount from this contract to the null address Can't burn more than we have Remove require for gas optimization - bsub will revert on underflow require(_balance[address(this)] >= amount, "ERR_INSUFFICIENT_BAL");
function _burn(uint256 amount) internal virtual { _balance[address(this)] = BalancerSafeMath.bsub(_balance[address(this)], amount); varTotalSupply = BalancerSafeMath.bsub(varTotalSupply, amount); emit Transfer(address(this), address(0), amount); }
303,197
./full_match/4/0x87f0D1e1AC129f5a2B8995d21E8B6ff3D42Fd896/sources/browser/BaoMasterFarmer_flat.sol
Update Reward Per Block
function rewardUpdate(uint256 _newReward) public onlyAuthorized { REWARD_PER_BLOCK = _newReward; }
746,850
pragma solidity ^0.4.16; interface tokenRecipient { function receiveApproval(address _from, uint32 _value, address _token, bytes _extraData) public; } contract owned { address public owner; function owned() { owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); ...
Prevent transfer to 0x0 address. Use burn() instead Check if the sender has enough Check for overflows Save this for an assertion in the future Subtract from the sender Add the same to the recipient Asserts are used to use static analysis to find bugs in your code. They should never fail
function _transfer(address _from, address _to, uint32 _value) internal { require(_to != 0x0); require(balanceOf[_from] >= _value); require(balanceOf[_to] + _value > balanceOf[_to]); uint previousBalances = balanceOf[_from] + balanceOf[_to]; balanceOf[_...
10,776,833
./partial_match/3/0x50fef2Bb63b907Fa3897B8F35bd0F318E65478FB/sources/NexaBook.sol
8X /set current level
function updateX8Referrer(address userAddress, address referrerAddress, uint8 level, uint noOfTokens) private { require(users[referrerAddress].activeX8Levels[level], "500. Referrer level is inactive"); if (users[referrerAddress].x8Matrix[level].firstLevelReferrals.length < 2) { ...
5,092,705
./partial_match/1/0x0c9796fD8B4645358ee23Fb7920F9d4e617a524d/sources/OneCoinToken.sol
Burn tokens from address token holder address amount uint256 amount of tokens to burn data bytes extra information provided by the token holder operatorData bytes extra information provided by the operator (if any)/ Update state variables
function _burn( address from, uint256 amount, bytes memory data, bytes memory operatorData ) internal virtual { require(from != address(0), "ERC777: burn from the zero address"); address operator = msg.sender; _beforeTokenTransfer(operator, f...
2,609,995
./partial_match/1/0x891696CCa87aa2f175124b412198c23D54680E31/sources/NFTWinner.sol
Gives permission to `to` to transfer `tokenId` token to another account. The approval is cleared when the token is transferred. Only a single account can be approved at a time, so approving the zero address clears previous approvals. Requirements: - The caller must own the token or be an approved operator. - `tokenId` ...
function approve(address to, uint256 tokenId) public virtual override { address owner = ownerOf(tokenId); if (_msgSenderERC721A() != owner) if (!isApprovedForAll(owner, _msgSenderERC721A())) { revert ApprovalCallerNotOwnerNorApproved(); } _tokenApprovals[tokenId].value = to; emit...
3,585,518
./partial_match/80001/0xEd494b640222d33F22a9156725d2a12a589fa3E0/sources/src/consensys_erc1400/ERC1400.sol
Get partitions index of a tokenholder. tokenHolder Address for which the partitions index are returned. return Array of partitions index of 'tokenHolder'./
function partitionsOf(address tokenHolder) external view override returns (bytes32[] memory) { return _partitionsOf[tokenHolder]; }
8,796,125
./full_match/41/0xED231ad1C1C88Db553Ac8d0C57028C01B792fEF7/sources/contracts/FarmBooster.sol
Anyone can call this function, if some users effective multiplier is not fair for other users, just call the 'refresh' function. _user user address. _pid pool id(MasterchefV2 pool). If return value not in range [BOOST_PRECISION, MAX_BOOST_PRECISION] the actual effective multiplier will be the closest to the side bou...
function getUserMultiplier(address _user, uint256 _pid) external view returns (uint256) { return _boostCalculate(_user, proxyContract[_user], _pid, avgLockDuration()); }
16,371,295
/// base.sol -- basic ERC20 implementation // Copyright (C) 2015, 2016, 2017 DappHub, LLC // 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 ...
Set correct amount of dai
function sell(uint _id, uint _input_token_amount, uint _tranche_size) external { }
1,816,004
./partial_match/1/0xae61DB510cC96D57805Bf3fe4fcCee9365D12fAa/sources/src/SubscriptionManager.sol
Grants the KEEPER_ROLE to the provided user. - Throws if the `msg.sender` is not `owner()` On completion: - `newKeeper` is assigned the `KEEPER_ROLE` newKeeper Address to assign the `KEEPER_ROLE`/
function grantKeeperRole(address newKeeper) external { grantRoles(newKeeper, KEEPER_ROLE); }
2,691,164
./partial_match/1/0xeA1F21c4f9BDA00BEDB5871E6C0de6746E1e2929/sources/ArkGamesToken.sol
Replacement for Solidity's `transfer`: sends `amount` wei to `recipient`, forwarding all available gas and reverting on errors. of certain opcodes, possibly making contracts go over the 2300 gas limit imposed by `transfer`, making them unable to receive funds via `transfer`. {sendValue} removes this limitation. IMPORTA...
function sendValue(address recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); require(success, "Address: unable to send value, recipient may have reverted"); }
4,207,126
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, ...
Set allowance for other address Allows `spender` to spend no more than `value` tokens in your behalf spender The address authorized to spend value the max amount they can spend/
function approve(address spender, uint256 value) public returns (bool success) { allowance[msg.sender][spender] = value; Approval(msg.sender, value, spender); return true; }
15,275,806
pragma solidity ^0.5.2; /** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { /...
Called by our MarketContract (owner) to create a long or short position token. These tokens are minted, and then transferred to our recipient who is the party who is minting these tokens. The collateral pool is the only caller (acts as the owner) because collateral must be deposited / locked prior to minting of new po...
function mintAndSendToken( uint256 qtyToMint, address recipient ) external onlyOwner { _mint(recipient, qtyToMint); }
1,045,026
./partial_match/1/0x475D148484CD934d0c74C6d00fd6e942d9165EC5/sources/XRAID.sol
Change the max buy amount _maxBuy The new max buy amount
function setMaxBuy(uint256 _maxBuy) external onlyOwner { emit MaxBuyChanged(maxBuy, _maxBuy); maxBuy = _maxBuy; }
2,592,257
./full_match/1/0x2Ee0d782DC691b4E3DbEb292fB0e83bc5155A6CD/sources/contracts/FantasyFootball.sol
view function returning a address's current team
function getActiveTeam(address _address) public view returns (uint256[] memory) { return teams[_address]; }
3,072,023
./full_match/1/0x991c79DB98dA75eAd9F47286b64f63b878C52354/sources/contracts/external/TransparentUpgradeableProxy.sol
Returns the current admin./
function _admin() internal view virtual returns (address) { return _getAdmin(); }
16,484,462
// File: ComptrollerStorage.sol pragma solidity ^0.5.16; contract UnitrollerAdminStorage { /** * @notice Administrator for this contract */ address public admin; /** * @notice Pending administrator for this contract */ address public pendingAdmin; /** * @notice Active brain...
Delegates execution to an implementation contract. It returns to the external caller whatever the implementation returns or forwards reverts./ delegate all other functions to current implementation
function () external payable { (bool success, ) = comptrollerImplementation.delegatecall(msg.data); assembly { let free_mem_ptr := mload(0x40) returndatacopy(free_mem_ptr, 0, returndatasize) switch success } }
6,071,405
pragma solidity ^0.5.16; import "./CErc20.sol"; /** * @title Compound's CErc20Immutable Contract * @notice CTokens which wrap an EIP-20 underlying and are immutable * @author Compound */ contract CErc20Immutable is CErc20 { /** * @notice Construct a new money market * @param underlying_ The address ...
Accrue interest then return the up-to-date exchange rate return Calculated exchange rate scaled by 1e18/
function exchangeRateCurrent() public nonReentrant returns (uint) { require(accrueInterest() == uint(Error.NO_ERROR), "accrue interest failed"); return exchangeRateStored(); }
17,587
./partial_match/97/0x9194EAfFDE96b9F6c6169146A177daDE231538a8/sources/ZombieMarket.sol
设置战将合约地址(合约拥有者可调) _dragonAddress:战将合约地址/
function setDragonAddress(ZombieDragon _dragonAddress) external onlyOwner{ dragonAddress = _dragonAddress; emit ChangeDragonAddress(_dragonAddress); }
11,348,957
pragma solidity ^0.4.13; // указываем версию компилятора // gr.vasilkov@gmail.com // Данный контракт создавался для демонстрации студентам BSU Blockchain and Smartcontracts Lab, // контракт содержит преднамеренные недостатки безопасности и его не желательно использовать // в production среде. // Описание GuestBook: /...
удаляем существующего пользователя из GuestBook. Только администратор может осуществить данное действие
function removeUser(address _badUser) onlyAdmin returns (bool success) { delete Users[_badUser]; return true; }
14,034,805
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "./Token.sol"; contract dBank { //assign Token contract to variable\ Token private token; //add mappings mapping(address => uint) public etherBalanceOf; mapping(address => uint) public depositStart; mapping(address => uint) public collateral...
check if loan is activetransfer tokens from user back to the contractcalc 10$ feesend user's collateral minus feereset borrower's dataemit event
function payOff() public { require(isBorrowed[msg.sender] == true, 'Error, loa not active'); uint fee = collateralEther[msg.sender]/10; payable(msg.sender).transfer(collateralEther[msg.sender]-fee); collateralEther[msg.sender] = 0; isBorrowed[msg.sender] = false; emit PayOff(msg.sender, fe...
5,385,050
./full_match/5/0x19A4010E859ca3d10F0d928C6665F9a9E3BE4B22/sources/contracts/collateral/Collateral.sol
Injects additional collateral into a product to resolve shortfall Shortfall is a measure of settled insolvency in the market This hook can be used by the product owner or an insurance fund to re-capitalize an insolvent market product Product to resolve shortfall for amount Amount of shortfall to resolve/
function resolveShortfall(IProduct product, UFixed18 amount) external isProduct(product) notPaused { _products[product].resolve(amount); token.pull(msg.sender, amount); emit ShortfallResolution(product, amount); }
1,912,782
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.4; pragma experimental ABIEncoderV2; import "../../libraries/SafeMathExt.sol"; import "../../interface/IOracle.sol"; // An oracle router calculates the asset price with a given path. // A path is [(oracle, isInverse)]. The OracleRouter never verifies whether th...
Dump the path with info/
function dumpPath() external view returns (RouteDump[] memory) { RouteDump[] memory ret = new RouteDump[](_path.length); for (uint256 i = 0; i < _path.length; i++) { ret[i].oracle = _path[i].oracle; ret[i].isInverse = _path[i].isInverse; ret[i].underlyingAsset = I...
12,599,369
pragma solidity ^0.5.0; 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) extern...
Profits from trade Cleanup dust (if any)
function closePosition(address _reserve, uint256 _amount) public nonReentrant { require(collateral.isReserve(_reserve) == true, "itrade: invalid reserve"); require(_amount <= ledger.getPosition(_reserve,msg.sender), "itrade: insufficient balance"); require(IERC20(_reserve).balanceOf(address(this)) =...
12,622,795
./partial_match/1/0x76E1DeB20301b710aC6252ce4f95F9Cc0ac17808/sources/TokenSpring.sol
Update lockedTokens amount before using it in computations after.updateAccounting();
function lockTokens(uint256 amount, uint256 durationSec) external onlyOwner { require(unlockSchedules.length < _maxUnlockSchedules, 'TokenSpring: reached maximum unlock schedules'); unlockTokens(); uint256 lockedTokens = totalLocked(); uint256 mintedLockedShares = (lock...
4,456,953
./full_match/42/0x68A37709Ed125aDB3Cf76223eb88d0769400dA45/sources/contracts/MainContract.sol
This function executes a drop. During the execution all joined users get their previously specificed number of NFTs randomly assigned. To make sure no NFT gets assigned to multiple users, it is removed from the list of available NFTs. loop trough the number of NFTs j reserved by user i
function drop(uint256 _dropHash) public { require( nftOwnerships[_dropHash][0].dropTime <= block.timestamp, "Droptime not yet reached!" ); for (uint256 i = 0; i < joinedUsers[_dropHash].length; i++) { shuffle(_dropHash); for ( u...
9,580,565
./full_match/1/0xeA944E90ea6faF29C136c43026fF8A9e0fBF68C9/sources/browser/oldtoken.sol
Sets an address frozen status for this token. addr The address for which to update frozen status freeze Frozen status of the address/
function setAddressFrozen(address addr, bool freeze) public onlyAgent { frozen[addr] = freeze; emit AddressFrozen(addr, freeze, msg.sender); }
4,977,758
pragma solidity ^0.4.4; contract Voting { mapping (bytes32 => uint8) public votesReceived; // 存储候选人名字的数组 bytes32[] public candidateList; function Voting(bytes32[] candidateNames) public { candidateList = candidateNames; } function totalVotesFor(bytes32 candidate) public constant ret...
require(validCandidate(candidate) == true);
function totalVotesFor(bytes32 candidate) public constant returns (uint8) { if (validCandidate(candidate) == true) { return votesReceived[candidate]; return 0; } }
989,144
./full_match/5/0xfAe93901d38CE9A2F6A14F21d731826F32dE30B9/sources/contracts/Controller.sol
Setter for DAO address _dao DAO address
function setDao(address _dao) external onlyDao { dao = _dao; }
1,903,031
./full_match/42161/0x4829022F8BAC287813d24e5d00C8B31Fa3b42c8b/sources/contracts/MonkeyBuilder.sol
Collects and distributes the primary sale value of tokens being claimed.
function _collectPriceOnClaim( address _primarySaleRecipient, uint256 _quantityToClaim, address _currency, uint256 _pricePerToken ) internal virtual { if (_pricePerToken == 0) { return; } uint256 totalPrice = _quantityToClaim * _pricePerToken;...
16,297,974
./full_match/1/0xa145eCA55AE0E39D7c228ed7A962424a97AC74cB/sources/browser/ExchangePortal.sol
Transfers tokens to this contract and approves them to another address _source Token to transfer and approve _sourceAmount The amount to transfer and approve (in _source token) _to Address to approve to/
function _transferFromSenderAndApproveTo(IERC20 _source, uint256 _sourceAmount, address _to) private { require(_source.transferFrom(msg.sender, address(this), _sourceAmount)); _source.approve(_to, _sourceAmount); }
3,183,959
// SPDX-License-Identifier: Apache-2.0 /* Copyright 2021 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by a...
Sells `sellAmount` of the given `inputToken` for ETH using the provided calls. inputToken The token to sell. calls The calls to use to sell the input tokens. sellAmount The amount of `inputToken` to sell. minBuyAmount The minimum amount of ETH that must be bought for this function to not revert. return ...
function multiplexBatchSellTokenForEth( IERC20TokenV06 inputToken, BatchSellSubcall[] memory calls, uint256 sellAmount, uint256 minBuyAmount ) public override returns (uint256 boughtAmount) { boughtAmount = _multiplexBatchSell( Batc...
6,350,106
/** *Submitted for verification at Etherscan.io on 2021-11-10 */ // Sources flattened with hardhat v2.6.4 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...
Allow us to whitelist in bulk
function addToWhitelistBulk(address[] memory addresses) external onlyOwner { for(uint i = 0; i < addresses.length; i++) { whitelist[addresses[i]] = true; } }
6,688,603
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IStakingRewardsVault.sol"; import "../commons/MetaTransactionsMixin.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; ...
Claim proceeds for transaction sender to `to`. _pid The index of the pool. See `poolInfo`./ Effects Rewards
function claim(uint256 _pid) public { address senderAddr = msgSender(); PoolInfo memory pool = updatePool(_pid); UserInfo storage user = userInfo[_pid][senderAddr]; int256 accumulatedTSX = int256(user.amount * pool.accTSXPerShare / ACC_TSX_PRECISION); uint256 pendin...
13,138,820
pragma solidity 0.7.5; pragma experimental ABIEncoderV2; // SPDX-License-Identifier: MIT // An instance can be found on mainnet here: 0xc4D6D61da34446Dc9Adc540Db748d3b9CAEaf140 /** Copyright (c) 2020 Austin Williams Permission is hereby granted, free of charge, to any person obtaining a copy of this software and ass...
Returns true iff the _buyer has approve this contract to move at least _totalUSDCRequiredFromSeller USDC.
function buyerHasApprovedUSDC(address _buyer, uint256 _totalUSDCRequiredFromSeller) public view returns (bool) { return ( USDC.allowance(_buyer, address(this)) >= _totalUSDCRequiredFromSeller ); }
12,794,242
pragma solidity ^0.4.24; // File: contracts/ERC20-token.sol /** * @title ERC20 interface * */ contract ERC20 { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); ...
Owner can transfer tokens that are sent here by mistake
function refundTokens(address _recipient, ERC20 _token) public onlyOwner { uint256 balance = _token.balanceOf(this); require(_token.transfer(_recipient, balance)); }
12,762,720
/** *Submitted for verification at Etherscan.io on 2019-03-11 */ pragma solidity ^0.5.1; contract tokenRecipientInterface { function receiveApproval(address _from, uint256 _value, address _token, bytes memory _extraData) public; } contract ERC20TokenInterface { function totalSupply() public view returns (uint25...
Owner can transfer tokens on others behalf withouth any allowance _from The account that will send tokens _to Account that will recive the tokens _value The amount that msg.sender is sending return if successful returns true/
function ownerTransferFrom(address _from, address _to, uint256 _value) onlyOwner public returns (bool success) { balances[_from] = safeSub(balanceOf(_from), _value); balances[_to] = safeAdd(balanceOf(_to), _value); emit Transfer(_from, _to, _value); return true; }
6,882,368
/** *Submitted for verification at Etherscan.io on 2022-04-19 */ /** *Submitted for verification at Etherscan.io on 2021-08-28 */ //SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.10; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Imple...
Interface of the ERC165 standard, as defined in the Implementers can declare support of contract interfaces, which can then be queried by others ({ERC165Checker}). For an implementation, see {ERC165}./
interface IERC165 { function supportsInterface(bytes4 interfaceId) external view returns (bool); pragma solidity 0.8.10; }
10,550,538
//Address: 0xdbabbcb1e314facb908c3e06b1f483124a627ce0 //Contract name: STANToken //Balance: 0 Ether //Verification Date: 8/25/2017 //Transacion Count: 1 // CODE STARTS HERE // Abstract contract for the full ERC 20 Token standard // https://github.com/ethereum/EIPs/issues/20 pragma solidity ^0.4.10; contract Token {...
decrease the token's supply
function decreaseSupply (uint256 _value) isOwner external { uint256 value = formatDecimals(_value); require (value + tokenRaised < currentSupply); require (value <= currentSupply - tokenRaised); currentSupply = safeSubtract(currentSupply, value); balances[msg.sender] += value...
15,882,722
./full_match/80001/0xa06587A30877C44e16B7A83e03AB408aFadFE821/sources/contracts/Bridge.sol
Verifies that chain signature is valid typeHash abi encoded type hash digest nonce Prevent replay attacks v Last byte of the signed PERMIT_DIGEST r First 32 bytes of the signed PERMIT_DIGEST v 32-64 bytes of the signed PERMIT_DIGEST Recover the signer of the PERMIT_DIGEST Compare the recover and the required signe...
function signatureVerification( bytes32 typeHash, uint256 nonce, uint8 v, bytes32 r, bytes32 s ) internal { require(!nonces[nonce], "Bridge: request already processed!"); bytes32 permitDigest = EIP712Utils.getPermitDigest(typeHash); address signer...
869,073
pragma solidity ^0.5.0; contract OZStorage { mapping (address => uint256) public _balances; mapping (address => mapping (address => uint256)) public _allowed; uint256 public _totalSupply; /// @dev counter to allow mutex lock with only one SSTORE operation uint256 private _guardCounter; fun...
counter to allow mutex lock with only one SSTORE operation
function totalSupply() internal view returns (uint256) { return _totalSupply; }
909,404
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; /* Library Imports */ import {AddressAliasHelper} from '../../standards/AddressAliasHelper.sol'; import {Lib_OVMCodec} from '../../libraries/codec/Lib_OVMCodec.sol'; import {Lib_AddressResolver} from '../../libraries/resolver/Lib_AddressResolver.sol'; /* Interfa...
Retrieves the total number of batches submitted. return _totalBatches Total submitted batches./
function getTotalBatches() public view returns (uint256 _totalBatches) { return batches().length(); }
1,596,296
pragma solidity 0.6.12; pragma experimental ABIEncoderV2; contract DSAuthEvents { event LogSetAuthority(address indexed authority); event LogSetOwner(address indexed owner); } contract DSAuth is DSAuthEvents { DSAuthority public authority; address public owner; constructor() public { ...
check if cdp is subscribed check if boost and boost allowed
function canCall(Method _method, address _user) public view returns(bool, uint) { bool subscribed = subscriptionsContract.isSubscribed(_user); CompoundSubscriptions.CompoundHolder memory holder = subscriptionsContract.getHolder(_user); if (!subscribed) return (false, 0); if...
7,333,797
// SPDX-License-Identifier: CC0-1.0 pragma solidity ^0.8.4; /// @title ERC-721 Non-Fungible Token Standard, optional enumeration extension /// @dev See https://eips.ethereum.org/EIPS/eip-721 /// Note: the ERC-165 identifier for this interface is 0x780e9d63. interface ERC721Enumerable /* is ERC721 */ { /// @notice Co...
ERC-721 Non-Fungible Token Standard, optional enumeration extension See https://eips.ethereum.org/EIPS/eip-721 Note: the ERC-165 identifier for this interface is 0x780e9d63.
interface ERC721Enumerable /* is ERC721 */ { function totalSupply() external view returns (uint256); function tokenByIndex(uint256 index) external view returns (uint256); function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); pragma solidity ^0.8.4; }
1,021,544
// SPDX-License-Identifier: Apache2.0 pragma solidity ^0.8.0; contract CharityDonation{ // ethereum address of contract owner address payable contractOwner; // list of charities (by address) this contract supports address payable[] private supportedCharities; // variable to store total number of...
sends donation (funds) to charity and destination address and emits a donation event emit donation event when transfers are made
function makeTransactions(uint amountToDonate, address payable destinationAddress, uint amountToSend, uint8 charityID) private { supportedCharities[charityID].transfer(amountToDonate); destinationAddress.transfer(amountToSend); emit DonationEvent(msg.sender, amountToDonate); }
6,413,830
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol"; //import "@uniswap/v3-periphery/contracts/interfaces/INonfungiblePositionManager.sol"; //import "@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol"; import "@uniswap/v3-periphery/contra...
get price decimals pool's token1's decimals (ex. 1e18) return price price
function getPrice(uint256 decimals) external view override nonZeroAddress(poolAddress) returns (uint256 price) { (uint160 sqrtPriceX96, , , , , , ) = IUniswapV3Pool(poolAddress).slot0(); return uint256(sqrtPriceX96).mul(uint256(sqr...
12,109,808
//SPDX-License-Identifier: MIT pragma solidity >=0.7.6; pragma abicoder v2; /// @title Unipilot Yield Farming /// @author Asim Raza /// @notice You can use this contract for earn reward on staking nft /// @dev All function calls are currently implemented without side effects //Utility imports import "./interfaces/IU...
withdraw NFT without reward claiming _tokenId unstake this tokenID
function emergencyNFTWithdraw(uint256 _tokenId) external { UserInfo storage userState = userInfo[_tokenId]; require(userState.user == msg.sender, "NOO"); PoolInfo storage poolState = poolInfo[userState.pool]; PoolAltInfo storage poolAltState = poolAltInfo[userState.pool]; ...
7,228,763
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.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 functions. * * By default, the owner account will be the on...
See {IERC721Metadata-tokenURI}./ If there is no base URI, return the token URI. If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).
function _beforeTokenTransfer( address from, address to, uint256 tokenId } pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; } pragma solidity ^0.8.0; } pragma solidity ^0.8.0; import "../ERC721.sol"; function tokenURI(uint256 tokenId) public view virtual...
24,004
pragma solidity 0.4.24; library SafeMath { function add(uint a, uint b) internal pure returns (uint c) { c = a + b; require(c >= a); } function sub(uint a, uint b) internal pure returns (uint c) { require(b <= a); c = a - b; } function mul(uint a, uint b) internal pure returns (uint c...
Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first re...
function approve(address spender, uint tokens) public whenNotPaused onlyPayloadSize(2) returns (bool success) { require(spender != address(0)); allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; }
7,030,365
// SPDX-License-Identifier: MIT pragma solidity ^0.6.2; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC2...
0.5% of deposits go into an insurance fund incase of negative profits to protect withdrawals At a 4 health factor, this is a -2% positionController can claim insurance to liquidate to cover interest
function deposit(uint _amount) public { uint _pool = balance(); token.safeTransferFrom(msg.sender, address(this), _amount); uint _insurance = _amount.mul(50).div(10000); _amount = _amount.sub(_insurance); insurance = insurance.add(_insurance); uint shares = 0; ...
12,682,234
// Project: AleHub // v1, 2018-05-24 // This code is the property of CryptoB2B.io // Copying in whole or in part is prohibited. // Authors: Ivan Fedorov and Dmitry Borodin // Do you want the same TokenSale platform? www.cryptob2b.io // *.sol in 1 file - https://cryptob2b.io/solidity/alehub/ pragma solidity ^0.4.21; c...
Within 400 days (FORCED_REFUND_TIMEOUT1) of the start of the Round, if it fails only investors can take money. After the deadline this can also include the company as well as investors, depending on who is the first to use the method. @ Do I have to use the function no @ When it is possible to call - @ When...
function distructVault() public { bytes32[] memory params = new bytes32[](1); params[0] = bytes32(msg.sender); if (rightAndRoles.onlyRoles(msg.sender,4) && (now > startTime.add(FORCED_REFUND_TIMEOUT1))) { financialStrategy.setup(0,params); } if (rightAndRoles...
11,869,855
pragma solidity ^0.4.24; library Address { /** * Returns whether the target address is a contract * @dev This function will return false if invoked during the constructor of a contract, * as the code is not actually created until after the constructor finishes. * @param addr address to check ...
Returns an URI for a given token ID Throws if the token ID does not exist. May return an empty string. tokenId uint256 ID of the token to query/
function tokenURI(uint256 tokenId) public view returns (string memory) { require(_exists(tokenId)); return _tokenURIs[tokenId]; }
15,834,551
pragma solidity ^0.4.17; /** * @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); ...
Forward ERC20 methods to upgraded contract if this one is deprecated
function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) { if (deprecated) { return UpgradedStandardToken(upgradedAddress).approveByLegacy(msg.sender, _spender, _value); return super.approve(_spender, _value); } }
436,266
./full_match/1/0x053197a8AB5875bF08A05E7524A2fdbe9C4aA59E/sources/project_/contracts/ForeverNft.sol
The following functions are overrides required by Solidity.
function _beforeTokenTransfer(address from, address to, uint256 tokenId, uint256 batchSize) internal override(ERC721, ERC721Snapshot) { super._beforeTokenTransfer(from, to, tokenId, batchSize); }
3,006,682
// SPDX-License-Identifier: MIT pragma solidity ^0.8.12; interface ICalculateLoan { function calculateNewDebt(uint principal, uint loanStartDate, uint loanEnd) external view returns (uint); function getRate() external view returns (uint); function adjustRate(uint newRate) external; } contract Storage { struct...
keep track of all our loans
function issueLoan(address borrower, uint amount) public { uint currDate = block.timestamp; balance[borrower] = Borrower(amount, currDate); outstandingBalance += amount; }
12,638,047
/** *Submitted for verification at Etherscan.io on 2021-05-05 */ //SPDX-License-Identifier: MIT pragma solidity 0.7.0; library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; ...
reorder array, creates more randomness refund any excess eth
function mintNFT() public payable { require(readyForSale == true, "HashGuise::changeToColor: not ready for sale"); uint256 mintPrice = distributionCurve(false); require(mintPrice != 0, "HashGuise::mintNFT: Sale has already ended"); require(mintPrice <= msg.value, "HashGuise::mintNFT:...
2,147,349
pragma solidity ^0.4.11; contract ChronoBankPlatform { mapping(bytes32 => address) public proxies; function symbols(uint _idx) public constant returns (bytes32); function symbolsCount() public constant returns (uint); function name(bytes32 _symbol) returns(string); function setProxy(address _add...
Transfers asset balance from the caller to specified receiver. _to holder address to give to. _value amount to transfer. return success./
function transfer(address _to, uint _value) returns(bool) { if (_to != 0x0) { return _transferWithReference(_to, _value, ""); } else { return false; } }
15,415,238
/* NumberBetManager v 1.0.0 http://www.get242.com/numberbet Copyright © 2019 S.H. LEE <windmill131@naver.com> This work is free. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See the COPYING file for more details. ...
Changes maximum number of tables Check that contract is paused
function changeMaxTable(uint256 _maxTable) public onlyOperator { require(isPaused); maxTable = _maxTable; emit OptionChanged(msg.sender); }
6,428,921