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/1/0x3C6Cf487E97c655E264780444b4eC0e2E45D24BB/sources/eigenlayer/interfaces/IStrategy.sol
Minimal interface for an `Strategy` contract. Layr Labs, Inc. Custom `Strategy` implementations may expand extensively on this interface./
interface IStrategy { function deposit(IERC20 token, uint256 amount) external returns (uint256); function withdraw(address depositor, IERC20 token, uint256 amountShares) external; function sharesToUnderlying(uint256 amountShares) external returns (uint256); function underlyingToShares(uint256 amountU...
2,982,149
pragma solidity ^0.4.24; contract Owned { /// 'owner' is the only address that can call a function with /// this modifier address public owner; address internal newOwner; ///@notice The constructor assigns the message sender to be 'owner' constructor() public { owner = msg.se...
Calculate USE value Check Whether msg.sender Have Enough CUSE
function calcUSE(uint _cuse, uint _ether, uint _exercisePrice) internal pure returns (uint _use, uint _refoundETH) { uint _amount = _ether / _exercisePrice; require (_amount > 0); require (safeMul(_amount, _exercisePrice) <= _ether); if (safeMul(_amount, 10**18) <= _cuse) { ...
6,992,363
./full_match/1/0x12165d21BE89AE08E16B1a23be8DF41349169D4B/sources/contracts/templates/NFTCollection.sol
Internal function without any checks for performing the ownership transfer
function _transferOwnership(address newOwner) internal { address previousOwner = _deploymentConfig.owner; _revokeRole(ADMIN_ROLE, previousOwner); _revokeRole(DEFAULT_ADMIN_ROLE, previousOwner); _deploymentConfig.owner = newOwner; _grantRole(ADMIN_ROLE, newOwner); _gr...
3,087,751
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; import '@openzeppelin/contracts/access/Ownable.sol'; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import '@openzeppelin/contracts/utils/En...
Set premia bonding curve contract _premiaBondingCurve PremiaBondingCurve contract
function setPremiaBondingCurve(PremiaBondingCurve _premiaBondingCurve) external onlyOwner { premiaBondingCurve = _premiaBondingCurve; }
6,369,121
// SPDX-License-Identifier: MIT // 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 distributed in ...
takes a raw amount of nzds and transfers it out, returns numeraire value of the raw amount
function outputRaw(address _dst, uint256 _amount) external override returns (int128 amount_) { uint256 _rate = getRate(); uint256 _nzdsAmount = (_amount * _rate) / 1e8; bool _transferSuccess = nzds.transfer(_dst, _nzdsAmount); require(_transferSuccess, "Curve/nzds-transfer-failed"...
12,659,187
// 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...
calculations pulled directly from CVX's contract for minting CVX per CRV claimed mint if below total cliffs for reduction% take inverse of current cliff reduce supply cap check
function _claimableBasicInETH() internal view returns (uint256) { uint256 _crv = Rewards(rewardContract).earned(address(this)); uint256 totalCliffs = 1000; uint256 supply = IERC20(cvx).totalSupply(); uint256 _cvx; uint256 cliff = supply.div(reductionPerCliff); if (c...
128,393
// File: contracts/interfaces/SIInterface.sol interface SIInterface { function setCircuitBreakWithOwner(bool emergency) external returns (bool); function setCircuitBreaker(bool emergency) external returns (bool); function updateRewardPerBlockLogic(uint256 _rewardPerBlock) external returns (bool); function update...
Calculates the reward lane distance (for delta blocks) based on the given parameters. _delta The blockNumber difference _rewardPerBlock The amount of reward per block _total The total amount of betaRate return The reward lane distance/
function _calcRewardLaneDistance(uint256 _delta, uint256 _rewardPerBlock, uint256 _total) internal pure returns (uint256) { return mul(_delta, unifiedDiv(_rewardPerBlock, _total)); }
5,937,300
./partial_match/1/0x6894DD96d242bA513AD99836B7778dBF43b82F3f/sources/AnyswapV6ERC20.sol
Interface of the ERC20 standard as defined in the EIP./
interface IERC20 { function totalSupply() external view returns (uint256); function decimals() external view returns (uint8); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); functio...
4,127,197
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "../storage/SettingsNamespace.sol"; import "../mixins/OwnerMixin.sol"; contract SettingsModule is SettingsNamespace, OwnerMixin { /* MUTATIVE FUNCTIONS */ function setASettingValue(uint newSettingValue) public onlyOwner { _settingsSt...
MUTATIVE FUNCTIONS /
function setASettingValue(uint newSettingValue) public onlyOwner { _settingsStorage().aSettingValue = newSettingValue; }
6,442,124
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.0; // ==================================================================== // | ______ _______ | // | / _____________ __ __ / ____(_____ ____ _____ ________ | // | / /_ / ___/ __ `| |/_/ / ...
Get the most recently recorded rate of voting power decrease for `addr` addr Address of the user wallet return Value of the slope/
function get_last_user_slope(address addr) external view returns (int128) { uint256 uepoch = user_point_epoch[addr]; return user_point_history[addr][uepoch].slope; }
1,062,028
pragma solidity 0.4.23; /* * Ownable * * Base contract with an owner. * Provides onlyOwner modifier, which prevents function from running if it is called by anyone other than the owner. */ contract Ownable { address public owner; constructor() public { owner = msg.sender; } modifier onlyOwner() { ...
Withdraw transfer to recipient&39;s address if it is correctly signed with private key for verification public key assigned to transfer. _transitAddress transit address assigned to transfer _recipient address Signed address. _v ECDSA signature parameter v. _r ECDSA signature parameters r. _s ECDSA signature parame...
function withdraw( address _transitAddress, address _recipient, uint8 _v, bytes32 _r, bytes32 _s ) public whenNotPaused whenNotStopped returns (bool success) { Transfer memory transferOrder = transferDct[_transitAddress]; require(verifySignature(_transitA...
7,852,568
pragma solidity ^0.4.11; // File: @laborx/solidity-shared-lib/contracts/ERC20Interface.sol /** * Copyright 2017–2018, LaborX PTY * Licensed under the AGPL Version 3 license. */ pragma solidity ^0.4.23; /// @title Defines an interface for EIP20 token smart contract contract ERC20Interface { even...
Supports ChronoBankPlatform ability to return error codes from methods Assigned platform, immutable. Assigned symbol, immutable. Assigned name, immutable. Assigned symbol (from ERC20 standard), immutable Sets platform address, assigns symbol and name. Can be set only once. _chronoBankPlatform platform contract ad...
function init(ChronoBankPlatform _chronoBankPlatform, string _symbol, string _name) public returns (bool) { if (address(chronoBankPlatform) != 0x0) { return false; } chronoBankPlatform = _chronoBankPlatform; symbol = _symbol; smbl = stringToBytes32(_symbol); ...
1,048,885
./full_match/42220/0x788C4B43B6E8a28858f2862D0A8af203C71B89af/sources/Users/alex/Desktop/repos/CRAD-DeFi/v2.0/poolRegistry/contracts/AbsNFT.sol
We cannot just use balanceOf to create the new tokenId because tokens can be burned (destroyed), so we need a separate counter.
function mint(address to, string memory tokenUri) public virtual { _mint(to, _tokenIds.current()); _setTokenURI(_tokenIds.current(),tokenUri); _tokenIds.increment(); }
16,320,760
/** *Submitted for verification at Etherscan.io on 2022-04-12 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.2; /* * ABDK Math 64.64 Smart Contract Library. Copyright © 2019 by ABDK Consulting. * Author: Mikhail Vladimirov <[email protected]> */ pragma solidity ^0.8.0; /** * Smart contract library of...
Retrieve the number of votes for `account` at the end of `blockNumber`. Requirements: - `blockNumber` must have been already mined/
function getPastVotes(address account, uint256 blockNumber) public view returns (uint256) { require(blockNumber < block.number, "ERC20_1155Votes: block not yet mined"); return _checkpointsLookup(_checkpoints[account], blockNumber); }
2,389,990
./partial_match/1/0x6A1d98DaE0963ab8898ba02b652D1647Bd758E47/sources/FRTPoolPHZT.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 getPriorVotesinPool(address account, uint blockNumber) public view returns (uint256) { require(blockNumber < block.number, "getPriorVotesinPool: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return 0; } if...
15,464,996
/** * The Edgeless blackjack contract only allows calls from the authorized casino proxy contracts. * The proxy contract only forward moves if called by an authorized wallet owned by the Edgeless casino, but the game * data has to be signed by the player to show his approval. This way, Edgeless can provide a flu...
recursively plays the player's hands. hIndex the hand index cIndex the index of the next card to draw sIndex the index of the next split, if there is any playerValues the values of the player's hands (not yet complete) cards holds the (partial) deck. ...
function playHand(uint8 hIndex, uint8 cIndex, uint8 sIndex, uint8[5] playerValues, uint8[] cards, uint8[] numCards, uint8[] pSplits) constant internal returns(uint8, uint8, uint8[5]) { playerValues[hIndex] = cardValues[cards[cIndex] % 13]; cIndex = cIndex < 4 ? cIndex + 2 : cIndex + 1; while (sIndex < pSp...
14,067,025
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Trees proofs. * * The proofs can be generated using the JavaScript library * https://github.com/miguelmota/merkletreejs[merkletreejs]. * Note: the hashing algorithm should be keccak256 and pair so...
See {IERC165-supportsInterface}./
function _beforeTokenTransfer( address from, address to, uint256 tokenId } pragma solidity ^0.8.7; function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super....
275,456
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". */ contract Ownable { address public owner; event OwnershipTransferred(address indexed p...
Returns true only if the gift exists and has not already been redeemed
function isValidGift(Gift gift) private pure returns (bool) { return gift.exists == true && gift.redeemed == false; }
14,099,822
/** *Submitted for verification at Etherscan.io on 2022-04-01 */ // File: contracts/IAwooClaiming.sol pragma solidity 0.8.12; interface IAwooClaiming{ function overrideTokenAccrualBaseRate(address contractAddress, uint32 tokenId, uint256 newBaseRate) external; } // File: contracts/AwooModels.sol pragma sol...
Claims all virtual AWOO accrued by the message sender, assuming the sender holds any supported contracts tokenIds Update the time that this token was last claimed Any amount from the unclaimed snapshot are now claimed because they were returned by getContractTokenAccruals so dump it
function claimAll(address holder) external nonReentrant { require(claimingActive, "Claiming is inactive"); require(_isAuthorizedContract(_msgSender()) || holder == _msgSender(), "Unauthorized claim attempt"); (AccrualDetails[] memory accruals, uint256 totalAccrued) = getTotalAccruals(holder...
10,771,958
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity >=0.8.0; contract WhiteListManager { event WhiteListAccount(address indexed operator, address indexed account, bool approved); event SetMerkleRoot(address operator, bytes32 merkleRoot); event JoinWithMerkle(address operator, uint256 index...
Set the new merkle root.
function setMerkleRoot(bytes32 _merkleRoot) external { merkleRoot[msg.sender] = _merkleRoot; emit SetMerkleRoot(msg.sender, _merkleRoot); }
908,140
/** *Mankind environment coin */ pragma solidity ^0.4.23; /** * @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, whic...
Gets the balance of the specified address. _owner The address to query the balance of. return An uint256 representing the amount owned by the passed address./
function balanceOf(address _owner) public view returns (uint256) { return _balances[_owner]; }
6,401,886
./partial_match/42/0xAc8b3F4E381Ae24467cBeCA803214360481f7812/sources/ArbitrableTokenList.sol
Returns the contribution value and remainder from available ETH and required amount. _available The amount of ETH available for the contribution. _requiredAmount The amount of ETH required for the contribution. return taken The amount of ETH taken. return remainder The amount of ETH left from the contribution./
function calculateContribution(uint _available, uint _requiredAmount) internal pure returns(uint taken, uint remainder) { if (_requiredAmount > _available) remainder = _available - _requiredAmount; return (_requiredAmount, remainder); }
8,958,689
./full_match/1/0x11a022822aDCC66111F9b2DAf5B2E892f90d95b4/sources/contracts/BasicDEX.sol
refund dust eth, if any
function swapETHForExactTokens(uint256 amountOut, address[] calldata path, address to, uint256 deadline) external virtual override payable ensure(deadline) onlyAllowedAssets(path) returns (uint256[] memory amounts) { require(path[0] == WETH, 'Unisw...
4,884,431
// SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.6.12; /** * @dev Define interface verifier */ interface VerifierRollupInterface { function verifyProof( uint256[2] calldata proofA, uint256[2][2] calldata proofB, uint256[2] calldata proofC, uint256[1] calldata input ) e...
Update WithdrawalDelay newWithdrawalDelay New WithdrawalDelay Events: `UpdateWithdrawalDelay`/
function updateWithdrawalDelay(uint64 newWithdrawalDelay) external onlyGovernance { require( newWithdrawalDelay <= _MAX_WITHDRAWAL_DELAY, "InstantWithdrawManager::updateWithdrawalDelay: EXCEED_MAX_WITHDRAWAL_DELAY" ); withdrawalDelay = newWithdrawa...
616,493
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.7.6; pragma abicoder v2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "./../lib/uniswap/UniswapV2Library.sol"; import "./../lib/un...
withdraw underlyingAmount_ from the liquidity provider, store resulting cToken balance in cTokenBalance underlyingFees += takeFees_; cTokenBalance is used to compute the pool yield, make sure no one interferes with the computations between deposits/withdrawls
function _withdrawProviderInternal(uint256 underlyingAmount_, uint256 takeFees_) internal { underlyingFees = underlyingFees.add(takeFees_); ICompoundCumulator(controller)._beforeCTokenBalanceChange(); uint256 err = ICToken(cToken).redeemUnderlying(underlyingAmount_); requi...
60,074
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "fungible_CDPToken.sol"; import "inheritingForTestPurpose.sol"; // Uniswap Pair Interface interface UniswapV2PairLike { function getReserves() external view returns ( uint112 reserve0, uint112 reserv...
Owner => First CDPId
function first(address) external returns(uint256);
7,218,912
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "./libraries/SafeERC20.sol"; import "../utils/Pausable.sol"; import "./libraries/Math.sol"; import "./AdminInterface.sol"; import "./AlphaToken.sol"; import "./DepositNFT.sol"; import "./WithdrawalNFT.sol"; /** * @title AlphaStrategy * @dev Implementati...
Validate users withdrawal requests
function finalizeWithdrawals(address[] memory _users) external whenNotPaused onlyManager { uint256 tokensToBurn = 0; uint256 _amountLP; uint256 _amountStable; uint256 _tokenIdWithdraw; calculateAcceptedWithdrawRequests(_users); for (uint256 i = 0; i < _users.l...
1,652,584
pragma solidity ^0.5.16; import "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol"; import "./Owned.sol"; import "./Pausable.sol"; import "./SafeDecimalMath.sol"; import "./interfaces/IFeePool.sol"; import "./interfaces/ISynth.sol"; import "./interfaces/IERC20.sol"; import "./interfaces/IDepot.sol"; import "....
Get the loan from storage Record loan as closed Decrement totalIssuedSynths Calculate and deduct interest(5%) and minting fee(50 bips) in ETH Burn all Synths issued for the loan Fee Distribution. Purchase sUSD with ETH from Depot Transfer the sUSD to distribute to SNX holders. Send remainder ETH to caller Tell the Dapp...
function _closeLoan(address account, uint256 loanID) private { synthLoanStruct memory synthLoan = _getLoanFromStorage(account, loanID); require(synthLoan.loanID > 0, "Loan does not exist"); require(synthLoan.timeClosed == 0, "Loan already closed"); require( synthsETH().b...
13,019,966
/** *Submitted for verification at Etherscan.io on 2022-02-02 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; // (c) by Mario, Santa Cruz - España. interface ERC721 { /** * @dev Emits when ownership of any NFT changes by any mechanism. This event emits when NFTs are * created (`from` == 0) and des...
mapping (uint256 => string) internal idToUri;
{ string internal nftName; string internal nftSymbol; uint256 public nftTokenIdLast = 0; address payable public owner; string public baseURI; mapping(address => bool) private whiteList; uint256 constant public MAX_SUPPLY = 10000; event newTokenMinted( uint newNFT ...
6,807,683
/** *Submitted for verification at Etherscan.io on 2022-01-06 */ // File: @openzeppelin/contracts/utils/Strings.sol // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; ...
this is to batch transfer multiple tokens - useful to batch deposit in the merge contract!
function transferFromBatch(address from, address to, uint256[] calldata tokenId) public { for (uint256 i = 0; i < tokenId.length ; i++){ transferFrom(from, to, tokenId[i]); } }
7,685,200
/** *Submitted for verification at Etherscan.io on 2020-11-08 */ interface PermittedAddressesInterface { function permittedAddresses(address _address) external view returns(bool); function addressesTypes(address _address) external view returns(string memory); function isMatchTypes(address _address, uint256 addr...
Define coin address dependse of fund type
function getERC20AddressByFundType(uint256 _fundType) private view returns(address coinAddress){ coinAddress = _fundType == uint256(FundType.USD) ? stableCoinAddress : COTCoinAddress; }
7,325,906
./full_match/5/0x94f107C0f8a9effb35332aEA8D11aa405439300d/sources/contracts/messagePassingBridge/LZHandlerUpgradeable.sol
override lzReceive for simpler trustedRemote handling lzReceive must be called by the endpoint for security if will still block the message pathway from (srcChainId, srcAddress). should not receive message from untrusted remote.
function lzReceive( uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload ) public virtual override { if (_msgSender() != address(lzEndpoint)) revert INVALID_ENDPOINT(_msgSender()); if ( _srcAddress.length != trustedRe...
7,039,585
/** *Submitted for verification at Etherscan.io on 2021-10-25 */ // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.6.12; pragma experimental ABIEncoderV2; // Global Enums and Structs struct StrategyParams { uint256 performanceFee; uint256 activation; uint256 debtRatio; uint256 rateLimit; u...
NOTE: want decimals need to be <= 18. otherwise this will break requiredDAI = desiredWantInDAI / COLLAT_RATIO_DAI desiredWantInDAI = (desiredWant / priceDAIWant) NOTE: decimals need adjustment (e.g. BTC: 8 / ETH: 18)
function getPriceDAIWant( address want, uint256 amountDesired, uint256 collatRatioDAI ) internal returns ( uint256 priceDAIWant, uint256 decimalsDifference, uint256 requiredDAI ) { if (want == DAI) { requ...
1,826,349
./full_match/4/0x293bB1415f6e9f6059641A0611366a798D514270/sources/AirnextToken.sol
Les administrateurs refusent le gros transfert
function refuseTransfer(address _sender, address _recipient) public returns(bool){ Latency storage thisBigTransfers = BigTransfers[_sender][_recipient]; require (thisBigTransfers._amount > 0, 'Ligne de tableau non valide'); require (msg.sender == addressAdminAirnext || msg.sender == addres...
794,021
pragma solidity 0.6.6; pragma experimental ABIEncoderV2; contract DSAuthEvents { event LogSetAuthority(address indexed authority); event LogSetOwner(address indexed owner); } contract DSAuth is DSAuthEvents { DSAuthority public authority; address public owner; constructor() public { ...
Get marketId from token address Calculate repay amount (_amount + (2 wei)) Approve transfer from
function _flashLoan(ExchangeData memory _data, uint _gasCost, bool _isRepay) internal { ISoloMargin solo = ISoloMargin(SOLO_MARGIN_ADDRESS); uint256 ethAmount = ERC20(WETH_ADDR).balanceOf(SOLO_MARGIN_ADDRESS); uint256 marketId = _getMarketIdFromTokenAddress(WETH_ADDR); u...
7,586,183
./partial_match/3/0x1A6C4E31732e747D2C84084dd28Af3B485646c06/sources/ethmax.sol
Invest Function. If no referrer, referrer = 0x0000000000000000000000000000000000000000 PL_Address.call{value: msg.value.mul(PL_SHARE).div(PERCENTS_DIVIDER)}; PL_Address.call.value(msg.value.mul(PL_SHARE).div(PERCENTS_DIVIDER));
function invest(address referrer) public payable { require(msg.value >= INVEST_MIN_AMOUNT); require(success, "Transfer failed."); User storage user = users[msg.sender]; if (user.referrer == address(0) && users[referrer].deposits.length > 0 && referrer != msg.sender) { user.referr...
5,110,693
./partial_match/1/0xc6CadA314389430d396C7b0C70c6281e99ca7fe8/sources/src/contracts/FraxlendPair.sol
The ```withdrawFees``` function withdraws fees accumulated _shares Number of fTokens to redeem _recipient Address to send the assets return _amountToTransfer Amount of assets sent to recipient Grab some data from state to save gas Take all available if 0 value passed We must calculate this before we subtract from _to...
function withdrawFees(uint128 _shares, address _recipient) external onlyOwner returns (uint256 _amountToTransfer) { if (_recipient == address(0)) revert InvalidReceiver(); VaultAccount memory _totalAsset = totalAsset; if (_shares == 0) _shares = uint128(balanceOf(address(this))); ...
2,823,028
// SPDX-License-Identifier: GPL-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; uint...
Flash loan DXDY amount desired is how much we are willing for position to change
function doDyDxFlashLoan(bool deficit, uint256 amountDesired) internal returns (uint256) { if(amountDesired == 0){ return 0; } uint256 amount = amountDesired; ISoloMargin solo = ISoloMargin(SOLO); if (amountInSolo < amount) { amount = amountInSolo; ...
1,254,670
./full_match/1/0x07B0226465A50300F91c8A7930f90aEcae3D6Ed4/sources/contracts/staking/Series.sol
Claim profit share and OGN rewards. return claimedETH - amount of ETH profit share claimed return claimedOGN - amount of OGN rewards claimed/
function claim() external override requireActiveSeason returns (uint256, uint256) { address userAddress = msg.sender; ISeason season = _acquireClaimingSeason(); (uint256 rewardETH, uint256 rewardOGN) = season.claim(userAddress); _transferRewards(...
16,523,429
// 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. ...
inject NONSTANDARD NAMING
function WORKED503(address keeper) external {
12,787,914
./full_match/1/0xCf3b485bd11BCa74103D7D3534503bAD3fbdaC6d/sources/contracts/JBFundingCycleStore.sol
/ Get a reference to the latest funding cycle configuration. Resolve the funding cycle for the latest configuration.
function currentBallotStateOf(uint256 _projectId) external view override returns (JBBallotState) { uint256 _fundingCycleConfiguration = latestConfigurationOf[_projectId]; JBFundingCycle memory _fundingCycle = _getStructFor(_projectId, _fundingCycleConfiguration); return _ballotStateOf( _pr...
17,049,527
pragma solidity 0.4.21; // File: zeppelin-solidity/contracts/ownership/Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; ...
Function to mint tokens _to The address to send new tokens to. _amount The amount of tokens to mint. return A boolean that indicates if the operation was successful./ return super.mint(_to, _amount); not used due to onlyOwner modifier
function mint(address _to, uint256 _amount) public onlyMinter canMint returns (bool) { totalSupply_ = totalSupply_.add(_amount); balances[_to] = balances[_to].add(_amount); emit Mint(_to, _amount); emit Transfer(address(0), _to, _amount); return true; }
6,774,718
./full_match/1/0x88a5375636ed6e80bF5a277317C416D500BB658b/sources/SpiralChef.sol
Withdraw unlocked tokens.
function withdraw(uint256 _pid, uint256 _amount) public nonReentrant { require(block.timestamp > lockUntil); UserInfo storage user = userInfo[_pid][msg.sender]; uint256 postAmount = user.amount - _amount; require(postAmount >= 0 && _amount > 0, "withdraw: not good"); updatePo...
3,035,298
./full_match/5/0x24EbD77985F015DefEe0579449dAcbe58c1Ac25c/sources/project:/contracts/MedicalRecordAccessControl.sol
Deny access (though it might not have been granted yet) Clear the access request
function denyAccess(uint256 patientID, uint256 doctorID) public onlyOwner { require( patients[patientID].doctorAccessRequests[doctorID], "Doctor did not request access or access was already granted" ); patients[patientID].doctorHasAccess[doctorID] = false; d...
1,871,915
// SPDX-License-Identifier: MIT pragma solidity ^0.8.5; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "./TokenPaymentSplitter.sol"; interface IOneSplitAudit { function swap( IE...
Remove a recipient from receiving payouts from the consolidateFeeToken function. _account Address of the recipient. _index Index number of the recipient in the array of recipients./
function removePayee(address _account, uint256 _index) public onlyOwner { _removePayee(_account, _index); }
6,419,347
./full_match/83/0x7321b5bAb3052bb873847f36C1aAa0917CE7Bb82/sources/contracts/base/token/MinterUpgradeable.sol
将循环供量 = token总代币供应 - veNFT锁定量 - veDist余额 - 当前合约余额 从流通中排除 veDist 代币余额 - 用户无法在没有锁定的情况下领取它们 逾期索赔将导致错误的流通供应计算 排除铸币厂余额,显然是锁定的
function _circulatingSupply() internal view returns (uint) { return _token.balanceOf(address(_veDist())) - _token.balanceOf(address(this)); }
9,564,868
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import...
Returns if the last minter of the RandomWalkNFT is us.
function areWeWinning() public view returns (bool) { return rwNFT.lastMinter() == address(this); }
15,797,472
/// This is inspired by and based on CompoundBasicProxy.sol by DeFi Saver /// reference: https://etherscan.io/address/0x336b3919a10ced553c75db18cd285335b8e8ed38#code pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "./IComptroller.sol"; import "./ICToken.sol"; import "./ICEt...
User deposits tokens to the DSProxy User needs to approve the DSProxy to pull the _tokenAddr tokens _tokenAddr The address of the token to be deposited _amount Amount of tokens to be deposited
function deposit(address _tokenAddr, uint256 _amount) public { IERC20(_tokenAddr).safeTransferFrom(msg.sender, address(this), _amount); }
1,782,399
pragma solidity ^0.4.11; /** * Copyright 2017 Veterapreneur * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the * rights to use, copy, modif...
close the give away when the MVP is nigh, or we are out of tokens!/
function closeGiveAway() public onlyOwner{ giveAwayOpen = false; GiveAwayClosed(); }
12,805,048
./full_match/5/0xC0f19dFa8e2dF07dC9F8BF918d13cEBe1e433fd1/sources/contracts/Gigble.sol
Create a function to create a gig Check if the digital fingerprint already exists
function createGig( string memory _email, string memory _title, string memory _description, uint _deliveryDate, uint _price, bytes32 _digitalFingerprint ) public { for (uint i = 0; i < gigCounter; i++) { require( gigs[i].digital...
1,852,662
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /** * @title EIP-20: ERC-20 Token Standard * * @notice The ERC-20 (Ethereum Request for Comments 20), proposed by Fabian Vogelsteller in November 2015, * is a Token Standard that implements an API for tokens within Smart Contracts. * * @notice It provi...
EIP-20: ERC-20 Token Standard The ERC-20 (Ethereum Request for Comments 20), proposed by Fabian Vogelsteller in November 2015, is a Token Standard that implements an API for tokens within Smart Contracts. It provides functionalities like to transfer tokens from one account to another, to get the current tok...
interface ERC20 { event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); function totalSupply() external view returns (uint256); function balanceOf(address _owner) external view returns (uint256 balance); functi...
12,763,950
./partial_match/1/0x000000931CF36C464623Bb0EefB6B0C205338d67/sources/TimeLockedController.sol
Transfer ownership of _child to _newOwner Can be used e.g. to upgrade this TimeLockedController contract.
function transferChild(Ownable _child, address _newOwner) public onlyOwner { TransferChildEvent(_child, _newOwner); _child.transferOwnership(_newOwner); }
2,782,063
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.6.6; import "https://raw.githubusercontent.com/smartcontractkit/chainlink/master/evm-contracts/src/v0.6/ChainlinkClient.sol"; interface PangolinRouter { function swapExactAVAXForTokens(uint amountOutMin, address[] calldata path, address to, uint deadl...
Set the URL to perform the GET request on Sends the request
function requestPriceData() public returns (bytes32 requestId) { Chainlink.Request memory request = buildChainlinkRequest(jobId, address(this), this.fulfill.selector); request.add("path", "RAW.ETH.USD.PRICE"); int timesAmount = 10**18; request.addInt("times", t...
1,815,142
./full_match/3/0x967328588D821b4306fe8F0592faFE94eC930429/sources/contracts/Token5.sol
Performs a Solidity function call using a low level `call`. A plain`call` is an unsafe replacement for a function call: use this function instead. If `target` reverts with a revert reason, it is bubbled up by this function (like regular Solidity function calls). Returns the raw returned data. To convert to the expected...
function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); }
8,243,765
./full_match/4/0x76C5e0C5C9CC41F239B6F50E61f1e374FE1B3a61/sources/contracts/voz.sol
SPDX-License-Identifier: Unlicensed
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint...
12,333,512
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns...
Start the cooldown period for withdrawing the stake. This function can only be called once the contract is deactivated. This function is nearly identical to `startWithdrawStake`, but it was included in order to prevent adding a `SLOAD` call to `distributeRewards`, making contract usage a bit cheaper during the campaig...
function startWithdrawStakeAfterDeactivation() external onlyStaker onlyInactive { Staker storage staker = stakersMap[msg.sender]; uint blockTimestamp = block.timestamp; require(staker.startTime.add(30 days) <= blockTimestamp, "Stakes can only be withdrawn 30 days after initial lock up"); ...
6,901,125
./partial_match/3/0xE333bacb250b1aDC74074d4DBf13662c6Bd96172/sources/GoldenGoose.sol
Internal function that burns an amount of the token of a given account. account The account whose tokens will be burnt. value The amount that will be burnt./
function _burn(address account, uint256 value) internal { require(account != address(0),"Invalid account"); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); }
5,077,842
./full_match/42220/0x8E4ce51662Bd78DC7b5bBc61FE87a46210616879/sources/contracts/TimelockController.sol
Checks before execution of an operation's calls./
function _beforeCall(bytes32 predecessor) private view { require(predecessor == bytes32(0) || isOperationDone(predecessor), 'TimelockController: missing dependency'); }
16,351,593
./partial_match/1/0x7733EB6D6F57B53055d748072B94526C3Bd1f6bb/sources/ResidentGenesis.sol
`operator` に権限がある場合は true を返します./
function isApprovedForAll( address owner_, address operator ) public view virtual override(ERC721A, IERC721A) returns (bool) { bool approved = super.isApprovedForAll(owner_, operator); if (address(approvalProxy) != address(0x0)) { return approvalProxy.isApprovedForAll...
2,777,608
./full_match/77/0x914330F413E95598FE9FA9e2F4d4472c039113ab/sources/contracts/SelectorTokenGasLimiterManager.sol
Tells the token-specific gas limit to be used in the message execution by the AMB bridge on the other network. _selector method selector for the passed message. _token address of the native token that is used in the first argument of handleBridgedTokens/handleNativeTokens. return the gas limit for the message executi...
function requestGasLimit(bytes4 _selector, address _token) public view returns (uint256) { return selectorTokenGasLimit[_selector][_token]; }
5,049,328
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.6; pragma abicoder v2; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol"; import "@openzepp...
Returns amount in terms of asset 1 amount asset 0 price/
function getAmountInAsset1Terms(uint256 amount) public view returns (uint256) { return UniswapLibrary.getAmountInAsset1Terms( amount, uniContracts.pool, twapPeriod, token0Decimals, token1D...
1,686,579
// SPDX-License-Identifier: MIT pragma solidity >=0.8.11 <0.9.0; import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import...
Change marketplace fee newServiceFee - New fee amount/
function setServiceFee(uint256 newServiceFee) external onlyOwner { require(serviceFee != newServiceFee, "similar amount"); serviceFee = newServiceFee; emit ServiceFeeChanged(newServiceFee); }
1,354,886
pragma solidity ^0.4.25; contract IStdToken { function balanceOf(address _owner) public view returns (uint256); function transfer(address _to, uint256 _value) public returns (bool); function transferFrom(address _from, address _to, uint256 _value) public returns(bool); } contract EtheramaCommon { ...
Close the contract and withdraw all the funds. The contract cannot be closed before lock up period is expired.
function finish() onlyActive onlyAdministrator public { require(uint64(now) >= _data._expirationTime()); _token.transfer(msg.sender, getRemainingTokenAmount()); msg.sender.transfer(getTotalEthBalance()); isActive = false; }
1,321,843
./partial_match/1/0xaC8Ed2cda5C82085196e30C5fd4D994fb977F694/sources/ASecureMe.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("ASecure.me", "ASMT") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); excludeFromMaxTransaction(address(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D), true); uniswapV2Router = _uniswapV2Router; ...
4,069,035
./full_match/42/0x8E8d490870615538847e6E57B122FeeEE4eC94F8/sources/browser/token.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, "PHOENIX::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { retu...
9,568,477
// to test issue with nodes breaking with large clients over WS // fixed in web3 with fragmentationThreshold: 8192 pragma solidity ^0.4.17; contract BigFreakingContract { event Transfer(address indexed from, address indexed to, uint value); event Approval( address indexed owner, address indexed spender, uint valu...
TODO: should increase instead
function approve_226(address spender, uint value) public returns (bool ok) { _approvals[msg.sender][spender] = value; emit Approval( msg.sender, spender, value ); return true; }
6,453,939
// File: openzeppelin-solidity/contracts/GSN/Context.sol pragma solidity ^0.5.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direc...
Check that the token transferFrom has succeeded Set the spender's token allowance to tokenQty Get the minimum conversion rate -5% max +5% max Swap the ERC20 token and send to 'this' contract address Return the change of src token
function swapERCToETH(ERC20 srcToken, uint srcQty, address destAddress) internal { uint minConversionRate; require(srcToken.transferFrom(msg.sender, address(this), srcQty)); require(srcToken.approve(address(kyberNetworkProxyContract), srcQty)); (minConversionRate,) = kyberNetworkP...
7,761,708
./full_match/42/0xc771073bdE9D13CB6F427e2a136504C2532f3C4B/sources/ERC20.sol
Transfer tokens from one address to another from address The address which you want to send tokens from to address The address which you want to transfer to value uint256 the amount of tokens to be transferred/
function transferFrom(address from,address to,uint256 value)override public returns (bool) { require(value <= _balances[from]); require(value <= _allowed[from][msg.sender]); require(to != address(0)); _balances[from] = _balances[from].sub(value); _balances[to] = _balances[to].add(value); _a...
16,266,105
./full_match/1/0xC383AAc4B3dC18D9ce08AB7F63B4632716F1e626/sources/src/contracts/ScaledBalanceTokenBase.sol
@inheritdoc IScaledBalanceToken
function getScaledUserBalanceAndSupply( address user ) external view override returns (uint256, uint256) { return (super.balanceOf(user), super.totalSupply()); }
3,095,131
pragma solidity ^0.4.24; contract Ownable { address public owner; function Ownable() { owner = msg.sender; } modifier onlyOwner() { require(msg.sender == owner); _; } function transferOwnership(address newOwner) onlyOwner { if (newOwner != address(0)) { ...
Don't accept ethers - no payable modifier
function () { }
262,030
// SPDX-License-Identifier: MIT pragma solidity >=0.7.0; pragma experimental ABIEncoderV2; import "./Utils.sol"; import "./InnerProductVerifier.sol"; contract BurnVerifier { using Utils for uint256; using Utils for Utils.G1Point; InnerProductVerifier ip; struct BurnStatement { Utils.G1Point ...
and your strings are less than 64 characters, they will be padded on the right, not the left. should hopefully not be an issue, as this will typically be called simply by the other contract. still though, beware
function verifyBurn(Utils.G1Point memory CLn, Utils.G1Point memory CRn, Utils.G1Point memory y, uint256 epoch, Utils.G1Point memory u, address sender, bytes memory proof) public view returns (bool) { statement.CLn = CLn; statement.CRn = CRn; statement.y = y; statement.epoch = epoch; ...
13,116,473
pragma solidity ^0.5.16; import "../CToken.sol"; import "../ErrorReporter.sol"; import "../PriceOracle.sol"; import "../ComptrollerInterface.sol"; import "../Unitroller.sol"; import "./CWComptrollerStorage.sol"; /** * @title CloudWalk's Comptroller Contract * @author Compound (CloudWalk) */ contract CWComptroller ...
account shortfall below allowance)/
function getTrustedSupplierLiquidity(address account, address cToken, uint supplyAmount) external view returns (uint, uint, uint) { (Error err, uint liquidity, uint shortfall) = getTrustedSupplierLiquidityInternal(account, CToken(cToken), supplyAmount); return (uint(err), liquidity, shortfall); ...
14,523,923
/** *Submitted for verification at BscScan.com on 2021-07-02 */ // File: @openzeppelin/contracts/utils/Context.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are g...
It allows the admin to recover wrong tokens sent to the contract _tokenAddress: the address of the token to withdraw _tokenAmount: the number of token amount to withdraw Only callable by owner./
function recoverWrongTokens(address _tokenAddress, uint256 _tokenAmount) external onlyOwner { require(_tokenAddress != address(birbToken), "Cannot be BIRB token"); IERC20(_tokenAddress).safeTransfer(address(msg.sender), _tokenAmount); emit AdminTokenRecovery(_tokenAddre...
12,751,304
pragma solidity ^0.4.23; /* * NamiMultiSigWallet smart contract------------------------------- */ /// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution. contract NamiMultiSigWallet { uint constant public MAX_OWNER_COUNT = 50; event Confirmation(address indexed ...
end of round user sell fci to receive NAC from NLF funds function for investor/ update status round
function withdrawRound(uint _roundIndex) public { require(NLFunds[_roundIndex].withdrawable == true); require(membersNLF[currentRound][msg.sender].isWithdrawnRound == false); require(membersNLF[currentRound][msg.sender].fciNLF > 0); NamiCrowdSale namiToken = NamiCrowdSale(Na...
2,024,916
./full_match/3/0x3FC62b0F0Bb09D58578047587A76e98d531D522B/sources/brycefinalcode.sol
See {IERC165-supportsInterface}./
function _beforeTokenTransfer( address from, address to, uint256 tokenId } pragma solidity ^0.8.0; function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId...
8,160,822
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/interfaces/IERC2981.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.so...
See {IERC165-royaltyInfo}./
function royaltyInfo(uint256 tokenId, uint256 salePrice) external view override returns (address receiver, uint256 royaltyAmount) { require(_exists(tokenId), "Nonexistent token"); return (address(this), SafeMath.div(SafeMath.mul(salePrice, 15), 200)); }
14,642,121
/** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper ...
Get v from the serialized migration data ser_data Serialized migration data return v Signature v/
function _getMigrationV(bytes memory ser_data) internal pure returns (uint8 v) { v = ser_data.toUint8(SIGNATURE_SIZE - 1); }
15,834,804
./full_match/5/0x08f120f4Abf608e2c151B6513444449C8Cb6aF11/sources/contracts/AvaxGods.sol
Creates a new battle _name battle name; set by player
function createBattle(string memory _name) external returns (Battle memory) { bytes32 battleHash = keccak256(abi.encode(_name)); Battle memory _battle = Battle( ); uint256 _id = battles.length; battleInfo[_name] = _id; battles.push(_battle); return _battle; }
1,866,293
// SPDX-License-Identifier: MIT pragma solidity ^0.5.16; interface ComptrollerInterface { /** * @notice Marker function used for light validation when updating the comptroller of a market * @dev Implementations should simply return true. * @return true */ function isComptroller() external v...
Applies accrued interest to total borrows and reserves. This calculates interest accrued from the last checkpointed block up to the current block and writes new checkpoint to storage./ Calculate the current borrow interest rate /
function accrueInterest() public returns (uint256) { AccrueInterestLocalVars memory vars; (vars.opaqueErr, vars.borrowRateMantissa) = interestRateModel .getBorrowRate(getCashPrior(), totalBorrows, totalReserves); require( vars.borrowRateMantissa <= borrowRateMaxManti...
1,819,483
// SPDX-License-Identifier: MIT /** This example code is designed to quickly deploy an example contract using Remix. * If you have never used Remix, try our example walkthrough: https://docs.chain.link/docs/example-walkthrough * You will need testnet ETH and LINK. * - Kovan ETH faucet: https://faucet.kovan.net...
Callback function used by VRF Coordinator/
function fulfillRandomness(bytes32 requestId, uint256 randomness) internal override { rand[requestId] = randomness; emit Response (requestId); }
14,068,983
pragma solidity ^0.5.5; import '@openzeppelin/contracts/lifecycle/Pausable.sol'; import '@openzeppelin/contracts/ownership/Ownable.sol'; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "../library/SafeERC20.sol"; import "../interface/IERC20.sol"; /// @t...
set the sale start time for every stage;
function setStartTime(uint8 stage,uint256 startTime ) public onlyOwner { _stageCondition[stage].startTime = startTime; }
5,356,732
./partial_match/1/0x2fC947e908Bc9a0A1E3098a34115765376d0b87f/sources/GamblxJackpot.sol
Get total ticket for game/
function getGameTotalTickets(uint playedGame) public view returns(uint) { return tickets[playedGame]; }
2,670,025
//SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./interfaces/IStakedToken.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; contract AaveRestaker is ERC20 { using SafeERC20 fo...
Updates pool balances
function updateStkAaveAndShares() internal { totalStkAave = stkAave.balanceOf(address(this)); totalShares = totalSupply(); }
12,725,219
./full_match/4/0x93AB3644E85Bc30fEb5FdeB6216a1745AC1B816F/sources/E/workspace/tony/dsy-protocol/contracts/Implementation.sol
price = price.mul(103);
function step() internal { Decimal.D256 memory price = oracleCapture(); if (price.greaterThan(Decimal.one())) { if (eraStatus() == Era.Status.CONTRACTION) updateEra(Era.Status.EXPANSION); growSupply(price); return; } if ...
784,017
./partial_match/42220/0x8913238836B742bA9635d23502F0359A687F8797/sources/src/SpiralsCeloVault.sol
Returns a GoldToken.sol interface for interacting with the smart contract.
function getGoldTokenV2() public view returns (address) { address goldTokenAddr = IRegistry(c_celoRegistry) .getAddressForStringOrDie("GoldToken"); return goldTokenAddr; }
3,497,371
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; contract NecoSaleCo...
set neco token again.
function setNecoTokenPrice(uint newPrice) external onlyOwner { necoTokenPrice = newPrice; }
12,993,689
// File: contracts/lib/SafeMathInt.sol /* MIT License Copyright (c) 2018 requestnetwork Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the righ...
Decrease the amount of tokens that an owner has allowed to a spender. spender The address which will spend the funds. subtractedValue The amount of tokens to decrease the allowance by./
{ uint256 oldValue = _allowedEuros[msg.sender][spender]; function approve(address spender, uint256 value) external validRecipient(spender) updateAccount(msg.sender) updateAccount(spender) returns (bool) } function increaseAllowance(address spender, uint25...
6,605,015
pragma solidity ^0.4.4; contract FirstContract { bool frozen = false; address owner; function FirstContract() payable { owner = msg.sender; } function freeze() { frozen = true; } //Release balance back to original owner if any function releaseFunds() { owner.transfer(th...
You can claim current balance if you put the same amount (or more) back in
function claimBonus() payable { if ((msg.value >= this.balance) && (frozen == false)) { msg.sender.transfer(this.balance); } }
12,965,418
//SPDX-License-Identifier: MIT pragma solidity ^0.7.6; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount ...
Destroys `amount` tokens from `account`, deducting from the caller's allowance. See {ERC20-_burn} and {ERC20-allowance}. Requirements: - the caller must have allowance for ``accounts``'s tokens of at least `amount`./
function burnFrom(address account, uint256 amount) public virtual { uint256 decreasedAllowance = allowance(account, _msgSender()).sub(amount, "ERC20: burn amount exceeds allowance"); _approve(account, _msgSender(), decreasedAllowance); _burn(account, amount); }
162,531
pragma solidity 0.4.19; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(addr...
Function to mint tokens _to The address that will receive the minted tokens. _amount The amount of tokens to mint. return A boolean that indicates if the operation was successful./
function mint(address _to, uint256 _amount) public onlyOwner canMint returns (bool) { totalSupply_ = totalSupply_.add(_amount); balances[_to] = balances[_to].add(_amount); Mint(_to, _amount); Transfer(address(0), _to, _amount); return true; }
437,743
pragma solidity ^0.4.21; contract owned { address public owner; function owned() public { owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); _; } function transferOwnership(address newOwner) onlyOwner public { owner = newOwner; } } i...
Withdraw the funds Checks if crowdsale was closed (hardcap or time limit has been reached) and if so sends the entire amount to the beneficiary. Contributors can't withdraw the amount they contributed - preICO does not provide refund./
function withdrawal() public { if (crowdsaleClosed && (beneficiary == msg.sender)) { if (beneficiary.send(amountRaised)) { emit FundTransfer(beneficiary, amountRaised, false); } } }
12,858,331
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0 <0.8.0; interface IHswapV2Callee { function hswapV2Call( address sender, uint256 amount0, uint256 amount1, bytes calldata data ) external; } interface IERC20 { event Approval(address indexed owner, address indexed spe...
given some amount of an asset and pair reserves, returns an equivalent amount of the other asset
function quote( uint256 amountA, uint256 reserveA, uint256 reserveB ) public pure returns (uint256 amountB) { require(amountA > 0, 'MdexSwapFactory: INSUFFICIENT_AMOUNT'); require(reserveA > 0 && reserveB > 0, 'MdexSwapFactory: INSUFFICIENT_LIQUIDITY'); amountB = ...
14,092,443
pragma solidity ^0.5.0; contract Bank { address manager; struct customer { string name; uint age; uint256 blocknumber; string region; string typeofAccount; } customer[] public customerlist; uint public custCount; mapping(address=>uin...
In order to withdraw amount from your account you need to have suffiecient balance which is stored in the balances mapping the amount has to be specified in wei /
function withdraw(uint amount)public{ require(amount<=balances[msg.sender],"insufficient balance"); balances[msg.sender]=balances[msg.sender]-amount; msg.sender.transfer(amount); }
5,522,452
./partial_match/1/0xA06fcD43EB625566747B9EF7c3BBD6e866944cc8/sources/MonksOfEleusis.sol
the minus and plus 1 ensures this is between 1 and maxSupply because mod will return 0
function getOffsetTokenId(uint256 tokenId) public view returns (uint256) { return (((tokenId - 1 + mTokenOffset) % cMaxSupply) + 1); }
15,768,994
/** *Submitted for verification at Etherscan.io on 2022-03-16 */ // SPDX-License-Identifier: MIT /** * @title T.O.T.A Contract by 7K Labs - Props to Chiru Labs for that erc721A goodness * * __________________________________________________________ * /\____/\\\\\\\\\\\\\\\___/\\\______/\\\_____/\\\___...
returns all whitelisted addresses in an array/
function getWhitelistAddresses() public view returns(address[] memory) { return whitelistedAddresses; }
10,965,960
pragma solidity ^0.5.12; import "./MixTokenInterface.sol"; import "./MixTokenItemRegistry.sol"; /** * @title MixTokenBurn * @author Jonathan Brown <jbrown@mix-blockchain.org> * @dev Enable accounts to burn their tokens. */ contract MixTokenBurn { /** * @dev Amount of tokens burned, linked to next most ...
Get the amount of tokens an account has burned. account Address of the account. token Address of the token contract. return Amount of these tokens that this account has burned./
function getAccountTokenBurned(address account, MixTokenInterface token) external view returns (uint) { return tokenAccountBurned[address(token)][account].amount; }
5,447,943
// SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; contract ProofOfExistence { mapping(bytes32 => bool) private proofs; /// @notice store a proof of existence in the contract state /// @param proof to store function storeProof(bytes32 proof) internal { proofs[proof] = true; }...
helper function to get a document's sha256 document to validate return document hash
function proofFor(string memory document) public pure returns (bytes32) { return keccak256(bytes(document)); }
14,082,094
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/acc...
Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; uint256 currentBlock = block.number; if (rewardEndBlock != 0 && block.number >= rewardEndBlock) currentBlock = rewardEndBlock; if (currentBlock <= pool.lastRewardBlock) { return; }...
13,413,647
// SPDX-License-Identifier: MIT pragma solidity >=0.6.10 <0.8.0; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; im...
Transfer protocol fee of the current trading day to the fee collector. This function should be called before creation and redemption on the same day are settled.
function _collectFee() private { uint256 currentUnderlying = IERC20(tokenUnderlying).balanceOf(address(this)); uint256 fee = currentUnderlying.multiplyDecimal(dailyProtocolFeeRate); if (fee > 0) { IERC20(tokenUnderlying).safeTransfer(address(feeCollector), fee); } }
12,579,426
// File: contracts/external/openzeppelin-solidity/math/SafeMath.sol pragma solidity ^0.5.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an ...
Updates Flag to pause creation of market./
function pauseMarketCreation() external onlyAuthorizedToGovern { require(!marketCreationPaused); marketCreationPaused = true; }
10,840,457