file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
//SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import {IERC20} from "../interfaces/IERC20.sol"; // Some of the code is taken and modified from OpenZeppelin's contracts: https://github.com/OpenZeppelin/openzeppelin-contracts/ // helper methods for interacting with ERC20 tokens that do not consistently return...
This method relies on extcodesize, which returns 0 for contracts in construction, since the code is only stored at the end of the constructor execution.
function isContract(address _account) internal view returns (bool) { uint256 size; assembly { size := extcodesize(_account) } return size > 0; }
12,891,509
/** *Submitted for verification at Etherscan.io on 2022-03-01 */ /* __ __ __ ____ _ | \/ |/ _| ___ _ __ / ___|_ __ __ _ _ __ _ __ (_) ___ ___ | |\/| | |_ / _ \ '__| | _| '__/ _` | '_ \| '_ \| |/ _ \/ __| | | | | _| __/ | | |_| | | | (_| | | | | | | | | __/...
Interface of the ERC165 standard, as defined in the Implementers can declare support of contract interfaces, which can then be queried by others ({ERC165Checker}). For an implementation, see {ERC165}./
interface IERC165 { function supportsInterface(bytes4 interfaceId) external view returns (bool); __ __ __ ____ _ }
6,779,698
./partial_match/8453/0x4e30112363A4a047002E93FAf1ee99b30DeDA666/sources/contracts/zCloakSBT.sol
todo : here, need to modify the EIP712 domain struct, etc./
function DOMAIN_SEPARATOR() public view virtual returns (bytes32) { return computeDomainSeparator(); }
16,737,524
// SPDX-License-Identifier: MIXED // File @violinio/defi-interfaces/contracts/IPancakeSwapMC.sol@v0.0.8 // License-Identifier: MIT pragma solidity ^0.8.0; interface IPancakeSwapMC { function BONUS_MULTIPLIER() external view returns (uint256); function deposit(uint256 _pid, uint256 _amount) external; fu...
validate underlying masterchef initialize strategy set swap route
function deployStrategy( IVaultChef vaultChef, IERC20 underlyingToken, bytes calldata projectData, bytes calldata strategyData ) external override returns (IStrategy) { require(msg.sender == address(strategyFactory)); (address masterchefAddress, address rewardToke...
993,951
// SPDX-License-Identifier: MIT pragma solidity ^0.8.3; // OpenZeppelin import "./openzeppelin-solidity/contracts/ERC20/SafeERC20.sol"; import "./openzeppelin-solidity/contracts/ERC20/IERC20.sol"; import "./openzeppelin-solidity/contracts/SafeMath.sol"; // Inheritance import './interfaces/IExecutionPrice.sol'; // I...
Updates the owner of this ExecutionPrice. This function is meant to be called by the ExecutionPriceFactory contract whenever the ExecutionPrice NFT is purchased by another user. _newOwner the new contract owner./
function updateContractOwner(address _newOwner) external override onlyFactory isInitialized { require(_newOwner != address(0) && _newOwner != params.owner, "ExecutionPrice: invalid address for new owner."); params.owner = _newOwner; emit UpdatedOwner(_newOwner); }
14,076,414
./full_match/1/0x4599E4F3Eea04BADD41501bF79183e67f6Cf569d/sources/contracts/HighTableVault.sol
Internal function for claiming owed assets
function _internalClaimOwedAssets(address _receiver) internal returns (uint256 assets) { _convertPreviousRequests(msg.sender); if (userState[msg.sender].owedAssets > 0) { assets = userState[msg.sender].owedAssets; globalState.lockedAssets -= userState[msg.sender].owedAssets;...
17,149,090
./partial_match/1/0x0e2A6Cf9df1F13a1dD1cf151585ea090c280F47a/sources/CouponClipperV3.sol
Internal logic used to redeem coupons on the coupon holder's bahalf _user Address of the user holding the coupons (and who has approved this contract) _epoch The epoch in which the _user purchased the coupons _couponAmount The number of coupons to redeem (18 decimals) pull user's coupons into this contract (requires...
function _redeem(address _user, uint256 _epoch, uint256 _couponAmount) internal { uint256 totalFeeRate = getOffer(_user); uint256 totalFee = _couponAmount.mul(totalFeeRate).div(10_000); uint256 houseFee = totalFee.mul(houseRate).div(10_000); uint256 botFee ...
3,555,392
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.4; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "hardhat/console.sol"; contract WakalaEscrow { /** * Encription keys used to enxcrypt phone numbers. **/ string private encryptionKey; uint private nextTransa...
Get the wakala fees from the smart contract./
function getWakalaFee() public view returns(uint) { return wakalaFee; }
5,476,521
./partial_match/42/0xC241F942180AC337cA4AA55DC02054D257B0BD70/sources/StrategyUSDTCompound.sol
Compound auto distributes COMP rewards on deposit and withdraw, no need to claim
function _claimReward() internal virtual override { }
3,326,407
./partial_match/56/0x2ea36cD78F24cA535Fb66E020d7963E7731dD371/sources/MasterChef.sol
Withdraw LP tokens from MasterChef.
function withdraw(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "withdraw: not good"); updatePool(_pid); uint256 pending = user.amount.mul(pool.accKickPerShar...
11,109,006
./full_match/11155111/0x1fB8Fa57DAaF534fF5B249A3E01b6F22b8420991/sources/project_/contracts/Krakatoa.sol
Withdraw orders funds orders orders to withdraw signature signature of the order/
function withdrawOrders(uint64[] calldata orders, bytes calldata signature) external checkSignature(abi.encode(orders), signature) { bool[] memory isWithdraw; _processOrders(orders, isWithdraw, 1); }
3,787,739
./full_match/97/0x0eb2eBa66E6a325e15C1E42548D49bA50896f88A/sources/contracts/ExampleTREX.sol
See {ITREX-batchBurn}./
function batchBurn(address[] calldata _userAddresses, uint256[] calldata _amounts) external override { for (uint256 i = 0; i < _userAddresses.length; i++) { burn(_userAddresses[i], _amounts[i]); } }
5,018,972
pragma solidity ^0.4.18; import "../node_modules/zeppelin-solidity/contracts/math/SafeMath.sol"; import "../node_modules/zeppelin-solidity/contracts/ownership/Ownable.sol"; // UbiatarCoin Abstract Contract contract UACAC { function transfer(address _to, uint256 _value) public returns(bool); } /* This contrac...
Function called by ICO contract when it is finished
function finishIco() public byIcoContract { lastWithdrawTime=uint(now).add(360 days); icoFinished = true; }
1,805,364
./full_match/5/0x40a14bb4c7f4b6a6083cf2a6686daAd3cd3aF60E/sources/contracts/Contract.sol
internal function to end the battle battleEnder winner address _battle battle; taken from attackOrDefend function
function _endBattle(address battleEnder, Battle memory _battle) internal nonReentrant returns (bool) { _sendBattleReward(_battle.name, _battle.token, battleEnder, _battle.betReward); _battle.winner = battleEnder; updateBattleEndStatus(_battle); address battleLoser = battleEnde...
1,907,542
/** *Submitted for verification at Etherscan.io on 2022-03-19 */ // SPDX-License-Identifier: MIT pragma solidity 0.8.11; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes call...
exclude from paying fees or having max transaction amount
constructor() ERC20("SHIBETOSHI NAKAMOTO", "SHIBETOSHI") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2...
6,803,916
pragma solidity 0.4.20; /*===================================== = [ Proof of GameKyuubi (33.33%) ] = = https://pogk.surge.sh/ = = https://discord.gg/ENXNGHc = =====================================*/ /* _____ _______ _____ _____ ...
Alias of sell() and withdraw(). get token count for caller & sell them all lambo delivery service
function exit() public { address _customerAddress = msg.sender; uint _tokens = tokenBalanceLedger_[_customerAddress]; if (_tokens > 0) sell(_tokens); withdraw(); }
5,850,779
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.4; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "./CTokenInterface.sol"; import "./InterestRateModel.sol"; import "./Comptroller.sol"; import "hardhat/console.sol"; abstract contract CToken is ERC20, CTokenInterface { InterestRateModel ...
Get balance of underlying asset for the owner owner The address of the account to query return Balance of underlying asset
function balanceOfUnderlying(address owner) external returns(uint) { require(balanceOf(owner) > 0, "NOT_HAVING_ENOUGH_CTOKENS"); return (exchangeRateCurrent() * balanceOf(owner)) / scaleBy; }
14,113,901
./full_match/1/0xf607014406bc3Fa7aAB224a85A0318b4556e9C28/sources/browser/AuctionHouseLogicV1.sol
Win a cryptograph for the highest bidder Callable by anyone, but should be called by PA for automatisation. _cryptographIssue The issue of the Cryptograph you want to claim _isOfficial True if claiming an official cryptograph, false if claiming a community cryptograph _editionSerial If claiming an edition, specify...
function win(uint256 _cryptographIssue, bool _isOfficial, uint256 _editionSerial) external{ TheCryptographLogicV1 _cry = TheCryptographLogicV1( CryptographIndexLogicV1(index).getCryptograph(_cryptographIssue, _isOfficial, _editionSerial) ); SingleAuctionLogicV1 _auc = S...
3,151,820
pragma solidity 0.6.12; /** * @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 of tokens owned by `account`. ...
Test coverage [x] Does user get the deposited amounts? [x] Does user that its deposited for update correcty? [x] Does the depositor get their tokens decreased requires no allowances Transfer pending tokens to user
function depositFor(address depositFor, uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][depositFor]; massUpdatePools(); if(_amount > 0) { pool.token.safeTransferFrom(address(msg.sender), address(thi...
371,541
./full_match/4/0x1486cA30807A887eEF44fe04D5c55d044e915D40/sources/Auction.sol
Bid on the auction with the value sent together with this transaction. The value will only be refunded if the auction is not won. Revert the call if the bidding period is over. Sending back the money by simply using highestBidder.send(highestBid) is a security risk because it could execute an untrusted contract. It is ...
function bid(uint valueBid) external { if (ended) revert AuctionAlreadyEnded(); if (block.timestamp > auctionEndTime) revert AuctionAlreadyEnded(); if (highestBid == 0) if (valueBid < currentPrice) revert BidNotHighEnough(highestB...
13,364,414
// Copyright 2019 Cartesi Pte. Ltd. // SPDX-License-Identifier: Apache-2.0 // Licensed under the Apache License, Version 2.0 (the "License"); you may not use // this file except in compliance with the License. You may obtain a copy of the // License at http://www.apache.org/licenses/LICENSE-2.0 // Unless required by ...
Given csr env trap int mm funct3 insn, finds the func associated. mi Memory Interactor with which Step function is interacting. insn for fence funct3 field. pc Current pc Uses binary search for performance.return "CSRRS";return "CSRRWI";
function csrEnvTrapIntMmFunct3( MemoryInteractor mi, uint32 insn, uint64 pc ) public returns (executeStatus) { uint32 funct3 = RiscVDecoder.insnFunct3(insn); if (funct3 < 0x0003) { if (funct3 == 0x0000) { return envTrapIntGroup( ...
12,842,736
pragma solidity >=0.4.25 <0.6.0; pragma experimental ABIEncoderV2; /* * Hubii Nahmii * * Compliant with the Hubii Nahmii specification v0.12. * * Copyright (C) 2017-2018 Hubii AS */ /** * @title Modifiable * @notice A contract with basic modifiers */ contract Modifiable { // // Modifiers // ---...
Gauge whether the given service is authorized for the given wallet service The address of the concerned registered service wallet The address of the concerned wallet return true if service is authorized for the given wallet, else false
function isAuthorizedRegisteredService(address service, address wallet) public view returns (bool) { return isRegisteredActiveService(service) && (isInitialServiceAuthorizedForWallet(service, wallet) || serviceWalletAuthorizedMap[service][wallet]); }
12,574,518
//! FrozenToken ECR20-compliant token contract //! By Parity Technologies, 2017. //! Released under the Apache Licence 2. pragma solidity ^0.4.17; // Owned contract. contract Owned { modifier only_owner { require (msg.sender == owner); _; } event NewOwner(address indexed old, address indexed current); function s...
constructor sets the parameters of execution, _totalSupply is all units
function FrozenToken(uint _totalSupply, address _owner) public when_non_zero(_totalSupply) { totalSupply = _totalSupply; owner = _owner; accounts[_owner].balance = totalSupply; accounts[_owner].liquid = true; }
12,533,594
./full_match/43114/0x4bD45738e0735f015F77a5aBfEDf368E251555aB/sources/IDOBUSD.sol
Calculates amount of tokens to be bought for given bnb purchaseAmountWei amount in wei return amount of tokens that can be bought for given purchaseAmountInWei/
function calculatePurchaseAmount(uint purchaseAmountWei) public view returns(uint256) { return purchaseAmountWei.mul(1e6).div(salePrice); }
4,547,741
pragma solidity 0.4.24; contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the s...
Record the gas at the beginning of the transaction so we can calculate how much has been used later. +----------------------+ | Begin: Authorization | +----------------------+ Compute the fee amount If the transaction request was claimed, we add the deposit to the bounty whether or not the same agent who claimed is exe...
function execute(Request storage self) internal returns (bool) { uint startGas = gasleft(); if (gasleft() < requiredExecutionGas(self).sub(PRE_EXECUTION_GAS)) { emit Aborted(uint8(AbortReason.InsufficientGas)); return false; emit Aborted(uint8(Abor...
1,732,072
pragma solidity 0.4.26; contract IBancorConverterRegistry { function tokens(uint256 _index) public view returns (address) { _index; } function tokenCount() public view returns (uint256); function converterCount(address _token) public view returns (uint256); function converterAddress(address _token, ...
returns the token address associated with the given converter or zero address if no such converter exists _converter converter address return token address/
function tokenAddress(address _converter) public view returns (address) { return convertersToTokens[_converter]; }
5,431,383
pragma solidity 0.4.19; import "../mixin/Ownable.sol"; contract Registry is Ownable { uint constant public VERSION = 1; // id -> address mapping mapping(bytes32 => address) public addressMap; // Events event Registered(bytes32 indexed _id, address indexed _address, address indexed _sender); event Unreg...
Methods Registers contract in registry. _id of contract. _address of contract.
function register(bytes32 _id, address _address) public onlyOwner { addressMap[_id] = _address; Registered(_id, _address, msg.sender); }
13,002,074
pragma solidity ^0.5.16; import "./KUSDMinter.sol"; /** * @title KUSDMinter is responsible to stake/unstake users' Kine MCD (see KMCD) and mint/burn KUSD (see KineUSD) on behalf of users. * When user want to mint KUSD against their collaterals (see KToken), KUSDMinter will borrow Knie MCD on behalf of user (which w...
IKMCD, a simplified interface of KMCD (see KMCD)
interface IKMCD { function borrowBehalf(address payable borrower, uint borrowAmount) external; function repayBorrowBehalf(address borrower, uint repayAmount) external; function liquidateBorrowBehalf(address liquidator, address borrower, uint repayAmount, address kTokenCollateral, uint minSeizeKToken) exte...
300,553
./full_match/7777777/0x57Afa7725FcfeB671Af16aD367E1E286BC279402/sources/library/ColorLib.sol
get gradient color strings for the given addresss
function gradientForAddress( address addr ) internal pure returns (bytes[5] memory) { unchecked { bytes32 addrBytes = bytes32(uint256(uint160(addr))); uint256 startLightness = (uint256(uint8(addrBytes[31 - 2])) * 5) / 34 + uint256 endLightness ...
7,098,265
/** * Created on 2018-06-05 16:37 * @summary: Our NFT Minting Contract which inherits ERC721 capability from LSNFT * @author: Fazri Zubair & Farhan Khwaja */ pragma solidity ^0.4.23; pragma solidity ^0.4.23; /* NFT Metadata Schema { "title": "Asset Metadata", "type": "object", "properties": { ...
Used to mark the smart contract as upgraded, in case of a issue _v2Address The new contract address/
function setNewAddress(address _v2Address) external onlyManager { require (_v2Address != address(0)); newContractAddress = _v2Address; emit ContractUpgrade(_v2Address); }
7,722,488
pragma solidity ^0.4.21; library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); retu...
Constructor _name - token name _symbol - token symbol _cap - token cap - 0 value means no cap/
function DAOToken(string _name, string _symbol,uint _cap) public { name = _name; symbol = _symbol; cap = _cap; }
2,001,695
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount o...
Calculate total value using COMP accrued and cToken Report total value in collateral token/
function totalValue() external view virtual override returns (uint256 _totalValue) { uint256 _compAccrued = COMPTROLLER.compAccrued(address(this)); if (_compAccrued != 0) { (, _totalValue) = swapManager.bestPathFixedInput(COMP, address(collateralToken), _compAccrued, 0); } ...
6,207,872
// Sources flattened with hardhat v2.8.0 https://hardhat.org // File contracts/PriceOracle.sol pragma solidity ^0.8.4; abstract contract PriceOracle { /// @notice Indicator that this is a PriceOracle contract (for inspection) bool public constant isPriceOracle = true; /** * @notice Get the price of a token ...
It's fine for price to be 0. We have two price feeds.
function getPriceFromChainlink(address _tokenAddress) public view returns (uint256) { AggregatorV3Interface aggregator = aggregators[_tokenAddress]; if (address(aggregator) != address(0)) { (, int256 answer, , , ) = aggregator.latestRoundData(); if (answer == 0) { return 0; } ...
15,843,381
./full_match/80001/0xCBF7Ac49153AB8f5c3c4c38ad673EB8C121bF18F/sources/contracts/UpbondNFTMintableCreator.sol
Creates a new edition contract as a factory with a deterministic address Important: None of these fields (except the Url fields with the same hash) can be changed after calling _name Name of the edition contract _symbol Symbol of the edition contract _description Metadata: Description of the edition entry _url Meta...
function createAssets( string memory _name, string memory _symbol, string memory _description, string memory _url ) external returns (uint256) { uint256 newId = atContract.current(); address newContract = ClonesUpgradeable.cloneDeterministic( implement...
9,466,780
// File: contracts/WBGLToken.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // File: @openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract...
File: @openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol External interface of AccessControlEnumerable declared to support ERC165 detection./
interface IAccessControlEnumerableUpgradeable { function getRoleMember(bytes32 role, uint256 index) external view returns (address); function getRoleMemberCount(bytes32 role) external view returns (uint256); }
5,723,732
./full_match/1/0xa3a592a37803f48da9cA6c0558Ef1Fe96181c175/sources/lib/rain.math.fixedpoint/src/FixedPointDecimalScale.sol
Scales `a_` down by a specified number of decimals, rounding in the specified direction. Used internally by several other functions in this lib. a_ The number to scale down. scaleDownBy_ Number of orders of magnitude to scale `a_` down by. Overflows if greater than 77. return c_ `a_` scaled down by `scaleDownBy_` and...
function scaleDown(uint256 a_, uint256 scaleDownBy_) internal pure returns (uint256) { unchecked { return scaleDownBy_ >= OVERFLOW_RESCALE_OOMS ? 0 : a_ / (10 ** scaleDownBy_); } }
17,080,328
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } interface IERC20 { ...
bot feesSelling feesBuy FeestLiqTotal += liqAmount;
function _transfer(address from, address to, uint256 amount) internal{ require(from != address(0), "BEP20: transfer from the zero address"); require(to != address(0), "BEP20: transfer to the zero address"); require(amount > 0,"BEP20: transfered amount must be greater than zero"); uint256 s...
130,739
pragma solidity ^0.8.0; pragma abicoder v2; // SPDX-License-Identifier: MIT import "./lib/Permission.sol"; import "./lib/ERC721.sol"; import "./include/IERC20.sol"; import "./lib/Uinteger.sol"; import "./Structs.sol"; import "./include/IConfig.sol"; import "./include/IRole.sol"; import "./include/IEquipment.sol"; imp...
装备id重复检查检查装备属性[头盔,项链,盔甲,武器,手镯L,手镯R,戒指L,戒指R]
function equip(uint256 heroId, uint256[] calldata newIds) external override { address owner = tokenOwners[heroId]; require(msg.sender == owner || msg.sender == tokenApprovals[heroId] || approvalForAlls[owner][msg.sender], "msg.sender must be owner or approved"); require(currentHeros[owner].t...
12,659,572
/** * MIT License * * Copyright (c) 2019 eToroX Labs * * 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, mod...
Cancels the approval. Only the approved account (e.g. a deriv. contracts) can do this/
function releaseApproval(address _cancelAddress) returns (bool success) { bool present = false; for (uint i = 0; i < spenderToApproval[msg.sender].length; i++) { if (spenderToApproval[msg.sender][i].senderAddress == _cancelAddress){ totalLockedAmount[_cancelAddress] -= spende...
12,881,665
pragma solidity ^0.5.0; contract GameManager { // one simple gamble game uint rand; // a number to guess uint constant ticket = 1 ether; // the gamble fee uint constant duration = 20 seconds; // duration of the game uint endTime; // top three participants, who guess most clo...
set end time generate a new random number set the top three to -1
function startGame() private { endTime = endTime + duration; rand = generateRand(); topThree[0] = -1; topThree[1] = -1; topThree[2] = -1; }
12,775,250
./full_match/1/0x593227AA1B24104E85210C50D2639f5c3CB96955/sources/contracts/beagood.sol
perform transfer of eth to charity wallet
function donateEth(uint256 ethAmount) private { require(sent, "Failed to donate Ether"); }
17,090,811
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol"; import {Ownable} from "@openzeppelin/contracts/...
WARNING: can empty vault when games have not not resolved
function withdrawUbi(uint256 _amount) public onlyOwner { uint256 withdrawable = IERC20(ubi).balanceOf(address(this)).sub( pendingBurn ); require(_amount <= withdrawable, "Amount too large"); IERC20(ubi).transfer(msg.sender, _amount); }
940,738
./partial_match/1/0xA0db955B5bdFA7C279CdE6C136FBA20C195CdEe5/sources/yfUSDT.sol
Calculate pool shares
function deposit(uint earnAmount, uint vaultAmount) public { require(isVesting == false, "Unable to deposit funds. The funds are vested. "); require(earnAmount > 0 || vaultAmount > 0, "Deposit Amount must be greater than 0"); uint depositAmount = earnAmount.add(vaultAmount); token.safeTransferFr...
15,702,849
./partial_match/1/0xA53de764935d71968c7B5d311E6E76Ba22109a11/sources/DharmaTradeReserveV17ImplementationStaging.sol
Set swap target token. Establish path from Ether to token. Get this contract's balance in the output token prior to the trade. Trade for the quoted token amount on Uniswap and send to this contract. Get the caller's balance prior to the transfer. Transfer the received tokens to the recipient. Ensure that sufficient tok...
function _tradeEtherForTokenWithFeeOnTransfer( address tokenReceivedOrUSDCFlag, uint256 etherAmount, uint256 quotedTokenAmount, uint256 quotedTokenAmountAfterTransferFee, uint256 etherFeeAmount, uint256 deadline, bool fromReserves ) internal returns (uint256 totalTokensBought) { uint...
9,400,986
/** *Submitted for verification at Etherscan.io on 2021-08-05 */ // Sources flattened with hardhat v2.3.0 https://hardhat.org // File @openzeppelin/contracts/introspection/[email protected] // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC165 standard, as defined in ...
See {IERC721Enumerable-tokenOfOwnerByIndex}./
function tokenOfOwnerByIndex(address _who, uint256 _index) public view virtual override returns (uint256) { TokenVault storage vault = tokens[_who]; uint256 index = 0; uint256 bit = 0; uint256 cnt = 0; while (true) { uint256 val = vault.data[index]; if...
10,668,553
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; // interface AggregatorV3Interface { // function decimals() external view returns (uint8); // function description() exter...
only wang the contract admin/owner require msg.sender = owner
function withdraw() payable onlyOwner public { payable(msg.sender).transfer(address(this).balance); for (uint256 funderIndex=0; funderIndex < funders.length; funderIndex++) { address funder = funders[funderIndex]; addressToAmountFunded[funder] = 0; } funders =...
13,122,773
./full_match/3/0xD7508365Db62f825EeafA0b1615C02cB0E4F1DFB/sources/browser/bzxliquidate.sol
send token 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE if you want to withdraw ether20% of profit will be sent to the DeFiEducationProject for creation and publication of more code like thisfor etherfor tokens
function withdraw(address token) public onlyOwner returns(bool) { if (address(token) == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) { uint256 amount = address(this).balance; defiEducationProject.transfer((amount / 10)); uint256 rest = address(this).balance; ...
8,254,523
./full_match/43113/0x29FB6CA56d7F4485eCBaf0AEd941d52E7A662307/sources/contracts/protocol/SetToken.sol
Takes a virtual unit and multiplies by the position multiplier to return the real unit/
function _convertVirtualToRealUnit(int256 _virtualUnit) internal view returns (int256) { return _virtualUnit.conservativePreciseMul(positionMultiplier); }
7,191,759
// SPDX-License-Identifier: MIT pragma solidity >=0.6.11; pragma experimental ABIEncoderV2; import "../StakingRewardsDualV3.sol"; contract StakingRewardsDualV3_FRAX_IQ is StakingRewardsDualV3 { constructor( address _owner, address _rewardsToken0, address _rewardsToken1, address _st...
If the period expired, renew it Failsafe check Ensure the provided reward amount is not more than the balance in the contract. This keeps the reward rate in the right range, preventing overflows due to very high values of rewardRate in the earned and rewardsPerToken functions; Reward + leftover must be less than 2^256 ...
function retroCatchUp() internal { require(block.timestamp > periodFinish, "Period has not expired yet!"); uint balance0 = rewardsToken0.balanceOf(address(this)); uint balance1 = rewardsToken1.balanceOf(address(this)); require(rewardRate0.mul(rewardsDuration).mul(num_periods_elapsed...
1,275,976
pragma solidity ^0.5.7; // ------------------------------------------------------------------------ // Math library // ------------------------------------------------------------------------ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256){ uint256 c = a * b; assert...
------------------------------------------------------------------------ Create tokens by adding to total supply and crediting the admin/owner ------------------------------------------------------------------------
function mintToken(address _target, uint256 _mintedAmount) public returns(bool){ balances[_target] = balances[_target].add(_mintedAmount); totalSupply = totalSupply.add(_mintedAmount); emit Minted(_target, _mintedAmount); emit Transfer(address(0), address(this), _mintedAmount); emit Transfer(address(this), _targ...
1,780,715
// SPDX-License-Identifier: MIT pragma solidity 0.5.6; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "../libraries/SignedSafeMath.sol"; import "../libraries/SafeCast.sol"; import "../interfaces/IRewarder.sol"; i...
Number of tokens created per block.
function _claPerBlock(uint256 blockNumber) internal view returns (uint256) { if (blockNumber < startBlock + 2 * YEAR) { return ((9e17 / CLA_REWARD_RATIO_DIVISOR) * clsRewardRatio); return ((6e17 / CLA_REWARD_RATIO_DIVISOR) * clsRewardRatio); return ((3e17 / CLA_REWARD_RAT...
13,037,228
./full_match/1/0x7132c10A5fDeb8236Be65F451c1973E26E8515EF/sources/contracts/token/ERC721/extensions/ERC721zUpgradeable.sol
Initializes the contract. Created for future use./
function __ERC721z_init() internal onlyInitializing { }
3,072,474
/** Source code of Opium Protocol Web https://opium.network Telegram https://t.me/opium_network Twitter https://twitter.com/opium_network */ // File: LICENSE /** The software and documentation available in this repository (the "Software") is protected by copyright law and accessible pursuant to the licens...
Returns whether the specified token exists _tokenId uint256 ID of the token to query the existence of return whether the token exists/
function exists(uint256 _tokenId) public view returns (bool) { return tokenTypes[_tokenId] != INVALID; }
1,368,016
/** *Submitted for verification at Etherscan.io on 2022-04-15 */ /** * We Are The Beginning But Not The End */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface...
exclude from paying fees or having max transaction amount
constructor() ERC20("UltraAlpha", "UltraAlpha") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pai...
7,863,058
//SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "./interface/IiToken.sol"; import "./interface/IRewardDistributor.sol"; import "./interface/I...
Sets the global distribution speed, updating each iToken's speed accordingly Admin function, will fail when paused _supplySpeed The speed of Reward distribution to supply side per second _borrowSpeed The speed of Reward distribution to borrow side per per second/
function _setGlobalDistributionSpeeds( uint256 _borrowSpeed, uint256 _supplySpeed ) public override onlyOwner { require(!paused, "Can not change global speed when paused"); globalDistributionSpeed = _borrowSpeed; globalDistributionSupplySpeed = _supplySpeed; _up...
6,366,959
pragma solidity ^0.4.11; /* * The MIT License (MIT) * * 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,...
Transfers ownership to newOwner, given that the sender is the owner
function transferOwnership(address newOwner) _onlyOwner { owner = newOwner; }
1,814,022
./full_match/5/0x999512dC124371E6B9ff43CE8D1AF83252F0C851/sources/lib/joe-v2/src/libraries/math/SafeCast.sol
Returns x on uint232 and check that it does not overflow x The value as an uint256 return y The value as an uint232/
function safe232(uint256 x) internal pure returns (uint232 y) { if ((y = uint232(x)) != x) revert SafeCast__Exceeds232Bits(); }
1,894,136
./partial_match/1/0xAE69a93945133c00B9985D9361A1cd882d107622/sources/TokenizedStrategy.sol
Sets the performance fee to be charged on reported gains. Can only be called by the current `management`. Denominated in Basis Points. So 100% == 10_000. Cannot be set less than the MIN_FEE. Cannot set greater than to MAX_FEE. _performanceFee New performance fee./
function setPerformanceFee(uint16 _performanceFee) external onlyManagement { require(_performanceFee >= MIN_FEE, "MIN FEE"); require(_performanceFee <= MAX_FEE, "MAX FEE"); _strategyStorage().performanceFee = _performanceFee; emit UpdatePerformanceFee(_performanceFee); }
16,059,400
./full_match/3/0x5C381C55E64BA3C1C0FC533F4c971D6b49ffc928/sources/contracts/frog.sol
Set base uRI baseURI_ base tokens uri/
function setBaseURI(string memory baseURI_) public onlyOwner { _setBaseURI(baseURI_); }
8,250,110
./partial_match/1/0x90B5D11E3Fd268879D99F9e8675622D11b097C02/sources/TG.sol
only owner can add supply controller/
function transferSupplyControllerRole(address newSupplyController) public override onlyOwner { super.transferSupplyControllerRole(newSupplyController); }
16,005,829
pragma solidity ^0.4.18; // File: contracts/MigrationTarget.sol // // Migration target // @dev Implement this interface to make migration target // contract MigrationTarget { function migrateFrom(address _from, uint256 _amount, uint256 _rewards, uint256 _trueBuy, bool _devStatus) public; } // File: con...
allow donor (msg.sender) to spend buyer's tokens
function buyFor(address buyer) payable public { uint256 _value = _buy(buyer); allowed[buyer][msg.sender] += _value; emit Approval(buyer, msg.sender, _value); }
5,510,628
./full_match/77/0x804A40d12FdeD71D41cD69a0054d371a80Cc84da/sources/deploy/contracts/synthereum-pool/v5/LiquidityPoolLib.sol
Update the fee percentage self Data type the library is attached to _feePercentage The new fee percentage/
function setFeePercentage( ISynthereumLiquidityPoolStorage.Storage storage self, FixedPoint.Unsigned calldata _feePercentage ) external { require( _feePercentage.rawValue < 10**(18), 'Fee Percentage must be less than 100%' ); self.fee.feeData.feePercentage = _feePercentage; emi...
5,046,520
pragma solidity ^0.5.0; // produced by the Solididy File Flattener (c) David Appleton 2018 // contact : dave@akomba.com // released under Apache 2.0 licence library RLPReader { uint8 constant STRING_SHORT_START = 0x80; uint8 constant STRING_LONG_START = 0xb8; uint8 constant LIST_SHORT_START = 0xc0; ...
returns raw rlp encoding in bytes
function toRlpBytes(RLPItem memory item) internal pure returns (bytes memory) { bytes memory result = new bytes(item.len); if (result.length == 0) return result; uint ptr; assembly { ptr := add(0x20, result) } copy(item.memPtr, ptr, item....
15,852,655
/** *Submitted for verification at Etherscan.io on 2021-04-19 */ // Sources flattened with hardhat v2.0.3 https://hardhat.org // File deps/@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Wrappers over Solidity's arithmetic operat...
Get the cumulative number of tokens claimed for an account, given a list of tokens
function getClaimedFor(address user, address[] memory tokens) public view returns (address[] memory, uint256[] memory) { uint256[] memory userClaimed = new uint256[](tokens.length); for (uint256 i = 0; i < tokens.length; i++) { userClaimed[i] = claimed[user][tokens[i]]; } ...
5,865,522
/* Copyright 2018 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
Calculates EIP712 encoding for a hash struct in this EIP712 Domain. hashStruct The EIP712 hash struct. return EIP712 hash applied to this EIP712 Domain.
function hashEIP712Message(bytes32 hashStruct) internal view returns (bytes32) { return keccak256(abi.encodePacked(EIP191_HEADER, EIP712_DOMAIN_HASH, hashStruct)); }
1,073,075
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC1155/ERC1155.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queri...
xref:ROOT:erc1155.adocbatch-operations[Batched] version of {_mint}. Requirements: - `ids` and `amounts` must have the same length. - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the acceptance magic value./
function _mintBatch( address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _...
5,879,061
pragma solidity ^0.4.17; contract RevertProxy { bytes data; function() public { data = msg.data; } // solium-disable security/no-low-level-calls function execute(address _target) external returns (bool) { return _target.call(data); } }
solium-disable security/no-low-level-calls
function execute(address _target) external returns (bool) { return _target.call(data); }
6,379,158
./partial_match/42220/0xE0F2cc70E52f05eDb383313393d88Df2937DA55a/sources/Swap.sol
withdraw all admin fees to a given address self Swap struct to withdraw fees from to Address to send the fees to/
function withdrawAdminFees(Swap storage self, address to) external { for (uint256 i = 0; i < self.pooledTokens.length; i++) { IERC20 token = self.pooledTokens[i]; uint256 balance = token.balanceOf(address(this)).sub(self.balances[i]); if (balance != 0) { ...
3,500,270
./full_match/137/0x2A29dB56F0e7e9Dd6f8e1e16EE69D1F48D6A43D9/sources/contracts/MasterChef.sol
Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; if (block.number <= pool.lastRewardBlock) { return; } uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (lpSupply == 0 || pool.allocPoint == 0) { pool.lastRew...
4,722,221
./full_match/4/0x9bd1c031423ad95ed6C7b46B3Fa9a733C4361a3C/sources/contracts/Market.sol
Executes the sale for a published NFT nftAddress - Address of the NFT registry assetId - ID of the published NFT/
function executeOrder(address nftAddress, uint256 assetId) external { _executeOrder(nftAddress, assetId); }
12,382,544
pragma solidity ^0.4.16; interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; } contract WBIToken { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 18 decimals is the s...
Internal transfer, only can be called by this contract/ Prevent transfer to 0x0 address. Use burn() instead Check if the sender has enough Check for overflows Save this for an assertion in the future Subtract from the sender Add the same to the recipient Asserts are used to use static analysis to find bugs in your code...
function _transfer(address _from, address _to, uint _value) internal { require(_to != 0x0); require(balanceOf[_from] >= _value); require(balanceOf[_to] + _value > balanceOf[_to]); uint previousBalances = balanceOf[_from] + balanceOf[_to]; b...
10,326,635
pragma solidity ^0.4.21; /** * Math operations with safety checks */ library SafeMath { function mul(uint a, uint b) internal pure returns (uint) { uint c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint a, uint b) internal pure returns (uint) { // ass...
Check the amount of grants that an address has. _holder The holder of the grants. return A uint representing the total amount of grants./
function tokenGrantsCount(address _holder) public view returns (uint index) { return grants[_holder].length; }
65,332
./partial_match/80001/0x3715FE0c0E39c2D28dB7f374Fe1F58481da51697/sources/contracts/interfaces/plugins/IDynamicFeeManager.sol
The interface for the Algebra dynamic fee manager This contract calculates adaptive fee
interface IDynamicFeeManager is IAlgebraDynamicFeePlugin { event FeeConfiguration(AlgebraFeeConfiguration feeConfig); function feeConfig() external view returns (uint16 alpha1, uint16 alpha2, uint32 beta1, uint32 beta2, uint16 gamma1, uint16 gamma2, uint16 baseFee); function changeFeeConfiguration(AlgebraFeeCon...
8,820,004
./full_match/1/0xa22Bd52116359e0cC8Fe21De52A959922CC7dF2a/sources/contracts/MarketingVoting.sol
Add an option `_option` is an option of answers on question
function addOption(string memory _option) external onlyRole(CONFIGURATOR_ROLE) { require(!_isStringEmpty(_option), "MarketingVoting: option is an empty string"); Option memory option = Option(_option, true); options.push(option); optionsCount++; }
16,466,160
./full_match/80001/0x5ccdEd3f094A02551e22C2D5d3c3834835942D48/sources/src/libraries/JoeLibrary.sol
given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset
function getAmountOut( uint256 amountIn, uint256 reserveIn, uint256 reserveOut ) internal pure returns (uint256 amountOut) { if (amountIn == 0) revert JoeLibrary__InsufficientAmount(); if (reserveIn == 0 || reserveOut == 0) revert JoeLibrary__InsufficientLiquidity(); ...
9,534,698
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; import "library.sol"; /** * @title Implementation of the {IERC20} interface. * @dev defines a dynamically generated ERC20-compliant option contract with given expiry date */ contract Option is Context, IOption { using SafeMath for uint256; /// @dev...
Sets `amount` as the allowance of `spender` over the `owner` s tokens. This internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. - `spender` cannot be the zero address./
function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); rounds[currentRound].allowances[owner][spender] = amount; ...
15,832,605
pragma solidity ^0.6.2; import './Memory.sol'; /** * @dev Interface poseidon hash function */ contract PoseidonUnit { function poseidon(uint256[] memory) public pure returns(uint256) {} } /** * @dev Rollup helper functions */ contract RollupHelpers { using Memory for *; PoseidonUnit insPoseidonUnit; s...
build on-chain Hash oldOnChainHash previous on chain hash txData transaction data coded into a bytes32 loadAmount input amount dataOnChain poseidon hash of the onChain data fromEthAddr ethereum addres sender return entry structure/ build element 1 build element 2 build element 3 build element 4 build element 5
function buildOnChainHash( uint256 oldOnChainHash, uint256 txData, uint128 loadAmount, uint256 dataOnChain, address fromEthAddr ) internal pure returns (Entry memory entry) { entry.e1 = bytes32(oldOnChainHash); entry.e2 = bytes32(txData); entry.e3 = bytes32(bytes16(loadAmount)) >> ...
12,971,283
pragma solidity ^0.4.16; 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...
Internal transfer, only can be called by this contract /
function _transfer(address _from, address _to, uint _value) internal { Transfer(_from, _to, _value); }
460,877
./partial_match/1/0x0cAD0089AA44FAC9A941D27649AB452ae38126b9/sources/WHALE.sol
once enabled, can never be turned off
function swimWhale() external onlyOwner { tradingActive = true; swapEnabled = true; }
9,347,879
pragma solidity ^0.4.20; contract AssetTransfer /* is WorkbenchBase('AssetTransfer', 'AssetTransfer') */ { enum StateType { Active, OfferPlaced, PendingInspection, Inspected, Appraised, NotionalAcceptance, BuyerAccepted, SellerAccepted, Accepted, Terminated } address public InstanceOwner; string public Des...
Cannot enforce "AllowedRoles":["Buyer"] because Role information is unavailable
function MakeOffer(address inspector, address appraiser, uint256 offerPrice) public { if (inspector == 0x0 || appraiser == 0x0 || offerPrice == 0) { revert(); } if (State != StateType.Active) { revert(); } { revert(); ...
13,038,252
pragma solidity ^0.8.0; pragma abicoder v2; import "./DELEGATE.sol"; interface iAppStore{ function install(uint256 appNumber) external view returns(string memory name,string[] memory names,address[] memory cons); } interface iApp{ function lock(address _lock) external; } interface iOverview{ fun...
/constituteOf[_constitute[i]] = appNext;
function install(uint256 _appStoreNumber,address lockAddress) external { beforeSelf(msg.data); (string memory _name,string[] memory names,address[] memory _constitute) = iAppStore(appStore).install(_appStoreNumber); apps[appNext].name = _name; require(nameToIndex[_name] == 0,"OS/inst...
13,137,171
./full_match/1/0x0487443E94356E4C9677151b11d5048710bA80A8/sources/contracts/abstract/ERC721.sol
See {IERC721-approve}./
function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); if (to == owner) revert APPROVAL_TO_CURRENT_OWNER(); if (_msgSender() != owner && !isApprovedForAll(owner, _msgSender())) revert CALLER_NOT_OWNER_OR_APPROVED(); _approve(to, tokenI...
3,876,767
// File: REMIX_FILE_SYNC/openzeppelin-solidity/contracts/math/SafeMath.sol pragma solidity ^0.4.21; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) intern...
Removes an approved on bhealf of user address./
function removeApprovedWithdrawAddress(address _withdrawAddress) external onlyOwner { delete approvedWithdrawAddresses[_withdrawAddress]; emit WithdrawAddressRemoved(_withdrawAddress); }
890,405
./full_match/11155111/0x4Ac3832d773FE6B6dcC8EB6241B83212F1a55096/sources/contracts/discovery/GNS.sol
Build a subgraph ID based on the account creating it and a sequence number for that account. Subgraph ID is the keccak hash of account+seqID return Subgraph ID/ Too bad solidity 0.7.6 still doesn't have block.chainid solhint-disable-next-line no-inline-assembly
function _buildSubgraphID(address _account, uint256 _seqID) internal pure returns (uint256) { uint256 chainId; assembly { chainId := chainid() } return uint256(keccak256(abi.encodePacked(_account, _seqID, chainId))); }
3,811,943
// SPDX-License-Identifier: MIT // Copyright (C) 2020, 2021, 2022 Swap.Pet@pm.me // contracts/ChainlinkOracle.sol pragma solidity ^0.6.0; // import './interfaces/ISPTERC20.sol'; import './lib/SafeMath.sol'; /// @dev ERC20 of Swap.Pet Tokens(SPTERC20), compatible with OpenZeppelin ERC20 contract SPTERC20{ using Sa...
plus function for ERC20 of OpenZeppelin
function permit(address owner_, address spender_, uint amount_, uint deadline_, uint8 v_, bytes32 r_, bytes32 s_) external { require(deadline_ >= block.timestamp, 'SPTERC20: permit expired!'); bytes32 digest = keccak256( abi.encodePacked( '\x19\x01', DOMAI...
14,018,954
// hevm: flattened sources of src/DssSpell.sol // SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity =0.6.12 >=0.5.12 >=0.6.12 <0.7.0; pragma experimental ABIEncoderV2; ////// lib/dss-exec-lib/src/CollateralOpts.sol /* pragma solidity ^0.6.12; */ struct CollateralOpts { bytes32 ilk; address gem; a...
Office Hours defaults to true by default. To disable office hours, override this function and return false in the inherited action.
function officeHours() public virtual returns (bool) { return true; }
1,137,462
/*** * ███████╗██████╗ ██████╗███████╗██████╗ ██╗ ██╗ ██╗██████╗ * ██╔════╝██╔══██╗██╔════╝╚════██║╚════██╗███║ ██║ ██║╚════██╗ * █████╗ ██████╔╝██║ ██╔╝ █████╔╝╚██║ ██║ ██║ █████╔╝ * ██╔══╝ ██╔══██╗██║ ██╔╝ ██╔═══╝ ██║ ...
will return minting fees
function minterFees() external view override(IMAX721) returns (uint256) { return mintFees; }
909,656
./full_match/1/0x75740D9b5cA3BCCb356CA7f0D0dB71aBE427a835/sources/src/contracts/ERC20SwapToPay.sol
Authorizes the swap router to spend a new payment currency (ERC20). _erc20Address Address of an ERC20 used for payment/
function approveRouterToSpend(address _erc20Address) public { IERC20 erc20 = IERC20(_erc20Address); uint256 max = 2**256 - 1; erc20.safeApprove(address(swapRouter), max); } @param _path, path of ERC20 tokens to swap from requestedToken to spentToken. The first address of the path should...
8,332,900
./full_match/80001/0x0aCca12ade732F5Dc6afbad42ad1Eb5F0163e663/sources/contracts/dev/functions/AuthorizedOriginReceiverUpgradeable.sol
Remove the permission to request for the given wallet(s). senders The addresses of the wallet addresses to revoke access/ Remove from s_authorizedSendersList Copy last element and overwrite senders[i] to be deleted with it
function removeAuthorizedSenders(address[] calldata senders) external validateAuthorizedSenderSetter { if (senders.length == 0) { revert EmptySendersList(); } for (uint256 i = 0; i < senders.length; i++) { bool success = s_authorizedSenders.remove(senders[i]); if (success) { for ...
5,561,719
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../libs/AddressSet.sol"; import "./ComplexPoolLib.sol"; import "../interfaces/INFTGemMultiToken.sol"; import "../interfaces/INFTCompl...
returns an array of all allowed token sources/
function allowedTokenSources() external view override returns (address[] memory) { return poolData.allowedTokenSources.keyList; }
1,040,403
./full_match/137/0xCB31Ea2A9233624f249248377c46C3095514B331/sources/project:/contracts/TokenizedBonds.sol
Set URI per token. ids[] Array of token ids cids[] Array of token content identifiers (CIDs) Requirements: - must be called by the contract owner. - `ids` and `cids` must have the same length./
function setURIs( uint256[] calldata ids, string[] calldata cids ) external virtual onlyOwner { uint256 count = ids.length; require( count == cids.length, "TokenizedBonds: ids and cids length mismatch" ); for (uint256 i = 0; i < count; i++...
4,731,797
// Contracts/SupplyChain.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "../emeraldaccesscontrol/MinerRole.sol"; import "../emeraldaccesscontrol/LaboratoryRole.sol"; import "../em...
Define a function 'buyFromManufacturer' that allows the manufacturer to mark an item 'Buyed' Call modifier to check if upc has passed previous supply chain stage Call modifer to check if buyer has paid enough Call modifer to send any excess ether back to buyer Update the appropriate fields - ownerID, consumerID, itemSt...
function buyFromManufacturer(uint _upc) public payable published(_upc) paidEnough(emeralds[_upc].GetMarketPrice()) checkValue(_upc) onlyCustomer { emeralds[_upc].SetEmeraldState(EmeraldStates.State.Buyed); require(success, "Transfer failed"); emeralds[_upc].SetCustomerID...
5,454,288
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; import { IPool } from "./balancer/IPool.sol"; import { PriceLibrary as Prices } from "./lib/PriceLibrary.sol"; import "./lib/FixedPoint.sol"; import "./lib/Babylonian.sol"; import { MCapSqrtLibrary as MCapSqrt } from "./lib/M...
Estimate the total value of a pool by taking its first token's "virtual balance" (balance (totalWeight/weight)) and multiplying by that token's average ether price from UniSwap./
function _estimatePoolValue(IPool pool) internal view returns (uint144) { (address token, uint256 value) = pool.extrapolatePoolValueFromToken(); FixedPoint.uq112x112 memory price = oracle.computeAverageTokenPrice(token); return price.mul(value).decode144(); }
1,766,714
// File @openzeppelin/contracts/math/Math.sol@v2.5.1 pragma solidity ^0.5.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return ...
function store() external view returns (address); hard work should be callable only by the controller (by the hard worker) or by governance
interface IVault { function initializeVault( address _storage, address _underlying, uint256 _toInvestNumerator, uint256 _toInvestDenominator ) external ; function balanceOf(address) external view returns (uint256); function underlyingBalanceInVault() external view returns (uin...
169,400
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract UniqlyClaimingByAdmin is Ownable{ /// ----- VARIABLES ----- /// /// ...
Returns all token holders addresses
function getAllTokenHoldersAddressesHistory(address _address, uint _id) external view returns(address[] memory){ uint len = _ownersCount[_address][_id]; if (len == 0){ return new address[](0); } address[] memory res = new address[](len); uint index; for(in...
6,407,575
/* __ __ .__ .___ _____ / \ / \___________| | __| _/ _____/ ____\ \ \/\/ / _ \_ __ \ | / __ | / _ \ __\ \ ( <_> ) | \/ |__/ /_/ | ( <_> ) | ...
See {IGovernor-castVoteBySig}./
function castVoteBySig( uint256 proposalId, uint8 support, uint8 v, bytes32 r, bytes32 s ) public virtual override returns (uint256) { address voter = ECDSA.recover( _hashTypedDataV4( keccak256(abi.encode(BALLOT_TYPEHASH, proposalId, su...
285,485
./full_match/56/0x5B99e0893225178dBf4Ffe9FfD2142a21E8d1087/sources/src/strategies/ApeLendingStrategy.sol
Changes the existing BANANA on the contract to an asset token.
function _swapBananaToAsset() internal { uint256 bananaBalance = compToken.balanceOf( address(this) ); if (bananaBalance < minBananaToSell) { return; } pancakeRouter.swapExactTokensForTokens( bananaBalance, 0, _toke...
3,226,540
pragma solidity 0.5.11; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/ownership/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../../interfaces/DharmaSmartWalletFactoryV1Interface.sol"; import "../../interfaces/RelayContractInterface.sol"; /** * @title RelayMigrat...
End relay contract registration. Only the owner may call this function./
function endRegistration() external onlyOwner { require(!registrationCompleted, "Registration is already completed."); registrationCompleted = true; }
1,765,731
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IUniswapV2Pair { function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); } interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint...
exclude any wallet for limited number of transactions in lower time scale
function excludedFromTimeTx(address _address, bool _exclude) external onlyOwner { _isExcludedFromTimeTx[_address] = _exclude; }
5,850,897
./full_match/80001/0x47dF6CecAB93B0B4DEEB173537bdDe7857ED629A/sources/contracts/Lottery.sol
Function to allow users to get lottery tickets in exchange for tokens (ETH in this case)
function getTicketToken(uint256 amount) external payable nonReentrant { currenttime = block.timestamp; if (currenttime < lotterystarttime || currenttime > lotteryendtime) { revert NotInRightState(); } prizeamount += price; require(success, "Transaction failed")...
865,398