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: UNLICENSED
pragma solidity >=0.4.1;
pragma experimental ABIEncoderV2; // allows returning array
contract FundRaiser {
modifier onlyAdmin { // for when we need admin only access
require(msg.sender == admin, "Only admin is allowed");
_;
}
// ... | get list of cause names | function getCauseNames() public view returns (string[] memory) {
return causeTitles;
ret[i] = causeMap[causeTitles[i]];
}
| 5,388,641 |
./full_match/80001/0x6EE00Ee32e9158B285dD6E5736cd8c438d7Ec2c2/sources/src/Vault.sol | / 0.5% = multiply by 1000 then divide by 5 | function calculateWithdrawalFeeValue(uint256 amount, uint256 _epoch)
public
view
returns (uint256 feeValue)
{
return (amount * epochFee[_epoch]) / 1000;
}
Factory FUNCTIONS
| 5,613,198 |
./full_match/1/0xDf24D7F73Bec8D0B34915Ecd8a00AE3598A1fA2c/sources/contracts/EtchMarket.sol | Calculate protocol fee amount amount to transfer/ | function _calculateProtocolFee(uint16 feeDiscount, uint256 amount) internal view returns (uint256) {
if (feeDiscount > 0) {
return (feeDiscount * amount) / 10000;
return (protocolFeeBps * amount) / 10000;
}
}
| 3,171,090 |
./partial_match/4/0x55EeF09D220d3b2916B99787Cf410216ce774d30/sources/LamboSwapPair.sol | if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k) | function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) {
address feeTo = ILamboSwapFactory(factory).feeTo();
feeOn = feeTo != address(0);
if (feeOn) {
if (_kLast != 0) {
uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1));
... | 8,651,661 |
./full_match/1/0x518eDc741A94B217F07583cDDDEb0266c33DD04D/sources/browser/TorroMigrate.sol | Execution of WITHDRAW proposal. proposal_ proposal. | function _executeWithdraw(Proposal storage proposal_) private {
}
| 17,041,444 |
./full_match/1/0x31a91336414d3B955E494E7d485a6B06b55FC8fB/sources/contracts/vault/VaultAdmin.sol | Set maximum amount of OTokens that can at any point be minted and deployed to strategy (used only by ConvexOUSDMetaStrategy for now). _threshold OToken amount with 18 fixed decimals./ | function setNetOusdMintForStrategyThreshold(uint256 _threshold)
external
onlyGovernor
{
netOusdMintedForStrategy = 0;
netOusdMintForStrategyThreshold = _threshold;
emit NetOusdMintForStrategyThresholdChanged(_threshold);
| 4,932,108 |
pragma solidity ^0.5.0;
import "./SafeMath.sol";
import "./Utilities.sol";
import "./TellorStorage.sol";
import "./TellorTransfer.sol";
import "./TellorDispute.sol";
import "./TellorStake.sol";
import "./TellorGettersLibrary.sol";
import "../interfaces/TokenInterface.sol";
/**
* @title Tellor Oracle System Library
* ... | Reselects validators if any of the first five fail to submit data/ | function reselectNewValidators(TellorStorage.TellorStorageStruct storage self) public{
require( self.uintVars[keccak256("lastSelection")] < now - 30, "has not been long enough reselect");
}
| 12,565,671 |
./partial_match/1313161554/0xEaE47c5D99f7B31165a7f0c5f7E0D6afA25CFd55/sources/IDMMRouter01.sol | full interface for router | interface IDMMRouter01 is IDMMExchangeRouter, IDMMLiquidityRouter {
function factory() external pure returns (address);
function weth() external pure returns (IWETH);
pragma solidity 0.6.12;
}
| 16,916,540 |
./partial_match/1/0x9cc3dB1aCF7fEE59a389261EA0d276a90ea1ADc7/sources/StabilizeStrategyStablecoinArb.sol | Get quantity estimate | function get_dy_underlying(int128, int128, uint256) external returns (uint256); | 2,637,593 |
pragma solidity ^0.4.16;
// VIRAL Token contract based on the full ERC 20 Token standard
// https://github.com/ethereum/EIPs/issues/20
// Symbol: VRT
// Status: ERC20 Verified
contract VIRALToken {
/* This is a slight change to the ERC20 base standard.
function totalSupply() constant returns (uint256 supply);... | Public variables of the token // | function VIRALTOKEN(){
}
| 2,004,893 |
./partial_match/3/0x02f2F6D0C6870cd4fEae271fa6809195dba54099/sources/NimbusPair.sol | update reserves and, on the first call per block, price accumulators never overflows, and + overflow is desired | function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private {
require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'Nimbus: OVERFLOW');
uint32 blockTimestamp = uint32(block.timestamp % 2**32);
if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) {
... | 5,262,168 |
pragma solidity ^0.7.3;
import '@openzeppelin/contracts-upgradeable/presets/ERC20PresetMinterPauserUpgradeable.sol';
contract GovernanceTokenMock is ERC20PresetMinterPauserUpgradeable {
/* ========== STATE VARIABLES ========== */
mapping (address => bool) private _faucetAddresses;
/* ========== MUTATIV... | ========== STATE VARIABLES ========== / ========== MUTATIVE FUNCTIONS ========== / | function faucetRequest() external {
require(!_faucetAddresses[_msgSender()], '!allowed');
_faucetAddresses[_msgSender()] = true;
_mint(_msgSender(), 1000e18);
}
| 13,074,124 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (stri... | Mints `tokenId` and transfers it to `to`. WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible Requirements: - `tokenId` must not exist. - `to` cannot be the zero address. Emits a {Transfer} event./ | function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to... | 351,975 |
pragma solidity ^0.4.24;
/**
* @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... | called by the owner to stopInEmergency , triggers stopped state/ | function stopInEmergency() onlyOwner public {
require(!paused);
paused = true;
emit StateChanged(true);
}
| 5,475,571 |
./full_match/1/0x2d68676c40Bf820Eb84e3B7d8d77a1C473b08B61/sources/contracts/crossChainSwaps/CrossChainSwapsSignatureUtil.sol | Check the signature if the trade offer info is valid or not. _offer trade offer info signature offer signature | function _verifyTradeOfferSignature(
TradeOffer calldata _offer,
bytes memory signature
) internal view {
bytes32 tradeOfferHash = keccak256(
abi.encode(
TRADE_OFFER_TYPE_HASH,
_hashAssetsSet(_offer.offeringAssets),
_hashAssetsS... | 17,067,148 |
pragma solidity ^0.4.20;
// 引入子合约
import './UniswapExchange.sol';
// 定义工厂合约接口
contract FactoryInterface {
// uniswap中现有的代币地址数组
address[] public tokenList;
// 设置a代币地址和a代币流动性池子地址的映射
mapping(address => address) tokenToExchange;
// 设置a代币流动性池子地址和a代币地址的映射
mapping(address => address) exchangeToToken;
... | 根据代币地址返回在交易所中该代币交易对地址 | function tokenToExchangeLookup(address _token) public view returns (address exchange) {
return tokenToExchange[_token];
}
| 1,045,102 |
./full_match/5/0xA13E43d299dd822677f3Cc62d3E77b84DC3665c3/sources/project_/contracts/base/MetawinMinterProxy.sol | This function takes a `MintBatch` struct as input and returns a single `uint256` representing the packed batch data. mintData The `MintBatch` struct to be packed return packedMintData The packed `uint256` data/ | function _packMintData(
MintBatch memory mintData
) private pure returns (uint256 packedMintData) {
packedMintData =
(mintData.startId) +
(uint256(mintData.endId) << 64) +
(uint256(mintData.nextId) << 128) +
(uint256(mintData.maxPerPurchase) << 192... | 1,942,885 |
// SPDX-License-Identifier: MIT
pragma solidity =0.5.0;
contract Betting {
string public name = "Peer to Peer Basketball Betting App";
address public owner;
uint256 public minimumBet;
struct Player {
// Amount bet by a player
uint256 amountBet;
// Team selected by th... | Enforce only the deployer/owner of the contract can call this function Create a temporary in memory array with fixed size of 1000 to store the winners, so there can be at most 1000000 winnerscheck if there actually are any bets on this game, if there are no bets, just skip all of this and set game as "taken place" We l... | function distributePrizes(uint16 _teamWinner, uint256 _gameID) public {
require(msg.sender == owner, "caller must be the owner");
address payable[1000000] memory winners;
address add;
uint256 HomeAmount = games[_gameID].totalBetsHome;
uint256 AwayAmount = games[_gameID].tot... | 13,037,621 |
pragma solidity ^0.5.2;
import "../ethereum-api/oraclizeAPI_0.5.sol";
import "../openzeppelin-solidity/contracts/math/SafeMath.sol";
import "../openzeppelin-solidity/contracts/lifecycle/Pausable.sol";
import "../openzeppelin-solidity/contracts/ownership/Ownable.sol";
contract PriceEmpire is usingOraclize, Pausable, O... | trim the price based on tier to prevent multiple slots of same price being a cityexample a tier 0 must end with "00" and a tier 1 with "0" | function getSlotId(uint256 price, uint8 tier) public pure returns (uint256) {
if(tier == 0)
price = price.div(100).mul(100);
else if(tier == 1)
price = price.div(10).mul(10);
return uint256(keccak256(abi.encodePacked(price, tier)));
}
| 2,475,541 |
./partial_match/1/0xA711b9bc1A40492Fb593582b4c8cD44b35De4caE/sources/Dogeviathan.sol | Returns the addition of two unsigned integers, reverting on overflow. Counterpart to Solidity's `+` operator. Requirements: - Addition cannot overflow./ | function add_outer(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
| 2,605,051 |
./partial_match/1/0x1473F3e4d236CBBe3412b9f65B4c210756BE2C0E/sources/src/FrxEthEthDualOracle.sol | The ```getUsdPerEthChainlink``` function returns USD per ETH using the Chainlink oracle return isBadData If the Chainlink oracle is stale return usdPerEth The Eth Price is usd units | function getUsdPerEthChainlink() public view returns (bool isBadData, uint256 usdPerEth) {
uint256 usdPerEthChainlinkRaw;
(isBadData, , usdPerEthChainlinkRaw) = _getEthUsdChainlinkPrice();
usdPerEth = (ORACLE_PRECISION * usdPerEthChainlinkRaw) / ETH_USD_CHAINLINK_FEED_PRECISION;
}
| 4,389,212 |
pragma solidity 0.6.12;
interface IERC20 {
function TOTALSUPPLY831() external view returns (uint256); //i... | inject NONSTANDARD NAMING | function LOG714(uint p0, uint p1, address p2, string memory p3) internal view { | 14,087,740 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @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, ... | Set the token seeder. Only callable by the owner when not locked./ | function setSeeder(IVerbsSeeder _seeder) external override onlyOwner whenSeederNotLocked {
seeder = _seeder;
}
| 10,107,138 |
pragma solidity ^0.4.11;
library SafeMath {
function mul(uint256 a, uint256 b) pure internal returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) pure internal returns (uint256) {
// assert(b > 0); // Solidity automatic... | Calculates the maximum amount of vested tokens return Number of vested tokens to withdraw | function calcMaxWithdraw()
public
constant
returns (uint)
{
uint maxTokens = (token.balanceOf(this) + withdrawnTokens) * (now - startDate) / disbursementPeriod;
if (withdrawnTokens >= maxTokens || startDate > now)
return 0;
if (maxTokens - withdrawnTok... | 12,825,440 |
// Sources flattened with hardhat v2.1.1 https://hardhat.org
// File @openzeppelin/contracts/math/Math.sol@v3.4.1
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Returns the largest of two nu... | Attempts to withdraw part of a CDP's collateral. This function reverts if a deposit into the CDP was made in the same block. This is to prevent flash loan attacks on other internal or external systems. _amount the amount of collateral to withdraw. | function withdraw(uint256 _amount) external nonReentrant noContractAllowed expectInitialized returns (uint256, uint256) {
CDP.Data storage _cdp = _cdps[msg.sender];
require(block.number > _cdp.lastDeposit, "");
_cdp.update(_ctx);
(uint256 _withdrawnAmount, uint256 _decreasedValue) = _withdrawFundsT... | 496,034 |
// SPDX-License-Identifier: MIT
pragma solidity >0.7.0 <0.9.0;
import "./MaterialBase.sol";
import "./utils/CompanyOwnable.sol";
import "./utils/CertificateAuthorityManagerReferencer.sol";
contract Material is MaterialBase, CompanyOwnable {
constructor(address _masterAddress, address _factoryContractAddress)
... | Burn some tokens from a batch _batchId The batch id that contains material instances _uuids The uuids of the material instance to be burned/ ensure these are my materials | function burnBatchTokens(uint256 _batchId, uint256[] memory _uuids) public {
require(_uuids.length > 0, "Amount needs to be bigger than 0");
require(batch[_batchId].materialsUuid.length >= _uuids.length, "Amount not available");
for (uint256 i = 0; i < _uuids.length; i++) {
burnB... | 12,963,364 |
pragma solidity ^0.4.21;
import "./LoanCdp.sol";
/**
* @title LoanIdentity
* @dev Contract used to determine unique identity of actors on protocol
* NOTE: Each actor must be verified using some identity
*/
contract LoanIdentity is LoanCdp {
mapping (address => uint[]) repayments;
mapping (address => uint[])... | Retrieves the number of defaults/ | function getDefaultsLength(address _address) external view returns (uint) {
return defaults[_address].length;
}
| 15,793,905 |
./full_match/80001/0x2F0A15e506ac8AfaD23f0a2921CB4E06655532c3/sources/contracts/Wrapper.sol | function to lock the token for art approvals | function approveArtUpdate(bool _yesorno, uint _tokennumber) external {
require(msg.sender == ownerOf(_tokennumber), "Not Authorized");
}
| 5,553,843 |
./partial_match/1/0xdb3D91Dcb27547d82A09556D1028beEdB04A5902/sources/src/Sand/erc777/ERC777BaseToken.sol | return the granularity of the token | function granularity() public pure returns (uint256) { return 1; }
| 9,405,492 |
./full_match/1/0x7af62458e41E2F490D2Df54A8FeDc56fFedB8c17/sources/lib/solady/src/tokens/ERC721.sol | Hook that is called after any token transfers, including minting and burning. | function _afterTokenTransfer(address from, address to, uint256 id) internal virtual {}
| 3,202,343 |
./partial_match/42/0x8fb3A267B29c5464fe58B7Cb956d9cCD48CbD125/sources/XConfig.sol | update SAFU and SAFE_FEE to pools | function updateSafu(address[] calldata pools) external onlyCore {
require(pools.length > 0 && pools.length <= 30, "ERR_BATCH_COUNT");
for (uint256 i = 0; i < pools.length; i++) {
require(Address.isContract(pools[i]), "ERR_NOT_CONTRACT");
IXPool pool = IXPool(pools[i]);
... | 9,017,939 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
/*
* @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 be accessed in such a direct
* manner, since when ... | 1. get tokenID with auto-increment 2. mint 3. set tokenURI | function mint(address _receiver, string memory _tokenURI, Copyright[] memory _copyrightInfos) public {
uint256 currentTokenId = tokenIdCounter;
tokenIdCounter++;
_mint(currentTokenId, _receiver, _copyrightInfos);
_setTokenURI(currentTokenId, _tokenURI);
emit SetTokenURI(curre... | 9,849,786 |
./full_match/80001/0x1727bc249Cd28B15C9C5cD4dbFee39DD1976eB63/sources/contracts/LensCrowdStreaming.sol | Update flow from contract to specified address. token Token to stream. receiver Receiver of stream. flowRate Flow rate per second to stream. | function updateFlowFromContract(
ISuperToken token,
address receiver,
int96 flowRate
) external {
token.updateFlow(receiver, flowRate);
}
| 5,570,715 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
interface CTokenInterface {
function underlying() external view returns (address);
}
interface TokenInterface {
function balanceOf(address) external view returns (uint);
function decimals() external view returns (uint);
}
interface OrcaleComp {
... | get Dai address/ | function getDaiAddress() public pure returns (address) {
return 0x6B175474E89094C44Da98b954EedeAC495271d0F;
}
| 596,658 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
import "../../../interfaces/IMarketController.sol";
import "../../../interfaces/IMarketConfig.sol";
import "../../../interfaces/IMarketClerk.sol";
import "../../diamond/DiamondLib.sol";
import "../MarketControllerBase.sol";
import "../MarketControlle... | The lots-based escrow ticketer getter/ | function getLotsTicketer()
external
override
view
returns (address)
{
MarketControllerLib.MarketControllerStorage storage mcs = MarketControllerLib.marketControllerStorage();
return mcs.lotsTicketer;
}
| 1,280,841 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
import "hardhat/console.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol";
import {FixedPointMath} from "../libraries/Fixe... | Withdraws tokens from the vault to the recipient. This function reverts if the caller is not the admin. _recipient the account to withdraw the tokes to. _amount the amount of tokens to withdraw. | function withdraw(address _recipient, uint256 _amount) external override onlyAdmin {
vault.withdraw(_tokensToShares(_amount),_recipient);
}
| 94,245 |
/*
file: LibCLL.sol
ver: 0.4.1
updated:18-Dec-2017
author: Darryl Morris
email: o0ragman0o AT gmail.com
A Solidity library for implementing a data indexing regime using
a circular linked list.
This library provisions lookup, navigation and key/index storage
functionality which can be used in conjunction with an... | Creates a bidirectional link between two nodes on direction `d` | function stitch(CLL storage self, int a, int b, bool d)
internal
{
self.cll[b][!d] = a;
self.cll[a][d] = b;
}
| 7,280,384 |
pragma solidity 0.5.0;
pragma experimental ABIEncoderV2;
import "./oraclizeAPI.sol";
contract deal{
uint public value;
address payable public seller;
address payable public buyer;
uint public landID;
constructor(uint _landID, address payable _buyer , uint _price) public {
... | Do something with viewsCount, like tipping the author if viewsCount > X? | function __callback(
bytes32 _myid,
string memory _result
)
public
{
require(msg.sender == oraclize_cbAddress());
re = _result;
emit LogResultPossible(_result);
}
| 15,819,724 |
pragma solidity ^0.4.22;
import { CarAccessControl } from "./carAccessControl.sol";
contract CarPermit is CarAccessControl {
event PermitAdded(uint256 permitId, uint64 validTill, uint8 permitType);
// event PermitStatus(bool isStillAuthority, bool isValid, bool isStillValid, bool permitType);
// @dev th... | interface to check if a valid permit for parsed type exists gets the standard permit from "_restrictions" | function isPermitted(
uint8 _requiredPermitType
)
internal
view
returns(bool)
{
(uint256 a, uint64 b, uint64 c, uint8 d) =
getPermit(_restrictions[_requiredPermitType]);
if (isValidPermit(a, b, c, d, _requiredPermitType)) {
return true;... | 12,695,749 |
/**
*Submitted for verification at Etherscan.io on 2020-08-11
*/
pragma solidity ^0.4.24;
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
... | ------------------------------------------------------------------------ Function to mint tokens _to The address that will receive the minted tokens. _amount The amount of tokens to mint. A boolean that indicates if the operation was successful. ------------------------------------------------------------------------ | function mint(address _to, uint256 _amount) onlyOwner public returns (bool) {
require(_to != address(0));
require(_amount > 0);
uint newamount = _amount * 10**uint(decimals);
_totalSupply = _totalSupply.add(newamount);
balances[_to] = balances[_to].add(newamount);
e... | 1,603,731 |
pragma solidity ^0.6.12;
// Copyright (C) 2018 Argent Labs Ltd. <https://argent.xyz>
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option)... | Checks if an address is an Argent wallet _wallet The target wallet/ | function isArgentWallet(address _wallet) external view returns (bool) {
bytes32 codeHash;
return acceptedCodes[codeHash].exists && acceptedImplementations[IArgentProxy(_wallet).implementation()].exists;
}
| 10,396,423 |
pragma solidity 0.5.3;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in... | Destoys `amount` tokens from `account`, reducing the total supply. Emits a `Transfer` event with `to` set to the zero address. Requirements - `account` cannot be the zero address. - `account` must have at least `amount` tokens./ | function _burn(address account, uint256 value) internal {
require(account != address(0), "ERC20: burn from the zero address");
require(_balances[account] >= value, "ERC20: burn overflow from address");
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].s... | 5,510,155 |
/**
*Submitted for verification at Etherscan.io on 2021-08-23
*/
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount o... | Convert cash amount to fund amount This converts cash amount to fund amount when a user buys the fund cashAmount Join cash amount return Fund amount | function convertToFund(uint256 cashAmount) public virtual override view returns (uint256){
uint256 totalSupply = totalSupply();
uint256 _assets = assets();
if (totalSupply == 0 || _assets == 0) {
return cashAmount;
return cashAmount.mul(totalSupply).div(_assets);
... | 6,627,285 |
./partial_match/3/0xc1254C6d9e35760b0c69cD52cE381e5CF45a2898/sources/XYZSwapPair.sol | update reserves | function _update(bool isAmpPool, ReserveData memory data) internal {
uint32 blockTimestamp = uint32(block.timestamp % 2**32);
reserve0 = safeUint112(data.reserve0);
reserve1 = safeUint112(data.reserve1);
blockTimestampLast = blockTimestamp;
if (isAmpPool) {
requir... | 5,334,998 |
./full_match/1/0xd1Ad8a5D9Be8267D833f23c7D2349b6A2B30b0AD/sources/contracts/Boneyard.sol | @inheritdoc IBoneyard/ Create a new race and store it | function createRace(uint256 tokenId, uint256 maxLevel)
external
virtual
nonReentrant
whenNotRacing(tokenId)
whenNotPaused
returns (uint256)
{
if (_levelOf(tokenId) > maxLevel) {
revert LevelTooHigh();
}
unchecked {
... | 8,352,490 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.4;
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "./module/PerpetualModule.sol";
import "./Type.sol";
import "./Storage.sol";
import "./interface/ILiquidityPoolGovernance.sol";
// @title Governance is the contract to maintai... | Force to set the state of the perpetual to "EMERGENCY" and set the settlement price. Can only called by the governor. perpetualIndex The index of the perpetual in liquidity pool./ | function forceToSetEmergencyState(uint256 perpetualIndex, int256 settlementPrice)
external
syncState(true)
onlyGovernor
{
require(settlementPrice >= 0, "negative settlement price");
OraclePriceData memory settlementPriceData = OraclePriceData({
price: settleme... | 12,843,704 |
./partial_match/80001/0x3715FE0c0E39c2D28dB7f374Fe1F58481da51697/sources/contracts/libraries/AdaptiveFee.sol | Calculates fee based on formula: baseFee + sigmoid1(volatility) + sigmoid2(volatility) maximum value capped by baseFee + alpha1 + alpha2 | function getFee(uint88 volatility, AlgebraFeeConfigurationU144 config) internal pure returns (uint16 fee) {
unchecked {
uint256 sumOfSigmoids = sigmoid(volatility, config.gamma1(), config.alpha1(), config.beta1()) +
sigmoid(volatility, config.gamma2(), config.alpha2(), config.beta2());
uint25... | 8,820,044 |
./full_match/5/0x58DD2f5b74662A781177E1daa0c9A2eF10a38a8B/sources/contracts/Contract.sol | removes address from authorized list, onwer access only | function removeauthuser(uint256 id, address user) public {
require(msg.sender == records[id].owner, "Access Denied");
require(access(user, records[id].authUsers), "User Does Not Have Authorization");
uint256 removal_id;
for (uint256 i = 0; i < records[id].authUsers.length-1; i++) {
... | 7,054,406 |
pragma solidity ^0.4.12;
//Compiler Version: v0.4.12+commit.194ff033
/**
* Math operations with safety checks
*/
contract SafeMath {
function safeMul(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeDiv(uint... | A contract attempts to get the coins / | function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
if (_value <= 0) throw;
allowance[_from][msg.sender] = SafeMath.safeSub(allowance[_from][msg.sender], _value);
soldToken +=_value;
Transfer(_from, _to, _value);
return true;
}
| 7,283,084 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IAccessControlEnumerableUpgradeable.sol";
import "./AccessControlUpgradeable.sol";
import "../utils/structs/EnumerableSetUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Extension of {AccessControl} that allows enumerating the ... | Get last claim timestamp of a specified tokenId | function getLastClaim(uint256 tokenId) public view returns (uint256) {
return lastClaim[tokenId];
}
| 457,320 |
pragma solidity 0.4.24;
/**
* CryptoCanvas Terms of Use
*
* 1. Intro
*
* CryptoCanvas is a set of collectible artworks (“Canvas”) created by the CryptoCanvas community with proof of ownership stored on the Ethereum blockchain.
*
* This agreement does a few things. First, it passes copyright ownership of a Canvas from ... | Marks canvas as finished if all the pixels has been already set. Starts initial bidding session./ | function _finishCanvasIfNeeded(Canvas storage _canvas, uint32 _canvasId) private {
if (_isCanvasFinished(_canvas)) {
activeCanvasCount--;
_canvas.state = STATE_INITIAL_BIDDING;
emit CanvasFinished(_canvasId);
}
}
| 5,907,360 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.7.5;
pragma experimental ABIEncoderV2;
import {IAaveDistributionManager} from '../interfaces/IAaveDistributionManager.sol';
import {SafeMath} from '../lib/SafeMath.sol';
import {DistributionTypes} from '../lib/DistributionTypes.sol';
/**
* @title DistributionMan... | Claims an `amount` of `REWARD_TOKEN` to the address `to` to Address to send the claimed rewards amount Amount to stake/ | function claimRewards(address to, uint256 amount) external override(IStakedToken, StakedTokenV2) {
_claimRewards(msg.sender, to, amount);
}
| 14,847,127 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.7.0;
contract MatchPennies {
uint constant public stake = 1 ether; // The stake
uint public initialstake; // stake of first player
enum Moves {None,Zero, One} // Possible moves of pick
enum Outcomes {None, Play... | Compute the outcome and pay the winner(s) and return the outcome. Both players' pick and guess must be valid | function reveal() public returns (Outcomes) {
if (pickPlayerA == Moves.None || pickPlayerB == Moves.None ) {
return Outcomes.None;
}
Outcomes outcome;
if (pickPlayerA == pickPlayerB ) {
outcome = Outcomes.PlayerA;
}
else if... | 14,075,498 |
/**
*Submitted for verification at Etherscan.io on 2021-02-26
*/
// 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... | Claim rewards for specific epoch | function claimRewardsForEpoch(uint256 amount, uint256 epoch)
public
updateReward(msg.sender)
{
require(amount > 0, 'Amount cannot be zero');
uint256 claimable = calculateClaimableRewardsForEpoch(msg.sender, epoch);
if (claimable > 0) {
require(
... | 7,831,280 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)
pragma solidity ^0.8.0;
import "./IAccessControlUpgradeable.sol";
/**
* @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
*/
interface IAccessControlEnumerableUpgradeable is... | returns `p`, `q`, `r`, `s`, `t`, `u` and `v` according to the current state: +-------------------+-----------------------------------------------------------+ | `e > (b+c)/(1-n)` | bootstrap deficit or default deficit or arbitrage deficit | +-------------------+----------------------------------------------------------... | function calculateWithdrawalAmounts(
) internal pure returns (Output memory output) {
if (
a > type(uint128).max ||
b > type(uint128).max ||
c > type(uint128).max ||
e > type(uint128).max ||
w > type(uint128).max ||
m > M ||
... | 10,394,517 |
./partial_match/1/0x6290E58Dfc565E9f830169Bd5b8FC967Ca0DbDBA/sources/MrWhite.sol | See {IERC20-approve}. Requirements: - `spender` cannot be the zero address./ | function approve(address spender, uint256 amount)
public
virtual
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
| 15,613,524 |
/**
* SourceUnit: /home/jgcarv/Dev/NFT/Orcs/etherOrcs-contracts/src/mainnet/EtherOrcs.sol
*/
////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: AGPL-3.0-only
pragma solidity 0.8.7;
/// @notice Modern and gas efficient ERC-721 + ERC-20/EIP-2612-like implementation,
/// including the MetaData, and ... | Picking the largest value between block.timestamp, action.timestamp and startingTime | function _doAction(uint256 id, address orcOwner, Actions action_, address who_) internal ownerOfOrc(id, who_) {
Action memory action = activities[id];
require(action.action != action_, "already doing that");
uint88 timestamp = uint88(block.timestamp > action.timestamp ? block.timestamp : ac... | 2,033,688 |
pragma solidity ^0.5.10;
/** @title BitcoinSPV */
/** @author Summa (https://summa.one) */
import {BytesLib} from "./BytesLib.sol";
import {SafeMath} from "./SafeMath.sol";
library BTCUtils {
using BytesLib for bytes;
using SafeMath for uint256;
// The target at minimum Difficulty. Also the target of th... | Extracts the timestamp from a block header Time is not 100% reliable _header The header return The timestamp (uint) | function extractTimestamp(bytes memory _header)
internal
pure
returns (uint32)
{
return
uint32(bytesToUint(reverseEndianness(extractTimestampLE(_header))));
}
| 5,491,252 |
//SPDX-License-Identifier: A hedgehog wrote this contract
pragma solidity ^0.8.0;
import "./Doomsday.sol";
contract DoomsdayViewerPatch{
Doomsday doomsday;
uint constant IMPACT_BLOCK_INTERVAL = 120;
int64 constant MAP_WIDTH = 4320000; //map units
int64 constant MAP_HEIGHT = 2588795;... | uint nextEliminationBlock = block.number - (block.number % IMPACT_BLOCK_INTERVAL) + IMPACT_BLOCK_INTERVAL - 5 ;goes from BLOCK - (IMPACT_BLOCK_INTERVAL-1) - 5 to BLOCK - 5 return nextEliminationBlock + 5 - block.number; | function nextImpactIn() public view returns(uint){
uint eliminationBlock = block.number - (block.number % IMPACT_BLOCK_INTERVAL) - 5;
return IMPACT_BLOCK_INTERVAL - ((block.number - 5) - eliminationBlock);
}
| 10,052,745 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
/* solhint-disable */
// REMIX
// import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.4/contracts/access/Ownable.sol";
// import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.4/contracts/math/SafeMath.sol";
//... | Check Payment Status nftId - nftId of the artwork return whether artwork was paid/ | function isArtworkPaid(uint256 nftId) public view returns (bool) {
return _winnerPaid[nftId];
}
| 611,614 |
// SPDX-License-Identifier: MIT
/**
* Copyright (C) SettleMint NV - All Rights Reserved
*
* Use of this file is strictly prohibited without an active license agreement.
* Distribution of this file, via any medium, is strictly prohibited.
*
* For license inquiries, contact hello@settlemint.com
*/
pragma solidity... | Seller's USDT to payout wallet address | function payout(uint256 dealIndex) public hasAdminRole {
Deal storage deal = _dealIndexToDeal[dealIndex];
require(
!deal.payoutCompleted &&
deal.accepted &&
deal.validUntil <= block.timestamp,
"ID"
address[] memory DTXToUSDTPath = new address[](2);
DTXToUSDTPath[0] = addr... | 15,785,144 |
./full_match/1/0xc258fF338322b6852C281936D4EdEff8AdfF23eE/sources/lib/prb-math/src/UD60x18.sol | Multiplies two UD60x18 numbers together, returning a new UD60x18 number. See the documentation for the `Core/mulDiv18` function. x The multiplicand as an UD60x18 number. y The multiplier as an UD60x18 number. return result The product as an UD60x18 number. | function mul(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {
result = wrap(mulDiv18(unwrap(x), unwrap(y)));
}
| 4,833,918 |
/**
*Submitted for verification at Etherscan.io on 2022-02-01
*/
// File: @openzeppelin/contracts/utils/structs/EnumerableSet.sol
// OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol)
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[se... | Optional function to set the base URI/ | function setBaseURI(string memory baseURI_) external {
require(
hasRole(DEFAULT_ADMIN_ROLE, msg.sender),
"BoaxNFT: must have DEFAULT_ADMIN_ROLE to set base URI"
);
_baseTokenURI = baseURI_;
}
| 2,010,678 |
pragma solidity 0.5.12;
import "./Handler.sol";
import "./interface/ILendFMe.sol";
import "./library/ReentrancyGuard.sol";
contract MoneyMarketHandler is Handler, ReentrancyGuard {
address public targetAddr; // market address
mapping(address => uint256) public interestDetails;
event NewdTargetAddr(
... | Total balance with any accumulated interest for _underlyingToken belonging to handler _underlyingToken Token to get balance./ | function getRealBalance(address _underlyingToken)
public
view
returns (uint256)
{
return
ILendFMe(targetAddr).getSupplyBalance(
address(this),
_underlyingToken
);
}
| 2,543,659 |
/*
website: cityswap.io
█████╗ ████████╗██╗ ██╗███████╗███╗ ██╗███████╗ ██████╗██╗████████╗██╗ ██╗
██╔══██╗╚══██╔══╝██║ ██║██╔════╝████╗ ██║██╔════╝ ██╔════╝██║╚══██╔══╝╚██╗ ██╔╝
███████║ ██║ ███████║█████╗ ██╔██╗ ██║███████╗ ██║ ██║ ██║ ╚████╔╝
██╔══██║ ██║ ██╔══██║██╔══╝ ██║╚██... | Deposit LP tokens to TravelAgency for CITY allocation. | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accCityPerShare).div(1e12).sub(user.rewardD... | 98,175 |
./full_match/10/0xaA1177255597A5252829aC3A247B626F1E4a2bAb/sources/contracts/utils/VestingEscrow.sol | 토큰을 필요한 수량만큼 해당 컨트랙트로 이관하는 함수, 다만 Approve는 서명으로 수행함/ | function fund(
uint256 amount,
uint8 v,
bytes32 r,
bytes32 s
) external onlyOwner {
IERC2612(address(token)).permit(msg.sender, address(this), amount, type(uint256).max, v, r, s);
assert(safeTransferFrom(token, msg.sender, address(this), amount));
unalloca... | 3,777,506 |
./full_match/11155111/0x15301EfE9edcf7EC087205f4870d3715860832E4/sources/contracts/ActivationHandler.sol | Set discount tiers Clear the current discount tiers and keys Set the new discount tiers and update the keys array | function setDiscountTiers(
uint256[] memory _minimumBalances,
uint256[] memory _discountedPrices
) external onlyOwner {
require(
_minimumBalances.length == _discountedPrices.length,
"Input arrays must have same length"
);
for (uint256 i = 0; i < d... | 3,841,949 |
./partial_match/1/0xb7d4797D48141cA2dDcD9fD554ff580806031860/sources/contracts/TypeERC721OperationFilter.sol | See {IERC721-safeTransferFrom}. In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry./ | function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data)
public
override (ERC721, IERC721)
onlyAllowedOperator(from)
{
super.safeTransferFrom(from, to, tokenId, data);
}
| 4,153,008 |
pragma solidity ^0.5.0;
import '../interfaces/IERC20.sol';
import '../access/roles/MinterRole.sol';
import '../math/SafeMath.sol';
import './SafeERC20.sol';
/**
* @title Token
* @dev Contract that implements ERC20 token standard
* Is deployed by `Crowdsale.sol`, keeps track of gBalances, etc.
*/
contract Token... | Internal function that burns an amount of the token of a given account, deducting from the sender's allowance for said account. Uses the internal burn function. Emits an Approval event (reflecting the reduced allowance). account_ The account whose tokens will be burnt. value_ The amount that will be burnt./ | function _burnFrom(address account_, uint256 value_) internal {
gAllowed[account_][msg.sender] = gAllowed[account_][msg.sender].sub(value_);
_burn(account_, value_);
emit Approval(account_, msg.sender, gAllowed[account_][msg.sender]);
}
| 14,114,717 |
./partial_match/1/0xC7e63B18dEDF226b1C1a7A436953a63c518bd442/sources/walletCache.sol | IWalletCache interface describes a method for poping an already cached wallet | interface IWalletCache {
function walletCachePop() external returns (address payable);
}
| 4,141,666 |
./full_match/97/0x5cfdc1D8d817D13E3D6A5349Ee2DD384073905bB/sources/Shibanomics.sol | Update the gasForProcessing needed to auto-distribute rewards newValue The new amount of gas needed The amount should not be greater than 500k to avoid expensive transactions | function setGasForProcessing(uint256 newValue) external onlyOwner {
require(newValue >= 200000 && newValue <= 500000, "SHIBIN: gasForProcessing must be between 200,000 and 500,000");
require(newValue != gasForProcessing, "SHIBIN: Cannot update gasForProcessing to same value");
emit GasForPro... | 5,031,337 |
// SPDX-License-Identifier: MIT
/*
# # # #####
## ## ###### ##### ## # # ##### ##### # # # # # #####
# # # # # # # # # # # # # # # # # # #
# # # ##### # # # ... | get total minted (does not take into account burned tokens)/ | function totalMinted() external view returns (uint256) {
uint256 minted = 0;
for (uint256 tierIndex = 0; tierIndex < numberOfTiers; tierIndex++) {
minted += _tiers[tierIndex].index - _tiers[tierIndex].minIndexInclusive;
}
return minted;
}
| 609,432 |
./full_match/1/0x5bF5BCc5362F88721167C1068b58C60caD075aAc/sources/contracts/ProofOfStake_Pages.sol | Updates the user token if we have a valid msg from Vitalik/prettier-ignore Will be wockis address in live v Signature will be invalid if it isn't to caller && EIP712: "Addresses are encoded as uint160" EIP712: "values bytes and string are encoded as a keccak256 hash" | function updateIfSigned(
bytes calldata _signature,
string calldata _sigValue,
string calldata _timestamp,
string calldata _message
) external nonReentrant {
(uint8 v, bytes32 r, bytes32 s) = Transforms.splitSignature(_signature);
bytes32 hashStruct = keccak256(... | 8,378,679 |
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
import './provableAPI_0.6.sol';
// Interfaces
interface ISwappToken {
function currentSwappDay() external view returns (uint64);
function approve(address _spender, uint256 _value) external returns (bool success);
function mintSupply(address _investo... | shows current day of SwappToken value is fetched from SWAPP_CONTRACT return iteration day since SWAPP inception/ | function _currentSwappDay() public view returns (uint64) {
return SWAPP_CONTRACT.currentSwappDay();
}
| 6,013,317 |
./full_match/80001/0x60fCa84E509dAFa4BD922E6C7B222aF03DdF264b/sources/contracts/NFTRentMarketplace.sol | Update the owner of the item if the current owner is not the sender | function addItemToPool(uint256 _nftId, address _nftContractAddress) public onlyNftOwner(_nftId, _nftContractAddress) {
uint256 itemId = nftContractToNftIdToItemId[_nftContractAddress][_nftId];
Item storage item = items[itemId];
Pool storage pool = pools[item.categoryId];
require(item.id != 0, "Item d... | 5,614,753 |
./partial_match/1/0x1ECFDCcf97EdD64Fb73890Ca4541f306456A21eC/sources/Metarelics.sol | backup mint function | function mint()
public
payable
nonReentrant
{
uint256 supply = totalSupply();
if (msg.sender != owner()) {
requireChecks(1);
require(msg.value >= cost, "insufficient funds");
require(isBackupSale == true, "Main sale not available.");
require(addressMintedBalance[msg.sender] == 0,... | 3,544,587 |
./full_match/3/0xCBc5F459CbFfF0B147c027BBef1cA2F42eC2029e/sources/arock.sol | is whitelist minting live / | function isWhitelistMintingActive() public view returns(bool){
return whitelistMinting;
}
| 8,262,188 |
/**
*Submitted for verification at Etherscan.io on 2020-11-26
*/
/*
SPDX-License-Identifier: MIT
*/
pragma solidity ^0.6.12;
/*
* @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.d... | Withdraw LP tokens from MasterChef. | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accRAMBAPerSha... | 2,238,613 |
/** Copyright (c) 2018, ZSC Dev Team
* 2018-10-19: v0.00.01
*/
pragma solidity ^0.4.25;
// pragma experimental ABIEncoderV2;
import "../utillib/LibString.sol";
import "../utillib/LibInt.sol";
import "../common/pausable.sol";
import "../common/delegate.sol";
contract InsuranceCompany {
// function update(stri... | return true if the contract is paused, false otherwise./ | function paused() public view _onlyOwner returns (bool) {
return super.paused();
}
| 1,811,871 |
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an... | If there is no partner associated with the referral id then no fee will be takenCalculate total fee to be takenCalculate partner's shareAll remaining fee is paraswap's shareCalculate total fee to be takenCalculate partner's shareAll remaining fee is paraswap's share | function _takeFee(
IERC20 toToken,
uint256 receivedAmount,
uint256 expectedAmount,
string memory referrer
)
private
returns(uint256 fee)
{
address partnerContract = _partnerRegistry.getPartnerContract(referrer);
if (partnerContract == address... | 1,493,257 |
./partial_match/1/0xCbBfC2Ce0c227fB40295954Caf01B7345EDb1248/sources/CryptojoyTokenSeller.sol | Multiplies two numbers, reverts on 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/openzeppelin-solidity/pull/522 | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b,"");
return c;
}
| 3,582,287 |
./partial_match/56/0x78BD25aB3fA11A5da06c9299e109Fb18840135F3/sources/FairLaunch.sol | Add a new lp to the pool. Can only be called by the owner. | function addPool(
uint256 _allocPoint,
address _stakeToken,
address _locker,
bool _withUpdate
) public override onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
require(_stakeToken != address(0), "add: not stakeToken addr");
require(!isDuplicatedPool(_stakeToken), "add: stak... | 11,211,042 |
./partial_match/1313161554/0x8a7FFE979095F0ee1Fed23B455d25b46d11B6B9D/sources/EthernalTreasury.sol | Dynamic max expansion percent First 28 epochs with 4.5% expansion set seigniorageSaved to it's balance | function initialize(
address _ethernal,
address _ebond,
address _spolar,
address _ethernalOracle,
address _masonry,
uint256 _startTime,
address[] memory _excludedFromTotalSupply
) public notInitialized onlyOperator {
ethernal = _ethernal;
e... | 16,928,148 |
./full_match/1/0x6a2Df7Fd15612079D1a72001F3a921Db792B2738/sources/lib/solady/src/utils/DateTimeLib.sol | Returns if `timestamp` is a supported unix timestamp. | function isSupportedTimestamp(uint256 timestamp) internal pure returns (bool result) {
unchecked {
result = timestamp < MAX_SUPPORTED_TIMESTAMP + 1;
}
}
| 17,179,002 |
./full_match/1/0xBCF9F4c6FC589c89d4aAdE063010D0f5B3733680/sources/contracts/discovery/GNS.sol | Allow a nameCurator to burn some of its nSignal and get GRT in return _graphAccount Subgraph owner _subgraphNumber Subgraph owners subgraph number which was curated on by nameCurators _nSignal The amount of nSignal the nameCurator wants to burn _tokensOutMin Expected minimum amount of tokens to receive/ Pool checks... | function burnNSignal(
address _graphAccount,
uint256 _subgraphNumber,
uint256 _nSignal,
uint256 _tokensOutMin
) external override notPartialPaused {
NameCurationPool storage namePool = nameSignals[_graphAccount][_subgraphNumber];
require(namePool.disabled == false... | 4,905,731 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.1;
import "./Tachyontoken.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
// Functionality :
// Set a fee Ac; -- tested
// Deposit Ether; -- tested
// Withdraw Ether; -- tested
// Deposit Tokens; -- tested
// Withdraw Tokens... | fee is given by the person who fills order | function _trade(uint _orderid, address _user, address _tokenGet, uint _amountGet, address _tokenGive, uint _amountGive)internal{
uint _feeAmount = _amountGive.mul(feePercent).div(100);
tokens[_tokenGet][msg.sender] = tokens[_tokenGet][msg.sender].sub(_amountGet.add(_feeAmount));
tokens[_tok... | 12,802,557 |
./full_match/80001/0xD8224491fcF8dE30135A4c53ac2c1Edb90D82A06/sources/MembershipCrossmint.sol | get minted NFTs of tokenId | function getTotalNFTsMintedForId(
uint256 _id
) public view returns (uint256) {
return minted[_id];
}
| 845,060 |
./full_match/4/0x9ce71Fd97d5cc7f47a00428A2e8f2E24E5416f27/sources/NFTYFactory.sol | Minting an NFT _collectionName Collection Name to view in opensea _amount How many copies to create _price Token price _metadataURI Metadata URI _data Data. By default "0x00" return NFT ID integer/ | function mint(
string memory _collectionName,
uint256 _amount,
uint256 _price,
uint256 _royaltyAmount,
string memory _metadataURI,
bytes memory _data
) public returns (uint256) {
address clone = ClonesUpgradeable.clone(implementedContractAddress);
... | 12,388,625 |
pragma solidity ^0.4.18;
import './ERC20.sol';
import './SafeMath.sol';
contract OldToken is ERC20 {
// flag to determine if address is for a real contract or not
bool public isVowmeToken;
}
contract NewToken is ERC20 {
using SafeMath for uint256; // use safe math operations
// flag to determine if ... | this prevents createToken from being called after finalized | function finalizeUpgrade() external {
require(msg.sender == upgradeAgent);
require(!upgradeFinalized);
upgradeFinalized = true;
}
| 12,847,433 |
./full_match/4/0x897cCc4d7825Ad59985e434ebff2B7b8b90B6b18/sources/contracts/SecondaryPoolERC20.sol | currentEventPriceChangePercent - from 1% to 40% (with 1e18 math: 1e18 == 100%) / | function submitEventStarted(uint256 currentEventPriceChangePercent)
external
override
onlyEventContract
{
require(
currentEventPriceChangePercent <= 0.4 * 1e18,
"Too high event price change percent submitted: no more than 40%"
);
require(
... | 692,612 |
./partial_match/1/0x441761326490cACF7aF299725B6292597EE822c2/sources/UNFI.sol | Gets the last token transaction of the specified address. owner The address to query the balance of./ | function lastTransactionOf(address owner) public view returns (uint256,uint256) {
return (_lastSendTransaction[owner],_lastReceiveTransaction[owner]);
}
| 2,615,348 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.10;
import {Ownable} from "../../lib/Ownable.sol";
import {Pausable} from "../../lib/Pausable.sol";
import {Reentrancy} from "../../lib/Reentrancy.sol";
import {ERC721, IERC721, IERC165} from "../../lib/ERC721/ERC721.sol";
import {IERC721Metadata} from "... | Allows the owner to set a global limit on the total supply throws if attempting to increase the limit enforce that the limit should only ever decrease once set announce the change in limit oldLimit newLimit update the limit. | function setLimit(uint256 limit_) external override onlyOwner {
require(
limit == 0 || limit_ < limit,
"limit must be < than current limit"
);
emit EditionLimitSet(
limit,
limit_
);
limit = limit_;
}
| 6,224,592 |
pragma solidity ^0.4.23;
interface ApproveAndCallFallBack {
function receiveApproval(
address from,
uint256 _amount,
address _token,
bytes _data
) external;
}
contract Controlled {
/// @notice The address of the controller is the only address that can call
... | Burns `_amount` tokens from `_owner` _owner The address that will lose the tokens _amount The quantity of tokens to burn return True if the tokens are burned correctly/ | function destroyTokens(
address _owner,
uint _amount
)
public
onlyController
returns (bool)
{
uint curTotalSupply = totalSupplyAt(block.number);
require(curTotalSupply >= _amount);
uint previousBalanceFrom = balanceOfAt(_owner, block.number);
... | 5,388,953 |
/**
*Submitted for verification at Etherscan.io on 2021-07-09
*/
/*
EFI
Ethereum Finance
ethereumfinance.io
>> eSTOCKs
>> eBONDs
*/
pragma solidity ^0.6.12;
abstract contract ReentrancyGuard {
// Booleans are more expensive th... | underflow attempts BTFO | function tokensToEthereum_(uint256 _tokens)
internal
view
returns(uint256)
{
uint256 tokens_ = (_tokens + 1e18);
uint256 _tokenSupply2 = (_totalSupply + 1e18);
uint256 _etherReceived =
(
SafeMath.sub(
(
(
... | 15,010,667 |
./partial_match/82/0x267E10BB464d3937613F60655163D11392829E03/sources/Users/huanglu/workspace/ETHEREUM/venus/chee-protocol/contracts/Governance/CHEE.sol | Transfer `amount` tokens from `msg.sender` to `dst` dst The address of the destination account rawAmount The number of tokens to transfer return Whether or not the transfer succeeded/ | function transfer(address dst, uint rawAmount) external validLock returns (bool) {
uint96 amount = safe96(rawAmount, "CHEE::transfer: amount exceeds 96 bits");
_transferTokens(msg.sender, dst, amount);
return true;
}
| 16,900,628 |
./partial_match/1/0xC8431fEb345B46c30A4576c1b5faF080fdc54e2f/sources/contracts/allocators/BtrflyAllocator.sol | Should only ever have a single element in amounts | function deallocate(uint256[] memory amounts) public override {
_onlyGuardian();
if (amounts[0] > 0) {
staking.unstake(amounts[0], false);
}
}
| 4,064,316 |
// Copyright (c) 2016-2019 Clearmatics Technologies Ltd
// SPDX-License-Identifier: LGPL-3.0+
pragma solidity ^0.4.23;
import "../storage/FabricStore.sol";
import "../libraries/ERC223Compatible.sol";
import "../libraries/RLP.sol";
/*
This contract serves as a example of how to perform DvP using the Ion framework ... | When called transfers the escrowed token for a specific trade agreement to designated receiver if the trade has been fulfilled on the Fabric ledger _chainId Identifier of the fabric chain on which the trigger has occured _channelId specific channel of Fabric chain in which tx should have occured _key Key in ledger t... | function retrieveAndExecute(bytes32 _chainId, string _channelId, string _key) public {
uint blockVersion;
uint txVersion;
string memory value;
(blockVersion, txVersion, value) = blockStore.getState(_chainId, _channelId, _key);
RLP.RLPItem[] memory rlpValue =... | 7,275,487 |
pragma solidity ^0.4.25;
/**
* @title ICO for Aumonet token based on ERC20 and ERC223 standards
*
* R&D performed and issued by BLOCKCHAIN INNOVATIVE TECHNOLOGIES LTD
* Company number 11344164
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev https://... | Can be overridden to add finalization logic. The overriding function should call super.finalization() to ensure the chain of finalization is executed entirely./ | function finalization()internal {}
| 6,964,012 |
./full_match/11155111/0xBC6562907FD8F718467a73be963733486B95C8b3/sources/contracts/Lottery.sol | We highly recommend revalidating the upkeep in the performUpkeep function | function performUpkeep(bytes calldata /* performData */) external override {
if (block.timestamp > startTime + interval) {
pickWinners();
return;
}
if (msg.sender == owner()) {
pickWinners();
}
| 3,794,730 |
./partial_match/1/0x00000000000006c7676171937C444f6BDe3D6282/sources/contracts/helpers/PointerLibraries.sol | Reads the bytes18 at `rdPtr` in returndata. | function readBytes18(
ReturndataPointer rdPtr
) internal pure returns (bytes18 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
| 4,300,379 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.