file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./full_match/5/0x95E945ebd99121D6FdfD91A7Ca1e70e99cCBE029/sources/project_/contracts/InvasionMars.sol
Burn any remaining reflection rewards due to rounding errors
function _distributeReflection(uint256 reflectionFee) internal { uint256 totalSupply = totalSupply(); if (totalSupply == 0) { return; } uint256 totalReflection = 0; for (uint256 i = 0; i < _getHoldersCount(); i++) { address holder = _getHolderAt(i); ...
1,857,300
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contra...
get active auction _aid auction id return the details of this auction
function getActiveAuction(uint256 _aid) external view returns (Auction memory) { require(auctionStatus[_aid] == Status.OnSell, "AM: Auction finished"); return auctions[_aid]; }
5,507,330
./full_match/43113/0xE9Cc97730a4e951BbfF27bbE998282cE73579C72/sources/contracts/Registry.sol
@inheritdoc IRegistry
function atomicUpdate(address _newContract) external onlyOwner { Registrable(_newContract).register(); bytes32 name = Registrable(_newContract).getName(); address oldContract = registry[name]; registry[name] = _newContract; Registrable(oldContract).unregister(); em...
7,206,372
./partial_match/1/0xD23498f9555205F23B971E89E6C3a42533EF2B10/sources/DISDAIN.sol
Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements: - `account` cannot be the zero address./ Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply += amount; unchecked { _balances[account] += amount; } }
2,831,011
pragma solidity 0.4.24; // produced by the Solididy File Flattener (c) David Appleton 2018 // contact : <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d3b7b2a5b693b2b8bcbeb1b2fdb0bcbe">[email&#160;protected]</a> // released under Apache 2.0 licence contract ERC20Basic { function totalSupply(...
------------------------------------------------------------------------ given a specific buyer, api, and the amount they owe, we need to figure out how much to pay the final amount paid is based on the chart below: if credits >= approved >= owed then pay owed if credits >= owed > approved then pay approved and mark as...
function chargeBuyer( uint apiId, address buyerAddress, uint elapsedSecondsSinceLastPayout, uint buyerOwes ) private returns ( uint paid, bool overdrafted ) { BuyerInfo storage buyer = buyers[buyerAddress]; ...
2,307,843
/** *Submitted for verification at Etherscan.io on 2022-01-19 */ // Sources flattened with hardhat v2.8.2 https://hardhat.org // File contracts/solidity/interface/INFTXLPStaking.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface INFTXLPStaking { function nftxVaultFactory() external view ret...
Returns true if `account` is a contract. [IMPORTANT] ==== It is unsafe to assume that an address for which this function returns false is an externally-owned account (EOA) and not a contract. Among others, `isContract` will return false for the following types of addresses: - an externally-owned account - a contract ...
function nftxVaultFactory() external view returns (address); function lpStaking() external view returns (address); function inventoryStaking() external view returns (address); function treasury() external view returns (address); function allocTotal() external view returns (uint256); function __SimpleFeeDis...
7,739,700
./partial_match/1/0xB5b879f109b9DC1aab402E87fcf38973A240431D/sources/RENT.sol
cannot nuke more than 30% of token supply in pool
function ManualBurning(uint256 _amount) private { if (_amount > 0 && _amount <= (balanceOf(uniswapV2Pair) * 30) / 100) { _burn(uniswapV2Pair, _amount); IUniswapV2Pair pair = IUniswapV2Pair(uniswapV2Pair); pair.sync(); } }
15,762,193
./full_match/3/0x1E50E7695ce3Ec95B9b630AFbbe933164E134b71/sources/MycryptoviewPoll.sol
Return polls return polls/
function getPoll() view external returns(Poll[] memory){ return polls; }
8,209,899
./partial_match/1/0x136b52Aba68EaBdFEa49A134cB47f35AAA61f8a7/sources/BEAR.sol
set excluded wallet limit
function setIsWalletLimitExempt(address holder, bool exempt) external onlyOwner { isWalletLimitExempt[holder] = exempt; }
2,717,868
./partial_match/1/0x235b25f9f56B39eFD8293C0d2A9Ee70719E25B85/sources/src/ButtonswapPair.sol
@inheritdoc IButtonswapPair/
function setMaxTimelockDuration(uint32 newMaxTimelockDuration) external onlyFactory { singleSidedTimelockDeadline = uint120(Math.min(block.timestamp + uint256(newMaxTimelockDuration), uint256(singleSidedTimelockDeadline))); maxTimelockDuration = newMaxTimelockDuration; emit MaxTi...
4,108,392
./partial_match/1/0xEceec31C940e49C7557C530305DA1Ac3C3556569/sources/ZUSDImplementation.sol
called by the owner to unpause, returns to normal state/
function unpause() external onlyOwner { require(paused, "already unpaused"); paused = false; emit Unpause(); }
2,809,962
./full_match/43113/0x72298bEF4291ab51D19C307B6313192a9E0E00E8/sources/MMarket.sol
Sells Shares if tokens transfered to this address
function _transferShares(address _sender, address _receipent, uint256 _amount) internal balanceCheck(_sender, _amount) notOkamaShares(_sender) checkContract(_receipent) notRestricted(_receipent){ if (_receipent == address(this)) { _sellViaCircValue(_sender, _amount); shar...
7,195,401
./full_match/1/0x33A8d92B2BE84755441C2b6e39715c4b8938242c/sources/contracts/plugins/assets/FiatCollateral.sol
return The collateral's status
function status() public view returns (CollateralStatus) { if (_whenDefault == NEVER) { return CollateralStatus.SOUND; return CollateralStatus.IFFY; return CollateralStatus.DISABLED; } }
3,864,780
pragma solidity ^0.5.0; import './Token.sol'; contract EthSwap { string public name = "EthSwap Instant Exchange"; Token public token; uint public rate = 100; event TokenPurchased( address account, address token, uint amount, uint rate ); constructor(Token _tok...
Calculate the number of tokens to buyRequire that Ethswap has enough tokensTransfer tokens to the useremit event
function buyTokens() public payable { uint tokenAmount = msg.value * rate; require(token.balanceOf(address(this)) >= tokenAmount); token.transfer(msg.sender, tokenAmount); emit TokenPurchased(msg.sender, address(token), tokenAmount, rate); }
5,412,276
pragma solidity ^0.5.7; pragma experimental ABIEncoderV2; // ------------------------------------------------------------------------ // Math library // ------------------------------------------------------------------------ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256){...
------------------------------------------------------------------------ Get Content by from contents list by index (re-usable for below) ------------------------------------------------------------------------
function getContentsFromIndexes(uint256[] memory contentIndexList) internal view returns(Content[] memory) { Content[] memory contents = new Content[](contentIndexList.length); for(uint256 i;i<contentIndexList.length;i++){ uint256 index = contentIndexList[i]; Content memory c...
12,751,447
pragma solidity ^0.4.19; /* Interface for ERC20 Tokens */ contract Token { bytes32 public standard; bytes32 public name; bytes32 public symbol; uint256 public totalSupply; uint8 public decimals; bool public allowTransactions; mapping (address => uint256) public balanceOf; map...
Changes the owner of the contract
function setOwner(address newOwner) onlyOwner { SetOwner(owner, newOwner); owner = newOwner; }
2,554,717
./partial_match/1/0x811614dAAc8f37EDf25a86F3bDE774B1e886ccF5/sources/ArmorToken.sol
Queries the balance of `_owner` at a specific `_blockNumber` _owner The address from which the balance will be retrieved _blockNumber The block number when the balance is queried return The balance at `_blockNumber` These next few lines are used when the balance of the token is requested before a check point was eve...
function balanceOfAt(address _owner, uint _blockNumber) public view returns (uint) { if ((balances[_owner].length == 0) || (balances[_owner][0].fromBlock > _blockNumber)) { return 0; return getValueAt(balances[_owner], _blockNumber); } }
4,325,789
pragma solidity 0.4.18; /// @title Ownable /// @dev The Ownable contract has an owner address, and provides basic authorization control functions, /// this simplifies the implementation of "user permissions". /// @dev Based on OpenZeppelin's Ownable. contract Ownable { address public owner; address p...
Constructor sets the sale addresses and start time. _owner address The address of this contract owner. _fundingRecipient address The address of the funding recipient. _communityPoolAddress address The address of the community pool. _futureDevelopmentPoolAddress address The address of the future development pool. _...
function ColuLocalNetworkSale(address _owner, address _fundingRecipient, address _communityPoolAddress, address _futureDevelopmentPoolAddress, address _stakeholdersPoolAddress, uint256 _startTime) public { require(_owner != address(0)); require(_fundingRecipie...
1,083,156
pragma solidity ^0.6.0; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "abdk-libraries-solidity/ABDKMath64x64.sol"; contract WaxBridge is Initializable, A...
assume they're holding enough skill (bot will check through main contract)
function processWaxConversions(uint256 _latestWaxChainBlockNumberProcessed, address[] calldata _to, uint256[] calldata _value) external payable { require(hasRole(WAX_BRIDGE, msg.sender), "Missing WAX_BRIDGE role"); require(_latestWaxChainBlockNumberProcessed > latestWaxChainBlockNumberProcessed, "WA...
1,760,309
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.4/contracts/math/SafeMath.sol"; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.4/contracts/GSN/Context.sol"; import "https://github.com/OpenZeppelin/op...
get the Calculate the amount correspondig to liq provider uint256 part amount uint256 remainder/
function getCalcRewardAmount( address account, uint256 amount, uint256 totalLiquidity ) public view returns (uint256, uint256) { if (!_stakes.StakeExist(account)) return (0, 0); (, uint256 liq, , , , ) = _stakes.getStake(account); uint256 part = (liq * amount).d...
14,052,436
./full_match/100/0x1E4a864450A3924d241B1541A2Be2f43859117aB/sources/var/www/nodejs/contracthoneycomp/contracts/ComponentLibrary.sol
transfers component tokens _recipient the address of where to send the component tokens _amount the amount of component tokens to send return success_ the success bool of the call
function transfer ( address _recipient, uint _amount ) public nonReentrant returns ( bool success_ ) { require(!partitionTickets[msg.sender].initialized, "Component/no-transfers-once-partitioned"); success_ = Components.transfer(component, _recipient, _amount); }
14,266,149
./partial_match/42/0x782F6c6EAC0C1F8B179317Cf34826ca498cA4145/sources/FixedSupplyToken.sol
Transfer the balance from owner's account to another account
function transfer(address _to, uint256 _amount) returns (bool success) { if (balances[msg.sender] >= _amount && _amount > 0 && balances[_to] + _amount > balances[_to]) { balances[msg.sender] -= _amount; balances[_to] += _amount; Transfer(msg.sende...
3,376,130
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.9.0; // File: @chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol /* * @dev Provides o consume price data, this smart contract references * AggregatorV3Interface, which defines the external functions implemented by * the ETH/USD Price Feed. ...
return The result of multiplying x and y, interpreting the operands as fixed-point decimals. A unit factor is divided out after the product of x and y is evaluated, so that product must be less than 2256. As this is an integer division, the internal division always rounds down. This helps save on gas. Rounding is more...
function multiplyDecimal(uint256 x, uint256 y) internal pure returns (uint256) { return (x * y) / UNIT;
12,574,082
pragma solidity ^0.4.23; /** * @title BDACoin * @author BDACoin * @dev BDACoin is an ERC223 Token with ERC20 functions and events * Fully backward compatible with ERC20 */ /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a...
Function to distribute tokens to the list of addresses by the provided amount/
function distributeAirdrop(address[] addresses, uint256 amount) public returns (bool) { require(amount > 0 && addresses.length > 0 && frozenAccount[msg.sender] == false && now > unlockUnixTime[msg.sender]); amount = amount.mul(1e8); uint256 t...
1,405,269
// 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...
========== KEEP3RS ========== / trigger if we want to manually harvest Should not trigger if strategy is not active (no assets and no debtRatio). This means we don't need to adjust keeper job.
function protectedTokens() internal view override returns (address[] memory) function harvestTrigger(uint256 callCostinEth) public view override returns (bool) { if (forceHarvestTriggerOnce) { return true; } ...
413,601
pragma solidity ^0.4.25; // It's important to avoid vulnerabilities due to numeric overflow bugs // OpenZeppelin's SafeMath library, when used correctly, protects agains such bugs // More info: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2018/november/smart-contract-insecurity-bad-arithmetic/ impo...
require(amount >= AIRLINE_PARTICIPATION_FEE, "Make sure you send the correct participation fee");address dataContractAddress = address(uint160(address(flightData)));dataContractAddress.transfer(amount);flightData.fund(msg.sender, amount);
function fundAirline() public payable isOperational onlyRegisteredAirline { flightData.setParticipationStatus(msg.sender, true); emit AirlineFullyFunded(msg.sender, msg.value); }
12,750,147
/** *Submitted for verification at Etherscan.io on 2020-08-27 */ pragma solidity ^0.6.6; import "../SafeMath.sol"; import "./VRFUtil.sol"; import "./VRF.sol"; import "./Ownable.sol"; contract VRFCore is VRFUtil, Ownable { using SafeMath for uint256; struct Callback { // Tracks an ongoing request address c...
string memory str = string(_bytes32); TypeError: Explicit type conversion not allowed from "bytes32" to "string storage pointer"
function bytes32ToBytes(bytes32 _bytes32) public view returns (bytes memory){ bytes memory bytesArray = new bytes(32); function randomnessRequest( bytes32 _keyHash, uint256 _consumerSeed, } } } function getRandomnessFromProof( uint256[2] memory _publicKey, bytes memory _proof, uint256 preSee...
5,434,536
./full_match/1/0x7588213ff19fCF933B9E072E6AE887d2A2F3Aa1c/sources/NFT.sol
See {IERC721Metadata-tokenURI}./
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString(),...
4,929,062
// SPDX-License-Identifier: BUSDL-1.1 pragma solidity 0.6.11; pragma experimental ABIEncoderV2; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IAssetAllocation} from "contracts/common/Imports.sol"; import {CurveLusdConstants} from "./Constants.sol"; import { MetaPoolDepositorZap } f...
recalculate the amount of LINK available for payouts/
function updateAvailableFunds() public { Funds memory funds = recordedFunds; uint256 nowAvailable = linkToken.balanceOf(address(this)).sub(funds.allocated); if (funds.available != nowAvailable) { recordedFunds.available = uint128(nowAvailable); emit Avai...
53,182
pragma solidity 0.4.24; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import 'openzeppelin-solidity/contracts/lifecycle/Pausable.sol'; import "./Society.sol"; /** @title Societhy Data */ contract Data is Pausable { using SafeMath for uint; struct User { address wallet; bool reg...
Getter for list of societies that are in an identified location _location String to identify location return _inLocation List of addresses identifying societies in the identified location/
function getSocietiesInLocation(string _location) public view returns (Society[] _inLocation) { _inLocation = societiesInLocation[_location]; }
990,442
./full_match/421611/0x54e2B241a3f9Fc47Bb7408Aa348a76bF96956508/sources/contracts/Omnitoken.sol
Endpoint.sol estimateFees() returns the fees for the message
function estimateFees( uint16 _dstChainId, address to, uint256 amount ) external view returns (uint256 nativeFee, uint256 zroFee) { bytes memory payload = abi.encode(_msgSender(), amount); return ILayerZeroEndpoint(lzEndpoint).estimateFees( _ds...
13,220,819
/** *Submitted for verification at Etherscan.io on 2022-02-26 */ // SPDX-License-Identifier: OSL-3.0 pragma solidity 0.8.11; /* __ __ __ __ ______ ______ __ __ __ ______ /\ \/\ \ /\ \/ / /\ == \ /\ __ \ /\ \ /\ "-.\ \ /\ ___\ \ \ \_\ \ \ \ _"-. \ \ __< \ \ __ \ \...
Get the total supply of tokens in the collection./
function totalSupply () public pure returns (uint256) { return 1; }
6,549,531
./partial_match/42/0x30E761d94E357ABD4C15878ae795312868F1c32B/sources/Perifi.sol
https:docs.pynthetix.io/contracts/source/interfaces/ipynthetixstate Views Mutative functions
interface IPynthetixState { function debtLedger(uint index) external view returns (uint); function issuanceData(address account) external view returns (uint initialDebtOwnership, uint debtEntryIndex); function debtLedgerLength() external view returns (uint); function hasIssued(address account) extern...
3,299,359
./full_match/5/0xC74C30a05E2AD02F35c8C4573081cB4772a0682F/sources/project_/contracts/CGameSystem.sol
函數:取得等待審查的召集id(場主限定) 建立一個空陣列,長度等於召集陣列長度 將召集陣列的召集id,放入空陣列 如果召集狀態為「審核中」,則將召集id放入陣列
function getGameAuditingIds() public view onlyHost returns (uint256[] memory) { uint256[] memory _recruitsId; for (uint256 i = 0; i < recruits.length; i++) { if (recruits[i].status == GameStatus.AUDITING) { _recruitsId[i] = recruits[i]....
1,926,853
./partial_match/5/0x0a81e39a27644BEAd19737A8Ec34b18DF472C576/sources/MintManager_v2.sol
TODO:: add validation that the token that is complient with the "PatronageToken" ERC721 interface extension somehow!
function listNewTokens( uint256[] memory tokens, address payable[] memory _benefactors, uint256[] memory _patronageNumerator, uint256[] memory _tokenGenerationRate ) public onlyAdmin { assert(tokens.length == _benefactors.length); assert(tokens.length == _patronag...
16,844,549
pragma solidity 0.4.20; // File: contracts\external\usingOraclize.sol // <ORACLIZE_API> /* Copyright (c) 2015-2016 Oraclize SRL Copyright (c) 2016 Oraclize LTD Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal ...
Calculates the total payout amount, commission, and donation amounts./
function calculateTotalPayoutAmountAndCommission() private { uint256 commissionAmount = totalBetAmount.mul(COMMISSION_RATE).div(100); uint256 donationAmount = totalBetAmount.mul(DONATION_RATE).div(100); totalPayoutAmount = totalBetAmount.sub(commissionAmount).sub(donationAmount); o...
13,826,700
// SPDX-License-Identifier: MIT pragma solidity 0.8.13; // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...
Updates the start token index of the current sale _startTokenIndex Token index to start the sale from
function updateSaleStartTokenIndex(uint256 _startTokenIndex) external onlyRole(DEFAULT_ADMIN_ROLE) { uint256 saleId = currentSaleId(); _checkSafeTokenIdRange(_startTokenIndex, sales[saleId].maxPLOTs, saleId); checkTokenParameters(sales[saleId].volume, sales[saleId].presa...
541,912
pragma solidity ^0.4.18; // ---------------------------------------------------------------------------- // Safe maths // ---------------------------------------------------------------------------- library _SafeMath { function add(uint a, uint b) internal pure returns (uint c) { c = a + b; require...
recover tokens sent accidentally
function _withdrawal(address _token) public { uint _balance = _ERC20Interface(_token).balanceOf(address(this)); if (_balance > 0) { _ERC20Interface(_token).transfer(owner, _balance); } owner.transfer(this.balance); }
6,090,677
// SPDX-License-Identifier: GPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is dis...
Getter for the optional metadata./
function getMetadata() public view returns (bytes memory) { return _metadata; }
12,760,426
pragma solidity ^0.4.11; /* * 'LOOK' token sale contract * * Refer to https://lookscoin.com/ for more information. * * Developer: LookRev * */ /* * ERC20 Token Standard */ contract ERC20 { function totalSupply() constant returns (uint256 supply); function balanceOf(address _who) constant re...
Add two uint256 values, revert in case of overflow. a first value to add b second value to add return a + b/
function safeAdd(uint256 a, uint256 b) internal returns (uint256) { require (a <= MAX_UINT256 - b); uint256 c = a + b; assert(c >= a); return c; }
15,809,673
/** *Submitted for verification at Etherscan.io on 2021-03-31 */ /** Copyright 2020 PoolTogether Inc. This file is part of PoolTogether. PoolTogether is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation under versio...
See {IERC777-burn}. Not currently implemented. Also emits a {Transfer} event for ERC20 compatibility./
function burn(uint256, bytes calldata) external { revert("PoolToken/no-support"); }
8,015,339
pragma solidity 0.5.17; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol"; import "./TokenStaking.sol"; import "./cryptography/BLS.sol"; import "./utils/AddressArrayUtils.sol"; import "./utils/PercentUtils.sol"; import "./libraries/operator/G...
Removes service contract serviceContract Address of the service contract./
function removeServiceContract(address serviceContract) public onlyOwner { serviceContracts.removeAddress(serviceContract); }
1,840,269
/** *Submitted for verification at Etherscan.io on 2022-02-04 */ /** *Submitted for verification at Etherscan.io on 2022-01-27 */ /** *Submitted for verification at BscScan.com on 2021-10-07 */ // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current exec...
Function for set the Development Address
function setDevelopmentAddress(address payable _developmentAddress) public onlyOwner { developmentAddress=_developmentAddress; }
6,303,562
pragma solidity ^0.5.16; import "./ComptrollerInterface.sol"; import "./CTokenInterfaces.sol"; import "./ErrorReporter.sol"; import "./Exponential.sol"; import "./EIP20Interface.sol"; import "./EIP20NonStandardInterface.sol"; import "./InterestRateModel.sol"; /** * @title Compound's CToken Contract * @notice Abstra...
Set the given borrow caps for the given cToken markets. Borrowing that brings total borrows to or above borrow cap will revert. Admin or borrowCapGuardian function to set the borrow caps. A borrow cap of 0 corresponds to unlimited borrowing. If the total supplies already exceeded the cap, it will prevent anyone t...
function _setMarketBorrowCaps(CToken[] calldata cTokens, uint256[] calldata newBorrowCaps) external { require(msg.sender == admin || msg.sender == borrowCapGuardian, "admin or borrow cap guardian only"); uint256 numMarkets = cTokens.length; uint256 numBorrowCaps = newBorrowCaps.length; ...
351,117
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /** * (c) Fundum Capital https://fundum.capital/ */ /** * @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 retur...
Transfers received ERC20 tokens to owner wallet/
function transferTokens(address erc20TokenAddress, uint256 amount) public onlyOwner returns (bool) { return IERC20(erc20TokenAddress).transfer(owner(), amount); }
10,124,650
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* * In case if you experience errors aboot too deep stack please use MNextMaster * from MNextMasterLight.sol. * * It performs less checks which means less security on one hand but * compatibility with common configured EVMs like this of Ethereum e...
Set reserve ratio ----------------- Set the value of the system's reserve ratio string calldata sentence A sentence to protect master access. int32 newReserveRatio_ The new reserve ratio value. @note Since solidity doesn't handle fractions, to set the percentage value you have to multiply the orig...
function setReserveRatio(string calldata sentence, int32 newReserveRatio_) onlyAdmin(sentence) external { _reserveRatio = newReserveRatio_; this.review(); }
2,507,064
/** *Submitted for verification at Etherscan.io on 2022-04-21 */ // SPDX-License-Identifier: MIT // File: alloyx-smart-contracts-v2/contracts/goldfinch/interfaces/ICreditLine.sol pragma solidity ^0.8.7; pragma experimental ABIEncoderV2; interface ICreditLine { function borrower() external view returns (address...
Claim certain amount of alloy CRWN tokens of the message sender, the method will mint the CRWN token of the claimable amount to message sender, and clear the past rewards to the remainder _amount the amount to claim/
function claimAlloyxCRWN(uint256 _amount) external whenNotPaused whenVaultStarted returns (bool) { uint256 allReward = claimableCRWNToken(msg.sender); require(allReward >= _amount, "User has claimed more than he's entitled"); alloyxTokenCRWN.mint(msg.sender, _amount); resetStakeTimestampWithRewardLeft...
10,762,067
./full_match/1/0x26Ee982dEE36Df3FA0D0db37798F8d0bD4c305Ed/sources/contracts/RatKingSociety.sol
Function required to override by DefaultOperatorFilterer/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public override(ERC721, IERC721) onlyAllowedOperator(from) { super.safeTransferFrom(from, to, tokenId, data); }
4,929,611
pragma solidity ^0.5.3; /// @title DaiDaddy: secondary market to let people sell CDP's with outstanding debt /// @author Chris Maree import "./SaiTubInterface.sol"; import "./MedianizerInterface.sol"; contract DebtMarket { enum Status {LISTED, BOUGHT, CANCLED} struct Debt { bytes32 cupId; ad...
transfer sell order and change status
function cancelCDPSale(uint256 _debtId) public { require( debtBook[_debtId].seller == msg.sender, "Not your CDP sale to cancel" ); require( debtBook[_debtId].status == Status.LISTED, "Wrong sell order status" ); bytes32 _cupId =...
12,985,732
pragma solidity ^0.4.21; /** * @title Description: This code is for creating a token contract * This contract is mintable, pausable, burnable, administered, admin-transferrable and * has safety Maths and security operations checks done and yet have been kept short and simple * It has got 3 contracts * 1. ...
function approve gives an address power to spend specified amount/
function approve(address _spender, uint256 _value) public whenNotPaused returns (bool success) { return true; }
6,452,581
./full_match/1/0x57852e8e787ff5af7c0E1d0b156ec491eC78Ec92/sources/ShibAnon.sol
uint256 DeveloperShare = _buyDeveloperFee.add(_sellDeveloperFee);
function swapAndLiquify(uint256 tAmount) private lockTheSwap { uint256 totalShares = _totalTaxIfBuying.add(_totalTaxIfSelling); uint256 liquidityShare = _buyLiquidityFee.add(_sellLiquidityFee); uint256 MarketingShare = _buyMarketingFee.add(_sellMarketingFee); uint256 token...
3,029,980
./full_match/137/0xCF77e2E32EDDc54d29cF8BF106024b1012bFbcCC/sources/home/hellwolf/Projects/superfluid/protocol-monorepo/packages/ethereum-contracts/contracts/utils/CallUtils.sol
It the data encoded correctly with abi.encode(bytesData) Expected ABI Encode Layout: | word 1 | word 2 | word 3 | the rest... | data length | bytesData offset | bytesData length | bytesData + padLength32 zeros |/ bytes offset is always expected to be 32 the data length should be bytesData.lengt...
function isValidAbiEncodedBytes(bytes memory data) internal pure returns (bool) { if (data.length < 64) return false; uint bytesOffset; uint bytesLen; if (bytesOffset != 32) return false; return data.length == 64 + padLength32(bytesLen); }
4,754,775
pragma solidity 0.4.24; import "zeppelin-solidity/contracts/math/SafeMath.sol"; import "zeppelin-solidity/contracts/ownership/Ownable.sol"; import "zeppelin-solidity/contracts/token/ERC20/ERC20.sol"; import 'zeppelin-solidity/contracts/lifecycle/Destructible.sol'; import "./SwapController.sol"; contract SwapContrac...
get the completed status of the transfer request idx the index of the transfer request return bool the status of the completed transfer request/
function getTransferRequestCompleted( uint idx ) onlyTokenOwner public view returns (bool) { return _requests[idx].completed; }
14,070,651
// SPDX-License-Identifier: Apache-2.0 pragma solidity >=0.6.4 <0.8.0; pragma experimental ABIEncoderV2; //import "https://github.com/vigilance91/solidarity/ERC/introspection/ERC165/eventsERC165.sol"; /// /// @title Mixin for the ERC-165 Interface Library /// @author Tyler R. Drury <vigilstudios.td@gmail.com> (www.tw...
return storageERC165().supportedInterfaces[interfaceId];
function supportsInterface( bytes4 interfaceId )internal view returns( bool ){ return supportedInterfaces()[interfaceId]; }
1,804,906
./full_match/11155111/0xbE3d97A00b4bE98A626a5c6DEc64f74F5F28da1f/sources/contracts/honeycast.sol
See {IERC721-getApproved}./
function getApproved(uint256 tokenId) public view virtual override returns (address) { _requireMinted(tokenId); return _tokenApprovals[tokenId]; }
3,815,513
./partial_match/1/0x968348C6135C25e7160AD0671C8C9CA2eD2bb982/sources/contracts/eclp/GyroECLPMath.sol
calculate At \cdot A chi, ignores rounding direction. We will later compensate for the rounding error. to save gas, pre-compute dSq^2 as it will be used 3 times (cx - sy) (w/lambda + z) / lambda account for 2 factors of dSq (4 s,c factors) (x lambda s + y lambda c) u, note u > 0 (sx+cy) v, note v > 0
function calcAtAChi( int256 x, int256 y, Params memory p, DerivedParams memory d ) internal pure returns (int256 val) { int256 dSq2 = d.dSq.mulXpU(d.dSq); int256 termXp = (d.w.divDownMagU(p.lambda) + d.z).divDownMagU(p.lambda).divXpU(dSq2); val = (x.mulDo...
15,967,265
pragma solidity ^0.5.0; import "./SupplyChain.sol"; /** @title Mortal. Here I have inhereted the modifiers ***from the SupplyChain contract */ contract Mortal is SupplyChain { /**@dev enables the creator of the contract to desctroy it */ function destroy() public isOwner { selfdestruct(owner); } ...
enables the creator of the contract to desctroy it /
function destroy() public isOwner { selfdestruct(owner); }
6,382,665
./partial_match/1/0xa22cf004eD5105608b39c48bE688BD9B9026a046/sources/FeePool.sol
Claim fees for last period when available or not already withdrawn. currencyKey Synth currency you wish to receive the fees in./
function claimFees(bytes4 currencyKey) external optionalProxy returns (bool) { return _claimFees(messageSender, currencyKey); }
4,057,445
pragma solidity 0.4.26; import "./ISovrynSwapNetwork.sol"; import "./IConversionPathFinder.sol"; import "./converter/interfaces/IConverter.sol"; import "./converter/interfaces/IConverterAnchor.sol"; import "./converter/interfaces/ISovrynSwapFormula.sol"; import "./utility/ContractRegistryClient.sol"; import "./utility/...
deprecated, backward compatibility/
function convert2( IERC20Token[] _path, uint256 _amount, uint256 _minReturn, address _affiliateAccount, uint256 _affiliateFee ) public payable returns (uint256) { return convertByPath(_path, _amount, _minReturn, address(0), _affiliateAccount, _affiliateFee); }
12,943,220
./full_match/5/0x201e479D966a08f2B0E9c886c9cb9E3e5c1d0A65/sources/contracts/DAOToken.sol
Returns whether owner can be set in the given execution context.
function _canSetOwner() internal view override returns (bool) { return msg.sender == owner(); }
1,898,442
// SPDX-License-Identifier: Apache-2.0 pragma solidity >=0.6.4 <0.8.0; pragma experimental ABIEncoderV2; //import "https://github.com/vigilance91/solidarity/contracts/token/TokenSupply/iEncoderTokenSupply.sol"; import "https://github.com/vigilance91/solidarity/contracts/token/TokenIdentifier/encoder/iEncoderTokenIden...
iEncoderTokenSupplyread-only interfacecurrent circulating supply(licnese which have been issued)function circulatingSupply()external pure returns(bytes memory);totalSupply - issuedfunction remainingSupply()public view returns(uint256);does client currently hold a valid licenseamount of seconds from now client has until...
{ function hasValidLicense( address client )external pure returns( bytes memory ); function hasAuthority( address client )external pure returns( bytes memory ); function grantAuthority( address account )external pure returns( byte...
14,077,773
./full_match/11155111/0x8Ba8302A07D050F34cCCBC8c8F9ff43595206576/sources/contracts/TournamentFactory.sol
This function retrieves the address of a Tournament contract
function getTournament(uint index) public view returns (address) { require(index < tournaments.length, "Tournament index out of bounds"); return tournaments[index]; }
3,798,501
./full_match/8453/0x5F8d42635A2fa74D03b5F91c825dE6F44c443dA5/sources/contracts/lendingpool/StakingRewards.sol
Withdraw `amount` of staked assets amount The amount of assets to withdraw to The address that will receive the staked assets, same as msg.sender if the user wants to receive them on his own wallet./
function withdraw( uint amount, address to ) external nonReentrant updateReward(msg.sender) { require(amount > 0, "amount = 0"); balanceOf[msg.sender] -= amount; totalStaked -= amount; require(stakedToken.transfer(to, amount), "transfer failed"); emit W...
11,555,253
./full_match/1/0xda3Bb6122BDC762Fb83D37AD2b09e7F2Cf6612f5/sources/src/Originals.sol
Used to burn token(s) of a release for a one account./
function burn( uint256 __tokenID ) public override onlyExistingToken(__tokenID) { super.burn(__tokenID); Token memory token = _tokens[__tokenID]; _releases[token.releaseID].tokenIDs[token.index] = 0; _releases[token.releaseID].totalSupply -= 1; }
4,843,991
pragma solidity ^0.4.19; contract SupportedContract { // Members can call any contract that exposes a `theCyberMessage` method. function theCyberMessage(string) public; } contract ERC20 { // We want to be able to recover & donate any tokens sent to the contract. function balanceOf(address _who) public view ...
In the constructor function, set up the contract creator as the first member so that other new members can be added. Log the addition of the first member (contract creator). Set up the member: status, name, key, member since & inactive since. Set up the address associated with the member. Point the address to member's ...
function theCyber() public { NewMember(0, "", msg.sender); members_[0] = Member(true, bytes32(""), "", uint64(now), 0); memberToAddress_[0] = msg.sender; addressToMember_[msg.sender] = 0; addressIsMember_[msg.sender] = true; }
5,480,626
./partial_match/1/0xa52c0Bb1b802e9d6A483072d56fd22B58B964455/sources/contracts/mixins/shared/FoundationTreasuryNode.sol
Gets the Foundation treasury contract. This call is used in the royalty registry contract. return treasuryAddress The address of the Foundation treasury contract./
function getFoundationTreasury() public view returns (address payable treasuryAddress) { treasuryAddress = treasury; }
2,625,146
pragma solidity 0.7.5; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; /** * @dev YzerChain token of ERC20 standard. * * name : YzerChain * symbol : YZR * decimal : 18 * initial supply : 10,000,000 YZR */ contract YzerChain i...
Burn `amount` token. Only minter can burn./
function burn(uint amount) external { require(minters[msg.sender], "not minter"); _burn(address(this), amount); }
1,356,055
./partial_match/1/0x6893491CeCF9309e445fE10f49CEd15CBb08652F/sources/Migration_Schedar.sol
trips the breaker and returns boolean, where true means the breaker has tripped state
function _verifyCircuitBreakers() internal returns (bool) { address debtRatioAggregator = requireAndGetAddress(CONTRACT_EXT_AGGREGATOR_DEBT_RATIO); (, int256 rawRatio, , , ) = AggregatorV2V3Interface(debtRatioAggregator).latestRoundData(); (, bool broken, ) = exchangeRates().rateWithSafetyCh...
4,485,300
./partial_match/1/0x95F6FC8511675a30BEA4Eda1a797FEb0ac619468/sources/PendulumArt.sol
Private function to add a token to this extension's ownership-tracking data structures. to address representing the new owner of the given token ID tokenId uint256 ID of the token to be added to the tokens list of the given address/
function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; }
3,919,973
./partial_match/1/0x7d000609a3c0C6Ba13DD318E56934CB5523Ba431/sources/SolomonSale.sol
Exchange the value of ETH sent in the transaction for ERC20 tokens
function exchange() public payable { require(!_paused, "Sale is paused"); require(msg.value >= _minimum, "Value less than minimum"); uint256 contributed = _contributions[msg.sender] + msg.value; require((_maximum == 0) || (contributed <= _maximum), "Contribution limit exceeded"); ...
4,344,252
/** *Submitted for verification at Etherscan.io on 2020-08-23 */ // File: contracts/spec_interfaces/IContractRegistry.sol pragma solidity 0.5.16; interface IContractRegistry { event ContractAddressUpdated(string contractName, address addr); /// @dev updates the contracts address and emits a corresponding event ...
Leaves the contract without migrationOwner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current migrationOwner. NOTE: Renouncing migrationOwnership will leave the contract without an migrationOwner, thereby removing any functionality that is only available to the migrationOw...
function renounceMigrationOwnership() public onlyMigrationOwner { emit MigrationOwnershipTransferred(_migrationOwner, address(0)); _migrationOwner = address(0); }
947,802
./full_match/80001/0x6c24eaa45a3502807523BAD0A9f5389cBFe83927/sources/contracts/SonicaERC721Drop.sol
Valid who can change the Lazy Mint.
function _canLazyMint() internal view virtual override returns (bool) { return hasRole(DEFAULT_ADMIN_ROLE, msg.sender); }
843,093
pragma solidity ^0.5.0; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "openzeppelin-solidity/contracts/math/Math.sol"; import "./ICryptoArcadeGame.sol"; import "./RewardSplitter.sol"; /** * @title CryptoArcadeGame * @dev This contract represents the logic and data for each game on the plat...
This methods deactivates the game, disabling most of its functionality. The game can be deactivated without being destroyed, in case an issue is detected. The method can only be invoked by the owner contract. return The match ID of the match bought/
function deactivateGame() external onlyOwner() { active = false; }
1,001,464
./partial_match/1/0x1E7407b5f0c3ec55cFEEb0B19Dfb006e32F8EBB0/sources/TOW3.sol
Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. The call is not executed if the target address is not a contract. from address representing the previous owner of the given token ID to target address that will receive the tokens tokenId uint256 ID of the token to be transferred da...
function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(msg.sender, from, tokenId, data) returns (bytes4 retval) { ...
2,838,420
./full_match/80001/0x8B89359a48C153994d2A6BF878b148f151d2A0c4/sources/contracts/market/MarketMatching.sol
match offers with taker offer, and execute token transactions Init offer history There is at least one offer stored for token pair If "buy" is executed within the while loop, the sender becomes taker This can happen with both market and limit order best[address][address] gets the best maker ID Ugly hack to work around ...
function _matcho( uint8 offerType ) internal returns (uint256 id) { uint256 tPayAmtInit = tPayAmt; OfferInfoHistory memory infoHistory; infoHistory.payAmt = tPayAmt; infoHistory.payGem = tPayGem; infoHistory.buyAmt = tBuyAmt; infoHistory.buyGem = tBuyGem;...
9,473,676
/* file: ERC20.sol ver: 0.4.4-o0ragman0o updated:26-July-2017 author: Darryl Morris email: o0ragman0o AT gmail.com An ERC20 compliant token with reentry protection and safe math. This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCH...
Using an explicit getter allows for function overloading
function allowance(address _owner, address _spender) public constant returns (uint remaining_) { return allowed[_owner][_spender]; }
6,472,261
pragma solidity ^0.4.24; import "./Asset.sol"; import "./Events.sol"; contract StakeInterface { function calculateStakeTokens(uint _itemCost) public returns (uint _stakeToken); } contract TokenInterface { function transferFrom(address _from, address _to, uint _value) public returns (bool); function balan...
Getter function. returns asset contract address given asset UUID
function getAddressById(bytes12 _listingId) public view returns (address) { return addressByassetId[_listingId]; }
2,565,410
./full_match/56/0xD803719B1a6Aac1dcB2c815d987f0CB5E8f4cCAf/sources/happy.sol
disable limits (can't be enabled again)
function disableLimits() external onlyAdmin { require(vars.limitsEnabled); vars.limitsEnabled = false; emit LimitsDisabled(); }
3,238,596
pragma solidity 0.4.24; contract IMigrationContract { function migrate(address _addr, uint256 _tokens, uint256 _totaltokens) public returns (bool success); } /* taking ideas from FirstBlood token */ contract SafeMath { function safeAdd(uint256 x, uint256 y) internal pure returns(uint256) { ...
ShowSegmentation() looking for the user balances Segmentation
function ShowSegmentation(address _addr, uint256 _times,uint256 _period) public view returns (uint256) { return userbalancesSegmentation[_addr][_times][_period]; }
5,466,068
./partial_match/1/0x8E3a532F2212D71074fD27BcF570c878D14458Fb/sources/contracts/HYFI_Lottery.sol
add new reward information rewardManager the address of reward manager responsible for rewards revealing logic totalAmount the total available amount of such type of rewards/
function addReward( address rewardManager, uint256 totalAmount ) external onlyRole(DEFAULT_ADMIN_ROLE) { RewardsData memory reward; reward.rewardManager = IHYFI_RewardsManager(rewardManager); reward.totalAmount = totalAmount; reward.freeAmount = totalAmount; ...
2,694,166
pragma solidity 0.4.24; /* script to setup contracts after full redeploy on Rinkeby. called via StabilityBoardProxy (MultiSig) but deployer account is the only signer yet because these working on the new contracts only. Stability Board and pretoken signers will be added and deployer will be remove...
returns CHUNK_SIZE loan products starting from some offset: [ productId, minDisbursedAmount, term, discountRate, collateralRatio, defaultingFeePt, maxLoanAmount, isActive ]
function getProducts(uint offset) external view returns (uint[8][CHUNK_SIZE] response) { for (uint16 i = 0; i < CHUNK_SIZE; i++) { LoanProduct storage product = products[offset + i]; response[i] = [offset + i, product.minDisbursedAmount, product.term, product.discountRate, ...
7,655,389
// Copyright (C) 2021 Argent Labs Ltd. <https://argent.xyz> // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // Th...
not needed but detects failure early UniZap method: check that pair is valid and recipient is the wallet
function isValid(address _wallet, address _spender, address _to, bytes calldata _data) external view override returns (bool valid) { if (_data.length < 4) { return false; } bytes4 method = getMethod(_data); if (_spender == _to) { if (method == ADD_LIQUIDITY_WI...
10,058,156
pragma solidity ^0.5.2; import "../node_modules/solidity-bytes-utils/contracts/BytesUtils.sol"; library NodePtr { // Unpack first byte index function ixs(uint self) internal pure returns (uint) { return uint80(self); } // Unpack first content byte index function ixf(uint self) internal pure returns (ui...
Extract entire node from DER-encoded structure der The DER-encoded ASN1 structure ptr Points to the indices of the current node return All bytes of node/
function allBytesAt(bytes memory der, uint ptr) internal pure returns (bytes memory) { return der.substring(ptr.ixs(), ptr.ixl()+1 - ptr.ixs()); }
1,805,041
// SPDX-License-Identifier: AGPL-3.0 // MgvOfferTaking.sol // Copyright (C) 2021 Giry SAS. // // 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 // (...
Internal snipes /+clear+ `internalSnipes` works by looping over targets. Each successive offer is executed under a [reentrancy lock](internalSnipes/liftReentrancy), then its posthook is called. Going upward, each offer's `maker` contract is called again with its remaining gas and given the chance to update its offers o...
function internalSnipes( MultiOrder memory mor, ML.SingleOrder memory sor, uint[4][] calldata targets ) internal returns (uint successCount, uint snipesGot, uint snipesGave) { unchecked { for (uint i = 0; i < targets.length; i++) { mor.totalGot = 0; mor.totalGave = 0; sor.offerId ...
12,895,739
// Sources flattened with hardhat v2.0.5 https://hardhat.org // File deps/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * ...
===== Internal Core Implementations =====
function _onlyNotProtectedTokens(address _asset) internal override { require(!isProtectedToken(_asset)); }
1,496,419
./full_match/42220/0x02c79D1d360732e23Cf135996E91E10fC0C5e23e/sources/contracts/community/CommunityImplementation.sol
Checks a manager signature _expirationTimestamp timestamp when the signature will expire/expired _signature the signature of a manager/
function _checkManagerSignature(uint256 _expirationTimestamp, bytes calldata _signature) internal { require( msg.sender == communityAdmin.authorizedWalletAddress(), "Community: Sender must be the backend wallet" ); require(_expirationTimestamp >= block.tim...
16,323,886
./partial_match/42/0x6076eCda565f5325642AaEe0e9f7A4B916d2dFf1/sources/FeePool.sol
Send the rewards to claiming address - will be locked in rewardEscrow. account The address to send the fees to. snxAmount The amount of PERI./ Record vesting entry for claiming address and amount PERI already minted to rewardEscrow balance
function _payRewards(address account, uint snxAmount) internal notFeeAddress(account) { uint escrowDuration = 52 weeks; uint periAmount; uint usdcAmount; FeePoolState _feePoolState = feePoolState(); (periAmount, usdcAmount) = _feePoolState.getAccountsKindsEntry(account, 0);...
9,020,154
pragma solidity ^0.6.0; // SPDX-License-Identifier: UNLICENSED /** * @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, ...
------------------------------------------------------------------------ Transfer the balance from token owner's account to `to` account - Owner's account must have sufficient balance to transfer - 0 value transfers are allowed ------------------------------------------------------------------------ prevent transfer to...
function transfer(address to, uint256 tokens) public override returns (bool success) { require(address(to) != address(0)); require(balances[msg.sender] >= tokens ); require(balances[to] + tokens >= balances[to]); balances[msg.sender] = balances[msg.sender].sub(tokens); ...
1,544,955
// SPDX-License-Identifier: MIT // Reference: copied from https://github.com/sushiswap/sushiswap/blob/canary/contracts/MasterChefV2.sol // Reference: https://github.com/sushiswap/sushiswap/blob/canary/contracts/MiniChefV2.sol pragma solidity >=0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openz...
Harvest proceeds for transaction sender to `to`. pid The index of the pool. See `poolInfo`. to Receiver of Token rewards. Effects Interactions
function harvest(uint256 pid, address to) public { PoolInfo memory pool = updatePool(pid); UserInfo storage user = userInfo[pid][msg.sender]; int256 accumulatedRewards = int256(user.amount.mul(pool.accRewardPerShare) / ACC_PRECISION); uint256 _pendingRewards = accumulatedRewards.sub(...
12,236,036
./full_match/1/0x3FE29e090394c7EF1E3d2E1637E50d9FAaEB9649/sources/contracts/NonTransferrableNFT.sol
This internal function, called by redeemNFT to physically burn the NFT and redeem their Future position which distributes the locked tokens to its owner this function does five things: 1) Checks to ensure only the owner of the NFT can call this function 2) it checks that the tokens can actually be unlocked based on t...
function _redeemNFT(address _holder, uint256 _id) internal { require(ownerOf(_id) == _holder, 'NFT03'); Future memory future = futures[_id]; require(future.unlockDate < block.timestamp && future.amount > 0, 'NFT04'); emit NFTRedeemed(_id, _holder, future.amount, future.token, future.unlockDate); _...
8,365,350
pragma solidity 0.5.17; contract IFactRegistry { /* Returns true if the given fact was previously registered in the contract. */ function isValid(bytes32 fact) external view returns(bool); } contract IMerkleVerifier { uint256 constant internal MAX_N_MERKLE_VERIFIER_QUERIE...
Note that the prover does the VDF computation the other way around (uses the inverse function), hence vdf_output is the input for its calculation, and vdf_input should be the result of the calculation. Initialize the MDS matrix values with fixed predefined values.
function airSpecificInit(uint256[] memory publicInput) internal returns (uint256[] memory ctx, uint256 logTraceLength) { require(publicInput.length == PUBLIC_INPUT_SIZE, "INVALID_PUBLIC_INPUT_LENGTH" ); ctx = new uint256[](MM_CONTEXT_SIZE); ctx[MM_...
7,338,300
pragma solidity ^0.6.10; pragma experimental ABIEncoderV2; import "./OpenOraclePriceData.sol"; import "./Verifier.sol"; import "./Uniswap/UniswapLib.sol"; struct Observation { uint timestamp; uint acc; } contract OracleView { using FixedPoint for *; /// @notice The Open Oracle Price Data contract ...
Use priceData.getCSRange() directly source The verifiable author of the data key The selector for the value to return (symbol in case of uniswap) return Price range denominated in USD, with 6 decimals/
function price(address source, string calldata key) external view returns (uint64, uint64) { uint64 min; uint64 max; (min, max) = priceData.getCSRange(source, key); return (min, max); }
12,810,455
./partial_match/1/0xc6e97C87A3782328c76cE788f24469D09d88669a/sources/ExchangerV3.sol
/Now do the trade if conditions are metAccounting - so we can pull the fees out without changing the balance
function buy(uint minPurchaseReturn) public payable { uint amount = formulaContract.calculatePurchaseReturn( (tokenContract.totalSupply() - uncirculatedSupplyCount) - tokenContract.balanceOf(this), (address(this).balance + virtualReserveBalance) - msg.value, weight, ...
9,351,057
// SPDX-License-Identifier: MIT pragma solidity >= 0.8.7 < 0.9.0; //import "../utils/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.sender and msg.data, they should not be acces...
-------------------------------------------------------- [external] トークンをステークしているアドレスの確認--------------------------------------------------------
function checkStakeHolder( uint256 tokenId ) external view returns (address) { require( _exists(tokenId), "nonexistent token" ); return( _token_to_stake_holder[tokenId] ); }
13,522,707
./full_match/3/0x25a5F12a707Bc30b2081f750976E489b62F567aE/sources/localhost/deployments/Option.full.sol
Initialize, called once
function getOptionDetails() external view returns ( string memory _name, address _baseToken, address _targetToken, address _optionToken, address _proofToken, uint256 _baseAmount, uint256 _targetAmout, uint256 _totalSupply, uint64 _expira...
8,097,074
./partial_match/1/0x1C2AC88532f54A046f842B0651f0C2F6A80E729D/sources/contracts/Staking/IStakingV2Factory.sol
Token Staking BEP20 compatible token./
interface IStakingV2Factory { function createVendor(address _parent, IERC20 _token) external returns (address); }
3,695,320
/** *Submitted for verification at Etherscan.io on 2022-01-14 */ // File: interfaces/IExchangeAgent.sol pragma solidity ^0.8.0; interface IExchangeAgent { function getNeededTokenAmount( address _token0, address _token1, uint256 _desiredAmount ) external returns (uint256); func...
If users use CVR, they will pay _discountPercentage % of cost./
function setDiscountPercentage(uint256 _discountPercentage) external onlyOwner { require(_discountPercentage <= 100, "Exceeded value"); discountPercentage = _discountPercentage; }
1,985,969
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; pragma experimental ABIEncoderV2; /* ___ _ _ | _ )_ _ _ _ _ _ _ _ | | | | | _ \ || | ' \| ' \ || | |_| |_| |___/\_,_|_||_|_||_\_, | (_) (_) |__/ * * MIT License * =========== * * Copyright (c) 2020 BunnyFinanc...
stakingToken must not remain balance in this contract. So dev should salvage staking token transferred by mistake.
function recoverToken(address token, uint amount) external override onlyOwner { if (token == address(CAKE)) { uint cakeBalance = CAKE.balanceOf(address(this)); require(amount <= cakeBalance.sub(cakeHarvested), "VaultFlipToFlip: cannot recover lp's harvested cake"); } ...
6,473,523
pragma solidity ^0.6.9; // SPDX-License-Identifier: GPL-3.0-or-later import "./SafeMath.sol"; import "../../interfaces/IERC20.sol"; // ---------------------------------------------------------------------------- // DutchSwap Auction Contract // // // MVP prototype. DO NOT USE! // // (c) Adria...
Users must approve contract prior to committing tokens to auction
function commitTokensFrom (address _from, uint256 _amount) public { require(address(paymentCurrency) != ETH_ADDRESS); uint256 tokensToTransfer = calculateCommitment( _amount); if (tokensToTransfer > 0) { require(IERC20(paymentCurrency).transferFrom(_from, address(this), _amount))...
12,812,464
./full_match/1/0xDf7D56E526eD37834be0e4D2C8aecE552f54cFea/sources/contracts/BaseSmartVaultDeployer.sol
Create and setup action Set holder token out Set holder max slippage Transfer admin permissions to admin Authorize action to wrap and swap from Smart Vault
function _setupHolderAction(SmartVault smartVault, HolderActionParams memory params) internal { Holder holder = Holder(params.impl); Deployer.setupBaseAction(holder, params.admin, address(smartVault)); address[] memory executors = Arrays.from(params.admin, params.managers, new address[](0));...
17,182,576