file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
/** *Submitted for verification at Etherscan.io on 2021-03-12 */ pragma solidity 0.6.6; // File: @openzeppelin/contracts/GSN/Context.sol /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.send...
`spreadE8` is less than 0.15 108.
function _calcRateBondToEth(bytes32 bondID, bytes32 poolID) internal returns ( uint256 rateE8, uint256 bondPriceE8, uint256 swapPairPriceE8, int256 spreadE8 ) { ( , LatestPriceOracleInterface ethOracle, ...
6,770,821
pragma solidity 0.5.11; /** * @title Gods Unchained ERC-721 Token Raffle * @author Unchained Games */ contract RaffleMarket { // You can't win the raffle if you don't buy a ticket // ==== EVENTS ==== // /** * @dev OnBuyRaffleTickets emits an event when raffle tickets are purchased * * @...
setTokenAddress sets the ERC721 token address once from the constructor _tokenAddress - The ERC721 token address/
function setTokenAddress(address _tokenAddress) private { tokenAddress = _tokenAddress; emit OnSetTokenAddress(_tokenAddress); }
944,829
// 定义语言和版本 pragma solidity ^0.4.16; // 调用人合约 contract owned { //地址 address public owner; constructor () public { owner = msg.sender; } //必须是自己 modifier onlyOwner { require(msg.sender == owner); _; } //转移所有权 function transferOwnership(address newOwner) onl...
Set allowance for other address 设置配额给其他地址 Allows `_spender` to spend no more than `_value` tokens in your behalf _spender The address authorized to spend _value the max amount they can spend/
function approve( address _spender, uint256 _value) public returns (bool success) { emit Approval(msg.sender, _spender, _value); return true; }
9,838,075
pragma solidity ^0.6.6; pragma experimental ABIEncoderV2; import "../node_modules/@openzeppelin/contracts/access/Ownable.sol"; import "../node_modules/@openzeppelin/contracts/math/SafeMath.sol"; import "../node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../node_modules/@openzeppelin/contracts/tok...
Get balance diffs of old assets
function __postProcessCall( uint256[] memory preBalances, address[] memory receivedAssets ) private returns ( address[] memory incomingAssets_, uint256[] memory incomingAmounts_, address[] memory outgoingAssets_, uint256[] memory ou...
12,807,988
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import "ds-test/test.sol"; import {MockProvider} from "./MockProvider.sol"; // solhint-disable func-name-mixedcase contract MockProviderTest is DSTest { MockProvider internal mockProvider; function setUp() public { mockProvider = new Moc...
solhint-disable-next-line avoid-low-level-calls
function test_setDefault_Enables_ReturnResponseOnQuery( bytes memory response_ ) public { bytes memory query = hex"11223344"; mockProvider.setDefault(response_); (bool okReceived, bytes memory responseReceived) = address(mockProvider) .call(query); assertTr...
5,386,085
./full_match/3/0x03b0258e8A3d9C0a7574bD55b06815998345ec1B/sources/contracts/DiamondHoldTestETH.sol
Returns true if an `wallet` is excluded from the reflection system/
function isExcludedFromReflection(address wallet) public view returns (bool) { return _isExcludedFromReflection[wallet]; }
8,267,717
// SPDX-License-Identifier: Unlicensed /** The Bucks Bunny Coin is the brainchild of a team that grew up watching a slew of now classic cartoon shows that were products of passionate creativity, inspired ingenuity and meticulous love. It was a glorious period when every frame was hand-drawn with zealous care and ev...
exclude from paying fees or having max transaction amount
constructor() ERC20("Bucks Bunny", "BUCKS BUNNY") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Fa...
11,674,657
// SPDX-License-Identifier: MIT pragma solidity ^0.8.6; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; /** LongVaultTokens: Mostly an exploration of ERC1155, probably useless */ contract...
Mint a LongVaultTokens token. account_ The account that the token will be assigned to. tokenId_ The id of the token type to mint. amount_ The amount of the token to be deposited./
function mint( address account_, uint tokenId_, uint amount_, bytes memory data_ ) public onlyRole(DEFAULT_ADMIN_ROLE) { _mint(account_, tokenId_, amount_, data_); }
13,135,430
pragma solidity 0.8.11; // SPDX-License-Identifier: MIT import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contract...
require new unlock time to be longer than old one
function _prolongLiquidityLock(uint256 newUnlockTime) private{ require(newUnlockTime>_liquidityUnlockTime); _liquidityUnlockTime=newUnlockTime; }
1,349,486
pragma solidity 0.4.24; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "openzeppelin-solidity/contracts/lifecycle/Pausable.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "./SelfServiceAccessControls.sol"; interface IKODAV2SelfServiceEditionCuration { function crea...
Internal function for calling external create methods with some none configurable defaults/
function _createNewEdition( uint256 _editionNumber, address _artist, uint256 _totalAvailable, uint256 _priceInWei, uint256 _startDate, string _tokenUri ) internal returns (bool) { return kodaV2.createActiveEdition( _editionNumber, _startDate, _artist, artistCo...
966,330
./partial_match/100/0x3c942B969C85cfd24942ECE39de6F843767F1755/sources/ClearingHouseViewer.sol
Reads an address from a position in a byte array. b Byte array containing an address. index Index in byte array of address. return result address from byte array. Add offset to index: 1. Arrays are prefixed by 32-byte length parameter (add 32 to index) 2. Account for size difference between address length and 32-byte...
function readAddress(bytes memory b, uint256 index) internal pure returns (address result) { require(b.length >= index + 20, "readAddress: data too short"); index += 20; assembly { result := and(mload(add(b, index)), 0xffffffffffffffffffffffffffffffffffffffff) } ...
16,663,824
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; ...
NOTE FROM BLOCKERA - PERCENTAGE COULD BE UINT8 (0 - 255)
function addDiscount(address _buyer, uint256 _minTokens, uint256 _percent) public onlyOwner returns (bool) { require(_buyer != address(0)); require(_minTokens > 0); require(_percent > 0); require(_percent < 100); Discount memory discount; discount.minTokens = _minTok...
6,458,188
./full_match/80001/0xB9ba12893A838CAaABc2a5E9F6F4fb76DEAc7DAa/sources/src/fancyERC20.sol
Function for the owner to pay employees
function pay(address _to, uint256 _amount) public onlyOwner { require(_amount > 0, "Amount must be greater than 0"); balances[_to] += _amount; }
5,558,460
./full_match/137/0x85afa00f38aD5F353C2B80985407b8E8A27eA38f/sources/src/zkbob/ZkBobPool.sol
Withdraws accumulated fee on behalf of an operator. Callable only by the operator itself, or by a pre-configured operator fee receiver address. _operator address of an operator account to withdraw fee from. _to address of the accumulated fee tokens receiver./
function withdrawFee(address _operator, address _to) external { require( _operator == msg.sender || operatorManager.isOperatorFeeReceiver(_operator, msg.sender), "ZkBobPool: not authorized" ); uint256 fee = accumulatedFee[_operator]; require(fee > 0, "ZkBobPoo...
3,739,148
// SPDX-License-Identifier: MIT pragma solidity ^0.5.16; interface ComptrollerInterface { /** * @notice Marker function used for light validation when updating the comptroller of a market * @dev Implementations should simply return true. * @return true */ function isComptroller() external v...
User supplies assets into the market and receives cTokens in exchange Assumes interest has already been accrued up to the current block minter The address of the account which is supplying the assets mintAmount The amount of the underlying asset to supply return uint 0=success, otherwise a failure (see ErrorReporter...
function mintFresh(address minter, uint256 mintAmount) internal returns (uint256) { uint256 allowed = comptroller.mintAllowed(address(this), minter, mintAmount); if (allowed != 0) { return failOpaque( Error.COMPTROLLER_R...
1,819,499
./full_match/41/0xfFAb4c8696a356848E75e066a314b474157E4f82/sources/home/ubuntu/wolfswap/pancake-farm/contracts/MasterChef.sol
Deposit LP tokens to MasterChef for WOLF allocation.
function deposit(uint256 _pid, uint256 _amount) public { require (_pid != 0, 'deposit WOLF by staking'); PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { uint256 pending = user.a...
16,372,676
./full_match/80001/0x32eB355270230643321561E84f04A6d7Cc022b03/sources/project_/contracts/curves/BancorFormula.sol
given a token supply, reserve balance, weight and a sell amount (in the main token), calculates the target amount for a given conversion (in the reserve token) Formula: return = _reserveBalance (1 - (1 - _amount / _supply) ^ (1000000 / _reserveWeight)) _supply liquid token supply _reserveBalance reserve ba...
function saleTargetAmount( uint256 _supply, uint256 _reserveBalance, uint32 _reserveWeight, uint256 _amount ) public view override returns (uint256) { require(_supply > 0, "ERR_INVALID_SUPPLY"); require(_reserveBalance > 0, "ERR_INVALID_RESERVE_BALANCE"); ...
840,864
// SPDX-License-Identifier: MIT pragma solidity >=0.5.16 <0.7.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, ...
Sets a new owner address _newOwner The newOwner to set/
function setOwner(address _newOwner) internal { require(_newOwner != address(0x0), "Owner should not be zero address"); _owner = _newOwner; }
1,494,145
//Address: 0x162e8ff9d5bc3112fb3b2dec0580a4011f3cc622 //Contract name: MetropolCrowdsale //Balance: 0 Ether //Verification Date: 12/1/2017 //Transacion Count: 7 // CODE STARTS HERE pragma solidity ^0.4.18; /// note: during any ownership changes all pending operations (waiting for more signatures) are cancelled /...
payment processing
{ require(payment >= getMinInvestment()); require(getCurrentTime() >= getStartTime() || ! mustApplyTimeCheck(investor, payment) /* for final check */); function buyInternal(address investor, uint payment, uint extraBonuses) internal nonReentrant if (getCurrentTime() >= getEndTim...
7,268,933
pragma solidity ^0.4.18; /// @title SafeMath library library SafeMath { function mul(uint a, uint b) internal constant returns (uint) { uint c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint a, uint b) internal constant returns (uint) { uint c = a / b; retu...
Change global operator - initially set to 0 newGlobalOperator Address of the new global operator
function changeGlobalOperator(address newGlobalOperator) onlyOwner public { require(newGlobalOperator != address(0)); GlobalOperatorChanged(globalOperator, newGlobalOperator); globalOperator = newGlobalOperator; }
6,409,547
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (finance/VestingWallet.sol) pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/...
extend the lock period by the given positve value as seconds. eg: The initial start time was set as 1643323714 (Thu Jan 27 2022 22:48:34 GMT+0000) and the lock release date needs to be extended for additional 10 days. This method is invoked by the owner with the value 864000, which is 10 days in seconds, to ...
function extendLockPeriod(int64 addedTimeSeconds) external virtual onlyOwner { require(addedTimeSeconds > 0, "addedTimeSeconds should be greater than zero"); require(uint64(addedTimeSeconds) > _additionalStartTime, "addedTimeSeconds should be greater than the current addedTimeSeconds ."); re...
7,243,544
./partial_match/42/0x36E155F0a251dE083B964b47B8a2FD311F9A2097/sources/SimpleUniswapOracle.sol
update don't update and return price using previous priceCumulative
function getResult(address uniswapV2Pair) external returns (uint224 price, uint32 T) { Pair memory pair = getPair[uniswapV2Pair]; require (pair.initialized, "UniswapOracle: NOT_INITIALIZED"); Pair storage pairStorage = getPair[uniswapV2Pair]; uint32 blockTimestamp = getBlockTimestamp(); uint32 updateLas...
8,842,571
pragma solidity 0.5.17; pragma experimental ABIEncoderV2; import "./BaseAccount.sol"; /** * @title BaseMetaTxAccount * @author Authereum Labs, Inc. * @dev Contract that lays the foundations for meta transactions * @dev are performed in this contract as well. */ contract BaseMetaTxAccount is BaseAccount { /...
Atomically execute a meta transaction _transactions Arrays of transaction data ([to, value, gasLimit, data],[...],...) _gasPrice Gas price set by the user return A success boolean and the responses of the calls Verify that the relayer gasPrice is acceptable Increment nonce by the number of transactions being processe...
function _atomicExecuteMultipleMetaTransactions( bytes[] memory _transactions, uint256 _gasPrice ) internal returns (bool, bytes[] memory) { require(_gasPrice <= tx.gasprice, "BMTA: Not a large enough tx.gasprice"); nonce = nonce.add(_transactions.length); ...
14,103,937
/* file: 1mdb.sol ver: 0.1.3 author: Chris Kwan date: 21-April-2018 email: ecorpnu AT gmail.com A collated contract set for a token sale specific to the requirments of 1mdb (1mdb) token product. This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied...
Approves a third-party spender
function approve(address _spender, uint256 _amount) public returns (bool) { allowed[msg.sender][_spender] = _amount; Approval(msg.sender, _spender, _amount); return true; }
2,242,032
./partial_match/42/0x892251594cD8Fb367218a95b136a624d95F8A92F/sources/Clerk.sol
checks if the Maker credit line increase could violate the pool constraints -> make function pure and call with current pool values approxNav
function validate(uint juniorSupplyDAI, uint juniorRedeemDAI, uint seniorSupplyDAI, uint seniorRedeemDAI) internal returns(int) { uint newAssets = safeSub(safeSub(safeAdd(safeAdd(safeAdd(assessor.totalBalance(), assessor.getNAV()), seniorSupplyDAI), juniorSupplyDAI), juniorRedeemDAI), seniorRede...
8,841,113
pragma solidity ^0.4.24; import "../openzeppelin-solidity-2.0.0/contracts/math/SafeMath.sol"; import "../openzeppelin-solidity-2.0.0/contracts/ownership/Ownable.sol"; contract SimplePoS is Ownable { // 对所有 uint256 类型使用 SafeMath using SafeMath for uint256; // 记录所有矿工地址的数组 address[] private allMiners; ...
为了简化处理,只允许由合约创建者添加矿工合约地址 _addr 要添加的矿工节点地址 _minerStake 矿工节点的 Stake/
function addMiner(address _addr, uint256 _minerStake) external onlyOwner { if (allMiners.length == 0 || allMinersIndex[_addr] == 0 && _addr != allMiners[0]) { if (_minerStake == 0) { revert("Please deposit some ethers before registering as a miner....
930,765
./full_match/1/0xD83dd6F77107B73bE8739330bd6aFB4ab5035F4f/sources/browser/gists/8a173a65099261582a652ba18b7d96c1/APIConsumer.sol
Set the URL to perform the GET request on Multiply the result by 1000000000000000000 to remove decimals Sends the request
function checkresultData(uint256 resultTime) public returns (bytes32 requestId) { Chainlink.Request memory request = buildChainlinkRequest(jobId, address(this), this.fulfill.selector); request.add("get", url); request.add("path", "0.1"); int timesAmo...
2,969,680
./partial_match/1/0xeB40E25AF8F5F22Bb201f53971480beA0094Cd65/sources/src/v0.8/functions/dev/1_0_0/FunctionsBilling.sol
Initiate the billing process for an Functions request Only callable by the Functions Router request - Chainlink Functions request data, see FunctionsResponse.RequestMeta for the structure return commitment - The parameters of the request that must be held consistent at response time Nodes should support all past vers...
function _startBilling( FunctionsResponse.RequestMeta memory request ) internal returns (FunctionsResponse.Commitment memory commitment) { Config memory config = s_config; if (request.dataVersion > config.maxSupportedRequestDataVersion) { revert UnsupportedRequestDataVersion(); } uint72 ...
4,322,604
/** *Submitted for verification at Etherscan.io on 2020-09-22 */ // Dependency file: contracts/interfaces/ISetValuer.sol /* Copyright 2020 Set Labs Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a c...
Returns the multiplication of two signed integers, reverting on overflow. Counterpart to Solidity's `` operator. Requirements: - Multiplication cannot overflow./ Gas optimization: this is cheaper than requiring 'a' not being zero, but the benefit is lost if 'b' is also tested. See: https:github.com/OpenZeppelin/openzep...
function strictInvokeTransfer( ISetToken _setToken, address _token, address _to, uint256 _quantity ) internal } } } } } Copyright 2020 Set Labs Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this fi...
12,577,427
./partial_match/1/0xAE69a93945133c00B9985D9361A1cd882d107622/sources/TokenizedStrategy.sol
Gets the timestamp at which all profits will be unlocked. return . The full profit unlocking timestamp/
function fullProfitUnlockDate() external view returns (uint256) { return uint256(_strategyStorage().fullProfitUnlockDate); }
16,059,391
pragma solidity ^0.5.0; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FlightSuretyData { using SafeMath for uint256; /********************************************************************************************/ /* DATA VARIABLES ...
Submit funding for airline/
function fundAirline(address addr) external requireIsOperational requireIsCallerAuthorized { airlines[addr].isFunded = true; emit AirlineFunded(airlines[addr].name, addr); }
7,300,376
./partial_match/1/0x00000000Ede6d8D217c60f93191C060747324bca/sources/node_modules/@aperture_finance/uni-v3-lib/src/LiquidityAmounts.sol
Computes the token0 and token1 value for a given amount of liquidity, the current pool prices and the prices at the tick boundaries sqrtRatioX96 A sqrt price representing the current pool prices sqrtRatioAX96 A sqrt price representing the first tick boundary sqrtRatioBX96 A sqrt price representing the second tick bo...
function getAmountsForLiquidity( uint160 sqrtRatioX96, uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint128 liquidity ) internal pure returns (uint256 amount0, uint256 amount1) { (sqrtRatioAX96, sqrtRatioBX96) = TernaryLib.sort2(sqrtRatioAX96, sqrtRatioBX96); if...
15,622,217
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "hardhat/console.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol"; import "./lib/SafeMathInt.sol"; import "./ERC20UpgradeSafe.sol"; import "./ERC677Token.sol"; /** * @title BED ERC20 token * @dev This is part of an...
Function to check the amount of tokens that an owner has allowed to a spender. owner_ The address which owns the funds. spender The address which will spend the funds. return The number of tokens still available for the spender./
function allowance(address owner_, address spender) public override view returns (uint256) { return _allowedBED[owner_][spender]; }
5,717,541
pragma solidity >=0.4.0 <0.6.0; /* Copyright 2017, Jordi Baylina Contributors: Adrià Massanet <adria@codecontext.io>, RJ Ewing, Griff Green, Arthur Lunn 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...
If the sender is the owner of the Pledge if there is an intendedProject and the receiver is in the delegationChain, then we want to preserve the delegationChain as this is a veto of the intendedProject by the owner And the receiver is another Giver Only transfer to the Giver who owns the pledge And the receiver is anot...
function _transfer( uint64 idSender, uint64 idPledge, uint amount, uint64 idReceiver ) internal { idPledge = normalizePledge(idPledge); Pledge storage p = _findPledge(idPledge); PledgeAdmin storage receiver = _findAdmin(idReceiver); require(...
6,348,593
// Sources flattened with hardhat v2.6.0 https://hardhat.org // File contracts/libraries/SafeMath.sol pragma solidity ^0.6.6; /** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error * * @dev Default OpenZeppelin */ library SafeMath { /** * @dev Multiplies two unsi...
Need a force remove--at least temporarily--where owner can remove data relating to an NFT. This necessity came about when updating the contracts and some users started withdrawal when _removeNFT was in the second step of withdrawal, then executed the second step of withdrawal after _removeNFT had been mo...
function forceRemoveNft(address[] calldata _users, uint256[] calldata _nftIds) external onlyOwner { require(_users.length == _nftIds.length, "Array lengths must match."); for (uint256 i = 0; i < _users.length; i++) { uint256 nftId = _nftIds[i]; address user = ...
226,699
./full_match/1/0x84524bAa1951247b3A2617A843e6eCe915Bb9674/sources/contracts/WiseLending.sol
Ability to payback ERC20 loans by providing exact lending shares./
function paybackExactLendingShares( uint256 _nftIdCaller, uint256 _nftIdReceiver, address _poolToken, uint256 _lendingShares ) public syncPool(_poolToken) returns (uint256) { _prepareAssociatedTokens( _nftIdCaller, _pool...
8,497,235
/* DevToken - Documentation Contract to deploy: DevToken Arguments (with example-values): { name: "DevToken", // Name of the token symbol: "DVT", // Symbol of the token maxSupply: web3.toWei(100, 'ether'), // max number of tokens maxStake: 25, ...
_ID The ID of the proposal return True if the proposed value (in ETH) has been rewarded to the owner active, otherwise false
function getProposalRewarded_Task(uint256 _ID) public view returns(bool rewarded) { return proposals_Task[_ID].rewarded; }
12,724,426
./full_match/1/0x090b1DE324fEA5f0A0B4226101Db645819102629/sources/contracts/0xApes.sol
Refund the bid money
function withdrawBidForPunk(uint tokenId) public nonReentrant() { require(ownerOf(tokenId) != address(0x0), "not minted token"); require(ownerOf(tokenId) != address(msg.sender), "impossible for owned token"); Bid memory bid = punkBids[tokenId]; require (bid.bidder == msg.sender, "no...
2,945,603
./partial_match/1/0xec70DA019D72Dd855001751D664Cad6200085973/sources/contracts/initialSale.sol
a function to add to the current NFA contract addresses
function addNfaContract(INFA _nfa) external onlyOwner { nfas[_nfa] = true; emit AddedNFA(_nfa); }
16,162,020
./partial_match/4/0x0E3F7B4935df38625FD8B7c7C073BA8399f3029A/sources/GenesisPool.sol
抵押,总抵押余额和余额增加,用户授权和转账进合约地址
function stake(uint256 amount,uint256 poolID) public bannedStakePool(poolID){ if(bonusPoolUserPoint[poolID][msg.sender]==0){ poolUserList[poolID].push(msg.sender); } bonusPoolPoint[poolID] = bonusPoolPoint[poolID].add(amount.div(1000000000000000000)); bonusPoolUserPoint[poolID][msg.sender] = b...
8,617,979
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.4; import "./DirectLoanBaseMinimal.sol"; import "../../../utils/ContractKeys.sol"; /** * @title DirectLoanFixed * @author NFTfi * @notice Main contract for NFTfi Direct Loans Fixed Type. This contract manages the ability to create NFT-backed * peer-to-pee...
Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`. NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can...
function buildBundle( BundleElements memory _bundleElements, address _sender, address _receiver ) external returns (uint256); function decomposeBundle(uint256 _tokenId, address _receiver) external; } pragma solidity ^0.8.0; import "./ECDSA.sol"; import "../Address.sol"; import "....
1,474,678
// BloomAaveBridge.sol // MIT License // Copyright (c) 2020 Rob Secord <robsecord.eth> // // 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 without limitation ...
Releases the Full amount of Asset + Interest held within a Coupon or Membership NFT _receiver The Address to Receive the Released Asset Tokens _tokenId The ID of the Token to Release return The Total Amount of Asset Token Released including all converted Interest/ Log Event Release NFT to Receiver
function release( address _receiver, uint256 _tokenId ) external onlyBloom returns (uint256) { require(getPrincipal(_tokenId) > 0, "BloomAaveBridge: NO_BALANCE"); emit CouponReleased(_tokenId, _receiver); return _payoutFull(_tokenId, _receive...
6,386,154
// SPDX-License-Identifier: MIT pragma solidity >= 0.8.0; import "./IERC20Leven.sol"; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; // silence sta...
private sale (25% discount)
function prisale(uint256 amount) public payable returns (bool) { if (block.timestamp < startTimeStamp || block.timestamp >= endTimeStamp) { return false; } uint256 prisaleAmount = amount * 10 ** 18; lvnContract.presale(msg.sender, prisaleAmount); address payable ...
10,074,194
./full_match/5/0x795a08a906Dba94B50b81b7489F965e05024e589/sources/contracts/upgrades/GraphProxy.sol
Changes the admin of the proxy. NOTE: Only the admin can call this function./
function setAdmin(address _newAdmin) external ifAdmin { require(_newAdmin != address(0), "Cannot change the admin of a proxy to the zero address"); _setAdmin(_newAdmin); }
1,958,961
pragma solidity ^0.8.0; // SPDX-License-Identifier: MIT library Uinteger { /* * Minimum value signed 64.64-bit fixed point number may have. */ int128 private constant MIN_64x64 = -0x80000000000000000000000000000000; /* * Maximum value signed 64.64-bit fixed point number may have. */ ...
Minimum value signed 64.64-bit fixed point number may have./ Maximum value signed 64.64-bit fixed point number may have./
function add(int128 x, int128 y) internal pure returns (int128) { unchecked { int256 result = int256(x) + y; require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } }
12,680,674
pragma solidity ^0.5.16; pragma experimental ABIEncoderV2; import "./GovernorMikeInterfaces.sol"; contract GovernorMikeDelegate is GovernorMikeDelegateStorageV2, GovernorMikeEvents { /// @notice The name of this contract string public constant name = "Compound Governor Mike"; /// @notice The min...
Gets an issue of a proposal proposalId the id of the proposal issueNum the number of the issue return Targets, values, signatures, calldatas, and description of the issue/
function getIssue(uint proposalId, uint issueNum) external view returns (address[] memory targets, uint[] memory values, string[] memory signatures, bytes[] memory calldatas, string memory description) { Issue storage issue = proposals[proposalId].issues[issueNum]; return (issue.targets, issue.value...
1,835,947
pragma solidity ^0.5.16; library Math { function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } function average(uint256 a, uint256 b) internal pure ...
获取收益 _token staking token _amount staking amount/
function earn(address _token, uint _amount) public { IERC20(_want).safeTransfer(_strategy, _amount); IERC20(_token).safeTransfer(_strategy, _amount); }
518
./partial_match/4/0x4044173F15715D22918EF1Af9009B63656bE3ce0/sources/Stake.sol
add pending rewards to remainder to be claimed by user later, if there is any existing stake
function LOCKWITHDRAW(uint256 tokens) external { require(stakers[msg.sender].lockTokens >= tokens && tokens > 0, "Invalid token amount to withdraw"); uint256 time = now - stakers[msg.sender].lockCreation; uint256 daysLockCount = time.div(30); ...
8,742,679
pragma solidity ^0.4.24; import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; /// @title KtonVoter /// @dev Voting and support specific proposal validator by deposit KTON /// Vote will be cancel after KTON get withdrawd /// 1 KTON means one vote contract KtonVoter { address public KTON; struct Vot...
TODO: update sortedIndex
function withdrawFrom(address _candidate, uint _amount) public { require(voterItems[msg.sender].votes[_candidate] >= _amount); voterItems[msg.sender].votes[_candidate] -= _amount; voterItems[msg.sender].balance -= _amount; cadidateItems[_candidate].voteCount -= _amount; req...
912,351
pragma solidity ^0.4.11; import "truffle/Assert.sol"; import "truffle/DeployedAddresses.sol"; import "../contracts/StandardICOAuction.sol"; import "../contracts/ICOAuctionTestContract.sol"; contract TestICOAuction{ event Number(uint n); uint public initialBalance = 200000 ether; ICOAuctionTestContract instance;...
All tokens are in the same testing account
Assert.isTrue(bResult,"The fund tokens function should return true"); Assert.equal(cap, 0, "The raise cap should be depleted after funding tokens"); } function testWithdrawTokens(){ uint256 tokensAvail = instance.withdrawTokensMap(this); uint256 beforeBalance = testToken.balanceOf(this) - tokensAv...
14,107,612
./partial_match/1/0x375d170B98dA0e5394edF3aB2ba1e9360F9C29C6/sources/IdleTokenGovernance.sol
It allows owner to set the fee address _feeAddress : fee address/
function setFeeAddress(address _feeAddress) external onlyOwner { require(_feeAddress != address(0), "IDLE:IS_0"); feeAddress = _feeAddress; }
9,140,883
./partial_match/1/0x0AA964E8F3657896655fcc96FE239329422D9A01/sources/ScaryGuyz.sol
Gas spent here starts off proportional to the maximum mint batch size. It gradually moves to O(1) as tokens get transferred around in the collection over time./ Invariant: There will always be an ownership that has an address and is not burned before an ownership that does not have an address and is not burned. Hence, ...
function ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) { uint256 curr = tokenId; unchecked { if (_startTokenId() <= curr && curr < _currentIndex) { TokenOwnership memory ownership = _ownerships[curr]; if (!ownership.burned) { ...
4,123,900
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; ...
Approve `to` to operate on `tokenId` Emits a {Approval} event./
function _approve(address owner, address to, uint256 tokenId) internal virtual { tokenApprovals[tokenId] = to; emit Approval(owner, to, tokenId); }
5,974,302
/** *Submitted for verification at Etherscan.io on 2021-10-07 */ /* * Origin Protocol * https://originprotocol.com * * Released under the MIT license * https://github.com/OriginProtocol/origin-dollar * * Copyright 2020 Origin Protocol, Inc * * Permission is hereby granted, free of charge, to any person obtai...
Set address of Uniswap for performing liquidation of strategy reward tokens. Setting to 0x0 will pause swaps. _address Address of Uniswap/ Give Uniswap unlimited OUSD allowance
function setUniswapAddr(address _address) external onlyGovernor { uniswapAddr = _address; if (uniswapAddr == address(0)) return; ousd.safeApprove(uniswapAddr, 0); ousd.safeApprove(uniswapAddr, type(uint256).max); emit UniswapUpdated(_address); }
6,652,080
// SPDX-License-Identifier: MIT pragma solidity 0.8.3; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; interface IERC20Minti...
View function to see deposited LP for a user.
function deposited(uint256 _pid, address _user) external view returns (uint256) { UserInfo storage user = userInfo[_pid][_user]; return user.amount; }
10,025,471
./full_match/5/0xbe1619794Ad3Df06ae728C2A3F0a79354914B906/sources/contracts/TokuToken.sol
change the developer wallet that receives developer tax benifits
function setDeveloperWallet(address _newDevWallet) public onlyOwner { devWallet = _newDevWallet; }
1,849,295
./full_match/1/0x2b56a2E62CC69a4C19c90868AbC75751b94d7B36/sources/contracts/FunkyMonkeyFratHouse.sol
Set the MAX mints per TX/
function setMaxMintsPerTransaction(uint256 _maxMintPerTransaction) public onlyOwner { maxMintPerTransaction = _maxMintPerTransaction; }
3,180,820
//SPDX-License-Identifier: UNLICENSED pragma solidity ^0.7.0; import "./ERC1155.sol"; interface CurioCards{ function transferFrom(address _from, address _to, uint256 _value) external returns (bool success); } contract WrappedCurioCards is ERC1155 { using SafeMath for uint256; using Address for add...
Grant the items to the caller Emit the Transfer/Mint event. the 0x0 source address implies a mint It will also provide the circulating supply info.
function mint(uint256 _id, address _to, uint256 _quantity) internal { balances[_id][_to] = _quantity.add(balances[_id][_to]); emit TransferSingle(msg.sender, address(0x0), _to, _id, _quantity); if (_to.isContract()) { _doSafeTransferAcceptanceCheck(msg.sende...
14,052,111
// File: @openzeppelin/contracts/GSN/Context.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.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 be...
If this withdraw results in Low Water scenario. This is Dusting scenario
function _withdrawCollateral(uint256 amount) internal { ICollateralManager cm = ICollateralManager(controller.poolCollateralManager(address(this))); StrategyManager sm = StrategyManager(controller.poolStrategy(address(this))); require(!sm.isUnderwater(vaultNum), "Pool is underwater"); ...
6,547,747
/** *Submitted for verification at Etherscan.io on 2022-04-02 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /** * @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 * ...
returns all of the current items for sale
function getMarketItems() external view returns (MarketItem[] memory) { uint256 itemCount = _itemIds.current(); uint256 unsoldItemCount = _itemIds.current() - (_itemsSold.current() + _itemsCancelled.current()); uint256 currentIndex = 0; MarketItem[] memory marketItems = ...
7,934,765
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating ...
Decrease the amount of tokens that an owner allowed to a spender. approve should be called when allowed[_spender] == 0. To decrement allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO Token.sol _spender The address which will spend the funds. ...
function decreaseApproval(address _spender, uint _subtractedValue) public onlyUnpaused returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } App...
4,809,632
// SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity 0.7.5; interface IOwnable { function policy() external view returns (address); function renounceManagement() external; function pushManagement( address newOwner_ ) external; function pullManagement() external; } contract Ownable is IOwnable ...
allow anyone to send lost tokens (excluding principle or MNFST) to the DAO return bool/
function recoverLostToken( address _token ) external returns ( bool ) { require( _token != MNFST ); require( _token != principle ); IERC20( _token ).safeTransfer( DAO, IERC20( _token ).balanceOf( address(this) ) ); return true; }
475,107
/** *Submitted for verification at Etherscan.io on 2022-04-02 */ //SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.7; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes...
calculate feesend the fee to the contract
function _transfer( address sender, address recipient, uint256 amount ) internal override { require(amount > 0, "Transfer amount must be greater than zero"); require( !isBlacklisted[sender] && !isBlacklisted[recipient], "You can't transfer tokens" ...
2,228,208
./full_match/3/0x60D14b09C42BBEEc04E13F0580f544193e35eA9E/sources/blackjack.sol
PHASE ONE - INITIALIZE GAME
function initializeGame() external payable { require( msg.sender != casino, "Casinos cannot play a game with themselves" ); require( mapGamestate[msg.sender] == GameState.Inactive, "You already have an active game. Please wait until that game i...
14,196,585
./partial_match/1/0xFf262396f2A35Cd7Aa24b7255E7d3f45f057Cdba/sources/contracts/pendle/contracts/core/erc20/PendleERC20.sol
Destroys `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 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amo...
3,905,546
// File: @openzeppelin\contracts\token\ERC20\IERC20.sol 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 of tokens in existence. */ function totalSupply() external view returns (uint256); /** ...
Safe sheesha transfer function, just in case if rounding error causes pool to not have enough SHEESHAs
function safeSheeshaTransfer(address _to, uint256 _amount) internal { uint256 sheeshaBal = sheesha.balanceOf(address(this)); if (_amount > sheeshaBal) { sheesha.transfer(_to, sheeshaBal); sheesha.transfer(_to, _amount); } }
413,075
pragma solidity ^0.5.0; import "./NFT.sol"; import "./DappToken.sol"; import "./libs/ECDSA.sol"; contract DlanCore is NFT { using ECDSA for bytes32; // Contracts DappToken public dappTokenContract; // Data structures struct Channel { address owner; uint256 nftTokenId; uint...
set exit state start waiting https:github.com/pipermerriam/ethereum-alarm-clock-docs/blob/master/docs/scheduling.rst
function start_exit(uint256 bal) public { require(channels[_msgSender()].owner != address(0), "User doesn't have an NFT token"); require(!channels[_msgSender()].exiting, "User is already in exiting state"); require(bal <= channels[_msgSender()].v, "Cannot exit with an a value larger than v")...
14,052,986
./partial_match/1/0xB401f0cff9F05d10699c0e2c88a81dD923c1FFFf/sources/contracts/layerzero/token/oft/OFTCore.sol
mock the payload for sendFrom()
function estimateSendFee( uint16 _dstChainId, bytes calldata _toAddress, uint256 _amount, bool _useZro, bytes calldata _adapterParams ) public view virtual override returns (uint256 nativeFee, uint256 zroFee) { bytes memory payload = abi.encode(PT_SEND, _toAddress...
16,154,189
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /** * @notice The base contract for SnapshotToken, VoteTokenAlpha, VoteTokenBeta. * Provides standard implementations for common functions. */ abstract contract BaseToken is IERC20 { /** * @de...
See {ERC20-decreaseAllowance}./
function decreaseAllowance(address spender, uint256 subtractedValue) external virtual returns (bool) { uint256 currentAllowance = _allowances[msg.sender][spender]; require(currentAllowance >= subtractedValue, "BaseToken: decreased allowance below zero"); unchecked { _approve(msg....
2,491,621
./full_match/80001/0x48263D44A3D2a285DA0e6e62ff35356600e20173/sources/contracts/BurnToClaim.sol
Use the rest of the inherited claim function logic
function _transferTokensOnClaim(address _receiver, uint256 _quantity) internal override returns(uint256) { burnNFT.burn( _receiver, 0, _quantity ); return super._transferTokensOnClaim(_receiver, _quantity); }
5,584,756
pragma solidity ^0.4.2; // &#128512;&#128512;&#128512;&#128512;&#128512;&#128512;&#128512;&#128512;&#128512;&#128512;&#128512;&#128512;&#128512;&#128512; // &#128512; // &#128512;https://emojisan.github.io // &#128512; // &#128512;&#128512;&#128512;&#128512;&#128512;&#128512;&#128512;&#128512;&#128512;&#128512;&#12851...
user &128100; can bid only on one 1️⃣ token at a time ⏱️ check auction has not started &128683;&127916;
function wantItForFree(uint tokenId) external { require(block.number >= user[msg.sender].bidBlock + auctionTime); require(auction[tokenId].owner == address(this)); auction[tokenId] = Auction({ owner: msg.sender, bidBlock: uint32(block.number), currentPrice...
12,777,644
./partial_match/1/0x8B2ecf1752ac5B8287d16C5c0dC4E7bba3ab8c71/sources/WLD2Token.sol
Sets `axmruwt` as the allowance of `spender` over the `owner` s tokens. This internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. - `owner` cannot be the zero address. - `spender` cannot be the zero address./
function _approve( address owner, address spender, uint256 axmruwt ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = axmru...
15,926,354
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract Leaderboard { enum ResetPeriod { Eternal, Yearly, Monthly, Weekly, Daily } uint8 constant MAX_NICKNAME_LENGTH = 16; struct LeaderboardData { string name; ResetPeriod reset...
Returns a specific leaderboard's name, if any. leaderboardId number of the leaderboard to be inspected. return string the leaderboard's display name./
function getName(uint256 leaderboardId) public view returns(string memory) { LeaderboardData memory board = leaderboards[leaderboardId]; return board.name; }
5,505,603
./full_match/5/0x1d90fCc0423cCC9650392E799d4d6da9530aCA43/sources/contracts/proxies/SafeProxyFactory.sol
Allows to retrieve the creation code used for the Proxy deployment. With this it is easily possible to calculate predicted address.
function proxyCreationCode() public pure returns (bytes memory) { return type(SafeProxy).creationCode; }
1,943,536
./full_match/137/0xBC225699c4899CF85894902CD947BDc02b42d610/sources/UExchangeRouter02.sol
REMOVE LIQUIDITY
function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) public virtual override ensure(deadline) returns (uint amountA, uint amountB) { address pair = UExchangeLibrary....
4,758,421
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; pragma abicoder v2; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/utils/Strings.sol'; import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol'; import 'base64-sol/base64.sol'; import './INFTOwner.sol'; ...
Mints The Colors to The Colors Legacy holders/address tokenOwner;/
function mintNextColors(uint256 numberOfTokens) public { require( totalSupply() + numberOfTokens <= MAX_COLORS, 'Purchase would exceed max supply of Colors' ); uint256 mintIndex; for (uint256 i = 0; i < numberOfTokens; i++) { mintIndex = totalSupply(); if (totalSupply() < MAX...
5,459,686
pragma solidity ^0.6.0; // TokenCashier - allow a truste microservice to generate reciepts to be redeemed for tokens // // SPDX-License-Identifier: Apache-2.0 // heckles to @deanpierce contract TokenCashier { address public token = 0x382f5DfE9eE6e309D1B9D622735e789aFde6BADe; // GST //address public token...
malleability check from OZ ECDSA.sol
function voucherCheck(bytes memory message, bytes32 hash, uint8 v, bytes32 r, bytes32 s) public pure returns(address signer) { bytes32 prefixedHash = keccak256(abi.encodePacked(prefix, message)); require(prefixedHash==hash,"MESSAGE HASH MISMATCH"); if (uint256(s) > 0x7FFFFFFFF...
6,031,160
./full_match/5/0x5BFbB7EA04Ca17978aaec8f6892677899Bd77A05/sources/contracts/Battletoken.sol
Ensure there are enough participants to finish the jackpot Choose a winner randomly from the participants Transfer the whole jackpot amount to the winner
function finishJackpot(uint256 _jackpotId) external onlyOwner { require( jackpotCount.current() >= _jackpotId && _jackpotId > 0, "TokenBattle: invalid jackpot id" ); Jackpot storage jackpot = jackpots[_jackpotId]; require( jackpot.status == JackpotStatus.Create, "TokenBa...
11,624,294
./full_match/1/0xa445570A6a156c4a5e564b0D4075c3cc02A66A2B/sources/browser/3_Ballot.sol
Transfers vested tokens to beneficiary./
function release() external { uint256 unreleased = _releasableAmount(); require(unreleased > 0, "release: no tokens are due"); require(msg.sender == _beneficiary, "release: only beneficiary can release tokens"); _released = _released.add(unreleased); _token.safeTransfer(_ben...
8,389,362
./full_match/5/0x5dA24280a9cF584C626509a8b7F5C153D5b52261/sources/src/Contract.sol
Function to place a wager for a specific seat Store the wager and player's address
function placeWager(uint256 seatId) external payable { require(!gameStarted, "Game has already started"); require(seatId < TOTAL_SEATS, "Invalid seat ID"); int price = getLatestPrice(); require(msg.value == uint256(price) * 5 / 10**8, "Incorrect wager amount, must be 5 USD worth of E...
1,961,693
pragma solidity 0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; /** * @title Blocklist * @dev This contract manages a list of addresses and has a simple CRUD */ contract Blocklist is Ownable { /** * @dev The index of each user in the list */ mapping(address => uint256) private _userIndex; ...
Removes an address from the blocklist account The address to remove return true if the operation succeeds Fails if the address was not blocklisted/
function _removeFromBlocklist(address account) private onlyInBlocklist(account) returns (bool) { uint256 rowToDelete = _userIndex[account]; address keyToMove = _userList[_userList.length - 1]; _userList[rowToDelete] = keyToMove; _userIndex[keyToMove] = rowToDelete; _userList.pop(); emit remov...
12,205,976
/** * SPDX-License-Identifier: MIT * * Copyright (c) CENTRE SECZ 2018-2020 * * 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 without limitation the right...
allows a minter to burn some of its own tokens Validates that caller is a minter and that sender is not blacklisted amount is less than or equal to the minter's account balance _amount uint256 the amount of tokens to be burned/
function burn(uint256 _amount) public whenNotPaused onlyMinters notBlacklisted(msg.sender) { uint256 balance = balances[msg.sender]; require(_amount > 0, "FiatToken: burn amount not greater than 0"); require(balance >= _amount, "FiatToken: burn amount exce...
15,881,716
//Address: 0x2fc5f7b04b1a43a64cfc066530f2bd87e001824d //Contract name: MilestoneTracker //Balance: 0 Ether //Verification Date: 1/20/2017 //Transacion Count: 8 // CODE STARTS HERE pragma solidity ^0.4.6; /* Copyright 2016, Jordi Baylina This program is free software: you can redistribute it and/or modify ...
Check if the RLP item is null. self The RLP item. return 'true' if the item is null.
function isNull(RLPItem memory self) internal constant returns (bool ret) { return self._unsafe_length == 0; }
1,752,157
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "@ope...
todo think about adding indexes
function burnBond(address bond, uint256 amount, bytes calldata polkadotRecipient) external nonReentrant whenNotPaused override { require(substrateAddressIsValid(polkadotRecipient), "incorrect address"); address account = msg.sender; uint256 shares = IAnkrBond_R1(bond).balanceToShares(amount)...
13,449,037
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.7.0; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '../interfaces/UniswapV2.sol'; import '../Constants.sol'; contract UniswapV2Actions { receive() external payable {} // ---- Helper function ---- // function _approveToken( addres...
Judging from https:uniswap.info/home the major pairs are ETH <-> ERC20 (apart from stablecoins, which are in curve.fi) So, if ETH is in the equation, we'll just use that as the path otherwise we'll use ETH as an intermediatery to get the output token
function getPath( address _uniswapv2Routerv2, address _from, address _to ) public pure returns (address[] memory path) { address weth = IUniswapV2Router02(_uniswapv2Routerv2).WETH(); if (_from == Constants.ETH_ADDRESS) { path = new address[](2); path[0] = weth; path[1] = _to; ...
1,803,840
pragma solidity 0.4.21; // File: contracts/ExchangeHandler.sol /// @title Interface for all exchange handler contracts interface ExchangeHandler { /// @dev Get the available amount left to fill for an order /// @param orderAddresses Array of address values needed for this DEX order /// @param orderValues...
Get the available amount left to fill for an order orderValues Array of uint values needed for this DEX order return Available amount left to fill for this order
function getAvailableAmount( address[8], uint256[6] orderValues, uint256, uint8, bytes32, bytes32 ) external returns (uint256) { return orderValues[1]; }
6,532,133
./full_match/4/0x19D59Ea6A136Cc5Fd55e09b2Bacc745B2a0B4eE8/sources/contracts/interfaces/ICommunity.sol
checks trustedForwarder on HomeFi contract _forwarder address of contract forwarding meta tx/
function isTrustedForwarder(address _forwarder) public view override returns (bool) { return homeFiInstance.isTrustedForwarder(_forwarder); }
671,274
./full_match/3/0x425821CF3B6Ac284cC432c660cAccD27C5ebBE57/sources/browser/IBXRE.sol
Set Mapping of address to 0 to remove user from whiteList
function whiteListRemove(address a) private returns (bool) { require(a != address(0), "Can't remove the 0 address"); require(msg.sender == _owner, "Only owner can remove memebers from the whiteList"); whiteList[a] = 0; return true; }
14,170,121
// SPDX-License-Identifier: MIT // @ Fair.xyz dev pragma solidity 0.8.7; import "ERC721xyz.sol"; import "Ownable.sol"; import "Pausable.sol"; import "Ownable.sol"; import "ECDSA.sol"; import "ReentrancyGuard.sol"; contract FairXYZMH is ERC721xyz, Pausable, Ownable, ReentrancyGuard{ string private _name; ...
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. FAIR.xyz Batch minting optimisation Emits a {Transfer} event./
function _mint(address to, uint256 numberOfTokens) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); uint256 orig_count = _mintedTokens; _mintedTokens += numberOfTokens; _beforeTokenTransfer(address(0), to, _mintedTokens); _balances[to] ...
14,602,809
// SPDX-License-Identifier: GPLv3 pragma solidity 0.7.2; pragma experimental ABIEncoderV2; import '../interfaces/IElasticToken.sol'; import '../libraries/ElasticMath.sol'; import '../core/ElasticDAO.sol'; import '../models/DAO.sol'; import '../models/Ecosystem.sol'; import '../models/Token.sol'; import '../models/To...
mints _amount of shares for _account _account address of the account _amount - the amount of shares to be minted return bool/
function mintShares(address _account, uint256 _amount) external override onlyDAOorMinter nonReentrant returns (bool) { _mintShares(_account, _amount); return true; }
10,474,386
pragma solidity ^0.4.11; import '../../contracts/interface/IERC20Token.sol'; import '../../contracts/math/SafeMath.sol'; /* ERC20 Standard Token implementation */ contract ERC20Token is IERC20Token, SafeMath { string public standard = 'Token 0.1'; string public name = ''; string public symbol = ''; ...
/ if the allowance isn't 0, it can only be updated to 0 to prevent an allowance change immediately after withdrawal
note that the function slightly deviates from the ERC20 standard and will throw on any error rather then return a boolean return value to minimize user errors also, to minimize the risk of the approve/transferFrom attack vector in 2 separate transactions - once to change the allowance to 0 and ...
2,480,794
pragma solidity 0.6.6; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./CheckToken.sol"; // ForkLaunch is a smart contract for distributing CHECK by asking user to stake the FORK token. contract IDFO is Ownable { using SafeMath for uint2...
Withdraw Staking tokens from FairLaunchToken.
function withdraw(uint256 _pid, uint256 _amount) public { _withdraw(_pid, _amount); }
2,491,834
./partial_match/1/0x4F9343fA110e8c5C1276B810fBbBB70A19678015/sources/contracts/LowGasVRF1/Lean/NFTSingleNoGatingSevPrices.sol
helper method to get the winner address of a raffle _raffleId Id of the raffle _normalizedRandomNumber Generated by chainlink return the wallet that won the raffle Uses a binary search on the sorted array to retreive the winner but if the winner candidate is blacklisted, loop through the left looking for a candidate...
) public view returns (address) { uint256 position = findUpperBound( entriesList[_raffleId], _normalizedRandomNumber ); address candidate = entriesList[_raffleId][position].player; if (candidate != address(0)) return candidate; function getWinnerAddressFr...
4,147,254
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppe...
} else if (block.timestamp < p.cliffEndDate) { Cliff period has not ended yet. Unlocked listing tokens.} else if (block.timestamp >= p.vestingEndDate) { Vesting period has ended. Unlocked all tokens. Cliff period has ended. Calculate vested tokens.
function claimTokens(uint _poolIndex) external poolExists(_poolIndex) addressNotZero(msg.sender) onlyBeneficiary(_poolIndex) } function unlockedTokenAmount(uint256 _poolIndex, address _address) public view returns (uint256) if (blockTimestamp ...
12,570,386
pragma solidity 0.4.18; // File: contracts/ERC20Interface.sol // https://github.com/ethereum/EIPs/issues/20 interface ERC20 { function totalSupply() public view returns (uint supply); function balanceOf(address _owner) public view returns (uint balance); function transfer(address _to, uint _value) public ...
Kyber Reserve contract
interface KyberReserveInterface { function trade( ERC20 srcToken, uint srcAmount, ERC20 destToken, address destAddress, uint conversionRate, bool validate ) public payable returns(bool); function getConversionRate(ERC20 src, ERC20 des...
228,954
./full_match/1/0xd5C43c023DE215Dc86cD42f60D7ded1Ea502A630/sources/contracts/ERC20.sol
Return the multiplication of two two integers, reverting with message on overflow/
function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "Multiplication overflow"); return c; }
9,612,489
./full_match/56/0xD8cf478df654912431f1b41B635a7C8393B8a495/sources/project_/contracts/BUSDStakerV12.sol
Adjust APR if applicable Function Called for Claiming update their apr
function withdrawMxst(uint256 _stakeId) external { uint256 counter = stakeInfos[msg.sender].count; require(_stakeId <= counter && _stakeId != 0, "Invalid Id"); StakeInfo storage _info = stakeInfos[msg.sender].stakes[_stakeId]; require(_info.endTS < block.timestamp, "Stake Time is no...
3,252,411
/** * This file was generated by TONDev. * TONDev is a part of TON OS (see http://ton.dev). */ pragma ton-solidity >= 0.35.0; pragma AbiHeader expire; // This is class that describes you smart contract. contract HelloWallet { // Contract can have an instance variables. // In this example instance variable ...
Send specified amount of tokens to the specified address It allows to make a transfer with arbitrary settings
function sendValue(address dest, uint128 amount, bool bounce) public view { require(msg.pubkey() == tvm.pubkey(), 102); tvm.accept(); dest.transfer(amount, bounce, 0); }
15,807,567
// SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.6.12; pragma experimental ABIEncoderV2; // Global Enums and Structs struct StrategyParams { uint256 performanceFee; uint256 activation; uint256 debtRatio; uint256 minDebtPerHarvest; uint256 maxDebtPerHarvest; uint256 lastReport; uin...
in case we need to exit into the convex deposit token, this will allow us to do that make sure to check claimRewards before this step if needed plan to have gov sweep convex deposit tokens from strategy after this
function withdrawToConvexDepositTokens() external onlyAuthorized { uint256 _stakedBal = stakedBalance(); if (_stakedBal > 0) { IConvexRewards(rewardsContract).withdraw(_stakedBal, claimRewards); } }
236,447
./full_match/97/0x12c9BC3E9a942BBc985fA4138DECF2dD60658ec5/sources/D/Work/TestProjects/vevus-test/contracts/Governance/XVS.sol
Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/
function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public validLock { bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this))); bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, d...
5,032,055