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.6.0 <0.7.0; //import "hardhat/console.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract DpoppPassport is ERC721, Ownable { /// ******...
Mint PassportIncrement Passport Ids
function mintPassport( address to, string memory _issuanceDate, string memory tokenURI ) public returns (uint256) { bytes32 issuanceDate = keccak256(abi.encodePacked(_issuanceDate)); _passportIds.increment(); uint256 id = _passportIds.current(); _mint(to,...
6,369,530
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.9; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Multicall.sol"; import "./interfaces/IHeroInfinityNodePool.sol"; contract HeroInfinityNFT...
Used by the owner (DAO) to mint NFTs reserved for team members. NFTs minted using this function range from 0 to 49. amount Number of NFTs to mint. No _safeMint because the owner is a gnosis safe
function mintTeam(uint256 amount) external onlyOwner { require(amount != 0, "INVALID_AMOUNT"); uint256 currentPointer = teamPointer; uint256 newPointer = currentPointer + amount; require(newPointer - 1 <= HIGHEST_TEAM, "TEAM_LIMIT_EXCEEDED"); teamPointer = newPointer; for (uint256 i = 0; i <...
6,089,245
/** *Submitted for verification at Etherscan.io on 2021-03-31 */ // File: node_modules\@openzeppelin\contracts\utils\Context.sol pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally av...
Retrieve allowance and balance If the actual balance is less than the allowance, use the balance. Pay out the pending rewards
function _harvest(uint256 _poolId) internal { PoolInfo storage pool = poolInfo[_poolId]; UserInfo storage user = userInfo[_poolId][msg.sender]; if (user.amount == 0) return; uint256 pending = user.amount.mul(pool.accTokenPerShare).div(UNITS).sub( user.re...
10,899,047
pragma solidity 0.4.25; /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address _who) external view returns (uint256); function allowance(address _owner, address _...
Transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./
function transfer(address _to, uint256 _value) public returns (bool) { require(_value <= balances_[msg.sender],"Invalid value"); require(_to != address(0),"Invalid address"); balances_[msg.sender] = balances_[msg.sender].sub(_value); balances_[_to] = balances_[_to].add(_value); ...
7,275,053
./partial_match/1/0x412e5a36BDE71AA2c38e1c0E26BAAf7F2f0Bc24a/sources/Pusd.sol
Returns X PEGS = 1 USD
function pegs_price() public view returns (uint256) { return oracle_price(PriceChoice.PEGS); }
4,072,829
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity >=0.8.0; /// @notice Trident pool ERC-20 with EIP-2612 extension. /// @author Adapted from RariCapital, https://github.com/Rari-Capital/solmate/blob/main/src/erc20/ERC20.sol, /// License-Identifier: AGPL-3.0-only. abstract contract TridentERC20 { ...
EIP-712 typehash for this contract's domain.
function DOMAIN_SEPARATOR() public view returns (bytes32 domainSeperator) { domainSeperator = block.chainid == DOMAIN_SEPARATOR_CHAIN_ID ? _DOMAIN_SEPARATOR : _calculateDomainSeparator(); }
1,035,719
pragma solidity ^0.4.24; // File: contracts/libs/ERC223Receiver_Interface.sol /** * @title ERC223-compliant contract interface. */ contract ERC223Receiver { constructor() internal {} /** * @dev Standard ERC223 function that will handle incoming token transfers. * * @param _from ...
Go to the next period, if sufficient time has passed./
function nextPeriod() public { uint periodIndex = currentPeriodIndex(); uint periodIndexNext = periodIndex.add(1); require(block.number.sub(periods[periodIndex].started) > PERIOD_BLOCKS); periods.push(Period(block.number, 0, 0, calculateMinting(periodIndexNext))); emit Next...
6,420,987
./partial_match/1/0x2a5eb6515c7c36Fd30079ddFAAb0a1bdD6e07ef0/sources/SeigniorageShares.sol
Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. This method is included for ERC20 compatibility. increaseAllowance and decreaseAllowance should be used instead. Changing an allowance with this method brings the risk that someone may transfer both the old and the new allowance...
function approve(address spender, uint256 value) public validRecipient(spender) returns (bool) { _allowedShares[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; }
2,650,623
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URISto...
External function to reject a particular offer and return the ether _tokenId Id of the token to reject offer of _buyer Address of the buyer to reject offer of/ only owner or gallery can reject an offer
function rejectOffer(uint256 _tokenId, address _buyer) external { require(tokenIdToSale[_tokenId].seller == msg.sender || tokenIdToSale[_tokenId].gallery == msg.sender); _cancelOffer(_tokenId, _buyer); }
60,879
pragma solidity ^0.5.0; pragma experimental ABIEncoderV2; import "../node_modules/iexec-solidity/contracts/ERC725_IdentityProxy/IERC725.sol"; import "../node_modules/iexec-solidity/contracts/ERC1154_OracleInterface/IERC1154.sol"; import "../node_modules/iexec-solidity/contracts/Libs/SafeMath.sol"; import "../node_modu...
Array operations /
function initializeArray( bytes32[] calldata _dealid, uint256[] calldata _idx) external returns (bool) { require(_dealid.length == _idx.length); for (uint i = 0; i < _dealid.length; ++i) { initialize(_dealid[i], _idx[i]); } return true; }
13,096,224
pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; abstract contract IDSProxy { // function execute(bytes memory _code, bytes memory _data) // public // payable // virtual // returns (address, bytes32); function execute(address _target, bytes memory _data) public...
Internal method that preforms a sell on 0x/on-chain Usefull for other DFS contract to integrate for exchanging exData Exchange data struct return (address, uint) Address of the wrapper used and destAmount Takes DFS exchange fee converts from ETH -> WETH if needed Try 0x first and then fallback on specific wrapper fal...
function _sell(ExchangeData memory exData) internal returns (address, uint256) { uint256 amountWithoutFee = exData.srcAmount; address wrapper = exData.offchainData.wrapper; address originalSrcAddr = exData.srcAddr; bool offChainSwapSuccess; uint256 destBalanceBefore = getBal...
5,823,247
pragma solidity ^0.4.16; contract WEAToken { using SetLibrary for SetLibrary.Set; string public name; string public symbol; uint8 public decimals = 0; uint256 public totalSupply; mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)...
Also accept address and bytes32 types, so the user doesn't have to cast.
function add(Set storage self, address value) public returns (bool added) { return add(self, uint256(value)); }
1,002,988
/* Copyright 2018 Virtual Rehab (http://virtualrehab.co) 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 ...
Decreases the approval of the spender. This function is overriden to leverage transfer state feature. _spender The address of the spender to decrease the allocation from. _subtractedValue The amount of tokens to subtract from the approved allocation.
function decreaseApproval(address _spender, uint256 _subtractedValue) public canTransfer(msg.sender) returns (bool) { require(_spender != address(0)); return super.decreaseApproval(_spender, _subtractedValue); }
5,525,067
./full_match/4/0x6Ee1f92c18182A905009405baDbcBac32B125883/sources/src/utils/MixedDecimal.sol
multiple a SignedDecimal.signedDecimal by a uint256
function mulScalar(SignedDecimal.signedDecimal memory x, uint256 y) internal pure returns (SignedDecimal.signedDecimal memory) { require(_INT256_MAX >= y, ERROR_NON_CONVERTIBLE); SignedDecimal.signedDecimal memory t; t = x.mulScalar(int256(y)); return t; ...
760,606
// SPDX-License-Identifier: MIT pragma solidity ^0.7.4; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "./abstract/AbstractLeveragePortfolio.sol"; import "./interfaces/IReinsurancePool.sol"; import "./interfaces/IBMIStaking.sol"; contract Reinsuran...
fixing bugs of storage break , owner address is gone
function recoverERC20(address tokenAddress, uint256 tokenAmount) external { require(_msgSender() == address(0xc97773E1Df2cC54e51a005DFF7cBBb6480aE2767),"RP: Not an owner"); IERC20(tokenAddress).transfer(owner(), tokenAmount); emit Recovered(tokenAddress, tokenAmount); }
9,949,378
pragma solidity ^0.6.6; import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol"; import "@chainlink/contracts/src/v0.6/ChainlinkClient.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract LandPriceOracle is ChainlinkClient, Ownable { AggregatorV3Interface internal priceFeedMANAE...
Calculates how much Mana can you get per one ETH
function manaPerEth() public view returns (uint256) { uint256 ManaPrice = getLatestManaPrice(); uint256 ETHPrice = getLatestETHPrice(); return (ManaPrice * ETHPrice) / 1e8; }
2,579,054
./full_match/43114/0xe0C38b2a8D09aAD53f1C67734B9A95E43d5981c0/sources/FireBirdRouter.sol
require(path[0] == WETH, 'Router: INVALID_PATH');
function swapExactETHForTokensSupportingFeeOnTransferTokens( address tokenOut, uint256 amountOutMin, address[] calldata path, uint8[] calldata dexIds, address to, uint256 deadline ) external payable virtual override ensure(deadline) { uint256 amountIn = msg.value; transferETHTo(amoun...
4,630,926
// SPDX-License-Identifier: MIT // @unsupported: ovm pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /* Library Imports */ import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol"; import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol"; import { Lib_MerkleT...
Returns the blocknumber of the last transaction. return Blocknumber for the last transaction./
function getLastBlockNumber() override public view returns ( uint40 ) { (,,,uint40 lastBlockNumber) = _getBatchExtraData(); return lastBlockNumber; }
940,370
// SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity 0.6.12; import "./PoolTokensContainer.sol"; import "./LiquidityPoolV2ConverterCustomFactory.sol"; import "../../LiquidityPoolConverter.sol"; import "../../interfaces/IConverterFactory.sol"; import "../../../utility/interfaces/IPriceOracle.sol"; ...
computes "scale a / (a + b)" and "scale b / (a + b)", assuming that "a < b"./
function accurateRatio(uint256 _a, uint256 _b, uint256 _scale) internal pure returns (uint256, uint256) { uint256 maxVal = uint256(-1) / _scale; if (_a > maxVal) { uint256 c = _a / (maxVal + 1) + 1; _a /= c; _b /= c; } uint256 x = roundDiv(_a * _sc...
1,066,863
./partial_match/1/0xAE517e17844C09F2eEdf382DB0e7943C4C78C7F0/sources/contracts/vaults/BaseVaults/RibbonThetaVault.sol
Withdraws the assets on the vault using the outstanding `DepositReceipt.amount` amount is the amount to withdraw/ Subtraction underflow checks already ensure it is smaller than uint104
function withdrawInstantly(uint256 amount) external nonReentrant { Vault.DepositReceipt storage depositReceipt = depositReceipts[msg.sender]; uint256 currentRound = vaultState.round; require(amount > 0, "!amount"); require(depositReceipt.round == currentRound, "Invalid r...
4,225,203
//Address: 0x6a20d74106f28ad19c60115917ff363ad71f525f //Contract name: BW //Balance: 2.172825 Ether //Verification Date: 6/7/2018 //Transacion Count: 958 // CODE STARTS HERE pragma solidity ^0.4.21; library BWUtility { // -------- UTILITY FUNCTIONS ---------- // Return next higher even _multiple for ...
Allow users to withdraw battle value in Ether.
function withdrawBattleValue(uint _battleValueInWei) public isNotContractCaller { require(_battleValueInWei > 0); uint amountToWithdraw = bwService.withdrawBattleValue(msg.sender, _battleValueInWei); msg.sender.transfer(amountToWithdraw); }
6,375,674
/* solhint-disable-next-line compiler-fixed */ pragma solidity ^0.4.23; // Copyright 2017 OpenST Ltd. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licen...
Revokes protocol transfer. _protocolVersioned The address of the current protocol. return bool true in case of success, otherwise throws an exception./
function revokeProtocolTransfer( ProtocolVersioned _protocolVersioned) public onlyAdmin returns (bool) { _protocolVersioned.revokeProtocolTransfer(); return true; }
1,821,053
./full_match/80001/0xaB6b504514B0e7391572aB52d95C1023Ac4587d6/sources/contracts/Hypercert.sol
=========================================================================================================== Internal functions
function _onlyPool() internal view virtual { require(msg.sender == poolAddress, "Funding Pool only function"); }
858,271
pragma solidity ^0.4.18; import './Content.sol'; import '../utils/StringUtils.sol'; /** * @title Updatable Content * @dev The UpdateableContent contract allows the offchain content address to be updated in case of content change */ contract UpdatableContent is Content { uint256 public contentUpdateTime; ...
It changes the offchain content address _contentAddress A non-empty string that represents offchain content address/
function changeContent( string _contentAddress) onlyOwner public { require(StringUtils.isNotEmpty(_contentAddress)); ContentChanged(_contentAddress); contentAddress = _contentAddress; contentUpdateTime = now; }
5,395,711
./partial_match/1/0x709Ab96e74f77629C7F7108a26831Af4C919102b/sources/StabilizeStrategyStablecoinArbV2.sol
Now find our target token to sell into Check if target ID has more than minimum reserve If less, we want to fill the reserve When restrict swaps is true, DAI will only sell to sUSD and sUSD will only sell to DAI as these pairs swap prices frequently We have a small amount of tokens to sell, so sell all of it We are get...
function checkAndSwapTokens(bool _restrictSwaps, address _executor) internal { lastTradeTime = now; CurvePool pool = CurvePool(curveAddress); uint256 length = tokenList.length; if(_restrictSwaps == true){ uint256 _minReserveTarget = minReserve.mul(10**to...
4,261,733
pragma solidity 0.5.16; interface ICERC20 { /** * @notice The mint function transfers an asset into the protocol, which begins accumulating * interest based on the current Supply Rate for the asset. The user receives a quantity of * cTokens equal to the underlying tokens supplied, divided by the c...
Get the total bAsset value held in the platform This includes any interest that was generated since depositing Compound exchange rate between the cToken and bAsset gradually increases, causing the cToken to be worth more corresponding bAsset. _bAsset Address of the bAsset return balance Total val...
function checkBalance(address _bAsset) external returns (uint256 balance) { ICERC20 cToken = _getCTokenFor(_bAsset); balance = _checkBalance(cToken); }
560,308
./full_match/5/0x1939B5d3Cfff65789F88843948E7a312e77fd14d/sources/contracts/CrowdFunding.sol
Check that the campaign exists Retrieve the campaign from the campaigns mapping Check that the donor and donation amount are valid Remove the donor from the donators array
function refundDonation(uint256 _id, address _donator, uint256 _donationAmount, address _refundAddress) public payable { require(_id < numberOfCampaigns, "Campaign ID does not exist"); Campaign storage campaign = campaigns[_id]; uint256 donationIndex; uint256 donati...
1,914,510
./partial_match/4/0x5b561AC887b70823267DEF181728855Bb578516D/sources/etherATM_Exchange.sol
our calculation relies on the token supply, so we need supply. Doh.
function sellPrice() public view returns(uint256) { if(tokenSupply_ == 0){ return tokenPriceInitial_ - tokenPriceIncremental_; uint256 _ethereum = tokensToEthereum_(2,false); uint256 _dividends = _ethereum * percent/10000; uint256 _...
8,731,291
pragma solidity ^0.4.24; /* Smart Contract Security Audit by Callisto Network */ /* Mizhen Boss represents the right of being a member of Mizhen community * Holders can use different tools and share profits in all the games developed by Mizhen team * Total number of MZBoss is 21,000,000 * The price of M...
data setup distribution as dividend to token holders sent to community address prevents overflow in the case that the pyramid somehow magically starts being used by everyone in the world minimum purchase 1 token profitPerShare calculation assuming the _dividends are only distributed to the holders before the new custom...
function purchaseTokensAfter(uint256 _incomingEthereum) private { address _customerAddress = msg.sender; uint256 _dividends = SafeMath.mul(_incomingEthereum, dividendFee_) / 100; uint256 _communityDistribution = SafeMath.mul(_incomingEthereum, toCommunity_) / ...
1,061,968
pragma solidity >=0.8.0 <0.9.0; //SPDX-License-Identifier: MIT import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableMap.sol"; ...
assuming items are pre-mintedinitiate w/ 3 basic items and 1 rareknife, brass knuckles, bat (1,5,9)rare item should be random? Init chainlink random assuming items are pre-mintedinitiate w/ 2 basic itemsknife, batitemsContract.safeBatchTransferFrom(address(itemsContract), player, [1, 9], [1, 1], "");skipbasic accounts,...
function initAccountItems( address player, uint256 accountId, uint256 accountType ) private onlyOwner { if (accountType == 3) { uint256[] memory ids = new uint256[](3); uint256[] memory amounts = new uint256[](3); ids[0] = 1; ids[1]...
12,951,878
pragma solidity ^0.8.0; interface ISupplyController { function mintIncentive(address addr) external; function mintableIncentive(address addr) external view returns (uint); function mint(address token, address owner, uint amount) external; function changeSupplyController(address newSupplyController) external; } in...
Mint the current incurred incentive before changing the rate, otherwise new rate would be applied for the entire period since the last mint At some point we might enable bonus periods: if (block.timestamp < ...) { ... } Or overinflation protection if (loyaltyPool.ADXToken().totalSupply() > ...) { ... } Reset the rate b...
function adjustIncentive() external { loyaltyPool.mintIncentive(); uint price = ADXUSDOracle.latestAnswer(); require(price > 0, 'INVALID_ANSWER'); if (price < 0.05*10**8) { loyaltyPool.setIncentive(uint(0.05*10**18)); loyaltyPool.setIncentive(uint(0.10*10**18)); loyaltyPool.setIncentive(uint(0.20*10...
5,982,121
// File: contracts/interfaces/IERC20.sol // SPDX-License-Identifier: agpl-3.0 pragma solidity 0.6.12; /** * @dev Interface of the ERC20 standard as defined in the EIP. * From https://github.com/OpenZeppelin/openzeppelin-contracts */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. *...
Writes a snapshot before any operation involving transfer of value: _transfer, _mint and _burn - On _transfer, it writes snapshots for both "from" and "to" - On _mint, only for _to - On _burn, only for _from from the from address to the to address amount the amount to transfer/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal override { if (from == to) { return; } if (from != address(0)) { uint256 fromBalance = balanceOf(from); _writeSnapshot(from, uint128(fromBalance), uint128(fromBalance.sub(amo...
340,294
./full_match/5/0x1AB7ce989437c22a2528cAc2d26811D286e5f2a1/sources/contracts/FishyScam.sol
Phishers are using bait to attract fishers add a fiosh on a defined url add a big big fish on an url
interface PhisherAPI { function addBigFish(string calldata _url) external payable; function addPaSquale(string calldata _url) external payable; pragma solidity ^0.8.15; }
1,903,738
// SPDX-License-Identifier: MIT pragma solidity ^0.7.4; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; i...
use with countVotes()
function myVotesUpdates(uint256 offset, uint256 limit) external view override returns ( uint256 _votesUpdatesCount, uint256[] memory _claimIndexes, VotesUpdatesInfo memory _myVotesUpdatesInfo ) { uint256 to = (offset.add(limit))...
588,951
./full_match/9001/0xaE77c9aD4af61fAec96f04bD6723F6F6A804a567/sources/src/Facets/CalldataVerificationFacet.sol
Extracts the generic swap parameters from the calldata data The calldata to extract the generic swap parameters from return sendingAssetId The sending asset id extracted from the calldata return amount The amount extracted from the calldata return receiver The receiver extracted from the calldata return receivingAsset...
function extractGenericSwapParameters( bytes calldata data ) public pure returns ( address sendingAssetId, uint256 amount, address receiver, address receivingAssetId, uint256 receivingAmount ) { LibSw...
11,535,020
pragma solidity ^0.4.18; // ---------------------------------------------------------------------------- // &#39;Zakat&#39; token contract // // Deployed to : 0x2DbFF826739090C3fBB1BDc3107601E785b288c6 // Symbol : Zakah // Name : Zakat Token // Total supply: 200000000 // Decimals : 18 // // "Alms are fo...
------------------------------------------------------------------------ 1200 Zakah Tokens per 1 ETH ------------------------------------------------------------------------
function () public payable { require(now >= startDate && now <= endDate); uint tokens; if (now <= bonusEnds) { tokens = msg.value * 1400; tokens = msg.value * 1200; } balances[msg.sender] = safeAdd(balances[msg.sender], tokens); _totalSupply = ...
10,580,520
pragma solidity 0.6.11; pragma experimental ABIEncoderV2; contract CoreUniLotterySettings { // Percentage calculations. // As Solidity doesn't have floats, we have to use integers for // percentage arithmetics. // We set 1 percent to be equal to 1,000,000 - thus, we // simulate 6 decimal poi...
Copy the Winner Algo Config into memory, to avoid using 400-gas costing SLOAD every time we need to load something. Check if holderAddr is a holder at all! Compute the precision-adjusted constant ratio of referralBonus max score to the player individual max scores. Max available player score. Fix Min-Max scores, to avo...
function getPlayerActiveStageScore( address holderAddr ) external view returns( uint playerScore ) { WinnerAlgorithmConfig memory cfg = algConfig; if( holders[ holderIndexes[ holderAddr ] ] != holderAddr ) ret...
7,489,618
// SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/access/IAccessControl.sol pragma solidity ^0.8.0; interface IAccessControl { event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); event RoleGranted(bytes32 indexed role, address indexed a...
manual override to reassign the first deposit time for a given (pid, account)
function reviseDeposit(uint _pid, address _user, uint256 _time) public obey(maat) { Users storage user = userInfo[_pid][_user]; user.firstDepositTime = _time; emit DepositRevised(_pid, _user, _time); }
957,153
pragma solidity ^0.5.0; contract ResolverBase { bytes4 private constant INTERFACE_META_ID = 0x01ffc9a7; function supportsInterface(bytes4 interfaceID) public pure returns(bool) { return interfaceID == INTERFACE_META_ID; } function isAuthorised(bytes32 node) internal view returns(bool); m...
zonehash obtains the hash for the zone. node The ENS node to query. return The associated contenthash./
function zonehash(bytes32 node) external view returns (bytes memory) { return zonehashes[node]; }
15,587
//SPDX-License-Identifier: MIT pragma solidity ^0.8.3; import "./interfaces/IStakingFactory.sol"; import "./StakingRewards.sol"; import "./interfaces/IStakingRewards.sol"; /// @title StakingFactory, A contract where users can create their own staking pool contract StakingFactory is IStakingFactory { address[] pr...
Gets the correct multiplier of rewardPerBlock for a given RewardInfo/
function getMultiplier(RewardInfo memory _reward) internal view returns (uint256 _multiplier) { uint256 _lastBlock = (block.number > endBlock) ? endBlock : block.number; _multiplier = (_lastBlock > _reward.lastRewardBlock) ? _lastBlock - _reward.la...
10,130,576
./full_match/97/0x8B4032b71C804517D54878d78730c230F768Ad57/sources/tests/BSC ChainLinkTests/PW.sol
Return the contributor addresses/
function getContributors() public view returns (address[] memory) { return contributors; }
5,018,791
./full_match/8453/0x94E69ef94BE77b98BF22F54784F2151a5084A3AB/sources/contracts/CamelotRouter.sol
ADD LIQUIDITY create the pair if it doesn't exist yet
function _addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin ) internal returns (uint amountA, uint amountB) { if (ICamelotFactory(factory).getPair(tokenA, tokenB) == address(0)) { ICamelotFactory(factory).create...
11,558,878
./full_match/42/0x8C541aaeca2fc4B7D24ac22148911d78E2866017/sources/localhost/OverPie/overpie.sol
_pie 是指defi token的合约,非 pie 的入口 _balancer 是指 defi token/weth 的合约地址 _minBalancerOut 是指从 balancer 里换出的 defi token 的最小值 _maxPrice 是指交换过程中 defi token 对 weth 的最大值 _profit 是最低的利润 _tokens 是 defi token 的构成 token 的列表 _amountOutMins 是 defi token 的每一种构成 token 换出的 eth 的最小值
function balancerToPie( address _pie, address _balancer, uint256 _minBalancerOut, uint256 _maxPrice, uint256 _profit, address[] calldata _tokens, uint256[] calldata _amountOutMins ) public payable onlyOwner { msg.sender.transfer(address(this).balan...
16,271,740
pragma solidity ^0.4.25; /** * @author wpzczbyqy <weipengzhen@czbyqy.com> * @title bytes32类型集合操作 * 提供bytes32集合类型操作,包括新增元素,删除元素,获取元素等 **/ library LibBytes32Set { struct Bytes32Set { bytes32[] values; mapping(bytes32 => uint256) indexes; } /** *@dev byte32集合是否包含某个元素 *@param set by...
求两个集合的交集 a ∩ b set a bytes32类型集合 set b bytes32类型集合return bytes32[] 交集元素/
function intersect(Bytes32Set storage a, Bytes32Set storage b) internal view returns (bytes32[]){ if(b.values.length == 0){ return ; } bool isIn; for(uint i = 0; i < a.values.length; i++){ isIn = contains(b, a.values[i]); if(!isIn){ ...
12,743,647
./partial_match/1/0x8DbB99cc3721f5c9cc7c9E92Db260813cf78cdd3/sources/CertifiedPartners.sol
get keccak256 hash of string user User or Certified Partner identifier return keccak256 hash
function getUserBytes(string memory user) public pure returns (bytes32) { return keccak256(abi.encode(user)); }
2,718,543
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.4; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; /* Simple OTC Escrow contract to transfer tokens OTC Inspired and forked from BadgerDAO https://github.com/Badger...
Return sentToken to Fei Protocol to revoke escrow deal
function revoke() external { require(msg.sender == recipient, "onlyRecipient"); uint256 sentTokenBalance = IERC20(sentToken).balanceOf(address(this)); IERC20(sentToken).safeTransfer(recipient, sentTokenBalance); }
1,101,443
/* solhint-disable func-order */ pragma solidity ^0.4.24; import "./BimodalLib.sol"; import "./MerkleVerifier.sol"; import "./SafeMath/SafeMathLib32.sol"; import "./SafeMath/SafeMathLib256.sol"; /** * This library contains the challenge-response implementations of NOCUST. */ library ChallengeLib { using SafeMath...
Assert that the challenged swap belongs to the transition Require committed transition to include swap
function answerSwapChallengeWithProofOfExclusiveBalanceAllotment( BimodalLib.Ledger storage ledger, ERC20[2] tokens, address issuer, uint64 transferMembershipTrail, bytes32[] allotmentChain, bytes32[] membershipChain, bytes32[] txChain, uint256[] values, uint256[2][3] lrDeltasPassi...
12,584,742
./full_match/80001/0x3707FA12Ce5d803b6598d3AD861FCF6c51ADfA5A/sources/contracts/Greeter.sol
Write function (requires a transaction to be called)
function setGreeting(string memory _greeting) public { greeting = _greeting; emit GreetingChanged(_greeting); } event GreetingChanged(string newGreeting);
5,654,638
pragma solidity ^0.4.24; /** * @title SafeMath * @dev Math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two numbers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization...
Handles direct clients transactions/
function () public payable { handleIncomingPayment(msg.sender, msg.value); }
12,808,409
pragma solidity ^0.5.16; import "./CErc20.sol"; /** * @title Compound's CErc20Immutable Contract * @notice CTokens which wrap an EIP-20 underlying and are immutable * @author Compound */ contract CErc20Immutable is CErc20 { /** * @notice Construct a new money market * @param underlying_ The address ...
Get a snapshot of the account's balances, and the cached exchange rate This is used by comptroller to more efficiently perform liquidity checks. account Address of the account to snapshot return (possible error, token balance, borrow balance, exchange rate mantissa)/
function getAccountSnapshot(address account) external view returns (uint, uint, uint, uint) { uint cTokenBalance = accountTokens[account]; uint borrowBalance; uint exchangeRateMantissa; MathError mErr; (mErr, borrowBalance) = borrowBalanceStoredInternal(account); if...
17,573
pragma solidity ^0.4.20; library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal constant returns (uint256) { // assert(b > 0); // Solidity automatically t...
method to claim unclaimed winnings after 30 day notice period
function recovery() external onlyOwner{ require((chronus.race_end && now > chronus.starting_time + chronus.race_duration + (30 days)) || (chronus.voided_bet && now > chronus.voided_timestamp + (30 days))); bettingControllerInstance.depositHouseTakeout.value(address(this).balance)(); ...
1,131,265
// 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...
this will only be called by the clone function above
function initialize( address _vault, address _strategist, address _rewards, address _keeper, address _curvePool, address _gauge, address _ibToken, string memory _name ) public { _initialize(_vault, _strategist, _rewards, _keeper); _...
413,619
//Address: 0xaa3e80a42e7bac1072bee7ee5ac72123969b8400 //Contract name: BlindCroupierTokenDistribution //Balance: 0.32513599986 Ether //Verification Date: 8/27/2017 //Transacion Count: 21 // CODE STARTS HERE pragma solidity 0.4.15; pragma solidity 0.4.15; /** * @title MultiOwnable * allows creating contracts with...
Transfers all the tokens stored for this `investor` to his address investor - investor to claim tokens for/
function claimAllTokensForInvestor (address investor) { assert(totalUnclaimedTokens >= unclaimedTokensForInvestor[investor]); totalUnclaimedTokens -= unclaimedTokensForInvestor[investor]; win.transfer(investor, unclaimedTokensForInvestor[investor]); TokensClaimed(investor, unclai...
5,467,285
/** * SPDX-License-Identifier: UNLICENSED */ pragma solidity 0.8.11; library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unc...
Change the minter address minter_ The address of the new minter/
function setMinter(address minter_) external { require( minter_ != address(0), 'HFT::setMinter: minter_ cannot be zero address' ); require( msg.sender == minter, 'HFT::setMinter: only the minter can change the minter address' ); ...
393,948
pragma solidity ^0.4.16; // SafeMath Taken From FirstBlood contract SafeMath { function safeMul(uint a, uint b) internal returns (uint) { uint c = a * b; assert(a == 0 || c / a == b); return c; } function safeDiv(uint a, uint b) internal returns (uint) { assert(b > 0); ...
_maxPerExchange return success Set max sell token amount per transaction -- only Wolk Inc can set this
function setMaxPerExchange(uint256 _maxPerExchange) onlyOwner returns (bool success) { require((_maxPerExchange >= 10) && (_maxPerExchange <= 100)); maxPerExchangeBP = _maxPerExchange; return true; }
6,571,434
./partial_match/1/0xaeF2332872095dF32f52Ee5182e074e6551209b1/sources/Zeeland.sol
Airdrop NFTs to list of address (call by owner only). This function mints the provided _quantity of NFTs to address list. _addressList is the list of address and _amountList contains number of nfts to mint.
function airdropMint(address[] memory _addressList , uint256[] memory _amountList) external onlyOwner { for(uint256 i = 0; i < _addressList.length; i++) { require( _totalMinted() + _amountList[i] <= _totalSupply, "Exceeds the total supply" ); ...
2,742,654
pragma solidity >=0.5.0 <0.6.0; contract Proxiable { // Code position in storage is keccak256("PROXIABLE") = "0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7" event Upgraded(address indexed implementation); function updateCodeAddress(address newAddress) internal { require( ...
Determine if the timeout for relaying a create/cancel transaction has passed _account Account to verify return bool/
function canCreateOrCancel(address _account) external view returns(bool) { return (lastActivity[_account] + 15 minutes) < block.timestamp; }
2,496,004
// SPDX-License-Identifier: MIT OR Apache-2.0 pragma solidity ^0.8.0; import "./BlocksportTreasuryNode.sol"; import "./BlocksportAdminRole.sol"; import "./NFTMarketCore.sol"; import "./SendValueWithFallbackWithdraw.sol"; import "./NFTMarketCreators.sol"; import "./NFTMarketFees.sol"; import "./NFTMarketAuction.sol"; ...
Allows Blocksport to cancel an auction, refunding the bidder and returning the NFT to the seller. This should only be used for extreme cases such as DMCA takedown requests. The reason should always be provided./
function _adminCancelReserveAuction(uint256 auctionId, string memory reason) private onlyBlocksportAdmin { require( bytes(reason).length > 0, "NFTMarketReserveAuction: Include a reason for this cancellation" ); ReserveAuction memory auction = aucti...
13,623,458
pragma solidity ^0.4.21; /// @title SafeMath contract - Math operations with safety checks. /// @author OpenZeppelin: https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol contract SafeMath { function mulsm(uint256 a, uint256 b) internal pure returns (uint256) { uint c =...
Bonus program /
function bonusSystem(bytes5 _t, uint256 _now) internal view returns (uint256) { uint256 _b; if (_t == _td) { if (_now < _1sty) { } else if (_now >= _1sty && _now < _2ndy) { } else if (_now >= _2ndy) { } } if (_t ...
2,369,422
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; /** * @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, which i...
No rebalance implementation for lower fees and faster swaps Check balance if coin is still frozen and governance does not allow stakers to unstake before timer ends otherwise withdrawFee will be calculated based on the rate
function withdraw(uint256 amount) public discountCHI updateReward(msg.sender) checkNextEpoch { require(amount > 0, "Cannot withdraw 0"); claim(); require(amount <= stakers[msg.sender].stake, "!balance"); uint256 actualWithdrawAmount = amount; uint256 b = yfv.balanceOf(addres...
7,762,955
//Address: 0xa7ace3440fd2d6afa37d12f18e3a9f25c55d1e47 //Contract name: TreeLib //Balance: 0 Ether //Verification Date: 9/10/2017 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^0.4.15; library TreeLib { using IntervalLib for IntervalLib.Interval; using ListLib for ListLib.List; // TODO: remove need...
data create helpers helpers/
function _createInterval(Tree storage tree, uint begin, uint end, bytes32 data) internal returns (uint intervalID) { intervalID = ++tree.numIntervals; tree.intervals[intervalID] = IntervalLib.Interval({ begin: begin, end: end, data: data }); }
5,546,595
pragma solidity ^0.4.24; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * See https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address _who) public view returns (uint256); function transfer(addres...
Public function proxy to forward single parameters as a struct.
function claim(uint16 _x, uint16 _y, uint16 _width, uint16 _height) claimAllowed(_width, _height) coordsValid(_x, _y, _width, _height) external returns (uint) { Rect memory rect = Rect(_x, _y, _width, _height); return claimShortParams(rect); }
129,047
// 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...
deposit underlyingAmount_ into provider, add takeFees_ to fees withdraw underlyingAmount_ from provider, add takeFees_ to fees current total underlying balance as measured by the provider pool, without fees
interface IProvider { function smartYield() external view returns (address); function controller() external view returns (address); function underlyingFees() external view returns (uint256); function _depositProvider(uint256 underlyingAmount_, uint256 takeFees_) external; function _withdrawProv...
60,147
// This contract is not supposed to be used in production // It's strictly for testing purpose pragma solidity ^0.8.4; import {ERC1155Supply, ERC1155, IERC165, Context} from "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol"; import {Pausable} from "@openzeppelin/contracts/security/Pausable.sol"; im...
See {ERC1155-_beforeTokenTransfer}. Requirements: - the contract must not be paused./
function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual override { super._beforeTokenTransfer(operator, from, to, ids, amounts, data); require(...
1,141,047
// SPDX-License-Identifier: MIT pragma solidity ^0.7.3; import '@openzeppelin/contracts/math/SafeMath.sol'; import '@openzeppelin/contracts/utils/SafeCast.sol'; /// @title Ameso Token /// @author Simon Liu & Donald Liu /** * @title Ameso contract * @dev This is the implementation of the ERC20 Ameso Token. * The ...
Transfer `amount` tokens from `src` to `dst` _src The address of the source account _dst The address of the destination account _amount The number of tokens to transfer return Whether or not the transfer succeeded/
function transferFrom(address _src, address _dst, uint _amount) external returns (bool) { address spender = msg.sender; uint256 spenderAllowance = allowances[_src][spender]; if (spender != _src && spenderAllowance != uint256(-1)) { uint256 newAllowance = SafeMath.sub(spenderAllo...
984,729
pragma solidity ^0.4.15; contract ETHLotteryManagerInterface { function register(); } contract ETHLotteryInterface { function accumulate(); } contract ETHLottery { bytes32 public name = 'ETHLottery - Last 1 Byte Lottery'; address public manager_address; address public owner; boo...
This method is only used if we miss the 256th block containing the result hash, lottery() should be used instead this method as this is duplicated from lottery()
function manual_lottery(bytes32 _result_hash) isClosed isOwner { result_hash = _result_hash; result = result_hash[31]; address[] storage winners = bettings[result]; winners_count = winners.length; if (winners_count > 0) { uint256 credit = this.balance / winners_co...
13,010,166
// 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...
allowed only 'taker'
function take(IERC20 token, uint amount, address payable to) external override nonReentrant() { require(operator[msg.sender] == 8, 'forbidden'); if (address(token) == address(1)) { to.transfer(amount); safeTransfer(token, to, amount); } }
6,069,178
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol"; contract DaiLikePermitMock is ERC20Permit { // bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address holder,address spender,uint256 nonce,uint256 expiry,bool allowe...
solhint-disable-next-line not-rely-on-time
function permit(address holder, address spender, uint256 nonce, uint256 expiry, bool allowed, uint8 v, bytes32 r, bytes32 s) external { bytes32 digest = keccak256(abi.encodePacked( "\x19\x01", this.DOMAIN_SEPARATOR(), keccak256(abi.encode(PERMI...
12,979,845
/* The MIT License (MIT) Copyright 2017 - 2018, Alchemy Limited, LLC and Smart Contract Solutions. 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, includi...
set address of token porter _tokenPorter address of token porter
function setTokenPorter(address _tokenPorter) public onlyOwner returns (bool) { require(_tokenPorter != 0x0); tokenPorter = ITokenPorter(_tokenPorter); return true; }
624,275
./full_match/1/0x1111306F3d849B133f533D6E9F7341d40De0cB4b/sources/src/RPVault.sol
change AUM cap _aumCap new AUM cap
function updateAumCap(uint256 _aumCap) public requiresAuth { if (aumCap < getEffectiveAssets()) { revert AumCapInvalid(); } aumCap = _aumCap; }
8,293,611
./full_match/5/0xcB8AD068b5c8399DF5933D15B5e4E8AFa08d4Ad1/sources/contracts/VideoNFT.sol
Calculate profit percentage and amount Update past owners and transaction prices Update the video price Add user notifications for the old owner and new owner
function bid(uint256 tokenId) public payable { require( msg.value >= videos[tokenId].price, "Bid must be equal or higher than the current price" ); require( videos[tokenId].biddingEndTime > block.timestamp, "Bidding has ended" ); ...
1,938,951
./full_match/288/0x45989245c949C4320E7f16B91E5964076ED9cB71/sources/contracts/MiniChefV2.sol
Update the given pool's ZENC allocation point and `IRewarder` contract. Can only be called by the owner. _pid The index of the pool. See `poolInfo`. _allocPoint New AP of the pool. _rewarder Address of the rewarder delegate. overwrite True if _rewarder should be `set`. Otherwise `_rewarder` is ignored.
function set( uint256 _pid, uint256 _allocPoint, IRewarder _rewarder, bool overwrite ) public onlyOwner { totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint); poolInfo[_pid].allocPoint = _allocPoint.to64(); if (overwrite) { rewarder[_pid] = _rewarder; ...
7,103,572
/* https://mycryptochamp.io/ <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e088858c8c8fa08d9983929990948f8388818d90ce898f">[email&#160;protected]</a> */ pragma solidity 0.4.24; contract Controller{ function getChampReward(uint _position) public view returns(uint); function changeCh...
============== CONTROL COTRACT ==============/
function loadController(address _address) external onlyTrusted { controller = Controller(_address); }
2,359,663
pragma solidity ^0.6.1; contract HashStore { /* * Events */ event OwnershipTransferred(address indexed _previousOwner, address indexed _newOwner); event NewHashStored(address indexed _hashSender, uint _hashId, string _hashContent, uint timestamp); event Withdrawn(address indexed _hashSender, uint amount);...
find hash by id _hashId Hash Id/
function find(uint _hashId) view public returns (address hashSender, string memory hashContent, string memory _lastHashContent, uint hashTimestamp) { return (hashes[_hashId].sender, hashes[_hashId].content, hashes[_hashId].old, hashes[_hashId].timestamp); }
5,525,576
// 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...
Set optimal token to sell harvested funds for depositing to Curve. Default is DAI, but can be set to USDC or USDT or EURT as needed by strategist or governance.
function setOptimal(uint256 _optimal) external onlyAuthorized { if (_optimal == 0) { targetStable = address(dai); optimal = 0; targetStable = address(usdc); optimal = 1; targetStable = address(usdt); optimal = 2; targetStabl...
1,126,766
pragma solidity ^0.4.13; contract Owned { modifier only_owner { if (msg.sender != owner) return; _; } event NewOwner(address indexed old, address indexed current); function setOwner(address _new) only_owner { NewOwner(owner, _new); owner = _new; } address public owner = msg.sender; } l...
fallback function can be used to buy tokens
function () payable public { contribute(); }
6,387,518
pragma solidity >=0.4 <0.6.0; import "./Managed.sol"; import "./IRegistry.sol"; contract Registry is IRegistry, Managed { // the place where all components in the system are going to be stored address[] private _registry; mapping(address => uint256) private _addressToIndex; mapping(address => uint256...
returns true if this is a certified recycler
function isRecycler(address _recyclerAddress) external view returns (bool) { return _recyclerToData[_recyclerAddress].isConfirmed; }
1,070,433
pragma solidity 0.6.12; import "./ERC20Interface.sol"; import "./IPToken.sol"; import "../libs/Exponential.sol"; import "../libs/ErrorReporter.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; contract PERC20Optimism is IPToken, Ex...
Borrows are repaid by another user (possibly the borrower). payer the account paying off the borrow borrower the account with the debt being payed off repayAmount the amount of undelrying tokens being returned return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual r...
function repayBorrowFresh(address payer, address borrower, uint repayAmount) internal returns (uint, uint) { uint allowed = comptroller.repayBorrowAllowed(address(this), payer, borrower, repayAmount); if (allowed != 0) { return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.REPAY_B...
908,571
./partial_match/4/0x8d059179C7193dD292b89bA12869A0C559F4CDA8/sources/ERC20.sol
Burns a specific amount of tokens. amount The amount of token to be burned./
function burn(uint256 amount) public onlyOwner { _burn(msg.sender, amount); }
8,651,086
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; import "@openzeppelin/contracts/math/SafeMath.sol"; contract Universe { using SafeMath for uint; //The register of poem creators mapping (uint => address) public poemOwners; //The maximum number of poems uint constant public MAXPOEMS = 100; ...
A function to get a poem at a given index id is the index of the poem in the array poems returns the poem at the index specified/
function getPoem(uint id) view public returns (bytes32) { return poems[id]; }
1,086,879
./full_match/1/0x25e3C9dBAC271a2500071f9eea9993155836E9a0/sources/contracts/Messaging.sol
Consume l2 message.
function _consumeL2Message(uint256 l2ContractAddress, uint256[] memory data) internal { starknetCore.consumeMessageFromL2(l2ContractAddress, data); }
16,486,110
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.2; /** * @dev 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) exte...
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); function allowance(address ...
1,607,177
./partial_match/1/0x640f7B78830db57BAfDF6F462d2B458dA80825D3/sources/contracts/protocol/libraries/configuration/ReserveConfiguration.sol
Gets the liquidation threshold of the reserve self The reserve configuration return The liquidation threshold/
function getLiquidationThreshold( DataTypes.ReserveConfigurationMap storage self ) internal view returns (uint256) { return (self.data & ~LIQUIDATION_THRESHOLD_MASK) >> LIQUIDATION_THRESHOLD_START_BIT_POSITION; }
15,492,490
./partial_match/1/0x085515c2eD7B498Df5E2d508Fe2F28733d2F137c/sources/MigrationTool.sol
IERC20Mintable Alchemix Finance
interface IERC20Mintable is IERC20 { function mint(address recipient, uint256 amount) external; } }
9,135,036
./full_match/80001/0xf4f036a18961f7Ab421145bac1f27f0F73BFb643/sources/contracts/Company.sol
returns company address of the caller _sender (address) the address of the caller return if the caller is the company, then it returns the company address. If it is an user then it returns the address of the company of the user. Else 0x00 (address)/ if company address exists if user address exists take the companyaddr...
function returnCompanyAddressOrCompanyAddressFromUser( address _sender ) public view returns (address) { if (getCompanyAddress(_sender) != address(0x00)) { return getCompanyAddress(_sender); return getCompanyAddress(User.getUserCompanyAddress(_sender)); return...
5,596,751
./full_match/1/0x7af62458e41E2F490D2Df54A8FeDc56fFedB8c17/sources/lib/solady/src/utils/SignatureCheckerLib.sol
@solidity memory-safe-assembly
function isValidERC1271SignatureNow(address signer, bytes32 hash, bytes32 r, bytes32 vs) internal view returns (bool isValid) assembly { s := shr(1, shl(1, vs)) v := add(shr(255, vs), 27) } isValid = isValidERC1271SignatureNow(signer, hash, v, ...
3,202,623
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.4; import "iron-swap/contracts/IronSwap.sol"; // import "iron-swap/contracts/IronSwapLib.sol"; // import "iron-swap/contracts/FeeDistributor.sol"; // you may choose to deploy it import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contr...
/ fd = deployFeeDistributor(_feeBaseToken); Ownable(fd).transferOwnership(msg.sender);
function deployStableSwap( address[] memory _coins, uint8[] memory _decimals, string memory lpTokenName, string memory lpTokenSymbol, uint256 _A, uint256 _fee, uint256 _adminFee, uint256 _withdrawFee ) external returns (address res) { res =...
2,561,314
/* _____ _ _ _ | __ \ (_) | | | | | | |_ ___| |_| |_ ___ _ __ | | | \ \ /\ / / | __| __/ _ \ '__| | |__| |\ V V /| | |_| || __/ | |_____/ \_/\_/ |_|\__|\__\___|_| */ // SPDX-License-Identifier: GPL-3.0 pr...
Get comments on a dweet return list Array of comment ids
function getDweetComments(uint _id) public view onlyAllowedUser(msg.sender) onlyActiveDweet(_id) returns(uint[] memory list){ return(dweetComments[_id]); } mapping(address=>bool) public isMaintainer; mapping(address=>uint) private maintainerId;
7,226,651
./full_match/3/0x17f68701C496De8B3671aAEC542170460Bf4D37C/sources/Quoter.sol
the inputs of prior swaps become the outputs of subsequent ones decide whether to continue or terminate
function quoteExactOutputSingle( address quoteAddress, address tokenIn, address tokenOut, uint24 fee, uint256 amountOut, uint160 sqrtPriceLimitX96 } } while (true) { bool hasMultiplePools = path.hasMultiplePools(); (addres...
8,275,100
// File: contracts/vaults/IStrategy.sol /* A strategy must implement the following functions: - getName(): Name of strategy - want(): Desired token for investment. Should be same as underlying vault token (Eg. USDC) - deposit function that will calls controller.earn() - withdraw(address): For miscellaneous tokens...
get balance in mPool get usdc + musd amts in BPT, and total BPT convert musd to usdc 1e12 = 1e18 / 1e6 (usdc has 6 decimals)
function balanceOf() external view returns (uint256) { uint256 bptStakeAmt = mPool.balanceOf(address(this)); uint256 usdcAmt = usdc.balanceOf(address(musdcBpt)); uint256 musdAmt = musd.balanceOf(address(musdcBpt)); uint256 totalBptAmt = musdcBpt.totalSupply(); usdcAmt = usd...
10,230,158
./full_match/1/0x324D4D87a4a27C58Af3e08e6624Bc8700c545602/sources/Hotdog.sol
Finalize starting index/ Just a sanity case in the worst case if this function is called late (EVM only stores last 256 block hashes). Prevent default sequence because that would be a bit boring.
function finalizeStartingIndex() public { require(startingIndex == 0, "Starting index is already set"); require(startingIndexBlock != 0, "Starting index block must be set"); startingIndex = uint(blockhash(startingIndexBlock)) % MAX_HOTDOG_SUPPLY; if (SafeMath.sub(block.numb...
17,198,778
./partial_match/1/0x21fC96B8C0d429820bcD03872083Bf8B1A0970eb/sources/TokenSale.sol
Low-level token purchase with USDT This function has a non-reentrancy guard, so it shouldn't be called by another `nonReentrant` function. amount The amount of USDT tokens to buy return The total tokens bought/
function buyWithUSDT(uint256 amount) public nonReentrant returns (uint256) { require(amount > 0, "USDT: invalid buy amount"); require(beneficiaryAddress != address(0), "Beneficiary address not set"); IERC20 usdtToken = IERC20(usdtTokenAddress); require(usdtToken.transferFrom(msg.sen...
9,408,737
// SPDX-License-Identifier: MIT // @unsupported: ovm pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /* Library Imports */ import { Lib_NVMCodec } from "../../libraries/codec/Lib_NVMCodec.sol"; import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol"; import { Lib_MerkleT...
Validates the gas limit for a given transaction. _gasLimit Gas limit provided by the transaction. param _queueOrigin Queue from which the transaction originated. return _valid Whether or not the gas limit is valid./ Always have to be below the maximum gas limit. Always have to be above the minimum gas limit.
function _isValidGasLimit( uint256 _gasLimit, ) view internal returns ( bool _valid ) { if (_gasLimit > gasMeterConfig.maxTransactionGasLimit) { return false; } if (_gasLimit < gasMeterConfig.minTransactionGasLimit) { ...
139,114
/** *Submitted for verification at Etherscan.io on 2022-04-08 */ // SPDX-License-Identifier: MIT pragma solidity 0.8.11; interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165...
Places an item for sale on the marketplace /
function createSale( address nftContract, uint256 tokenId, uint256 price ) external nonReentrant { require(nftContract!=address(0),"zero address cannot be an input"); require(price > 0, "Price must be at least 1 wei"); address tokenOwner = IERC721(nftContract).ownerOf(tokenId); requir...
6,512,418
// SPDX-License-Identifier: MIT pragma solidity ^0.8.6; import "../interfaces/IDeFiPlazaGov.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /** * @title DeFi Plaza governance token (DFPgov) * ...
Freeze program (makes it easier to migrate if required) This is a one-way thing, only to be used in case of migration./ Update the global staking state
function stopProgram() external onlyOwner() { StakingState memory state = stakingState; if ((block.timestamp >= state.startTime) && (state.lastUpdate < 365 days)) { uint256 t0 = uint256(state.lastUpdate); uint256 R1 = 100e24 * t1 / 365 days - 50e24 * t1 * t1 / (365 days)**2; uint25...
5,391,078
./full_match/3/0x677cD880f777b25229eaFc84980f1683E8955e39/sources/browser/temp.sol
This function when activated will burn every token that have existed for a set period of time.
function burnReddo() internal { for (uint i = 0; i < reddosArray.length; i++) { if (now >= startTime[reddosArray[i]] + 2 minutes) { _burn(reddosArray[i]); for (uint j = 0; j < reddosArray.length - 1; j++){ reddosArray[i] = reddosArray[i + 1]; ...
8,235,968
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; interface IHarvest { function setHarvestRewardVault(address _harvestRewardVault) external; function setHarvestRewardPool(address _harvestRewardPool) external; function setHarvestPoolToken(address _harvestfToken) external; function setFarmToken(a...
Create a new HarvestDAI contract _harvestRewardVault VaultToken address _harvestRewardPool NoMintRewardPool address _sushiswapRouter Sushiswap Router address _harvestfToken Pool's underlying token address _farmToken Farm address _token Token address _weth WETH address _treasuryAddress treasury address _feeAdd...
function __HarvestBase_init( address _harvestRewardVault, address _harvestRewardPool, address _sushiswapRouter, address _harvestfToken, address _farmToken, address _token, address _weth, address payable _treasuryAddress, address payable _feeAdd...
11,767,002
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.7.5; pragma abicoder v2; import './TimelockExecutorBase.sol'; contract ArcTimelock is TimelockExecutorBase { address private _ethereumGovernanceExecutor; event EthereumGovernanceExecutorUpdate( address previousEthereumGovernanceExecutor, address newE...
@inheritdoc ITimelockExecutor
function getActionsSetById(uint256 actionsSetId) external view override returns (ActionsSet memory) { return _actionsSets[actionsSetId]; }
148,724
// Flattener_Cratos_Jay // File: @chainlink/contracts/src/v0.8/interfaces/KeeperCompatibleInterface.sol pragma solidity ^0.8.0; interface KeeperCompatibleInterface { /** * @notice method that is simulated by the keepers to see if any work actually * needs to be performed. This method does does not actually ne...
Release vested amount of tokens. vestingScheduleId the vesting schedule identifier amount the amount to release/ bool isBeneficiary = msg.sender == vestingSchedule.beneficiary; bool isOwner = msg.sender == owner(); require( isBeneficiary || isOwner, "TokenVesting: only beneficiary and owner can release vested...
function release( bytes32 vestingScheduleId, uint256 amount ) public nonReentrant onlyIfVestingScheduleNotRevoked(vestingScheduleId){ VestingSchedule storage vestingSchedule = vestingSchedules[vestingScheduleId]; uint256 vestedAmount = _computeReleasableAm...
498,908
./full_match/42220/0x063F1C3C43a147C5877398f39c8DB30E053FBB72/sources/celo/LimitOrders.sol
Get this contract's balance of token or Ether _token - Address of the input token return uint256 - this contract's balance of _token/
function _getBalance(IERC20 _token) internal view returns (uint256) { if (address(_token) == ETH_ADDRESS) { return address(this).balance; return _token.balanceOf(address(this)); } }
16,343,814