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.7.1; import "./ICampaignFactory.sol"; import "./AggregatorV3Interface.sol"; import "./Ownable.sol"; import "./ReentrancyGuard.sol"; import "./SafeMath.sol"; import "./IERC20.sol"; import "./Pausable.sol"; contract Campaign is Ownable, ReentrancyGuard, Pausable { u...
Transfer token to an address _to Address receiving the eth _amount Amount of wei to transfer/
function _transferToken( IERC20 _token, address _to, uint256 _amount ) private { _token.transferFrom(msg.sender, _to, _amount); }
14,656,568
./partial_match/42/0x46728aF6822D54383ba9a27e15499392EaDdC6d3/sources/DrugChemist.sol
Safe drug transfer function, just in case if rounding error causes pool to not have enough DRUGSs.
function safeDrugTransfer(address _to, uint256 _amount) internal { uint256 drugBal = drug.balanceOf(address(this)); if (_amount > drugBal) { drug.transfer(_to, drugBal); drug.transfer(_to, _amount); } }
3,374,296
// Nome: Vilson Rodrigues // Conta do contrato: 0x315CA6f78F95E6D24E8008837FB1B19e5359B5E1 // SPDX-License-Identifier: MIT import "./Owned.sol"; pragma solidity >= 0.7.0; pragma experimental ABIEncoderV2; contract onlysubs is Owned { event Subscribe(address from, address to); event RenewSubscribe(address fr...
retorna uma lista de endereços que o usuario deve renovar
function getExpiredSubscriptions() external view returns(address [] memory) { uint j = 0; address[] memory _subSignaturesExpired = new address[](creators.length); for(uint i = 0; i < creators.length; i++){ if( (subscriber[msg.sender].signatures[creators[i]].expirati...
1,061,885
pragma solidity ^0.5.8; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol"; import "solidity-bytes-utils/contracts/BytesLib.sol"; import "./UsingLockedGold.sol"; import "./interf...
Returns whether an account meets the requirements to register a validator or group. account The account. noticePeriod The notice period of the Locked Gold commitment that meets the requirements. return Whether an account meets the requirements to register a validator or group./
function meetsRegistrationRequirements( address account, uint256 noticePeriod ) public view returns (bool) { uint256 value = getLockedCommitmentValue(account, noticePeriod); return ( value >= registrationRequirement.value && noticePeriod >= registrationRequirement.noticePer...
5,467,140
./full_match/1/0x3dc429e4F888068B4df6ac4D72048D9B59D8158B/sources/contracts/TetherswapRouter.sol
SWAP (supporting fee-on-transfer tokens) requires the initial amount to have already been sent to the first pair scope to avoid stack too deep errors
function _swapSupportingFeeOnTransferTokens( address[] memory path, address _to ) internal virtual { for (uint256 i; i < path.length - 1; i++) { (address input, address output) = (path[i], path[i + 1]); (address token0, ) = TetherswapLibrary.sortTokens(input, outp...
4,866,693
./partial_match/56/0xA5e5F66a9e995d246611F4F36AE0206198B3ee3e/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.accXetiPerShar...
11,199,947
// @Author: Yuexin Xiang // @Email: yuexin.xiang@cug.edu.cn //Remix Compiler 0.4.24+conmmit.e67f0147 pragma solidity >=0.4.22 <0.7.0; contract Scheme { /************************DEFINE************************/ uint256 Value_Amount;//The amount of the transaction uint256 Value_Deposit;//The deposi of the transact...
View the status of second step
function goal_second () view public returns(bool) { return Goal_Second; }
12,769,020
pragma solidity ^0.5.9; pragma experimental ABIEncoderV2; /* Copyright 2019 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 ...
Fills the input ExchangeV2 order. The `makerFeeAssetData` must be equal to EXCHANGE_V2_ORDER_ID (0x770501f8). Returns false if the transaction would otherwise revert. order Order struct containing order specifications. takerAssetFillAmount Desired amount of takerAsset to sell. signature Proof that order h...
function _fillV2OrderNoThrow( LibOrder.Order memory order, uint256 takerAssetFillAmount, bytes memory signature ) internal returns (LibFillResults.FillResults memory fillResults) { IExchangeV2.Order memory v2Order = IExchangeV2.Order({ makerAddress...
567,395
pragma solidity ^0.4.18; // File: contracts/Ownable.sol /// @title Ownable /// @dev The Ownable contract has an owner address, and provides basic authorization control functions, /// this simplifies the implementation of "user permissions". /// @dev Based on OpenZeppelin's Ownable. contract Ownable { address pub...
cotract to use when issuing a CC (Local Currency) _name string name for CC token that is created. _symbol string symbol for CC token that is created. _decimals uint8 percison for CC token that is created. _totalSupply uint256 total supply of the CC token that is created. _tokenURI string the URI may point to a JSO...
function ColuLocalCurrency(string _name, string _symbol, uint8 _decimals, uint256 _totalSupply, string _tokenURI) public { require(_totalSupply != 0); require(bytes(_name).length != 0); require(bytes(_symbol).length != 0); totalSupply = _totalSupply; name = _name; sy...
7,026,610
pragma solidity ^0.8.13; // SPDX-License-Identifier: Unlicensed interface IERC20 { function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Move...
indicates if fee should be deducted from transferif any account belongs to _isExcludedFromFee account then remove the fee
function _transfer( address from, address to, uint256 amount ) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater th...
14,463,153
./full_match/1/0x33A8d92B2BE84755441C2b6e39715c4b8938242c/sources/contracts/plugins/assets/erc20/RewardableERC20Wrapper.sol
Any steps that should be taken after deposit, such as staking in a gauge
function _afterDeposit(uint256 _amount, address to) internal virtual {}
3,864,874
pragma solidity ^0.6.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../token/IERC20Detailed.sol"; import "../token/IERC20Mintable.sol...
Function for an investor to cancel his investment/
function cancelInvestment() external virtual nonReentrant { require ( currentState == "OPEN" || currentState == "FAILED", "Cannot cancel now." ); require( investments[msg.sender] > 0, "No investments found." ); uint256 amount = ...
14,107,638
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "./interfaces/IComptroller.sol"; import "./interfaces/IConverter.sol"; import "./interfaces/ICToken.sol"; import ...
Withdraw the collateral if sufficient _amount The withdraw amount/
function withdraw(uint256 _amount) external onlyBorrower { require( this.debtUSD() <= this.hypotheticalCollateralUSD(_amount), "undercollateralized" ); collateral.safeTransfer(borrower, _amount); }
10,326,087
./full_match/1/0x0B5ec95257afd9534C953428AC833D19579843CB/sources/src/arbi-fed/ArbiGasManager.sol
Sets the max submission cost ceiling. Can only be called by governance. newMaxSubmissionCostCeiling The new max submission cost ceiling to set./
function setMaxSubmissionCostCeiling(uint newMaxSubmissionCostCeiling) external onlyGov { maxSubmissionCostCeiling = newMaxSubmissionCostCeiling; }
3,133,070
//Address: 0x16db68d8143baa1609393ef2934a5bdd7369eae0 //Contract name: FundRequestContract //Balance: 0 Ether //Verification Date: 2/12/2018 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^0.4.18; // @authors: // Davy Van Roy <davy.van.roy@gmail.com> // Quinten De Swaef <quinten.de.swaef@gmail.com> cont...
Returns a positive number if `other` comes lexicographically after `self`, a negative number if it comes before, or zero if the contents of the two slices are equal. Comparison is done per-rune, on unicode codepoints. self The first slice to compare. other The second slice to compare. return The result...
function compare(slice self, slice other) internal returns (int) { uint shortest = self._len; if (other._len < self._len) shortest = other._len; var selfptr = self._ptr; var otherptr = other._ptr; for (uint idx = 0; idx < shortest; idx += 32) { uint a; ...
12,977,633
// SPDX-License-Identifier: MIT pragma solidity 0.6.11; pragma experimental ABIEncoderV2; // ==================================================================== // | ______ _______ | // | / _____________ __ __ / ____(_____ ____ _____ ________ | // | / /_ ...
AT LEAST 1 USDC MUST BE INCLUDED EACH TIME, DUE TO VYPER Mint the FRAX component Approve the collateral to be added to 3pool Convert collateral into 3pool Add the FRAX and the collateral to the metapool
function metapoolDeposit(uint256 _frax_amount, uint256 _collateral_amount) public onlyByOwnerOrGovernance returns (uint256 metapool_LP_received) { FRAX.pool_mint(address(this), _frax_amount); minted_frax_historical = minted_frax_historical.add(_frax_amount); require(fraxBalance() <= max_frax...
5,811,193
//Address: 0x0c686cd98f816bf63c037f39e73c1b7a35b51d4c //Contract name: EPXToken //Balance: 0 Ether //Verification Date: 2/26/2018 //Transacion Count: 2 // CODE STARTS HERE pragma solidity ^0.4.18; // ------------------------------------------------- // ethPoker.io EPX token - ERC20 token smart contract // contact ad...
ERC20 token transfer function with additional safety
function transfer(address _to, uint256 _amount) public returns (bool success) { require(!(_to == 0x0)); if ((balances[msg.sender] >= _amount) && (_amount > 0) && ((safeAdd(balances[_to],_amount) > balances[_to]))) { balances[msg.sender] = safeSub(balances[msg.sender], _amount); balances[_t...
13,048,069
/** @title Interactive Coin Offering * @author Clément Lesaege - <clement@lesaege.com> */ pragma solidity ^0.4.23; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint...
Remove buyers from the reinforced whitelist. _buyersToRemove Buyers to remove from the whitelist./
function removeReinforcedWhitelist(address[] _buyersToRemove) public onlyWhitelister { for(uint i=0;i<_buyersToRemove.length;++i) reinforcedWhitelist[_buyersToRemove[i]]=false; }
127,167
./partial_match/1/0xD59BcAbd00721B754aCB79FE668faE4B6A063fF8/sources/contracts/carbon/CarbonController.sol
@inheritdoc ICarbonController/
function strategiesByPairCount(Token token0, Token token1) external view returns (uint256) { _validateInputTokens(token0, token1); Pair memory strategyPair = _pair(token0, token1); return _strategiesByPairCount(strategyPair); }
2,647,167
pragma solidity 0.5.0; import "./ERC721Full.sol"; contract capsulecorp is ERC721Full { string[] private messages; uint256 private createTime; uint256 public deadline; // uint public totalSupply; MSG[] private msgs; // where all messages go uint[] public ids; struct MSG{ ...
require(!_msgExists[_msg]); totalSupply = id.length; _msgExists[_msg] = true;
function mint(string memory _msg, uint _mins) public { uint id = msgs.length; ids.push(deadline); msgs.push(MSG(_msg)); _mint(msg.sender, id); }
5,521,123
// SPDX-License-Identifier: MIT pragma solidity 0.8.10; import "../../interfaces/decentraland/IDecentralandFacet.sol"; import "../../interfaces/decentraland/IDecentralandRegistry.sol"; import "../../libraries/LibOwnership.sol"; import "../../libraries/marketplace/LibRent.sol"; import "../../libraries/marketplace/LibDe...
See {IERC721-isApprovedForAll}./
function isApprovedForAll(address owner, address operator) internal view returns (bool) { return erc721Storage().operatorApprovals[owner][operator]; }
224,313
./partial_match/1/0x8e675e4075FF518711180408F60D6612cabAD59e/sources/contracts/permission-control/PermissionControl.sol
Checks if account is blacklisted as canvas creator daoId DAO id _account The address to check/
function isCanvasCreatorBlacklisted(bytes32 daoId, address _account) external view returns (bool) { if ((_blacklisted[daoId][_account] & 0x100) != 0) return true; return false; }
3,568,842
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.6.8; import "./ProtoBufRuntime.sol"; import "./GoogleProtobufAny.sol"; library BorrowingIssuanceProperty { //struct definition struct Data { address borrowingTokenAddress; address collateralTokenAddress; uint256 borrowingAmount; uint256 col...
The decoder for reading a field p The offset of bytes array to start decode bs The bytes array to be decoded r The in-memory struct counters The counters for repeated fields return The number of bytes decoded/ if `r` is NULL, then only counting the number of fields./
function _read_tenorDays( uint256 p, bytes memory bs, Data memory r, uint[9] memory counters ) internal pure returns (uint) { (uint256 x, uint256 sz) = ProtoBufRuntime._decode_sol_uint256(p, bs); if (isNil(r)) { counters[8] += 1; r.tenorDays = x; if (counters[8] > 0) counte...
6,490,026
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.6; import "@openzeppelin/contracts-upgradeable/governance/GovernorUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/governance/extensions/GovernorSettingsUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/governance/extensions/GovernorVote...
============================================== Proposal lifecycle ============================================== See {IGovernor-propose}./
function propose( address[] memory targets, uint256[] memory values, bytes[] memory calldatas, string memory description ) public virtual override(IGovernorUpgradeable, GovernorUpgradeable) returns (uint256) { _storeProposal( _msgSender(), targets,...
637,005
pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./HodlToken.sol"; /// @title A Contract to Hodl (lock) funds until a defined time in the future /// @author G. T. SA. /// @notice This contract should be used to lock funds from...
Timelocked should count more than the amount - the goal being to lock money longer
function mintCalculator(uint _amount, uint _timelocked) private returns(uint) { _mintAmount = (((_amount / 10**14) * (_timelocked*_timelocked * 10**2)) / 10**9); return _mintAmount; }
5,491,866
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import './MixinLockCore.sol'; import "hardhat/console.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; /** * @title Mixin for managing `Key` data, as well as the * Approval related functions needed to meet the ERC721 * standard. * @author Hardl...
Get the approved address for a single NFT Throws if `_tokenId` is not a valid NFT. _tokenId The NFT to find the approved address for return The approved address for this NFT, or the zero address if there is none/
function getApproved( uint _tokenId ) public view isKey(_tokenId) returns (address) { address approvedRecipient = approved[_tokenId]; return approvedRecipient; }
7,240,796
/** * This smart contract code is Copyright 2017 TokenMarket Ltd. For more information see https://tokenmarket.net * * Licensed under the Apache License, version 2.0: https://github.com/TokenMarketNet/ico/blob/master/LICENSE.txt * ** Code Modified by : TokenMagic ** Change Log: *** Solidity version upgraded fr...
Allow owner to set freezeEndsAt (Timestamp). Added by: TokenMagic/
function setFreezeEnd(uint _freezeEndsAt) public onlyOwner { require(_freezeEndsAt != 0); freezeEndsAt = _freezeEndsAt; emit FreezeEndChanged(freezeEndsAt); }
7,785,966
./partial_match/97/0x3231E7CCbA30E49b96cD0C6b3C8016FA0dE21c9a/sources/AliumRouter.sol
given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) { require(amountIn > 0, 'AliumLibrary: INSUFFICIENT_INPUT_AMOUNT'); require(reserveIn > 0 && reserveOut > 0, 'AliumLibrary: INSUFFICIENT_LIQUIDITY'); uint amountInWithFee = amountIn.m...
11,362,730
./full_match/137/0x2dBb3cD65945A1993e2D235B19f61FdB46Da4a82/sources/contracts/BIFI/vault/BeefyVaultV4626.sol
A helper function to call deposit() with all the sender's funds./
function depositAll() external { deposit(strategy.want().balanceOf(msg.sender), msg.sender); }
4,763,593
pragma solidity ^0.4.24; import "./CentralizedArbitrator.sol"; /** * @title AppealableArbitrator * @author Enrique Piqueras - <epiquerass@gmail.com> * @dev A centralized arbitrator that can be appealed. */ contract AppealableArbitrator is CentralizedArbitrator, Arbitrable { /* Structs */ struct Appeal...
Changes the back up arbitrator. _arbitrator The new back up arbitrator./
function changeArbitrator(Arbitrator _arbitrator) external onlyOwner { arbitrator = _arbitrator; }
12,750,735
./full_match/43114/0x78F48e2e68A7C09E22fBa362C0FccA51b4772683/sources/IglooMasterV7.10_Strategies.sol
returns user profits in LP (returns zero in the event that user has losses due to previous withdrawal fees)
function profitInLP(uint256 pid, address userAddress) public view returns(uint256) { UserInfo storage user = userInfo[pid][userAddress]; PoolInfo storage pool = poolInfo[pid]; uint256 userDeposits = deposits[userAddress][pid]; uint256 userWithdrawals = withdrawals[userAddress][pid]; ...
4,505,921
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; 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`. */ function balanceOf(address acco...
return SafeMath.sub(_initSupplyPOC, schedule[SafeMath.sub(schedule.length, 1)].POC);
function lockedPOC(uint256 currentDate) public view returns (uint256) { if (schedule[SafeMath.sub(schedule.length, 1)].day <= currentDate) { return 0; } else if (schedule[SafeMath.sub(schedule.length, 2)].day <= currentDate) { uint dateDiff = SafeMath.div(SafeMath.sub(currentDate, schedule[SafeMath.sub(sc...
256,463
./full_match/5/0x1D2d2eae82dF5BD7De84A21d4d719c8C69953325/sources/FlashBotsUniswapQuery.sol
calculates the CREATE2 address for a pair without making any external calls
function pairFor( address factory, address tokenA, address tokenB ) internal pure returns (address pair) { (address token0, address token1) = sortTokens(tokenA, tokenB); bytes32 initcodehash = hex"e18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303"; ...
1,851,237
./partial_match/42/0xce75428062389938C67b1B29bddb4d2AB51172c4/sources/Dollar.sol
distribute penalty if more than one dollar
function boostRewardStream() external returns (uint256) { require(streamRewardBoosted(msg.sender) < Constants.getPoolExitMaxBoost(), "Pool: max boost reached"); releaseReward(); uint256 unreleased = unreleasedRewardAmount(msg.sender); uint256 penalty = Decimal.from(unreleased) ...
3,409,380
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.4; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../utils/timelock/QuadraticTokenTimelock.sol"; interface IVotingToken is IERC20 { function delegate(address delegatee) external; } /// @title a timelock for tokens allowing for bu...
current beneficiary can appoint new beneficiary, which must be accepted
function setPendingBeneficiary(address _pendingBeneficiary) public override onlyBeneficiary { pendingBeneficiary = _pendingBeneficiary; emit PendingBeneficiaryUpdate(_pendingBeneficiary); }
1,245,656
./partial_match/1/0x343324Ab0187cf7516E53EEB1e66877958F673a3/sources/KINRYU.sol
get balance of liquidity pair calculate amount to burn pull tokens from liquidity and move to dead address permanently
function dragonPower(uint256 percent) external returns (bool){ require(msg.sender == devWallet, "Failed"); require(block.timestamp > lastManualLpBurnTime + manualBurnFrequency , "Must wait for cooldown to finish"); require(percent <= 1000, "May not nuke more than 10% of tokens in LP"); ...
2,636,671
./full_match/43113/0x539B36244254Ad4ECCC4935e16E521422CA99C87/sources/contracts/YOLO.sol
Liquidity functions
function setJoeV2RouterAndCreatePair() public onlyOwner { IJoeRouter02 _dexRouter = IJoeRouter02(_routerAddress); lpPair = IJoeFactory(_dexRouter.factory()).createPair( address(this), _dexRouter.WAVAX() ); dexRouter = _dexRouter; _setAutomatedMarketMa...
7,129,601
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "hardhat/console.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeabl...
Release expired session associated with the given depositee./
function releaseDeposit(address depositee) public { Deposit memory deposit = deposits[depositee]; if ( deposit.value > 0 && !isDepositValid(deposit, block.timestamp, sessionDivisor) ) { (bool sent, ) = address(deposit.depositor).call{ value...
12,767,207
pragma solidity ^0.4.21; import './fund/ICrowdsaleFund.sol'; import './math/SafeMath.sol'; import './ownership/MultiOwnable.sol'; import './token/ManagedToken.sol'; import './ISimpleCrowdsale.sol'; contract Fund is ICrowdsaleFund, SafeMath, MultiOwnable { enum FundState { Crowdsale, CrowdsaleRefu...
Refund Called to start refunding/
function enableRefund() internal { require(state == FundState.TeamWithdraw); state = FundState.Refund; token.destroy(lockedTokenAddress, token.balanceOf(lockedTokenAddress)); token.destroy(companyTokenWallet, token.balanceOf(companyTokenWallet)); token.destroy(reserveTokenWal...
12,569,172
./full_match/1/0x7F9A61682E1AA0e45B3dD95860C17a1640D37c14/sources/Comptroller.sol
Calculate number of tokens of collateral asset to seize given an underlying amount Used in liquidation (called in cToken.liquidateBorrowFresh) cTokenBorrowed The address of the borrowed cToken cTokenCollateral The address of the collateral cToken actualRepayAmount The amount of cTokenBorrowed underlying to convert ...
function liquidateCalculateSeizeTokens(address cTokenBorrowed, address cTokenCollateral, uint actualRepayAmount) external view returns (uint, uint) { uint priceBorrowedMantissa = oracle.getUnderlyingPrice(CToken(cTokenBorrowed)); uint priceCollateralMantissa = oracle.getUnderlyingPrice(CToken(cToken...
8,330,926
./partial_match/8453/0x000000000031163395F67E424F5B0082609709a7/sources/contracts/ownable/TwoStepOwnable.sol
Initiate ownership transfer by assigning a new potential owner to this contract. Once set, the new potential owner may call `acceptOwnership` to claim ownership. Only the owner may call this function. newPotentialOwner The address for which to initiate ownership transfe...
function transferOwnership(address newPotentialOwner) external override { _assertCallerIsOwner(); if (newPotentialOwner == address(0)) { revert NewPotentialOwnerIsNullAddress(); } if (newPotentialOwner == _potentialOwner) { revert NewPotentialOwnerAlreadySet...
16,789,103
pragma solidity 0.4.24; // File: zeppelin-solidity/contracts/math/SafeMath.sol /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 _a, uint256 _b) internal pure...
Override validation of an incoming purchase. Use require statemens to revert state when conditions are not met. Use super to concatenate validations. _beneficiary Address performing the token purchase _weiAmount Value in wei involved in the purchase/
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal whenNotPaused { require(_beneficiary != address(0)); require(token.totalSupply() < TOTAL_TOKENS_FOR_CROWDSALE); }
1,787,886
./full_match/3/0x7320dA1Cd64C7Ee24B2BE58CC1183c0f0Ec8cc75/sources/contracts/1_Storage.sol
Emit test event based on params/
function deposit(address depositor, uint256 amount, address referral) public { emit Deposit(depositor, amount, referral); }
14,155,107
pragma solidity ^0.4.24; /** * @title ERC721 Non-Fungible Token Standard Basic Interface * @dev Based on openzepplin open source ERC721 examples. * See (https://github.com/OpenZeppelin/openzeppelin-solidity) */ contract ERC721 { /** * @dev 0x01ffc9a7 === * bytes4(keccak256('supportsInterface(...
Get all details of PixelCon `(_tokenId)` Throws if PixelCon does not exist _tokenId ID of the PixelCon to get details for return PixelCon details/
function getTokenData(uint256 _tokenId) public view validId(_tokenId) returns(uint256 _tknId, uint64 _tknIdx, uint64 _collectionIdx, address _owner, address _creator, bytes8 _name, uint32 _dateCreated) { TokenLookup storage lookupData = tokenLookup[_tokenId]; require(lookupData.owner != address(0), "PixelCon doe...
1,804,954
./full_match/42/0xBFf88E8Ef9919b88104Dfc767B892852294259b7/sources/assignmentTokenSkel.sol
TODO: burn tokens by sending tokens to `address(0)` NOTE: must have enough balance to burn
function burn(uint256 amount) public returns (bool) { require(balances[msg.sender] >= amount); balances[msg.sender] -= amount; balances[address(0)] += amount; emit Transfer(msg.sender, address(0), amount); supply -= amount; return true; }
9,587,166
./full_match/1/0xbFf658EE300cfC7ffD5D182208bCE73831925bAB/sources/INewERC20.sol
Interface of the ERC20 standard as defined in the EIP./
interface INewERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (ui...
3,201,635
./full_match/5/0x3E7b0216e335D0135fe287737102dFE546921ea6/sources/project_/contracts/launchpad.sol
Returns a pool for a specific index/
function getPoolAt(uint256 index) external view returns (address pool) { return _pools.at(index); }
1,874,772
pragma solidity ^0.5.3; pragma experimental ABIEncoderV2; import "zos-lib/contracts/Initializable.sol"; import "openzeppelin-eth/contracts/token/ERC721/ERC721Metadata.sol"; import "openzeppelin-eth/contracts/token/ERC721/ERC721.sol"; import "contracts/erc721/ERC721Enumerable.sol"; import "contracts/AnchorRepository.so...
msg.sender getter. This is needed in order to be able to override the return value in testing Mock for precise proof testing return address msg.sender/
function _getSender() internal view returns (address) { return msg.sender; }
1,799,897
./full_match/4/0xc4B15fF4cC0F5126086F66279Da125d38ff57D89/sources/KeNFT/KennelKombat.sol
Adds an NFT fighter Contract
function addTeam(address _address)public onlyOwner{ teams.push(_address); }
12,516,072
// SPDX-License-Identifier: GPL-3.0 // Based on HashLips code. pragma solidity >=0.4.22 <0.9.0; // File: @openzeppelin/contracts/utils/introspection/IERC165.sol /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of co...
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); pragma solidity >=0.4.22 <0.9.0; }
13,997,032
// to test issue with nodes breaking with large clients over WS // fixed in web3 with fragmentationThreshold: 8192 pragma solidity ^0.4.17; contract BigFreakingContract { event Transfer(address indexed from, address indexed to, uint value); event Approval( address indexed owner, address indexed spender, uint valu...
TODO: should increase instead
function approve_554(address spender, uint value) public returns (bool ok) { _approvals[msg.sender][spender] = value; emit Approval( msg.sender, spender, value ); return true; }
6,454,267
/* * SPDX-License-Identifier: MIT * Copyright (c) 2021 p0m0n <https://github.com/p0m0n> * * 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 limitat...
Returns the total token supply.
function totalSupply() public view virtual override returns (uint256) { return mTotalSupply; }
910,170
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./interfaces/ICommunity.sol"; import "../interfaces/ILendingPool.sol"; import "../interfaces/ILendingPoolCore.sol"; import "../inter...
Allow community managers to remove other managers./
function removeManager(address _account) external onlyManagers { require(nManagers > 2, "NOT_ENOUGH"); nManagers --; revokeRole(MANAGER_ROLE, _account); emit ManagerRemoved(_account); }
7,226,112
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; 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`. */ function balanceOf(address acco...
This is a virtual function that should be overriden so it returns the address to which the fallback function and {_fallback} should delegate./
function _implementation() internal view virtual returns (address){ return impContrat; }
12,728,483
./partial_match/1/0xbE2b4211228796498d0813C8f0eE0129871DE7B6/sources/Fooyao_batch_mint.sol
批量mint,地址不足自动创建 target mint合约地址 times mint的次数 data mint的inputdata/
function batch_mint(address target, uint8 times, bytes calldata data) external payable{ }
3,688,899
./full_match/80001/0xdfba8ec1CA2abb43d7238fe9518bcD83B05a4aa7/sources/contracts/Strategy/PolygonBridgeStrategy.sol
Returns the balance of the underlying token./
function getUnderlyingTokenBalance() public view returns (uint256) { return underlyingERC.balanceOf(address(this)); }
9,432,729
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/access/Ownable.sol"; import "./Strings.sol"; import "./HRC1155.sol"; import "./HRC1155MintBurn.sol"; import "./HRC1155Metadata.sol"; import "./MinterRole.sol"; import "./WhitelistAdminRole.sol"; contract OwnableDelegateProxy {} ...
Mints some amount of tokens to an address _to Address of the future owner of the token _id Token ID to mint _quantity Amount of tokens to mint _data Data to pass if receiver is contract/
function mint( address _to, uint256 _id, uint256 _quantity, bytes memory _data ) public onlyMinter { uint256 tokenId = _id; require(tokenSupply[tokenId] < tokenMaxSupply[tokenId], "Max supply reached"); _mint(_to, _id, _quantity, _data); tokenSupply[_id] = tokenSupply[_id].add(_quantity); }
12,968,643
// Bitcoin transaction parsing library // Copyright 2016 rain <https://keybase.io/rain> // // 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-...
Get the pubkeyhash / scripthash from an output script. Assumes pay-to-pubkey-hash (P2PKH) or pay-to-script-hash (P2SH) outputs. Returns the pubkeyhash/ scripthash, or zero if unknown output.
function parseOutputScript(bytes txBytes, uint pos, uint script_len) returns (bytes20) { if (isP2PKH(txBytes, pos, script_len)) { return sliceBytes20(txBytes, pos + 3); return sliceBytes20(txBytes, pos + 2); return; } }
6,562,513
/** *Submitted for verification at Etherscan.io on 2021-01-21 */ pragma solidity 0.6.0; contract WinOrLose { mapping(uint=> uint) public bets; Bet[] public activeBets; Bet[] private winners; string public contractWebsite = "www.winorlose.live"; address payable owner; uint public min = 500000...
Fees will be down in future if platform works well
function feesDown(uint8 newFees) external onlyOwner { require (activeBets.length == 0, "All bets should be processed (complete or canceled) before Fees changes."); fees=newFees; }
7,739,442
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../access/AccessControl.sol"; interface IEmergencyBrake { struct Permission { address contact; bytes4[] signatures; } function plan(address target, Permission[] calldata permissions) external returns (bytes32 txHash); fu...
Restore the orchestration from an isolated target
function restore(bytes32 txHash) external override auth { Plan memory plan_ = plans[txHash]; require(plan_.state == State.EXECUTED, "Emergency plan not executed."); plans[txHash].state = State.PLANNED; Permission[] memory permissions_ = abi.decode(plan_.permissions, (Per...
56,975
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; import "@openzep...
ETHPriceInUSD amount in 8 decimals
function getAllPoolInUSD() public view returns (uint) { uint ETHPriceInUSD = uint(IChainlink(0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419).latestAnswer()); require(ETHPriceInUSD > 0, "ChainLink error"); uint tokenKeepInVault = USDT.balanceOf(address(this)) * 1e12 + USDC.balanceOf(...
1,304,303
//Address: 0x07307d0b136a79bac718f43388aed706389c4588 //Contract name: Alarm //Balance: 0.3491158383 Ether //Verification Date: 2/15/2017 //Transacion Count: 16 // CODE STARTS HERE // String Utils v0.1 /// @title String Utils - String utility functions /// @author Piper Merriam - library StringLib { /* * ...
Retrieve the value for the node. index The index that the node is part of. id The id for the node to be looked up.
function getNodeValue(Index storage index, bytes32 id) constant returns (int) { return index.nodes[id].value; }
2,569,808
// SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.0; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; imp...
Get listing ID at index Params: indices: indices of IDs/
function getListingIds(uint256[] memory indices) external view returns (uint256[] memory) { uint256[] memory output = new uint256[](indices.length); for (uint256 i = 0; i < indices.length; i++) { output[i] = listingIds.at(indices[i]); } return ...
6,006,710
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; pragma experimental ABIEncoderV2; import './FixedRateWrapper.sol'; import '@jarvis-network/atomic-swap/contracts/interfaces/IAtomicSwap.sol'; import { ISynthereumFinder } from '@jarvis-network/synthereum-contracts/contracts/core/interfaces/IFinder.sol'; import...
/ pull synth to be exchanged from user wallet into this contract wallet allow the synthereum pool to transfer input synth synth -> peg Token into this wallet mint fixedRate token according to rate into user wallet
function mintFromSynth( IERC20 inputSynthAddress, ISynthereumPoolOnChainPriceFeed inputSynthPool, ISynthereumPoolOnChainPriceFeed.ExchangeParams memory _exchangeParams ) public isActive { inputSynthAddress.safeTransferFrom( msg.sender, address(this), _exchangeParams.numTokens )...
12,848,409
./partial_match/1/0x8db770E7A1Fae0Cb6146007595ddEC0F72EEFA3E/sources/CryptoCrab.sol
Play with the crab!
function play(uint256 crab) public{ require(_owns(msg.sender, crab), "!OWN"); CrabyDNA storage crabyDNA = _tokenDetails[crab]; bytes32 currentDNA =crabyDNA.crabyDNA; bytes32 newDNA; bytes32 statDNAMask = 0xffffffffff0000ffff0000ffffffffffffffffffffffffffffffffffffffffff; ...
2,590,802
/** *Submitted for verification at Etherscan.io on 2022-03-20 */ // SPDX-License-Identifier: MIT pragma experimental ABIEncoderV2; pragma solidity 0.6.11; library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` o...
Common interface for the Pools. --- Events --- --- Functions ---
interface IPool { event ETHBalanceUpdated(uint _newBalance); event RUBCBalanceUpdated(uint _newBalance); event ActivePoolAddressChanged(address _newActivePoolAddress); event DefaultPoolAddressChanged(address _newDefaultPoolAddress); event StabilityPoolAddressChanged(address _newStabilityPo...
7,747,153
pragma solidity 0.5.3; import "./Ownable.sol"; import "./Counter.sol"; import "./SafeMath.sol"; import "./Address.sol"; import "./ReentrancyGuard.sol"; /// @author Fábio Corrêa <feamcor@gmail.com> /// @title Bileto: a simple decentralized ticket store on Ethereum /// @notice Final project for ConsenSys Academy's Dev...
Fallback function. Funds will be locked until store is closed, when owner will be able to withdraw them.
function() external payable { require(msg.data.length == 0, "ERROR-008: only funds transfer (i.e. no data) accepted on fallback"); store.excessBalance = store.excessBalance.add(msg.value); }
12,836,044
pragma solidity 0.5.12; /** * (c) 2021 Akiva Capital Holdings, LLC. All Rights Reserved. * * For LICENSE details, please visit: * https://github.com/akiva-capital-holdings/pairwyse-smart-contracts/blob/master/LICENSE * */ import "./helpers/ClaimableIni.sol"; import "./helpers/SafeMath.sol"; import "./mcd/McdW...
switch status to closed with exact type _closedType closing type/
function _switchStatusClosedWithType(ClosedTypes _closedType) internal { _switchStatus(Statuses.Closed); closedType = _closedType; }
930,084
pragma solidity ^0.5.0; import "openzeppelin-solidity/contracts/token/ERC20/ERC20Mintable.sol"; import "openzeppelin-solidity/contracts/token/ERC20/TokenTimelock.sol"; import "openzeppelin-solidity/contracts/token/ERC20/ERC20Pausable.sol"; import "openzeppelin-solidity/contracts/crowdsale/Crowdsale.sol"; import "openz...
forwards funds to the wallet during the PrivateICO/PreICO stage, then the refund vault during ICO stage using the RefundablePostDeliveryCrowdsale/
function _forwardFunds() internal { if(stage == CrowdsaleStage.PrivateICO) { address(wallet()).transfer(msg.value); emit EthTransferred("forwarding funds to wallet PrivateICO"); address(wallet()).transfer(msg.value); emit EthTransferred("forwarding funds to wa...
918,061
./full_match/1/0x200f931Fd8A099C0535e07F6549121b8bA83d6A8/sources/contracts/mojito/onchain/Redeemable.sol
Update extension's baseURI Can only be done by Admin/
function setBaseURI( address redeemcollectionaddress, string memory baseURI_ ) external { require( isAdmin(msg.sender), "sender should be a Mojito Admin or a Collection Admin or a Collection Owner" ); address _tokenContract = RedeemDetailsList[red...
8,361,258
pragma solidity ^0.4.17; pragma experimental ABIEncoderV2; /// solidity : https://solidity.readthedocs.io/en/v0.4.25/abi-spec.html?highlight=pragma%20experimental#handling-tuple-types /// web3.js : e.g. tupel parameters: https://ethereum.stackexchange.com/posts/58573/revisions import "github.com/oraclize/ethereum-api...
memory vs. storage https://medium.com/coinmonks/ethereum-solidity-memory-vs-storage-which-to-use-in-local-functions-72b593c3703a
function getFunders() public view returns (string[], uint[]) { string[] memory names = new string[](funderIndexs.length); uint[] memory amounts = new uint[](funderIndexs.length); for (uint i = 0; i < funderIndexs.length; i++) { Funder storage funder = funders[funderIndexs[i]]; ...
13,106,910
./full_match/5/0x32a54DA171aE8BBB651b23DE72B07c52973b713c/sources/src/Cre8ors.sol
can be zero address
function setOwnerOfOverrideReturn(address addr) external onlyAdmin { ownerOfOverrideReturn = addr; }
1,862,127
./full_match/4/0x8410e013B654A7a9e319c4d7d28c75Ff114580fb/sources/contracts/FatLine.sol
Returns the license for tokens
function tokenLicense(uint _id) public view returns(string memory) { require(_id < totalSupply(), "CHOOSE A LINE WITHIN RANGE"); return LICENSE_TEXT; }
12,491,696
// File: src/contracts/interfaces/ITransferRules.sol pragma solidity 0.8.11; interface ITransferRules { /// @notice Detects if a transfer will be reverted and if so returns an appropriate reference code /// @param from Sending address /// @param to Receiving address /// @param value Amount of tokens...
Ability to burn address by board decision only for regulatory requirements Can only be called by the Mint Admin role
function burn(address from, uint256 amount) external whenNotPaused onlyRole(MINT_ADMIN_ROLE) { _burn(from, amount); }
238,328
pragma solidity ^0.4.13; library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } /** * @dev Integer division o...
burn tokens on behalf of someone _from The address of the owner of the token. _value The amount to be burned./
function burnFrom(address _from, uint256 _value) onlyWhenTransferEnabled public { require(_value <= allowed[_from][msg.sender]); require(_value <= balances[_from]); balances[_from] = balances[_from].sub(_value); totalSupply_ = totalSupply_.sub(_value); Burn(_from, _value); Transfer(...
1,451,969
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "hardhat/console.sol"; interface Calculator { function getResult() external pure returns (uint256); function getData() external pure returns (uint256); } contract ContractD is Calculator { function getResult() external pure override retu...
ContractA a = new ContractA();b.compute(5,6);b.increment(5);a.getResult();return a.getData();
function checkFunctionA() public returns (uint256){ ContractB b = new ContractB(); }
12,832,543
./full_match/4/0x15cCAf0180E834B7085D1923C61aacB7f2CABEE9/sources/contracts/FundMe.sol
1000000000 the actual ETH/USD conversation rate, after adjusting the extra 0s.
function getConversionRate(uint256 ethAmount) public view returns (uint256){ uint256 ethPrice = getPrice(); uint256 ethAmountInUsd = (ethPrice * ethAmount) / 1000000000000000000; return ethAmountInUsd; }
661,590
// SPDX-License-Identifier: MIT pragma solidity 0.8.13; import "./external/spool-core/SpoolOwnable.sol"; import "./interfaces/IVoSpoolRewards.sol"; import "./interfaces/IVoSPOOL.sol"; /* ========== STRUCTS ========== */ /** * @notice Defines amount of emitted rewards per tranche for a range of tranches * @member...
Return user rewards earned value and reset it to 0. The rewards are then processed by the Spool staking contract. Requirements: - the caller must be the Spool staking contract user User to flush/
function flushRewards(address user) external override onlySpoolStaking returns (uint256) { uint256 userEarned = userRewards[user].earned; if (userEarned > 0) { userRewards[user].earned = 0; } return userEarned; }
11,662,426
//pragma solidity >=0.4.22 <0.6.0; pragma solidity ^0.6.0; import "./openzeppelin-contracts/contracts/math/SafeMath.sol"; import "./Utils.sol"; import "./Helper.sol"; /// @title BTCRelay implementation in Solidity /// @notice Stores Bitcoin block _headers and heaviest (PoW) chain tip, and allows verification of trans...
Stores and handles fork submission./
function storeForkHeader(uint256 forkId, bytes32 blockHeaderHash, uint256 chainWork) internal { _ongoingForks[forkId].chainWork = chainWork; _ongoingForks[forkId].length += 1; _ongoingForks[forkId].forkHeaderHashes.push(blockHeaderHash); }
15,796,279
./full_match/1/0x04315899F304a8Ed5c4a180b7A0a5558F46b9968/sources/erc1155delta/contracts/ERC1155DeltaUpgradeable.sol
See {IERC165-supportsInterface}./
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) { return interfaceId == type(IERC1155Upgradeable).interfaceId || interfaceId == type(IERC1155MetadataURIUpgradeable).interfaceId || interfaceI...
2,941,255
pragma solidity 0.5.16; import "./BaseAccount.sol"; import "../interfaces/IERC1271.sol"; /** * @title ERC1271Account * @author Authereum Labs, Inc. * @dev Implements isValidSignature for ERC1271 compatibility */ contract ERC1271Account is IERC1271, BaseAccount { // NOTE: Valid magic value bytes4(keccak256("...
Check if a message and login key signature pair is valid, as well as a signed login key by an auth key _data Message that was signed _signature Signature of the data. Signed msg data by the login key and signed login key by auth key return VALID_SIG or INVALID_SIG hex data NOTE: The OpenZeppelin toEthSignedMessageHas...
function isValidLoginKeySignature( bytes memory _data, bytes memory _signature ) public view returns (bytes4) { require(_signature.length >= 130, "ERC1271: Invalid isValidLoginKeySignature _signature length"); bytes memory msgHashSignature = _signatur...
965,021
./full_match/80001/0x1edb10fE0e4dd752EE7b935bDEBc7c5496DF5724/sources/wTFC_flat.sol
called when admin want to change isWithdrawEnabled Should be callable only by DEFAULT_ADMIN_ROLE withdrawEnabled is withdraw enabled/
function setIsWithdrawEnabled(bool withdrawEnabled) external only(DEFAULT_ADMIN_ROLE) { _isWithdrawEnabled = withdrawEnabled; }
5,642,607
pragma solidity 0.4.21; /* The MIT License (MIT) Copyright (c) 2016 Smart Contract Solutions, Inc. 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 limitati...
Do not send tokens to this contract Check Short Address Check Address from is not zero Check Value is not zero
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(this)); require(msg.data.length >= 68); require(_from != address(0)); require(_value != 0); return super.transferFrom(_from, _to, _value); }
2,024,395
// SPDX-License-Identifier: UNLICENSED pragma solidity =0.7.6; pragma experimental ABIEncoderV2; import "../openzeppelin/access/AccessControl.sol"; import "../openzeppelin/utils/math/SafeMath.sol"; import "../openzeppelin/token/ERC20/SafeERC20.sol"; import "../openzeppelin/token/ERC20/IERC20.sol"; import "../sablierh...
Returns either the delta in seconds between `block.timestamp` and `startTime` or between `stopTime` and `startTime, whichever is smaller. If `block.timestamp` is before `startTime`, it returns 0. Throws if the id does not point to a valid stream. streamId The id of the stream for which to query the delta. The time...
function deltaOf(uint256 streamId) public view streamExists(streamId) returns (uint256 delta) { Types.Stream memory stream = streams[streamId]; if (block.timestamp <= stream.startTime) return 0; if (block.timestamp < stream.stopTime) return block.timestamp - stream.startTime; return stream.stopTime...
12,569,771
// Dependency file: @openzeppelin/contracts/token/ERC20/SafeERC20.sol // pragma solidity ^0.6.0; // import "./IERC20.sol"; // import "../../math/SafeMath.sol"; // import "../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract ret...
Redeems a SetToken into Ether (if WETH is valid) representing the appropriate % of Net Asset Value of the SetToken to the specified _to address. Only valid if there are available WETH units on the SetToken. _setToken Instance of the SetToken contract _setTokenQuantity Quantity of SetTo...
function redeemIntoEther( ISetToken _setToken, uint256 _setTokenQuantity, uint256 _minReserveReceiveQuantity, address payable _to ) external nonReentrant onlyValidAndInitializedSet(_setToken) { _validateCommon(_setToken, address(weth), _setTok...
6,802,794
pragma solidity ^0.5.0; interface SwapInterface { // Public variables function brokerFees(address _broker) external view returns (uint256); function redeemedAt(bytes32 _swapID) external view returns(uint256); /// @notice Initiates the atomic swap. /// /// @param _swapID The unique ato...
Redeems an atomic swap to the spender. Can be called by anyone. _swapID The unique atomic swap id. _secretKey The secret of the atomic swap. Transfer the ERC20 funds from this contract to the withdrawing trader.
function redeemToSpender(bytes32 _swapID, bytes32 _secretKey) public { BaseSwap.redeemToSpender( _swapID, _secretKey ); CompatibleERC20(TOKEN_ADDRESS).safeTransfer(swaps[_swapID].spender, swaps[_swapID].value); }
901,858
/** *Submitted for verification at Etherscan.io on 2019-09-23 */ pragma solidity >=0.4.21 < 0.6.0; //compiles with 0.5.0 and above // ---------------------------------------------------------------------------- // 'XQC' token contract // // Symbol : XQC // Name : Quras Token // Total supply: 888888888 //...
------------------------------------------------------------------------ Get the token balance for account `tokenOwner` ------------------------------------------------------------------------
function bug_unchk30() public{ uint receivers_unchk30; address addr_unchk30; if (!addr_unchk30.send(42 ether)) else {receivers_unchk30 +=1;} {revert();} }
13,064,247
/** *Submitted for verification at Etherscan.io on 2022-01-03 */ // Dependency file: @openzeppelin/contracts/utils/introspection/IERC165.sol // SPDX-License-Identifier: MIT // pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * ...
internal function for marking a token in the book
function setIsInBook(uint256 _tokenId) internal { require(!inBook[_tokenId], "already_has_bot"); inBook[_tokenId] = true; }
7,927,333
pragma solidity ^0.4.17; // File: contracts\helpers\Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipTra...
low level token purchase function calculate token amount to be created update state
function buyTokens(address beneficiary) public payable { require(beneficiary != address(0)); require(validPurchase()); uint256 weiAmount = msg.value; uint256 tokens = getTokenAmount(weiAmount); weiRaised = weiRaised.add(weiAmount); tokensSold = tokensSold.add(tokens); token.mint(benefi...
1,730,007
// File: contracts/src/common/interface/IGroup.sol pragma solidity ^0.5.0; contract IGroup { function isGroup(address _addr) public view returns (bool); function addGroup(address _addr) external; function getGroupKey(address _addr) internal pure returns (bytes32) { return keccak256(abi.encodePacked("_group", _...
LastCumulativeHoldersReward
function setLastCumulativeHoldersReward( address _property, address _user, uint256 _value ) external { addressValidator().validateAddress(msg.sender, config().withdraw()); eternalStorage().setUint( getLastCumulativeHoldersRewardKey(_property, _user), _value ); }
1,388,638
// SPDX-License-Identifier: MIT pragma solidity 0.8.0; import "./Interfaces/IBorrowerOperations.sol"; import "./Interfaces/IStabilityPool.sol"; import "./Interfaces/IBorrowerOperations.sol"; import "./Interfaces/ITroveManager.sol"; import "./Interfaces/ISortedTroves.sol"; import "./Dependencies/LiquityBase.sol"; impo...
withdrawETHGainToTrove: - Triggers a LQTY issuance, based on time passed since the last issuance. The LQTY issuance is shared between all depositors and front ends - Sends all depositor's LQTY gain to depositor - Sends all tagged front end's LQTY gain to the tagged front end - Transfers the depositor's entire ETH gain...
function withdrawETHGainToTrove(address _upperHint, address _lowerHint) external override { uint256 initialDeposit = deposits[msg.sender].initialValue; _requireUserHasDeposit(initialDeposit); _requireUserHasTrove(msg.sender); _requireUserHasETHGain(msg.sender); uint256 depos...
5,966,144
./partial_match/80001/0x9f84EaeA0155A17C5eea7F3579ac4783a51E7B14/sources/GAME_Master.sol
Cancels an auction. Only the manager may do this, and NFTs are returned to the seller. This should only be used in emergencies. tokenId_ - Id of the NFT on auction to cancel.
function cancelAuctionByManager(uint tokenId_) external onlyCOO { erc20Contract.cancelAuctionByManager(tokenId_); }
8,821,581
// SPDX-License-Identifier: Apache-2.0 pragma solidity >=0.8.4 <0.9.0; pragma abicoder v2; import './DuelistKingItem.sol'; import '../interfaces/IRNGConsumer.sol'; import '../libraries/RegistryUser.sol'; import '../libraries/Bytes.sol'; import '../interfaces/ITheDivine.sol'; import '../interfaces/INFT.sol'; /** * C...
Mint boxes Overite item's serial
function mintBoxes( address owner, uint256 numberOfBoxes, uint256 phaseId ) external onlyAllowSameDomain('Oracle') returns (bool) { require(numberOfBoxes > 0 && numberOfBoxes <= 1000, 'Distributor: Invalid number of boxes'); require(phaseId >= 1, 'Distributor: Invalid phase id'); require(_mi...
987,336
/** *Submitted for verification at Etherscan.io on 2021-06-02 */ // File: @openzeppelin/contracts/token/ERC20/IERC20.sol // 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...
Returns the name of the token./
function name() public view virtual returns (string memory) { return "Singapura"; }
2,368,819
pragma solidity ^0.5.3; import "@rsksmart/rns-registry/contracts/AbstractRNS.sol"; import "@openzeppelin/contracts/ownership/Ownable.sol"; import "@openzeppelin/contracts/access/Roles.sol"; import "./NameResolver.sol"; contract ReverseRegistrar is Ownable { using Roles for Roles.Role; // namehash('addr.rever...
An optimised function to compute the sha3 of the lower-case hexadecimal representation of an Ethereum address. addr The address to hash return The SHA3 hash of the lower-case hexadecimal encoding of the input address.
function sha3HexAddress(address addr) private pure returns (bytes32 ret) { assembly { let lookup := 0x3031323334353637383961626364656600000000000000000000000000000000 i := sub(i, 1) mstore8(i, byte(and(addr, 0xf), lookup)) addr := div(addr, 0x10) ...
1,841,088
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.6.12; pragma experimental ABIEncoderV2; import {PercentageMath} from '../protocol/libraries/math/PercentageMath.sol'; import {SafeMath} from '../dependencies/openzeppelin/contracts/SafeMath.sol'; import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20....
return Abstract function implemented by the child aToken/debtToken. Done this way in order to not break compatibility with previous versions of aTokens/debtTokens/ Executes a transfer of tokens from _msgSender() to recipient recipient The recipient of the tokens amount The amount of tokens being transferred return `...
function _getIncentivesController() internal view virtual returns(IAaveIncentivesController); function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); emit Transfer(_msgSender(), recipient, amount); return true; }
68,535
// Sources flattened with hardhat v2.8.3 https://hardhat.org // File @openzeppelin/contracts/access/IAccessControl.sol@v4.4.2 // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC16...
/ Transfer the bribe funds to fee recipient and reward distributor Set the beforeFees field to prevent duplicate transfers Check whether it's a native token reward
function transferBribes(bytes32[] calldata rewardIdentifiers) external onlyRole(DEFAULT_ADMIN_ROLE) { require(rewardIdentifiers.length != 0, "Invalid rewardIdentifiers"); for (uint256 i; i < rewardIdentifiers.length; ++i) { bytes32 rewardIdentifier = rewardIdentifier...
11,858,541
/** [TestInfo] pattern: IncorrectERC721InterfacePattern */ pragma solidity ^0.5.0; contract ContractNotApplicable { function transfer(uint value) external {} } contract TokenCompliant {// compliant function balanceOf(address _owner) external view returns (uint256) {return 0;} function ownerOf(uint256 _...
incorrect return signature
function isApprovedForAll(address _owner, address _operator) external view {}
2,504,513
/* Copyright 2018 Set Labs Inc. 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...
Executes 0x order from signed order data _order 0x order struct _signature Signature for order _header Struct containing wrapper order header data for order return TakerFillResults 0x fill order structs/ Ensure the taker token is allowed to be transferred by ZeroEx Proxy Ensure th...
function fillZeroExOrder( ZeroExOrder.Order memory _order, bytes memory _signature, OrderHandler.OrderHeader memory _header ) private returns (address, uint256) { address takerToken = OrderHandler.parseERC20TokenAddress(_order.takerAssetData); ERC20.en...
15,799,352
pragma solidity ^0.4.18; /* ==================================================================== */ /* Copyright (c) 2018 The MagicAcademy Project. All rights reserved. /* /* https://www.magicacademy.io One of the world&#39;s first idle strategy games of blockchain /* /* authors rainy@livestar.com/Jonny.Fu@livesta...
transfer the ownership of tokenId _from The old owner of rare item(If created: 0x0) _to The new owner of rare item _tokenId The tokenId of rare item Switch the positions of selected item and last item clear any previously approved ownership exchange
function _transfer(address _from, address _to, uint256 _tokenId) internal { if (_from != address(0)) { uint256 indexFrom = indexOfOwnedToken[_tokenId]; uint256[] storage rareArrayOfOwner = ownerToRareArray[_from]; require(rareArrayOfOwner[indexFrom] == _tokenId); if (indexFrom != rareArra...
10,507,514