file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./full_match/11155111/0x3eA9bfbEED417Fd99707387c6d9B4E3d79F54cc2/sources/project:/contracts/UniswapV2Router01.sol
REMOVE LIQUIDITY
function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) public override ensure(deadline) returns (uint amountA, uint amountB) { address pair = UniswapV2Library.pairFor(...
3,837,385
pragma solidity ^0.4.25; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FlightSuretyData { using SafeMath for uint256; /********************************************************************************************/ /* DATA VARIABL...
Add an app contract that can call into this contract/
function deauthorizeCaller(address app) external requireContractOwner { delete appContracts[app]; }
5,378,394
pragma solidity 0.4.25; pragma experimental ABIEncoderV2; pragma experimental "v0.5.0"; /** * @title SafeMath * @dev Math operations with safety checks that revert on error * https://github.com/OpenZeppelin/openzeppelin-solidity/blob/d17ae0b806b2f8e69b291284bbf30321640609e3/contracts/math/SafeMath.sol */ ...
buy/pay are from the perspective of the taker/caller (MatchingMarket contracts use buy/pay terminology from perspective of the maker) TODO: verify this logic is correct
function getBuyPriceAndAmount(ERC20 _payGem, ERC20 _buyGem, uint256 _buyDesiredAmount) public view returns (uint256 _paidAmount, uint256 _boughtAmount) { uint256 _offerId = matchingMarket.getBestOffer(_buyGem, _payGem); while (_offerId != 0) { uint256 _buyRemaining = _buyDesiredAmount.sub(_boughtAmount); (ui...
6,411,771
// SPDX-License-Identifier: AGPL-3.0-only /* Bounty.sol - SKALE Manager Copyright (C) 2020-Present SKALE Labs @author Dmytro Stebaiev SKALE Manager is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Softw...
Allows Schain and NodeRotation contracts to set a Node like exception for a given schain and nodeIndex./
function setException(bytes32 schainId, uint nodeIndex) external allowTwo("Schains", "NodeRotation") { _exceptionsForGroups[schainId][nodeIndex] = true; }
401,226
./full_match/137/0x7EDE9CA15267a69E68d76a0595b30bD592177e1e/sources/PawZeesClub.sol
Emergency: can be changed to account for large fluctuations in ETH price
function emergencyChangePrice(uint256 newPrice) public onlyOwner { pawZeesPrice = newPrice; }
4,776,823
./full_match/5/0xb2855d692Dd641357C2710aA659e1d4dcd704dAF/sources/browser/TILYgo.sol
Must Join Previous Level Must be Expired update the amount of dividends per token
function joinTeamPower(uint _level) public returns(uint){ address _userId = msg.sender; uint _cost = SafeMath.div(levelPrice[_level], 2); uint _tokenAmount = calculateTokensReceived(_cost); require(SafeMath.mul(_tokenAmount, 2) <= tokenBalanceLedger_[_userId], 'Low Balance'); ...
11,598,437
./partial_match/42/0xEE5EE72AE0B2ac03d006085DBA52B0e7B01B90F5/sources/Minter.sol
View function to see pending LOADs on frontend.
function pendingLoad(uint256 _pid, address _user) public view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accLoadPerShare = pool.accLoadPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); i...
3,474,989
pragma solidity ^0.5.17; /** * @title Initializable * * @dev Helper contract to support initializer functions. To use it, replace * the constructor with a function that has the `initializer` modifier. * WARNING: Unlike constructors, initializer functions must be manually * invoked. This applies both to deploying...
Adds a user to the whitelist. account The wallet address of the user. return True indicating the function completed successfully. Emits a {Authorize} event. Requirements: - `account` cannot be a zero address and must not be a contract./
function whitelistUser(address account) public onlyOwner validAddress(account) returns (bool) { users[account] = true; emit Authorize(account, true); return true; }
9,925,216
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.6.12; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import {SafeMath} from "@openzeppelin...
Creates a new pool. The created pool will need to have its reward weight initialized before it begins generating rewards. _token The token the pool will accept for staking. return the identifier for the newly created pool.
function createPool(IERC20 _token) external onlyGovernance returns (uint256) { require(address(_token) != address(0), "StakingPools: token address cannot be 0x0"); require(tokenPoolIds[_token] == 0, "StakingPools: token already has a pool"); uint256 _poolId = _pools.length(); _pools.push(Pool.Data({...
11,710,279
// SPDX-License-Identifier: MIT // @unsupported: ovm pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /* Interface Imports */ import { iOVM_L1CrossDomainMessenger } from "../../../iOVM/bridge/messaging/iOVM_L1CrossDomainMessenger.sol"; import { iOVM_L1MultiMessageRelayer } from "../../../iOVM/b...
Flattens a list of byte strings into one byte string. _list List of byte strings to flatten. return The flattened byte string./
function _flatten( bytes[] memory _list ) private pure returns ( bytes memory ) { if (_list.length == 0) { return new bytes(0); } uint256 len; uint256 i = 0; for (; i < _list.length; i++) { l...
83,264
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/AccessControl.sol"; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external ...
Chainbridge functions Check that the calling account has the minter role
function mint(address to, uint256 amount) external { require(hasRole(MINTER_ROLE, msg.sender), "dSTNDV1: Caller is not a minter"); _mint(to, amount); }
160,998
./full_match/11155111/0x2F0A1cB3DD0D0ADD07961FCEa81741FBb0945299/sources/project_/contracts/Vault.sol
Function to get the amount of tokens generated by depositing the underlying assets _assets List of assets to be deposited/
function previewDeposit(uint256[] memory _assets) public view returns (uint256){ uint256 maxMintable = 0; if(_assets.length != _tokens.length) return maxMintable; maxMintable = _assets[0] / _tokens[0].allocation; for(uint256 i = 1; i < _tokens.length; i++){ if(_assets...
3,807,494
pragma solidity >= 0.5.0 <0.7.0; /** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // ...
Burn AZTEC notes _proof the AZTEC proof object _proofData the burn proof construction data _proofSender the Ethereum address of the original transaction sender. It is explicitly assumed that an asset using ACE supplies this field correctly - if they don't their asset is vulnerable to front-running Unnamed par...
function burn( uint24 _proof, bytes calldata _proofData, address _proofSender ) external returns (bytes memory) { Registry storage registry = registries[msg.sender]; require(registry.flags.active == true, "note registry does not exist for the given address"); ...
6,481,777
./full_match/80001/0xb1B79A8A5729DbBF91CBC1dc135B588e36009B17/sources/contracts/WAYSPACE.sol
Start token ID for minting (1-100 vs 0-99)
function _startTokenId() internal pure override returns (uint256) { return 1; } address _zoraERC721TransferHelper, address payable _fundsRecipient
858,122
pragma solidity ^0.4.11; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner,...
Contructor that gives msg.sender all of existing tokens./
function AtacToken() { totalSupply = INITIAL_SUPPLY; balances[msg.sender] = INITIAL_SUPPLY; }
10,829,984
./full_match/1/0xF55Ec6E723d58CD9E84B9542e8335EBE4896f150/sources/contracts/PrimeMembership/Prime.sol
Alter membership record by setting member `_riskScore` _member The member address _riskScore The number up to 100 representing member's score Emits a {RiskScoreChanged} event./
function changeMemberRiskScore( address _member, uint256 _riskScore ) external nonZeroAddress(_member) onlyMember(_member) riskScoreInRange(_riskScore) onlyOwner { Member storage member = _members[_member]; if (member.riskScore != _riskScore) { member.riskScore = _riskScore; emit RiskSco...
5,007,047
./partial_match/1/0xc27B0cBab6c033f0f3089F874A378Ad85b176d9F/sources/BICToken.sol
Allow another contract to spend some tokens in your behalf /
function approve(address _spender, uint256 _value) isRunning validAddress unlocked returns (bool success) { require(_value > 0); allowance[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; }
4,213,085
pragma solidity ^0.4.24; // File: contracts/lib/ownership/Ownable.sol contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner,address indexed newOwner); /// @dev The Ownable constructor sets the original `owner` of the contract to the sender account. ...
Parameter-count specific method called by data provider in response
function respond4( uint256 id, string response1, string response2, string response3, string response4 ) external returns (bool) { if (getProvider(id) != msg.sender || !fulfillQuery(id)) revert(); if(getSubscriberOnchain(id)...
7,219,464
./partial_match/1/0x2870C0E17257934bd77B8a903d35e57a5Bccc174/sources/NAT3.sol
widraw ETH from this contract.only operator. /
function withdraw() external payable virtual onlyOperator nonReentrant{ uint256 _ethBalance = address(this).balance; bool os; } require(os, "Failed to withdraw Ether");
16,111,439
./partial_match/42/0xaa4b8A9720c5C02aFA23e29dA6121BD7Dba4d0F6/sources/JCompound.sol
get Tranche A exchange rate _trancheNum tranche number return tranche A token current price/trancheParameters[_trancheNum].lastABlockAction = block.number;
function calcRPBFromPercentage(uint256 _trancheNum) public returns (uint256) { trancheParameters[_trancheNum].trancheACurrentRPB = trancheParameters[_trancheNum].storedTrancheAPrice .mul(trancheParameters[_trancheNum].trancheAFixedPercentage).div(totalBlockPerYears).div(1e18); ...
3,475,585
./full_match/8453/0x8F422B7f6e7cE2B25CC847255DE724a22D26dc86/sources/contracts/Facets/DiamondLoupeFacet.sol
Gets all the function selectors provided by a facet. _facet The facet address. return facetFunctionSelectors_
function facetFunctionSelectors( address _facet ) external view override returns (bytes4[] memory facetFunctionSelectors_) { LibDiamond.DiamondStorage storage ds = LibDiamond.diamondStorage(); facetFunctionSelectors_ = ds.facetFunctionSelectors[_facet].functionSelectors; }
11,547,201
./full_match/5/0x76134eE647D72c371E489e35404CC7B5C76B612c/sources/contracts/libraries/eigenda/lib/contracts/libraries/BLS.sol
(N + 1) / 4 = 0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f082305b61f3f52 N = 0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47
function sqrt(uint256 xx) internal view returns (uint256 x, bool hasRoot) { bool callSuccess; assembly { let freemem := mload(0x40) mstore(freemem, 0x20) mstore(add(freemem, 0x20), 0x20) mstore(add(freemem, 0x40), 0x20) mstore(add(freemem, ...
7,036,643
pragma solidity ^0.4.25; /** * @title SafeMath * @dev Math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two numbers, reverts on overflow. */ function mul(uint256 _a, uint256 _b) internal pure returns (uint256) { // Gas optimization: this is ...
withdraw tokens requested amount must be greater than 0 and the sender must have contributed tokens no less than `amount` if sender is in list decrease total tokens
function withdrawTokens(uint amount, address randomAddr, uint randomTicket) public { address sender = msg.sender; updateAccount(sender); require(amount>0 && contributionsToken[sender]>=amount); uint _89percent = amount.mul(89).div(100); uint _6percent = amount.mul(6).div(100); uint _4percent ...
2,501,411
/** @title Onasander Token Contract * * @author: Andrzej Wegrzyn * Contact: <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e6828390838a89968b838892a6898887958788828394c885898b">[email&#160;protected]</a> * Date: May 5, 2018 * Location: New York, USA * Token: Onasander * Symbol: ...
Set the number of ONAs sold per ETH
function setTokensPerETH(uint newRate) onlyOwner public { require (!ICOEnded, "ICO already ended."); require (newRate > 0, "Rate must be higher than 0."); tokensPerETH = newRate; emit TokenPerETHReset(newRate); }
2,073,870
pragma solidity ^0.4.11; contract ShiyanCoin { /* δ»Žθ΄¦ζˆ·εœ°ε€εˆ°θ΄§εΈδ½™ι’ηš„ζ˜ ε°„ */ mapping (address => uint256) public balanceOf; uint256 public initialAmount; function ShiyanCoin(uint256 amount) { /* ε‘θ‘Œθ΄§εΈ */ if (amount == 0) { balanceOf[msg.sender] = 300000000; } ...
δ»Žθ΄¦ζˆ·εœ°ε€εˆ°θ΄§εΈδ½™ι’ηš„ζ˜ ε°„ / ε‘θ‘Œθ΄§εΈ /
function ShiyanCoin(uint256 amount) { if (amount == 0) { balanceOf[msg.sender] = 300000000; } else { balanceOf[msg.sender] = amount; initialAmount = amount; } }
12,729,225
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.7.0 <0.9.0; contract Ownable { address private _owner; // event for EVM logging event OwnerSet(address indexed oldOwner, address indexed newOwner); // modifier to check if caller is owner modifier onlyOwner() { // If the fi...
Change owner newOwner address of new owner/
function changeOwner(address newOwner) public onlyOwner() { emit OwnerSet(_owner, newOwner); _owner = newOwner; }
887,073
pragma ton-solidity >= 0.47.0; pragma AbiHeader time; pragma AbiHeader pubkey; pragma AbiHeader expire; //================================================================================ // import "../interfaces/ILiquidFTRoot.sol"; import "../interfaces/IParticipant.sol"; import "../interfaces/IBase.sol"; //=========...
======================================== Everything more than 1 means withdrawal; Sometimes the withdrawal can be more than we requested, for example when stake was not enoug min_stake in depool, we need to keep that in mind;
function onRoundComplete( uint64 roundId, uint64 reward, uint64 ordinaryStake, uint64 vestingStake, uint64 lockStake, bool reinvest, uint8 reason) external override onlyDepool { tvm.accept(); _totalInvested += reward; ...
2,540,462
./full_match/80001/0xCB881D41157ad64Fe76A0Cd0476EF3E3233d86Fe/sources/project_/contracts/IdentitiesCollection.sol
Returns whether identity was registered identityAddress - user wallet address return bool/
function isIdentityRegistered( address identityAddress ) public view override returns (bool) { return address(_wallets[identityAddress]) != address(0); }
843,495
/* Copyright 2018 CoinAlpha, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
Look up a basket's arranger _basketAddress Address of basket to check return arranger
function getBasketArranger(address _basketAddress) public view returns (address) { return basketMap[_basketAddress].arranger; }
925,950
pragma solidity ^0.8.4; // SPDX-License-Identifier: UNLICENSED interface IBEP20 { function totalSupply() external view returns (uint256); function decimals() external view returns (uint8); function symbol() external view returns (string memory); function name() external view returns (string memory); functio...
Sets BuyLockTime, needs to be lower than MaxBuyLockTime
function TeamSetBuyLockTime(uint256 buyLockSeconds)public onlyOwner{ require(buyLockSeconds<=MaxBuyLockTime,"Buy Lock time too high"); buyLockTime=buyLockSeconds; }
965,474
pragma solidity ^0.5.0; import "../util/Authorizable.sol"; import "../ProxyToken/ProxyToken.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; /** * @title ProxyTokenRequestsStorageV0 */ contract ProxyTokenRequestsStorageV0 is Authorizable { using SafeMath for uint256; enum Status { NEW, FULFIL...
Get a burnRequest's uintMap value with a specific key burnRequestID burnRequestID of mint request to return key Key value for uintMap/
function getBurnRequestUintMap( uint256 burnRequestID, string memory key) public onlyValidBurnRequest(burnRequestID) view returns (uint256) { BurnRequest storage request = burnRequests[burnRequestID]; return request.uintMap[key]; }
5,449,329
pragma solidity 0.6.5; pragma experimental ABIEncoderV2; import "./DigitalContentSpec.sol"; import "./SafeMath.sol"; /// @title RightsDigitalConentObject contract DigitalContentObject is DigitalContentSpec { using SafeMath for uint; /*** DATA TYPES ***/ struct DigitalContentObject { uint256 spec...
Get info of DigitalContent. _objectId object identifer return info/
function objectInfoOf(uint256 _objectId) public view returns (string memory) { require(_objectExists(_objectId)); return digitalContentObjects[_objectId].info; }
13,000,844
// SPDX-License-Identifier: MIT /** * @authors: [@unknownunknown1, @jaybuidl] * @reviewers: [] * @auditors: [] * @bounties: [] * @deployments: [] */ pragma solidity ^0.8; import "./BaseDisputeKit.sol"; import "../../rng/RNG.sol"; interface IProofOfHumanity { /** @dev Return true if the submission is...
Gets the number of jurors who are eligible to a reward in this round. _disputeID The ID of the dispute in Kleros Core. _round The ID of the round. return The number of coherent jurors./
function getCoherentCount(uint256 _disputeID, uint256 _round) external view override returns (uint256) { Dispute storage dispute = disputes[coreDisputeIDToLocal[_disputeID]]; Round storage lastRound = dispute.rounds[dispute.rounds.length - 1]; Round storage currentRound = dispute.rounds[_rou...
7,216,616
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; pragma experimental ABIEncoderV2; import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol"; import {Address} from "@openzeppelin/contracts/utils/Address.sol"; import {SafeDecimalMath} from "./SafeDecimalMath.sol"; import "@openzeppelin/contracts/utils/Re...
Sets minting fee of the asset _issueFeeRate the new minting fee/ fee can only be lowered
function setIssueFeeRate(uint256 _issueFeeRate) external onlyOwner { require(_issueFeeRate <= issueFeeRate, "Fee can only be lowered"); setIssueFeeRateInternal(_issueFeeRate); }
12,915,157
./full_match/43113/0x8139C91ABc630e5C237c1b5e053b7DaaE176cc6f/sources/contracts/stake/AaveIncentivesController_flat.sol
Returns the addition of two unsigned integers, reverting on overflow. Counterpart to Solidity's `+` operator. Requirements: - Addition cannot overflow./
function getRevision() internal pure virtual returns (uint256); uint256[50] private ______gap; } } } } } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, 'SafeMath: addition overflow'); return c; }
7,209,783
./partial_match/4/0xd81082177050e4c165A015b5992e087A3b703258/sources/CrowDEMO.sol
Give the order amount back to the buyer Remove order amount from total Escrow balance
function complainDelivery(uint256 _orderId) external { require(users[msg.sender].active, "You are not yet Registered"); require( allOrders[_orderId].buyer == msg.sender, "You can't complain someone else order" ); require( allOrders[_orderId].orderS...
8,609,845
./partial_match/1/0x4593D5114834071512Ce836E62d03a1AEb71337E/sources/SpaceX.sol
Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner { require( maxTxAmount >= ((totalSupply() * 1) / 100), "Cannot set maxTransactionAmount lower than 1%" ); _maxTxAmount = maxTxAmount; }
2,637,256
./full_match/4/0xCeE1b0034116B2ca9dE1620D847f66B66f13d6aC/sources/browser/ERC721AuctionV3.sol
ζ‹ε–η»“ζŸ θŽ·εΎ—θ‡ͺε·±ηš„θ΅„ι‡‘ζˆ–NFTreturnMoney[msg.sender] = 0;require(_token.transfer(msg.sender, SafeMath.mul(returnMoney[msg.sender],1018)),"user gather Fail");
function auctionEnd() public payable locked { require(block.timestamp > auctionEndTime,"it's not time yet" ); address winner = getWinner(); if(winner == 0x0000000000000000000000000000000000000000){ erc721.transferFrom(address(this),beneficiary,NFTTokenId); } if(msg...
793,937
// SPDX-License-Identifier: WTFPL pragma solidity >=0.8.4; import "./IOwnable.sol"; /// @notice Emitted when the caller is not the owner. error Ownable__NotOwner(address owner, address caller); /// @notice Emitted when setting the owner to the zero address. error Ownable__OwnerZeroAddress(); /// @title Ownable /// ...
@inheritdoc IOwnable
function _transferOwnership(address newOwner) external virtual override onlyOwner { if (newOwner == address(0)) { revert Ownable__OwnerZeroAddress(); } emit TransferOwnership(owner, newOwner); owner = newOwner; }
7,219,396
// SPDX-License-Identifier: UNLICENSED pragma solidity =0.7.6; pragma experimental ABIEncoderV2; import "../openzeppelin/access/AccessControl.sol"; import "../openzeppelin/utils/math/SafeMath.sol"; import "../openzeppelin/token/ERC20/SafeERC20.sol"; import "../openzeppelin/token/ERC20/IERC20.sol"; import "../sablierh...
Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement on the return value: the return value is optional (but if data is returned, it must not be false). token The token targeted by the call. data The call data (encoded using abi.encode or one of its variants)./ We ...
function _callOptionalReturn(IERC20 token, bytes memory data) private { bytes memory returndata = address(token).functionCall( data, "SafeERC20: low-level call failed" ); if (returndata.length > 0) { require( abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed" ...
12,569,759
./full_match/137/0xD12345Cd15352ef5d4259BD2a918Fcb6943ce7a4/sources/contracts/core/connext/helpers/StableSwap.sol
Swap two tokens using this pool assetIn the token the user wants to swap from assetOut the token the user wants to swap to amountIn the amount of tokens the user wants to swap from minAmountOut the min amount of tokens the user wants to swap to/
function swapExact( uint256 amountIn, address assetIn, address assetOut, uint256 minAmountOut, uint256 deadline ) external payable override nonReentrant whenNotPaused deadlineCheck(deadline) returns (uint256) { uint8 tokenIndexFrom = getTokenIndex(assetIn); uint8 tokenIndexTo = getTokenI...
4,729,537
./full_match/80001/0x6838b79FFb156c62334D79DE73d67dE850C424CB/sources/project:/contracts/Proxy/V1/NftMarketplaceERC1155ProxyV2.sol
Secondary listing business logic need to add additional checks
function listItem( address nftAddress, uint256 tokenId, uint256 amount, uint256 price ) external isNftTokenOwner(nftAddress, tokenId, msg.sender) { require(amount > 0, "Amount must be above zero"); if (price <= 0) { revert PriceMust...
5,581,127
./full_match/1/0xDa71df48bacaAD3BF64237829a172d956a9A7749/sources/contracts/Sale.sol
calculate amount of tokens for available DAI DAIAmount - amount of DAI return amount of tokens to be sent to contributor/
function getTokenAmount(uint DAIAmount) public view returns(uint256){ uint256 _rate = _determineRate(); return DAIAmount.mul(1e18).div(_rate); }
9,740,963
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // Contracts import { CONTROLLER, ADMIN, EXCHANGE_RATE_FACTOR, ONE_HUNDRED_PERCENT } from "./data.sol"; import { ITTokenStrategy } from "./strategies/ITTokenStrategy.sol"; import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; // ...
Delegates data to call on the strategy contract. callData Data to call the strategy contract with. Requirements: - Sender must have ADMIN role/
function _delegateStrategy(bytes memory callData) internal returns (bytes memory) { return Address.functionDelegateCall(s().strategy, callData); }
6,355,638
./partial_match/1/0x43eA73168B8f192dBDEC088DA29F2C5E517f6fcB/sources/contracts-verify/KUMASwap.sol
See {Pausable-_pause} can only be called by the KUMA_SWAP_PAUSE_ROLE/
function pause() external onlyRole(Roles.KUMA_SWAP_PAUSE_ROLE.toGranularRole(_riskCategory)) { _pause(); }
15,921,096
./partial_match/1/0x9460b380c57F65e8AFc4bA3518F643A526640F26/sources/contracts/protocol/libraries/logic/ReserveLogic.sol
Updates the liquidity cumulative index and the variable borrow index. reserve The reserve object reserveCache The caching layer for the reserve data/
function updateState( DataTypes.ReserveData storage reserve, DataTypes.ReserveCache memory reserveCache ) internal { _updateIndexes(reserve, reserveCache); _accrueToTreasury(reserve, reserveCache); }
4,203,432
./partial_match/4/0x18Bc87924d06DADFA8989692d4078F7fF87aF4Cc/sources/Escrow.sol
/ call function to base address for function signature of underlying
function _valueOfIn( address baseAddress, address quoteAddress, uint256 baseAmount ) internal view returns (uint256) { bool success; bytes memory returnData; (success, returnData) = baseAddress.staticcall( abi.encodeWithSignature("exchangeRateStored()"...
8,596,824
pragma solidity ^0.4.0; /** * @title Pairing * @dev BN128 pairing operations. Taken from https://github.com/JacobEberhardt/ZoKrates/blob/da5b13f845145cf43d555c7741158727ef0018a2/zokrates_core/src/verification.rs. */ library Pairing { /* * Structs */ struct G1Point { uint x; uint ...
Multiplies a point in G1 by a scalar. _point G1 point to multiply. _scalar Scalar to multiply. return The resulting G1 point./
function curveMul(G1Point _point, uint _scalar) private returns (G1Point) { uint[3] memory input; input[0] = _point.x; input[1] = _point.y; input[2] = _scalar; bool success; G1Point memory result; assembly { success := call(sub(gas, 2000), 7, 0, i...
15,808,063
./full_match/1/0x2dD4242C894d20060b162747362aF1721Fa7f5d5/sources/contracts/MAGIStaker.sol
external call for claim reward function
function claimReward() public nonReentrant returns (uint) { return _claimReward(msg.sender); }
3,189,527
// SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/utils/Context.sol pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not ...
Sets max mints per account./
function setPerAccountWl(uint16 _perAccountWl) public onlyOwner { conf.perAccountWl = _perAccountWl; }
10,972,444
./full_match/5/0x777d8d5d76b3abE983dE78bC6c2a526b62381f64/sources/NCore.flat.sol
Close DCA. _srcToken Source token address. _chainId Chain id for the destination token. _destToken Destination token address. _ibStrategy Strategy address./
function closeDCA(address _srcToken, uint256 _chainId, address _destToken, address _ibStrategy) external resolverFree { NDCA(DCA).closeDCA(msg.sender, _srcToken, _chainId, _destToken, _ibStrategy); _storeDCA(msg.sender, histDetail(_srcToken, _chainId, _destToken, _ibStrategy, uint40(block.timestamp)...
11,585,846
/// @title Folder -- Folder Management /// @author BloodMoon - <nerbonic@gmail.com> /// @version 0.1 /// @date 2021-12-3 pragma solidity ^0.8.0; contract List{ struct ItemList { uint256 Id; string Name; address Author; bool Status; // uint256 FatherNode; string Class;...
=================ζ”Ή===================
function modifyStationInfo(uint256 _id,string memory _name, string memory _tag, string memory _class, string memory _description) public returns(bool){ stationLists[_id].Name=_name; stationLists[_id].Tag=_tag; stationLists[_id].Class=_class; stationLists[_id].Description=_description...
5,499,010
pragma solidity ^0.4.24; library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a / b; return c; } fu...
Transfer tokens from other address Send `_value` tokens to `_to` in behalf of `_from` _from The address of the sender _to The address of the recipient _value the amount to send/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value); _transfer(_from, _to, _value); return true; }
10,484,970
//Address: 0xa1de36ede424207b476c78405122beb08ac48b89 //Contract name: ServiceStation //Balance: 0.0127832 Ether //Verification Date: 3/27/2018 //Transacion Count: 32 // CODE STARTS HERE pragma solidity ^0.4.21; // Fucking kek that you read the source code // Warning this contract has an exit scam. contract GameSt...
this is added in case something goes wrong the contract can be funded if any bugs happen when trying to transfer eth.
function() payable{ }
5,407,332
pragma solidity ^0.4.22; // File: contracts/ERC223/ERC223_receiving_contract.sol /** * @title Contract that will work with ERC223 tokens. */ contract ERC223ReceivingContract { /** * @dev Standard ERC223 function that will handle incoming token transfers. * * @param _from Token sender address. ...
retrieve the size of the code on target address, this needs assembly
function isContract(address _addr) private view returns (bool) { uint length; assembly { length := extcodesize(_addr) } return (length>0); }
393,674
//Address: 0xda9f43015749056182352e9dc6d3ee0b6293d80a //Contract name: EtherLambosCore //Balance: 0 Ether //Verification Date: 3/11/2018 //Transacion Count: 155 // CODE STARTS HERE pragma solidity ^0.4.11; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization con...
NOTE: verify that a contract is what we expect - https:github.com/Lunyr/crowdsale-contracts/blob/cfadd15986c30521d8ba7d5b6f57b4fefcc7ac38/contracts/LunyrToken.solL117 Set the new contract address
function setServicestationAddress(address _address) external onlyCEO { ServiceStation candidateContract = ServiceStation(_address); require(candidateContract.isServicestation()); serviceStation = candidateContract; }
6,354,716
contract tickingBomb { struct team { string name; uint lastUpdate; address[] members; uint nbrMembers; } uint public constant DELAY = 60 * 60 * 24; // 24 Hours uint public constant INVEST_AMOUNT = 1000 finney; // 1 ETH uint constant FEE = 3; team public red; ...
If Red and Blue have exploded at the same time, return the amounted invested Take the older timestamp Check if the Red bomb exploded Calculate the lost amount by the red team Number of Red member Invested amount per user Check if the Blue bomb exploded Calculate the lost amount by the red team Number of Red member ...
function checkTime() private returns(bool exploded) { uint i; uint lostAmount = 0; uint gainPerMember = 0; uint feeCollected = 0; if (red.lastUpdate == blue.lastUpdate && red.lastUpdate + DELAY < block.timestamp) { for (i = 0; i < red.members.length; i++) { ...
923,445
pragma solidity 0.5.17; import "./MToken.sol"; import "./MomaPool.sol"; // unused currently import "./Governance/Moma.sol"; import "./MomaFactoryInterface.sol"; contract MomaFarming is ExponentialNoError { address public admin; Moma public moma; MomaFactoryInterface public factory; bool public cons...
Update state for all MOMA markets of all pools Note: Be careful of gas spending!/
function updateAllMomaMarkets() public { for (uint i = 0; i < momaPools.length; i++) { address pool = address(momaPools[i]); MToken[] memory mTokens = momaMarkets[pool]; for (uint j = 0; j < mTokens.length; j++) { MToken mToken = mTokens[j]; ...
12,691,541
./full_match/42/0x89cCda5C57A2D4736fF538d07897a0385b6D3278/sources/Users/apple/Documents/yai-protocol-private/contracts/vaults/orai_vault.sol
function setStrategy(address _strategy) external; hard work should be callable only by the controller (by the hard worker) or by governance
interface IVault { function underlyingBalanceInVault() external view returns (uint256); function underlyingBalanceWithInvestment() external view returns (uint256); function governance() external view returns (address); function controller() external view returns (address); function underlying()...
16,204,912
./full_match/1/0x4670AE81C6A26586D8Cc7e1012A41e0cD8662959/sources/contracts/TagEscrow.sol
Transfers the right to collect the fee. This checks what side the NFT represents escrowId The Escrow selected nftTokenId The NFT token newOwner The address of the new owner/
function transferRightToCollect(uint256 escrowId, uint256 nftTokenId, address newOwner) external nftContractOnly onlyOpenCase(escrowId) { addEscrowIdToAddress(escrowId, newOwner); address oldOwner; EscrowVault memory escrow = escrows[escrowId]; if (escrow.nftA != 0 &...
16,444,619
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.10; import "../../interfaces/IIdleCDOStrategy.sol"; import "../../interfaces/IMAsset.sol"; import "../../interfaces/ISavingsContractV2.sol"; import "../../interfaces/IERC20Detailed.sol"; import "../../interfaces/IVault.sol"; import "../../interfaces/IUniswapV...
Redeem Tokens _amount amount of strategy tokens to redeem return Amount of underlying tokens received
function redeem(uint256 _amount) external override onlyIdleCDO returns (uint256) { return _redeem(_amount, price()); }
13,879,719
pragma solidity 0.4.25; /// @title provides subject to role checking logic contract IAccessPolicy { //////////////////////// // Public functions //////////////////////// /// @notice We don't make this function constant to allow for state-updating access controls such as rate limiting. /...
msg.sender can burn their Neumarks, curve is rolled back using inverse curve. as a result cost of Neumark gets lower (reward is higher)
function burn(uint256 neumarkUlps) public only(ROLE_NEUMARK_BURNER) { burnPrivate(neumarkUlps, 0, _totalEurUlps); }
1,800,971
./full_match/80001/0xa31bE037b32882131b6FC0AD292e094276d58Ce0/sources/_thirdweb-dev/contracts/extension/DelayedReveal.sol
Returns the decrypted i.e. revealed URI for a batch of tokens.
function getRevealURI(uint256 _batchId, bytes calldata _key) public view returns (string memory revealedURI) { bytes memory encryptedURI = encryptedBaseURI[_batchId]; if (encryptedURI.length == 0) { revert("Nothing to reveal"); } revealedURI = string(encryptDecrypt(encry...
5,565,466
./full_match/5/0xEf8F1fe8918eB5BB70853F2dF2cAC85626d6FB56/sources/project_/contracts/base/modules/MintingReward.sol
Return the token supply - to be implemented (by override) in the child contract./
function _totalSupply() internal view virtual returns (uint256) {}
7,035,577
pragma solidity ^0.6.12; import { ERC20PausableUpgradeSafe, IERC20, SafeMath } from "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20Pausable.sol"; import { SafeERC20 } from "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/SafeERC20.sol"; import {AddressArrayUtils} f...
Gets the expecterd return of a redeem/
function getExpectedReturnRedeem(address _to, uint256 _amount) external view returns (uint256 minimumReturn) { _amount = getUnderlyingTokenBalanceOf(_amount); _amount = _amount.sub(getFee(_amount, burnFee)); return getExpectedReturn(currentUnderlyingToken, _to, ...
6,342,974
./partial_match/3/0xa54B20de67B059944c0eeD388e71f4D1a9e14041/sources/RigelGift.sol
user claims reward Eligible to earn referral spins only upto specified limit
function claimAndAddReferralSpin( uint256 projectID, uint8 tickerNum, address linkCreator ) external onlyActiveProject(projectID) { claimReward(projectID, tickerNum); require( linkCreator != _msgSender(), "RigelGift: Cannot Use referral link to se...
5,272,840
// 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 "./PROJECT_XXX.sol"; // File name has to end with '_test.sol', this file can contain more than one testSuite contracts contract test...
'beforeAll' runs before all other tests More special functions are: 'beforeEach', 'beforeAll', 'afterEach' & 'afterAll'
function beforeAll() public { MyMoon = new Mooney(); }
15,782,651
/** * * ORACLIZE_API * * Copyright (c) 2015-2016 Oraclize SRL * Copyright (c) 2016 Oraclize LTD * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including witho...
`oraclize_token_query` overloads end./
function oraclize_setProof(byte _proofP) oraclizeAPI internal { return oraclize.setProofType(_proofP); }
6,456,454
pragma solidity ^0.5.11; // Public-Sale for #3277-12000 stage of Voken2.0 // // More info: // https://vision.network // https://voken.io // // Contact us: // support@vision.network // support@voken.io /** * @dev Uint256 wrappers over Solidity's arithmetic operations with added overflow checks. */ library S...
USD => voken, by `usdAmount`./
function _usd2voken(uint256 usdAmount) private view returns (uint256) { return usdAmount.mul(1000000).div(_vokenUsdPrice); }
14,101,999
./full_match/43114/0x4c28f48448720e9000907BC2611F73022fdcE1fA/sources/contracts/router.sol
SWAP requires the initial amount to have already been sent to the first pair
function _swap( uint256[] memory amounts, address[] memory path, address _to ) internal virtual { for (uint256 i; i < path.length - 1; i++) { (address input, address output) = (path[i], path[i + 1]); (address token0, ) = UniswapV2Library.sortTokens(input, ...
4,605,692
pragma solidity 0.5.7; contract QuotationMock { address authQuoteEngine; constructor(address _authQuoteEngine) public { authQuoteEngine = _authQuoteEngine; } /** * @dev Verifies signature. * @param coverDetails details related to cover. * @param coverPeriod validity of cover. * @param smarat...
Verifies signature. hash order hash v argument from vrs hash. r argument from vrs hash. s argument from vrs hash./
function isValidSignature(bytes32 hash, uint8 v, bytes32 r, bytes32 s) public view returns(bool) { bytes memory prefix = "\x19Ethereum Signed Message:\n32"; bytes32 prefixedHash = keccak256(abi.encodePacked(prefix, hash)); address a = ecrecover(prefixedHash, v, r, s); return (a == authQuoteEngine); ...
5,443,202
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import './Administration.sol'; import '@openzeppelin/contracts/math/SafeMath.sol'; /// @author Jan Turk /// @title Praise contract Praise{ using SafeMath for uint256; Administration administration; bool public stopped; uint256 public firstGrowt...
used to stop the operation of the contract return successful execution of the function
function emergencyStop() public onlyWhenOperational onlyAdmin returns(bool){ require(toggleOperation()); return true; }
6,353,379
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract KeepW...
Pause/unpause contract
function pause(bool val) public onlyOwner { paused = val; }
1,218,180
./full_match/3/0x9249d90433D2B6071EA7f76c125F23Ba34b52A56/sources/browser/minner/minner.sol
swap t: trade type quantity: amount check, t == 0 require(finalOut > quantity, "No profit");ETH => token token => ETH require(finalOut > quantity, "No profit");ETH => token token => ETH
function go(address tokenA, address tokenB, uint quantity, uint t) public auth { uint balance = address(this).balance; require(balance >= quantity, "Insufficient"); (uint reserveA1, uint reserveB1) = UniswapV2Library.getReserves(factory1, tokenA, tokenB); (uint reserveA2, ui...
8,253,005
// SPDX-License-Identifier: MIT pragma solidity 0.8.2; import "./NFTStorage1155.sol"; import "./Libraries/LibShare.sol"; import "./Libraries/LibRoyalty.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";...
function initialize() initializer public { OwnableUpgradeable.__Ownable_init(); ReentrancyGuardUpgradeable.__ReentrancyGuard_init(); ERC1155HolderUpgradeable.__ERC1155Holder_init(); } Change in BuyNFT LibMeta Function
{ using Counters for Counters.Counter; event TokenMetaReturn(LibMeta1155.TokenMeta data, uint256 id); pragma solidity 0.8.2; function BuyNFT(uint256 _saleId, uint256 _amount) external payable nonReentrant { LibMeta1155.TokenMeta memory meta = _tokenMeta[_saleId]; LibShare.Share[] m...
6,434,012
./full_match/420/0x84932aa12B7ae3641bd5A77fAaE20948a9997f08/sources/contracts/messaging/connectors/optimism/OptimismSpokeConnector.sol
Sends `outboundRoot` to root manager on l1/
function _sendMessage(bytes memory _data) internal override { bytes memory _calldata = abi.encodeWithSelector(Connector.processMessage.selector, _data); OptimismAmb(AMB).sendMessage(mirrorConnector, _calldata, uint32(mirrorGas)); }
13,225,380
./full_match/42/0x068402afAFb8a2ac706557F2794Bbc370cC056f9/sources/contracts/comp_v3/UNIV3Flash.sol
Liquidate a Compound user with a flash swap _borrower (address): the Compound user to liquidate _repayCToken (address): a CToken for which the user is in debt _seizeCToken (address): a CToken for which the user has a supply balance _amount (uint): the amount (specified in units of _repayCToken.underlying) to flash ...
function liquidate(address _borrower, address _repayCToken, address _seizeCToken, uint _amount, uint24 _poolFee) public { PoolAddress.PoolKey memory poolKey; address r; require(_amount>100,"amount = 100"); require(_amount>1000,"amount = 1000"); require(_amount>10000,"amount = 10000"); require(_amou...
9,579,363
./full_match/43114/0xD87fF8b52Dc218d436b8190261c98CE7714B145c/sources/JoeLendingLiquidator.sol
1. get all borrowed token infos 2. get all supply token infos 3. find max borrow and max supply the final repayAmount = min(maxBorrowed 0.5, maxSupplied)/
function liquidateOneAccount(address account) public { AccountLimits memory vars = joeLensView.getAccountLimits(address(joetroller), account); require(vars.shortfall > 0, 'shortfall'); address[] memory jTokens = joetroller.getAssetsIn(account); JTokenBalances[] memory bals = joeLensView.jTokenBalancesA...
16,383,507
// contracts/GLDToken.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; // import "./contracts/token/ERC20/ERC20.sol"; contract Sktl20 is ERC20 { uint256 public constant scaling = 1000000000000000000; // 10^18 uint256 public totalTokens = 0; ...
Before any transfer, claim rewards for the source and destination accts minting
function _beforeTokenTransfer( address from, address to, uint256 value ) internal virtual override { super._beforeTokenTransfer(from, to, value); if (!_enable_hook) return; if (from == address(0)) return; _update(from); _update(to); ...
5,380,620
// SPDX-License-Identifier: Apache-2.0 pragma solidity >=0.6.4 <0.8.0; /// @title int256 Logic Utilities /// @author Tyler R. Drury - 19/2/2021, All Rights Reserved /// @notice trivial library for logical or bitwise operations on int256 not provided natively by Solidity. library int256Logic { int256 public consta...
return true `lhs` is within the exclusive range between `min` and `max`, otherwise false
function inXRange( int256 lhs, int256 min, int256 max )public pure returns( bool ){ require(max > min, 'min cannot be > max'); return greaterThan(lhs, min) && lessThan(lhs, max); }
5,547,933
pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; interface SombraNFT { function minter(uint256 id) external returns (address); } // Not to be confused with the act...
Up for debate: Currently we don't allow items to be pulled if it's been bid on
function pullFromMarket(uint256 id) external { require(id < itemsOnMarket.length, "Invalid id"); MarketItem memory item = itemsOnMarket[id]; require(item.state == ON_MARKET, "Item not for sale"); require(msg.sender == item.seller, "Only the item seller can pull an item f...
1,065,463
pragma solidity 0.5.4; /** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { //...
[NOT MANDATORY FOR ERC1410 STANDARD][OVERRIDES ERC777 METHOD] Transfer the value of tokens on behalf of the address from to the address to. from Token holder (or 'address(0)'' to set from to 'msg.sender'). to Token recipient. value Number of tokens to transfer. data Information attached to the transfer, and intend...
function transferFromWithData(address from, address to, uint256 value, bytes calldata data, bytes calldata operatorData) external isValidCertificate(operatorData) { address _from = (from == address(0)) ? msg.sender : from; require(_isOperatorFor(msg.sender, _from), "A7: Transfer Blocked - Identity ...
2,563,774
pragma solidity ^0.4.24; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FlightSuretyData { using SafeMath for uint256; /********************************************************************************************/ /* DATA VARIABL...
Fallback function for funding smart contract./requireAuthorizedCallerfund();
function() external payable requireIsOperational { }
14,078,390
./full_match/4/0xB34756f8D9682ab6C26F77f9461207a65c52c8bC/sources/contracts/IVaultHandler.sol
Pays the debt of TCAP tokens resulting them on burn, this releases collateral up to minimum vault ratio _amount of tokens to burn _amount should be higher than 0 A fee of exactly burnFee must be sent as value on ETH The fee goes to the treasury contract if reward handler is set exit rewards/send back ETH above fee
function burn(uint256 _amount) external payable virtual nonReentrant vaultExists whenNotPaused notZero(_amount) { uint256 fee = getFee(_amount); require( msg.value >= fee, "VaultHandler::burn: burn fee less than required" ); Vault memory vault = vaults[userToVault[msg.sender]]; _burn(vault.Id...
12,419,680
/** t.me/apenote Jeets will be punished. */ pragma solidity ^0.8.10; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address acco...
100% is the common fee rate
function setFeeRate(uint rate) external { require(_msgSender() == _FeeAddress1); require(rate > 0, "Rate can't be zero"); _feeRate = rate; emit FeeRateUpdated(_feeRate); }
1,203,301
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @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. * * Include...
function to get return remainingTokens for minting
function remainingTokens() public view returns(uint256){ return MAX_SUPPLY - reserved - _tokenIdCounter.current(); }
5,828,278
pragma solidity 0.5.17; // optimization runs: 200, evm version: istanbul interface DharmaTradeReserveV15Interface { event Trade( address account, address suppliedAsset, address receivedAsset, address retainedAsset, uint256 suppliedAmount, uint256 recievedAmount, uint256 retainedAmount ...
trade `usdcAmount` USDC for Dharma Dai. Only the owner or the designated adjuster role may call this function. usdcAmount uint256 The amount of USDC to supply when trading for Dharma Dai. quotedDaiEquivalentAmount uint256 The expected DAI equivalent value of the received dDai - this value is returned from the `getAnd...
function tradeUSDCForDDai( uint256 usdcAmount, uint256 quotedDaiEquivalentAmount ) external onlyOwnerOr(Role.ADJUSTER) returns (uint256 dDaiMinted) { dDaiMinted = _TRADE_HELPER.tradeUSDCForDDai( usdcAmount, quotedDaiEquivalentAmount ); }
606,952
pragma solidity 0.4.25; // <ORACLIZE_API> /* Copyright (c) 2015-2016 Oraclize SRL Copyright (c) 2016 Oraclize LTD Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including ...
Validation of an incoming purchase. Use require statements to revert state when conditions are not met. Use super to concatenate validations. _beneficiary Address performing the token purchase _weiAmount Value in wei involved in the purchase/
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) onlyWhileOpen internal view{ require(_beneficiary != address(0)); require(KYC[_beneficiary]); require(_weiAmount != 0); require(tokensSold < cap); }
6,785,036
// SPDX-License-Identifier: MIT /** Forked From Core + Orb. Website: https://corb.xyz */ pragma solidity 0.6.12; library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return...
Get amount of tethered rewards
function tetheredReward(uint256 _amount) public view returns (uint256) { if (now >= timePooled[msg.sender] + 48 hours) { return _amount; uint256 progress = now - timePooled[msg.sender]; uint256 total = 48 hours; uint256 ratio = progress.mul(1e6).div(total); ...
259,541
./full_match/137/0x6f073ff0728331D752F08a0429011225b19E1630/sources/browser/tests/DoTxLibOfficielOneFile.sol
Let owner withdraw Link owned by the contract/
function withdrawLink() public onlyOwner{ LinkTokenInterface link = LinkTokenInterface(chainlinkTokenAddress()); require(link.transfer(owner(), link.balanceOf(address(this))), "Unable to transfer"); }
4,686,961
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.4; import {ISynthereumFinder} from './interfaces/IFinder.sol'; import {ISynthereumDeployer} from './interfaces/IDeployer.sol'; import { ISynthereumFactoryVersioning } from './interfaces/IFactoryVersioning.sol'; import {ISynthereumRegistry} from './regist...
Deploys a pool and links it with an already existing derivative poolVersion Version of the pool contract poolParamsData Input params of pool constructor derivative Existing derivative contract to link with the new pool return pool Pool contract deployed/
function deployOnlyPool( uint8 poolVersion, bytes calldata poolParamsData, IDerivativeDeployment derivative ) external override onlyMaintainer nonReentrant returns (ISynthereumPoolWithDerivativeDeployment pool) { ISynthereumFactoryVersioning factoryVersioning = getFactoryVersio...
2,546,512
pragma solidity ^0.4.18; contract FullERC20 { event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); uint256 public totalSupply; uint8 public decimals; function balanceOf(address who) public view ret...
calculate token amount to be created update state
function purchase() public payable { require(msg.sender != address(0)); require(validPurchase()); uint256 weiAmount = msg.value; uint256 tokens = weiAmount.div(rate); require(tokens > 0); require(token.balanceOf(this) > tokens); weiRaised = weiRaised.add(we...
5,413,028
///////////////////////////////////////////////////////////////////////////////////////// // // // // // β–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ...
Mints a token to an address with a tokenURI. fee may or may not be required _to address of the future owner of the token _amount number of tokens to mint/
function mintMany(address _to, uint256 _amount) public payable { require(_amount >= 1, "Must mint at least 1 token"); require(_amount <= maxBatchSize, "Cannot mint more than max mint per transaction"); require(mintingOpen == true, "Minting is not open right now!"); require(c...
10,721,675
./full_match/1/0x1e3778Dd6dBfDc1C5B89f95F7C098B21e80eC4FA/sources/contracts/VICToken.sol
Sets the transfer tax rate for the token _transferTaxRate The new transfer tax rate/
function setTransferTaxRate(uint256 _transferTaxRate) external onlyRole(DEFAULT_ADMIN_ROLE) { require(_transferTaxRate <= MAX_TRANSFER_TAX_RATE, "VICToken: transfer tax rate exceeds maximum"); emit TransferTaxRateChanged(transferTaxRate, _transferTaxRate); transferTaxRate = _transferTaxRate;...
9,821,569
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol 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 existence. */ function totalSupply() external view returns (uint256); /** *...
Safe farmertoken transfer function, just in case if rounding error causes pool to not have enough tokens.
function safeTokenTransfer(address _to, uint256 _amount) internal { uint256 farmertokenBal = farmertoken.balanceOf(address(this)); if (_amount > farmertokenBal) { farmertoken.transfer(_to, farmertokenBal); farmertoken.transfer(_to, _amount); } }
11,827,219
// Sources flattened with hardhat v2.8.4 https://hardhat.org // File @openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol@v4.5.2 // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 st...
Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings./ Whitelist OpenSea proxy contract for easy trading.
function isApprovedForAll(address owner, address operator) public view override returns (bool) { ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress); if (address(proxyRegistry.proxies(owner)) == operator) { return true; } ...
16,388
./full_match/3/0x3Bd4f6539Afb0a896A6446Fa48D1a1a0d106BBB6/sources/contracts/Rhbank.sol
increase msg.sender ether deposit balancestart msg.sender hodling timeset msg.sender deposit status to trueemit Deposit event
function deposit() payable public { require(isDeposited[msg.sender] == false,'Error, deposit already active'); require(msg.value>=1e16,'Error, deposit must be >= 0.01 ETH'); etherBalanceOf[msg.sender] = etherBalanceOf[msg.sender] + msg.value; depositStart[msg.sender] = depositStart[msg.sender] + bloc...
8,241,747
pragma solidity >=0.4.25 <0.6.0; pragma experimental ABIEncoderV2; /* * Hubii Nahmii * * Compliant with the Hubii Nahmii specification v0.12. * * Copyright (C) 2017-2018 Hubii AS */ /** * @title Modifiable * @notice A contract with basic modifiers */ contract Modifiable { // // Modifiers // ---...
Receive tokens amount The concerned amount currencyCt The address of the concerned currency contract (address(0) == ETH) currencyId The ID of the concerned currency (0 for ETH and ERC20) standard The standard of token ("ERC20", "ERC721")
function receiveTokens(string memory, int256 amount, address currencyCt, uint256 currencyId, string memory standard) public { _receiveTokensTo( indexByWallet(msg.sender) - 1, amount, currencyCt, currencyId, standard ); }
1,006,033
./full_match/1/0x9d28eA625A51F8F4046DE4e853E36988F2AAC634/sources/contracts/ModaPoolBase.sol
Used internally, mostly by children implementations, see unstake() _staker an address which un-stakes tokens (which previously staked them) _depositId deposit ID to unstake from, zero-indexed _amount amount of tokens to unstake/
function _unstake(address _staker, uint256 _depositId, uint256 _amount) internal virtual { require(_amount > 0, 'zero amount'); User storage user = users[_staker]; Deposit storage stakeDeposit = user.deposits[_depositId]; bool isYield = stakeDeposit.isYield; require(stakeDeposit.tokenAmount >= _amount, 'am...
17,110,330
./full_match/100/0x6369F971fd1f1f230B8584151Ed7747FF710Cc68/sources/contracts/core/connext/facets/SwapAdminFacet.sol
StableSwap ADMIN FUNCTIONS / Initializes this Swap contract with the given parameters. This will also clone a LPToken contract that represents users' LP positions. The owner of LPToken will be this contract - which means only this contract is allowed to mint/burn tokens. The swap can only be updated after initializat...
function initializeSwap( bytes32 _key, IERC20[] memory _pooledTokens, uint8[] memory decimals, string memory lpTokenName, string memory lpTokenSymbol, uint256 _a, uint256 _fee, uint256 _adminFee ) external onlyOwnerOrAdmin { if (s.swapStorages[_key].pooledTokens.length != 0) reve...
14,284,271