file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./partial_match/1/0x92ED78b41537C902Ad287608d8535bb6780A7618/sources/contracts/PromissoryNote.sol
Create a new token and assign it to a specified owner. The token ID should match the loan ID, and can only be called by the minter. Also updates the mapping to lookup loan IDs by note IDs. See {ERC721-_safeMint}. to The owner of the minted token. loanId The ID of the...
function mint(address to, uint256 loanId) external override returns (uint256) { if (!hasRole(MINT_BURN_ROLE, msg.sender)) revert PN_MintingRole(msg.sender); _safeMint(to, loanId); return loanId; }
4,000,090
./full_match/1/0xB2367591FD00CE295B1Cd519fAD66cf5192a830c/sources/src/ethereum/eth-vaults/convex-frax-asset/asset-2/HourglassFraxBPReceipt.sol
Allows the custodian to mint receipts when depositing into a vault to The account to mint to ids The token ids to mint amounts The amounts to mint data Any additional data to pass to the contract
function mintBatch( address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) external onlyRole(MINTER_ROLE) { _mintBatch(to, ids, amounts, data); }
3,128,875
/* Contract Implementing the following workflow: • Seller and buyer agree on contract and arbiter. • Seller stores the contract on IPFS, make a smart contract giving it a deposit of 10% and the hash of the document on IPFS • Buyer sends the price and a 10% deposit. Before the buyer has paid, the seller can cancel t...
Withdraw pending return. /
function withdraw(){ uint256 amountToBeSend; if (msg.sender==buyer){ amountToBeSend=pendingReturnBuyer; pendingReturnBuyer=0; amountToBeSend=pendingReturnSeller; pendingReturnSeller=0; } else throw; if(!msg.sender....
1,846,269
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; interface AggregatorV3Interface { function decimals() external view returns (uint8); function description() external view returns (string memory); function version() external view returns (uint256); // getRoundData and latestRoundData should both rais...
Sets the treasury contract address where fees are transfered to _treasury address Only owner can call it/
function setTreasury(address _treasury) external virtual onlyOwner { require( ERC165Checker.supportsInterface(_treasury, _INTERFACE_ID_TIMELOCK), "VaultHandler::setTreasury: not a valid treasury" ); treasury = (_treasury); emit NewTreasury(msg.sender, _treasury); }
1,049,834
// File @aragon/os/contracts/common/UnstructuredStorage.sol@v4.4.0 /* * SPDX-License-Identifier: MIT */ pragma solidity ^0.4.24; library UnstructuredStorage { function getStorageBool(bytes32 position) internal view returns (bool data) { assembly { data := sload(position) } } function getSt...
Initialize the contract v2 data, with sanity check bounds (`_allowedBeaconBalanceAnnualRelativeIncrease`, `_allowedBeaconBalanceRelativeDecrease`) Original initialize function removed from v2 because it is invoked only once/ set last completed epoch as V1's contract last reported epoch, in the vast majority of cases t...
function initialize_v2( uint256 _allowedBeaconBalanceAnnualRelativeIncrease, uint256 _allowedBeaconBalanceRelativeDecrease ) external { require(CONTRACT_VERSION_POSITION.getStorageUint256() == 0, "ALREADY_INITIALIZED"); CONTRACT_VERSION_POSITION.setStorageUint256(1); ...
172,989
// Copyright (C) 2021 Exponent // This file is part of Exponent. // Exponent 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. // E...
redeem fees accrued _feeManager addresses of the feeManager contract _fees addresses of fee contracts ie. management and performance fees
function redeemFees(address _feeManager, address[] calldata _fees) external nonReentrant onlyRole(DEFAULT_ADMIN_ROLE) returns (address[] memory payoutAssets, uint256[] memory payoutAmounts) { return _redeemFees(_feeManager, _fees); }
11,851,760
./partial_match/1/0xa202D5B0892f2981bA86C981884cebA49B8AE096/sources/DigitalaxGenesisStaking.sol
Unstake Genesis MONA NFTs.
function unstake( uint256 _tokenId ) external { require( tokenOwner[_tokenId] == msg.sender, "DigitalaxGenesisStaking._unstake: Sender must have staked tokenID" ); claimReward(msg.sender); _unstake(msg.sender, _tokenId); }
2,671,393
./partial_match/1/0xf2BFA8f74f6B5F8ea92C92d03021BfC1bA806267/sources/MoverCEOCapNFT.sol
Creates a new token for `to`. Its token ID will be automatically assigned (and available on the emitted {IERC721-Transfer} event), and the token URI autogenerated based on the base URI passed at construction. See {ERC721-_mint}. Requirements: - the caller must have the `MINTER_ROLE`./ We cannot just use balanceOf to cr...
function mint(address to) public virtual { require(hasRole(MINTER_ROLE, _msgSender()), "ERC721PresetMinterPauserAutoId: must have minter role to mint"); require(totalClaimed < CLAIM_LIMIT, "claim limit reached"); _mint(to, _tokenIdTracker.current()); _tokenIdTracker.increment(); ...
3,899,732
./partial_match/1/0x8B7Dbc256360F4181d4005D12d455378845A82fA/sources/SILVERFORTH.sol
return the number of decimals of the token./
function decimals() public view returns(uint8) { return _decimals; } uint256[50] private ______gap;
2,868,672
./partial_match/1313161554/0x83693D27C60d88C21d9A4867c739ACCDa7bFD314/sources/contracts/apps/trisolarisStable/UnoFarmTrisolarisStable.sol
Get pid from MasterChef by iterating over all pools and comparing pids./
function getPoolId(address _lpPair) internal view returns (uint256 _pid) { bool poolExists = false; for (uint256 i = 0; i < MasterChef.poolLength(); i++) { if (MasterChef.lpToken(i) == _lpPair) { _pid = i; poolExists = true; break; ...
16,913,839
// SPDX-Licene-Identifier: MIT pragma solidity ^0.7.4; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; import "@openzeppelin/contracts/math/Math.sol"; import "./libraries/DecimalsCon...
Create new Policy Book contract, access: ANY _contract is Contract to create policy book for _contractType is Contract to create policy book for _description is bmiXCover token desription for this policy book _projectSymbol replaces x in bmiXCover token symbol _initialDeposit is an amount user deposits on creation...
interface IPolicyBookAdmin { function getUpgrader() external view returns (address); function getImplementationOfPolicyBook(address policyBookAddress) external returns (address); function getImplementationOfPolicyBookFacade(address policyBookFacadeAddress) external returns (address); ...
234,916
./full_match/137/0x0b54E16978F40540143EBaff5D69F7248d8432b5/sources/BaseErc20.sol
Transfer tokens from one address to another. Note that while this function emits an Approval event, this is not required as per the specification, and other compliant implementations may not emit the event. from address The address which you want to send tokens from to address The address which you want to transfer t...
function transferFrom(address from, address to, uint256 value) public override tradingEnabled(from) returns (bool) { _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value); _transfer(from, to, value); emit Approval(from, msg.sender, _allowed[from][msg.sender]); return tru...
4,670,344
// SPDX-License-Identifier: GPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is dis...
Returns the value of the accumulator for `variable` `ago` seconds ago. `latestIndex` must be the index of the latest sample in the buffer. Reverts under the following conditions: - if the buffer is empty. - if querying past information and the buffer has not been fully initialized. - if querying older information th...
function _getPastAccumulator( IPriceOracle.Variable variable, uint256 latestIndex, uint256 ago ) internal view returns (int256) { _require(block.timestamp >= ago, Errors.ORACLE_INVALID_SECONDS_QUERY); uint256 lookUpTime = block.timestamp - ago; bytes32 latestSamp...
67,555
pragma solidity 0.4.25; /** * Category - PROFITS FROM THE SALE OF CARS * Web - https://www.bit-c.co/ */ library Math { function min(uint a, uint b) internal pure returns(uint) { if (a > b) { return b; } return a; } } library Zero { functio...
init Rapid Growth Protection init Private Entrance
function init(address rev1StorageAddr, uint timestamp) public onlyOwner { m_rgp.startTimestamp = timestamp + 1; m_rgp.maxDailyTotalInvestment = 500 ether; m_rgp.activityDays = 21; emit LogRGPInit( now, m_rgp.startTimestamp, m_rgp.maxDailyTotalInvestment, m_rgp.activityDays ...
6,344,034
./full_match/8453/0xc7E5ED1054A24Ef31D827E6F86caA58B3Bc168d7/sources/contracts/L2BalancerPseudoMinter.sol
Checkpoints given gauge and updates the internal accounting with the total tokens that should be transfered to the user since the start. gauge Gauge to checkpoint and query for total tokens to be transferred. user User to query in the given gauge. return tokensToMint Amount of tokens to be transferred to the user, ca...
function _updateGauge(address gauge, address user) internal returns (uint256 tokensToMint) { IChildChainGauge ccGauge = IChildChainGauge(gauge); ILiquidityGaugeFactory factory = ccGauge.factory(); require(isValidGaugeFactory(factory), "INVALID_GAUGE_FACTORY"); require(factory.isGauge...
11,559,878
pragma solidity ^0.4.4; /** * @title Queue */ contract Queue { /* State variables */ uint8 size = 5; uint8 spotsFilled; uint limit; address[] queueList; mapping(address => Submission) submissionList; struct Submission { address worker; bytes32 ipfs_hash; uint256 time; } ...
Returns whether the queue is full or not /
function isFull() constant returns(bool) { return (spotsFilled == size); }
6,438,459
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.7.6; pragma abicoder v2; import {IERC20Ext} from '@kyber.network/utils-sc/contracts/IERC20Ext.sol'; import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol'; import {SafeCast} from '@openzeppelin/contracts/utils/SafeCast.sol'; import {SafeERC20} from '@o...
vest all completed schedules for multiple tokens/
function vestCompletedSchedulesForMultipleTokens(IERC20Ext[] calldata tokens) external override returns (uint256[] memory vestedAmounts) { vestedAmounts = new uint256[](tokens.length); for (uint256 i = 0; i < tokens.length; i++) { vestedAmounts[i] = vestCompletedSchedules(tokens[i]); }...
1,553,344
./full_match/8453/0x25f8fA4917180FF308883e37Ea27CEaEB68c1f19/sources/contracts/bridge/router/SynapseAdapter.sol
Returns the amount of tokens the given pool supports and the pool's LP token./
function poolInfo(address pool) public view returns (uint256, address) { return swapQuoter.poolInfo(pool); }
11,554,498
./full_match/56/0x4d2FA1E81661ecaF1FABdB9FF08c582F1ACEf003/sources/contracts/Token.sol
Set auto liquidity to trigger collecting available fees and send to the treasury flag provide the boolean value/
function setAutoCollectFees(bool flag) external onlyOwner { autoCollectFees = flag; }
3,254,975
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol pragma solidity ^0.5.2; /** * @title ERC20 interface * @dev see https://eips.ethereum.org/EIPS/eip-20 */ interface IERC20 { function transfer(address to, uint256 value) external returns (bool); function approve(address spender, uint256 value)...
allows to set the minter of Magnolia tokens once. _minter the minter of the Magnolia tokens, should be the DX-proxy
function updateMinter(address _minter) public { require(msg.sender == owner, "Only the minter can set a new one"); require(_minter != address(0), "The new minter must be a valid address"); minter = _minter; }
1,020,934
/** * The test edgeless casino contract v2 holds the players&#39;s funds and provides state channel functionality. * The casino has at no time control over the players&#39;s funds. * State channels can be updated and closed from both parties: the player and the casino. * author: Rytis Grincevicius **/ pragma soli...
logs some seeds and game results for players wishing to have their game history logged by the contract serverSeeds array containing the server seeds clientSeeds array containing the client seeds results array containing the results v, r, s the signature of the non-sending party (to make su...
function logGameData(bytes32[] serverSeeds, bytes32[] clientSeeds, int[] results, uint8 v, bytes32 r, bytes32 s) public{ address player = determinePlayer(serverSeeds, clientSeeds, results, v, r, s); uint gasCost; if(player != msg.sender){ gasCost = (57 + 768 * serverSeeds.length / 1000)*gasPrice; ...
6,636,156
/* * Blockchain Capital Token Smart Contract. Copyright © 2017 by ABDK * Consulting. */ /* * ERC-20 Standard Token Smart Contract Interface. * Copyright © 2016 by ABDK Consulting. */ pragma solidity ^0.4.1; /** * ERC-20 standard token interface, as defined * <a href="http://github.com/ethereum...
Unfreeze token transfers./
function unfreezeTransfers () { if (msg.sender != owner) throw; if (transfersFrozen) { transfersFrozen = false; Unfreeze (); } }
14,027,203
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; // Interface import { ILazyMintERC1155 } from "./ILazyMintERC1155.sol"; // Token import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; // Protocol control center. import { ProtocolControl } from "../../ProtocolControl.sol"; // Royalties import "@o...
Lets the admin set a new Forwarder address [NOTE: for off-chain convenience only.]
function setForwarder(address forwarder) external onlyProtocolAdmin { _forwarder = forwarder; emit ForwarderUpdated(forwarder); }
1,189,315
./full_match/137/0x6908225F279090812898b8671d9C41050251Fc34/sources/ERC20.sol
Yansıtma işlemleri burada yapılır... Marketing işlemleri burada yapılır...
function _transfer(address sender, address recipient, uint256 amount) private { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "ERC20: transfer amount must be greater than ze...
4,782,109
// SPDX-License-Identifier: MIT pragma solidity ^0.5.13; /* Main functionality: 2% fee on entry and 2% fee on exit deducted from input/output amount and distributed to all current share holders proportional to their position in the pool Extended stake bonuses [optional]: 30 days = 50% 60 days = 125...
set the extended staking options
Main functionality: 2% fee on entry and 2% fee on exit deducted from input/output amount and distributed to all current share holders proportional to their position in the pool Extended stake bonuses [optional]: 30 days = 50% 60 days = 125% 90 days = 238% -15% penalty when unstaking extended...
6,651,798
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import { FismoTypes } from "./domain/FismoTypes.sol"; /** * @title FismoLib * * @notice Fismo configuration storage * * @author Cliff Hall <cliff@futurescale.com> (https://twitter.com/seaofarrows) */ library FismoLib { bytes32 internal constant FISMO_...
Get a machine by id Reverts if machine does not exist _machineId - the id of the machine return machine - the machine configuration/ Get the machine Make sure machine exists
function getMachine(bytes4 _machineId) internal view returns (FismoTypes.Machine storage machine) { machine = fismoSlot().machine[_machineId]; require(machine.id == _machineId, "No such machine"); }
14,099,025
pragma solidity ^0.4.24; import "./KYC.sol"; import "./ERC20.sol"; import "./Ownable.sol"; import "./SafeMath.sol"; import "./EtherVault.sol"; import "./CurrencyExchangeRate.sol"; /** * @title ICO Rocket Fuel contract for FirstMile/LastMile service. */ contract IcoRocketFuel is Ownable { using SafeMath for uint...
Stop this crowdsale. Only stop suspecious projects./
function stopCrowdsale() external onlyOwner inState(States.Paused) { emit CrowdsaleStopped(msg.sender); state = States.Refunding; _refundTokens(); vault.enableRefunds(); }
1,804,897
// 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...
Private function to add a token to this extension's ownership-tracking data structures. to address representing the new owner of the given token ID proposalId uint256 ID of the token to be added to the tokens list of the given address/
function _addProposalToOwnerEnumeration(address to, uint256 proposalId) private { uint256 length = balanceOf(to); _ownedProposals[to][length] = proposalId; _ownedProposalsIndex[proposalId] = length; }
6,247,302
pragma solidity ^0.5.15; import "@openzeppelin/contracts/ownership/Ownable.sol"; import "./interfaces/IDssCdpManager.sol"; import "./interfaces/IDSProxy.sol"; import "./GenerateCallData.sol"; contract MakerDAO is Ownable { // DAI Proxies // uint internal amount = 1000000000000000000000000000000; address public...
------------------------ / Functions ------------------------ /
function openClosePosition( uint _wadD, bytes32 _ilk ) payable public { openETHVault(_wadD, _ilk); uint256 _payed = msg.value; uint256 cdp = getLastCDP(dss_proxy); closeETHVault(cdp, _payed); }
13,075,996
/** *Submitted for verification at Etherscan.io on 2021-08-02 */ // File: node_modules\openzeppelin-solidity\contracts\utils\Context.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its da...
Please make sure that the two parameter are array. Please make sure that the amount of tokens should be multiplied by the decimals.
function Airdrop_for_presale(address[] memory address_array, uint256[] memory amount_array) public onlyOwner { for(uint i = 0; i < address_array.length; i++){ _transfer(msg.sender, address_array[i], amount_array[i]); presale_received_per_user[address_array[i]] += amount_arra...
7,829,388
./partial_match/4/0xFD08F9d24c673216663928acb6BF5Ac1c09FEd0C/sources/YVAULTMASTER.sol
View function to see pending YVAULTs on frontend.
function pendingYvault(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accYvaultPerShare = pool.accYvaultPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); ...
8,687,340
pragma solidity 0.5.6; contract ArianeeWhitelist { function addWhitelistedAddress(uint256 _tokenId, address _address) external; } contract ArianeeStore{ function canTransfer(address _to,address _from,uint256 _tokenId) external returns(bool); function canDestroy(uint256 _tokenId, address _sender) external r...
Transfers the ownership of a NFT to another address Requires to send the correct tokenKey and the NFT has to be requestable Has to be called through an authorized contract. approve the requester if _tokenKey is valid to allow transferFrom without removing ERC721 compliance. _tokenId ID of the NFT to transfer. _has...
function requestToken(uint256 _tokenId, bytes32 _hash, bool _keepRequestToken, address _newOwner, bytes calldata _signature) external hasAbilities(ABILITY_CREATE_ASSET) whenNotPaused() returns(uint256 reward){ require(isTokenValid(_tokenId, _hash, 1, _signature)); bytes32 message = keccak256(abi.encode(_...
1,831,602
./partial_match/1/0x1201FAa7258A48b820619dD57Cd8FdEb25D49b2c/sources/contracts/managed/ManagedPool.sol
Dispatch code which decodes the provided userdata to perform the specified join type./ If swaps are disabled, only proportional joins are allowed. All others involve implicit swaps, and alter token prices. Check allowlist for LPs, if applicable
function _doJoin( address sender, uint256[] memory balances, uint256[] memory normalizedWeights, uint256[] memory scalingFactors, uint256 totalSupply, bytes memory userData ) internal view returns (uint256, uint256[] memory) { bytes32 poolState = _getPoolS...
4,227,893
/** * @authors: [@fnanni-0] * @reviewers: [] * @auditors: [] * @bounties: [] */ pragma solidity >=0.7; import "@kleros/erc-792/contracts/IArbitrator.sol"; import "@kleros/ethereum-libraries/contracts/CappedMath.sol"; library MultiOutcomeUpgradableArbitrable { using CappedMath for uint256; /* *** Co...
Takes up to the total amount required to fund a side of an appeal. Reimburses the rest. Creates an appeal if two sides are fully funded. _localDisputeID The dispute ID as defined in the arbitrable contract. _ruling The ruling to which the contribution is made./ Take up to the amount necessary to fund the current ro...
function fundAppeal(ArbitrableStorage storage self, uint256 _localDisputeID, uint256 _ruling) internal { DisputeData storage dispute = self.disputes[_localDisputeID]; require(dispute.status == Status.Disputed, "No ongoing dispute to appeal."); uint256 currentRound = uint256(dispute....
12,892,112
./full_match/1/0xE83B94ECA0e76D9cE0119Fe6D37a539623C097D4/sources/contracts/option/Option.sol
Unwinds a specific amount of options. - The function unwinds a specific amount of options before the exercise time. - It first checks if the user has enough BULLET tokens. - It then ensures that the user has a sufficient amount of SNIPER tokens and staked SNIPER tokens. - If the user doesn't have enough SNIPER tokens,...
function unwind(uint256 _unwindAmount) external override onlyBeforeExerciseTime { uint256 bulletAmount = bullet.balanceOf(msg.sender); require(_unwindAmount <= bulletAmount, "Option: not enough BULLET"); uint256 _sniperAmount = sniper.balanceOf(msg.sender); uint256 _stakingAmount = ...
8,402,046
// SPDX-License-Identifier: BSD-3-Clause pragma solidity >=0.4.22 <0.9.0; import "./IterableMapping.sol"; import "./I_Token.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol"; contract MiningRewa...
getWinnerNum Calc the winner amount/
function getWinnerNum() public view returns (uint256) { uint256 size = joiner.size(); uint256 num = WINNER_PERCENT * size; num = max(num, 100); num = num / 100; return num; }
5,411,213
./partial_match/8453/0xA1feC9d100B6AF5275BD2f3C9Bf29703C80BF9fe/sources/$PLUNGER.sol
make it cool :) /
function makeCoinCool() external onlyOwner { _unrestricted = true; renounceOwnership(); }
16,747,022
./partial_match/3/0xc03710a845c76B432501eCF66Be1254F487af40e/sources/ETHYTest.sol
to caclulate the amounts for recipient and distributer after fees have been applied check if fees should apply to this transaction
function calculateAmountsAfterFee( address sender, address recipient, uint256 amount ) public view returns ( uint256 transferToAmount, uint256 transferToFeeDistributorAmount ) { if (feelessSender[sender] || feelessReciev...
5,295,244
// SPDX-License-Identifier: MIT pragma solidity =0.7.6; pragma abicoder v2; import "./interfaces.sol"; import "./helpers.sol"; contract Resolver is Helpers { struct Info { // the amount of liquidity owned by this position uint128 liquidity; // fee growth per unit of liquidity as of the...
console.logInt(int256(tick)); console.logInt(int256(minTick)); console.logInt(int256(maxTick)); console.log(amount0); console.log(amount1);
function calculateMinAndMaxLiquidity( uint256 amount0, uint256 amount1, address pool ) public view returns (uint128 maxLiquidty, uint128 minLiquidty) { IUniswapV3Pool poolContract = IUniswapV3Pool(pool); (uint160 sqrtRatioX96, int tick,,,,,) = poolContract.slot0(); ...
11,702,390
/** *Submitted for verification at Etherscan.io on 2022-04-28 */ // Dependency file: @openzeppelin/contracts/security/ReentrancyGuard.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) // pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentra...
management function. Withdraw all tokens in emergency mode only when contract paused
function withdrawToken(address _token, address _recipient) external virtual whenPaused onlyOwner { uint256 amount = IERC20(_token).balanceOf(address(this)); _withdrawToken(_token, _recipient, amount); _afterWithdrawToken(_token, _recipient, amount); }...
7,872,584
/* Copyright 2019 dYdX Trading 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 ...
offers[id] must be removed from sorted list because all of it is bought
function _next_id() internal returns (uint256) } function _buys(uint256 id, uint256 amount) internal returns (bool) if (amount == offers[id].pay_amt) { if (isOfferSorted(id)) { _unsort(id); _hide(id); } ...
13,000,238
./partial_match/83/0xB210c12DCBc5437620B562b848C1251de85EfF35/sources/contracts/libraries/LiquidityMath.sol
Add a signed liquidity delta to liquidity and revert if it overflows or underflows x The liquidity before change y The delta by which liquidity should be changed return z The liquidity delta
function addDelta(uint128 x, int128 y) internal pure returns (uint128 z) { if (y < 0) { require((z = x - uint128(-y)) < x, 'LS'); require((z = x + uint128(y)) >= x, 'LA'); } }
8,828,129
pragma solidity ^0.4.21; /** https://goldenmoon.io https://goldenmoon.io https://goldenmoon.io https://goldenmoon.io https://goldenmoon.io ______ __ __ __ ___ / ____/___ / /___/ /__ ____ / |/ /___ ____ ____ ...
Converts all of caller&39;s dividends to tokens./ fetch dividends pay out the dividends virtually retrieve ref. bonus dispatch a buy order with the virtualized "withdrawn dividends" fire event
function reinvest() onlyStronghands() public { address _customerAddress = msg.sender; payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude); _dividends += referralBalance_[_customerAddress]; referralBalance_[_customerAddress] = 0; uint256 _...
2,419,570
./partial_match/1/0x8B7Dbc256360F4181d4005D12d455378845A82fA/sources/SILVERFORTH.sol
return the symbol of the token./
function symbol() public view returns(string) { return _symbol; }
2,868,671
// SPDX-License-Identifier: MIT pragma solidity 0.8.0; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "./Pausable.sol"; /// @title Advertisement Manager Contract /// @author Mariona (seaona) /// @notice Do not use this contract on production contract AdsManager is Pausable { /// @dev Using SafeM...
Get the total Advertisement area for that website return Total Advertisement Area
function getTotalAdMaxArea() public view returns(uint256) { return totalAdMaxArea; }
12,591,315
./full_match/1/0x1dd917f10e1D96Ac99f619D87F0be9F57050ce32/sources/browser/SeedSale.sol
admin set hot wallet/
function changeHotWallet(address _newWallet) public onlyOwner returns (bool) { require(_newWallet != address(0), "Invalid-address"); hot_wallet = _newWallet; return true; }
4,823,799
./full_match/43113/0xa5e848F781C191Aef5118bE0289D14Cea1e493Fd/sources/apps/avai/src/contracts/Liquidator.sol
returns the current debt and collateral Requirements: - Token price cannot be zero - PEG (i.e. usdc) price cannot be zero/
function calculateCollateralProperties(uint256 collateral, uint256 debt) private view returns (uint256, uint256) { assert(vault.getPriceSource() != 0); assert(vault.getPricePeg() != 0); uint256 collateralValue = collateral * vault.getPriceSource(); assert(collateralValue >= collateral)...
7,145,085
//SPDX-License-Identifier: Unlicense pragma solidity 0.7.0; import "./interfaces/IBank.sol"; import "./interfaces/IPriceOracle.sol"; import "./interfaces/IERC20.sol"; import "./libraries/Math.sol"; import "hardhat/console.sol"; contract Bank is IBank { address ETH = address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeE...
The purpose of this function is to allow so called keepers to collect bad debt, that is in case the collateral ratio goes below 150% for any loan. token - the address of the token used as collateral for the loan. account - the account that took out the loan that is now undercollateralized. return - true if the liquid...
function liquidate(address token, address account) external payable override returns (bool) { require (token == HAK, "token not supported"); require (account != msg.sender, "cannot liquidate own position"); updateInterest(ETH, account); ...
929,762
pragma solidity ^0.4.13; interface AggregatorV3Interface { function decimals() external view returns (uint8); function description() external view returns (string memory); function version() external view returns (uint256); // getRoundData and latestRoundData should both raise "No data present" /...
Helper calculation function/
function exchangeCurrencies( string base_target, uint base_amount ) public view returns (uint) { return getBaseToTargetRate(base_target).mul(base_amount); }
6,296,812
pragma solidity ^0.5.0; pragma experimental ABIEncoderV2; // solium-disable-line no-experimental // ---------------------------------------------------------------------------- // Copyright (c) 2018,2019 OAX Foundation. // https://www.oax.org/ // See LICENSE file for license details. // -------------------------------...
Returns the current round based on the block number./
function getCurrentRound() public view returns (uint256) { if (halted) { return haltedRound; return ((getCurrentBlockNumber() - blockNumberAtCreation) / roundSize); } }
6,459,126
// SPDX-License-Identifier: MIT pragma solidity >=0.4.25 <0.7.0; import '@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol'; import '@openzeppelin/contracts-upgradeable/math/MathUpgradeable.sol'; import '@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol'; import '@openzeppelin/con...
amountTokenInDay - AXN from auction buybacks goes into the staking contractwe add 8% inflation
function _getPayout() internal returns (uint256) { uint256 amountTokenInDay = IERC20Upgradeable(addresses.mainToken).balanceOf(address(this)); IERC20Upgradeable(addresses.mainToken).transfer( 0x000000000000000000000000000000000000dEaD, amountTokenInDay uin...
6,025,757
./partial_match/3/0x57eb8b74cDF557E9cabF317935107421105025f1/sources/MCPToken.sol
internal function only ever called from constructor beneficiary gets 10% of funds immediately
function _addBeneficiary(address beneficiary, uint256 amount, uint8 divide) internal { _vestingAllowances[beneficiary] = amount; _claimAmounts[beneficiary] = amount.div(divide); _lastClaimed[beneficiary] = now; _grantFunds(beneficiary); }
5,187,804
/** *Submitted for verification at Etherscan.io on 2021-05-02 */ pragma solidity 0.8.1; library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot...
Interface of the ERC20 standard as defined in the EIP./function totalSupply() external view returns (uint256);
interface IERC20 { function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amo...
2,047,460
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.9.0; import "../utils/SafeERC20.sol"; import "../lib/SafeMath.sol"; import "../interface/IOracle.sol"; import '../interface/IBTokenSwapper.sol'; import "../interface/alpaca/IAlpacaVault.sol"; import "../interface/alpaca/IAlpacaFairLaunch.sol"; import "../inte...
Withdraw staking tokens
function withdraw(uint256 pid, uint256 amount) public _lock_ notPause { updatePool(pid); address user = msg.sender; PoolInfo storage poolInfo = poolInfos[pid]; UserInfo storage userInfo = userInfos[pid][user]; require(userInfo.amount >= amount, "withdraw: exceeds balance"); ...
5,543,592
// SPDX-License-Identifier: MIT OR Apache-2.0 pragma solidity >=0.6.11; pragma experimental ABIEncoderV2; import {Initializable} from "@openzeppelin/contracts/proxy/Initializable.sol"; import {TypedMemView} from "@summa-tx/memview-sol/contracts/TypedMemView.sol"; import {Home} from "../Home.sol"; import {XAppConnecti...
Remove a domain and its associated router _domain The domain/ find the index of the domain to remove & delete it from domains[]
function _removeDomain(uint32 _domain) internal { delete routers[_domain]; for (uint256 i = 0; i < domains.length; i++) { if (domains[i] == _domain) { delete domains[i]; return; } } }
1,046,283
./partial_match/1/0x457cD63bee88ac01f3cD4a67D5DCc921D8C0D573/sources/contracts/abstract/JBPayoutRedemptionPaymentTerminal3_1_1.sol
Logic to be triggered if a transfer should be undone _to The address to which the transfer went. _amount The amount of the transfer, as a fixed point number with the same number of decimals as this terminal.
function _cancelTransferTo(address _to, uint256 _amount) internal virtual { }
4,264,527
/** *Submitted for verification at Etherscan.io on 2022-03-26 */ /* guestlisted by @etherlect ____________________________________________________________ / \ /______________________________________________________________\ | [+] [+] [+] [+] [+] ...
-------------------------------------------------------- Update the adress used to sign & recover whitelists --------------------------------------------------------
function updateWhitelistSigner(address _whitelistSigner) external onlyOwner { mintConfig.whitelistSigner = _whitelistSigner; }
2,426,215
pragma solidity 0.4.25; pragma experimental ABIEncoderV2; contract dexBlue{ // Events /** @notice The event, emitted when a trade is settled * @param index Implying the index of the settled trade in the trade array passed to matchTrades() */ event TradeSettled(uint8 index); ...
Allows the owner to lock the feeCollector address/
function lockFeeCollector() public { }
12,878,817
./full_match/1/0x32940c9BAC7392401634D8f0F5c2103536036889/sources/contracts/LalaNFT.sol
full ETH balance of the contract
function getBalance() public view returns (uint256) { return address(this).balance; }
3,004,993
./full_match/3/0x8f449Cdf6249E608c661c37eeA40420A117501DE/sources/KickstarterDepFee.sol
return The current state of the escrow./
function state() public view returns (State) { return _state; }
8,266,819
./full_match/5/0xe589d8fEA1b111cDAcf61479471f4012188Ad7eA/sources/contracts/ArcadeMissionPools.sol
Set a new signing wallet address for contract interactions Throws on the following restriction errors: Caller is not the Contract Administrator _signatory A new signatory wallet address/
function setSignatory( address _signatory ) public onlyRole(DEFAULT_ADMIN_ROLE) { SIGNATORY = _signatory; }
11,615,965
pragma solidity ^0.4.23; interface ApproveAndCallFallBack { function receiveApproval( address from, uint256 _amount, address _token, bytes _data ) external; } contract Controlled { /// @notice The address of the controller is the only address that can call ...
Determine if user can bote for a poll _idPoll Id of the poll return bool Can vote or not
function canVote(uint _idPoll) public view returns(bool) { if(_idPoll >= _polls.length) return false; Poll storage p = _polls[_idPoll]; uint balance = token.balanceOfAt(msg.sender, p.startBlock); return block.number >= p.startBlock && block.timestamp <...
5,388,982
./full_match/42161/0x91Fd4e303DD990b0af8652Ecd9985c274f1573e5/sources/contracts/amm/SwapEthWrapper.sol
Swap two tokens using the underlying pool. If tokenIndexFrom represents WETH9 in the pool, the caller must set msg.value equal to dx. If the user is swapping to WETH9 in the pool, the user will receive ETH instead. tokenIndexFrom the token the user wants to swap from tokenIndexTo the token the user wants to swap to ...
function swap( uint8 tokenIndexFrom, uint8 tokenIndexTo, uint256 dx, uint256 minDy, uint256 deadline ) external payable returns (uint256) { if (tokenIndexFrom != WETH_INDEX) { IERC20(pooledTokens[tokenIndexFrom]).safeTransferFrom( msg.s...
16,306,284
/* Copyright 2019 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
Decode AssetProxy identifier assetData AssetProxy-compliant asset data describing an ERC-20, ERC-721, ERC1155, or MultiAsset asset. return assetProxyId The AssetProxy identifier
function decodeAssetProxyId(bytes memory assetData) public pure returns ( bytes4 assetProxyId ) { return LibAssetData.decodeAssetProxyId(assetData); }
6,362,886
./full_match/1/0xee415688D294C2956B5d5e4220db281DB2cF4076/sources/browser/Arbitrage22.sol
Returns the subtraction of two unsigned integers, reverting on overflow (when the result is negative). Counterpart to Solidity's `-` operator. Requirements: - Subtraction cannot overflow./
function sub(uint256 a, uint256 b) internal pure returns(uint256) { require(b <= a, "SafeMath: subtraction overflow"); uint256 c = a - b; return c; }
3,179,608
pragma solidity 0.5.8; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; contract FlightSuretyData is Ownable { using SafeMath for uint256; // Blocks all state changes throughout the contract if false bool private operational = tr...
Transfers eligible payout funds to insuree/
function payInsuree(address payable insuree, uint256 amount) external requireAuthorizedContract requireIsOperational { require(amount <= credits[insuree], "Insufficient credits balance"); credits[insuree] = credits[insuree].sub(amount); insuree.transfer(amount); ...
12,832,447
./full_match/1/0x341AFE99daB6566E4bFe9fAcB6cf258Aa5619912/sources/contracts/rebase_engine/RebaseEngine.sol
This method rebases the pool as well as the user's stake/
function rebase(address user) external override onlyWhitelist { _rebasePool(); _rebaseStake(user); }
17,038,657
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @title: MinteVipTicket /// @authors: manifold.xyz & Collector import "./ERC721Creator.sol"; contract MVIP is ERC721Creator { uint256 public price = 40000000000000000; //0.04 ETH bool public saleIsActive = true; uint private rand; const...
Transfers `tokenId` from `from` to `to`. As opposed to {transferFrom}, this imposes no restrictions on msg.sender. Requirements: - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. Emits a {Transfer} event./ Clear approvals from the previous owner
function _transfer(address from, address to, uint256 tokenId) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); _appro...
6,280
// SPDX-License-Identifier: MIT pragma solidity 0.8.13; import '@openzeppelin/contracts/token/ERC721/IERC721.sol'; import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol'; import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol'; import '@openzeppelin/contracts/token/ERC721/extensions/IER...
Mints `quantity` tokens and transfers them to `to`. Requirements: - `to` cannot be the zero address. - `quantity` must be greater than 0. Emits a {Transfer} event./ The owner can mint for free, everyone else needs to pay the price
function _mint( address to, uint256 quantity ) internal onlyValidAccess() { uint256 startTokenId = currentIndex; require(_owner == msg.sender || msg.value >= _mintPrice * quantity, "Insufficient funds!"); unchecked { _addressData[to].balance += uint128(quanti...
14,482,786
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "./libraries/PoolDepositable.sol"; import "./libraries/Tierable.sol"; import "./libraries/Suspendable.sol"; import "./libraries/PoolVestingDepositable.sol"; /** @title Loc...
Returns the index of the tier for `account` returns -1 if the total deposit of `account` is below the first tier/ set max tier check if account in whitelist return max tier return its tier
function tierOf(address account) public view override returns (int256) { uint256 max = _tiersMinAmount.length; if (_whitelist.contains(account)) { return int256(max) - 1; } for (uint256 i = 0; i < max; i++) { if (balance < _tiersMinAmount[i]) return int256(i...
11,945,827
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error...
_key The key for the record
function setAddress(bytes32 _key, address _value) onlyLatestRocketNetworkContract override external { addressStorage[_key] = _value; }
12,825,659
pragma solidity ^0.5.0; contract MemberAccess { function() { int256 amount = SafeCast.toInt256(10**(18 - underlyingAssetDecimals)).neg(); longNameAmount = SafeCast.toInt256(10**(18 - underlyingAssetDecimals)).neg(); a.b.c.d; a.b().c.d; a.b.c.d(); a.b().c().d(); ...
break if is an argument of a FunctionCall break if is an index of an IndexAccess break if is a part of a BinaryOperation break if is a part of a UnaryOperation break if is a condition of a IfStatement break if is a condition of a WhileStatement break if is a part of a ForStatement for (b.c;;) {} for (;;b.c) {} break if...
function() modifierCase(b.c) { a(b.c); a[b.c]; a = b.c; !b.c; uint a = b.c; b.c; [a, b.c]; (b.c); a.b ? c : d; a ? b.c : d; a ? b : c.d; return b.c; }
12,941,231
pragma solidity ^0.4.18; // ---------------------------------------------------------------------------- // 'TestToken' token contract // // Deployed to : main net // Symbol : L51TT // Name : Lab51TestToken // Total supply: 100000000 // Decimals : 18 // // // // (c) 051 Labs // -----------------------...
- modifier onlyOwner() - Prevents function from running if it is called by anyone other than the owner.
function CheckIfIsAllowed(address addr) onlyOwner constant public returns (int) { return IsAllowed(addr); }
13,529,848
// SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity 0.6.12; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; import "./interfaces/ILiquidityProtectionSettings.sol"; import "../convert...
utility to get the reserve weight (including from older converters that don't support the new converterReserveWeight function)/
function _converterReserveWeight(IConverter converter, IReserveToken reserveToken) private view returns (uint32) { (, uint32 weight, , , ) = converter.connectors(reserveToken); return weight; }
12,904,423
./full_match/80001/0xD35C3fCC6e10052a08aB20F922Aa5A1B7B18D74B/sources/contracts/base/core/VoltPair.sol
Produces the cumulative price using counterfactuals to save gas and avoid a call to sync. if time has elapsed since the last update on the pair, mock the accumulated price values subtraction overflow is desired
function currentCumulativePrices() public view returns ( uint reserve0Cumulative, uint reserve1Cumulative, uint blockTimestamp ) { blockTimestamp = block.timestamp; reserve0Cumulative = reserve0CumulativeLast; reserve1Cu...
5,677,497
// SPDX-License-Identifier: None pragma solidity 0.6.12; import "../BoilerplateStrategy.sol"; import "../../interfaces/uniswap/IUniswapV2Router02.sol"; import "../../interfaces/curvefi/ICurveFi_Gauge.sol"; import "../../interfaces/curvefi/ICurveFi_Minter.sol"; import "../../interfaces/curvefi/ICurveFiWbtc.sol"; con...
Shows the balance of the strategy.
function balanceOf() external view override returns (uint256) { return investedUnderlyingBalance().add(IERC20(underlying).balanceOf(address(this))); }
482,155
pragma solidity >=0.4.21 <0.8.6; contract ArtemisTreasury { event Deposit(address indexed sender, uint amount, uint balance); event SubmitTransaction( address indexed owner, uint indexed txIndex, address indexed to, uint value, bytes data ); event ConfirmTransact...
Initiates the submission of a transaction in multi-sig wallet New Transaction struct is appended to the transaction array state variable _to Address to submit transaction _value The value of the transaction amount _data Any meta data associated with the transaction return An SubmitTransaction event is emitted at th...
function submitTransaction(address _to, uint _value, bytes memory _data) public onlyOwner { uint txIndex = transactions.length; transactions.push(Transaction({ to: _to, value: _value, data: _data, executed: false, numCo...
2,551,130
pragma solidity ^0.4.24; /** * @title ERC20Interface * @dev Standard version of ERC20 interface */ contract ERC20Interface { uint256 public totalSupply; function balanceOf(address _owner) public view returns (uint256 balance); function transfer(address _to, uint256 _value) public returns (bool ...
Function that burns an amount of the token of a given account. _account The account whose tokens will be burnt. _value The amount that will be burnt./
function burn(address _account, uint256 _value) onlyOwner public { require(_account != address(0)); totalSupply = totalSupply.sub(_value); balances[_account] = balances[_account].sub(_value); emit Burn(_account, _value); }
6,420,608
./full_match/1/0x85Ff72ef23C559881589Daa5C8Ed9698124eDE72/sources/lib/seaport-types/src/helpers/PointerLibraries.sol
Reads the bytes27 at `mPtr` in memory.
function readBytes27( MemoryPointer mPtr ) internal pure returns (bytes27 value) { assembly ("memory-safe") { value := mload(mPtr) } }
8,452,055
./partial_match/3/0x9C7FcB7eD4363075675344641E7cb5CC50bF7BF4/sources/FruitFarm.sol
Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through {transferFrom}. This is zero by default. This value changes when {approve} or {transferFrom} are called./
function allowance(address owner, address spender) public view virtual returns (uint256) { return _allowances[owner][spender]; }
5,185,007
./full_match/1/0x36967c741e2E9c3B012e7a85595D1e3Cc514B6e1/sources/TheScornablesContract.sol
Update merkle root to reflect changes in Allowlist _newMerkleRoot new merkle root to reflect most recent Allowlist/
function updateMerkleRoot(bytes32 _newMerkleRoot) public onlyTeamOrOwner { require(_newMerkleRoot != merkleRoot, "Merkle root will be unchanged!"); merkleRoot = _newMerkleRoot; }
3,162,923
./full_match/80001/0xd8d0A205062f074bE065125353CBaBb38441FEA7/sources/contracts/MyNFT.sol
This function is for whitelist mint of MyNFT _quantity: no. of NFTs to be minted _merkleProof: Proof for proving whitlelist status/
function whitelistMint( bytes32[] memory _merkleProof, uint256 _quantity ) external payable callerIsUser { if (!whiteListSale) { revert MyNFT__WhiteListSaleNotActive(); } if ((totalSupply() + _quantity) > MAX_SUPPLY) { revert MyNFT__ExceedsMaxSuppl...
9,490,009
// Tell the compiler which version of the compiler we are using pragma solidity ^0.4.8; // Simple Voting Contract. contract Ballot { // Events are our Dapp's window into what is happening in our smart contract // They are cheap to create, and saved in such a way that it is fast to find event Voted(address...
Add another proposal to our array `Proposal({...})` creates a temporary Proposal object and `proposals.push(...)` appends it to the end of `proposals`.
function addProposal(string newProposal, string desc){ proposals.push(Proposal({ name: newProposal, description: desc, voteCount: 0 })); }
2,545,774
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...
Sets the minimum stake, can only be called by the appeals resolver./
function setMinimumStake(uint256 _minimumStake) public onlyAppealsResolver { emit MinimumStakeChanged(minimumStake_, _minimumStake, appealsResolver_); minimumStake_ = _minimumStake; }
12,554,537
./full_match/1/0x9b20bAd4B7759ECa269a4B2607A2999f39820698/sources/contracts/LSDai.sol
Deposit DAI and mint LSDAI. to The address to mint LSDAI to. daiAmount The amount of DAI to deposit. permitNonce The nonce of the permit signature. permitExpiry The deadline timestamp, type(uint256).max for no deadline. permitV The recovery byte of the signature. permitR Half of the ECDSA signature pair. permitS...
function depositWithPermit( address to, uint256 daiAmount, uint256 permitNonce, uint256 permitExpiry, uint8 permitV, bytes32 permitR, bytes32 permitS ) external returns (uint256) { dai.permit(msg.sender, address(this), permitNonce, permitExpiry, true, permitV, permitR, permitS); ...
2,904,908
// SPDX-License-Identifier: MIT pragma solidity =0.8.10; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; /// @title LPTokenWrapper /// @author Pavle Batuta <pavle@batuta,xyz> /// @notice Defines stake/withdraw/balanceOf functions for an LP Token contract LPTokenWrapper { using SafeERC20 for IERC...
Stake a given amount of tokens to the given account amount The amount to stake account The account to stake to
function stake(uint256 amount, address account) public virtual { _totalSupply += amount; _balances[account] = _balances[account] + amount; }
12,677,724
./partial_match/1/0x5648DFBDBd74F91D01B454aee0D11CEbc60810B4/sources/WebQDeployer.sol
Check how many NFTs that have been minted by minter. minter whoever wants to mint spNFT. return minted quantity of NFTs minted by minter./
function mintedNFT(address minter) external view returns(uint256 minted){ (minted,,) = NFT.getMintStats(minter); }
15,674,562
./partial_match/42/0x593eCfA63A5805bAd11d039084986094072e1CF9/sources/XSwapProxyV1.sol
IXPool pool = IXPool(poolAddress); address[] memory tokens = pool.getFinalTokens(); require(maxAmountsIn.length == tokens.length, "ERR_LENGTH_MISMATCH"); bool hasEth = false; for (uint8 i = 0; i < tokens.length; i++) { if (msg.value > 0 && tokens[i] == address(weth)) { transferFromAllAndApprove( ...
function joinPool( uint256[] memory maxAmountsIn, address poolAddress, uint256 poolAmountOut ) public payable nonReentrant{ uint256 amount=msg.value; }
9,090,864
pragma solidity 0.4.24; contract ERC20Interface { event Transfer( address indexed from, address indexed to, uint256 value ); event Approval( address indexed owner, address indexed spender, uint256 value ); function totalSupply() public view returns (uint256); function balanceOf(...
Once set, it can not be changed.
function setChickenHunt(address _chickenHunt) public onlyManager { require(chickenHunt == address(0)); chickenHunt = ChickenTokenDelegate(_chickenHunt); }
1,143,674
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "../reputation/IR...
cancel collateral function and return back collateral _collateralId is id of collateral/ Remove relation of collateral and offers
function withdrawCollateral( uint256 _collateralId ) external whenNotPaused { Collateral storage collateral = collaterals[_collateralId]; require(collateral.owner == msg.sender, 'owner'); require(collateral.status == CollateralStatus.OPEN, 'col'); safeTransfer(collateral...
13,053,762
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.8.7 <0.9.0; contract Monolith { address[] private devs; mapping(address => uint256) public credits; uint256 public creditCap; constructor(uint256 initCreditCap, address[] memory coFounders) { creditCap = initCreditCap; devs.push(msg.sender); ...
uint[] memory admins = getAdmins();
function dropCredit() public { require(getAdmins().length > 1, "NO! you are our only hope!"); credits[msg.sender]--; }
2,561,909
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity 0.8.10; /******************************************************************************\ * Author: Evert Kors <[email protected]> (https://twitter.com/evert0x) * Sherlock Protocol: https://sherlock.xyz /*******************************************************...
Function used to check if this is the current active distribution manager return Boolean indicating it's active If inactive the owner can pull all ERC20s and ETH Will be checked by calling the sherlock contract
function isActive() public view override returns (bool) { return address(sherlockCore.sherDistributionManager()) == address(this); }
10,256,261
pragma solidity ^0.4.23; /* * Creator: H2C (Help2Crypto) */ /* * Abstract Token Smart Contract * */ /* * Safe Math Smart Contract. * https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol */ contract SafeMath { function mul(uint256 a, uint256 b) internal pure return...
Maximum allowed number of tokens in circulation. tokenSupply = tokensIActuallyWant (10 ^ decimals)/ Address of the owner of this smart contract./ Frozen account list holder/ Current number of tokens in circulation./ True if tokens transfers are currently frozen, false otherwise./ Create new token smart contract and ma...
function H2CToken () { owner = msg.sender; }
10,846,919
./full_match/3/0x521abc9edF3c24DbE0517AF6f6e981Ed2663E7FA/sources/browser/Maindapp_degen.sol
require(IERC20(platformToken).balanceOf(msg.sender) >= minPlatTokenReq, "Not enough platform token");
function SafeGovernRefund() public{ require (now > governEndTime, "Voting has not finished yet"); require (EnableGovernRefund, "Voting Not Finalized"); require (!Voter[msg.sender].refunded && Voter[msg.sender].EthRefunded == 0, "User already took the refund"); Voter[msg.sender].refunded =...
14,146,196
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return...
init parter/require(_amount == 210000);
function setParter(address _parter, uint256 _amount) public onlyOwner { require(parterAcc.length <= 49); parterAcc.push(_parter); frozenBalances[_parter] = _amount; SetParter(_parter, _amount); }
7,636,867
./full_match/100/0xF4572223496ECFeEF8A11b059180de4906c75627/sources/project_/contracts/agreements/InstantDistributionAgreementV1.sol
IInstantDistributionAgreementV1.calculateDistribution implementation
function calculateDistribution( ISuperfluidToken token, address publisher, uint32 indexId, uint256 amount ) external view override returns( uint256 actualAmount, uint128 newIndexValue) { bytes32 iId = _getPublisherId(publisher, ...
14,280,625
./full_match/4/0x559Ec7fdfb759Bfd1Bb6751b7abDDF11Ef60cAA4/sources/contracts/rarible/LibERC1155LazyMint.sol
checks if _tokenURI starts with base. if true returns _tokenURI, else base + _tokenURI
function checkPrefix(string memory base, string memory _tokenURI) internal pure returns (string memory) { bytes memory whatBytes = bytes(base); bytes memory whereBytes = bytes(_tokenURI); if (whatBytes.length > whereBytes.length) { return string(abi.e...
12,316,788
pragma solidity >=0.5.4 <0.6.0; // ---------------------------------------------------------------------------- // 'ERCT' 'Eracoin Token' token contract // // Symbol : ERCT // Name : Eracoin Token // Total supply: 300,000,000.000000000000000000 // Decimals : 18 // // ------------------------------------...
inject NONSTANDARD NAMING
function BURN816(uint256 _value) public returns (bool success) {
13,041,319
./partial_match/4/0xFD75D3c9B541b2C9d0eD644832d67A4C381Aab15/sources/Vault.sol
==================== 策略相关 ====================
function futureStrategy() public view returns(address) { return _futureStrategy(); }
8,526,237
pragma solidity ^0.4.16; pragma experimental "v0.5.0"; pragma experimental "ABIEncoderV2"; import {ExactMath} from "../src/math/ExactMath.sol"; contract MathExamples { using ExactMath for int; using ExactMath for uint; // Add exact uints example. function uintExactAddOverflowExample() public pure {...
Multiply exact uints example.
function uintExactMulOverflowExample() public pure { var n = uint(~0); n.exactMul(2); }
2,563,914