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/421613/0xA0902D3F318f287a6bfa313d19dCe7Bc3BB882Ce/sources/project_/contracts/mercenaries/WrappedCharacters.sol | Unwraps an NFT & burns the wrappedCharacter wrappedTokenID ID of the token | function unwrap(uint256 wrappedTokenID)
external
nonReentrant
onlyWrapped(wrappedTokenID)
onlyOwnerOfToken(wrappedTokenID)
{
_burn(wrappedTokenID);
_unwrap(wrappedTokenID);
}
| 11,567,022 |
./full_match/80001/0x69e308Dd74269F534944B3ebcaBC41C126236e6d/sources/contracts/Contract.sol | Function to reward customers | function rewardCustomer(address customer, uint256 tokenAmount) public {
transferFrom(owner, msg.sender, userMappings[owner].name, userMappings[msg.sender].name, tokenAmount, "Buy Tokens");
transferFrom(msg.sender, customer, userMappings[msg.sender].name, userMappings[customer].name, tokenAmount, "R... | 5,587,649 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
/*
* $$\ $$\ $$$$$$\ $$$$$$$\ $$\ $$\
* $$ | $$ |$$ __$$\ $$ __$$\ $$ | $$ |
* $$ | $$ |$$ / \__|$$ | $$ |\$$\ $$ |
* $$ | $$ |\$$$$$$\ $$ | $$ | \$$$$ /
* $$ | $$ | \____$$\ $$ | $$ | $$ $$<
* $$ | $$ |$$\ $$ |$$ | $$ ... | Returns the amount of accrued appreciation for _account. | function appreciation(address _account) public view returns (uint256) {
account storage acct = accounts[_account];
(, uint256 appr) = acctAppreciation(acct);
return appr;
}
| 13,442,562 |
./full_match/3/0xC2A0775411912eA7572f0662CD73370665985E31/sources/C/Projects/RopstenDeployment/contracts/DODO.sol | Hatch an baby DODO egg with two DODO you own (_matronId and _sireId). Requires a pre-payment of the fee given out to the first caller of crack() _matronId The ID of the DODO acting as matron _sireId The ID of the DODO acting as sire return The hatched DODO egg ID/ Checks for payment. Checks for BRD payment Checks if ... | function hatch(uint256 _matronId, uint256 _sireId)
external
override
payable
whenNotPaused
nonReentrant
returns (uint256)
{
address msgSender = msg.sender;
require(
msg.value >= autoCrackingFee,
"CryptoDODO: Required autoCr... | 8,181,821 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "./AssemblyCore.sol";
import "./IAssemblyIncentives.sol";
import "./IProofOfHumanity.sol";
import "./Faucet.sol";
/// @title Assembly contract... | return Timestamp of the last state of the delegation seats | function getLastSnapshotTimestamp() external view returns (uint256) {
return _lastSnapshotTimestamp;
}
| 1,816,886 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
interface IToken is IERC20{
function decimals() external view returns (uint);
}
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as def... | calls by WHAsset contract to unlock funds and premium (when closing a position, either exercising or unlocking funds) id Id of the Hedge Contract that is being opened/ | function unlock(uint256 id) external override {
LockedLiquidity storage ll = lockedLiquidity[msg.sender][id];
require(ll.locked, "LockedLiquidity with such id has already unlocked");
ll.locked = false;
lockedPremium = lockedPremium.sub(ll.premium);
lockedAmount = lockedAmoun... | 1,201,859 |
./partial_match/1/0x81e8fdA067327BC04160832E1E5ddb8697d19341/sources/TROPVault.sol | Withdraw tokens from TROPVault. | function withdraw(uint256 _pid, uint256 _amount) public {
_withdraw(_pid, _amount, msg.sender, msg.sender);
}
| 2,587,785 |
./full_match/5/0x787e1C700877Bdfc7fcb9Ae4569c3d365CD683D7/sources/project_/contracts/ZeroExProxy.sol | Get function implementation address based on signature signature function signature return impl address of implementation | function getFunctionImplementation(bytes4 signature) public returns (address impl) {
impl = _implementationOverrides[signature];
if (impl == _NULL_ADDRESS) {
impl = _zeroEx.getFunctionImplementation(signature);
}
}
| 7,066,743 |
pragma solidity ^0.4.13;
// File: contracts\zeppelin\ownership\Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
... | Function to check the amount of tokens that an owner allowed to a spender. _owner address The address which owns the funds. _spender address The address which will spend the funds. return A uint256 specifying the amount of tokens still available for the spender./ | function allowance(address _owner, address _spender) public returns (uint256) {
return allowed[_owner][_spender];
}
| 6,436,772 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "./utils/BaseTest.sol";
import "./utils/mocks/MockERC721A.sol";
// import "solmate/test/ERC721.t.sol";
/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/test/ERC721.t.sol)
contract ERC721Recipient is ERC721TokenReceiver {
func... | vm.expectRevert(ERC721.WrongFrom.selector); | function testFail_transferFrom_wrongFrom() public {
erc721a.mint(address(123), 1);
erc721a.transferFrom(alice, bob, 1);
}
| 15,866,382 |
pragma solidity ^0.4.23;
// 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 applic... | Change inbox state to the next possible state State will change only for Undeclared, Declared, DeclaredRevocation Undeclared -> Declared, Declared -> Progressed, DeclaredRevocation -> Revoked _messageBox Message box. _messageHash Message hash return isChanged_ `true` if the state is changed return nextStat... | function changeInboxState(
MessageBox storage _messageBox,
bytes32 _messageHash
)
external
returns (
bool isChanged_,
MessageBus.MessageStatus nextState_
)
{
MessageStatus status = _messageBox.inbox[_messageHash];
if(status == ... | 14,100,026 |
./full_match/97/0xec51816BFE26468dec6931baF37a168637b6D3f5/sources/staking/Staking.sol | update validator status emit event | function _releaseValidatorFromJail(Validator memory validator) internal {
address validatorAddress = validator.validatorAddress;
validator.status = ValidatorStatus.Active;
validator.jailedBefore = 0;
_validatorsMap[validatorAddress] = validator;
_activeValidatorsList.push(val... | 5,034,320 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4 <0.9.0;
import './Keep3rJobFundableCredits.sol';
import './Keep3rJobFundableLiquidity.sol';
import '../Keep3rDisputable.sol';
abstract contract Keep3rJobDisputable is IKeep3rJobDisputable, Keep3rDisputable, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {
... | @inheritdoc IKeep3rJobDisputable | function slashLiquidityFromJob(
address _job,
address _liquidity,
uint256 _amount
) external override onlySlasher {
if (!disputes[_job]) revert NotDisputed();
_unbondLiquidityFromJob(_job, _liquidity, _amount);
emit JobSlashLiquidity(_job, _liquidity, msg.sender, _amount);
}
| 12,802,741 |
./partial_match/1/0xa1a5143b4044cC3B710FfB8D7130b24a542536f0/sources/lib/forge-std/src/safeconsole.sol | Selector of `log(uint256,bool,address,bool)`. | function log(uint256 p0, bool p1, address p2, bool p3) internal pure {
bytes32 m0;
bytes32 m1;
bytes32 m2;
bytes32 m3;
bytes32 m4;
assembly {
m0 := mload(0x00)
m1 := mload(0x20)
m2 := mload(0x40)
m3 := mload(0x60)
... | 16,053,194 |
./full_match/80001/0x6F61605BDBD66122D6C58674fe88D34f9cbC102F/sources/contracts/Farm.sol | Items, NFTs or resources Used by resources - items/NFTs won't have this will this be an issue? | interface ERCItem {
function mint(address account, uint256 amount) external;
function burn(address account, uint256 amount) external;
function balanceOf(address acount) external returns (uint256);
function stake(address account, uint256 amount) external;
function getStaked(address account) exte... | 5,593,221 |
pragma solidity ^0.4.11;
import './TimeScheduledToken.sol';
import './LimitedPurchaseToken.sol';
import 'zeppelin-solidity/contracts/math/SafeMath.sol';
/**
* @title Crowdsale contract for GIF Token.
* @author SOCIFI Ltd, 2017
* @dev An ERC20 mintable token with total supply limited to 500,000,000,000 GIF Tokens... | Transfer tokens from sender to another. _to address The address which you want to transfer to. _value uint256 the amount of tokens to be transferred. return A boolean that indicates if the operation was successful./ | function transfer(address _to, uint256 _value) public whenTransferable returns (bool) {
return super.transfer(_to, _value);
}
| 2,553,744 |
./full_match/43113/0xF39d18583fdFD746543aE22eC8D33432730431d7/sources/tests/Fingers/Fingers.sol | bool _isRight, bool _thumb, bool _index, bool _middle, bool _ring, bool _pinky, uint8 _skin, uint8 _thumbDna, uint8 _indexDna, uint8 _middleDna, uint8 _ringDna, uint8 _pinkyDna | function _generateFinger() internal returns(uint256) {
bool isRight;
bool thumb = false;
bool index = false;
bool middle = false;
bool ring = false;
bool pinky = false;
uint8 randomFinger = uint8(_random5());
if(_random2() == 0){
... | 13,193,610 |
///File: giveth-common-contracts/contracts/ERC20.sol
pragma solidity ^0.4.19;
/**
* @title ERC20
* @dev A standard interface for tokens.
* @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
*/
contract ERC20 {
/// @dev Returns the total token supply
function totalSupply() ... | `onlyOwner` Adds a spender to the `allowedSpenders[]` white list _spender The address of the contract being authorized/unauthorized _authorize `true` if authorizing and `false` if unauthorizing | function authorizeSpender(address _spender, bool _authorize) onlyOwner external {
allowedSpenders[_spender] = _authorize;
emit SpenderAuthorization(_spender, _authorize);
}
| 10,468,503 |
/**
*Submitted for verification at Etherscan.io on 2022-02-20
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.9;
/* This contract is a subsidiary of the Hedron contract. The Hedron *
* contract can be found at 0x3819f64f282bf135d62168C1e513280dAF905e06. */
/* Hedron is a collection of Ethereum... | Calls the HEX function "stakeGoodAccounting" against the HEX stake held within the HSI./ | function goodAccounting(
)
external
{
require(share.stake.stakedDays > 0,
"HSI: Creation not yet performed");
_hx.stakeGoodAccounting(address(this), 0, share.stake.stakeId);
_stakeDataUpdate();
}
| 2,292,654 |
./full_match/1/0xc75f89C55fd71B07A54976575C774EA6Fa283d7A/sources/@mimic-fi/v2-helpers/contracts/math/UncheckedMath.sol | Unsafely multiplies two unsigned integers/ | function uncheckedMul(uint256 a, uint256 b) internal pure returns (uint256) {
unchecked {
return a * b;
}
}
| 17,143,863 |
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 existence.
*/
function totalSupply() external view returns (uint... | base instructions base instructions | function updateRewardAmount(uint256 newRate) external onlyRewardsDistribution updateReward(address(0)) {
if (block.timestamp >= periodFinish) {
rewardRate = newRate.div(rewardsDuration);
lastUpdateTime = block.timestamp;
periodFinish = block.timestamp.add(rewardsDurati... | 13,703,137 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import {IKODAV3SecondarySaleMarketplace} from "./IKODAV3Marketplace.sol";
import {IKOAccessControlsLookup} from "../access/IKOAccessControlsLookup.sol";
import {IKODAV3} from "../core/IKODAV3.sol";
import {BuyNowMarketplace} from "./BuyNowMarketplace.sol";
import... | split money N:B. open offers are left for the bidder to withdraw or the new token owner to reject/accept send token to buyer | function _facilitateSecondarySale(uint256 _tokenId, uint256 _paymentAmount, address _seller, address _buyer) internal {
(address _royaltyRecipient, uint256 _royaltyAmount) = koda.royaltyInfo(_tokenId, _paymentAmount);
handleSecondarySaleFunds(_seller, _royaltyRecipient, _paymentAmount, _royaltyAmou... | 998,563 |
/**
* SPDX-License-Identifier: UNLICENSED
*/
pragma solidity =0.6.10;
import {OracleInterface} from "../interfaces/OracleInterface.sol";
import {OpynPricerInterface} from "../interfaces/OpynPricerInterface.sol";
import {Ownable} from "../packages/oz/Ownable.sol";
import {SafeMath} from "../packages/oz/SafeMath.sol";... | sets the dispute period for a pricer can only be called by the owner for a composite pricer (ie CompoundPricer) that depends on or calls other pricers, ensure that the dispute period for the composite pricer is longer than the dispute period for the asset pricer that it calls to ensure safe usage as a dispute in the o... | function setDisputePeriod(address _pricer, uint256 _disputePeriod) external override onlyOwner {
require(_pricer != address(0), "Oracle: cannot set pricer to address(0)");
pricerDisputePeriod[_pricer] = _disputePeriod;
emit PricerDisputePeriodUpdated(_pricer, _disputePeriod);
}
| 461,092 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.0;
import "./IKIP37.sol";
import "./IKIP37MetadataURI.sol";
import "./IKIP37Receiver.sol";
import "./IERC1155Receiver.sol";
import "../../GSN/Context.sol";
import "../../introspection/KIP13.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.sol";
... | See {IKIP37-balanceOfBatch}. Requirements: - `accounts` and `ids` must have the same length./ | function balanceOfBatch(address[] memory accounts, uint256[] memory ids)
public
view
returns (uint256[] memory)
{
require(
accounts.length == ids.length,
"KIP37: accounts and ids length mismatch"
);
uint256[] memory batchBalances = new uin... | 5,397,967 |
./partial_match/1/0x4eeF4C43734690ffe34a00A872234037676D7990/sources/contracts/Manager.sol | can be called by the seller at every moment once enough funds has been raised _raffleId Id of the raffle the seller of the nft, if the minimum amount has been reached, can call an early cashout, finishing the raffle it triggers Chainlink VRF1 consumer, and generates a random number that is normalized and checked tha... | function earlyCashOut(uint256 _raffleId) external {
RaffleStruct storage raffle = raffles[_raffleId];
FundingStructure memory funding = fundingList[_raffleId];
require(raffle.seller == msg.sender, "Not the seller");
require(
raffle.status == STATUS.ACCEPTED,
... | 3,577,060 |
/**
*Submitted for verification at Etherscan.io on 2021-11-27
*/
// Sources flattened with hardhat v2.5.0 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/[email protected]
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/... | 从资金池等比例取出一半资金,用于跨链到BSC | function withdraw() external onlyGovernance {
uint balance0 = IERC20(NEST_TOKEN_ADDRESS).balanceOf(address(this));
uint balance1 = IERC20( DCU_TOKEN_ADDRESS).balanceOf(address(this));
TransferHelper.safeTransfer(NEST_TOKEN_ADDRESS, msg.sender, balance0 >> 1);
TransferHelper.... | 15,056,669 |
./full_match/80001/0x1Ce2a44c19963Db85E5a08d65F23E3029f3dbCda/sources/Lottery.sol | check the winning amount | function checkWinningsAmount() public view returns (uint256) { | 9,460,609 |
/**
*Submitted for verification at Etherscan.io on 2021-06-05
*/
/**
*Submitted for verification at Etherscan.io on 2021-05-04
*/
// File: @openzeppelin/contracts/GSN/Context.sol
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transacti... | messageHash can be used only onceVerifes signature | function claimOnePool(uint256 deadline,uint256 _amount, bytes32 txs, bytes calldata signature) external isLocked {
require( (deadline > block.number) && (deadline < (block.number + expiryBlock)) , "time Expired" );
require(!txHash[txs], "BridgeEthToBsc: tx duplicate");
byte... | 6,640,018 |
./partial_match/42/0x0eAB3b0762653643EDd0ECDC13AC4C1D1c285E3D/sources/contracts/DecentralizedAutonomousTrust.sol | Pay the organization on-chain without minting any tokens. This allows you to add funds directly to the buybackReserve. | function pay() external payable
{
require(address(currency) == address(0), "ONLY_FOR_CURRENCY_ETH");
}
| 3,331,101 |
./full_match/11155111/0xeed229be83DFFDD876f37cd5FAE5B1C80725297e/sources/project_/contracts/FriendsClaim.sol | Both contracts have 4444 tokens for Braq Friends | function claimTokens(uint32[] memory tokenIds) external {
require(currentQuarter > 0 && currentQuarter < 5, "Current quarter is wrong");
require(tokenIds.length <= BraqFriendsInstance.balanceOf(msg.sender), "Claiming more tokens than you have!");
for (uint32 i=0; i < tokenIds.length; i++){
... | 3,792,748 |
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.13;
/// @title The Nouns DAO logic version 1
/*********************************
* ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *
* ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *
* ░░░░░░█████████░░█████████░░░ *
* ░░░░░░██░░░████░░██░░░████░░░ *
* ░░██████░░░████████░░░████░░░ *
... | Burns veto priviledges Vetoer function destroying veto power forever/ Check caller is pendingAdmin and pendingAdmin ≠ address(0) | function _burnVetoPower() public {
require(msg.sender == vetoer, "NounsDAO::_burnVetoPower: vetoer only");
_setVetoer(address(0));
}
| 12,735,795 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IER... | See {IERC721-setApprovalForAll}./ | function setApprovalForAll(address operator, bool approved)
public
virtual
override
{
require(operator != _msgSender(), "Symbiosis: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
... | 5,716,773 |
// SPDX-License-Identifier: MIT
//Feel free to use this code for your own project.
//Expand the possibilities and continue to build a diverse ecosystem!!
pragma solidity ^0.8.7;
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/... | Function for donars to donate their contributionsUsers should send the donation amount in the value section of the call | function donation() public payable{
require(msg.sender.balance > msg.value);
if(success){
donatorsBalance[msg.sender] += msg.value;
emit NewDonation(msg.sender, msg.value);
}
}
| 974,434 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./interfaces/LinkTokenInterface.sol";
import "./VRFRequestIDBase.sol";
/** ****************************************************************************
* @notice Interface for contracts using VRF randomness
* ******************************************... | prettier-ignore solhint-disable-next-line quotes | function getNumericAttributeBytes(string memory _key, uint256 _value)
private
view
returns (bytes memory)
{
}
| 10,217,144 |
pragma solidity ^0.5.7;
// Abstract contract for the full ERC 20 Token standard
// https://github.com/ethereum/EIPs/issues/20
interface ERC20Token {
/**
* @notice send `_value` token to `_to` from `msg.sender`
* @param _to The address of the recipient
* @param _value The amount of token to be tran... | Opens a dispute between a seller and a buyer _escrowId Id of the Escrow that is being disputed _openBy Address of the person opening the dispute (buyer or seller) _motive Description of the problem/ | function _openDispute(uint _escrowId, address _openBy, uint8 _motive) internal {
require(arbitrationCases[_escrowId].result == ArbitrationResult.UNSOLVED && !arbitrationCases[_escrowId].open,
"Arbitration already solved or has been opened before");
address arbitratorAddress = _getAr... | 1,797,998 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import {ERC20PresetMinterPauser} from "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol";
import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";
import {Album} from "./Album.sol";
import {AllowList} from "./AllowList.sol";... | Anyone can trigger a sweep, but the proceeds always get sent to the creator. | function sweepProceeds() public saleOver(true) {
require(!swept, "Already swept");
swept = true;
payable(CREATOR).transfer(saleProceeds);
getToken().transfer(CREATOR, amountUnsold);
emit SaleSwept(saleProceeds, amountUnsold);
}
| 1,615,157 |
pragma solidity >=0.5.3<0.6.0;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
// Just inlining part of the standard ERC20 contract
interface ERC20Token {
function transfer(address recipient, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 ... | Updates the Immediately Withdrawable Limit Publisher address, the only address other than the owner that can set the immediately withdrawable limit. newImmediatelyWithdrawableLimitPublisher The address of the new Immediately Withdrawable Limit Publisher/ | function setImmediatelyWithdrawableLimitPublisher(
address newImmediatelyWithdrawableLimitPublisher
) external {
require(
msg.sender == _owner,
"Only the owner can set the immediately withdrawable limit publisher address"
);
address oldValue = _immediatelyWi... | 12,781,445 |
./partial_match/42/0x9c6B5e242f7e82eb6f50249E75A510C0A5f93f7D/sources/Mixer.sol | n The nulllifier hash to check return True if the nullifier hash has previously been stored in the contract/ | function hasNullifier(uint n) public view returns (bool) {
return nullifier_hash_history[n];
}
| 3,408,280 |
./full_match/5/0xD3453802c461992b5756c15290A8fAF316065B10/sources/contracts/core/CollateralDepositRecord.sol | Ignore account deposit cap for devs | function recordDeposit(address _sender, uint256 _amount)
external
override
onlyAllowedHooks
{
require(
_amount + _globalDepositAmount <= _globalDepositCap,
"Global deposit cap exceeded"
);
if (!_devAccounts[_sender]) {
require(
... | 1,930,013 |
./full_match/420/0x8Af7C7d19857a3596F735F5daff729291E9ceff0/sources/lib/tokenid.sol | require that the type of id matches the type of ty. id is the type to check ty is the type to check for. note this can also be another instance of the desired type. | function requireType(uint256 id, uint256 ty) pure {
if (!checkType(id, ty))
revert TypeRequirementNotMet(maskTypeField(id), maskTypeField(ty));
}
| 13,228,015 |
./partial_match/56/0x942151d7715d3f5097D6A1956C87a3ffd0C2Aa6f/sources/SousChef.sol | Withdraw Foam tokens from SousChef. | function withdraw(uint256 _amount) public {
require (_amount > 0, 'amount 0');
UserInfo storage user = userInfo[msg.sender];
require(user.amount >= _amount, "withdraw: not enough");
updatePool();
heat.safeTransfer(address(msg.sender), _amount);
user.rewardPending = ... | 11,269,072 |
pragma solidity ^0.4.18;
//
// 🌀 EnishiCoin
//
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
... | Add owners to the list _address Address of owner to add/ | function addOwner(address _address) signed public {
owners.push(_address);
}
| 14,881,006 |
pragma solidity ^0.4.18;
contract ERC20Token{
//ERC20 base standard
uint256 public totalSupply;
function balanceOf(address _owner) public view returns (uint256 balance);
function transfer(address _to, uint256 _value) public returns (bool success);
function transferFrom(address _from,... | Check if it is safe to multiply two numbers | function safeMultiply(uint256 a, uint256 b) internal pure returns (uint256) {
uint c = a * b;
assert(a == 0 || (c / a) == b);
return c;
}
| 5,936,301 |
./full_match/43113/0xa4a3dbeE3445d595b5848cB7ee87c4CF8017108a/sources/contracts/Lottery.sol | This require causes an error That gas price estimatinrequire(msg.value > .01 ether); | function enter() public payable {
players.push(msg.sender);
}
| 7,124,357 |
./full_match/1/0xA0C20eef415ed68a16215e061821D6ad24767Db1/sources/lib/story-contract/src/IStory.sol | Story Contract Interface transientlabs.xyz @custom:version 3.0.0 | interface IStory {
Events
event CreatorStory(uint256 indexed tokenId, address indexed creatorAddress, string creatorName, string story);
event Story(uint256 indexed tokenId, address indexed collectorAddress, string collectorName, string story);
... | 8,401,435 |
pragma solidity ^0.4.18;
/**
* 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); // Solid... | Get all information about a specifc grant. _holder The address which will have its tokens revoked. _grantId The id of the token grant. return Returns all the values that represent a TokenGrant(address, value, start, cliff, revokability, burnsOnRevoke, and vesting) plus the vested value at the current time./ | function tokenGrant(address _holder, uint _grantId) public constant returns (address granter, uint256 value, uint256 vested, uint64 start, uint64 cliff, uint64 vesting, bool revokable, bool burnsOnRevoke) {
TokenGrant storage grant = grants[_holder][_grantId];
granter = grant.granter;
value = grant.value... | 2,091,979 |
./full_match/10/0xf270BBA56b1a8cA722AcBD6E6fB255A51Dc065A7/sources/contracts/OvertimeVaults/SportVault.sol | Set IStakingThales contract _stakingThales IStakingThales address | function setStakingThales(IStakingThales _stakingThales) external onlyOwner {
stakingThales = _stakingThales;
emit StakingThalesChanged(address(_stakingThales));
}
| 3,779,759 |
pragma solidity 0.5.17;
import "./MToken.sol";
import "./ErrorReporter.sol";
import "./PriceOracle.sol";
import "./MomaMasterInterface.sol";
import "./MomaMasterStorage.sol";
import "./MomaPool.sol";
/**
* @title Moma's MomaMaster Contract
* @author Moma
*/
contract MomaMaster is MomaMasterInterface, MomaMasterV1S... | Checks if the account should be allowed to borrow the underlying asset of the given market mToken The market to verify the borrow against borrower The account which would borrow the asset borrowAmount The amount of underlying the account would borrow return 0 if the borrow is allowed, otherwise a semi-opaque error c... | function borrowAllowed(address mToken, address borrower, uint borrowAmount) external returns (uint) {
require(isLendingPool, "this is not lending pool");
require(!borrowGuardianPaused[mToken], "borrow is paused");
if (!markets[mToken].isListed) {
return uint(Error.MARKET_NOT_LIS... | 12,663,127 |
./partial_match/1/0x381e3c53380DB31aDc8F1d2eB6a5a8DdF793EDab/sources/contracts/UniStrategy.sol | This function updates the twapDeviation value of pools iteratively _pools: pools addresses _twapDeviations: devaiation values/ | function setPoolTwapDeviation(address[] memory _pools, int24[] memory _twapDeviations)
external
onlyGovernance
{
for (uint256 i; i < _pools.length; i++) {
poolStrategy[_pools[i]].maxTwapDeviation = _twapDeviations[i];
}
}
| 2,870,603 |
pragma solidity ^0.5.0;
import '../math/SafeMath.sol';
import '../token/ERC777TokensSender.sol';
import '../registry/ERC1820Implementer.sol';
/**
* @title CounterSignature
*
* An ERC777 tokens sender contract that requires a counter-signature
* from an approved address to allow a transfer to procee... | This obtains the signer of a hash given its signature. Note that a returned value of 0 means that the signature is invalid, and should be treated as such./ | function signer(bytes32 _hash, bytes memory _signature) private pure returns (address) {
bytes32 r;
bytes32 s;
uint8 v;
assembly {
r := mload(add(_signature, 32))
s := mload(add(_signature, 64))
v := and(mload(add(_signature, 65)), 255)
}
... | 13,031,588 |
./full_match/1/0xcDE0d5c298aA767116434e8fF5275a7b6F1EB271/sources/contracts/MorphysV2.sol | ERC721 related See {ERC721Metadata-tokenURI}./ | function tokenURI(uint256 tokenId) public view override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _morphysRegistry[tokenId];
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toSt... | 8,382,743 |
pragma solidity ^0.4.15;
import "zeppelin-solidity/contracts/crowdsale/Crowdsale.sol";
import "zeppelin-solidity/contracts/crowdsale/CappedCrowdsale.sol";
import "zeppelin-solidity/contracts/crowdsale/FinalizableCrowdsale.sol";
import "zeppelin-solidity/contracts/crowdsale/RefundableCrowdsale.sol";
import "./BLOCToken... | emit tokens for the devs | function finalization() internal {
uint256 totalSupply = token.totalSupply();
uint256 finalSupply = TOTAL_SHARE.mul(totalSupply).div(CROWDSALE_SHARE);
token.mint(wallet, DEV_SHARE.mul(finalSupply).div(TOTAL_SHARE));
token.finishMinting();
super.finalization();
}
| 925,802 |
./full_match/5/0xCA38dCcfD555e11D93D6714227Ce39efCE0204e3/sources/contracts/CrowdFunding.sol | return the address of donators and the amount of donations | function getDonators(uint256 _id) public view returns(address[] memory, uint256[]memory ){
return (campains[_id].donators, campains[_id].donations);
}
| 1,895,383 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0 <0.9.0;
import "./libraries/math/WadRayMath.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/... | Sets `amount` as the allowance of `spender` over the `owner` s tokens. This internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. - `spender` cannot be the zero address./ | function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount... | 15,853,197 |
pragma solidity ^0.4.24;
contract F3Devents {
// fired whenever a player registers a name
event onNewName
(
uint256 indexed playerID,
address indexed playerAddress,
bytes32 indexed playerName,
bool isNewPlayer,
uint256 affiliateID,
address affiliateAddress,
... | ends the round. manages paying out winner/splitting up pot/ setup local rID grab our winning player and team id's grab our pot amount calculate our winner share, community rewards, gen share, p3d share, and amount reserved for next pot calculate ppt for round mask | function endRound(F3Ddatasets.EventReturns memory _eventData_)
private
returns (F3Ddatasets.EventReturns)
{
uint256 _rID = rID_;
uint256 _winPID = round_[_rID].plyr;
uint256 _winTID = round_[_rID].team;
uint256 _pot = round_[_rID].pot;
uint256 _win = (_pot.mul(... | 9,949,040 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.0;
import "../RelayHub.sol";
contract TestRelayHub is RelayHub {
constructor(
IStakeManager _stakeManager,
address _penalizer,
address _batchGateway,
address _relayRegistrar,
RelayHubConfig memory _config
//... | Allow depositing for non-paymaster addresses for Gas Calculations tests | function depositFor(address target) public override payable {
uint256 amount = msg.value;
balances[target] = balances[target] + amount;
emit Deposited(target, msg.sender, amount);
}
| 14,057,251 |
pragma solidity ^0.4.25;
pragma experimental ABIEncoderV2;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pu... | ----------------<BEGIN PRICE FUNCTIONS>----------------/ | function returnRemainder(uint price) internal {
if (msg.value > price) msg.sender.transfer(msg.value.sub(price));
}
| 5,371,885 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./interfaces/IAbstractCooldownStaking.sol";
abstract contract AbstractCooldownStaking is IAbstractCooldownStaking{
using SafeMath for uint256;
uint256 internal constant WITHDRAWING_COOLDOWN_DU... | There is a second withdrawal phase of 48 hours to actually receive the rewards. If a user misses this period, in order to withdraw he has to wait for 7 days again. It will return: 0 if cooldown time didn't start or if phase duration (48hs) has expired coolDownTimeEnd Time when user can withdraw. | function whenCanWithdrawBrightReward(address _address) internal view returns (uint256) {
return
withdrawalsInfo[_address].coolDownTimeEnd.add(WITHDRAWAL_PHASE_DURATION) >=
block.timestamp
? withdrawalsInfo[_address].coolDownTimeEnd
: 0;
}
| 6,898,432 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/interfaces/IERC2981.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import "@openz... | Set publication fee _saleType Sales type _amount Fixed amount/ | function setPublicationFee(SaleType _saleType, uint256 _amount) public onlyOwner {
publicationFees[_saleType] = _amount;
}
| 7,212,275 |
./partial_match/3/0xE05FDD0806CA346Ad792Bf0b4bb8d4b1b8acA7Fb/sources/Nexon.sol | function to get _purchaseableTokensAddress | function getpurchaseableTokensAddress() public view returns(address){
return _purchaseableTokensAddress;
}
| 5,115,178 |
./full_match/1/0xD1CE9000dAe71a7130c193486761c324fbf94819/sources/cache/solpp-generated-contracts/TinyStrings.sol | Checks whether the string contains any characters. self an instance of TinyString to check for emptiness. return true if the string is empty./ as simple as it gets: if there are no characters, the string will be 0x0 | function isEmpty(TinyString self) internal pure returns (bool) {
return TinyString.unwrap(self) == 0;
}
| 2,904,158 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "../interfaces/IAuthManager.sol";
contract AuthManager is IAuthManager, Initializable {
// mapping which contains roles for address
mapping(address => bytes32[]) internal members;
... | Add new role for member by string. Only SUPER_ROLE can add new roles roleString - role string member - address of member/ | function addByString(string calldata roleString, address member) external {
require(_find(members[msg.sender], SUPER_ROLE) != NOT_FOUND, "FORBIDDEN");
bytes32[] storage _roles = members[member];
bytes32 role = keccak256(bytes(roleString));
require(_find(_roles, role) == NOT_FOUND, ... | 14,079,232 |
./full_match/44787/0x133e77Aba91A49182C41AD2B7E3e2946D66605fF/sources/contracts/CarbonPathToken.sol | Destroys `amount` tokens from `account`, deducting from the caller's allowance. See {ERC20-_burn} and {ERC20-allowance}. Requirements: - the caller must have allowance for ``accounts``'s tokens of at least `amount`. - the caller must have `MINTER_ROLE`/ | function burnFrom(address account, uint256 amount) public virtual {
require(hasRole(MINTER_ROLE, _msgSender()), 'CarbonPathToken: must have minter role to burn');
_spendAllowance(account, _msgSender(), amount);
_burn(account, amount);
}
| 13,259,900 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "contracts/ticket/Ticket.sol";
import "hardhat/console.sol";
contract RandomMachine is Initializa... | address of player entering lottery | function enter() public payable {
require (block.timestamp >= startTimestamp + 60 seconds && block.timestamp <= startTimestamp + 100 seconds);
require(msg.sender != address(0));
require(msg.value >= cost);
records.push(payable(msg.sender));
}
| 2,478,690 |
// File: contracts/XVersion.sol
pragma solidity 0.5.17;
contract XVersion {
function getVersion() external view returns (bytes32);
}
contract XApollo is XVersion {
function getVersion() external view returns (bytes32) {
return bytes32("APOLLO");
}
}
// File: contracts/XConst.sol
pragma solidity... | calcPoolOutGivenSingleIn pAo = poolAmountOut / \ tAi = tokenAmountIn / / wI \ \\ \ wI \ wI = tokenWeightIn | tAi | 1 - || 1 - -- | ... | function calcPoolOutGivenSingleIn(
uint256 tokenBalanceIn,
uint256 tokenWeightIn,
uint256 poolSupply,
uint256 totalWeight,
uint256 tokenAmountIn,
uint256 swapFee
) public pure returns (uint256 poolAmountOut) {
uint256 normalizedWeight = tokenWeightIn.bdiv(... | 5,539 |
./full_match/1/0x33aEa2307407b0c00f885fdD45c9621D8C0db20F/sources/contracts/Blockparty.sol | See {IERC721Metadata-tokenURI}./ | function tokenURI(uint256 tokenId) public view override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory _tokenURI = _tokenURIs[tokenId];
return _tokenURI;
}
| 9,686,754 |
./full_match/1/0xa94D1052A1F67F523FCF5E7A512A43e07Cab86D7/sources/src/wildlands/tokens/rootchain/ImmortalsV2.sol | To avoid collision with OZ _msgSender, we only use _txMsgSender for lockables. ERC721 uses _msgSenderERC721A to determine sender At this point we know that the sender is a trusted forwarder, so we trust that the last bytes of msg.data are the verified sender address. extract sender address from the end of msg.dat... | function _txMsgSender() internal view returns (address ret) {
if (msg.data.length >= 20 && isTrustedForwarder(msg.sender)) {
assembly {
ret := shr(96, calldataload(sub(calldatasize(), 20)))
}
ret = msg.sender;
}
}
| 4,911,949 |
pragma solidity ^0.4.24;
/**
* @title IERC165
* @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md
*/
interface IERC165 {
/**
* @notice Query if a contract implements an interface
* @param interfaceId The interface identifier, as specified in ERC-165
* @dev Interface identifica... | super.transferFrom(msg.sender, 0x0000000000000000000000000000000000000000, _token_id); allocate PlanetCOIN tokens to user... | function burn(uint256 _token_id) public {
require(msg.sender == ownerOf(_token_id));
uint256 _cardSize = plotDetails[tokenIDplotdetailsIndexId[_token_id]].plots_lat.length;
processBurn(msg.sender, _token_id);
planetCryptoCoin_interface.transfer(msg.sender, ... | 5,342,228 |
pragma solidity ^0.7.0;
contract Create2Factory {
/**
* @dev Deploys a contract using `CREATE2`. The address where the contract
* will be deployed can be known in advance via {computeAddress}. Note that
* a contract cannot be deployed twice using the same salt.
*/
function deploy(bytes32 sa... | Returns the address where a contract will be stored if deployed via {deploy}. Any change in the `bytecode` or `salt` will result in a new destination address./ | function computeAddress(bytes32 salt, bytes memory bytecode) external view returns (address) {
return computeAddress(salt, bytecode, address(this));
}
| 2,480,155 |
pragma solidity >=0.4.0 <0.6.0;
//Land Details
contract landRegistration{
struct landDetails{
string region;
string district;
string land_area;
uint256 surveyNumber;
address payable CurrentOwner;
uint marketValue;
bool isAvailable;
address requester;
... | will show assets of the function caller | function viewAssets()public view returns(uint[] memory){
return (profile[msg.sender].assetList);
}
| 6,383,001 |
pragma solidity ^0.4.24;
/**
* @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 c) {
// Gas optimization: this is cheaper than asser... | Get base denomination info return the denomination short name return the denomination address return the denomination public name return the denomination symbol return the denomination num of decimals return the denomination multiplier (power of ten)/ | function getBaseDenomination() public view returns (bytes8, address, string, string, uint8, uint256) {
require (totalDenominations > 1);
return getDenominationByIndex(1);
}
| 10,007,364 |
pragma solidity 0.5.10;
/// @dev Randomness test contract based on https://github.com/poanetwork/posdao-contracts.
/// Generates and stores random numbers in a RANDAO manner and accumulates a random seed.
contract Random {
mapping(uint256 => mapping(address => bytes32)) public hashes;
mapping(uint256 => mappin... | Called by the validator's node to store a hash and a cipher of the validator's secret on each collection round. The validator's node must use its mining address to call this function. This function can only be called once per collection round (during the `commits phase`). _secretHash The Keccak-256 hash of the validat... | function commitHash(bytes32 _secretHash, bytes calldata _cipher) external {
require(block.coinbase == msg.sender);
require(_isCommitPhase(block.number - 1));
uint256 round = _collectRound(block.number - 1);
require(!isCommitted(round, msg.sender));
hashes[round][msg.sender] =... | 7,296,752 |
pragma solidity ^0.4.23;
// File: contracts/grapevine/crowdsale/GrapevineWhitelistInterface.sol
/**
* @title Grapevine Whitelist extends the zeppelin Whitelist and adding off-chain signing capabilities.
* @dev Grapevine Crowdsale
**/
contract GrapevineWhitelistInterface {
/**
* @dev Function to check if an a... | Function to check if an address is whitelisted _address address The address to be checked./ | function whitelist(address _address) view external returns (bool) {
return whitelist[_address];
}
| 1,357,874 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
import "./ENS.sol";
import "./Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/**
* @dev A basic interface for ENS resolvers.
*/
interface Resolver {
function s... | Sets the address record for a resident ENS name | function setResidentAddress(string calldata name, uint coinType, bytes memory a, Resolver resolver) external onlyOwner{
bytes32 label = keccak256(bytes(name));
bytes32 domainNode = keccak256(abi.encodePacked(TLD_NODE, label));
resolver.setAddr(domainNode, coinType, a);
}
| 11,908,037 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../proxy/Initializable.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functi... | Call approveOrder - Solidity ABI encoding limitation workaround, hopefully temporary./ | function approveOrder_(
address[7] memory addrs,
uint256[7] memory uints,
FeeMethod feeMethod,
SaleKindInterface.Side side,
SaleKindInterface.SaleKind saleKind,
AuthenticatedProxy.HowToCall howToCall,
bytes memory callData,
bytes memory replacementPatt... | 14,408,215 |
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./interfaces/IWnDGame.sol";
import "./interfaces/ITrainingGrounds.sol";
imp... | allows owner to withdraw funds from minting/ | function withdraw() external onlyOwner {
payable(owner()).transfer(address(this).balance);
}
| 71,918 |
./full_match/1/0x9532a80eC638E29486459C7c5e4EF3643Ecd2bEe/sources/contracts/Staking.sol | Initializes the contract. Verify the contract addresses being passed before deployment. _memagAddress Address of memag ERC20 contract, cannot be updated later. _stakingReserveAddress Address from which memag staking rewards will be paid, can be updated later. _maxStakeLimitPerPool Max stakes user can create in each... | function initialize(
address _memagAddress,
address _stakingReserveAddress,
uint256 _maxStakeLimitPerPool
) external initializer {
__Ownable_init_unchained();
memagToken = IERC20Upgradeable(_memagAddress);
maxStakePerPool = _maxStakeLimitPerPool;
stakingRe... | 9,630,288 |
pragma solidity 0.5.11;
import "./whitelist/WhitelistExtension.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/crowdsale/distribution/FinalizableCrowdsa... | ================ GETTERS ==================== | function getNumberSwaps() external view returns (uint256) {
return listSwaps.length;
}
| 912,821 |
pragma solidity ^0.4.23;
import "openzeppelin-solidity/contracts/ownership/HasNoEther.sol";
import "openzeppelin-solidity/contracts/ownership/HasNoTokens.sol";
import "openzeppelin-solidity/contracts/ownership/Claimable.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./TrueUSD.sol";
// This ... | admin initiates a request to mint _value TrueUSD for account _to | function requestMint(address _to, uint256 _value) public onlyAdminOrOwner {
uint256 releaseTimestamp = block.timestamp;
if (msg.sender != owner) {
releaseTimestamp = releaseTimestamp.add(mintDelay);
}
MintOperation memory op = MintOperation(_to, _value, admin, releaseTime... | 5,345,375 |
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./AllerSafeToken.sol";
contract TeamTokenLock {
using SafeERC20 for AllerSafe;
// ERC20 basic token contract being held
AllerSafe private immutable _token;
// beneficiary of tokens after they are releas... | Transfers tokens held by timelock to beneficiary./ | function release() public virtual {
require(block.timestamp >= releaseTime(), "TeamTokenLock: current time is before release time");
uint256 amount = token().balanceOf(address(this));
require(amount > 0, "TeamTokenLock: no tokens to release");
}
| 15,812,608 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.21 <0.7.0;
contract Lottery {
struct BetInfo {
uint256 answerBlockNumber;
address payable bettor;
bytes1 challs;
}
uint256 private _tail;
uint256 private _head;
mapping(uint256 => BetInfo) private _bets;
address pay... | Bet and distribute. User should send 0.005 ETH with 1 byte character. Information that stored in queue will be dealt in distribute function challs character that user bet on return result check function worked well/ | function betAndDistribute(bytes1 challs)
public
payable
returns (bool result)
{
bet(challs);
distribute();
return true;
}
| 12,752,654 |
./partial_match/1/0x674c9FDc5DcBD525cd3ea2C3A2caE6cfe79727C5/sources/DelayVault.sol | the user can approve the redemption of their tokens by the admin | function approveTokenRedemption(address _token, bool _status) external {
Allowance[_token][msg.sender] = _status;
emit TokenRedemptionApproval(_token, msg.sender, _status);
}
| 4,278,817 |
./full_match/5/0x7a8855fd32fD1Ea63F0E93c3ed8FF38cC66376E2/sources/project_/contracts/PepeMax.sol | Withdraw ETH from contract to contract owner wallet | function withdrawETH() external onlyOwner {
payable(owner()).transfer(address(this).balance);
}
| 1,919,959 |
/**
*Submitted for verification at Etherscan.io on 2021-08-12
*/
// Sources flattened with hardhat v2.5.0 https://hardhat.org
// File @openzeppelin/contracts/utils/introspection/[email protected]
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in th... | Sale must NOT be enabled | function preMint(address to, uint256 quantity) public onlyOwner {
require(!sale, "Sale already in progress");
require(quantity != 0, "Requested quantity cannot be zero");
require(super.totalSupply() + quantity <= maxSupply, "Total supply will exceed limit");
for (uint256 i = 0; i < ... | 6,838,305 |
pragma solidity ^0.5.0;
import "./IERC20.sol";
import "./ERC20LockableAccount.sol";
import "../../../../common-solidity/crosschain-precompile-calls/contracts/Crosschain.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* The balances are stored in their own contracts, to allow for the router / lockable ... | See {IERC20-allowance}./ | function allowance(address _owner, address _spender) public view returns (uint256) {
return allowances[_owner][_spender];
}
| 1,790,683 |
pragma solidity 0.4.25;
pragma experimental ABIEncoderV2;
/**
* @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 Owners... | called by the owner to unpause, returns to normal state/ | function unpause() public onlyOwner whenPaused {
_paused = false;
emit Unpaused();
}
| 883,671 |
./full_match/5/0xA0E69f8Cf9f8F8555e1Bd0983214871e674ac30F/sources/contracts/tenderswap/TenderSwap.sol | @inheritdoc ITenderSwap | function addLiquidity(
uint256[2] calldata _amounts,
uint256 _minToMint,
uint256 _deadline
) external override nonReentrant deadlineCheck(_deadline) returns (uint256) {
SwapUtils.PooledToken[2] memory tokens_ = [token0, token1];
return SwapUtils.addLiquidity(tokens_, _am... | 7,038,723 |
./full_match/1/0x016C8f5BA33475570cDD6c3948A1D3E06fF4cd20/sources/contracts/ZappedPaymentSplitter.sol | Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20 contract./ _erc20TotalReleased[token] is the sum of all values in _erc20Released[token]. If "_erc20TotalReleased[toke... | function release(IERC20 token, address account) public virtual {
require(_shares[account] > 0, "ZappedPaymentSplitter: account has no shares");
uint256 payment = releasable(token, account);
require(payment != 0, "ZappedPaymentSplitter: account is not due payment");
_erc20TotalRele... | 2,913,597 |
./partial_match/1/0x7FA888A801fC7B7E5e847239E58DD4e2dc621Fd5/sources/contracts/nft/ReflectiveURIDescriptor.sol | An owner-only function for setting the string value of the base URI. newBaseURI The new value of the base URI./ | function setBaseURI(string memory newBaseURI) external onlyOwner {
baseURI = newBaseURI;
emit SetBaseURI(msg.sender, newBaseURI);
}
| 4,189,091 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
... | inject NONSTANDARD NAMING | function FUNCTIONCALL15(address target, bytes memory data) internal returns (bytes memory) { | 12,568,882 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.5.16;
contract JoetrollerErrorReporter {
enum Error {
NO_ERROR,
UNAUTHORIZED,
JOETROLLER_MISMATCH,
INSUFFICIENT_SHORTFALL,
INSUFFICIENT_LIQUIDITY,
INVALID_CLOSE_FACTOR,
INVALID_COLLATERAL_FACTOR,
... | Returns whether the given account is entered in the given asset account The address of the account to check jToken The jToken to check return True if the account is in the asset, otherwise false./ | function checkMembership(address account, JToken jToken) external view returns (bool) {
return markets[address(jToken)].accountMembership[account];
}
| 1,810,223 |
./full_match/80001/0xBF6c49840EF2c86D237d55FdAF6CD51490942c5b/sources/Vault1155ERM.sol | Set the role flags for a given set of users. It's possible, but not recommended, to remove all admins. This will lock out all future role and contract management. Depositor and withdrawal flags will have no affect unless the vault is using this whitelist to restrict those actions (see: `changeRoleRestrictions()`). It's... | function setRoles(address[] calldata users, bool adminFlag, bool depositorFlag, bool withdrawerFlag) external {
require(
, "Not authorized");
uint256 rolesFlag;
if (depositorFlag) {
rolesFlag |= R_CAN_DEPOSIT;
}
if (withdrawerFlag) {
rolesFlag... | 866,577 |
pragma solidity ^0.5.0;
contract Adoption {
address[16] public adopters;
//Adopting fish
function adopt(uint fishId) public returns (uint){
require(fishId >= 0 && fishId <= 15);
adopters[fishId] = msg.sender;
return fishId;
}
// Retrieving the adopters
function getAd... | Retrieving the adopters | function getAdopters() public view returns (address[16] memory) {
return adopters;
}
| 1,046,391 |
pragma solidity 0.4.24;
/**
COPYRIGHT 2018 Token, Inc.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDER... | Delete value for String associated with bytes32 id key _key Pointer identifier for value in storage return { "success" : "Returns true when successfully called from another contract" }/ | function deleteString(bytes32 _key) public onlyOwner returns (bool success) {
delete stringStorage[_key];
return true;
}
| 1,780,682 |
./full_match/1/0xdD8bd1a9927aB550Cf2fC0a9da14702F9c09ac88/sources/contracts/ChromiaDelegation.sol | Matches `account`'s delegation to the underlying stake. `isStakeValid(account)` must be false before call. | function reviseDelegation(address account) external nonReentrant onlyRole(WHITELIST_ADMIN) {
require(!isStakeValid(account), ALREADY_SYNCRONISED_ERROR);
(, , , uint64 since) = twn.getStakeState(account);
require(block.timestamp - since > epochLength, CHANGE_TOO_RECENT_ERROR);
Delega... | 2,989,905 |
./full_match/8453/0x6AE3fFA7bb6f95fAcA1F1A7f85880C87141c0236/sources/contracts/utils/0xUtils/LibMath.sol | Calculates partial value given a numerator and denominator rounded down. numerator Numerator. denominator Denominator. target Value to calculate partial of. return partialAmount Partial value of target rounded down. | function getPartialAmountFloor(
uint256 numerator,
uint256 denominator,
uint256 target
) internal pure returns (uint256 partialAmount) {
partialAmount = (numerator * target) / denominator;
return partialAmount;
}
| 11,544,835 |
./full_match/1/0x3592954497dAFb830469d25F8c46ab0Afd9C27F1/sources/browser/CoreUtils.sol | 要清算的质押物数量X = (ACprice - PCRPD)/(price(1-PCRDiscount))X = (PCRPD - ACprice)/(price(PCRDiscount-1))若质押资产不能清偿债务,全额清算逾期未还款 | function X(uint256 id) public view returns (uint256 res) {
IBondData b = bondData(id);
if (!isUnsafe(id)) {
return 0;
}
if (isInsolvency(id)) {
return b.getBorrowAmountGive();
}
if (now >= b.bondExpired().add(b.gracePeriod())) {
... | 4,923,191 |
./partial_match/3/0x9bb72C6E2c1aA070276b438228F55e81f73E9586/sources/IPKFarm.sol | Interface of the ERC20 standard as defined in the EIP. Does not include the optional functions; to access them see {ERC20Detailed}./ | 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 mint(address account, uint amount) external;
function allowance(ad... | 5,306,632 |
./full_match/1/0x3c1164531d5857029ae5412E49999306547834d8/sources/@rmrk-team/evm-contracts/contracts/RMRK/extension/RMRKRoyalties.sol | Used to retrieve the recipient of royalties. return Address of the recipient of royalties/ | function getRoyaltyRecipient() public view virtual returns (address) {
return _royaltyRecipient;
}
| 9,657,843 |
./full_match/1/0x5231617982e340a6651bd6357f15bc3461519b2b/sources/contracts/utils/transfer/TransferHelper.sol | internal function to perform assets transfer from address from which fees and payment is taken to address who receives payment assetType asset type (Native, ERC20, ERC721, ERC1155) collection token address, if payment performed in native coin then address(0) can be used id token id for ... | function _transfer(
address from,
address to,
AssetType assetType,
address collection,
uint256 id,
uint256 amount
) internal {
if (assetType == AssetType.ERC721) {
return _performERC721Transfer(collection, from, to, id);
}
if (a... | 17,072,102 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.