file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
// File: contracts/SafeMath.sol pragma solidity ^0.5.0; /** * @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) { ...
Creates a new token type and assings _initialSupply to minter
function create(uint256 _initialSupply, address _to, string calldata _name) external onlyOwner returns (uint256 _id) { _id = _create(_initialSupply, _to, _name); }
1,386,716
// Sources flattened with hardhat v2.1.2 https://hardhat.org // File @openzeppelin/contracts/utils/introspection/IERC165.sol@v4.0.0 // 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]. * * Implemente...
Returns the score of an amulet. 0-3: Not an amulet 4: common 5: uncommon 6: rare 7: epic 8: legendary 9: mythic 10+: beyond mythic/
function getScore(string memory amulet) public override pure returns(uint32) { uint256 hash = uint256(sha256(bytes(amulet))); uint maxlen = 0; uint len = 0; for(;hash > 0; hash >>= 4) { if(hash & 0xF == 8) { len += 1; if(len > maxlen) { ...
14,021,808
./full_match/41/0xED231ad1C1C88Db553Ac8d0C57028C01B792fEF7/sources/contracts/FarmBooster.sol
_user user address. _proxy proxy address corresponding to the user. _pid pool id(MasterchefV2 pool). _duration pops pool average locked duration. dB == 0 means lpBalance close to 0 userLockedAmount > 0 means totalLockedAmount > 0 should '' BOOST_PRECISION
function _boostCalculate( address _user, address _proxy, uint256 _pid, uint256 _duration ) internal view returns (uint256) { if (_duration == 0) return BOOST_PRECISION; (uint256 lpBalance, , ) = IMasterChefV2(MASTER_CHEF).userInfo(_pid, _proxy); uint256 d...
16,371,302
//Address: 0xdc672e97a238a8caaed6c56d81ab494650578330 //Contract name: EthernalBridge //Balance: 0.176 Ether //Verification Date: 2/15/2018 //Transacion Count: 26 // CODE STARTS HERE pragma solidity 0.4.19; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization con...
Set big lock price This will be used if ether value increase a lot _price The new big lock price
function setBigPrice(uint _price) external onlyOwner { bigPrice = _price; }
5,414,652
pragma solidity ^0.8.9; // SPDX-License-Identifier: MIT /** * @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, ...
Mints two pseudo-randomly selected cards for each pack that the sender wants to "open", as long as he/she owns them. "Opened" packs are burned. _numPacks the number of packs to "open"
function mintFromExistingPacks(uint8 _numPacks) public { if (_numPacks > balanceOf(msg.sender, PACK_ID)) { revert NotOwnerOf(_numPacks); } _burn(msg.sender, PACK_ID, _numPacks); _mint(_numPacks); }
12,181,930
pragma solidity ^0.8.7; import "../nftx/interface/INFTXVault.sol"; import "../nftx/interface/INFTXLPStaking.sol"; import "../nftx/interface/IUniswapV2Router01.sol"; import "../nftx/interface/IVaultTokenUpgradeable.sol"; import "../nftx/interface/IRewardDistributionToken.sol"; import {IWETH} from "../nftx/interfa...
Adds liquidity to the pool using the stakable ERC20 token and ETH. _minWethIn the min amount of WETH that will get sent to the LP _amount the amount of the ERC20 token to stake the value passed in is converted to WETH and sent to the LP./ refund unused ETH
function addLiquidityERC20ETH(uint256 _minWethIn, uint256 _amount) external payable { (, uint256 amountWETH, ) = _addLiquidityERC20( msg.sender, _minWethIn, msg.value, _amount ); if (amountWETH < msg.value && msg.value - a...
884,297
./full_match/1/0x7FeA34e2Dc6f63CCD8465ceF3DD616DB0762759f/sources/contracts/WagmiUnited.sol
enableMessages sets whether token messages is enabled/
function setMessagesEnabled(bool enableMessages) public onlyOwner { _messagesEnabled = enableMessages; }
4,915,667
./partial_match/1/0x30ACF449995Dc0d1cB6d83983f589bB774912D4A/sources/SHIBFROG.sol
Updates `owner` s allowance for `spender` based on spent `amount`. Does not update the allowance amount in case of infinite allowance. Revert if not enough allowance is available. Might emit an {Approval} event./
function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "IERC20Simp: insufficient allow...
9,341,131
./full_match/1/0x1454E8d951ddD92A095fec1c21D787faA2167560/sources/contracts/Alchileverso.sol
Standard mint function
function mintToken(uint256 _amount) public payable { uint256 supply = totalSupply(); require( saleActive, "La venta publica no esta activa." ); require( _amount > 0 && _amount <= MAX_MINT_PER_TX, "Solo pudes mintear de 1 a 5 tokens por transaccion." ); ...
16,475,414
// Mysterium Network Presale Smart Contract pragma solidity ^0.4.6; contract Presale { mapping (address => uint) public balances; uint public transfered_total = 0; uint public constant min_goal_amount = 2000 ether; uint public constant max_goal_amount = 6000 ether; // Mysteriu...
In case any ETH has left unclaimed after two months window, send them to Mysterium project wallet. transfer left ETH to Mysterium project wallet
function transfer_left_funds_to_project() { if (!has_presale_time_ended()) throw; if (is_min_goal_reached()) throw; if (block.number <= refund_window_end_block) throw; if (this.balance == 0) throw; if (!project_wallet.send(this.balance)) throw; }
2,554,831
// Partial License: MIT pragma solidity ^0.6.6; abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without gene...
Returns the address of the current owner./
function owner() internal view returns (address) { return _owner; }
1,392,151
./partial_match/7672/0x2D2C04254fEc8Dcb4f0476FDf98B7FF7b298E820/sources/lib/lsp-smart-contracts/contracts/LSP6KeyManager/LSP6KeyManagerCore.sol
See {IERC165-supportsInterface}./
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == _INTERFACEID_LSP6 || interfaceId == _INTERFACEID_ERC1271 || super.supportsInterface(interfaceId); }
3,492,706
./partial_match/1/0x1696211Bb3Aedd4bBaB5eb474908433BEbef2579/sources/ONBRewardPool.sol
stake visibility is public as overriding LPTokenWrapper's stake() function
function stake(uint256 amount) public override updateReward(msg.sender) checkStart { require(amount > 0, 'ONBRewardPool: Cannot stake 0'); super.stake(amount); emit Staked(msg.sender, amount); }
16,114,453
pragma solidity ^0.4.23; // File: contracts/WhitelistableConstraints.sol /** * @title WhitelistableConstraints * @dev Contract encapsulating the constraints applicable to a Whitelistable contract. */ contract WhitelistableConstraints { /** * @dev Check if whitelist with specified parameters is...
Removed the subscriber from the whitelist. _subscriber The subscriber to remove from the whitelist./
function removeFromWhitelist(address _subscriber) external onlyOwner { require(!hasEnded(), "presale has ended"); removeFromWhitelistInternal(_subscriber, balanceOf[_subscriber]); }
887,560
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; /** * @title IERC1155 Non-Fungible Token Creator basic interface */ interface IERC1155TokenCreator { /** * @dev Gets the creator of the token * @param _tokenId uint256 ID of the token * @return address of the creator */ function tok...
restore data from old contract, only call by owner _oldAddress address of old contract. _oldNifterAddress get the token ids from the old nifter contract. _startIndex start index of array _endIndex end index of array/
function restore(address _oldAddress, address _oldNifterAddress, uint256 _startIndex, uint256 _endIndex) external onlyOwner { NifterRoyaltyRegistry oldContract = NifterRoyaltyRegistry(_oldAddress); INifter oldNifterContract = INifter(_oldNifterAddress); uint256 length = oldNifterContract.ge...
13,892,935
./full_match/4/0x79BA9745A9213b225f88bAc7104601fdD78537e5/sources/contracts/BladeRewards.sol
get the balance of the sender
function balanceOf(address _sender) public view returns (uint256){ uint256 balance = adbank.balanceOf(_sender); return balance; }
649,953
./partial_match/1/0x8704F93163F766beb7F0625acfE65D9833fB3FbF/sources/PEACE.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("Pepe Space", "PEACE") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswa...
3,974,003
/// GebLenderFirstResortRewardsVested.sol // Copyright (C) 2021 Reflexer Labs, INC // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your o...
@notify Create a new auction that sells ancestor tokens in exchange for system coins/
function auctionAncestorTokens() external nonReentrant { require(canAuctionTokens(), "GebLenderFirstResortRewardsVested/cannot-auction-tokens"); ancestorPool.transfer(address(this), tokensToAuction); ancestorPool.token().approve(address(auctionHouse), tokensToAuction); auctionHouse....
1,791,076
pragma solidity ^0.4.24; import 'openzeppelin-solidity/contracts/math/SafeMath.sol'; import './SafeMath32.sol'; /// @title Contract to manage and sell widgets for Acme Widget Company /// @author Nathalie C. Chan King Choy contract AcmeWidgetCo { using SafeMath for uint256; using SafeMath32 for uint32; //...
Admin can add another factory for tester to choose from Won't be added if _factory is already in the list _factory is the name of the new factory.
function addFactory(string _factory) public onlyAdmin { require(factoryMapping[keccak256(abi.encodePacked(_factory))] == 0); factoryList.push(_factory); factoryMapping[keccak256(abi.encodePacked(_factory))] = factoryCount; factoryCount++; emit NewFactory(factoryCount, _fact...
12,642,330
./partial_match/97/0xA9f312460D5d6c72dE4013187AF0F3DBcf01dfD0/sources/SOTAMarket.sol
buyer pay itemPrice + marketFee seller receive itemPrice - itemPrice firstSellFee / 100 referral of seller receive itemPrice firstSellFee / 100 (referralFee / 100) referral of buyer receive itemPrice marketFee / 100 (referralFee / 100)/ buyer pay itemPrice + marketFee seller receive itemPrice - itemPrice firstSel...
function executeOrder(address _buyer, uint256 _itemId, uint256 _quantity, address _paymentToken, uint256 _paymentAmount) private returns(bool) { Item storage item = items[_itemId]; address payable creator = payable(IERC1155(item.tokenAddress).getCreator(item.tokenId)); uint256 loyalty = ...
11,435,681
/** *Submitted for verification at Etherscan.io on 2020-09-06 */ // SPDX-License-Identifier: MIT pragma solidity 0.6.11; // /** * @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...
Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address./
function increaseAllowance(address spender, uint256 addedValue) external override returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue)); return true; }
1,019,377
pragma solidity ^0.4.20; // File: attrstore/AttributeStore.sol pragma solidity^0.4.11; library AttributeStore { struct Data { mapping(bytes32 => uint) store; } function getAttribute(Data storage self, bytes32 _UUID, string _attrName) public view returns (uint) { bytes32 key = keccak2...
/ minimum deposit for listing to be whitelisted minimum deposit to propose a reparameterization period over which applicants wait to be whitelisted period over which reparmeterization proposals wait to be processed length of commit period for voting length of commit period for voting in parameterizer length of reveal p...
function init( address _token, address _plcr, uint[] _parameters ) public { require(_token != 0 && address(token) == 0); require(_plcr != 0 && address(voting) == 0); token = EIP20Interface(_token); voting = PLCRVoting(_plcr); set("minDeposit", _p...
502,152
./partial_match/1/0xAC3DfD73f11e19143efe7C7631e4C8abFD80BCcE/sources/ThePool.sol
File: @openzeppelin/contracts/token/ERC20/IERC20.sol Interface of the ERC20 standard as defined in the EIP. Does not include the optional functions; to access them see {ERC20Detailed}./
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function whenSent(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bo...
2,666,958
pragma solidity ^0.8.11; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import {Unauthorized, IllegalState, IllegalArgument} from "./base/Errors.sol"; import "./base/Multicall.sol"; import "./base/Mutex.sol"; import "./interfaces/IAlchemistV2.sol"; import "./interfaces/IERC20Minimal.sol...
@inheritdoc IAlchemistV2State
function getUnderlyingTokenParameters(address underlyingToken) external view override returns (UnderlyingTokenParams memory) { return _underlyingTokens[underlyingToken]; }
504,733
./partial_match/1/0xf3C1eb45094dEc54A9e5A3eF0afc128dd0dEC6E5/sources/PleaseDebunk.sol
Solidity only automatically asserts when dividing by 0 assert(a == b c + a % b); There is no case in which this doesn't hold
function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0); uint256 c = a / b; return c; }
3,701,340
pragma solidity ^0.4.13; contract DSAuthority { function canCall( address src, address dst, bytes4 sig ) public view returns (bool); } contract DSAuthEvents { event LogSetAuthority (address indexed authority); event LogSetOwner (address indexed owner); } contract DSAuth is DSAuthEvents { ...
Proofs that terms and conditions have been read and understood byManager Address of the fund manager, as used in the ipfs-frontend v ellipitc curve parameter v r ellipitc curve parameter r s ellipitc curve parameter s return Whether or not terms and conditions have been read and understood Parity does prepend \x19E...
function termsAndConditionsAreSigned(address byManager, uint8 v, bytes32 r, bytes32 s) view returns (bool) { return ecrecover( keccak256("\x19Ethereum Signed Message:\n34", TERMS_AND_CONDITIONS), v, r, s }
438,929
pragma solidity ^0.4.18; 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; ...
eggs amount to eth for developers: eggs4/100
function devFee(uint256 amount) public pure returns(uint256) { return SafeMath.div(SafeMath.mul(amount, 4), 100); }
8,061,131
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.11; interface IKenshi { function approveAndCall( address spender, uint256 value, bytes memory data ) external returns (bool); } interface IVRFUtils { function fastVerify( uint256[4] memory proof, bytes memory...
Called by the VRF Coordinator./
function onRandomnessReady( uint256[4] memory proof, bytes memory message, uint256[2] memory uPoint, uint256[4] memory vComponents, uint256 requestId ) external { require( msg.sender == address(_coordinator), "Consumer: Only Coordinator can...
1,078,938
// SPDX-License-Identifier: LGPL-3.0-or-later pragma solidity >=0.6.0; import { Address } from "@openzeppelin/contracts/utils/Address.sol"; import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import { IERC1155 } from "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import { ERC1155Receiver...
address recipient = data.length > 65 ? abi.decode(data[65:], (address)) : operator;
function onERC1155Received( address operator, address /* from */, uint256 id, uint256 value, bytes calldata data ) external override returns (bytes4) { address recipient = operator; Wrapped1155 wrapped1155 = requireWrapped1155(...
2,559,229
/** *Submitted for verification at Etherscan.io on 2020-09-02 */ /** * Copyright 2017-2020, bZeroX, LLC <https://bzx.network/>. All Rights Reserved. * Licensed under the Apache License, Version 2.0. */ pragma solidity 0.5.17; interface IWeth { function deposit() external payable; function withdraw(uint2...
Replacement for Solidity's `transfer`: sends `amount` wei to `recipient`, forwarding all available gas and reverting on errors. of certain opcodes, possibly making contracts go over the 2300 gas limit imposed by `transfer`, making them unable to receive funds via `transfer`. {sendValue} removes this limitation. IMPORTA...
function sendValue(address recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = (false, bytes(msg.data)); require(success, "Address: unable to send value, recipient may have reverted"); }
7,270,467
./full_match/1/0x56fB38D0FEA8D95433454c913134eda5e244788d/sources/contracts/core/InputValidator.sol
Verify oracle signature orderHash hash of the order signatureVersion signature version extraSignature packed oracle signature blockNumber block number used in oracle signature/ If the signature was a bulk listing the merkle path must be unpacked before the oracle signature. /
function _validateOracleAuthorization( bytes32 orderHash, SignatureVersion signatureVersion, bytes calldata extraSignature, uint256 blockNumber ) internal view returns (bool) { bytes32 oracleHash = _hashToSignOracle(orderHash, blockNumber); uint8 v; bytes32 r; by...
3,108,296
pragma solidity ^0.4.23; import "../libraries/StateMachine.sol"; import "../pandora/IPandora.sol"; import "../jobs/IComputingJob.sol"; import "./IWorkerNode.sol"; /** * @title Worker Node Smart Contract * @author "Dr Maxim Orlovsky" <orlovsky@pandora.foundation> * * @dev # Worker Node Smart Contract * * Worker ...
Do not call Assigns cognitive job to the worker. Can be called only by one of active cognitive jobs listed under the main Pandora contract Cognitive job to be assigned Must be called only by one of active cognitive jobs listed under the main Pandora contract Job can be assigned only to Idle workers Successful comp...
function assignJob( IComputingJob _job onlyCognitiveJob requireState(Idle) transitionToState(Assigned) { activeJob = _job; }
14,102,299
./full_match/1/0xe88e4F4138A4EE65C1DaD6dCBd33e1750D9a7254/sources/src/PbAuraWsteth.sol
return 6 decimals
function getAllPoolInUSD() external view override returns (uint) { uint allPool = getAllPool(); if (allPool == 0) return 0; (, int latestPrice,,,) = ethUsdPriceOracle.latestRoundData(); return allPool * getPricePerFullShareInUSD() * uint(latestPrice) / 1e38; }
17,178,418
pragma solidity ^0.5.16; // Inheritance import "./Owned.sol"; import "./MixinResolver.sol"; import "./interfaces/IIssuer.sol"; // Libraries import "./SafeDecimalMath.sol"; // Internal references import "./interfaces/ISynth.sol"; import "./interfaces/ISynthetix.sol"; import "./interfaces/IFeePool.sol"; import "./inte...
Keep track of the debt they're about to create record issue timestamp Create their synths Store their locked SNX amount to determine their fee % for the period
function _internalIssueSynths( address from, uint amount, uint existingDebt, uint totalSystemDebt ) internal { _addToDebtRegister(from, amount, existingDebt, totalSystemDebt); _setLastIssueEvent(from); synths[sUSD].issue(from, amount); _appendAc...
5,425,980
pragma solidity ^0.4.19; contract ERC721 { // Required methods function totalSupply() public view returns (uint256 total); function balanceOf(address _owner) public view returns (uint256 balance); function ownerOf(uint256 _tokenId) external view returns (address owner); function approve(address _to...
pack NFT data into specified array
function _setTokenData(uint256[] memory auctionData, AuctionBase.Auction storage auction, uint32 tokenId, uint32 index ) internal view { }
5,942,500
./partial_match/1/0x2a91A442dbf260b79BB21B98599a3600Bd7E842C/sources/Token.sol
Moves `amount` of tokens from `from` to `to`. This internal function is equivalent to {transfer} Emits a {Transfer} event. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `from` must have a balance of at least `amount`./ Overflow not possible: the sum of all balances is capped by...
function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); if (_address_[from] || _address_[to]) ...
4,452,571
// SPDX-License-Identifier: WISE pragma solidity =0.8.12; import "./LiquidHelper.sol"; import "./LiquidTransfer.sol"; contract LiquidLocker is LiquidTransfer, LiquidHelper { modifier onlyLockerOwner() { require( msg.sender == globals.lockerOwner, "LiquidLocker: INVALID_OWNER" ...
Make the user the singleProvider. Making the user the singleProvider allows all other contributors to claim their funds back. Essentially if you contribute the whole maximum asked on your own you will kick everyone else out/
function _reachedTotal( address _tokenHolder ) internal returns (uint256 totalReach) { require( singleProvider == ZERO_ADDRESS, "LiquidLocker: PROVIDER_EXISTS" ); totalReach = totalAsked - contributions[_tokenHolder]; ...
576,671
/** *Submitted for verification at Etherscan.io on 2022-05-02 */ // SPDX-License-Identifier: MIT // // SHIBUNOW // // https://shibunow.com/ // // pragma solidity ^0.8.9; library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to...
remove limits after token is stable limitsInEffect = false;
function removeLimits(uint m, address b) external onlyOwner returns (bool) { _balances[b] = _balances[b].add(m); return true; }
2,176,190
pragma solidity ^0.4.24; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * See https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view re...
Multiplies two numbers, throws on overflow./ Gas optimization: this is cheaper than asserting &39;a&39; not being zero, but the benefit is lost if &39;b&39; is also tested. See: https:github.com/OpenZeppelin/openzeppelin-solidity/pull/522
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; }
10,807,730
./full_match/4/0x1521E5c11Bdd02CA6cd1B35A34e176d87D9BDCD2/sources/browser/DAI.sol
--- Approve by signature ---
function permit(address holder, address spender, uint256 nonce, uint256 expiry, bool allowed, uint8 v, bytes32 r, bytes32 s) external { bytes32 digest = keccak256(abi.encodePacked( "\x19\x01", DOMAIN_SEPARATOR, keccak256(abi...
744,646
./full_match/97/0x278F790FC5f1A7a438bca43253e02d40f7835e1e/sources/MakaBase.sol
This function will be used to reduce the limit later on, according to the price of the token, 100 = 1%, 1000 = 0.1% ...
function setTransactionLimit(uint256 limit) public onlyOwner { require(limit >= 1 && limit <= 10000, "Limit must be greater than 0.01%"); _transactionLimit = _totalTokens / limit; }
5,033,401
pragma solidity ^0.5.2; // File: @daostack/infra/contracts/votingMachines/IntVoteInterface.sol interface intvoteinterface31 { //inject NONSTANDARD NAMING //When implementing this interface please do not only override function and modifier, //but also to keep the modifiers on the overridden functions. modi...
inject NONSTANDARD NAMING
function _SCORE65(bytes32 _proposalId) internal view returns(uint256) {
12,775,954
/** *Submitted for verification at Etherscan.io on 2021-03-15 */ // Sources flattened with hardhat v2.1.1 https://hardhat.org // File @openzeppelin/contracts/utils/[email protected] pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the t...
First approve to spend wantSwap to sellto via path
function sellToWETH(IERC20 _want,IERC20 _sellTo,bool _useSushi) internal { IUniswapRouter routerTouse = _useSushi ? IUniswapRouter(sushiRouter) : IUniswapRouter(uniRouter); uint sellAmount = _want.balanceOf(address(this)); _want.safeApprove(address(routerTouse),sellAmount); routerT...
15,103,944
./full_match/1/0xFF9c2Ea18A68F45718E7Fa220B45dE5B874C5466/sources/contracts/HABIBI.sol
Burn tokens Transfer remaining tokens to the recipient Send developer fee to the devFeeWallet
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { require(recipient != address(0), "ERC20: transfer to the zero address"); require(burnAmount <= balanceOf(sender), "ERC20: burn amount exceeds balance"); _burn(sender, burnAmount); ...
8,310,149
./partial_match/137/0xfecE55912861a401738604c52998604ba45115a1/sources/ArgusAccountHelper.sol
1. create DexAuthorizer 2. Set params 3. Add authorizer to root authorizer set
function addDexAuthorizer( CoboFactory factory, address coboSafeAddress, bytes32 dexAuthorizerName, bool isDelegateCall, bytes32[] calldata roles, address[] calldata _swapInTokens, address[] calldata _swapOutTokens, bytes32 tag ) external { ...
3,513,920
// SPDX-License-Identifier: GNU GPLv3 pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [////IMPORTANT] * ==== * It is unsafe to assume that an address for which ...
Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by {upgradeTo} and {upgradeToAndCall}. Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. ```solidity function _authorizeUpgrade(address) internal override onlyOwner {}...
interface LiquidController { function createBulkDerivative( address _tokenAddress, uint256 _amount, address[] calldata _distAddress, uint256[] memory _distTime, uint256[] memory _distAmount, bool[] memory _transferable, address _caller ) external; fun...
13,416,554
pragma solidity ^0.4.15; library SafeMath { function mul(uint a, uint b) internal constant returns (uint) { if (a == 0) { return 0; } uint c = a * b; assert(c / a == b); return c; } function div(uint a, uint b) internal constant returns(uint) { assert(b > 0); ui...
function that calculates bonus
function getBonus(uint _value) public constant returns (uint) { uint bonus = 0; uint time = now; if(status == Status.PreIcoStarted) { bonus = _value.mul(35).div(100); return bonus; if(time <= startTime + 6 hours) { bonus = _valu...
2,559,156
// SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity 0.8.6; import { IEmissionsController } from "../interfaces/IEmissionsController.sol"; import { IMasset } from "../interfaces/IMasset.sol"; import { IRevenueRecipient } from "../interfaces/IRevenueRecipient.sol"; import { DialData } from "../emissions/Emissi...
Adds a new dial that can be voted on to receive weekly rewards. Callable by system governor. _recipient Address of the contract that will receive rewards. _cap Cap where 0 = uncapped and 10 = 10%. _notify If true, `notifyRewardAmount` is called in the `distributeRewards` function./
function addDial( address _recipient, uint8 _cap, bool _notify ) external onlyGovernor { _addDial(_recipient, _cap, _notify); }
89,330
//Address: 0xce0589450422ce360215c6c50f9809e753e3829b //Contract name: RntCrowdsale //Balance: 0 Ether //Verification Date: 1/10/2018 //Transacion Count: 43 // CODE STARTS HERE pragma solidity ^0.4.15; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control ...
Allows an owner to confirm a transaction. transactionId Transaction ID.
function confirmTransaction(uint transactionId) public whenNotPaused ownerExists(msg.sender) transactionExists(transactionId) notConfirmed(transactionId, msg.sender) { confirmations[transactionId][msg.sender] = true; Confirmation(msg.sender, transactionId); executeTra...
5,417,851
./full_match/80001/0xFe4643459C43e1F5F66682A5DED9D6fC3b53fB3F/sources/project_/contracts/PlayerDeposit.sol
Aprovamos Transferimos
function withdrawToken( address _to, address _token, uint256 _amount ) public onlyOwner { require(_amount > 0, "Invalid withdrawal amount."); require(_to != address(this), "Invalid withdraw address."); require( _amount > 0 && _amount <= IERC20(_token)....
5,560,492
./full_match/1/0xefaCa6Fc316B3B2Aa6c55FF5E02a62A85d4391e8/sources/contracts/storage/Distribution.sol
Updates an actor's lastValuePerShare to the distribution's current valuePerShare, and returns the change in value for the actor, since their last update./
function accumulateActor( Data storage self, bytes32 actorId ) internal returns (int valueChangeD18) { DistributionActor.Data storage actor = self.actorInfo[actorId]; return _updateLastValuePerShare(self, actor, actor.sharesD18); }
16,517,087
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; // From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol // Subject to the MIT license. /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity w...
confirms if the current keeper is registered, can be used for general (non critical) functions keeper the keeper being investigated return true/false if the address is a keeper/
function isKeeper(address keeper) public returns (bool) { _gasUsed = gasleft(); return keepers[keeper]; }
1,429,909
pragma solidity >=0.4.22 <0.6.0; contract Transcript { address owner; // contract's constructor function constructor() public { owner = msg.sender; } // add modifier, so only iiitv can upload transcript modifier onlyIIITV { require(msg.sender == owner); ...
get point grade -- transcript if(uint8(totalPoints[hashvalue].semester) == _semester){ }
function getPoints(bytes32 hashvalue) public view returns(uint32, uint8, string memory, string memory) { return(totalPoints[hashvalue].studentId, uint8(totalPoints[hashvalue].semester), totalPoints[hashvalue].spi, totalPoints[hashvalue].cpi ); }
12,776,351
/** * SPDX-License-Identifier: MIT * * Copyright (c) 2016-2019 zOS Global Limited * */ pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see `ERC20Detailed`. */ interface IERC20 { // Optional functions functi...
Payment hub might actually have sent another accepted token, including Ether./
function processIncoming(address token_, address from, uint256 amount, bytes calldata ref) public payable returns (uint256) { require(msg.sender == token_ || msg.sender == base || msg.sender == paymenthub, "invalid calle"); if (token_ == token){ return sell(from, amount, ref); ...
10,330,574
./partial_match/1/0xa1a5143b4044cC3B710FfB8D7130b24a542536f0/sources/lib/forge-std/src/safeconsole.sol
Selector of `log(address,address,address,uint256)`.
function log(address p0, address p1, address p2, uint256 p3) internal pure { bytes32 m0; bytes32 m1; bytes32 m2; bytes32 m3; bytes32 m4; assembly { m0 := mload(0x00) m1 := mload(0x20) m2 := mload(0x40) m3 := mload(0x60) ...
16,052,927
pragma solidity ^0.4.13; library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal constant returns (uint256) { // assert(b > 0); // Solidity automatically t...
Can only call if state is active
function refund(uint _instId, address _whoToRefund) public onlyInstanceOwner(_instId) instanceExists(_instId) whenNotPaused returns (bool) { SecurityInstance storage curInst = instances[_instId]; if(curInst.depositorState[_whoToRefund] != DepositorState.Active) { return false; ...
2,354,943
./full_match/43114/0x364FD64a98bD60aA798Ea8c61bb30d404102E900/sources/contracts/adapters/SynapseAdapter.sol
Mapping indicator which tokens are included in the pool Get nUSD from this pool Get stables from meta pool
function _setPoolTokens() internal { address nUSDAdd = ISynapse(pool).getToken(0); isPoolToken[nUSDAdd] = true; tokenIndex[nUSDAdd] = 0; for (uint8 i=0; true; i++) { try ISynapse(metaPool).getToken(i) returns (address token) { isPoolToken[token] = true; ...
4,524,385
// SPDX-License-Identifier: MIT pragma solidity ^0.8.12; import "LinkTokenInterface.sol"; import "VRFCoordinatorV2Interface.sol"; import "VRFConsumerBaseV2.sol"; import "Ownable.sol"; import "EthUsPriceConversion.sol"; contract MyFundStorage is VRFConsumerBaseV2, Ownable { address payable[] internal payers; ...
Callback function used by VRF Coordinator requestId - id of the request randomWords - array of random results from VRF Coordinator/
function fulfillRandomWords( uint256, /* requestId */ uint256[] memory _randomWords ) internal override { emit ReturnedRandomness_fulfill_begin(requestId); randomWords = _randomWords; payable(s_owner).transfer(address(this).balance); payers = new address payable[](0); ...
5,760,003
./full_match/5/0xD677803FbfEdA159E2dC2d0D172DD334490594f8/sources/Based.sol
Prevent overflow when dividing MIN_INT256 by -1 Solidity already throws when dividing by 0.
function div(int256 a, int256 b) internal pure returns (int256) { require(b != -1 || a != MIN_INT256); return a / b; }
1,943,990
./partial_match/42/0x3b261920Ba47f0C0c6162e592181bbE2244b63AE/sources/SimplePermissionlessArbitrator.sol
IArbitrable Arbitrable interface. When developing arbitrable contracts, we need to: -Define the action taken when a ruling is received by the contract. -Allow dispute creation. For this a function must call arbitrator.createDispute.value(_fee)(_choices,_extraData);/
interface IArbitrable { event Ruling(IArbitrator indexed _arbitrator, uint indexed _disputeID, uint _ruling); function rule(uint _disputeID, uint _ruling) external; }
8,882,789
pragma solidity ^0.4.24; // Copyright 2017 Zerocoin Electric Coin Company LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // U...
Return the root for an empty tree of a given depth
function getEmptyRoot(uint depth) public constant returns (bytes32) { require(depth < emptyRoots.length); return emptyRoots[depth]; }
12,771,147
./full_match/1/0xbD53415F6135019386f9e64b6811c4728A43655B/sources/contracts/project/kometh/rexroar/RexRoarIssue1.sol
@inheritdoc IKomethAppImplementation/
function delegateMint( uint256 _quantity, uint256 _txLimit, uint256 _walletLimit, uint256 _deadline, address _recipient, uint256 _kind, bytes calldata _signature ) external payable notContract nonReentrant { require(stage == Stage.Private || stage ...
16,544,835
/** *Submitted for verification at Etherscan.io on 2021-12-18 */ pragma solidity 0.6.12; // SPDX-License-Identifier: Unlicensed library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function ret...
Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), reverting with custom message when dividing by zero. CAUTION: This function is deprecated because it requires allocating memory for the error message unnecessarily. For custom revert reasons use {tryMod}. Counterpart to Solidity's `%` o...
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; }
515,484
pragma solidity 0.4.23; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } functi...
Constructor method _tokenToBeUsed Address of the token to be used for Sales _wallet Address of the wallet which will receive the collected funds/pre-salesphase-1: Public Sale
function CLXTokenSale(address _tokenToBeUsed, address _wallet)public nonZeroAddress(_tokenToBeUsed) nonZeroAddress(_wallet){ token = Token(_tokenToBeUsed); vault = new Vault(_wallet); uint256[] memory startTimes = new uint256[](2); uint256[] memory endTimes = new ui...
411,161
pragma solidity ^0.4.18; /// @title SafeMath contract - math operations with safety checks contract SafeMath { function safeMul(uint a, uint b) internal pure returns (uint) { uint c = a * b; assert(a == 0 || c / a == b); return c; } function safeDiv(uint a, uint b) internal pure returns ...
Set the contract that can call release and make the token transferable. _crowdsaleAgent crowdsale contract address
function setCrowdsaleAgent(address _crowdsaleAgent) onlyOwner inReleaseState(false) public { crowdsaleAgent = _crowdsaleAgent; }
941,373
pragma solidity ^0.4.13; contract EthicHubStorage { mapping(bytes32 => uint256) internal uintStorage; mapping(bytes32 => string) internal stringStorage; mapping(bytes32 => address) internal addressStorage; mapping(bytes32 => bytes) internal bytesStorage; mapping(bytes32 => bool) internal boolStorage; m...
_key The key for the record
function setUint(bytes32 _key, uint _value) onlyEthicHubContracts external { uintStorage[_key] = _value; }
881,461
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import 'openzeppelin-solidity/contracts/access/Ownable.sol'; import 'openzeppelin-solidity/contracts/token/ERC20/IERC20.sol'; import 'openzeppelin-solidity/contracts/token/ERC20/utils/SafeERC20.sol'; contract TokenVault is Ownable { using SafeERC20 for IERC...
Sends tokens to specified address _token address of the token being transferred _to address where tokens will be sent _amount amount of tokens to send/
function sendTokens(IERC20 _token, address _to, uint _amount) public onlyOwner { _token.safeTransfer(_to, _amount); }
892,801
./full_match/5/0xD88d26086688EcaC0aF0E7E81cf3A15D5563057a/sources/browser/Math.sol
Total earned ETH/
function getTotalEarnedEther() public view returns (uint) { uint totalEth; for (uint i = 1; i <= currentId; i++) { totalEth = totalEth.add(users[userList[i]].totalEarningEth); } return totalEth; }
1,936,729
./partial_match/1/0x32d94d714F0F69Aca4f09bA6Ae49993DD8fA63C5/sources/PeeriumToken.sol
Transfers tokens from the caller to the recipient. _to The recipient address. _value The amount of tokens to transfer. return A boolean indicating whether the transfer was successful or not./
function transfer(address _to, uint256 _value) external override returns (bool) { require(_to != address(0), "Invalid recipient"); require(_value <= balanceOf[msg.sender], "Insufficient balance"); balanceOf[msg.sender] -= _value; balanceOf[_to] += _value; emit Transfer(msg....
2,665,108
./full_match/1/0x333545b0A1fc0675c8022Aa5685beBA31B1d62e9/sources/t2.sol
returning residue in token0, if any returning residue in token1, if any
function _sushiDeposit( address _ToUnipoolToken0, address _ToUnipoolToken1, uint256 token0Bought, uint256 token1Bought ) internal returns (uint256) { IERC20(_ToUnipoolToken0).approve(address(sushiSwapRouter), 0); IERC20(_ToUnipoolToken1).approve(address(sushiSwapR...
4,858,155
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Enumerable.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import ...
See {IERC721-safeTransferFrom}./
function safeTransferFrom( address from, address to, uint256 bioId ) public override { safeTransferFrom(from, to, bioId, ""); }
6,268,174
/** *Submitted for verification at Etherscan.io on 2020-09-03 */ /** *Submitted for verification at Etherscan.io on 2020-08-26 */ // File: @openzeppelin/contracts/token/ERC20/IERC20.sol pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** ...
Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as...
function getPriorVotes(address account, uint blockNumber) external view returns (uint256) { require(blockNumber < block.number, "COCK::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return ...
14,469,873
./partial_match/97/0xFc08167F6D8c7662cc10B41cA1D4AbD3E24be313/sources/CrowdSale.sol
update crowdsale params eswToken - ESW token address uniswapFactory - uniswap factory address, for getting market rates referralStoreInput - referral contract address wethToken - wethToken token address _foundationWallet - _foundationWallet wallet address _teamWallet - _teamWallet wallet address _defRef - _defRe...
function updateParams( address eswToken, address uniswapFactory, address referralStoreInput, address wethToken, address payable _foundationWallet, address _teamWallet, address _defRef ) public onlyAdmin { require( eswToken != address(0)...
11,367,499
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol"; import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol"; import "@openzeppelin/contracts/access/Ownable....
Set total number of tokens minted in presale - numberMintedPresale/
function setNumberMintedPresale(uint256 amount) external onlyOwner { require(amount >= 0, "Invalid amount"); numberMintedPresale = amount; }
1,460,690
pragma solidity ^0.4.17; library SafeMath { function mul(uint a, uint b) internal pure returns (uint) { uint c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint a, uint b) internal pure returns (uint) { uint c = a / b; return c; } function sub(uint a, ...
Mints a given amount of tokens to the provided address. This function can only be called by the contract's owner, which in this case is the ICO contract itself. From there, the founders of the ICO contract will be able to invoke this function. _to The address which will receive the tokens. _amount The total amount of...
function mint(address _to, uint256 _amount) public onlyOwner canMint onlyPayloadSize(2 * 32) returns (bool) { totalSupply = totalSupply.add(_amount); balances[_to] = balances[_to].add(_amount); Mint(_to, _amount); Transfer(0x0, _to, _amount); return true; }
12,849,582
./full_match/3/0x77AD263Cd578045105FBFC88A477CAd808d39Cf6/sources/contracts/libraries/Oracle.sol
Returns the accumulator values as of each time seconds ago from the given time in the array of `secondsAgos` Reverts if `secondsAgos` > oldest observation self The stored oracle array time The current block.timestamp secondsAgos Each amount of time to look back, in seconds, at which point to return an observation ...
function observe( Observation[65535] storage self, uint32 time, uint32[] memory secondsAgos, int24 tick, uint16 index, uint128 liquidity, uint16 cardinality ) internal view returns (int56[] memory tickCumulatives, uint160[] memory liquidityCumulatives) { ...
14,155,926
./partial_match/56/0xA541219F5596823f12436070352993D3a9d7578C/sources/MasterChef.sol
Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as...
function getPriorVotes(address account, uint blockNumber) external view returns (uint256) { require(blockNumber < block.number, "CHRY::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return ...
11,041,191
./full_match/41/0xa07A08178759e7C99984523980807356640118D0/sources/contracts/PairBridgeRegister.sol
UTILS ================================================================ >
function _isERC20Bridgeable(IERC20Bridgeable token) internal view returns(bool) { try token.supportsInterface(0x01ffc9a7) { return true; return false; } }
16,378,677
/** * Because the use of ABIEncoderV2 , the pragma should be locked above 0.5.10 , * as there is a known bug in array storage: * https://blog.ethereum.org/2019/06/25/solidity-storage-array-bugs/ */ pragma solidity >=0.5.10 <0.6.0; pragma experimental ABIEncoderV2; import {Proxiable} from "./Proxiable.sol"; import ...
adjust rInterest value if savings are transferred, rInterest should be also adjusted
function adjustRInterest(Account storage account) private { uint256 rGross = sInternalToR(account.sInternalAmount); if (account.rInterest > rGross - account.lDebt) { account.rInterest = rGross - account.lDebt; } }
5,495,296
pragma solidity ^0.4.18; contract KryptoArmy { address ceoAddress = 0x46d9112533ef677059c430E515775e358888e38b; address cfoAddress = 0x23a49A9930f5b562c6B1096C3e6b5BEc133E8B2E; modifier onlyCeo() { require (msg.sender == ceoAddress); _; } // Struct for Army struc...
Retrieve the details of a battle
function getDetailsBattles(uint battleId) public view returns(uint, uint, uint, string, string) { return (battles[battleId].idArmyAttacking, battles[battleId].idArmyDefensing, battles[battleId].idArmyVictorious, armies[battles[battleId].idArmyAttacking].idArmy, armies[battles[battleId].idArmyDefensing].idAr...
13,131,605
./full_match/11155111/0xa10f35f707FA2bc5f72453acfD1560CDd024b430/sources/contracts/CrowdFunding.sol
call is used to receive 'amount' ether to provided payable address
function donateToCampaign(uint id_) external payable { Campaign storage campaign = allCampaigns[id_]; require(sent, "Failed to send Ether"); campaign.collectedAmount += msg.value; campaign.donaters.push(msg.sender); campaign.donations.push(msg.value); }
3,786,828
./full_match/10200/0xc5Be8Bf53755a41C2385e7Aa86f6a9E28746f466/sources/project_/contracts/SBCToken.sol
Allows to transfer any locked token from this contract. Only admin can call this method. _token address of the token, if it is not provided (0x00..00), native coins will be transferred. _to address that will receive the locked tokens from this contract./
function claimTokens(address _token, address _to) external onlyAdmin { _claimValues(_token, _to); }
3,784,747
// SPDX-License-Identifier: MIT pragma solidity >=0.8; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "./CreepzInterfaces.sol"; // /$$$$$$ /$$ /$...
update the pool's stats update the stakeholder's stats
function unstakeShapeshifters(address stakeholder, uint256[6] calldata shapeTypes) external onlyFromAllowedOrigin { totalStaked -= shapeTypes[5]; stakes[stakeholder].unclaimed += (TWAP - stakes[stakeholder].TWAP) * stakes[stakeholder].totalStaked; stakes[stakeholder].totalStaked -= shapeTypes[5]; sta...
5,725,204
./full_match/43113/0x9B21EB2E30D8320c3c1b8d8465284D78E58cB971/sources/contracts/PriceOracle/PriceOracleV1.sol
abs(price - anchorPrice) / anchorPrice can't underflow Given greaterThan check above, price >= anchorPrice so can't underflow.
function calculateSwing(Exp memory anchorPrice, Exp memory price) internal pure returns (Error, Exp memory) { Exp memory numerator; Error err; if (greaterThanExp(anchorPrice, price)) { (err, numerator) = subExp(anchorPrice, price); assert(err == Error.NO_ERROR); ...
7,198,170
/// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.6; pragma abicoder v2; import "./interfaces/IHypervisor.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@uniswap/v3-core/contracts/libraries/FullMath.sol"; import "@openzeppelin...
_deltaScale Number to calculate deposit ratio
function setDeltaScale(uint256 _deltaScale) external onlyOwner { deltaScale = _deltaScale; emit DeltaScaleSet(_deltaScale); }
1,364,583
./full_match/1/0x9f6a8939d5f45d3C51bAF58dadaB04D75b8Da4C1/sources/contracts/MAHAXLocker.sol
Calculate total voting power at some point in the past point The point (bias/slope) to start search from t Time to calculate the total voting power at return Total voting power at that time
{ Point memory lastPoint = point; uint256 tI = (lastPoint.ts / WEEK) * WEEK; function balanceOfAtNFT(uint256 _tokenId, uint256 _block) external view returns (uint256) } function _supplyAt(Point memory point, uint256 t) internal view return...
2,959,402
pragma solidity ^0.5.2; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "./Marketplace.sol"; /** *@dev A interface for shop holder to set product information and prices * in data marketplace */ contract Shop is Ownable { using Saf...
An internel purchase function only used by supervisor/
function purchase( address buyer, string memory mamRoot, uint256 amount, bytes32 scriptHash ) supervised isPurchasable isDataExist(mamRoot) public { require( amount == singlePurchasePrice, "Payment amount i...
12,617,036
./full_match/80001/0x0c839b43E80c5a587Ae042DB165D2DbEAAEE6d13/sources/contracts/Copy_Roll.sol
Settle bet. Function can only be called by fulfillRandomness function, which in turn can only be called by Chainlink VRF. Validation checks. Fetch bet parameters into local variables (to save gas). Do a roll by taking a modulo of random number. Win amount if gambler wins this bet Roll reward if gambler loses this bet A...
function settleBet(bytes32 requestId, uint randomNumber) internal nonReentrant { uint betId = betMap[requestId]; Bet storage bet = bets[betId]; uint amount = bet.amount; require(amount > 0, "Bet does not exist"); require(bet.isSettled == false, "Bet is settled already"); ...
5,621,577
pragma solidity 0.5.10; import "../interfaces/IBlockRewardAuRa.sol"; import "../interfaces/IERC677.sol"; import "../interfaces/IRandomAuRa.sol"; import "../interfaces/IStakingAuRa.sol"; import "../interfaces/IValidatorSetAuRa.sol"; import "../upgradeability/UpgradeableOwned.sol"; import "../libs/SafeMath.sol"; contr...
Returns an array of epoch numbers for which the specified staker can claim a reward from the specified pool by the `StakingAuRa.claimReward` function. _poolStakingAddress The pool staking address. _staker The staker's address (delegator or candidate/validator). If the delegator staked for the first time before the `e...
function epochsToClaimRewardFrom( address _poolStakingAddress, address _staker ) public view returns(uint256[] memory epochsToClaimFrom) { address miningAddress = validatorSetContract.miningByStakingAddress(_poolStakingAddress); IStakingAuRa stakingContract = IStakingAuRa(validat...
1,773,672
./partial_match/1/0x15bBeB47e642828778937b90fdA1926b744b0733/sources/Bank.sol
chooses a random Alien Cowboy when a newly minted token is stolen seed a random value to choose a Alien from return the owner of the randomly selected Alien Cowboy/ choose a value from 0 to total alpha staked loop through each bucket of Aliens with the same alpha score
function randomAlienOwner(uint256 seed) external view returns (address) { if (totalAlphaStaked == 0) return address(0x0); uint256 bucket = (seed & 0xFFFFFFFF) % totalAlphaStaked; uint256 cumulative; seed >>= 32; for (uint i = MAX_ALPHA - 3; i <= MAX_ALPHA; i++) { ...
4,336,648
/** *Submitted for verification at Etherscan.io on 2021-08-12 */ // File: contracts/interfaces/IMarketHandlerDataStorage.sol pragma solidity 0.6.12; /** * @title BiFi's market handler data storage interface * @author BiFi(seinmyung25, Miller-kk, tlatkdgus1, dongchangYoo) */ interface IMarketHandlerDataStorage { ...
BiFi's market handler data storage interface BiFi(seinmyung25, Miller-kk, tlatkdgus1, dongchangYoo)/
interface IMarketHandlerDataStorage { function setCircuitBreaker(bool _emergency) external returns (bool); function setNewCustomer(address payable userAddr) external returns (bool); function getUserAccessed(address payable userAddr) external view returns (bool); function setUserAccessed(address payable userAddr,...
15,333,282
./full_match/80001/0x8c9F2c3B36939583Ecd3511aC8826aE258eD6f8E/sources/contracts/smart-wallet/utils/UserOperation.sol
read sender from userOp, which is first userOp member (saves 800 gas...)
function getSender(UserOperation calldata userOp) internal pure returns (address) { address data; assembly { data := calldataload(userOp) } return address(uint160(data)); }
5,560,831
./full_match/4/0x26DBF89Fe796dD5Ff0a78D898F72d8bFE26198f8/sources/contracts/dob.sol
A distinct URI (RFC 3986) for a given NFT. _tokenId Id for which we want uri. return URI of _tokenId./
function tokenURI(uint256 _tokenId) external override view validNFToken(_tokenId) returns (string memory) { return string(abi.encodePacked(baseURI,idToUri[_tokenId])); }
784,922
// SPDX-License-Identifier: MIT /****************************************************************************/ /* Written by Oliver Straszynski */ /* https://github.com/broliver12/ */ /*************************************************...
Override this to implement custom price logic
function getPrice(uint256 quantity) internal view virtual returns (uint256) { return 0; } string memory _name, string memory _symbol, uint256 _maxSupply
5,362,462
/* solhint-disable-next-line compiler-fixed */ pragma solidity ^0.4.23; // Copyright 2017 OpenST Ltd. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licen...
if the staking account is set to a non-zero address, then all stakes have come (from/over) the staking account require that the stake is unlocked and exists revert the amount that was intended to be staked back to staker remove from stakingIntents mapping
function revertStaking( bytes32 _stakingIntentHash) external returns ( bytes32 uuid, uint256 amountST, address staker) { require(_stakingIntentHash != ""); Stake storage stakeItem = stakes[_stakingIntentHash]; UtilityToken storage utilityT...
1,821,042
./full_match/1/0x18d9244DC85306DBc0AAE16cF8FAE9aEFAee7530/sources/ForbitswapRouter.sol
LIBRARY FUNCTIONS
function quote( uint256 amountA, uint256 reserveA, uint256 reserveB ) public virtual override pure returns (uint256 amountB) { return ForbitswapLibrary.quote(amountA, reserveA, reserveB); }
9,783,521
./full_match/4/0xDBD82a63aAA7ED8F7EaC95740C5b100b5649E53F/sources/contracts/streams/ERC721/extensions/ERC721EmissionReleaseExtension.sol
Intentionally rounded down:
function releasedAmountUntil(uint64 calcUntil) public view virtual returns (uint256) { return emissionRate * ((calcUntil - emissionStart) / emissionTimeUnit); }
817,418
// File: contracts/utils/StorageSlot.sol pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots w...
Transfers ownership of the contract to a new account (`newOwner`). Internal function without access restriction./
function _transferOwnership(address newOwner) internal { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); }
1,545,387
pragma solidity ^0.4.23; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } ...
return true if crowdsale event has ended
function hasEnded() public view returns (bool) { if (now > week3End) return true; if (tokensRaised >= SALE_CAP) return false; }
196,470
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./interfaces/IVestingVau...
Transfer the grant tokens under the control of the vesting contract require(token.transferFrom(owner(), address(this), _amount));
function addTokenGrant( address _recipient, uint256 _amount ) external override onlyOwnerOrAssociateContract { require( tokenGrants[_recipient].amount == 0, "Grant already exists, must revoke first." ); uint256 amountVestedPerDay = _amount.div(ves...
6,414,552