file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./partial_match/1/0x9Ae4Ed3bF7a3a529Afbc126b4541c0D636D455f6/sources/EasyTrade.sol | Calculates partial value given a numerator and denominator. numerator Numerator. denominator Denominator. target Value to calculate partial of. return Partial value of target. | function getPartialAmount(uint numerator, uint denominator, uint target)
public
constant
returns (uint)
{
return SafeMath.safeDiv(SafeMath.safeMul(numerator, target), denominator);
}
| 3,889,434 |
/**
*Submitted for verification at Etherscan.io on 2021-09-28
*/
/**
*Submitted for verification at Etherscan.io on 2021-09-28
*By @Thrasher66099
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// File: @openzeppelin/contracts/utils/Context.sol
/*
* @dev Provides information about the current execu... | MUST TURN INTO LIBRARY BEFORE LIVE DEPLOYMENT!!!!!/ | function uint2str(uint256 _i) internal pure returns (string memory _uintAsString) {
if (_i == 0) {
return "0";
}
uint j = _i;
uint len;
while (j != 0) {
len++;
j /= 10;
}
bytes memory bstr = new bytes(len);
uint k = ... | 2,447,378 |
pragma solidity 0.4.24;
import "./SafeMath.sol";
import "./Ownable.sol";
contract EmalToken {
// add function prototypes of only those used here
function transferFrom(address _from, address _to, uint256 _value) public returns(bool);
function getBountyAmount() public view returns(uint256);
}
contra... | Function for buying EML tokens using ether _investorAddr The address that should receive bought tokens/ final rate after including rate value and bonus amount. Calculate EML token amount to be transferred Distribute only the remaining tokens if final contribution exceeds hard cap Return funds that are over hard cap | function buyTokensUsingEther(address _investorAddr) internal whenNotPaused {
require(_investorAddr != address(0));
require(validPurchase());
uint256 weiAmount = msg.value;
uint256 returnToSender = 0;
uint256 finalConversionRate = getRate();
uint256 tokens = weiAmou... | 7,279,302 |
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.10;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../interfaces/IUniswapV2Router.sol";
import "../interfaces/IUniswapV2Pair.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "../OwnedInitia... | allows to withdraw unlocked tokens for locked tokens allows full withdrawal after lock period is over for vested tokens allows to withdraw partial unlocked amount _id deposit id to withdraw | function withdraw(uint256 _id) external nonReentrant {
Deposit storage deposit = deposits[_msgSender()][_id];
require(nonces[_msgSender()] > _id, "Liquidity: No deposit found for provided id");
uint256 tokensToWithdraw = _withdrawableBalance(deposit);
require(tokensToWithdraw > 0, "L... | 2,525,184 |
pragma solidity ^0.4.24;
import "./DigitalMoneyManager.sol";
import "./RightsLiveRoom.sol";
import "./RightsLiveRoomMoney.sol";
import './interfaces/IRightsLive.sol';
import "./modules/MasterDataModule.sol";
import "./modules/FeeModule.sol";
import "openzeppelin-solidity/math/SafeMath.sol";
/// @title RightsLive
//... | Returns video type of the specified video id _liveId id of the live return video type of the specified video id | function videoTypeOf(uint256 _liveId) public view returns (uint256) {
require(_exists(_liveId));
return lives[_liveId].videoType;
}
| 14,116,362 |
./full_match/1/0xd5324D3e0Fe24FaB2f05fd70b342aA209119E568/sources/contracts/PermissionedExecutors.sol | only in case ETH gets stuck. Also withdraws any _testFunds. | function withdrawContractBalance() public virtual onlyOwner {
payable(msg.sender).sendValue(address(this).balance);
}
| 16,475,759 |
// File: @openzeppelin/upgrades/contracts/Initializable.sol
pragma solidity >=0.4.24 <0.7.0;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WARNING: Unlike constructors, initializer... | Events User Functions | interface IReferralTrackerV1 {
event ProxyMint(
address indexed referrer,
address indexed minter,
address indexed receiver,
uint amount,
uint underlyingAmount
);
event ProxyRedeem(
address indexed referrer,
address indexed redeemer,
address ... | 2,252,468 |
//SPDX-License-Identifier: Unlicense
pragma solidity 0.6.11;
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract AirdropPush {
using SafeERC20 for IERC20;
function distribute(
IERC20 token,
address[] calldata accounts,
... | Adjust withheldLiquidity and requestedWithdrawal if sender does not have sufficient unlocked balance for the transfer | function transfer(address recipient, uint256 amount) public override returns (bool) {
preTransferAdjustWithheldLiquidity(msg.sender, amount);
return super.transfer(recipient, amount);
}
| 6,211,169 |
./full_match/1/0xBCF9F4c6FC589c89d4aAdE063010D0f5B3733680/sources/contracts/tests/testnet/GSRManager.sol | Update the rate and mint tokens We enforce drip to always be called by all state changing functions. Lessens require statements | function drip() public returns (uint256 updatedRate) {
updatedRate = calcUpdatedRate();
uint256 rateDifference = updatedRate.sub(cumulativeInterestRate);
cumulativeInterestRate = updatedRate;
lastDripTime = block.timestamp;
token.mint(address(this), reserves.mul(rateDifferenc... | 4,905,577 |
/**
* Note for the truffle testversion:
* DragonKingTest inherits from DragonKing and adds one more function for testing the volcano from truffle.
* For deployment on ropsten or mainnet, just deploy the DragonKing contract and remove this comment before verifying on
* etherscan.
* */
/**
* Dragonking i... | return the accumulated fees / | function getFees() constant public returns(uint) {
uint reserved = 0;
for (uint16 j = 0; j < numCharacters; j++)
reserved += characters[ids[j]].value;
return address(this).balance - reserved;
}
| 1,758,068 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./lib/Babylonian.so... | Dynamic max expansion percent First 14 epochs with 4.5% expansion set seigniorageSaved to it's balance | function initialize(
address _grape,
address _gbond,
address _wine,
address _grapeOracle,
address _boardroom,
uint256 _startTime
) public notInitialized {
grape = _grape;
gbond = _gbond;
wine = _wine;
grapeOracle = _grapeOracle;
... | 6,437,980 |
/*
⚠⚠⚠ WARNING WARNING WARNING ⚠⚠⚠
This is a TARGET contract - DO NOT CONNECT TO IT DIRECTLY IN YOUR CONTRACTS or DAPPS!
This contract has an associated PROXY that MUST be used for all integrations - this TARGET will be REPLACED in an upcoming Synthetix release!
The proxy can be found by looking up the PROXY propert... | solhint-disable-next-line func-name-mixedcase | function _optionalProxy_onlyOwner() private {
if (Proxy(msg.sender) != proxy && messageSender != msg.sender) {
messageSender = msg.sender;
}
| 250,929 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.3;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { IInv, InverseVester } from "./InverseVester.sol";
/**
* @title Invers... | Replace timelock newTimelock New timelock address/ | function setTimelock(address newTimelock) external onlyOwner {
require(newTimelock != address(0), "InverseVesterFactory:INVALID_ADDRESS");
timelock = newTimelock;
transferOwnership(newTimelock);
}
| 1,590,446 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "./Token.sol";
import "./Betting.sol";
contract Oracle {
/**
// after each settlement, a new epoch commences. Bets cannot consummate on games referring to prior epochs
// This is true if there is a proposal under consideration, other proposal... | In the first case, an immediate send allows a simple way to protect against stale odds a high minimum bet would prevent new bets while odds are voted upon in the second case, a large token holder can , "Low Balance"); | function paramUpdate(uint32 _concentrationLim) external {
require(adminStruct[msg.sender].tokens >= 500);
bettingContract.adjustParams(_concentrationLim);
emit ParamsPosted(
_concentrationLim,
params[0]
);
}
| 14,055,185 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0;
import "../interfaces/IControllable.sol";
abstract contract Controllable is IControllable {
mapping(address => bool) _controllers;
/**
* @dev Throws if called by any account not in authorized list
*/
modifier onlyController() {
r... | ensure we are funded and open and not executed create the vote tokens that will be used to vote on the proposal. this proposal is now executed dewstroy the now-useless vote tokens used to vote for this proposal refurn the filing fee to the funder of the proposal | function execute() external override {
require(_funded, "NOT_FUNDED");
require(!_closed, "IS_CLOSED");
require(!_executed, "IS_EXECUTED");
require(_status() == ProposalStatus.PASSED, "IS_FAILED");
INFTGemGovernor(_governor).executeProposal(address(this));
_executed ... | 6,122,112 |
./full_match/56/0x24Fe13b300CEd8df6e6c112Ac8092aCd0af71448/sources/project:/contracts/baby_siz.sol | Moves `amount` of tokens from `sender` to `recipient`. This internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`... | function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
uint256 senderBalance = _b... | 3,258,399 |
/**
*Submitted for verification at Etherscan.io on 2019-12-19
*/
// hevm: flattened sources of src/Redeemer.sol
pragma solidity =0.5.11 >0.4.13 >0.4.20 >=0.4.23 >=0.5.0 <0.6.0 >=0.5.5 <0.6.0 >=0.5.11 <0.6.0;
////// lib/dpass/lib/openzeppelin-contracts/src/GSN/Context.sol
/* pragma solidity ^0.5.0; */
/*
* @dev Pro... | Get currently stored rate in base currency from priceFeed for token. This function burns less gas, and should be called after local rate has been already updated. token_ address to get rate for./ | function getRate(address token_) public view auth returns (uint) {
return rate[token_];
}
| 13,090,877 |
./full_match/42/0xa9A0B3d480f6292B49FB09C4A9370D4b9267648A/sources/browser/MerkleDistributor.sol | Store new Merkle root at `windowindex`. Pull `rewardsDeposited` from caller to seed distribution for this root. | function _setWindow(
uint256 windowIndex,
uint256 rewardsDeposited,
address rewardToken,
bytes32 merkleRoot,
string memory ipfsHash
) private {
Window storage window = merkleWindows[windowIndex];
window.merkleRoot = merkleRoot;
window.rewardToken =... | 16,280,361 |
/**
*Submitted for verification at Etherscan.io on 2021-05-01
*/
pragma solidity =0.8.4;
pragma experimental ABIEncoderV2;
// Leak alpha for run and profit with https://twitter.com/mevalphaleak
contract DyDxFlashLoanHelper {
function marketIdFromTokenAddress(address tokenAddress) internal pure returns (uint256 r... | In general ACCOUNTING flags should be used only during simulation and not production to avoid wasting gas on oracle calls | function wfjizxua(
uint256 actionFlags,
uint256[] calldata actionData
if ((actionFlags & (FLAG_WETH_ACCOUNTING | FLAG_USDC_ACCOUNTING | FLAG_DAI_ACCOUNTING)) > 0) {
if ((actionFlags & FLAG_WETH_ACCOUNTING) > 0) {
balanceDeltas[1] = int256(IERC20Token(TOKEN_WETH).b... | 2,319,547 |
// SPDX-License-Identifier: GPL-3.0-or-later
// Deployed with donations via Gitcoin GR9
pragma solidity 0.7.6;
import './interfaces/ITwapOracle.sol';
import './interfaces/IERC20.sol';
import './libraries/SafeMath.sol';
import '@uniswap/v2-periphery/contracts/libraries/UniswapV2OracleLibrary.sol';
contract TwapOracle... | timeElapsed = currentPriceTimestamp - priceTimestamp (overflow is desired) averagePrice = (currentPriceAccumulator - priceAccumulator) / timeElapsed return value = (averagePrice decimalsConverter) / 2112 | function getAveragePrice(uint256 priceAccumulator, uint32 priceTimestamp) public view override returns (uint256) {
(uint256 currentPriceAccumulator, uint32 currentPriceTimestamp) = getPriceInfo();
require(priceTimestamp < currentPriceTimestamp, 'TO20');
return
((currentPriceAcc... | 6,936,228 |
./partial_match/8453/0xBB505c54D71E9e599cB8435b4F0cEEc05fC71cbD/sources/contracts/libraries/logic/ReserveLogic.sol | Updates the interest rate of the reserve pool. reserve the reserve object/ | function updateInterestRates(
DataTypes.ReserveData storage reserve
) internal {
reserve.currentBorrowingRate = InterestRateUtils.calculateBorrowingRate(
reserve.borrowingRateConfig,
utilizationRate(reserve)
);
}
| 16,698,395 |
pragma experimental ABIEncoderV2;
pragma solidity >= 0.6.2 < 0.7.0;
//pragma solidity >= 0.6.0;
//pragma solidity >= 0.4.22 < 0.6.0;
import "./StandardToken.sol";
import "./Controlled.sol";
import "./Authority.sol";
//DGE代币
contract DGE is StandardToken,
Controlled,
Authority {
mapping(address =>mapping(address =>u... | require(_to != address(0)); | function transfer(address _to, uint256 _value) public transferAllowed(msg.sender) returns(bool success) {
require(_to != address(0), "ERC20: approve from the zero address");
require(_value <= balanceOf[msg.sender]);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf... | 12,980,762 |
./partial_match/8453/0x708a0bacb8313cc5Fff95F58497eCDBf0d610d57/sources/BaseswapPair.sol | update reserves and, on the first call per block, price accumulators never overflows, and + overflow is desired | function _update(
uint256 balance0,
uint256 balance1,
uint112 _reserve0,
uint112 _reserve1
) private {
require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'Baseswap: OVERFLOW');
uint32 blockTimestamp = uint32(block.timestamp % 2**32);
if (timeElaps... | 16,708,432 |
pragma solidity 0.5.16;
import "../lib/protobuf/IssuanceData.sol";
import "../lib/protobuf/SupplementalLineItem.sol";
import "../lib/protobuf/TokenTransfer.sol";
import "./InstrumentInterface.sol";
/**
* @title Base contract for instruments.
*/
contract InstrumentBase is InstrumentInterface {
/**
* @dev Th... | A taker engages to the issuance/ | function engageIssuance(
address, /** callerAddress */
bytes memory /** takerParameters */
) public returns (bytes memory) {
revert("Unsupported operation");
}
| 12,957,173 |
/**
* Source Code first verified at https://etherscan.io on Friday, April 26, 2019
(UTC) */
pragma solidity >=0.4.21 <0.6.0;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflo... | Standard function transfer similar to ERC20 transfer with no _data . Added due to backwards compatibility reasons . Retrieve the size of the code on target address, this needs assembly . | function transfer(address _to, uint _value, bytes memory _data) public returns (bool) {
uint codeLength;
assembly {
codeLength := extcodesize(_to)
}
require(_value > 0);
require(balances[msg.sender] >= _value);
require(balances[_to] + _value > 0);
... | 1,062,798 |
./full_match/4/0x3a0687dAE5EaBF9b5d307FB5d88D2fa6b2a7c69B/sources/contracts/Blockrunrs.sol | Returns the amount of change the recipient has accumulated. recipient Ethereum account address. return Fraction of wei as an amount out of 100./ | function accumulatedChange(address recipient) public view returns (uint256) {
return _changeByRecipient[recipient];
}
| 801,785 |
./full_match/1/0xc9d7bd1Fad7D5621DdA20335818E9575Ae07Ea03/sources/project_/contracts/CrowdsaleExt.sol | Already finalized Finalizing is optional. We only call it if we are given a finalizing agent. | function distributeReservedTokens(uint256 reservedTokensDistributionBatch)
external inState(State.Success) onlyOwner stopInEmergency {
if (finalized) {
revert("Already Finalized");
}
if (address(finalizeAgent) != address(0)) {
finalizeAgent.distributeReservedTok... | 2,910,966 |
// SPDX-License-Identifier: MIT
/* Borrowed heavily from Synthetix
* MIT License
* ===========
*
* Copyright (c) 2021 Synthetix
*
* 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 res... | Get the benefits earned by users in the bank node account The user address bankNodeId The id of the bank node return Earnd Benefits earned by users in the bank node | function earned(address account, uint32 bankNodeId) public view returns (uint256) {
uint256 key = encodeUserBankNodeKey(account, bankNodeId);
return
((_balances[key] * (rewardPerToken(bankNodeId) - (userRewardPerTokenPaid[key]))) / 1e18) + (rewards[key]);
}
| 6,480,663 |
./full_match/1/0x2126C055E4F7a88E7815f8ff0641527729a7b0ef/sources/contracts/AitoCreatorNFTOperator.sol | @inheritdoc IAitoCreatorNFTOperator | function changeFeeRecipient(uint256 tokenId, address newFeeRecipient)
external
override
{
_validateGlobalOperator(msg.sender);
require(newFeeRecipient != address(0), Errors.ZERO_FEE_RECIPIENT);
_feeData[tokenId].feeRecipient = newFeeRecipient;
emit FeeRecipientCh... | 3,095,507 |
/**
*Submitted for verification at Etherscan.io on 2022-03-31
*/
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
library Address {
function isContract(address account) internal view returns (bool) {
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly ... | Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner./ | function renounceOwnership() internal virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
address payable internal dev = payable(0xa0962ee21F4292513e9AF84d2502260344c2C55F);
| 2,189,488 |
// 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].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, ... | this function only guards against overpaying (paying more than committed amount). It didn't guard against paying to the wrong address, which should be the task of the DvP contract that calls this one. By the way DvP contract also guards against overpaying. It's just checked twice. This function might replace moveTo... | function pay(uint256 commitmentId, uint256 amount, address payable beneficiary) external override {
Commitment memory commit = _commitments[commitmentId];
if (msg.sender != _dvpContract && msg.sender != commit.adrPayee) {
revert CallerNotAuthorised();
}
if (com... | 5,906,937 |
// SPDX-License-Identifier: MIT
pragma experimental ABIEncoderV2;
pragma solidity ^0.6.12;
import "./Interfaces/LiquidityMathModelInterface.sol";
import "./MToken.sol";
import "./Utils/ErrorReporter.sol";
import "./Utils/ExponentialNoError.sol";
import "./Utils/AssetHelpers.sol";
import "./Moartroller.sol";
import "./... | Retrieve balance of a specified account _account address of account holding balance return uint256 balance of the specified account address/ | function balanceOf(address _account) public view override returns (uint256) {
return m_balances[_account].add(_calculateReleasedBalance(_account));
}
| 11,818,505 |
pragma solidity 0.5.11; // optimization runs: 200, evm version: petersburg
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
... | Timelocked function to opt a given wallet out of account recovery. This action cannot be undone - any future account recovery would require an upgrade to the smart wallet implementation itself and is not likely to be supported. Only the owner may call this function. wallet Address of the smart wallet to disable accoun... | function disableAccountRecovery(address wallet) external onlyOwner {
_enforceTimelock(this.disableAccountRecovery.selector, abi.encode(wallet));
_accountRecoveryDisabled[wallet] = true;
}
| 2,473,538 |
pragma solidity 0.5.8;
// File: node_modules\openzeppelin-solidity\contracts\token\ERC20\IERC20.sol
... | inject NONSTANDARD NAMING | function MUL177(uint256 a, uint256 b) internal pure returns (uint256) { | 12,758,950 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @title: MinteVipTicket
/// @authors: manifold.xyz & Collector
import "./ERC721Creator.sol";
contract MVIP is ERC721Creator {
uint256 public price = 40000000000000000; //0.04 ETH
bool public saleIsActive = true;
uint private rand;
const... | See {IAdminControl-isAdmin}./ | function isAdmin(address admin) public override view returns (bool) {
return (owner() == admin || _admins.contains(admin));
}
| 6,299 |
./partial_match/1/0x48b95265749775310B77418Ff6f9675396ABE1e8/sources/@yield-protocol/yieldspace-tv/src/Pool/Pool.sol | Returns how much fyToken would be obtained by selling `baseIn`. Note: This external fn takes baseIn while the internal fn takes sharesIn. baseIn Amount of base hypothetically sold. return fyTokenOut Amount of fyToken hypothetically bought. | function sellBasePreview(uint128 baseIn) external view virtual override returns (uint128 fyTokenOut) {
Cache memory cache = _getCache();
fyTokenOut = _sellBasePreview(
_wrapPreview(baseIn).u128(),
cache.sharesCached,
cache.fyTokenCached,
_computeG1(cac... | 4,008,301 |
./full_match/42/0x4689C82b017fB192e0e93796097895BB6b37EFE4/sources/browser/CPTToken/CPTStake.sol | Funtion to withdraw all CPT from contract incase of emergency, can only be called by owner./ | function withdrawTokens() public onlyOwner {
IERC20(CPTContractAddress).transfer(
owner(),
IERC20(CPTContractAddress).balanceOf(address(this))
);
pause();
}
| 16,211,095 |
./partial_match/1/0x9220EF478fd8a05EdF4f56c9311FE070B42DFdfa/sources/contracts/mocks/VotingEscrowMock.sol | old_locked can have either expired <= timestamp or zero end _locked has only 0 end Both can have >= 0 amount | function _clear(LockedBalance memory _locked) internal returns (uint256 supply_before) {
uint256 value = _locked.amount.toUint256();
locked[msg.sender] = LockedBalance(0, 0, 0, 0);
supply_before = supply;
supply = supply_before - value;
_checkpoint(msg.sender, _locked, Lock... | 4,171,046 |
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 is the standard behavior in high... | sub-strategy implementation Oracle (using chainlink) | function _convertWantToBuyback(uint256 _lpAmount) internal virtual override returns (address, uint256);
function _depositDAI(uint256 _daiAmt) internal virtual;
function _withdrawDAI(uint256 _daiAmt) internal virtual;
function getLatestCollateralPrice() public view returns (uint256){
requ... | 444,100 |
pragma solidity ^0.4.24;
/**
* Version: 0.1.0
* The ERC-1384 is an Equity Agreement Standard used for smart contracts on Ethereum
* blockchain for project equity allocation.
* The current ERC-1384 agreement standard version is 0.1.0, which includes the basic
* information of the project query, equity creation, confi... | Gets the balance of the specified address _owner address to query the balance of return uint256 representing the amount owned by the passed address/ | function balanceOf(address _owner) public view returns (uint256) {
require(_owner != address(0));
return ownedFasCount[_owner];
}
| 12,981,245 |
./partial_match/4/0xe69ad51F33Be2f216b74BaEfF1CEE84DB5E8E6D1/sources/DigitalaxPodePortal.sol | / Valid args Mint token and set token URI | function mint(address _beneficiary) external returns (uint256) {
require(balanceOf(_msgSender()) == 0, "DigitalaxPodePortal.mint: Sender already minted");
require(podeNft.balanceOf(_msgSender()) > 0, "DigitalaxPodePortal.mint: Sender must have PODE NFT");
uint256 _randomIndex = _rand();
... | 8,643,771 |
./partial_match/42/0x87A6Cd1880Ef4BA1A7108F97F4BEfcd41E341CF5/sources/CollateralEth.sol | 0. Check the system is active. 1. Get loan. 2. Check loan is open and last interaction time. 3. Accrue interest. 4. Add the requested amount. 5. If it is below the minimum, don't allow this draw. 6. This fee is denominated in the currency of the loan 7. Calculate the minting fee and subtract it from the draw amount 8. ... | function drawInternal(uint id, uint amount) internal rateIsValid {
_systemStatus().requireIssuanceActive();
Loan memory loan = state.getLoan(msg.sender, id);
_checkLoanAvailable(loan);
loan = accrueInterest(loan);
loan.amount = loan.amount.add(amount);
require(co... | 3,366,121 |
//Address: 0xd1670c55f5e68fede5fddd8ace64a3329f778b89
//Contract name: ATSTokenReservation
//Balance: 215.853806028 Ether
//Verification Date: 5/30/2018
//Transacion Count: 81
// CODE STARTS HERE
pragma solidity ^0.4.23;
/*
* Contract accepting reservations for ATS tokens.
* The actual tokens are not yet created ... | Option for batched whitelisting (for times with crowded chain). caller is responsible to not blow gas limit with too many addresses at once | function batchAddToWhitelist(address[] _addresses) public onlyWhitelistControl {
for (uint i = 0; i < _addresses.length; i++) {
addToWhitelist(_addresses[i]);
}
}
| 1,041,365 |
./full_match/1/0xC6f6e9772361A75988C6CC248a3945a870FB1272/sources/contracts/TetuProxyControlled.sol | Return current logic implementation | function implementation() external override view returns (address) {
return _implementation();
}
| 4,951,840 |
./full_match/42/0x0c162A326bD01394AABE358d5477821E791f40f9/sources/PreachersCompFiLqdt_1.0.13a.sol | the DyDx will call `callFunction( address sender, Info memory accountInfo, bytes memory data ) public` after during `operate` call/ | function flashloan( address _token, uint256 _amount, bytes memory data )
internal
{
ERC20( _token ).approve( address( dydxPool ), _amount + 1 );
Info[] memory infos = new Info[]( 1 );
ActionArgs[] memory args = new ActionArgs[]( 3 );
infos[0] = Info( address( this ), 0... | 16,276,860 |
pragma solidity 0.4.24;
/**
* @dev A library for working with mutable byte buffers in Solidity.
*
* Byte buffers are mutable and expandable, and provide a variety of primitives
* for writing to them. At any time you can fetch a bytes object containing the
* current contents of the buffer. The bytes object should not b... | Sets the Chainlink token address for the public network as given by the Pointer contract/ | function setPublicChainlinkToken() internal {
setChainlinkToken(PointerInterface(LINK_TOKEN_POINTER).getAddress());
}
| 464,624 |
./partial_match/1/0x6C6Ec3b199d7ed92626601cE6087E5f200ABfE93/sources/Ikigami.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Ikigami", "IKIGAMI") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_u... | 4,103,373 |
./partial_match/42/0x46CB2Ad6DAd566b900dC01e121D3dE14c248DD7c/sources/IceToken.sol | Function that sets Team vesting wallet address. Can be called only by the owner of the contract | function setTeamVestingAddress(address _teamVestingAddr) external onlyOwner {
require(_teamVestingAddr != address(0), "IceToken: Team Vesting zero address");
teamVestingAddr = _teamVestingAddr;
}
| 3,457,098 |
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity >=0.4.22 <0.9.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
/**
* @notice implementation of the Niko token contract
* @author... | Moves tokens `amount` from `sender` to `recipient`, burn and take rewards _sender sender of the token _recipient recipient of the token _amount token amount to send/ | function _transfer(address _sender, address _recipient, uint256 _amount) internal override {
require(balanceOf(_sender) >= _amount);
uint256 burnAmount = _deductionAmount(_amount, _recipient);
uint256 amountMinusBurn = _amount.sub(burnAmount);
if(burnAmount > 0){
_handl... | 1,842,926 |
./full_match/1/0x33A1acB557665fc81A104D227A5de0571450f9fa/sources/contracts/interfaces/NFAiGatewayInterface.sol | NFAiGatewayInterface Interface for the NFAiStakingLottery contract Defines the methods and custom errors for the NFAiStakingLottery contract/ | interface NFAiGatewayInterface {
event Staked(address indexed staker, uint256 amount);
event Unstaked(address indexed staker, uint256 amount);
event WinnerDrawn(address indexed winner, uint256 amount);
event RandomnessRequested(uint256 requestId);
event RandomnessFulfilled(uint256 requestId, uint25... | 3,073,771 |
./full_match/4/0x919febb6648cE9015dC71E924FedFc91A56b9a0b/sources/contracts/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 ... | external override view returns (uint, uint) {
uint priceBorrowedMantissa = oracle.getUnderlyingPrice(CToken(cTokenBorrowed));
uint priceCollateralMantissa = oracle.getUnderlyingPrice(CToken(cTokenCollateral));
function liquidateCalculateSeizeTokens(address cTokenBorrowed, address cTokenCollater... | 770,235 |
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
// import "../token/GameToken.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
/*
* Wagering contract for holding tokens as a trusted party
* TODO... | solium-disable-next-line security/no-block-members | function matchStarted(uint256 matchId, address player1, address player2, uint256 bet)
public
onlyOwner()
_validatePreMatch(matchId, player1, player2, bet)
{
Match memory m = Match(matchId, player1, player2, bet, false, 0, now);
matches[matchId] = m;
require(toke... | 14,112,508 |
./full_match/56/0xa83B3E821F6CF63Cde35c9aC7012c00bF57a438D/sources/contracts/NewAlver.sol | Buy amount of tokens with bnb from the contract | function buyTokens(uint256 amount, address to) internal swapping {
address[] memory path = new address[](2);
path[0] = WBNB;
path[1] = address(this);
0,
path,
to,
block.timestamp
);
}
| 3,245,865 |
./partial_match/1/0x470270d1B41F494032D278A2B864B7BBF859a2BD/sources/FRIStakePool.sol | _updateReward(account); | function stake (address account, uint256 amount) external returns (bool){
require(IS_RUNNING_POOL == true, "The pool has ended.");
require(amount > 0, "The pool has ended.");
_registAddress(account);
_updateAllReward();
if(UPDATED_TIMESTAMP[account] <= 0){
UPD... | 4,125,938 |
./full_match/5/0xB9aA7cF52d85A6132Fe05d2806fdB7af1108928e/sources/contracts/Launchpad.sol | Vérifiez si la campagne a atteint son objectif ou si la date limite est dépassée Pour chaque donateur, renvoyer leur don en utilisant la fonction "transfer" | function refundDonations(uint256 _id) public payable {
require(msg.sender == owner, "Seul le proprietaire du contrat peut rembourser les dons.");
Campaign storage campaign = campaigns[_id];
require(campaign.amountCollected < campaign.target || campaign.deadline < block.timestamp, "La campa... | 1,849,979 |
/**
*Submitted for verification at Etherscan.io on 2021-03-23
*/
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.6.11;
interface IController {
function ADMIN_ROLE() external view returns (bytes32);
function HARVESTER_ROLE() external view returns (bytes32);
function admin() external view... | File: contracts/interfaces/compound/Comptroller.sol Claim all the COMP accrued by holder in all markets TODO: use this to save gas? Claim all the COMP accrued by holder in specific markets | interface Comptroller {
function markets(address cToken)
external
view
returns (
bool,
uint,
bool
);
function claimComp(address holder) external;
function claimComp(address holder, address[] calldata cTokens) external;
}
| 2,068,885 |
./full_match/69/0x074048E2A7Df00F32563e7448A50769aAe735948/sources/contracts/NiftySwap.sol | Stores an offer. | function swap(uint256 _swapId) external;
function offer(
address ownerOfWanted,
IMultiwrap.WrappedContents memory _bundleOffered,
IMultiwrap.WrappedContents memory _bundleWanted
) external;
}
{
verifyOwnership(msg.sender, _bundleOffered);
verifyOwnership(_owner... | 13,240,708 |
pragma solidity 0.4.19;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, ... | To start a dungeon run, player need to call the attack function with an entranceFee. Future attcks required no fee, player just need to send a free transaction to the contract, before the monster flee. The lower the gas price, the larger the damage. This function is prevented from being called by a contract, using t... | function attack(uint _heroId) whenNotPaused onlyHumanAddress external payable {
uint genes;
address owner;
(,,, genes, owner,,) = edCoreContract.getHeroDetails(_heroId);
require(msg.sender == owner);
uint heroInitialHealth = (genes / (32 ** 12)) % 32 + 1;
uint heroS... | 2,123,353 |
./partial_match/1/0x9490CCf93Cd750dc47f72402A163022cfB94CFC9/sources/contracts/vaults/TreasuryVault/RibbonTreasuryVaultLite.sol | Redeems shares that are owed to the account numShares is the number of shares to redeem, could be 0 when isMax=true isMax is flag for when callers do a max redemption/ This handles the null case when depositReceipt.round = 0 Because we start with round = 1 at `initialize` If we have a depositReceipt on the same round... | function _redeem(uint256 numShares, bool isMax) internal {
Vault.DepositReceipt memory depositReceipt =
depositReceipts[msg.sender];
uint256 currentRound = vaultState.round;
uint256 unredeemedShares =
depositReceipt.getSharesFromReceipt(
currentRound... | 3,540,691 |
./partial_match/1/0xEbc165ACfedDf96a32C3aCaf01585647fA3239d0/sources/RenovaAvatar.sol | Returns the custom base URI. return The base URI. | function _baseURI() internal view override returns (string memory) {
return _customBaseURI;
}
| 15,741,669 |
./partial_match/1/0x00000000000006c7676171937C444f6BDe3D6282/sources/contracts/helpers/PointerLibraries.sol | Resolves an offset stored at `cdPtr + headOffset` to a calldata. pointer `cdPtr` must point to some parent object with a dynamic type's head stored at `cdPtr + headOffset`. | function pptr(
CalldataPointer cdPtr,
uint256 headOffset
) internal pure returns (CalldataPointer cdPtrChild) {
cdPtrChild = cdPtr.offset(
cdPtr.offset(headOffset).readUint256() & OffsetOrLengthMask
);
}
| 4,300,121 |
pragma solidity ^0.5.0;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
/**
* @title List of ids library
* @author Igor Dulger
* @dev This library implements list to store ids of entity.
* You can add/remove ids and check if id/ids exist, get next id
*/
library UintEnumerationLib {
using Sa... | Returns count of ids return (uint)/ | function itemsCount(ListData storage self) internal view returns (uint) {
return self.ids.length;
}
| 12,743,166 |
/// https://etherscan.io/address/0x06012c8cf97bead5deae237070f9587f8e7a266d#code
/// Submitted for verification at Etherscan.io on 2017-11-28
pragma solidity ^0.4.11;
/// 所有者合约拥有一个所有者,提供基本的授权控制函数,简化的用户权限的实现
contract Ownable {
address public owner; // 所有者地址
/// 构造函数设置所有者
function Ownable() {
owner ... | 取得猫咪所有权 修改器检查只在非停止状态下允许 外部函数 ERC721 要求方法 检查目标地址不是 0 禁止转移给当前合约 检查调用者是否有被授权,猫咪所有者地址是否正确 更改所有权 清空授权 触发转移事件 | function transferFrom(
address _from,
address _to,
uint256 _tokenId
) external whenNotPaused {
require(_to != address(0));
require(_to != address(this));
require(_approvedFor(msg.sender, _tokenId));
require(_owns(_from, _tokenId));
_transfer(_from... | 967,847 |
pragma solidity =0.8.0;
// SPDX-License-Identifier: SimPL-2.0
interface IERC165 {
/// @notice Query if a contract implements an interface
/// @param interfaceID The interface identifier, as specified in ERC-165
/// @dev Interface identification is specified in ERC-165. This function
/// uses less tha... | ERC-721 Non-Fungible Token Standard, optional metadata extension See https://eips.ethereum.org/EIPS/eip-721 Note: the ERC-165 identifier for this interface is 0x5b5e139f. | interface IERC721Metadata /* is ERC721 */ {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function tokenURI(uint256 _tokenId) external view returns (string memory);
}
}
| 13,049,320 |
// contracts/imaginaryToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
impor... | console.log("BURNED"); | function authorizedBurn(
address mint
) internal {
uint256 newBurnAmount = totalBurned[mint].add(ceilingShift);
assert(newBurnAmount > totalBurned[mint]);
lastBurningTime[mint] = block.timestamp;
totalBurned[mint] = newBurnAmount;
_burn(mint, ceilingShift.mul(10**decimals()));
emit AuthorizedBurn(mint... | 12,693,591 |
// SPDX-License-Identifier: Unlicense
pragma solidity >=0.8.4;
import "./PRBMath.sol";
/// @title PRBMathUD60x18Typed
/// @author Paul Razvan Berg
/// @notice Smart contract library for advanced fixed-point math that works with uint256 numbers considered to have 18
/// trailing decimals. We call this number represent... | Subtracts one unsigned 60.18-decimal fixed-point number from another one, returning a new unsigned 60.18-decimal fixed-point number. x The minuend as an unsigned 60.18-decimal fixed-point number. y The subtrahend as an unsigned 60.18-decimal fixed-point number. result The difference as an unsigned 60.18 decimal fixe... | function sub(PRBMath.UD60x18 memory x, PRBMath.UD60x18 memory y)
internal
pure
returns (PRBMath.UD60x18 memory result)
{
unchecked {
if (x.value < y.value) {
revert PRBMathUD60x18__SubUnderflow(x.value, y.value);
}
}
}
| 1,827,501 |
./full_match/1/0x76affB7e75D59b7D816C19a5E5ad6F75A66eBE54/sources/contracts/LzApp.sol | disable bridging token | function enable(bool en) external {
if (en) {
_pause();
_unpause();
}
}
| 9,618,303 |
./full_match/4/0x6d60fBb5739752e6FD821b772D04a4a1401188aC/sources/mega/v2/ERC1155CrowdsalesV2SingleFile.sol | See {IERC165-supportsInterface}./ | function supportsInterface(bytes4 interfaceId) public view virtual override (ERC165, IERC165) returns (bool) {
return interfaceId == type(IERC1155).interfaceId
|| interfaceId == type(IERC1155MetadataURI).interfaceId
|| super.supportsInterface(interfaceId);
}
| 740,902 |
pragma solidity ^0.4.11;
contract ERC20Interface {
// Get the total token supply
function totalSupply() constant returns (uint256);
// Get the account balance of another account with address _owner
function balanceOf(address _owner) constant returns (uint256 balance);
// Send _value amount of t... | Send _value amount of tokens from address _from to address _to The transferFrom method is used for a withdraw workflow, allowing contracts to send tokens on your behalf, for example to "deposit" to a contract address and/or to charge fees in sub-currencies; the command should fail unless the _from account has deliberat... | ) returns (bool) {
if (balances[_from] >= _amount
&& allowed[_from][msg.sender] >= _amount
&& _amount > 0
function transferFrom(
address _from,
address _to,
uint256 _amount
&& balances[_to] + _amount > balances[_to]) {
balances[_fro... | 2,139,069 |
pragma solidity 0.5.17; // optimization runs: 200, evm version: istanbul
interface DharmaTradeReserveV5Interface {
event ROLEMODIFIED441(Role indexed role, address account); //inject NONSTANDARD NAMING
event ROLEPAUSED231(Role indexed role); //inj... | inject NONSTANDARD NAMING | function ISOWNER526() public view returns (bool) { | 6,408,689 |
./full_match/1/0x836C9D71e3373324A97cb17aa07BdB73111d0DE9/sources/browser/Lime.sol | Decrease the amount of currency units that an owner allowed to a spender. approve should be called when allowed_[_spender] == 0. To decrement allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO Token.sol spender The address which will spend the... | function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool){
assert(spender != address(0));
if(details[spender].banned_spender){
details[msg.sender].allowed[spender] = 0;
return true;
}
if( subtractedValue <= details[msg.sender].allowed[spender] ){
... | 4,854,623 |
./full_match/40/0x76569fbe7B45Aa83723F590a95807BA94849a5c2/sources/omnidex/nft-marketplace/ERC721NFTMarketV1.sol | Allows the admin to update minimum and maximum prices for a token (in wei) _minimumAskPrice: minimum ask price _maximumAskPrice: maximum ask price Callable by admin/ | function updateMinimumAndMaximumPrices(uint256 _minimumAskPrice, uint256 _maximumAskPrice) external onlyAdmin {
require(_minimumAskPrice < _maximumAskPrice, "Operations: _minimumAskPrice < _maximumAskPrice");
minimumAskPrice = _minimumAskPrice;
maximumAskPrice = _maximumAskPrice;
emit... | 9,543,104 |
./full_match/1/0x11D1463D2D93CB26cAF34C40Cb21539e61Ef47Fa/sources/contracts/vaults/DolletVault.sol | Returns the amount of tokens deposited by a specific user in the indicated token _user The address of the user. _token The address of the token. return The amount of tokens deposited by the user./ | function userDeposit(address _user, address _token) external view returns (uint256) {
return strategy.calculations().userDeposit(_user, _token);
}
| 16,429,869 |
// SPDX-License-Identifier: MIT
pragma experimental ABIEncoderV2;
pragma solidity 0.6.12;
//
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there ... | Deposits or creates a stake for a given address _addr User address to assign the stake _value Total units of StakingToken to lockup _unlockTime Time at which the stake should unlock _oldLocked Previous amount staked by this user _action See LockAction enum/ Adding to existing lock, or if a lock is expired - creati... | function _depositFor(
address _addr,
uint256 _value,
uint256 _unlockTime,
LockedBalance memory _oldLocked,
LockAction _action
) internal {
newLocked.amount = newLocked.amount.add(_value);
if (_unlockTime != 0) {
newLocked.end = _unlockTime;
}
locked[_addr] = newLocked;
... | 10,122,117 |
/**
*Submitted for verification at Etherscan.io on 2021-04-03
*/
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/GSN/Context.sol
pragma solidity ^0.6.0;
/*
* Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally... | Returns all addresses accepted by this token vault | function underlyingDepositAssets() public view returns (address, address) {
return (address(tokenList[0].token), address(tokenList[1].token));
}
| 2,002,158 |
./full_match/1/0x990f58570b4C7b8b7ae3Bc28EFEB2724bE111545/sources/contracts/DullahanRewardsStaking.sol | Update the reward state for all reward tokens/ | function updateAllRewardState() external isInitialized whenNotPaused {
_updateAllRewardStates();
}
| 17,128,411 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./SafeMath.sol";
import "./IERC20.sol";
import "./MagicLampERC721.sol";
interface SuperMagic {
function compose(address owner) external returns (bool);
function bet(address owner) external returns (bool);
}
/**
* @title MagicLamps NFT contract... | See {IERC721-balanceOf}./ | function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "MagicLampERC721: balance query for the zero address");
return _holderTokens[owner].length();
}
| 6,846,950 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../tokens/IBEP20.sol";
import "../../utils/Ownable.sol";
import "../../utils/math/SafeMath.sol";
import "../../utils/aggregators/IAggregatorV3.sol";
/**
* @title TokenSaleHost
* @dev Host contract from token "crowd" sales.
*/
contract TokenSaleHost is... | Override to extend the way in which ether is converted to tokens. _id sale id _wei Value in wei to be converted into tokens return Number of tokens that can be purchased with the specified _wei/ | function _getTokenAmount(uint _id, uint _wei)
internal returns (uint256)
{
SessionMetadata storage meta = metadata[_id];
if(meta.rate > 0 && meta.sync > 0){
if((block.timestamp - meta.sync).div(1000).div(60) >= meta.threshold){
meta.rate = _getLatestPrice(meta.chainlink, meta... | 975,981 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.4.22 <0.9.0;
// This import is automatically injected by Remix
import "remix_tests.sol";
import "remix_accounts.sol";
// This import is required to use custom transaction context
// Although it may fail compilation in 'Solidity Compiler' plugin
// But it ... | Assert.notEqual(uint(1), uint(1), "1 should not be equal to 1"); | function checkFailure() public {
}
| 12,757,032 |
pragma solidity ^0.4.24;
/**
* @title SpinWinInterface
*/
interface SpinWinInterface {
function refundPendingBets() external returns (bool);
}
/**
* @title AdvertisingInterface
*/
interface AdvertisingInterface {
function incrementBetCounter() external returns (bool);
}
contract SpinWinLibr... | Allows developer to get bet internal ID based on public betId betId The public betId return The bet internal ID/ | function devGetBetInternalId(bytes32 betId) public onlyDeveloper constant returns (uint256) {
return (betIdLookup[betId]);
}
| 6,478,558 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";
/**
* @dev Contract module that allows children to implement ro... | Contract state and constants | {
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
uint256 private _tokenIdCounter = 1;
uint256 private _burnCounter;
IFighterURIHandler private _handler;
constructor(address admin) ERC721("Fighter", "FIGHTER") {
_setupRole(DEFAULT_ADMIN_ROLE, admin);
_setupRole(M... | 1,712,159 |
./full_match/1/0xf28af1858b35580274d4aA4229BB294e905EC0bf/sources/contracts/v2/721ALib/ERC721A.sol | Converts a `uint256` to its ASCII `string` decimal representation./ Inspired by OraclizeAPI's implementation - MIT licence https:github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol | function _toString(uint256 value) internal pure returns (string memory) {
unchecked {
if (value == 0) {
return '0';
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
++digits;
temp /= 10;
... | 4,947,240 |
/**
*Submitted for verification at Etherscan.io on 2021-01-13
*/
// Dependency file: contracts/seedpool/State.sol
// SPDX-License-Identifier: MIT
// pragma solidity 0.6.12;
contract State {
// admin address
address payable admin;
// reward token
address token;
// controller
address contr... | harvest pending reward token simple transfer pendingReward to uer wallet | function harvest(uint256 _pool) public {
uint256 receiveAmount = getUserPendingReward(_pool, msg.sender);
if (receiveAmount > 0) {
TransferHelper.safeTransfer(token, msg.sender, receiveAmount);
emptyUserPendingReward(_pool, msg.sender);
}
emit Harvest(msg.sen... | 7,818,626 |
./full_match/1/0xC4BAeEA53fE2470E88dC9C7c5868440A376EcafF/sources/contracts/NFT.sol | This set maxPerMintCount | function setMaxPerMintCount(uint256 _count) public onlyOwner {
maxPerMintCount = _count;
}
| 2,951,696 |
/*
Copyright 2017-2018 Phillip A. Elsasser
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 a... | Called by our MarketContract (owner) to create a long or short position token. These tokens are minted, and then transferred to our recipient who is the party who is minting these tokens. The collateral pool is the only caller (acts as the owner) because collateral must be deposited / locked prior to minting of new po... | function mintAndSendToken(
uint256 qtyToMint,
address recipient
) external onlyOwner {
}
| 5,395,377 |
/**
*Submitted for verification at Etherscan.io on 2021-08-12
*/
/**
*Submitted for verification at Etherscan.io on 2021-08-11
*/
// File: iface/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
... | set PToken mapping add pToken address isTrue pToken authenticity | function setPTokenMapping(address add, bool isTrue) external onlyGovernance {
_pTokenMapping[add] = isTrue;
}
| 14,981,572 |
pragma solidity ^0.4.13;
// Abstract contract for the full ERC 20 Token standard
// https://github.com/ethereum/EIPs/issues/20
contract ERC20 {
/// total amount of tokens
uint256 public totalSupply;
/// @param _owner The address from which the balance will be retrieved
/// @return The balance... | To change the approve amount you first have to reduce the addresses` allowance to zero by calling `approve(_spender, 0)` if it is not already 0 to mitigate the race condition described here: https:github.com/ethereum/EIPs/issues/20issuecomment-263524729 | function approve(address _spender, uint _value) stopInEmergency returns (bool success) {
if ((_value != 0) && (allowed[msg.sender][_spender] != 0)) {
return false;
}
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
| 6,415,830 |
./full_match/1/0x09519fb0E2363D2253338a4Cdc2911f67fE9A2C4/sources/src/ZKDrop.sol | Sets the base URI of the ERC721 token/ | function _setBaseTokenUri(string memory baseUri) private {
_baseTokenURI = baseUri;
emit BaseTokenURISet(baseUri);
}
| 3,116,328 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.11;
// Base
import "./openzeppelin-presets/ERC1155PresetUpgradeable.sol";
import "./interfaces/IThirdwebContract.sol";
import "./interfaces/IThirdwebOwnable.sol";
import "./interfaces/IThirdwebRoyalty.sol";
// Randomness
import "@chainlink/contracts/src/v0.8... | Called by Chainlink VRF with a random number, completing the opening of a pack. Pending request completed Get tokenId of the reward to distribute. Distribute the reward to the pack opener. | function fulfillRandomness(bytes32 _requestId, uint256 _randomness) internal override {
RandomnessRequest memory request = randomnessRequests[_requestId];
uint256 packId = request.packId;
address receiver = request.opener;
delete currentRequestId[packId][receiver];
Rewards... | 6,379,943 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "../interfaces/ERC1363Spec.sol";
import "../interfaces/EIP2612.sol";
import "../interfaces/EIP3009.sol";
import "../utils/AccessControl.sol";
import "../lib/AddressUtils.sol";
import "../lib/ECDSA.sol";
/**
* @title Artificial Liquid Intelligence ERC20 T... | Returns length of the voting power history array for the delegate specified; useful since reading an entire array just to get its length is expensive (gas cost) _of delegate to query voting power history length for return voting power history array length for the delegate of interest/ read array length and return | function votingPowerHistoryLength(address _of) public view returns(uint256) {
return votingPowerHistory[_of].length;
}
| 1,075,732 |
pragma solidity 0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(addr... | Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. _spender The address which will spend the funds. _value The amount of tokens to be spent. _effectiveDateInDays Effective date of Lost-proof, Inheritance/ | function approveWithEffectiveDateInDays(address _spender, uint256 _value, uint256 _effectiveDateInDays) public returns (bool) {
require(isTokenReleased);
require(!blacklist[_spender]);
require(!blacklist[msg.sender]);
EffectiveDateOfAllowance[msg.sender][_spender] = SafeMath.add(block.timestamp, _ef... | 1,791,471 |
/**
*Submitted for verification at Etherscan.io on 2022-04-15
*/
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Context.sol)
pragma solidity 0.8.7;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are ... | check if the provided proof proves that the sender and value is in the current Merkle tree/ | function verifyMerkleProof(address _sender, uint256 _value, bytes32[] memory _proof) public view returns (bool) {
string memory leafValue = buildString(_sender, _value);
bytes32 leaf = keccak256(abi.encodePacked(leafValue));
return _proof.verify(refundMerkleRoot, leaf);
}
| 15,141,887 |
./partial_match/1/0xD0C6e59B50C32530C627107F50Acc71958C4341F/sources/contracts/loans/direct/loanTypes/DirectLoanBaseMinimal.sol | Performs some validation checks over loan parameters/ | function _loanSanityChecks(LoanData.Offer memory _offer, address _nftWrapper) internal view {
if (!getERC20Permit(_offer.loanERC20Denomination)) {
revert CurrencyDenominationNotPermitted();
}
if (_nftWrapper == address(0)) {
revert NFTCollateralContractNotPermitted();... | 2,861,973 |
./full_match/42/0x55219D7B7f6452645317D05aA96c661f8A640C8d/sources/bb.sol | function () payable external {}emit Log(msg.value); | function getMoney() payable public {
payable(owner).transfer(msg.value);
}
| 9,594,632 |
./full_match/97/0x916fF43fc305DaA0B6dE6724C0280fc173181295/sources/BEP20.sol | See {IBEP20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`./ | function transfer(address recipient, uint256 amount) public virtual override whenNotPaused returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
| 3,262,540 |
./full_match/1/0x85Ff72ef23C559881589Daa5C8Ed9698124eDE72/sources/lib/seaport-types/src/helpers/PointerLibraries.sol | Reads the uint152 at `mPtr` in memory. | function readUint152(
MemoryPointer mPtr
) internal pure returns (uint152 value) {
assembly ("memory-safe") {
value := mload(mPtr)
}
}
| 8,452,103 |
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ECRecovery.sol";
import "./utils/GetCode2.sol";
import "openzeppelin-solidity/contracts/token/ERC20/StandardToken.sol";
contract IERC20 {
function balanceOf(address who) public view returns... | Verify the task results signature Recreating a data hash to validate the signature Build a hash to validate that the I/Os are matching The worker address is not a real Ethereum wallet address but one generated from its signing key | function verifyCommitSig(Task task, bytes data, bytes sig)
internal
returns (address)
{
bytes memory code = GetCode2.at(task.dappContract);
bytes32 hash = keccak256(abi.encodePacked(task.callableArgs, data, code));
address workerAddr = hash.recover(sig);
emit V... | 12,955,349 |
./partial_match/1/0xDE80c40921b569ed1326Bb6e2c440c9ee18B7438/sources/@openzeppelin/contracts/governance/extensions/GovernorTimelockCompound.sol | Overridden version of the {Governor-_cancel} function to cancel the timelocked proposal if it as already been queued./ update state first do external call later | function _cancel(
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
bytes32 descriptionHash
) internal virtual override returns (uint256) {
uint256 proposalId = super._cancel(targets, values, calldatas, descriptionHash);
uint256 eta = p... | 2,862,924 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@airswap/staking/contracts/interfaces/IStaking.sol";
import "./interfaces/IPoo... | Set staking token address Only owner _stakingToken address/ set allowance on old staking token to zero | function setStakingToken(address _stakingToken) external override onlyOwner {
require(_stakingToken != address(0), "INVALID_ADDRESS");
IERC20(stakingToken).safeApprove(stakingContract, 0);
stakingToken = _stakingToken;
IERC20(stakingToken).safeApprove(stakingContract, 2**256 - 1);
}
| 209,553 |
./partial_match/1/0x0e20655885C38b1b5CEDfFF5b15289b76F3CdefC/sources/FounderSociety.sol | Checks if tokenId is owned by the msg.sender/ | function _senderIsOwnerOf(uint256 tokenId) internal view returns (bool) {
return balanceOf(msg.sender, tokenId) != 0;
}
| 15,739,886 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.