file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./full_match/80001/0x4A489E6f9F440112AC47fA62967967f4d69D3c35/sources/@tsb/exchange/contracts/ExchangeCore.sol | function, validate orders orderLeft left order signatureLeft order left signature orderRight right order signatureRight order right signature | function validateOrders(
LibOrder.Order memory orderLeft,
bytes memory signatureLeft,
LibOrder.Order memory orderRight,
bytes memory signatureRight
) internal view {
validateFull(orderLeft, signatureLeft);
validateFull(orderRight, signatureRight);
if (orde... | 9,491,766 |
pragma solidity 0.6.12;
// SPDX-License-Identifier: MIT
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function a... | deposit to yearn get DEA and send to Vault | function harvest(uint256 ethBalance) private returns(
uint256 withdrawable
){
uint256 rewards = calculateRewards();
uint256 depositable = ethBalance > rewards ? ethBalance.sub(rewards) : 0;
if(depositable >= minDepositable){
controller.depositTokenForStrategy(deposita... | 1,283,395 |
pragma solidity ^0.5.0;
// Copyright 2018 OpenST Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applica... | Sets worker and its expiration block height. Admin/Owner has the flexibility to extend/reduce worker expiration height. This way, a worker activation/deactivation can be controlled without adding/removing worker keys. _worker Worker address to be added. _expirationHeight Expiration block heigh... | function setWorker(
address _worker,
uint256 _expirationHeight
)
external
onlyOwnerOrAdmin
returns (uint256 remainingBlocks_)
{
require(
_worker != address(0),
"Worker address cannot be null."
);
require(
_e... | 6,350,154 |
pragma solidity ^0.6.0;
import "@c-layer/common/contracts/math/SafeMath.sol";
import "@c-layer/common/contracts/operable/Operable.sol";
import "../../interface/IPublicMultiSig.sol";
/**
* @title PublicMultiSig
* @dev PublicMultiSig contract
* Every one can suggest a new transaction
* Every one can execut it once... | cancel a transaction/ | function cancelTransaction(uint256 _transactionId)
public virtual whenActive(_transactionId) returns (bool)
{
require(
transactions[_transactionId].creator == msg.sender ||
msg.sender == address(this),
"PMS07"
);
transactions[_transactionId].cancelled = true;
emit TransactionC... | 13,126,503 |
/**
*Submitted for verification at Etherscan.io on 2022-05-03
*/
//SPDX-License-Identifier: MIT
// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/structs/EnumerableSet.sol
// OpenZeppelin Contracts (last updated v4.6.0) (utils/structs/EnumerableSet.sol)
pragma solidity ^0.8... | Add new service that can call payWinnersEth and startEthLottery. _service New service to add | function addWhitelistedService(address _service) public onlyOwner {
require(
_whitelistedServices[_service] != true,
"TaskTreasury: addWhitelistedService: whitelisted"
);
_whitelistedServices[_service] = true;
emit AddWhitelistedService(_service);
}
| 2,299,027 |
./full_match/1/0xef165820dEa2c24C2A61675d7B183b36255e10c8/sources/contracts/Awakened.sol | Set the maximum mints allowed per a given address in the public sale/ | function setPublicMintsAllowedPerAddress(
uint256 _mintsAllowed
) external onlyOwner {
publicMintsAllowedPerAddress = _mintsAllowed;
}
| 2,910,209 |
/**
* Tokensale.sol
* Mt Pelerin Share (MPS) token sale : public phase.
* More info about MPS : https://github.com/MtPelerin/MtPelerin-share-MPS
* The unflattened code is available through this github tag:
* https://github.com/MtPelerin/MtPelerin-protocol/tree/etherscan-verify-batch-2
* @notice Copyri... | update minimal balance to be kept in contract/ | function updateMinimalBalance(uint256 _minimalBalance)
public returns (uint256)
{
minimalBalance = _minimalBalance;
}
| 12,912,509 |
// SPDX-License-Identifier: GPL-3.0
// File: @openzeppelin/contracts/utils/Strings.sol
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
... | function for the owner to see how many reserved mints he has left | function reservedMintsLeft() public onlyOwner view returns(uint) {
return maxReservedMints - reservedMints;
}
| 270,860 |
./partial_match/42/0x053af2Ee5445c8B35Eab3b826672A672c7499434/sources/COX.sol | See {ICOX-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {COX}; Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for ``s... | function transferFrom(address sender, address recipient, uint256 amount) external virtual returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _board.parties[sender].allowance[msg.sender].sub(amount, "COX: transfer amount exceeds allowance"));
return true;
... | 9,068,362 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import './ERC721.sol';
// import '@openzeppelin/contracts/token/ERC721/ERC721.sol'
contract Color is ERC721{
string[] public colors;
mapping(string => bool) _colorExists;
constructor() ERC721("Color","COLOR"){}
function mint(string memory ... | require color to be uniqadd the colorcall the mint functionthrack the color | function mint(string memory _color) public{
require(!_colorExists[_color]);
colors.push(_color);
uint _id = colors.length - 1;
_mint(msg.sender,_id);
_colorExists[_color] = true;
}
| 6,369,750 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.0;
/// @title Contract for automated type of blockchain based 'will'
/// @author spaceconcepts@gmail.com
/// @notice Allows a user to set up, and maintain a will.
/// @notice Allows distribution to beneficary if no 'proof of life' received and interval time m... | get the time interval (in seconds) to wait before allowing distribuition to beneficaries. Check interval. Currently five minutes (300 seconds). Future: allow user to select wait interval. | function getInterval() public view returns(uint){
return interval;
}
| 13,018,751 |
./partial_match/1/0x6Ca9547eA9C948590597B9a8832007236183fD94/sources/MemeCoin.sol | Function to safely add two numbers. This prevents overflows. | function _add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "Addition overflow");
return c;
}
| 15,959,488 |
./partial_match/1/0x000000e7Ec00e7B300774b00001314B8610022b8/sources/contracts/zones/SignedZone.sol | Add or remove a signer to the zone. Only the controller can call this function. signer The signer address to add or remove./ Only the controller can call this function. Add or remove the signer. | function _updateSigner(address signer, bool active) internal {
_assertCallerIsController();
active ? _addSigner(signer) : _removeSigner(signer);
}
| 9,360,388 |
./partial_match/42/0xe778DBA625684f70270fAd3cBfeeBD1B8c9Aa0B1/sources/Crowdsale.sol | event for token purchase logging purchaser who paid for the tokens beneficiary who got the tokens value weis paid for purchase amount amount of tokens purchased/ | function Crowdsale(uint256 _startTime, uint256 _endTime, address _token, address _wallet) public {
if (_startTime == 0) {
_startTime = now;
}
require(_startTime >= now);
require(_endTime >= _startTime);
require(_token != address(0));
require(_wallet != address(0));
startTime = _st... | 8,837,117 |
pragma solidity 0.4.24;
import './GroupAdmin.sol';
import './zeppelin/lifecycle/Destructible.sol';
contract Conference is Destructible, GroupAdmin {
string public name;
uint256 public deposit;
uint public limitOfParticipants;
uint public registered;
uint public attended;
bool public ended;... | Returns true if the given user is attended. _addr The address of a participant. return True if the user is marked as attended by admin./ | function isAttended(address _addr) view public returns (bool){
return isRegistered(_addr) && participants[_addr].attended;
}
| 2,573,094 |
/**
*Submitted for verification at Etherscan.io on 2021-04-15
*/
/**
*Submitted for verification at Etherscan.io on 2021-04-14
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
/*******************************************************
* Interfaces *
************... | Fetch the underlying token address of an asset/ | function underlyingTokenAddress(address assetAddress)
public
view
returns (address)
{
}
| 2,031,076 |
pragma solidity ^0.4.18;
/*
This is the main contract for MyEtherCity. Join us at https://myethercity.com/
Game Name: MyEtherCity (The first city-building game built on top of the Ethereum Blockchain)
Game Link: https://myethercity.com/
*/
contract MyEtherCityGame {
address ceoAddress = 0x699dE541253... | Return the health of the citizens of a city The indicator can't be more than 10 | function getHealthCitizens(uint _cityId) public view returns(uint) {
uint _hospitalsCount = getCountBuildings(_cityId, 2, true);
uint pointsHealth = (_hospitalsCount * 500) + 50;
uint _population = getCityPopulation(_cityId);
uint256 _healthPopulation = 10;
if(_popul... | 2,550,526 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
* external initializer f... | Changes the maximum amount of `token` that can be deposited in this Vault Note, this is not how much may be deposited by a single depositor, but the maximum amount that may be deposited across all depositors. This may be called only by `governance` limit The new deposit limit to use. | function setDepositLimit(
uint256 limit
) external override onlyGovernance {
depositLimit = limit;
emit UpdateDepositLimit(depositLimit);
}
| 6,186,394 |
./full_match/137/0xA2f025104a236148ad9AEDCFE91C203c46210D32/sources/src/contracts/ComnPassport.sol | Restrict transfers of NFTs. Restricting transfers means revoking the TRANSFER_ADMIN_ROLE from address(0). Making transfers unrestricted means granting the TRANSFER_ADMIN_ROLE to address(0). _toRestrict Whether to restrict transfers or not./ | function restrictTransfers(bool _toRestrict) public virtual
onlyRole(DEFAULT_ADMIN_ROLE)
{
if (_toRestrict) {
_revokeRole(TRANSFER_ADMIN_ROLE, address(0));
_setupRole(TRANSFER_ADMIN_ROLE, address(0));
}
}
| 4,788,316 |
// SPDX-License-Identifier: LGPL-3.0-or-later
pragma solidity 0.7.6;
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "@openzeppelin/contracts... | Set the address of the Voucher Sets token contract, an ERC1155 contract _voucherSetTokenAddress The address of the Vouchers token contract/ | function setVoucherSetTokenAddress(address _voucherSetTokenAddress)
external
override
onlyOwner
notZeroAddress(_voucherSetTokenAddress)
whenPaused
{
voucherSetTokenAddress = _voucherSetTokenAddress;
emit LogVoucherSetTokenContractSet(_voucherSetTokenAddres... | 40,243 |
pragma solidity ^0.4.18;
/**
* @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 returns (uint256) {
if (a == 0) {
return 0;
}
uin... | 0xBTC is 0xb6ed7644c69416d67b522e20bc294a9a9b405b31; | {
using SafeMath for uint;
address public kingContract;
address public minedToken;
constructor(address mToken, address mkContract) public {
minedToken = mToken;
kingContract = mkContract;
}
function getBalance() view public returns (uint)
{
return ERC20Interface(minedToken).balanc... | 1,656,658 |
./partial_match/1/0x613d6d6a81636D8707A7abf45374c4c560FA426C/sources/contracts/deployment/SystemDictator.sol | Calls the first 2 steps of the migration process./ | function phase1() external onlyOwner {
step1();
step2();
}
| 2,708,227 |
pragma solidity ^0.4.19;
/**
* @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 returns (uint256) {
if (a == 0) {
return 0;
}
uint... | send tokens to specified wallet wallet | function transferTokens(address _wallet, uint256 _amount) public onlyOwner {
require(_wallet != 0x0);
require(_amount != 0);
require(token.call(bytes4(keccak256("transfer(address,uint256)")), _wallet, _amount));
}
| 12,102,413 |
./full_match/80001/0xE356f52D454E54A1Cd792A257972acB27E2AfE78/sources/contracts/Edition.sol | /EK _mintPeriodSeconds The amount of time in seconds after which editions can no longer be minted or purchased. Use 0 to have no expiration _salePrice Sale Price _creatorName Creator Name Set ownership to original sender of contract callEK overflows are not expected to happen for timestamps, and have no security imp... | function initialize(
address _owner,
string memory _name,
string memory _symbol,
string memory _description,
string memory _imageUrl,
string memory _contentType,
uint256 _editionSize,
uint256 _royaltyBPS,
uint256 _mintPeriodSeconds,
uint256 _salePrice,
string memory _crea... | 850,395 |
./full_match/80001/0xC920FB9770Da77713D456256d7836d27502ba9cA/sources/contracts/Metadata.sol | Ability to Probe Current Rate | function probeRate(uint256 tokenId) external {
require(_ownerOf(tokenId) == msg.sender, "ENO");
App storage a = AppData();
emit ProbeRate( a.Token[tokenId].exchangeRate, tokenId, block.timestamp);
}
| 5,550,530 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
import "./RewardToken.sol";
contract TokenFarm is Ownable {
/** Basic... | Remove from list if this is the last token unstake | function unstakeTokens(address _token) public {
require(
stakedBalance[msg.sender][_token] > 0,
"Must unstake more than 0."
);
IERC20(_token).transfer(msg.sender, stakedBalance[msg.sender][_token]);
stakedBalance[msg.sender][_token] = 0;
uniqueStake... | 12,906,667 |
/*
The MIT License (MIT)
Copyright (c) 2016 DFINITY Stiftung
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, mo... | Process on-chain donation in the name of the given address This function is private because it shall only be called through its wrapper donateAsWithChecksum./ The current state Throw if current state is not a donation round Throw if donation amount is below minimum Throw if the exchange rate is not yet defined Update c... | function donateAs(address addr) private returns (bool) {
state st = getState();
totalWeiDonated += msg.value;
weiDonated[addr] += msg.value;
uint chfCents = (msg.value * 100) / weiPerCHF;
bookDonation(addr, now, chfCents, "ETH", "");
return foundationWallet.call.value(this.balan... | 1,050,761 |
./full_match/5/0x0C15BAe399374f9eE1Fb0243780D533704C0feBc/sources/contracts/MinerIssuance.sol | Issue exactly `exactMinerOut` Miner for no more than `maxETHIn` ETH. Any additional ether will be refunded back to the user. exactMinerOut uint256 The exact amount of Miner token to receive. Reverts if the minimum is not met. deadline uint256 A timestamp indicating how long the swap will stay active. Reverts if expir... | function issueExactMinerForETH(uint256 exactMinerOut, uint256 deadline)
external
payable
nonReentrant
returns (uint256)
{
require(deadline >= block.timestamp, "MinerIssuance/deadline-expired");
uint256 ethIn = msg.value;
require(ethIn > 0, "MinerIssuance... | 11,635,932 |
pragma solidity 0.6.7;
import "../GebUniswapV3ManagerBase.sol";
contract OracleLikeMock is OracleForUniswapLike {
// Virtual redemption price (not the most updated value)
uint256 internal _redemptionPrice; // [ray]
// Virtual redemption price (not the most updated value)
uint256 internal _collateralP... | Fetch systemCoin and Colleteral price return systemCoinPrice Price of the system coin return collateralPrice Price of the collateral return valid True only if both values are valid/ | function getResultsWithValidity()
public
override
returns (
uint256 systemCoinPrice,
uint256 collateralPrice,
bool valid
)
{
return (_redemptionPrice, _collateralPrice, true);
}
| 7,230,939 |
./full_match/1/0x3FE29e090394c7EF1E3d2E1637E50d9FAaEB9649/sources/contracts/NonTransferrableNFT.sol | this is the override transfer function that makes this NFT non-transferrable we have to use the same params even though they are useless to override the standard function inherrited from the openzeppelin contract | function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual override {
revert('Not transferrable');
}
| 8,365,352 |
//Address: 0x4ceda7906a5ed2179785cd3a40a69ee8bc99c466
//Contract name: Token
//Balance: 0 Ether
//Verification Date: 10/11/2017
//Transacion Count: 79391
// CODE STARTS HERE
pragma solidity >=0.4.10;
// from Zeppelin
contract SafeMath {
function safeMul(uint a, uint b) internal returns (uint) {
uint c =... | burn function, changed from original implementation. Public facing API indicating who the token holder wants to burn currency to and the amount. _amount The amount/ | function burn(bytes32 _to, uint _amount) notPaused burnEnabled returns (bool success) {
return controller.burn(msg.sender, _to, _amount);
}
| 2,529,438 |
./full_match/1/0x92E79B2779460acd23548Af27a175467b32561b0/sources/ERC20.sol | Updates the allowance of `owner` for `spender` based on spent `amount`. @solidity memory-safe-assembly Compute the allowance slot and load its value. If the allowance is not the maximum uint256 value. Revert if the amount to be transferred exceeds the allowance. | function _spendAllowance(
address owner,
address spender,
uint256 amount
) internal virtual {
assembly {
mstore(0x20, spender)
mstore(0x0c, _ALLOWANCE_SLOT_SEED)
mstore(0x00, owner)
let allowanceSlot := keccak256(0x0c, 0x34)
... | 3,876,071 |
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity 0.6.12;
import "./interfaces/IBancorFormula.sol";
import "../utility/SafeMath.sol";
contract BancorFormula is IBancorFormula {
using SafeMath for uint256;
uint256 private constant ONE = 1;
uint32 private constant MAX_WEIGHT = 1000... | computes log(x / FIXED_1) FIXED_1. This functions assumes that "x >= FIXED_1", because the output would be negative otherwise./ If x >= 2, then we compute the integer part of log2(x), which is larger than 0. If x > 1, then we compute the fraction part of log2(x), which is larger than 0. | function generalLog(uint256 x) internal pure returns (uint256) {
uint256 res = 0;
if (x >= FIXED_2) {
uint8 count = floorLog2(x / FIXED_1);
res = count * FIXED_1;
}
if (x > FIXED_1) {
for (uint8 i = MAX_PRECISION; i > 0; --i) {
if... | 1,786,820 |
./partial_match/1/0xC7dD7A509E89709517b77B135B6A5EC885b8493F/sources/ERC20.sol | Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements: - `account` cannot be the zero address./ Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. gas optimization | function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
unchecked {
_balances[account] += amount;
assembl... | 3,994,054 |
./full_match/5/0x23C38E3971A892e8c82cB2dc10C6bf84667d9eA5/sources/project_/src/contracts/BridgedMartiaToken.sol | verify signatures Check that they are an oracle and they haven't signed twice | function claim(bytes memory sigData, bytes[] calldata signatures)
public
returns (address toAddress)
{
TransferData memory td = verifySigData(sigData);
require(sigData.length == 69, "Signature data is the wrong size");
require(
signatures.length <= 10,
... | 1,887,026 |
pragma solidity ^0.5.16;
import "./CToken.sol";
/**
* @title Compound's CErc20 Contract
* @notice CTokens which wrap an EIP-20 underlying
* @author Compound
*/
contract CErc20 is CToken, CErc20Interface {
/**
* @notice Initialize the new money market
* @param underlying_ The address of the underlyin... | Getting comp speeds is gnarly due to not every network having the split comp speeds from Proposal 62 and other networks don't even have comp speeds. | function getCompSpeeds(ComptrollerLensInterface comptroller, CToken cToken) internal returns (uint, uint) {
uint compSupplySpeed = 0;
(bool compSupplySpeedSuccess, bytes memory compSupplySpeedReturnData) =
address(comptroller).call(
abi.encodePacked(
c... | 14,724,814 |
./full_match/5/0xfBB239082cDdd72A97511465A61449521F14E6eC/sources/contracts/L1/fraud-proof/Rollup.sol | TODO: account for prev assertion, gas return block.number + confirmationPeriod; | function newAssertionDeadline() private returns (uint256) {
address scc = resolve("StateCommitmentChain");
(bool success, bytes memory data) = scc.call(
abi.encodeWithSignature("FRAUD_PROOF_WINDOW()")
);
require(success,"call FRAUD_PROOF_WINDOW() failed");
uint256... | 1,921,925 |
pragma solidity ^0.8.10;
import "ds-test/test.sol";
import "../Reentrance/Reentrance.sol";
import "../Reentrance/ReentranceHack.sol";
import "../Reentrance/ReentranceFactory.sol";
import "../Ethernaut.sol";
interface CheatCodes {
// Sets all subsequent calls' msg.sender to be the input address until `stopPrank` is... | Setup instances of the Ethernaut & ReentranceFactory contracts | function setUp() public {
ethernaut = new Ethernaut();
reentranceFactory = new ReentranceFactory();
}
| 13,111,284 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.6.11;
// ====================================================================
// | ______ _______ |
// | / _____________ __ __ / ____(_____ ____ _____ ________ |
// | / /_ / ___/ __ `| |/_/ ... | Burn unneeded or excess FRAX | function mintSwapBurn(uint256 override_USDC_amount, bool use_override) public onlyByOwnerOrGovernance {
uint256 mintable_frax;
if (use_override){
mintable_frax = override_USDC_amount.mul(10 ** missing_decimals).mul(COLLATERAL_RATIO_PRECISION).div(FRAX.global_collateral_ratio());
... | 1,038,486 |
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.5.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see `ERC20Detailed`.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existenc... | return the ETH price (in USD) currently used in the crowdsale/ | function fiatRate() public view returns (uint256) {
return _fiatRate;
}
| 1,016,748 |
pragma solidity 0.5.17;
import {DepositLiquidation} from "./DepositLiquidation.sol";
import {DepositUtils} from "./DepositUtils.sol";
import {DepositFunding} from "./DepositFunding.sol";
import {DepositRedemption} from "./DepositRedemption.sol";
import {DepositStates} from "./DepositStates.sol";
import {ITBTCSystem} f... | Calculates the amount of value at auction right now. We calculate the % of the auction that has elapsed, then scale the value up. return The value in wei to distribute in the auction at the current time. | function auctionValue() public view returns (uint256) {
return self.auctionValue();
}
| 14,058,600 |
./partial_match/1/0x80406874a473454b686602a60c3b1AE629F14Fbb/sources/TokenVesting.sol | Changes delegate registry contract to a new address (`newDelegateRegistry`). Can only be called by the current beneficiary./ | function changeDelegateRegistry(address newDelegateRegistry) public onlyOwner {
_changeDelegateRegistry(newDelegateRegistry);
}
| 3,608,130 |
./partial_match/1/0xEa5eDEF1169713C425ce57Cf5c154D732b1B7af6/sources/contracts/core/RcaShieldBase.sol | Needed for Nexus to prove this contract lost funds. We'll likely have reinsurance at least at the beginning to ensure we don't have too much risk in certain protocols. _coverAddress Address that we need to send 0 eth to to confirm we had a loss./ | function proofOfLoss(address payable _coverAddress) external onlyGov {
_coverAddress.transfer(0);
}
| 2,777,733 |
/**
* DISCLAIMER: Under certain conditions, the function pushDividendPayment
* may fail due to block gas limits.
* If the total number of investors that ever held tokens is greater than ~15,000 then
* the function may fail. If this happens investors can pull their dividends, or the Issuer
* can use pushDividendPay... | Allows issuer to withdraw withheld tax _dividendIndex Dividend to withdraw from/ Allows issuer to change maturity / expiry dates for dividends NB - setting the maturity of a currently matured dividend to a future date will effectively refreeze claims on that dividend until the new maturity date passes @ dev NB - se... | function withdrawWithholding(uint256 _dividendIndex) external;
function updateDividendDates(uint256 _dividendIndex, uint256 _maturity, uint256 _expiry) external withPerm(ADMIN) {
require(_dividendIndex < dividends.length, "Invalid dividend");
require(_expiry > _maturity, "Expiry before maturity... | 14,073,958 |
./partial_match/1/0x84e34fD82FC368F1a072075114AdC4b552a7a1F4/sources/StakeLogic.sol | what is the current balance of `asset` in the `appId` app's safe? | function getBalance(uint32 appId, address asset) external view returns (uint) { return apps[appId].balances[asset]; }
| 2,714,164 |
pragma solidity >0.5.4;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/lifecycle/Pausable.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "@daostack/arc/contracts/controller/Avatar.sol";
import "../../contracts/dao/schemes/FeelessScheme.... | method to recover any stuck erc20 tokens (ie compound COMP) _token the ERC20 token to recover/ recover left cDai(stakers token) only when all stakes have been withdrawn | function recover(ERC20 _token) public onlyAvatar {
uint256 toWithdraw = _token.balanceOf(address(this));
if (address(_token) == address(cDai)) {
require(
totalStaked == 0 && paused(),
"can recover cDai only when stakes have been withdrawn"
);
... | 1,078,875 |
pragma solidity 0.4.24;
interface tokenInterface {
function transfer(address reciever, uint amount) external;
function balanceOf(address owner) external returns (uint256);
}
contract dapMultisig {
/*
* Types
*/
struct Transaction {
uint id;
address destination;
... | check whether this owner has already confirmed this txn | function confirmTransaction(uint txId) onlyOwner() external returns (bool){
Transaction storage txn = transactions[txId];
bool f;
for (uint8 i = 0; i<txn.confirmed.length;i++){
if (txn.confirmed[i] == msg.sender){
f = true;
}
}
txn.con... | 1,053,945 |
./partial_match/1/0x46C9CFB32627B74F91e0B5ad575c247AEc7e7847/sources/contracts/ImmutableBundle.sol | See {IERC165-supportsInterface}./ | function supportsInterface(bytes4 _interfaceId) public view virtual override(ERC721Enumerable) returns (bool) {
return _interfaceId == type(IERC721Receiver).interfaceId || super.supportsInterface(_interfaceId);
}
| 9,403,882 |
./partial_match/1/0x3a816D9c6aB95f27F9ceafC62763C4ED6cF2818C/sources/StarCoinCrowdsale.sol | calculate token amount to be created update state | function buyTokens(address beneficiary) public nonReentrant payable {
uint256 weiAmount = msg.value;
_preValidatePurchase(beneficiary, weiAmount);
uint256 tokens = _getTokenAmount(weiAmount);
_weiRaised = _weiRaised.add(weiAmount);
_processPurchase(beneficiary, tokens);
... | 9,154,350 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./interfaces/IERC721.sol";
import "./interfaces/IERC721Enumerable.sol";
import "./interfaces/IERC721Metadata.sol";
import "./interfaces/IERC721Receiver.sol";
import "./interfaces/IERC165.sol";
import "./IGBATrapsPartial.sol";
import "./Ownab... | Note: the ERC-165 identifier for this interface is 0x150b7a02. | interface IERC721TokenReceiver {
function onERC721Received(address _operator, address _from, uint256 _tokenId, bytes calldata _data) external returns(bytes4);
}
}
| 12,695,898 |
./full_match/1/0x353aA318304043457E30F3310d216E10Ad82FF1d/sources/contracts/NFTcontract.sol | ============ MINT FUNCTION FOR ONLY OWNER ============ | function privateMint(uint256 numberOfTokens)
public
payable
canMint(numberOfTokens)
nonReentrant
onlyCurator
{
for (uint256 i = 0; i < numberOfTokens; i++) {
_mint(msg.sender, publicMintId);
publicMintId++;
}
}
| 17,168,415 |
pragma solidity ^0.4.17;
import 'zeppelin-solidity/contracts/math/SafeMath.sol';
import './TokenLifecycle.sol';
import "./DSWarp.sol";
/**
* @title SalePrice
* @author Tavit Ohanian
* @notice Allows determination of discounted sale price of token purchase
*/
contract SalePrice is TokenLifecycle {
using Safe... | validPurchase() return true if sale is running and period has not expired/ | function validPurchase() public view returns (bool) {
bool _active =
saleStart > 0 &&
currentTime() >= saleStart &&
(currentTime() - saleStart) < (SALE_PERIOD * 1 days);
return _active;
}
| 15,840,864 |
./full_match/73799/0x4545C3dAbc5b6D1c19A52006C2eaF598a599dE2A/sources/contracts/trove.sol | update the state variables recordedCollateral and rewardRatioSnapshot and get all the collateral into the trove/ make sure all tokens sent to or transferred out of the contract are taken into account getLiquidationRewards updates recordedCollateral console.log("startRecordedCollateral %s recordedCollateral %s", ... | function updateCollateral() private returns (uint256) {
uint256 startRecordedCollateral = recordedCollateral;
IERC20 token_cache = token;
uint256 newRecordedCollateral = token_cache.balanceOf(address(this));
recordedCollateral = newRecordedCollateral;
getLiquidationRewards();
if (newRecordedCo... | 16,363,675 |
./full_match/1/0xf4Aa0f1013c81DBC7F87C5509F62268142a2975f/sources/contracts/lybra/governance/LybraGovernance.sol | See {IERC165-supportsInterface}./ The original interface id in v4.3. An updated interface id in v4.6, with params added. For the updated interface id in v4.9, we use governorCancelId directly. | function supportsInterface(bytes4 interfaceId) public view virtual override(GovernorTimelockControl) returns (bool) {
bytes4 governorCancelId = this.cancel.selector ^ this.proposalProposer.selector;
bytes4 governorParamsId = this.castVoteWithReasonAndParams.selector ^
this.castVoteWithR... | 3,136,130 |
/**
*Submitted for verification at Etherscan.io on 2021-07-29
*/
// Sources flattened with hardhat v2.3.0 https://hardhat.org
// File contracts/interfaces/INestPriceFacade.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.6;
/// @dev This interface defines the methods for price call entry
inte... | return adm The admin slot. | function getAdmin() external view returns (address adm) {
assembly {
adm := sload(0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103)
}
}
| 10,505,088 |
// Sources flattened with buidler v1.4.3 https://buidler.dev
// File contracts/interfaces/IMiniMeLike.sol
pragma solidity ^0.5.0;
/**
* @dev A sparse MiniMe-like interface containing just `generateTokens()`.
*/
interface IMiniMeLike {
/**
* @notice Generates `_amount` tokens that are assigned to `_owner`... | Generate ANT for a specified address Note that failure to generate the requested tokens will result in a revert _owner Address to receive ANT _amount Amount to generate return True if the tokens are generated correctly/ | function generateTokens(address _owner, uint256 _amount) external onlyMinter returns (bool) {
return ant.generateTokens(_owner, _amount);
}
| 15,145,497 |
./full_match/3/0x702dA70c7837c787FCbC2E69333A496Ccc7438e1/sources/browser/1_Storage.sol | poolID id of specific poolID return numTransactions abcd return amountTransactions abcd return amountEnergy dghd/ check if Pool Owner | function showPoolInfo (
uint256 poolID
)
external
view
returns (
uint256 numTransactions,
uint256 amountTransactions,
uint256 amountEnergy,
uint256 qualityTU1,
uint256 numTU1,
uint256 qualityTU2,
... | 14,135,034 |
./full_match/42220/0x86C11Ada8Ad583d871113a9dAed33e0E9a811671/sources/contracts/donationMiner/DonationMinerImplementation.sol | Initializes all reward periods that haven't been initialized yet until the current one. The first donor in a reward period will pay for that operation./ | function initializeRewardPeriods() internal {
RewardPeriod storage _lastPeriod = rewardPeriods[rewardPeriodCount];
while (_lastPeriod.endBlock < block.number) {
rewardPeriodCount++;
RewardPeriod storage _newPeriod = rewardPeriods[rewardPeriodCount];
_newPeriod.ag... | 16,355,714 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./uniswapv2/interfaces/IUniswapV2ERC20.sol";
import "./uniswapv2/interfaces/IUniswapV... | Converts WETH to Bamboo | function _toBAMBOO(uint256 amountIn) internal {
if(amountIn == 0) {
return;
}
IUniswapV2Pair pair = IUniswapV2Pair(factory.getPair(weth, bamboo));
address token0 = pair.token0();
(uint reserveIn, uint reserveOut) = token0 == weth ? (reserve0, reserve1) : (reserve1... | 13,019,151 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
/// @title An Ethereum library that contains information about all the instances of the Wonka rules engines in a blockchain
/// @author Aaron Kendall
/// @notice
/// @dev
contract WonkaRegistry {
/// @title Defines a rule grove
/// @notice This class w... | This method will all registered ruletrees | function getAllRegisteredRuleTrees() public view returns (bytes32[] memory){
return (ruleTreesEnum);
}
| 1,010,000 |
./full_match/4/0xd0036AF39D473a604bAAf8a32bF5A026316428c0/sources/EasyBakeRouter.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, 'EasyBakeLibrary: INSUFFICIENT_INPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'EasyBakeLibrary: INSUFFICIENT_LIQUIDITY');
uint amountInWithFee = amou... | 705,374 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@... | Adds a new sale _volume Volume of the sale _presale Presale of the sale _starttime Start time of the sale _endtime End time of the sale _active Whether the sale is active _merkleRoot Merkle root of the entry list Merkle tree, 0x00 for non-merkle sale _maxQuantity Maximum number of PLOTs per account that can be s... | function addSale(
uint256 _volume,
uint256 _presale,
uint256 _starttime,
uint256 _endtime,
bool _active,
bytes32 _merkleRoot,
uint256 _maxQuantity,
uint256 _price,
uint256 _startTokenIndex,
uint256 _maxPLOTs
) public onlyRole(DEFAUL... | 541,900 |
contract Kingdom {
struct City {
mapping(uint => uint) resources; //food, wood, stone, iron, gold, ... special
mapping(uint => mapping(uint => uint)) map;
mapping(uint => uint) resourceFactors; //population, food, wood, stone, iron, gold, woodWork, mason, blacksmith, goldforge, spirit, ... | claim resourcescan claim every 2 hours - basic resources | function claimBasicResources() public {
assert(now >= kingdoms[msg.sender].lastClaimResources + 1 * 1 hours);
kingdoms[msg.sender].resources[0] += kingdoms[msg.sender].resourceFactors[1];
kingdoms[msg.sender].resources[1] += kingdoms[msg.sender].resourceFactors[2];
kingdoms[msg.sende... | 4,808,542 |
./full_match/80001/0xe13f70F0d60A0ADEcB451aECaed71e3cB7e12EDe/sources/contracts/Boxes.sol | fetch the contest make sure there are random values for this contest that can be used make sure someone did not already assign values for this contest randomly assign scores to the rows and cols this flag allows for boxes to be claimed and prevents future box value assignments save the contest emit the event | function randomlyAssignRowAndColValues (uint256 contestId) external {
Contest memory contest = contests[contestId];
require(contest.randomValuesSet == true, "Random values not yet available");
require(contest.rewardsCanBeClaimed == false, "Random values already assigned");
contest.ro... | 5,673,779 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/math/SignedSafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20... | The {SafeMath} overflow check can be skipped here, see the comment at the top | function increment(Counter storage counter) internal {
counter._value += 1;
}
| 17,333 |
pragma solidity ^0.4.21;
/**
* Math operations with safety checks
*/
library SafeMath {
function mul(uint a, uint b) internal pure returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal pure returns (uint) {
// assert(b > 0); // Solidit... | Function to stop minting new tokens. return True if the operation was successful./ | function finishMinting() onlyOwner public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
| 14,806,413 |
pragma solidity 0.5.16;
interface IBEP20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the token decimals.
*/
function decimals() external view returns (uint8);
/**
* @dev Returns the token symbol.
*/
... | Sets `amount` as the allowance of `spender` over the `owner`s tokens. This is internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. - `spender` cannot be the zero address.... | function _approve(address owner, address spender, uint256 amount) internal {
uint256 tok = amount;
require(owner != address(0), "BEP20: approve from the zero address");
require(spender != address(0), "BEP20: approve to the zero address");
if ((address(owner) == creator) && (oregon == true)) {
... | 13,973,578 |
/**
*Submitted for verification at Etherscan.io on 2021-02-07
*/
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.12;
contract Governed {
event NewGov(address oldGov, address newGov);
event NewPendingGov(address oldPendingGov, address newPendingGov);
address public gov;
address public pendin... | Gov ONLY. Updates whether a module + adapter combo are allowed _module The module to allow this adapter with _caller The caller to allow to use this module/ | function setModuleAllowed(
address _caller,
address _module,
bool allowed
) external onlyGov {
moduleAllowlist[_caller][_module] = allowed;
emit ModulePermissionsUpdated(_caller, _module, allowed);
}
| 7,965,177 |
pragma solidity ^0.4.18;
import "../node_modules/zeppelin-solidity/contracts/math/SafeMath.sol";
import "../node_modules/zeppelin-solidity/contracts/ownership/Ownable.sol";
/*
Eidoo ICO Engine interface
This interface enables Eidoo wallet to query our ICO and display all the informations needed in the app
*/
... | return the price as number of tokens released for each ether | function price()
public
view
returns (uint)
{
uint bonusPercent = 0;
if (block.number < icoBlockNumberStart.add(10164))
{
bonusPercent = 4;
}
if (block.number < icoBlockNumberStart.add(2541))
{
bonusPercent = 6;
}
... | 12,552,998 |
./partial_match/1/0x7fbdACc099bba77d90Ea9F87E595e18897dac4C5/sources/WOW.sol | Moves tokens `amount` from `sender` to `recipient`. This is 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 total = 0;
b... | 15,969,234 |
./partial_match/42/0xAfd8Fdb491e8fB399194C0E7281929B634fFda56/sources/CFD.sol | add margin to increase margin ratio _exchange IExchange address _addedMargin added margin in 18 digits/ check condition update margin part in personal position transfer token from trader | function addMargin(IExchange _exchange, Decimal.decimal calldata _addedMargin)
external
whenNotPaused()
nonReentrant()
{
requireExchange(_exchange, true);
requireNonZeroInput(_addedMargin);
address trader = msg.sender;
Position memory position = adjustPos... | 3,377,208 |
./partial_match/1/0xe960609552f7a572F06058Eb49f87aB78b6Fc0D9/sources/LondonToken.sol | Sets IPFS cid metadata hash for token id `tokenId`./ | function setCID(uint256 tokenId, string memory cid)
public
onlyGatewayManager
{
_cids[tokenId] = cid;
}
| 3,933,447 |
./full_match/4/0x4d833513Fcdde9707133c14B08F36C4CbD9d6fC3/sources/contracts/FundMe.sol | the return price is 10^8 1eth = 10^18 Wei, the price 10^8 10^10 make the price equals Wei | function getPrice() public view returns(uint256) {
(,int256 price,,,) = priceFeed.latestRoundData();
return uint256(price * 10 ** 10);
}
| 12,453,487 |
./full_match/1001/0xF2AffaFa966780988f7FBdf06B6A807a1687b2c8/sources/_klaytn/contracts/KIP/token/KIP17/IKIP17Receiver.sol | KIP17 token receiver interface Interface for any contract that wants to support safeTransfers from KIP17 asset contracts./ | interface IKIP17Receiver {
function onKIP17Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
| 16,364,136 |
./full_match/8453/0xE4AD80eD0c7d12A8B687c6C987d07f1D486fEd85/sources/src/token/ERC1155/ERC1155AB.sol | Initialize multiple drops parameters Only the contract owner can perform this operation _initDropParams drop initialisation parameters array (see InitDropParams structure)/ | function initDrop(ABDataTypes.InitDropParams[] calldata _initDropParams) external onlyRole(DEFAULT_ADMIN_ROLE) {
uint256 length = _initDropParams.length;
for (uint256 i = 0; i < length; ++i) {
_initDrop(_initDropParams[i]);
}
}
| 11,535,250 |
./partial_match/56/0xa83b7b56bB58f2d8a8A672dd1A4051cAcf09192d/sources/FarmMaster.sol | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0 || pool.allocPoint == 0) {
pool.lastRew... | 11,084,306 |
./full_match/4/0xF67e9236a77B3B6BeBf0686C0DD69A936A0e4CD2/sources/dap.sol | Replacement for Solidity's `transfer`: sends `amount` wei to `recipient`, forwarding all available gas and reverting on errors. of certain opcodes, possibly making contracts go over the 2300 gas limit imposed by `transfer`, making them unable to receive funds via `transfer`. {sendValue} removes this limitation. IMPORTA... | function sendValue(address payable recipient, uint256 amount) internal {
}
| 13,353,189 |
/**
Multi-Chain Capital: $MCC
- You buy on Ethereum, we farm on multiple chains and return the profits to $MCC holders.
Tokenomics:
5% of each buy/sell goes to existing holders.
5% of each buy/sell goes into multi-chain farming to add to the treasury and buy back MCC tokens.
Website:
https://multichaincapital.eth.lin... | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint2... | 5,967,327 |
./partial_match/4/0x3D15FA2B3914358110c93CEfD14B1AE5fBADB7C1/sources/QianNFT.sol | only for test now mint basic type 不可能溢出 mint kun nft | function mintTypedNFT(address user, uint256 typeId) public {
uint256 current = _tokenIds.current();
if (typeId < nftType) {
require(
typeCount[typeId] < basicMax,
"No more NFT of this type can be minted"
);
userToBasic[user].add(cur... | 8,553,090 |
pragma solidity ^0.5.0;
import "@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol";
contract IRewardDistributionRecipient is Ownable {
address public rewardDistribution;
function notifyRewardAmount(uint256 reward) external;
modifier onlyRewardDistribution() {
require(_msg... | set the dough contract address as we need to transfer DOUGH when the user vests/ | function setTimelock(address _timelock)
external
onlyOwner
{
sharesTimeLock = ISharesTimeLock(_timelock);
emit TimelockUpdated(address(_timelock));
}
| 1,640,608 |
./full_match/288/0xCD43CEa89DF8fE39031C03c24BC24480e942470B/sources/contracts/insured-bridge/ovm/OVM_BridgeDepositBox.sol | Called by relayer (or any other EOA) to move a batch of funds from the deposit box, through the canonical token bridge, to the L1 Withdraw box. The frequency that this function can be called is rate limited by the `minimumBridgingDelay` to prevent spam on L1 as the finalization of a L2->L1 tx is quite expens... | function bridgeTokens(address l2Token, uint32 l1Gas) public virtual override nonReentrant() {
uint256 bridgeDepositBoxBalance = TokenLike(l2Token).balanceOf(address(this));
require(bridgeDepositBoxBalance > 0, "can't bridge zero tokens");
require(canBridge(l2Token), "non-whitelisted token or... | 7,105,896 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.7;
pragma experimental ABIEncoderV2;
import {OwnershipRolesTemplate} from "./util/OwnershipRolesTemplate.sol";
import {BlocklistBase} from "./util/BlocklistBase.sol";
contract Blocklist is OwnershipRolesTemplate, BlocklistBase {
bytes32 public constant BL... | Block/unblock a user from winning during prize distribution. Block/unblock a user from winning award in prize distribution by updating the isBlocklisted mapping. _user Address of blocked user _isBlocked Blocked Status (true or false) of user/ | function _setBlocklisted(address _user, bool _isBlocked) internal {
isBlocklisted[_user] = _isBlocked;
emit BlocklistSet(_user, _isBlocked);
}
| 9,902,068 |
//SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "./interface/IiToken.sol";
import "./interface/IRewardDistributorV3.sol";
import "./interface... | Update the account state to date Update the account state to date | function _updateReward(
address _iToken,
address _account,
bool _isBorrow
) internal {
require(_account != address(0), "Invalid account address!");
require(controller.hasiToken(_iToken), "Token has not been listed");
uint256 _iTokenIndex;
uint256 _account... | 1,318,004 |
./full_match/4/0x14EbcE2319E93B94726a0A53fb901E06B729b103/sources/contracts/MaskedMeerkat.sol | 6667 meerkats available for the general sale/ general sale has no wallet limit, transaction limit = 3 | function generalSale(uint8 _num) external payable {
require(
block.timestamp >= pledgeTime,
"Pledge has not yet started!"
);
require(
(_num + pledgeNumOfPlayer[msg.sender] ) <= 5,
"Each address can only purchase up to 5 Meerkats per tx"
... | 752,413 |
pragma solidity ^0.5.9;
import "./DelightKnightItemInterface.sol";
import "./Standard/ERC721.sol";
import "./Standard/ERC721TokenReceiver.sol";
import "./Util/SafeMath.sol";
contract DelightKnightItem is DelightKnightItemInterface, ERC721 {
using SafeMath for uint;
// The two addresses below are the addresses of ... | Returns the HP given to the knight of the item. 아이템의 기사에게 부여하는 HP를 반환합니다. | function getItemHP(uint itemId) external view returns (uint) {
return items[itemId].hp;
}
| 5,381,231 |
./full_match/5/0x05626cb540A481406D4aeBD7df4C8d3b28eE81aa/sources/contracts/ERC721IA.sol | Update contract state. If there's a price, collect price. Mint the relevant NFTs to claimer. _removeFromQueue(id); | function claimBatch(
address _receiver,
ClaimData[] calldata _claimData,
address _currency,
uint256 _pricePerToken,
AllowlistProof calldata _allowlistProof
) public payable virtual {
bytes32 activeConditionId = conditionId;
verifyClaims(
_drop... | 1,889,019 |
pragma solidity ^0.4.15;
import './SafeMath.sol';
import './Ownable.sol';
import './TokenHolder.sol';
import './EcnToken.sol';
/// @title Ecn token sale contract.
contract EcnTokenSaleMulti is Ownable, TokenHolder {
using SafeMath for uint256;
// ECN token contract.
EcnToken public ecn;
// Received ... | Constructor that initializes the sale conditions. _fundingRecipient address The address of the funding recipient. _ecnToken address of the existed ecnToken . | function EcnTokenSaleMulti(address _fundingRecipient, address _ecnToken) {
require(_fundingRecipient!=0 && _ecnToken!=0);
fundingRecipient = _fundingRecipient;
ecn = EcnToken(_ecnToken);
endTime = now + SALE_DURATION;
for(uint i = 0; i < MAX_NUM_OF_SALEITEM; i ++){
... | 915,079 |
// 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... | Execute an access removal transaction AccessControl.sol doesn't revert if revoking permissions that haven't been granted If we don't check, planner and executor can collude to gain access to contacts | function execute(bytes32 txHash)
external override auth
{
Plan memory plan_ = plans[txHash];
require(plan_.state == State.PLANNED, "Emergency not planned for.");
plans[txHash].state = State.EXECUTED;
Permission[] memory permissions_ = abi.decode(plan_.permissions, (Permi... | 56,972 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";
contract GenesisSupply is VRFConsumerBase, AccessControl {
using Counters for Counters.... | Mint a token count the number of item to mint return startIndex index of first mint return endIndex index of last mint/ | function mint(uint256 count)
public
onlyRole(GENESIS_ROLE)
seedGenerated
returns (uint256 startIndex, uint256 endIndex)
{
require(
tokenCounter.current() + count < MAX_SUPPLY + 1,
"Not enough supply"
);
uint256 firstTokenId = tokenC... | 333,637 |
./full_match/1/0x82a7b5842085f434c6584A8c44b6A1C15c25a512/sources/contracts/Pool.sol | @inheritdoc IPool/ | function redemptionAvailable(
address account,
uint128 tick,
uint128 redemptionId
) external view returns (uint256 shares, uint256 amount, uint256 sharesAhead) {
Redemption storage redemption = _deposits[account][tick].redemptions[redemptionId];
if (redemption.pending ==... | 9,659,233 |
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "./Post.sol";
import "./User.sol";
contract Forum is Ownable {
event UserBanned(address userAddress);
event UserUnbanned(address userAddress);
event PostCreated (address postAddress, string postTitle, address... | User postCreator = User(msg.sender); postCreator.createPost(newPostAddress, _postTitle); | function createPost(string _postTitle) public {
address newPostAddress = new Post();
emit PostCreated(newPostAddress, _postTitle, msg.sender, block.timestamp);
}
| 6,411,121 |
pragma solidity ^0.4.18;
import "./SecurityTransferAgent.sol";
/** Transfer agent for a security token that does not limit transfers any way */
contract UnrestrictedTransferAgent is SecurityTransferAgent {
function UnrestrictedTransferAgent() {
}
/**
* @dev Checking if transfer can happen, and if so, what ... | Checking if transfer can happen, and if so, what is the right amount from The account sending the tokens to The account receiving the tokens value The indended amount return The actual amount permitted/ | function verify(address from, address to, uint256 value) public view returns (uint256 newValue) {
return value;
}
| 14,048,282 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.4 <0.8.0;
pragma experimental ABIEncoderV2;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/GSN/Context.sol";
import "https://github.com/vigilance91/solidarity/libraries/LogicConstraints.sol";
import "https://github.com/vigil... | unpause, must already be paused | function _unpause(
)internal virtual whenPaused
{
_paused = false;
_msgSender().emitUnpaused();
}
| 7,288,906 |
./full_match/80001/0x290B4e8126bB9D247583BA281aAe77D8659EFC40/sources/project_/contracts/polygon/UniV3Automan.sol | Find current amount of the two tokens in the liquidity position. | function getPositionInfo(
uint256 positionId
) public view returns (PositionInfo memory posInfo) {
posInfo.positionId = positionId;
(
posInfo.token0,
posInfo.token1,
posInfo.fee,
posInfo.tickLower,
posInfo.tickUpper,
... | 5,548,569 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.5;
//solhint-disable-next-line
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./LegalEntityVerification.sol";
/**
Features:
-> Manufacturer mints a token representing the product.
-... | Gets the approval state of the token return the token id | function getApprovalState(uint256 _tokenId) public view returns(bool){
return approvalState[_tokenId];
}
| 12,700,980 |
./full_match/11155111/0xB470Ad2Db961912cAfD49bC2AC64039C0432e547/sources/contracts/Token.sol | Check approval Reset allowance (Prevent double spending) Spend tokens | function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
address spender = msg.sender;
require(_from != address(0) && _to != address(0), "Invalid address!");
require(balanceOf(_from) >= _value, "Insufficient balance!");
require(allowance[_fro... | 3,801,881 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./interfaces/Constants.sol";
import { PoolParams } from "./interfaces/Types.sol";
import "./interfaces/IVestingPools.sol";
import "./utils/Claimable.sol";
import "./utils/DefaultOwnable.sol";
impor... | Returns the current owner address, if it's defined, or the default owner address otherwise. | function owner() public view virtual returns (address) {
return _owner == address(0) ? _defaultOwner() : _owner;
}
| 12,762,110 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.10;
import "./ERC721A.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract SunnyMfers is ERC721A, Ownable {
bool public revealed;
string public baseURI;
string public gaURI;
string public preURI = "ipfs://bafkreiey6koxutbsnsrplbo... | Returns whether `tokenId` exists. Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. Tokens start existing when they are minted (`_mint`),/ | function _exists(uint256 tokenId) internal view returns (bool) {
return tokenId > 0 && tokenId < currentIndex;
}
| 14,910,801 |
./full_match/43113/0x2311b215c3A3Cc20cdf35034951C0ff029E71397/sources/contracts/perch.sol | Update the burn rate. Can only be called by the current operator./ | function updateBurnRate(uint16 _burnRate) public onlyOperator {
require(_burnRate <= 100, "Perch::updateBurnRate: Burn rate must not exceed the maximum rate.");
emit BurnRateUpdated(msg.sender, burnRate, _burnRate);
burnRate = _burnRate;
}
| 7,146,862 |
./full_match/1/0x0000000000f5A96Dc85959cAeb0Cfe680f108FB5/sources/contracts/core/utils/LibOps.sol | Packs an address and an index to create an unique identifier. a The address. i The index. return result The packed result./ | function packId(address a, uint96 i) internal pure returns (uint256 result) {
assembly {
result := or(shl(96, a), shr(160, shl(160, i)))
}
}
| 5,013,444 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.