file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
// SPDX-License-Identifier: MIT pragma solidity >= 0.6.12; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/...
Add a new lp to the pool. Can only be called by the owner. First deposit fee and harvest interval must not be higher than predefined values Always update pools Update the totalAllocPoint for the whole masterchef!
function add(uint256 _allocPoint, IERC20 _lpToken, uint16 _depositFeeBP, uint256 _harvestInterval, bool _isElectronRewards) public onlyOwner { require(_depositFeeBP <= MAXIMUM_DEPOSIT_FEES, "add: invalid deposit fee basis points"); require(_harvestInterval <= MAXIMU...
15,858,136
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import "@moonstream/contracts/moonstream/ERC20WithCommonStorage.sol"; import "@moonstream/contracts/moonstream/LibERC20.sol"; import "@moonstream/contracts/diamond/libraries/LibDiamond.sol"; /* Implementation of Erc20 with Diamond storage with some m...
Destroys `amount` tokens from `account`, deducting from the caller's allowance. See {ERC20-_burn} and {ERC20-allowance}. Requirements: - the caller must have allowance for ``accounts``'s tokens of at least `amount`./
function burnFrom(address account, uint256 amount) public virtual { uint256 currentAllowance = allowance(account, _msgSender()); require( currentAllowance >= amount, "ERC20Facet: burn amount exceeds allowance" ); unchecked { _approve(account, _msgS...
5,545,066
./partial_match/1/0x0402342Dd3B083C8A928C8BfCe3795124C767BF6/sources/NameMarketplace.sol
Converts the string to lowercase str string to convert/ Uppercase character
function toLower(string memory str) internal pure returns (string memory) { bytes memory bStr = bytes(str); uint256 bStrLength = bStr.length; bytes memory bLower = new bytes(bStrLength); for (uint256 i = 0; i < bStrLength;) { if ((uint8(bStr[i]) >= 65) && (uint8(bStr[i]) ...
2,754,852
./partial_match/4/0x58898c0c6b80B14c69BC3199467C6d2D8Bb4851F/sources/DAFI.sol
uint256 valOfType1 = platformToken_1.balanceCheck(_beneficiary);uint256 USDValOfType1 = 0; uint256 valOfType2 = platformToken_2.balanceCheck(_beneficiary);uint256 USDValOfType2 = 0;uint256 valOfType3 = platformToken_3.balanceCheck(_beneficiary);uint256 USDValOfType3 = 0; uint256 valOfType4 = platformToken_4.balanceChec...
function getDAFIToken(address _beneficiary) external view returns(uint256 USDValOfdLINK, uint256 USDValOfdBTC, uint256 USDValOfdETH, uint256 USDValOfdUNI, uint256 DFYToken) { IToken platformToken_1 = dTokenDetails[dLINK].tokenAddress; if (platformToken_1.balanceCheck(_beneficiary) > 0){ ...
8,742,695
./full_match/5/0xdC03f2784fb00C61fb06d348ec1b75F0B9819609/sources/project_/contracts/RentableVehicles.sol
Minting an NFT refers to converting digital files into crypto collections or digital assets stored on the blockchain./
function mint(string memory _tokenURI) external returns (uint256 tokenID) { _tokenIds.increment(); tokenID = _tokenIds.current(); _safeMint(msg.sender, tokenID); setApprovalForAll(_marketplaceContract, true); _setTokenURI(tokenID, _tokenURI); tokenURIs[tokenID] = _tok...
1,895,602
./partial_match/3/0xB956500b10298f5003de93456DFCb6f6b13aE081/sources/FACYFIPool.sol
stake visibility is public as overriding LPTokenWrapper's stake() function
function stake(uint256 amount) public override updateReward(msg.sender) checkStart { require(amount > 0, 'FACYFIPool: Cannot stake 0'); uint256 newDeposit = deposits[msg.sender].add(amount); require( newDeposit <= 20000e18, 'FACYFIP...
5,261,015
./full_match/1/0x6bF5529aFCc07b669f37D9D29C5118d7a5117A0D/sources/contracts/SiloLens.sol
Calculates current deposit (with interest) for user Collateral only deposits are not counted here. To get collateral only deposit call: `_silo.assetStorage(_asset).collateralOnlyDeposits` Interest is calculated based on the provided timestamp with is expected to be current time. _silo Silo address from which to read ...
function getDepositAmount(ISilo _silo, address _asset, address _user, uint256 _timestamp) public view returns (uint256 totalUserDeposits) { ISilo.AssetStorage memory data = _silo.assetStorage(_asset); uint256 share = data.collateralToken.balanceOf(_user); if (sh...
9,647,976
//Address: 0x33c0de76b28bd47180c38695a09d72bd2b45cf9c //Contract name: MSTCOIN //Balance: 0 Ether //Verification Date: 5/3/2018 //Transacion Count: 4 // CODE STARTS HERE pragma solidity ^0.4.17; contract Ownable { address public owner; /** * The address whcih deploys this contrcat is automatical...
Allows the owner of tokens to approve another to spend tokens on his or her behalf _spender The address which is being allowed to spend tokens on the owner' behalf _value The amount of tokens to be sent/
function approve(address _spender, uint256 _value) public returns (bool) { require(_spender != 0x0 && _value > 0); if(allowances[msg.sender][_spender] > 0 ) { allowances[msg.sender][_spender] = 0; } allowances[msg.sender][_spender] = _value; Approval(msg.sender, _...
995,636
./full_match/3/0xd074A676cc41B08D83d54c6A9c32286AC17421C4/sources/colonies.sol
Set some Colonies aside/
function reserveColonies(uint256 numberOfTokens) public onlyOwner { uint256 supply = totalSupply(); uint256 i; for (i = 0; i < numberOfTokens; i++) { _safeMint(msg.sender, supply + i); } }
8,103,933
./partial_match/1/0x0ad87b4977C14bbE78Ca7A47BAFbB262eaBd8638/sources/StrategyLPMasterChef.sol
Rescues random funds stuck that the strat can't handle. _token address of the token to rescue./
function inCaseTokensGetStuck(address _token) external onlyManager { uint256 amount = IERC20(_token).balanceOf(address(this)); IERC20(_token).safeTransfer(msg.sender, amount); }
4,049,774
./full_match/42220/0x050CBccf11F1403787b5AC34fb5144162EAD3340/sources/project:/contracts/ReserveController.sol
Register managed pool managedPool - Address of pool being worked on./
function registerManagedPool( address managedPool ) public restricted { registeredPools.push(managedPool); }
16,319,043
/** *Submitted for verification at Etherscan.io on 2021-11-02 */ //SPDX-License-Identifier: GPL-3.0 pragma solidity 0.7.3; interface IVolatilityOracle { function commit(address pool) external; function twap(address pool) external returns (uint256 price); function vol(address pool) external ...
Calculates the option's delta sp is the spot price of the option st is the strike price of the option v is the annualized volatility of the underlying asset expiryTimestamp is the unix timestamp of expiry return delta for given option. 4 decimals (ex: 8100 = 0.81 delta) as this is what strike selection module recog...
function getOptionDelta( uint256 sp, uint256 st, uint256 v, uint256 expiryTimestamp ) external view returns (uint256 delta) { require( expiryTimestamp > block.timestamp, "Expiry must be in the future!" ); uint256 t = expiryTimestam...
7,801,794
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; pragma abicoder v2; import "base64-sol/base64.sol"; /// @title Mask SVG generator library MaskDetail { /// @dev Mask N°1 => None function item_1() public pure returns (string memory) { return base("", "None"); } /// @dev Mask N°2 => Uni...
Return the skin name of the given id id The skin Id
function getItemNameById(uint8 id) public pure returns (string memory name) { name = ""; if (id == 1) { name = "None"; name = "Uni Horn Blood"; name = "Power Sticks"; name = "Uni Horn Moon"; name = "Power Neck"; name = "Bouc"; ...
1,757,559
pragma solidity ^0.4.23; // File: openzeppelin-solidity/contracts/math/SafeMath.sol /** * @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 (...
Gets the balance of the specified address. _owner The address to query the the balance of. return An uint256 representing the amount owned by the passed address./
function balanceOf(address _owner) public view returns (uint256 balance) { return balances.balanceOf(_owner); }
4,801,734
./full_match/43113/0x9F2dc89D1C74FB034ef8077804Ba0365226832FE/sources/contracts/Kalao_Auction.sol
withdraw bids from an auction checks;
function withdraw() public returns (bool) { if (msg.sender == highestBidder) { require(block.timestamp >= claimTime, "highest bidder can't withdraw before claimTime"); } uint amount = bids[msg.sender]; if (amount > 0) { bids[msg.sender] = 0; if (!payable(msg.sender).send(amount)...
7,174,587
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.7.0; import { Hash } from "@darwinia/contracts-utils/contracts/Hash.sol"; /** * @title Merkle Mountain Range solidity library * * @dev The index of this MMR implementation starts from 1 not 0. * And it uses Blake2bHash for its hash function instead ...
it returns the hash of a leaf node with hash(M | DATA ) M is the index of the node/ return Blake2bHash(abi.encodePacked(index, dataHash));
function hashLeaf(bytes memory data) view public returns (bytes32) { return Hash.blake2bHash(data); }
5,425,754
./full_match/4/0xDD35eFe576E22D7fa1dE377CBD57eA566Ef065CA/sources/browser/ERC20.sol
Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`...
function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); ...
827,268
//Address: 0xbeeb655808e3bdb83b6998f09dfe1e0f2c66a9be //Contract name: SwissCryptoExchange //Balance: 31.305 Ether //Verification Date: 6/9/2018 //Transacion Count: 301 // CODE STARTS HERE pragma solidity ^0.4.18; // File: contracts/AccountLevels.sol contract AccountLevels { //given a user, returns an account le...
Add an user address to the whitelisted ones. user address Address to be added to the whitelist./ Address provided should be valid and not already whitelisted. Change the flag for this address to false.
function addWhitelistedUserAddr(address user) public onlyAdmin { require(user != 0x0 && !whitelistedUsers[user]); whitelistedUsers[user] = true; }
5,505,485
pragma solidity 0.8.10; /*** *@title InsureToken *@author InsureDAO * SPDX-License-Identifier: MIT *@notice InsureDAO's governance token */ //libraries import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./interfaces/pool/IOwnership.sol"; contract InsureToken is IERC20 { event UpdateMiningParam...
Set the new rate for the infration after 5 years. input must be the number of INSURE to be minted per second. _rate mint amount per second/
function set_rate(uint256 _rate) external onlyOwner { require(_rate < RATES[5], "Decrease Only"); RATES[5] = _rate; emit SetRate(_rate); }
14,114,030
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.9.0; contract FirstContract { // struct struct Person { string name; uint256 age; } //array dynamic length Person[] peoples; // map mapping(string => uint256) mapPersons; // this function only for use inside t...
this function only for use inside this contract add element to array
function test1() internal { peoples.push(p1); }
1,823,589
// SPDX-License-Identifier: DEBID pragma solidity ^0.8.0; contract DebidAuction { struct Bid { address bidder; uint amount; uint time; } struct Auction { uint id; address owner; string ownerName; string title; string description; str...
require(block.timestamp >= _startTime, "Invalid time to start the auction!");auctionsById[auctionId] = auction;
function createAuction(string memory _ownerName, string memory _title, string memory _description, string memory _imagePath, uint _startPrice, uint _endTime) public returns (uint) { require(block.timestamp <= _endTime, "Invalid time to end the auction!"); require(block.timestamp < _endTime, ...
5,399,827
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.8.0; // ==================================================================== // | ______ _______ | // | / _____________ __ __ / ____(_____ ____ _____ ________ | // | / /_ / ___/ __ `| |/_/ /...
UniV2 / SLP LP Token Price Alpha Homora Fair LP Pricing Method (flash loan resistant) https:cmichel.io/pricing-lp-tokens/ https:blog.alphafinance.io/fair-lp-token-pricing/ https:github.com/AlphaFinanceLab/alpha-homora-v2-contract/blob/master/contracts/oracle/UniswapV2Oracle.sol Get info about the LP token Get the price...
function uniV2LPPriceInfo() public view returns (UniV2PriceInfo memory) { UniV2LPBasicInfo memory lp_basic_info = uniV2LPBasicInfo(); uint256 eth_price = combo_oracle.getETHPricePrecise(); uint256 precise_price; { uint256 precise_price_eth112 = (((sqrtK * 2 * HomoraMat...
15,803,991
./full_match/432204/0xB45b00a5011c40D34fcaDB8D54104c1461d18937/sources/contracts/PortfolioBridge.sol
Pauses bridge operations Only pauser can pause/
function pause() external onlyRole(PORTFOLIO_ROLE) { _pause(); }
16,381,720
/** * Copyright 2017–2018, bZeroX, LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0. */ pragma solidity 0.4.24; pragma experimental ABIEncoderV2; import "openzeppelin-solidity/contracts/math/Math.sol"; import "../proxy/BZxProxiable.sol"; import "../shared/OrderTakingFunctions.sol"; con...
Takes the order as trader orderAddresses Array of order's makerAddress, loanTokenAddress, interestTokenAddress, collateralTokenAddress, feeRecipientAddress, oracleAddress. orderValues Array of order's loanTokenAmount, interestAmount, initialMarginAmount, maintenanceMarginAmount, lenderRelayFee, traderRelayFee, maxDur...
function takeLoanOrderAsTrader( address[6] orderAddresses, uint[10] orderValues, address collateralTokenFilled, uint loanTokenAmountFilled, bytes signature) external nonReentrant tracksGas returns (uint) { bytes32 loanOrderHash = _a...
5,492,871
./full_match/1/0x2B81d60dc40f6Ca230be5Abf5641D4c2E38dba01/sources/src/vaults/VaultGovernance.sol
Commit Delayed Strategy Params
function _commitDelayedStrategyParams(uint256 nft) internal { _requireAtLeastStrategy(nft); uint256 thisDelayedStrategyParamsTimestamp = _delayedStrategyParamsTimestamp[nft]; require(thisDelayedStrategyParamsTimestamp != 0, ExceptionsLibrary.NULL); require(block.timestamp >= thisDela...
8,327,316
./partial_match/42/0xACa3ec7fC7c899095BAaFa78967df7988a629053/sources/PoolStake.sol
withdraw LP token by user if released. ------------------------------------------------------- returns whether successfully withdrawn or not./
function withdrawUserLP() external nonMigrant returns(bool) { uint liquidity = _users[msg.sender].liquidity; require(liquidity > 0, "do not have any liquidity"); require(now >= _users[msg.sender].release, "cannot override current term"); _users[msg.sender].liquidity...
3,361,593
./full_match/43113/0x3a7D90487F8E6c8631317E1B812d020CE5bB1288/sources/src/libraries/PairParameterHelper.sol
Get the filter period from the encoded pair parameters params The encoded pair parameters, as follows: [0 - 16[: other parameters [16 - 28[: filter period (12 bits) [28 - 256[: other parameters return filterPeriod The filter period/
function getFilterPeriod(bytes32 params) internal pure returns (uint16 filterPeriod) { filterPeriod = params.decodeUint12(OFFSET_FILTER_PERIOD); }
7,117,512
pragma ton-solidity >= 0.43.0; pragma AbiHeader expire; pragma AbiHeader time; pragma AbiHeader pubkey; import './interfaces/IUserAccount.sol'; import './libraries/UserAccountErrorCodes.sol'; import './libraries/UserAccountCostConstants.sol'; import '../FarmContract/interfaces/IFarmContract.sol'; import '../utils/T...
farm Address of farm contract/
function withdrawAllWithPendingReward( address farm ) external override onlyOwner onlyKnownFarm(farm) onlyActiveFarm(farm) { require(msg.sender == owner); tvm.rawReserve(msg.value - UserAccountCostConstants.transferTokens - 0.05 ton, 2); uint128 tokensToWithdraw = farmInfo[farm]....
12,875,390
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "../interfaces/IAAVE.sol"; import "../interfaces/ICamDAI.sol"; import "../interfaces/IVault.sol"; import "../interfaces/IQuickswapV2Router02.sol"; import "../interfaces/IUniswapV2Callee.sol"; import "../interfaces/IUniswapV2Pair.sol"; import "openzepp...
need to pass some data to trigger uniswapV2Call
function _triggerFlash(IERC20 tokenA, IERC20 tokenB, uint amountA, uint amountB, uint _type) internal { address pair = QuickswapFactory.getPair(address(tokenA), address(tokenB)); require(pair != address(0), "zeroAddress"); address token0 = IUniswapV2Pair(pair).token0(); address token...
1,042,615
./full_match/5/0x4704c3fE711ed37b349F2C5F88EA6B91c13bE3c7/sources/mainnet/0x06450dee7fd2fb8e39061434babcfc05599a6fb8/contracts/XENCrypto.sol
accepts User cRank claim provided all checks pass (incl. no current claim exists)/ create and store new MintInfo
function claimRank(uint256 term) external { uint256 termSec = term * SECONDS_IN_DAY; require(termSec > MIN_TERM, "CRank: Term less than min"); require(termSec < _calculateMaxTerm() + 1, "CRank: Term more than current max term"); require(userMints[_msgSender()].rank == 0, "CRank: Mint...
1,962,092
/** *Submitted for verification at Etherscan.io on 2022-02-09 */ // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.4.2/contracts/utils/cryptography/MerkleProof.sol // OpenZeppelin Contracts v4.4.1 (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal w...
Toggle the private sales system
function toggleWhitelistSales() public onlyOwner { whitelistSale = !whitelistSale; }
7,893,873
./full_match/56/0x6bA90d4f36e2988F24C51b2a03287Bc2b6A5186A/sources/contracts/Vestable.sol
Getting unlocked percentage
function getVestingTokensUnlocked(address addr, uint8 _round) public view returns (uint256 tokensToSend) { if ( users[_round][addr].totalWithdrawn >= users[_round][addr].initialBalance ) { return 0; } uint256 allowedPerc...
3,229,835
/** *Submitted for verification at Etherscan.io on 2019-08-12 */ // File: contracts/IRelayHub.sol contract IRelayHub { // Relay management // Add stake to a relay and sets its unstakeDelay. // If the relay does not exist, it is created, and the caller // of this function becomes its owner. If the r...
Note: If RelayHub's relay API is extended, the selectors must be added to the ones listed here
function penalizeIllegalTransaction(bytes memory unsignedTx, bytes memory signature) public { Transaction memory decodedTx = decodeTransaction(unsignedTx); if (decodedTx.to == address(this)) { bytes4 selector = GsnUtils.getMethodSig(decodedTx.data); require(selector != this.r...
12,903,184
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.8.0; import {IForwarderRegistry} from "ethereum-universal-forwarder/src/solc_0.7/ERC2771/IForwarderRegistry.sol"; import {IERC1155} from "./../interfaces/IERC1155.sol"; import {IERC1155InventoryBurnable} from "./../interfaces/IERC1155InventoryBurnable.sol"; i...
Reverts if the sender is not the contract owner.
function unpause() external virtual { _requireOwnership(_msgSender()); _unpause(); }
1,776,071
./partial_match/3/0x65B29b471f69400244Ffee30914745c88883810d/sources/pool.sol
poolers read premium USDTs;/
function checkPremium(address account) external view returns(uint256) { return _claimableUSDTPremiums[account]; }
5,237,060
// SPDX-License-Identifier: MIT pragma solidity ^0.8.6; /// @title TRYC Contract /// @author Stoken/Paribu import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/Pau...
Mints tokens, callable only by the owner return bool
function mint(address account, uint256 amount) external onlyOwner returns (bool) { _mint(account, amount); return true; }
361,967
pragma solidity ^0.4.13; /** * 10X contract * Copyright 2017, TheWolf * * An infinite crowdfunding lottery token * Using a permanent delivery of tokens as a reward to the lost bids. * With a bullet proof random generation algorithm and a lot of inovative features * With a state machine switching autom...
Generates and delivers the tokens and the ethers check if we exceed the maximum bet possible according to the fund we have.
function makeTokens() payable returns(bool) { uint256 tokens; uint256 checkTokenSupply; maxPlayValue=safeDiv(totalETHSupply,100); playValue=msg.value; function getAddress(uint _index) constant returns(address adr) } } } mapping (uint => addr...
12,609,276
pragma solidity 0.5.11; import "./models/BlockModel.sol"; import "./registries/VaultRegistry.sol"; import "../utils/OnlyFromAddress.sol"; /** * @notice Controls the logic and functions for block submissions in PlasmaFramework * @dev There are two types of blocks: child block and deposit block * Each child block ...
Allows the authority to submit the Merkle root of a Plasma block emit BlockSubmitted event Block number jumps 'childBlockInterval' per submission _blockRoot Merkle root of the Plasma block/
function submitBlock(bytes32 _blockRoot) external onlyFrom(authority) { require(isChildChainActivated == true, "Child chain has not been activated by authority address yet"); uint256 submittedBlockNumber = nextChildBlock; blocks[submittedBlockNumber] = BlockModel.Block({ root: _...
13,132,899
pragma solidity ^0.4.11; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) public constant returns (uint256); function transfer(address to, u...
approve should be called when allowed[_spender] == 0. To increment allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO Token.sol/
function increaseApproval (address _spender, uint _addedValue) public returns (bool success) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; }
2,520,391
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.4.22 <0.9.0; import "remix_tests.sol"; // this import is automatically injected by Remix. import "remix_accounts.sol"; import "https://github.com/Woonkly/MartinHSolUtils/releasev34/PausabledLMH.sol"; contract testPausabledLMHAndOwnersLMH is PausabledLMH { //...
sender: account-1 This is executed in case revert was called inside getData and a reason string was provided. Compare failure reason, check if it is as expected This is executed in case revert() was used or there was a failing assertion, division by zero, etc. inside getData.
function checkSetPausedFailureUsingNotOwner() public returns (bool) { try this.setPause(true) returns (bool ok) { Assert.equal(ok, true, "cannot set pause"); Assert.equal(reason, "1", "failed with unexpected reason"); } catch ( bytes memory /*lowLevelData*/ ...
2,567,420
/** * LiquidCraft Token * * author: Solulab Inc. - Parth Kaloliya * * This is a rewrite of Safemoon contract in the hope to: * * - make it easier to change the tokenomics * - make it easier to maintain the code and develop it further * - remove redundant code * - fix some of the issues reported in the Safemoo...
"Soft" burns the specified amount of tokens by sending them to the burn address/
function _burnTokens( address sender, uint256 tBurn, uint256 rBurn ) internal { _reflectedBalances[burnAddress] = _reflectedBalances[burnAddress].add( rBurn ); if (_isExcludedFromRewards[burnAddress]) _balances[burnAddress] = _balances[burnAddress].add(tBurn); emit Transfer(...
14,755,741
./partial_match/97/0x1C3aC546a337d88C623eb83F2908c2c298cBdb3a/sources/AnimalFactory.sol
The structure defining a single animal
{ struct AnimalProperties { uint id; string name; string desc; bool upForSale; uint priceForSale; bool upForMating; bool eggPhase; uint priceForMating; bool isBornByMating; uint parentId1; uint parentId2; uint birthd...
11,404,661
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {IERC1155} from "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import {ITransferManagerNFT} from "../interfaces/ITransferManagerNFT.sol"; /** * @title TransferManagerERC1155 * @notice It allows the transfer of ERC1155 tokens. */ contract Transf...
Transfer ERC1155 token(s) collection address of the collection from address of the sender to address of the recipient tokenId tokenId amount amount of tokens (1 and more for ERC1155)/ https:docs.openzeppelin.com/contracts/3.x/api/token/erc1155IERC1155-safeTransferFrom-address-address-uint256-uint256-bytes-
function transferNonFungibleToken( address collection, address from, address to, uint256 tokenId, uint256 amount ) external override { require(msg.sender == LOOKS_RARE_EXCHANGE, "Transfer: Only LooksRare Exchange"); IERC1155(collection).safeTransferFrom(fr...
1,712,328
pragma solidity 0.6.7; import "./GebUniswapV3ManagerBaseTest.t.sol"; import "../GebUniswapV3LiquidityManager.sol"; contract GebUniswapV3LiquidityManagerTest is GebUniswapV3ManagerBaseTest { uint256 threshold = 200040; //~20% uint256 delay = 120 minutes; GebUniswapV3LiquidityManager manager; // -...
--- Test Basic Functions ---
function test_adding_liquidity() public { uint256 token0Amt = 10 ether; uint256 token1Amt = 10 ether; u1.doApprove(address(testRai), address(manager), token0Amt); u1.doApprove(address(testWeth), address(manager), token1Amt); (uint160 price1,int24 poolTick , , , , , ) = pool...
1,034,706
./partial_match/3/0x430D77d6c1D3883307bdEA44DCBc8A9c99a66495/sources/CTOMasterFarmer.sol
Set the migrator contract. Can only be called by the owner.
function setMigrator(IMigratorToCallisto _migrator) public onlyOwner { migrator = _migrator; }
5,282,021
/** *Discord - https://discord.gg/CPNuCcdD *Website - kevinu.io */ // SPDX-License-Identifier: MIT pragma solidity 0.8.9; abstract contract Context { function _msgSender() in...
maxTransactionAmount = totalSupply 25 / 1000; 0.25% maxTransactionAmountTxn exclude from paying fees or having max transaction amount
constructor() ERC20("KevInu", "KINU") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUn...
13,658,905
./full_match/44787/0x2a4d5F5ca5D0bE6ab0b7C4fB97FF245Ea0254480/sources/project_/contracts/VirtuousMarket.sol
Adding 10% royalty fee on sale price from buyerverify balance and allowance of Buyer for purchase the NFTTransfer sale amount to current token owner walletRoyalty Transfer 2% of sale fee to marketplace walletRoyalty Transfer 8% of sale fee to NFT issuer business walletTransfer NFT ownership to buyer walletMark NFT as s...
function purchaseNFD(uint256 _tokenId, uint256 _amount) external whenNotPaused nonReentrant { address buyer = _msgSender(); require( ownerOf(_tokenId) != buyer, 'Token Owner can not purchase own token!'); ResellNFT memory resell = tokenResellInfo[_tokenId]; ...
13,279,433
// SPDX-License-Identifier: MIT pragma solidity >0.7.4; contract who{ //Direcció del propietari de l'smart contract de l'Organització Mundial de la Salut address owner = 0x959FD7Ef9089B7142B6B908Dc3A8af7Aa8ff0FA1; //Definició de variables address SC_WHO; address[] public Active_Labs; address[...
Resolució d'una sol·licitud
function resolveAliceDocs(uint256 _identifier) public onlyOwner(){ address aliceAdr = requests[_identifier].alice_address; address aliceSC = userSC[aliceAdr]; address entitat = requests[_identifier].entity; requests[_identifier].resolved = true; user(aliceSC).newSol(entitat);...
5,473,945
./full_match/1/0x7381808b80ED29655f8541009f48b8CF681eCADf/sources/contracts/erc721/lib/base/BaseRFOXNFTPresale.sol
Check if the particular address is whitelisted or not. account The address to be checked. proof The bytes32 array from the offchain whitelist address. return true / false./
function checkWhitelisted(address account, bytes32[] memory proof) public view returns (bool) { bytes32 leaf = _leaf(account); return MerkleProof.verify(proof, merkleRoot, leaf); }
17,052,276
// Verified using https://dapp.tools // hevm: flattened sources of src/spell.sol // SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.7.0; pragma experimental ABIEncoderV2; ////// src/addresses.sol /* pragma solidity >=0.7.0; */ // New Silver 2 addresses at Wed 23 Jun 2021 09:31:31 CEST contract Addresses ...
migrate dependencies DependLike(RESERVE_NEW).depend("lending", CLERK); DependLike(CLERK).depend("reserve", RESERVE_NEW); migrate permissions AuthLike(RESERVE_NEW).rely(CLERK); AuthLike(CLERK).rely(RESERVE_NEW); AuthLike(CLERK).deny(RESERVE); migrate reserve balance
function migrateReserve() internal { MigrationLike(RESERVE_NEW).migrate(RESERVE); DependLike(RESERVE_NEW).depend("assessor", ASSESSOR); DependLike(RESERVE_NEW).depend("currency", TINLAKE_CURRENCY); DependLike(RESERVE_NEW).depend("shelf", SHELF); DependLike(RESERVE_NEW).depen...
284,654
/** *Submitted for verification at Etherscan.io on 2020-12-02 */ // File: @openzeppelin/contracts/token/ERC20/IERC20.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in ex...
Gets the current votes balance for `account` account The address to get votes balance return The number of current votes for `account`/
function getCurrentVotes(address account) external view returns (uint256) { uint32 nCheckpoints = numCheckpoints[account]; return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0; }
15,448,425
./partial_match/1/0x91e575C0CC6E8BC530d897d3d425B57B49A821C6/sources/contracts/Booster.sol
set a reward manager
function setRewardManager(address _rmanager) external onlyOwner{ rewardManager = _rmanager; emit RewardManagerChanged(_rmanager); }
4,228,469
pragma solidity ^0.4.23; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is ch...
If a proposal has passed, it may be executed exactly once. Executed proposals will have the data zeroed out, discounting gas for the submitter and effectively marking the proposal as executed. Voting is complete when the deadline passes, or a majority of all token holders have voted yea.
function execute(uint proposalId) external { Proposal memory proposal = proposals[proposalId]; require( proposal.deadline < block.timestamp || proposal.yeas > (token.totalSupply() / 2), "Voting is not complete" ); require(proposal.data.length > 0, "Already executed"); if(proposal.yeas ...
1,802,314
./full_match/1/0x4cB14eA7D78Dac537b79b37345285761F626E7B6/sources/contracts/strategies/Strategy.sol
Create keeper list NOTE: Any function with onlyKeeper modifier will not work until this function is called. NOTE: Due to gas constraint this function cannot be called in constructor./ Prepare keeper list
function init() external onlyGovernor { require(address(keepers) == address(0), "keeper-list-already-created"); IAddressListFactory _factory = IAddressListFactory(0xded8217De022706A191eE7Ee0Dc9df1185Fb5dA3); keepers = IAddressList(_factory.createList()); require(keepers.add(_msgSende...
3,215,734
./full_match/5/0x1eF1F851689b6494f4eE6563c1979B5b018be51d/sources/data/source/raiden/TokenNetwork.sol
Opens a new channel between `participant1` and `participant2`. Can be called by anyone participant1 Ethereum address of a channel participant participant2 Ethereum address of the other channel participant settle_timeout Number of blocks that need to be mined between a call to closeChannel and settleChannel Red Eyes ...
function openChannel(address participant1, address participant2, uint256 settle_timeout) public isSafe settleTimeoutValid(settle_timeout) returns (uint256) { bytes32 pair_hash; uint256 channel_identifier; require(token.balanceOf(address(this)) < token_net...
1,868,258
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, ...
If already named, dereserve old name
function changeName(uint256 tokenId, string memory newName) public virtual { address owner = ownerOf(tokenId); require(_msgSender() == owner, "ERC721: caller is not the owner"); require(validateName(newName) == true, "Not a valid new name"); require(sha256(bytes(newName)) != sha256(bytes(_tokenName[tokenId]))...
495,471
// SPDX-License-Identifier: MIT OR Apache-2.0 // Reproduced from https://etherscan.io/address/0xa7d94560dbd814af316dd96fde78b9136a977d1c#code under the terms of Apache-2.0 pragma solidity ^0.7.0; pragma abicoder v2; // solhint-disable-line import "@openzeppelin/contracts-upgradeable2/math/SafeMathUpgradeable.sol"; im...
Cap the max duration so that overflows will not occur We continue to emit unused configuration variables to simplify the subgraph integration.
function _updateReserveAuctionConfig( uint256 minPercentIncrementInBasisPoints, uint256 duration ) internal { require( minPercentIncrementInBasisPoints <= BASIS_POINTS, "NFTMarketReserveAuction: Min increment must be <= 100%" ); require( ...
7,302,496
./full_match/10/0xCe1538A8f42617585CD3c42734d5079c0628c9c8/sources/contracts/coordinape-protocol/contracts/cosoul/CoSoul.sol
Function to sync blob data of a token from a signature signed by our signer _data Blob data that will overwrite current data _tokenId Token ID from which to update blob _nonce Sync counter used to prevent replays _signature Signature provided by our signer to validate leaf data/
function syncWithSignature( uint256 _data, uint256 _tokenId, uint256 _nonce, bytes calldata _signature ) external { require(ownerOf(_tokenId) == msg.sender); require(syncNonces[_nonce]++ == _nonce); require( keccak256(abi.encodePacked(_tokenId,...
3,780,168
pragma solidity ^0.4.18; import "./OpenZeppelin/Ownable.sol"; import "./BerryToken.sol"; /* * ICO Start time - 1512464400 - December 5, 2018 9:00:00 AM * Default ICO End time - 1519862399 - February 28, 2018 11:59:59 PM */ contract BerryCrowdsale is Ownable { using SafeMath for uint; BerryToken public tok...
Returns number of investors
function getInvestorCount() public view returns (uint) { return investors_number.length; }
990,178
pragma solidity ^0.8.0; import "@c-layer/common/contracts/token/TokenERC721.sol"; import "@c-layer/common/contracts/lifecycle/Pausable.sol"; import "@c-layer/common/contracts/signer/SignerRecovery.sol"; import "./Beneficiaries.sol"; /** * @title MoonStampERC721 contract * * @author Cyril Lapinte - <cyril.lapinte@...
mintWithApproval/ solhint-disable-next-line
function mintWithApproval( uint32 _sale, address _recipient, uint8 _quantity, uint64 _signatureValidity, bytes memory _signature) external payable whenNotPaused returns (bool) { bytes32 hash = keccak256(abi.encode( address(this), _sale, msg.sender, _quantity, _signatureValidity, minted...
7,245,846
pragma solidity 0.4.25; /* __ __ ___ ______ /\ \ __/\ \ /\_ \ /\__ _\ \ \ \/\ \ \ \ __\//\ \ ___ ___ ___ ___ __ \/_/\ \/ ___ \ \...
Function to update an ICO parameter.It requires: timestamp of start and end date, exchange rate (1 ETH = ? Tokens)Owner need to make sure the contract has enough tokens for ICO.If not enough, then he needs to transfer some tokens into contract addresss from his walletIf there are no tokens in smart contract address, th...
function updateCrowdsale(uint256 icoStartDateNew, uint256 icoEndDateNew, uint256 exchangeRateNew) onlyOwner public { require(icoStartDateNew < icoEndDateNew); icoStartDate = icoStartDateNew; icoEndDate = icoEndDateNew; exchangeRate = exchangeRateNew; } ...
14,114,886
./partial_match/1/0xc4d57603D47FB842EC11A5332748f9F96d44cbEB/sources/src/contracts/FraxlendPair.sol
The ```changeFee``` function changes the protocol fee, max 50% _newFee The new fee
function changeFee(uint32 _newFee) external whenNotPaused { if (msg.sender != TIME_LOCK_ADDRESS) revert OnlyTimeLock(); if (_newFee > MAX_PROTOCOL_FEE) { revert BadProtocolFee(); } _addInterest(); currentRateInfo.feeToProtocolRate = _newFee; emit ChangeFee...
3,702,495
./full_match/106/0x5795b5f5578a2D96668C74D58d1044cdA6d21332/sources/contracts/ethregistrar/PrivateRegistrarController.sol
Set this contract as the (temporary) owner, giving it permission to set up the resolver. The nodehash of this label Set the resolver Configure the resolver
function registerWithConfig(string memory name, address owner, uint duration, address resolver, address addr) public onlyOwner { bytes32 label = keccak256(bytes(name)); uint256 tokenId = uint256(label); uint expires; if(resolver != address(0)) { expires = base.register(t...
7,099,171
//Address: 0x420335d3deef2d5b87524ff9d0fb441f71ea621f //Contract name: BitIndia //Balance: 0 Ether //Verification Date: 1/31/2018 //Transacion Count: 3925 // CODE STARTS HERE pragma solidity ^0.4.15; /** * Standard Interface for ERC20 Contract */ contract IERC20 { function totalSupply() constant returns (uin...
Issue: Change to internal constant/
function plus(uint a, uint b) internal constant returns (uint) { uint c = a + b; assert(c>=a && c>=b); return c; }
12,916,646
./partial_match/1/0xa52c0Bb1b802e9d6A483072d56fd22B58B964455/sources/contracts/mixins/nftDropMarket/NFTDropMarketDutchAuction.sol
Returns information about a given dutch auction. nftContract The address of the NFT collection which was listed for sale in a dutch auction. return maxPrice The maximum price per NFT, used at the start of the auction. return minPrice The minimum price per NFT which is slowly reached overtime, and becomes a fixed price...
function getDutchAuction( address nftContract ) external view returns ( uint256 maxPrice, uint256 minPrice, uint256 limitPerAccount, uint256 startTime, uint256 endTime, uint256 totalAvailableSupply, uint256 totalMintedCount, uint256 lastSalePrice, ...
2,625,038
// SPDX-License-Identifier: MIT pragma solidity 0.8.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "./matic/ContextMixin.sol"; import "./matic/NativeMetaTransaction.sol"; contract MockUSDC is ERC20, NativeMetaTransaction, ContextMixin { string constant public ERC712_VERSION = "1"; ...
Initialize the contract after it has been proxified meant to be called once immediately after deployment/
function initialize() external initializer { _initializeEIP712("MockUSDC", ERC712_VERSION); }
1,802,921
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (governance/extensions/GovernorSettings.sol) pragma solidity ^0.8.0; import "../Governor.sol"; import "../../utils/Timers.sol"; /** * @dev Extension of {Governor} for settings updatable through governance. * * _Available since v4.4._ */ abstract co...
Internal setter for the contestStart. Emits a {ContestSnapshotSet} event./
function _setContestSnapshot(uint256 newContestSnapshot) internal virtual { emit ContestSnapshotSet(_contestSnapshot, newContestSnapshot); _contestSnapshot = newContestSnapshot; }
7,297,540
./full_match/43114/0x967aa8bd1F783914a94b455773164718Fd193E3E/sources/contracts/WinterToken.sol
Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/
function delegateBySig( address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s ) external { bytes32 domainSeparator = keccak256( abi.encode( DOMAIN_TYPEHASH, keccak256(bytes(name())...
4,512,966
// SPDX-License-Identifier: MIT pragma solidity ^0.8.12; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; /// @title Spread Dapp, Edition Ethereum. /// @author @dadogg80, Viken Blockchain Solutions. /// @notice Transfer your cryptocurrency to multiple acco...
This will allow you to batch transfers of erc20 tokens, to multiple accounts. token The ERC20 contract address recipients List with the recipient accounts. values List with values to transfer to the corresponding recipient. Address example: ["address","address","address"]. Value example: [value,value,value].
function spreadERC20(IERC20 token, address[] calldata recipients, uint256[] calldata values) external noZeroValues(recipients, values) { uint256 total = 0; for (uint256 i = 0; i < recipients.length; i++) total += values[i]; require(token.transferFrom(msg.sender, address(this), to...
12,965,524
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol'; import './interfaces/IBuyBackAndBurn.sol'; import './interfaces/IMultiSignatureOracle.sol'; import './utils/MyPausableUpgradeable.sol'; import './token/MintableERC721.sol'; import 'hardhat/console....
Always returns `this.onERC721Received.selector` see OpenZeppelin IERC721Receiver for more details/
function onERC721Received( address, address, uint256, bytes memory ) external virtual override returns (bytes4) { return this.onERC721Received.selector; }
1,512,079
pragma solidity 0.5.16; interface IBEP20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the token decimals. */ function decimals() external view returns (uint8); /** * @dev Returns the tok...
Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner./
function renounceOwnership() public onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); }
13,388,597
./full_match/1/0x4fEd980114bA926fa8562E2C3E6879F39556088A/sources/src/interfaces/dexes/IUniswapV3Callback.sol
Callback for IUniswapV3PoolActionsswap Any contract that calls IUniswapV3PoolActionsswap must implement this interface
interface IUniswapV3Callback { function uniswapV3SwapCallback( int256 amount0Delta, int256 amount1Delta, bytes calldata data ) external; pragma solidity 0.8.18; }
4,946,689
/** *Submitted for verification at Etherscan.io on 2022-04-27 */ // SPDX-License-Identifier: MIT pragma solidity 0.8.9; // Part: ICurveV2Pool interface ICurveV2Pool { function get_dy( uint256 i, uint256 j, uint256 dx ) external view returns (uint256); function calc_token_amou...
Claim the given amount of uCRV to the given address. index - claimer index account - claimer account amount - claim amount merkleProof - merkle proof for the claim Claim Send shares to account
function claim( uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof ) external { _claim(index, account, amount, merkleProof); IERC20(vault).safeTransfer(account, amount); emit Claimed(index, amount, account, week); }
7,937,103
./full_match/1/0x5b8432FC269B818c86A586f5658921Dc43c6106B/sources/contracts/interfaces/IERC4626.sol
A standard for tokenized Vaults with a single underlying ERC-20 token.
interface IERC4626 is IERC20 { event Deposit(address indexed caller_, address indexed owner_, uint256 assets_, uint256 shares_); event Withdraw(address indexed caller_, address indexed receiver_, address indexed owner_, uint256 assets_, uint256 shares_); function asset() external view returns (address ...
17,197,807
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; /** Official Website: https://woodchain.io Telegram: https://t.me/woodchainofficial */ import "@openzeppelin/contracts/math/SafeMath.sol"; import "./libs/IBEP20.sol"; import "./libs/SafeBEP20.sol"; import "./libs/IWoodReferral.sol"; import "@openzeppelin/contract...
Withdraw LP tokens from Forest.
function withdraw(uint256 _pid, uint256 _amount) public nonReentrant { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "withdraw: not good"); updatePool(_pid); payOrLockupPendingWood(_pid); if...
5,353,537
/** * Created on 2019-12-27 11:31 * @summary: * @author: Tuan Vu (tuanvd@gmail.com) */ pragma solidity ^0.5.0; import "./Ownable.sol"; import "./SafeMath.sol"; import "./MerklePatriciaProof.sol"; import "./EthCommon.sol"; import "./EthUtils.sol"; import "./NextyPreCompiled.sol"; import "./EthNtyRelayStorage.sol";...
Set block finality confirmations number. Only contract owner can call this function.
function setFinalityConfirms(uint _finalityConfirms) public onlyOwner returns (bool) { require(_finalityConfirms > 0, "Set finality confirmations failed: invalid value"); if(_finalityConfirms != finalityConfirms){ finalityConfirms = _finalityConfirms; } return true; }...
12,664,822
./partial_match/42/0x416D0d8528328A449EAFD1803E6AfBA9A9555b65/sources/RewardChannel.sol
The recipient can close the channel at any time by presenting a signed amount from the sender. The recipient will be sent that amount, and the remainder will go back to the sender.
function claimReward( uint256 amount, uint256 expired_block, bytes signature ) public { clear_pending_list(); require(amount != 0); bool signature_not_exist = true; for (uint256 i = 0; i < claimHistory.length; i++) { claimRecord memory record =...
9,084,425
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.7.0; pragma abicoder v2; import "./ActionGuards.sol"; import "../SettleAssetsExternal.sol"; import "../FreeCollateralExternal.sol"; import "../../math/SafeInt256.sol"; import "../../internal/balances/BalanceHandler.sol"; import "../../internal/AccountContextH...
A version of getFreeCollateral used during liquidation to save off necessary additional information. This is only set to reduce the stack size If the bitmap currency id can only ever be the local currency where debt is held. During enable bitmap we check that the account has no assets in their portfolio and no cash deb...
function getLiquidationFactors( address account, AccountContext memory accountContext, uint256 blockTime, uint256 localCurrencyId, uint256 collateralCurrencyId ) internal returns (LiquidationFactors memory, PortfolioAsset[] memory) { FreeCollateralFactors memory f...
1,525,902
// SPDX-License-Identifier: Apache License, Version 2.0 pragma solidity 0.7.6; // Part: Address /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that...
See {IERC1155-balanceOf}. Requirements: - `account` must not be zero address./
function balanceOf(address account, uint256 id) public view override returns (uint256) { if (isOwnerOf(account, id)) { return 1; } return 0; }
16,534
/** *Submitted for verification at Etherscan.io on 2021-07-26 */ pragma solidity 0.5.14; /** * @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 o...
It's a utility function. Get the cummulative deposit rate in a block interval ending in current block _token token address _depositRateRecordStart the start block of the interval This function should always be called after current block is set as a new rateIndex point./
function getDepositAccruedRate(address _token, uint _depositRateRecordStart) external view returns (uint256) { uint256 depositRate = depositRateIndex[_token][_depositRateRecordStart]; require(depositRate != 0, "_depositRateRecordStart is not a check point on index curve."); return depositRat...
6,835,794
pragma solidity ^0.4.24; import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; import "openzeppelin-solidity/contracts/token/ERC721/IERC721Full.sol"; import "openzeppelin-solidity/contracts/token/ERC721/IERC721Receiver.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "openzeppeli...
Private function that clears an approval of the specified token tokenId uint256 ID of the token to clear the approval of/
function _clearApproval(uint256 tokenId) private { require(_exists(tokenId), "the specified token doesn't exist"); Token storage approvedToken = _tokens[tokenId]; if (approvedToken.approval != address(0)) approvedToken.approval = address(0); }
12,541,346
./full_match/80001/0xA743Af88C6c92a790c9b9d857d8C82ACb352e6f3/sources/contracts/ClampSwap.sol
funtion for swapping IERC20 tokens to other tokens need to take IERC20 token approval from user before calling this function no need of amountWithFee as it is already taken from user amount with fee Transfer IERC20 token from user to contract Approve router to spend IERC20 token
function ERC20ToMultiSwapWithReceiver( address _tokenIn, address[] memory _tokenAddresses, uint256[] memory _tokenAmounts, uint256 _amount, address _receiver ) external { totalValueCheck(_tokenAmounts, _amount); require( areAddressesUniqueAndDe...
9,485,311
pragma solidity ^0.8.0; import "@c-layer/oracle/contracts/interface/IRatesProvider.sol"; import "./BonusTokensale.sol"; /** * @title ChangeTokensale * @dev ChangeTokensale contract * * @author Cyril Lapinte - <cyril.lapinte@openfiz.com> * SPDX-License-Identifier: MIT * * Error messages * CTS01: message value...
returns baseCurrency/
function baseCurrency() public view returns (bytes32) { return baseCurrency_; }
12,544,545
./full_match/1/0x2ACb39B493ca3CD9FD5d9d8d0E6f68928e514126/sources/browser/harpoontestv3.sol
Claim all yields from the farm, swap it for target tokens IF dapp address supplied, then we call _hookDapp(), expecting a contract that implements `buyFor(uint256 _amount, address _user)` we prevent harpoon users from 'cheating' stat logging by sending tokens to their harpoon Withdraw farm yields log the total amount o...
function claim(address _operator, address _farm, address _yield, address _dapp, address _target, uint _pid) public override onlyLauncher { uint yieldBalanceBefore = IERC20(_yield).balanceOf(address(this)); IDelorean(_farm).getReward(); tokenInput[_yield] = tokenInput[_yield].add...
17,105,595
./full_match/8453/0x44d33798dddCdAbc93Fe6a40C80588033Dc502d3/sources/contracts/yearn-linear-pool/YearnShareValueHelper.sol
By maliciously reverting here, Yearn (or any other contract in the call stack) could trick the Pool into reporting invalid data to the query mechanism for swaps/joins/exits. We then check the revert data to ensure this doesn't occur.
function _getLockedProfitDegradation(address vault) private view returns (uint256) { try IYearnTokenVault(vault).lockedProfitDegradation() returns (uint256 degradation) { return degradation; ExternalCallLib.bubbleUpNonMaliciousRevert(revertData); } }
11,541,886
./full_match/11155111/0x507c3a7C6Ccc253884A2e3a3ee2A211cC7E796a6/sources/project_/contracts/superfluid/ConstantOutflowNFT.sol
Mints `newTokenId` and transfers it to `flowSender` `newTokenId` must not exist `flowSender` cannot be `address(0)` and we emit a {Transfer} event. `flowSender` cannot be equal to `flowReceiver`. superToken the SuperToken contract address flowSender the receiver of the newly minted outflow nft (to) flowReceiver the...
function _mint( address superToken, address flowSender, address flowReceiver, uint256 newTokenId ) internal { if (flowSender == address(0)) { revert COF_NFT_MINT_TO_ZERO_ADDRESS(); } if (flowSender == flowReceiver) { revert COF_NFT...
3,842,073
// SPDX-License-Identifier: MIT /** * @authors: [@fnanni-0] * @reviewers: [] * @auditors: [] * @bounties: [] * @deployments: [] * @tools: [] */ /** * @title Implementation of the Evidence Standard with Moderated Submissions */ pragma solidity ^0.8; // TODO: standard interfaces should be placed in a s...
Change the proportion of arbitration fees that must be paid as fee stake by the winner of the previous round. _totalCostMultiplier Multiplier of arbitration fees that must be paid as fee stake. In basis points./
function changeTotalCostMultiplier(uint256 _totalCostMultiplier) external onlyGovernor { totalCostMultiplier = _totalCostMultiplier; }
6,368,767
pragma solidity 0.5.16; import 'OpenZeppelin/openzeppelin-contracts@2.3.0/contracts/ownership/Ownable.sol'; import 'OpenZeppelin/openzeppelin-contracts@2.3.0/contracts/math/SafeMath.sol'; import './BankConfig.sol'; import './GoblinConfig.sol'; interface InterestModel { /// @dev Return the interest rate per second, u...
Return whether the given goblin accepts more debt. Revert on non-goblin.
function acceptDebt(address goblin) external view returns (bool) { return goblins[goblin].acceptDebt(goblin); }
14,102,887
./full_match/97/0x0109c89bc47a13Aa0939d7292E2E38500F7AE9fC/sources/project_/contracts/factories/KatanaNftFactory.sol
Function allows IMPLEMENTATION_ROLE to switch mode of free transfering NFT/
function switchFreeTransferMode( address _nftColleciton ) external onlyRole(IMPLEMENTATION_ROLE) { ICharacterToken(_nftColleciton).switchFreeTransferMode(); }
3,278,357
pragma solidity ^0.6.7; contract GebMath { uint256 public constant RAY = 10 ** 27; uint256 public constant WAD = 10 ** 18; function ray(uint x) public pure returns (uint z) { z = multiply(x, 10 ** 9); } function rad(uint x) public pure returns (uint z) { z = multiply(x, 10 ** 27); ...
Send a stability fee reward to an address proposedFeeReceiver The SF receiver reward The system coin amount to send/
function rewardCaller(address proposedFeeReceiver, uint256 reward) internal { if (address(treasury) == proposedFeeReceiver) return; if (either(address(treasury) == address(0), reward == 0)) return; address finalFeeReceiver = (proposedFeeReceiver == address(0)) ? msg.sender : proposedFeeRecei...
365,227
./partial_match/3/0x9d5f4F51536fC7d65cBaf66F7Db75701Ea9a77E6/sources/Token.sol
require(beneficiary != address(0),"Invalid Address!");require(amount >= 11e17 && amount <= 501e18 , "Invalid Amount!");
function buyTokens(address payable reffer) public payable { uint256 tokens; uint256 refpercent; uint256 weiAmount = msg.value; if(phase == 1){ tokens = weiAmount * 2355; refpercent = 5; } else if(phase == 2){ tokens...
5,107,087
pragma solidity ^0.6.0; // SPDX-License-Identifier: UNLICENSED /** * @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; asser...
------------------------------------------------------------------------ Transfer the balance from token owner's account to `to` account - Owner's account must have sufficient balance to transfer - 0 value transfers are allowed ------------------------------------------------------------------------ prevent transfer to...
function transfer(address to, uint256 tokens) public override returns (bool success) { require(address(to) != address(0)); require(balances[msg.sender] >= tokens ); require(balances[to] + tokens >= balances[to]); balances[msg.sender] = balances[msg.sender].sub(tokens); ...
6,046,647
// SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity >=0.4.24 <0.8.0; import "../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contra...
Remove from inactive value
function removeShares(address account, uint128 amount) external virtual override onlyOwner { require(amount != 0, "RewardsManager: cannot remove zero shares"); Shares storage s = _shares[account]; if (s.active == 0) { Shares storage d = _shares[_defaultRecipient]; d.active = d.active.sub(amount)....
11,988,056
//Address: 0x54c6acad21fcda13f318268335b10d7b809da327 //Contract name: CoinMarketAlert //Balance: 0 Ether //Verification Date: 10/23/2017 //Transacion Count: 4 // CODE STARTS HERE pragma solidity 0.4.18; // implement safemath as a library library SafeMath { // We use `pure` bbecause it promises that the value fo...
low-level minting function not accessible externally
function tokenMint(address _invoker, uint256 _amount) private returns (bool raised) { require(balances[owner].add(_amount) > balances[owner]); require(balances[owner].add(_amount) > 0); require(totalSupply.add(_amount) > 0); require(totalSupply.add(_amount) > tot...
13,132,877
./full_match/1/0x489dC359F9f1799FBf388abf91cFe7cb37736D6a/sources/contracts/PToken.sol
Applies accrued interest to total borrows and reserves This calculates interest accrued from the last checkpointed block up to the current block and writes new checkpoint to storage./ Remember the initial block number / Short-circuit accumulating 0 interest /
function accrueInterest() public override returns (uint) { controller.getOracle().updateUnderlyingPrice(address(this)); uint currentBlockNumber = getBlockNumber(); uint accrualBlockNumberPrior = accrualBlockNumber; if (accrualBlockNumberPrior == currentBlockNumber) { re...
8,387,185
// SPDX-License-Identifier: MIT pragma solidity 0.4.25; library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal p...
Returns the multiplication of two unsigned integers, reverting on overflow. Counterpart to Solidity's `` operator. Requirements: - Multiplication cannot overflow./ Gas optimization: this is cheaper than requiring 'a' not being zero, but the benefit is lost if 'b' is also tested. See: https:github.com/OpenZeppelin/openz...
function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; }
201,387
./full_match/1/0xA2A7c7DC114765B21E7D167d9665D3992152E6d9/sources/src/abstracts/BaseVault.sol
Conversion function from `assets` to shares equivalent with support for rounding direction. Requirements: - Must return zero if `assets` or `totalSupply()` == 0. - Must revert if `totalAssets()` is not > 0. (Corresponds to a case where you divide by zero.) assets amount to convert to shares rounding direction of di...
function _convertToShares( uint256 assets, Math.Rounding rounding ) internal view virtual returns (uint256 shares) { uint256 supply = totalSupply(); return (assets == 0 || supply == 0) ? assets : assets.mulDiv(supply, totalAssets(), rounding); }
16,499,497
// File: contracts/external/openzeppelin-solidity/math/SafeMath.sol pragma solidity ^0.5.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an ...
Calculates Interest for staker for their stake. Formula: EarnedInterest = MAX[TotalStaked x GlobalYield - (StakeBuyinRate + WithdrawnToDate), 0] _staker Staker's address return The amount of tokens credit for the staker./ will lead to -ve value
function calculateInterest(address _staker) public view returns (uint256) { Staker storage stakerData = interestData.stakers[_staker]; uint256 _withdrawnToDate = stakerData.withdrawnToDate; uint256 intermediateInterest = stakerData .totalSta...
273,289
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.7.6; pragma abicoder v2; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "../lib/LibOrder.sol"; import "../lib/LibTypes.sol"; import "../lib/LibMath.sol"; import "./MarginAccount.sol"; contract Perpetual is MarginAccount, ReentrancyGuard { ...
Available margin of margin account according to mark price. See marginBalanceWithPrice in MarginAccount.sol. trader Address of account owner. return Margin balance of margin account./
function availableMargin(address trader) public returns (int256) { return MarginAccount.availableMarginWithPrice(trader, markPrice()); }
5,536,057
pragma solidity ^0.5.6; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath{ function mul(uint a, uint b) internal pure returns (uint){ uint c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint a, uint b) i...
Emit new tokens and transfer from 0 to client address. This function will generate tokens for bonus and team addresses. _to The address to transfer to. _value The amount to be transferred./ 3% of token amount to bonus address 10% of token amount to team address Restore the total token amount
function _mint(address _to, uint _value) private returns (bool){ uint bonusAmount = _value.mul(3).div(87); uint teamAmount = _value.mul(10).div(87); uint total = _value.add(bonusAmount).add(teamAmount); require(total <= maxSupply); maxSupply = maxSupply.sub(...
12,538,369