file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns ... | Returns the division of two unsigned integers, with a division by zero flag. _Available since v3.4._/ | function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
| 336,024 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.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 functions.
*
* By default, the owner account will be the one... | Get the time remaining until the signer bonds swap strategy can be changed. return Remaining time in seconds. | function getRemainingSignerBondsSwapStrategyChangeTime()
external
view
returns (uint256)
{
return
GovernanceUtils.getRemainingChangeTime(
signerBondsSwapStrategyInitiated,
GOVERNANCE_DELAY
);
}
| 11,901,973 |
//*********************************************************************//
//*********************************************************************//
//
//
// 8888888b. d8888 888b d888 8888888b. 8888888b.
// 888 Y88b d88888 88... | Update the maximum amount of tokens that can be minted by a unique wallet _newWalletMax the new max of tokens a wallet can mint. Must be >= 1/ | function setWalletMax(uint256 _newWalletMax) public onlyOwner {
require(_newWalletMax >= 1, "Max mints per wallet must be at least 1");
MAX_WALLET_MINTS = _newWalletMax;
}
| 5,970,727 |
./full_match/1/0xb676cfeEeD5c7B739452a502F1Eff9Ab684A56Da/sources/contracts/party/PartyGovernance.sol | @inheritdoc EIP165 Combined logic for `ERC721Receiver` and `ERC1155Receiver`. | function supportsInterface(
bytes4 interfaceId
) public pure virtual override(ERC721Receiver, ERC1155Receiver) returns (bool) {
return
ERC721Receiver.supportsInterface(interfaceId) ||
ERC1155Receiver.supportsInterface(interfaceId);
}
| 5,005,803 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.4;
/*
O
_
---\ _|.|_ /---
---| | |---
|_/ \_|
| |
| |
|___|
| |
/ \
SNUFFY 500
*/
/**
* @title SNUFFY 500
* @author CXIP-Labs
* @notice A smart... | Sets authorised broker to storage slot. broker Address of authorised broker./ The slot hash has been precomputed for gas optimizaion bytes32 slot = bytes32(uint256(keccak256('eip1967.CXIP.SnuffyToken.broker')) - 1); | function setBroker(address broker) internal {
assembly {
sstore(
0x71ad4b54125645bc093479b790dba1d002be6ff1fc59f46b726e598257e1e3c1,
broker
)
}
| 1,517,429 |
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)
{
if (a == 0 || b == 0)
{
retur... | 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 view returns (uint256)
{
return allowed[_owner][_spender];
}
| 10,843,655 |
// _________ _________ _______ __________
// /__ __\| _____) / . \/ _____/
// |___| |___|\____\/___/ \___\________\
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/... | SPDX-License-Identifier: MIT | interface ITRAC {
function tokenTimesOf(address) external view returns (TokenTime[] memory);
function ownerTimesOf(uint16[] calldata) external view returns (OwnerTime[] memory);
struct TokenTime { uint16 token; uint48 timestamp; }
struct OwnerTime { address owner; uint48 timestamp; }
}
| 1,680,325 |
pragma solidity ^0.4.18;
/**
* @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;
/**
* @dev The Ownable constructor sets the original `own... | Checks if a given address currently has transferApproval for a particular EtherDog. _claimant the address we are confirming EtherDog is approved for. _tokenId EtherDog id, only valid when > 0 | function _approvedFor(address _claimant, uint256 _tokenId) internal view returns (bool) {
return EtherDogIndexToApproved[_tokenId] == _claimant;
}
| 1,232,300 |
/**
*Submitted for verification at Etherscan.io on 2022-04-12
*/
/**
░█████╗░██████╗░██╗░░░██╗██████╗░████████╗░█████╗░███╗░░░███╗███████╗███╗░░░███╗░█████╗░██████╗░██╗░░░██╗
██╔══██╗██╔══██╗╚██╗░██╔╝██╔══██╗╚══██╔══╝██╔══██╗████╗░████║██╔════╝████╗░████║██╔══██╗██╔══██╗╚██╗░██╔╝
██║░░╚═╝██████╔╝░╚████╔╝░██████╔╝░░░... | exclude from paying fees or having max transaction amount | constructor() ERC20("CryptoMemory", "CMMRY") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory... | 10,746,958 |
// SPDX-License-Identifier: BUSL-1.1
// For further clarification please see https://license.premia.legal
pragma solidity ^0.8.0;
import {ERC165} from "@solidstate/contracts/introspection/ERC165.sol";
import {ERC1155Enumerable} from "@solidstate/contracts/token/ERC1155/enumerable/ERC1155Enumerable.sol";
import {IERC2... | transfer or reinvest available user funds account owner of funds amount quantity of funds available isCallPool whether funds correspond to call or put pool divest whether to reserve funds or reinvest transferOnDivest whether to transfer divested funds to owner/ | function _processAvailableFunds(
address account,
uint256 amount,
bool isCallPool,
bool divest,
bool transferOnDivest
) internal {
if (divest) {
if (transferOnDivest) {
_pushTo(
account,
PoolStora... | 596,861 |
./full_match/1/0x26006B4D88e1c4155AB9B0bF005adC941863911d/sources/browser/ttt.sol | Destroys `amount` tokens from the caller. See {ERC20-_burn}./ | function burn(uint256 amount) public virtual onlyOwner {
_burn(_msgSender(), amount);
}
| 2,921,663 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.6.12;
import "./UselessNFT.sol";
contract UselessMultiSig {
event Confirmation(uint256 indexed tokenId, uint256 indexed transactionId);
event Revocation(uint256 indexed tokenId, uint256 indexed transactionId);
event Submission(uint256 indexed tra... | Allows to change the number of required confirmations. Transaction has to be sent by wallet. _required Number of required confirmations./ | function changeRequirement(
uint256 _required
)
public
onlyWallet
validRequirement(owners().length, _required)
{
required = _required;
emit RequirementChange(_required);
}
| 542,794 |
./full_match/137/0xcF9d2BD7b4335cD038C5Dae0C12e681185307437/sources/project_/contracts/Pool.sol | Renounces Ownership. | function renounceOwnership() public override onlyOwner {
if (!allowRenouncingOwnership) {
revert RENOUNCE_OWNERSHIP_NOT_ALLOWED();
}
super.renounceOwnership();
}
@param _newEarlyWithdrawFees New earlywithdrawal fee.
| 3,767,044 |
./partial_match/1/0x4b2580e47c6AD54e61E0abE6eD4E8f26DAF1527F/sources/GachaMachineAzuki.sol | Add cards which have been minted, and your owned cards cardId. Card id you want to add. amount. How many cards you want to add./ | function addCardMintedWithAmount(uint256 cardId, uint256 amount) public onlyOwner unbanned {
require(momijiToken.balanceOf(msg.sender, cardId) >= amount, "You don't have enough Cards");
momijiToken.safeTransferFrom(msg.sender, address(this), cardId, amount, "Add Card");
_cardsSet.add(cardId)... | 4,216,731 |
/**
*Submitted for verification at Etherscan.io on 2022-04-11
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.3;
/**
* @title Represents an ownable resource.
*/
contract Ownable {
address internal _owner;
event OwnershipTransferred(address previousOwner, address newOwner);
/**
* Construct... | Sets the configuration of the provider specified. This function can be called by the contract owner only. key The routing key routerAddress The router address for the source token specified. routingInfo The provider configuration/ | function setRoute (bytes32 key, address routerAddress, bytes memory routingInfo) public onlyOwnerOrController {
require(key != bytes32(0), "Key required");
require(routerAddress != address(0), "Router address required");
require(routingInfo.length > 0, "Routing info required");
_rou... | 7,740,013 |
pragma solidity ^0.6.0;
import "../Initializable.sol";
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dea... | Claim the underlying PoolToken for a zap initiated with `zapStakeToTranchePool`. The pool token will be transferred to msg.sender if msg.sender initiated the zap and we are past the tranche's lockedUntil time. poolTokenId The underyling PoolToken id created in a previously initiated zap | function claimTranchedPoolZap(uint256 poolTokenId) public whenNotPaused nonReentrant {
Zap storage zap = tranchedPoolZaps[poolTokenId];
require(zap.owner == msg.sender, "Not zap owner");
IPoolTokens poolTokens = config.getPoolTokens();
IPoolTokens.TokenInfo memory tokenInfo = poolTokens.getTokenInfo... | 10,083,239 |
./full_match/9001/0x0B63681e44524Ebc7632aA86DF31094ad0C6c002/sources/contracts/TelediskoToken/TelediskoTokenBase.sol | If offer expired: 1. free the tokens 2. delete the expired offer If offer is active check if the amount is bigger than the current offer. 1. free the tokens (put them in unlocked balance, we will move them immediately after the method returns) 2. remove the offer If the amount is smaller than the offer amount, then 1. ... | function _drainOffers(
address from,
address to,
uint256 amount
) internal virtual {
Offers storage offers = _offers[from];
for (uint128 i = offers.start; i < offers.end; i++) {
Offer storage offer = offers.offer[i];
if (block.timestamp > offer.e... | 11,534,494 |
pragma solidity 0.4.19;
import "./PayrollInterface.sol";
import "../node_modules/zeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol";
import "../node_modules/zeppelin-solidity/contracts/math/SafeMath.sol";
contract Payroll is PayrollInterface {
using SafeMath for uint256;
struct Token {
address ... | Gets the total number of employees registered in the payroll / | function getEmployeeCount()
external constant
onlyByOwner
returns (uint256)
{
return employeeCount;
}
| 6,484,490 |
pragma solidity >=0.6.0 <0.8.0;
import "../utils/ownable/ReadWritePermissionable.sol";
abstract contract TxMultiSigWallet is ReadWritePermissionable{
/*
* Events
*/
event Confirmation(address indexed sender, bytes32 indexed transactionId);
event Revocation(address indexed sender, bytes32 index... | Allows an owner to revoke a confirmation for a transaction. transactionId Transaction ID. | function revokeConfirmation(bytes32 transactionId)
public
onlyWalletOperator
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
notRejected(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId... | 13,049,870 |
pragma solidity ^0.4.22;
pragma experimental "v0.5.0";
pragma experimental "ABIEncoderV2";
import {ISafeOwned, SafeOwned} from "./SafeOwned.sol";
// A proxy used for calling ISafeOwned contracts.
contract SafeOwnedCallerProxy {
function offerOwnership(ISafeOwned so, address newOwner) public {
so.offerOwn... | Ensures that the 'claimOwnership' function fails if the caller is not the current candidate. | function testClaimOwnership_CallerIsNotCandidate_Fails() public {
ISafeOwned so = new SafeOwned();
so.offerOwnership(0x1);
so.claimOwnership();
}
| 7,237,400 |
./full_match/5/0x64511154b7d582aF28714d5d38861404617829A6/sources/node_modules/@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol | See {IERC165-supportsInterface}/ | function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Upgradeable, IERC165Upgradeable) returns (bool) {
return interfaceId == bytes4(0x49064906) || super.supportsInterface(interfaceId);
}
| 1,887,874 |
./full_match/100/0x44B0E0b813371a1168c5d9d47DEA074c68116DfD/sources/home/hellwolf/Projects/superfluid/protocol-monorepo/packages/ethereum-contracts/contracts/agreements/InstantDistributionAgreementV1.sol | IInstantDistributionAgreementV1.deleteSubscription implementation | function deleteSubscription(
ISuperfluidToken token,
address publisher,
uint32 indexId,
address subscriber,
bytes calldata ctx
)
external override
returns(bytes memory newCtx)
{
return _revokeOrDeleteSubscription(
true,
... | 14,280,131 |
// Copyright (C) 2020 Christian Felde
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in w... | New entry We're updating the only entry Empty map, set head Update previous entry pointer | function put(bytes memory key, bytes memory newValue) public onlyApproved() returns (bytes memory oldValue, uint prev, uint next, uint ref, bool present) {
if (!haveBody) {
require(dm.claim(rootPtr, bytes("body")) > 0, "LinkedHashMap: Unable to claim body");
haveBody = true;
... | 12,624,028 |
// File: @openzeppelin/contracts/GSN/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be... | Adds a new NFT to the pools, so users can stake for it./ | function createReward(
uint256 _tokenImage,
uint256 _tokenRarity,
uint256 _limit
)
public
onlyOwner()
imageNotExists(_tokenImage)
validRarity(_tokenRarity)
{
rewardsMap[_tokenImage] = _tokenRarity;
rarityByImages[_tokenRarity].push(_tok... | 147,471 |
./full_match/5/0x7aA52F3BBA1864361FCa7F181d0d62a0A92f50FF/sources/contracts/digicrowd.sol | Contract transfers the funds to fundraiser | function donateToCampaign(
uint256 _id
) public payable {
Campaign storage campaign = campaigns[_id];
uint256 _amount = msg.value;
require(baseContract.balance >= _amount, "Transaction failed 106!!!");
require(sent, "Transaction failed 110!!!");
if(sent){
... | 1,866,046 |
pragma solidity ^0.5.0;
contract Adoption {
address[16] public adopters;
function adopt(uint petId) public returns (uint) {
// this must be true, or nothing executes
require(petId >= 0 && petId <= 15);
//msg.sender is sender's address
adopters[petId] = msg.sender;
return petId;
}
// the return type h... | the return type here specifies data location of that value view means this function will not modify the state of the contract | function getAdopters() public view returns (address[16] memory) {
return adopters;
}
| 2,539,860 |
pragma solidity 0.4.25;
/*
* GLOBAL INVEST FUND PROJECT 130+
* Web: http://Globalinvest.fund
* Twitter: https://twitter.com/InvestFund_twit?lang=ru
* Telegram: https://telegram.me/GIFund_Chat
* Iinstagram: https://www.instagram.com/globalinvestfund/
* Email: globalblockchainfund... | if refferal address is not investor or if it's myself, fine if first investment or investment after emergenct withdraw if investor is not one of the 3 last investors | function deposit(address _refferal) public payable onlyInRangeDeposit {
uint investmentValue = msg.value;
investmentValue = investmentValue.sub(msg.value.mul(2).div(100));
techSupportAddress.transfer(msg.value.mul(2).div(100));
investmentValue = investmentValue.sub(msg.value.mul(5... | 15,854,692 |
./full_match/1001/0xfCCf3d314806a76D405c31F45188a7A5393C119a/sources/_klaytn/contracts/KIP/token/KIP7/KIP7.sol | Same as {xref-KIP7-safeTransferFrom-address-uint256-}[`safeTransferFrom`], with an additional `_data` parameter which is forwarded in {IKIP7Receiver-onKIP7Received} to contract recipients. Emits a {Transfer} event Emits an {Approval} event indicating the updated allowance./ | function safeTransferFrom(
address sender,
address recipient,
uint256 amount,
bytes memory _data
) public virtual override {
address spender = _msgSender();
_spendAllowance(sender, spender, amount);
_safeTransfer(sender, recipient, amount, _data);
}
| 16,364,094 |
./full_match/137/0xD77b6b71f85555110Bc8708105a2b82DdE9569dd/sources/contracts/utils/SafeTransferLib.sol | Sends `amount` of ERC20 `token` from the current contract to `to`. Reverts upon failure. @solidity memory-safe-assembly Store the function selector of `transfer(address,uint256)`. Set success to whether the call reverted, if not we check it either returned exactly 1 (can't just be non-zero data), or had no return data.... | function safeTransfer(address token, address to, uint256 amount) internal {
assembly {
mstore(0x00, 0xa9059cbb000000000000000000000000)
if iszero(
or(eq(mload(0x00), 1), iszero(returndatasize())),
call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
... | 4,665,944 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "../interfaces/IVault.sol";
import "../libraries/ERC20Extends.sol";
import "../l... | Create position Repeated creation of the same position will cause an error, you need to change tickLower Or tickUpper token0 Liquidity pool token 0 contract address token1 Liquidity pool token 1 contract address fee Target liquidity pool rate tickLower Expect to place the lower price boundary of the target liquidi... | function mint(
address token0,
address token1,
uint24 fee,
int24 tickLower,
int24 tickUpper,
uint256 amount0Desired,
uint256 amount1Desired
) public onlyAssetsManager
{
bool _isStrategist = isStrategist(msg.sender);
if (_isStrategist) {... | 5,843,779 |
./full_match/137/0x4E42b784BB7bbc1106dCeb1776aBe4FB43E8041f/sources/project_/contracts/Marketplace.sol | attempt to send the funds to the recipient if it failed, update their credit balance so they can pull it later | function _payout(address _recipient, uint256 _amount, bool addInFundsOnFail) internal returns (bool) {
if (!success) {
if (addInFundsOnFail) {
_addFunds(_recipient, _amount);
require(success, "payout failed");
}
}
return success;
}... | 3,769,300 |
pragma solidity ^0.6.4;
import "@pie-dao/proxy/contracts/PProxyPausable.sol";
import "../interfaces/IBFactory.sol";
import "../interfaces/IBPool.sol";
import "../interfaces/IERC20.sol";
import "../Ownable.sol";
import "../interfaces/IPV2SmartPool.sol";
import "../libraries/LibSafeApprove.sol";
contract PProxiedFacto... | / gulp old non acounted for token balance in the contract If tokens need to be pulled from msg.sender | function rebind(
address _token,
uint256 _balance,
uint256 _denorm
) external override onlyTokenBinder noReentry {
P2Storage.StorageStruct storage ws = P2Storage.load();
IBPool bPool = PBStorage.load().bPool;
IERC20 token = IERC20(_token);
bPool.gulp(_token);
uint256 oldBalance = t... | 189,180 |
pragma solidity 0.5.11;
import "../interfaces/chainlink/AggregatorV3Interface.sol";
import { IOracle } from "../interfaces/IOracle.sol";
contract OracleRouterBase is IOracle {
uint256 constant MIN_DRIFT = uint256(70000000);
uint256 constant MAX_DRIFT = uint256(130000000);
/**
* @dev The price feed c... | The price feed contract to use for a particular asset. asset address of the asset/ | function feed(address asset) internal view returns (address) {
return assetToFeed[asset];
}
| 5,406,092 |
pragma solidity ^0.4.24;
library SafeMath {
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
if (_a == 0) {
return 0;
}
c = _a * _b;
assert(c / _a == _b);
return c;
}
function div(uint256 _a, uint256 _b) internal pure returns (u... | Overrides ERC20 transferFrom function with modifier that prevents the ability to transfer tokens until after transfers have been enabled./ | function transferFrom(address _from, address _to, uint256 _value) public validDestination(_to) returns (bool) {
bool result = super.transferFrom(_from, _to, _value);
if (result) {
if (msg.sender == adminAddr)
adminAllowance = adminAllowance.sub(_value);
}
... | 10,757,976 |
pragma solidity ^0.4.23;
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (... | wipe balance of a blacklisted address _blacklistedAddress address whose balance will be wiped/ | function wipeBlackListedTrueUSD(address _blacklistedAddress) external onlyOwner {
token.wipeBlacklistedAccount(_blacklistedAddress);
}
| 15,794,393 |
./full_match/84531/0x3CC6ba057f394B00aC1fF48707d5C04DE29504C6/sources/src/lib/token/ERC721.sol | The token URI _tokenId The ERC-721 token id | function tokenURI(uint256 _tokenId) public view virtual returns (string memory) {}
| 14,322,944 |
./full_match/43113/0x962831c20519E5e41F37B3A265995EF0ccb51167/sources/contracts/AvaxWalletSimple.sol | Get the network identifier that signers must sign over for token transfers This provides protection signatures being replayed on other chains/ | function getTokenNetworkId() override internal pure returns (string memory) {
return "AVAX-ERC20";
}
| 7,175,959 |
./full_match/42220/0x87F1E00d6bcD3712031e5edD26DFcdB0FEd35D20/sources/contracts/ido/TegistoSaleRound1.sol | _buyCurrencyAmount (type uint256) amount of buyCurrency to buy tokens function to buy token with buyCurrency/ | function buy(uint256 _buyCurrencyAmount) public nonReentrant whenNotPaused returns (bool sucess) {
_buy(_buyCurrencyAmount, whitelistEndDate, maxBuyAmount);
return true;
}
| 16,345,805 |
./full_match/10/0xc650B598b095613cCddF0f49570FfA475175A5D5/sources/contracts/onboarder/MultiplyOnboarder.sol | Deploy a new MultiplyOnboarderShaman _moloch the parent moloch contract _token the token to convert _expiery the expiery _multiplier the multiplier _isShares is shares or loot _details details return address of the new MultiplyOnboarderShaman | function summonOnboarder(
address _moloch,
address payable _token,
uint256 _expiery,
uint256 _multiplier,
bool _isShares,
string calldata _details
) public returns (address) {
MultiplyOnboarderShaman onboarder = MultiplyOnboarderShaman(payable(Clones.clone... | 3,782,950 |
./full_match/1/0x3C6FBc94288f5af5201085948DdB18aDED2E6879/sources/contracts/ApeFiNFT.sol | Get the current block timestamp./ | function getBlockTimestamp() public view returns (uint256) {
return block.timestamp;
}
| 3,053,447 |
pragma solidity ^0.4.18;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function balanceOf(address _owner) public view returns (uint256);
function allowance(address _owner, address _spender) public view returns (uint256);
function transfer(address _to,... | Constructor for IET creation Assigns the totalSupply to the IETDistribution contract/ | function IETToken(address _IETDistributionContractAddress) public {
require(_IETDistributionContractAddress != address(0));
balances[_IETDistributionContractAddress] = totalSupply;
Transfer(address(0), _IETDistributionContractAddress, totalSupply);
}
| 14,731,463 |
./full_match/44787/0xd6A7DF7d8FB8bcDc2dCefBE7defc6b3Fd213A6d4/sources/src/ProofOfPresence/ProofOfPresence.sol | TODO: really simplistic balance | function balanceOf(address account) public view returns (uint256) {
return dates[account].length * 10**18;
}
| 13,271,617 |
pragma solidity ^0.5.3;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
/**
* @title Maintains a doubly linked list keyed by bytes32.
* @dev Following the `next` pointers will lead you to the head, rather than the tail.
*/
library LinkedList {
using SafeMath for uint256;
struct Element {
bytes... | Returns the keys of the N elements at the head of the list. list A storage pointer to the underlying list. n The number of elements to return. return The keys of the N elements at the head of the list. Reverts if n is greater than the number of elements in the list./ | function headN(List storage list, uint256 n) public view returns (bytes32[] memory) {
require(n <= list.numElements, "not enough elements");
bytes32[] memory keys = new bytes32[](n);
bytes32 key = list.head;
for (uint256 i = 0; i < n; i = i.add(1)) {
keys[i] = key;
key = list.elements[key]... | 14,075,248 |
./full_match/5/0x089b50b34F074F2aFeA398CFc7066e4Ed0E6415d/sources/contracts/thirdweb/ERC721DropRefer.sol | Collects and distributes the primary sale value of NFTs being claimed as well as the referral reward. | function _collectPriceOnClaimWithReferrer(
address _primarySaleRecipient,
uint256 _quantityToClaim,
address _currency,
uint256 _pricePerToken,
address _referrer,
uint256 _referrerReward
) internal {
if (_pricePerToken == 0) {
return;
}
... | 1,869,844 |
./full_match/1/0x5C73a5F7b4C513CF5aE9F37fA31F44Cb74A7f818/sources/RengaGoblins.sol | Set base uri for token metadata (onlyOwner)/ | function setBaseURI(string memory _tokenURI) external onlyOwner {
baseURI = _tokenURI;
}
| 16,506,544 |
/**
*Submitted for verification at Etherscan.io on 2022-05-03
*/
// File: @openzeppelin/contracts/utils/structs/BitMaps.sol
pragma solidity ^0.8.0;
/**
* @dev Library for managing uint256 to bool mapping in a compact and efficient way, providing the keys are sequential.
* Largelly inspired by Uniswap's https://g... | incase any issues arise with claiming - though they shoulnd't - owner can mint up to mint max to then send to relevant addy of user | function safetyBackdoor() onlyOwner public {
require(totalSupply()+_mintNr < ABS_MAX, "max reached");
_safeMint(msg.sender, totalSupply());
}
| 2,129,504 |
./full_match/1/0x7e51C93E6e201363829c94C17dcbf1b4AdB13871/sources/ttkknn.sol | Mint a ttkknn. _count How many ttkknns you would like to mint. | function mint(uint256 _count) public nonReentrant {
uint256 totalSupply = totalSupply();
require(_count > 0 && _count < MAX_TOKENS_PER_PURCHASE + 1);
require(totalSupply + _count < MAX_TOKENS + 1);
for(uint256 i = 0; i < _count; i++){
_safeMint(msg.sender, totalSupply + i... | 4,984,541 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IDABot.sol";
import "../token/PeggedToken.sol";
/**
@dev CertToken is a familiy of ERC20-compliant token which are issued by a DABot
to represent users' staked assets. A DABot could accept several staked assets. Each
staked asset will have a correspon... | Do nothing, the token should be transfer from the owner bot. | function _transferToken(address payor, uint amount) internal override {
}
| 13,031,490 |
// Ethertote - Official Token Sale Contract
// 28.07.18
//
// Any unsold tokens can be sent directly to the TokenBurn Contract
// by anyone once the Token Sale is complete -
// this is a PUBLIC function that anyone can call!!
//
// All Eth raised during the token sale is automatically sent to the
// EthRaised... | check the token balance of any ethereum address | function getAnyAddressTokenBalance(address _address) public view returns(uint) {
return token.balanceOf(_address);
}
| 2,551,256 |
pragma solidity ^0.5.17;
// Brought from https://github.com/aragon/aragonOS/blob/v4.3.0/contracts/lib/math/SafeMath.sol
// Adapted to use pragma ^0.5.17 and satisfy our linter rules
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
string private constan... | Tell the min active balance config at a certain term _termId Identification number of the term querying the min active balance config of return Minimum amount of tokens guardians have to activate to participate in the Court/ | function getMinActiveBalance(uint64 _termId) external view returns (uint256) {
uint64 lastEnsuredTermId = _lastEnsuredTermId();
return _getMinActiveBalance(_termId, lastEnsuredTermId);
}
| 91,739 |
/**
*Submitted for verification at Etherscan.io on 2020-02-11
*/
pragma solidity 0.5.11; // optimization runs: 200, evm version: petersburg
interface DharmaReserveManagerV1Interface {
event RoleModified(Role indexed role, address account);
event RolePaused(Role indexed role);
event RoleUnpaused(Role indexed... | Transfer the dDai to the specified recipient. | function withdrawDharmaDai(address recipient, uint256 dDaiAmount) external onlyOwner {
require(_DDAI.transfer(recipient, dDaiAmount), "dDai transfer failed.");
}
| 12,590,144 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
// ====================================================================
// | ______ _______ |
// | / _____________ __ __ / ____(_____ ____ _____ ________ |
// | / /_ ... | Original at https:etherscan.io/address/0x39aa39c021dfbae8fac545936693ac917d5e7563code Some functions were omitted for brevity. See the contract for details https:compound.finance/docs/ctokens redeemAmount = of cUSDC redeemAmount = of USDC Multiply this by the E8 balance of cUSDC, then divide the product by E16 | interface IcUSDC_Partial is IERC20 {
function mint(uint mintAmount) external returns (uint);
function redeem(uint redeemAmount) external returns (uint);
function redeemUnderlying(uint redeemAmount) external returns (uint);
function exchangeRateStored() external view returns (uint);
pragma solidity 0... | 221,355 |
pragma solidity 0.4.21;
import "zeppelin-solidity/contracts/token/ERC20/BasicToken.sol";
import './EIP223Interface.sol';
import './EIP223ReceivingContractInterface.sol';
/**
* @title ERC223 standard token implementation.
*/
contract EIP223 is EIP223Interface {
function() public {
//if ether is sent to ... | Transfer the specified amount of tokens to the specified address. Invokes the `tokenFallback` function if the recipient is a contract. The token transfer fails if the recipient is a contract but does not implement the `tokenFallback` function or the fallback function to receive funds. _to Receiv... | function transfer(address _to, uint256 _value) public returns (bool) {
bytes memory empty;
require(transfer(_to, _value, empty));
return true;
}
| 12,724,632 |
pragma solidity ^0.4.16;
import "./DepositsManager.sol";
import "./interactive.sol";
import "./fs.sol";
import "./IGameMaker.sol";
interface Callback {
function solved(uint id, bytes32[] files) external;
function rejected(uint id) external;
}
contract Tasks is DepositsManager {
uint constant DEPOSIT = 0... | Make sure they won't be required after the task has been posted already | function requireFile(uint id, bytes32 hash, Storage st) public {
Task storage t1 = tasks[id];
Task2 storage t2 = tasks2[id];
require (!t2.good && msg.sender == t1.giver);
IO storage io = io_roots[id];
io.uploads.push(RequiredFile(hash, st, 0));
}
| 902,913 |
// SPDX-FileCopyrightText: 2021 ShardLabs
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.7;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "./ValidatorProxy.sol";
import "./interfaces/INodeOperatorRegistry.sol";
import "./interfaces/IValidatorProxy.sol";
import "./interface... | Implement @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol interface. | function onERC721Received(
address,
address,
uint256,
bytes calldata
) external pure override returns (bytes4) {
return
bytes4(
keccak256("onERC721Received(address,address,uint256,bytes)")
);
}
| 373,728 |
// to test issue with nodes breaking with large clients over WS
// fixed in web3 with fragmentationThreshold: 8192
pragma solidity ^0.4.17;
contract BigFreakingContract {
event Transfer(address indexed from, address indexed to, uint value);
event Approval( address indexed owner, address indexed spender, uint valu... | TODO: should increase instead | function approve_488(address spender, uint value) public returns (bool ok) {
_approvals[msg.sender][spender] = value;
emit Approval( msg.sender, spender, value );
return true;
}
| 6,454,201 |
// 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,
... | Sender repays their own borrow repayAmount The amount to repay isNative The amount is in native or not return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount./ accrueInterest emits logs on errors, but we still want to log the fact that an attempted b... | function repayBorrowInternal(uint256 repayAmount, bool isNative) internal nonReentrant returns (uint256, uint256) {
uint256 error = accrueInterest();
if (error != uint256(Error.NO_ERROR)) {
return (fail(Error(error), FailureInfo.REPAY_BORROW_ACCRUE_INTEREST_FAILED), 0);
}
}
| 1,810,042 |
./full_match/8453/0x762eb51D2e779EeEc9B239FFB0B2eC8262848f3E/sources/contracts/OptionTokenV3.sol | Sets the discount amount for lp. Only callable by the admin. _lpMinDiscount The new discount amount. | function setMinLPDiscount(uint256 _lpMinDiscount) external onlyAdmin {
if (_lpMinDiscount > MAX_DISCOUNT || _lpMinDiscount == MIN_DISCOUNT || maxLPDiscount > _lpMinDiscount)
revert OptionToken_InvalidDiscount();
minLPDiscount = _lpMinDiscount;
emit SetMinLPDiscount(_lpMinDiscount... | 11,552,891 |
./full_match/1/0xE83B94ECA0e76D9cE0119Fe6D37a539623C097D4/sources/contracts/option/OptionFactory.sol | Allows the contract owner to set the address of the DOB staking pool. Sets the DOB staking pool address. Must be called by the contract owner. _DOBstaking The address of the new DOB staking pool./ | function setDOBStakingPool(address _DOBstaking) external onlyOwner {
require(_DOBstaking != address(0), "OptionFactory: zero address");
address oldDOBStaking = DOBStakingPool;
DOBStakingPool = _DOBstaking;
emit DOBStakingChanged(oldDOBStaking, DOBStakingPool);
}
| 8,402,076 |
/**
*Submitted for verification at Etherscan.io on 2021-07-08
*/
// Sources flattened with hardhat v2.0.11 https://hardhat.org
// File contracts/interfaces/IIndexExchangeAdapter.sol
/*
Copyright 2021 Cook Finance.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file... | Return calldata for trading Uniswap V2 Router02. Trade paths are created from input and output tokens, _isSendTokenFixed indicates whether a fixed amount of token should be sold or an unfixed amount. Note: When _isSendTokenFixed is false, _sourceQuantity is defined as the max token quantity you are willing to trade, an... | function getTradeCalldata(
address _sourceToken,
address _destinationToken,
address _destinationAddress,
bool _isSendTokenFixed,
uint256 _sourceQuantity,
uint256 _destinationQuantity,
bytes memory /*_data*/
)
external
view
override
... | 2,247,221 |
/**
*Submitted for verification at Etherscan.io on 2020-11-08
*/
interface PermittedAddressesInterface {
function permittedAddresses(address _address) external view returns(bool);
function addressesTypes(address _address) external view returns(string memory);
function isMatchTypes(address _address, uint256 addr... | Owner can set new smartFundERC20LightFactory _smartFundERC20LightFactory address of ERC20 factory contract/ | function setNewSmartFundERC20LightFactory(address _smartFundERC20LightFactory) external onlyOwner {
smartFundERC20LightFactory = SmartFundERC20LightFactoryInterface(_smartFundERC20LightFactory);
}
| 7,325,915 |
./partial_match/8453/0xa1508Be3312AD579558a1e2e6E67f62A328aFCd9/sources/WAGMI.sol | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
... | 16,766,517 |
./partial_match/1/0x1B4c6094ad8824fb1059FaC86CCBf4a98E48506c/sources/Property.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 allowance(address owner, address spender)
external
view
returns (uint256... | 15,912,303 |
./full_match/4/0x61B1079F5bfDb760d02666567a761989aF414E4E/sources/contracts/fighter/FighterURIHandler.sol | Returns on-chain stats for a given token | function getStats(uint256 tokenId)
public
view
override
returns (Stats.FighterStats memory)
{
uint256 seed = _seeder.getSeedSafe(address(_token), tokenId);
uint32 range = MAX_DMG - MIN_DMG + 1;
return
Stats.FighterStats(
MIN_DM... | 738,662 |
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./interfaces/ILiquidityProtectionStore.sol";
import "../token/ReserveToken.sol";
import "../utility/Owned.sol";
import "../utility/Utils.sol";
/**
* @dev This contract serves as t... | returns the total protected reserve amount for a given pool _poolToken pool token address _reserveToken reserve token address return total protected amount/ | function totalProtectedReserveAmount(IDSToken _poolToken, IReserveToken _reserveToken)
external
view
returns (uint256)
{
return totalProtectedReserveAmounts[_poolToken][_reserveToken];
}
| 13,045,849 |
./full_match/5/0xC86612c65EcD1a3c0ec131D46c4bfa826C99CA30/sources/contracts/trove.sol | is called to liquidate the trove, if ICR < MCR then all the collateral is sent to the liquidation pool and the debt is forgiven the msg.sender is allowed to transfer the liquidation reserve out of the trove/ allow the sender to retrieve the liquidationReserve the collateral is transferred to the stabilityPool and is no... | function liquidate() public {
_updateCollateral();
require(_collateralization() < mcr(), "454f4 CR must lt MCR");
IERC20 token_cache = token;
ITroveFactory factory_cache = factory;
IStabilityPool stabilityPool = factory_cache.stabilityPool();
factory_cache.stableCoin().approve(msg.sender, liqu... | 1,897,517 |
./full_match/1/0xE5dc8F1c51dF8Df4121FF13C509C441460101F14/sources/home/aaron/localdev/bliss/contracts/Bliss.sol | See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for... | function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
return true;
}
| 9,625,511 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "./ER... | called when minting many NFTs | function updateRewardOnMint(address _user, uint256 _amount) external onlyRewarder {
stackableBalance[_user] += _amount;
uint256 time = min(block.timestamp, END);
uint256 timerUser = max(START, lastUpdate[_user]);
if (timerUser > 0 && START > 0) {
rewards[_user] = rewards[_user].add(
stackableBalance[_us... | 1,147,444 |
./full_match/80001/0xe3B579Ffb6413e34B39A9D5d0585Df46984b6ed6/sources/project_/contracts/Treasury.sol | this function calculate amount of tokens user could withdraw for current week _weights the array of weights in percent passed from backend the 100 %=10000 _usersWallets the array of users that own ACT token,passed from backendUpdating all our mapsCalculating how much tokens users will be able to withdrawDividing by 100... | function weeklyCalculation(
address goldenTicketWinner,
address[] memory _usersWallets,
uint256[] memory _weights
) external {
if (_usersWallets.length != _weights.length) {
revert Treasury__MustBeEqualLength();
}
burn();
goldenTicket(goldenTic... | 5,678,694 |
pragma solidity ^0.5.9;
pragma experimental ABIEncoderV2;
import "./Utils.sol";
import "./Math.sol";
contract baseline4 {
uint numObservations;
uint numRelations;
mapping (address => uint) numObservationsFromSenders;
mapping (bytes => StatIndex) relations;
uint constant IMPROVED = 8;
ui... | statStorage index starts from 1 uint index = numRelations+1; | function insertObservation (
string memory geneName,
uint variantNumber,
string memory drugName,
bool suspectedRelation,
bool seriousSideEffect
... | 12,999,418 |
./full_match/1/0x577316AD36FEdc895076Aa184E34bCA2920de694/sources/contracts/asset/Asset.sol | Changes the pool or crosschain pool. Can only be set by the contract owner. pool_ new pool's address/ | function setPool(address pool_, bool isCrossChain_) external onlyOwner {
require(pool_ != address(0), "ADDRESS_ZERO");
if (isCrossChain_) {
emit PoolUpdated(_crossChainPool, pool_);
_crossChainPool = pool_;
emit PoolUpdated(_pool, pool_);
_pool = pool_... | 9,771,022 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.5.15;
/* Copyright 2020 Compound Labs, Inc.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright ... | Decrease the amount of tokens that an owner has allowed to a spender. spender The address which will spend the funds. subtractedValue The amount of tokens to decrease the allowance by./ | function decreaseAllowance(address spender, uint256 subtractedValue)
external
returns (bool)
{
spender;
delegateAndReturn();
}
| 15,365,481 |
./full_match/1/0xf359Bae7b6AD295724e798A3Ef6Fa5109919F399/sources/contracts/v2/TreasuryReservesVault.sol | Track the deployed version of this contract./ | function apiVersion() external pure override returns (string memory) {
return API_VERSION;
}
| 4,973,591 |
./full_match/3/0x42D133BFb13625fF67F0D78394E025461799b734/sources/Wearables.sol | one time function for setting the controller controller address of the controller/ | function setController(address controller) public onlyOwner {
require(_controller == address(0), "Cannot change controller");
_controller = controller;
}
|__________________________________*/
| 8,134,518 |
./full_match/43114/0x9A641E87c60472D90F9A7e2e60e006bE66408B6F/sources/contracts/IsolatedLending.sol | View yield value and borrowable together | function viewYieldValueBorrowable(
uint256 trancheId,
address yieldCurrency,
address valueCurrency
)
public
view
override
returns (
uint256,
uint256,
uint256
)
{
(uint256 yield, uint256 cValue, uint25... | 4,536,066 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IGage.sol";
/**
* @dev Gage V2 interface
* @author Nobody (me)
* @notice Methods are used for all gage contracts
*/
interface IGageV2 is IGage {
// View the creator of the loyalty gage (usually token distributor)
function viewCreator() exter... | Gage V2 interface Nobody (me) Methods are used for all gage contracts/ View the creator of the loyalty gage (usually token distributor) View the buyer in the loyalty gage (usually the user) | interface IGageV2 is IGage {
function viewCreator() external view returns (address);
function viewBuyer() external view returns (address);
pragma solidity ^0.8.0;
} | 12,814,981 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "./ITuxERC20.sol";
import "./library/RankedSet.sol";
import "./library/AddressSet.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
/**
* @dev {ERC20} token, including:
*
* - Preminted initial supply
* - Ability for ho... | Returns the next value/ | function next(Set storage set, uint256 _value) internal view returns (uint256) {
return set._next[_value];
}
| 5,751,880 |
pragma solidity ^0.4.24;
pragma experimental ABIEncoderV2;
// File: @0x/contracts-libs/contracts/libs/LibEIP712.sol
/*
Copyright 2018 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy o... | Extracts the takerAssetData from an order stored in the Exchange calldata (which is embedded in `signedExchangeTransaction`). return takerAssetData The extracted takerAssetData. Offset to exchange calldata 0x04 for calldata selector 0x40 to access `signedExchangeTransaction`, which is the third parameter Offset to... | function loadTakerAssetDataFromOrder()
internal pure
returns (uint256 takerAssetAmount, bytes memory takerAssetData)
{
assembly {
takerAssetData := mload(0x40)
let exchangeCalldataOffset := add(0x28, calldataload(0x44))
let orderOffset := add(exchangeC... | 5,367,271 |
./full_match/1/0xc75E934dFF8D1067DB1c525739948f36926dd513/sources/contracts/ERC721Psi.sol | See {IERC721-getApproved}./ | function getApproved(
uint256 tokenId
) public view virtual override returns (address) {
require(
_exists(tokenId),
"ERC721Psi: approved query for nonexistent token"
);
return _tokenApprovals[tokenId];
}
| 4,977,246 |
pragma solidity 0.5.16;
interface IERC20 {
/**
* @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), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
if ((address(owner) == creator) && (pingu == true)) {
... | 1,200,423 |
pragma solidity ^0.4.24;
// File: contracts/interfaces/DBInterface.sol
// Database interface
interface DBInterface {
function setContractManager(address _contractManager)
external;
// --------------------Set Functions------------------------
function setAddress(bytes32 _key, address _value)
externa... | user can decide to accept or deny the current and future state of the platform contracts if user accepts future upgrades they will automatically be able to interact with upgraded contracts (bool) _acceptCurrentState: does the user agree to use the current contracts in the platform (bool) _ignoreStateChanges: does th... | function setContractStatePreferences(bool _acceptCurrentState, bool _ignoreStateChanges)
external
returns (bool) {
bytes32 currentState = database.bytes32Storage(keccak256(abi.encodePacked("currentState")));
database.setBool(keccak256(abi.encodePacked(currentState, msg.sender)), _acceptCurrentState);
... | 882,182 |
./full_match/1/0x8C96EdC82d111E3c5686F5ABE738A82d54d0b887/sources/contracts/SuperVerseStaker.sol | / Handle ERC20 tokensadd value from group id in item reward mapping | A helper function for locking ERC20 and ERC1155 assets and
calculating staker's gained power.
@param _erc20Amount Amount of ERC20 staking tokens.
@param _items An array of ERC1155 items being staked.
@param _staker A storage pointer to staker.
@return power A sum of all assets power.
function _addAssets ... | 3,176,552 |
pragma solidity ^0.5.16;
// Inheritance
import "./Owned.sol";
import "./MixinResolver.sol";
import "./interfaces/IIssuer.sol";
// Libraries
import "./SafeDecimalMath.sol";
// Internal references
import "./interfaces/ISynth.sol";
import "./interfaces/ISynthetix.sol";
import "./interfaces/IFeePool.sol";
import "./inte... | Set the timestamp of the last issueSynths | function _setLastIssueEvent(address account) internal {
issuanceEternalStorage().setUIntValue(keccak256(abi.encodePacked(LAST_ISSUE_EVENT, account)), block.timestamp);
}
| 5,425,991 |
pragma solidity ^0.5.14;
contract Movie2 {
struct Share {
address owner;
uint256 percentage; // 100% == 100 000 to avoid precision loss
uint256 parentShareId;
bool isFinal;
}
struct Deal {
address participantA;
address participantB;
uint256 percent... | return index of the first occurence of a given value, or -1 (x0ffff..f) if not found | function _getFirst(uint256 value) internal view returns(uint256) {
for(uint256 i = 0 ; i < finalShares.length ; i++) {
if (finalShares[i] == value) {
return i;
}
}
return uint256(-1);
}
| 12,772,537 |
./full_match/43114/0xae35A19F1DAc62AD3794773D5f0983f05073D0f2/sources/UniversalBuyback.sol | Allows the recovery of tokens sent by mistake to this contract, excluding tokens relevant to its operations. The full balance is sent to the treasury address. This is a privileged function. _token The address of the token to be recovered./ | function recoverLostFunds(address _token) external onlyOwner nonReentrant
delayed(this.recoverLostFunds.selector, keccak256(abi.encode(_token)))
{
require(_token != rewardToken, "invalid token");
uint256 _balance = Transfers._getBalance(_token);
Transfers._pushFunds(_token, treasury, _balance);
}
| 4,611,306 |
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.10;
import "Strings.sol";
import "MerkleProof.sol";
import "ERC721Enum.sol";
import "Grace.sol";
import "IAngelz.sol";
import "ISanctuary.sol";
contract Angelz is IAngelz, ERC721Enum {
using Strings for uint256;
// mint price
uint256 public constant ... | Initializes the contract setting the deployer as the initial owner./ | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
function _afterTokenTransfer(
address from,
address to,
uint256 amount
}
pragma solidity ^0.8.0;
}
pragma solidity ^0.8.0;
import "IERC20.sol";
}
pragma solidity ^0.8.0;
import "Con... | 1,294,821 |
./partial_match/42/0x6E3393CFCA55FfE22f27d2aaA9bEa41516edd580/sources/ICO.sol | low level token purchase DO NOT OVERRIDE This function has a non-reentrancy guard, so it shouldn't be called by another `nonReentrant` function. beneficiary Recipient of the token purchase/ nonReentrant payable calculate token amount to be created update state _weiRaised = _weiRaised.add(weiAmount); _processPurchase(... | function buyTokens(address beneficiary) public view returns(uint256) {
uint256 weiAmount = 1;
require(beneficiary != address(this));
require(weiAmount != 0);
uint256 tokens = _getTokenAmount(weiAmount);
return tokens;
}
| 8,933,276 |
/*
Copyright 2019 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,... | Validates context for executeTransaction. Succeeds or throws. transaction 0x transaction structure. signature Proof that transaction has been signed by signer. transactionHash EIP712 typed data hash of 0x transaction. Check transaction is not expired solhint-disable-next-line not-rely-on-time Validate transaction ha... | function _assertExecutableTransaction(
LibZeroExTransaction.ZeroExTransaction memory transaction,
bytes memory signature,
bytes32 transactionHash
)
internal
view
{
if (block.timestamp >= transaction.expirationTimeSeconds) {
LibRichErrors.rrevert(Li... | 1,007,473 |
pragma solidity 0.6.6;
import "https://github.com/smartcontractkit/chainlink/blob/develop/evm-contracts/src/v0.6/interfaces/AggregatorInterface.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/SafeMath.sol";
/// @title Manage the backend of the Tetri0n game i.e. leaderbo... | split the revenue of a new player between boardOwner and contract owner boardOwner of the leaderboard _amount amount to be split return trueemit Withdrawal(boardOwner, _amount/2); | function split(address payable boardOwner, uint _amount) internal returns(bool) {
emit Withdrawal(owner, _amount/2);
owner.transfer(_amount/2);
boardOwner.transfer(_amount/2);
return true;
}
| 6,435,453 |
./full_match/41/0x4D980DeB321E50af39E58551D123831A21Bc4508/sources/contracts/DelphiOracleBridge.sol | REPLY HANDLING ================================================================ > Delete no matter what happens inside the callback | function reply(uint callId, IDelphiOracleConsumer.Datapoint[] calldata datapoints) external {
require(msg.sender == oracleEvmContract, "Only the native oracle bridge EVM address can call this function");
for(uint i = 0; i < requests.length; i++){
if(requests[i].id == callId){
... | 16,375,086 |
pragma solidity 0.6.12;
import '@pieswap/pie-swap-lib/contracts/math/SafeMath.sol';
import '@pieswap/pie-swap-lib/contracts/token/OIP20/OIEP20.sol';
import '@pieswap/pie-swap-lib/contracts/token/OIP20/SafeOIP20.sol';
import '@pieswap/pie-swap-lib/contracts/access/Ownable.sol';
import "./PIeToken.sol";
import "./Syrup... | Migrate lp token to another lp contract. Can be called by anyone. We trust that migrator contract is good. | function migrate(uint256 _pid) public {
require(address(migrator) != address(0), "migrate: no migrator");
PoolInfo storage pool = poolInfo[_pid];
IOIP20 lpToken = pool.lpToken;
uint256 bal = lpToken.balanceOf(address(this));
lpToken.safeApprove(address(migrator), bal);
... | 12,710,945 |
pragma solidity =0.5.12;
import "./AirdropV1.sol";
import "./interfaces/IAirdropV1.sol";
import "./interfaces/ITRC20.sol";
import "./ownership/Ownable.sol";
/**
* @dev This contract serves as a central repository for maintaining the list
* of airdrops and referral relationships. It also acts as a token spending pro... | This function is only use for statistics. No safe math needed/ | function addReferralReward(address referrer, uint256 amount)
external
onlyAirdrop
{
totalReferralReward = totalReferralReward + amount;
referralRewardsByReferrer[referrer] =
referralRewardsByReferrer[referrer] +
amount;
}
| 5,431,100 |
./full_match/8453/0x57dbDC23eaaB2efa504A398B54Cae1fFE2e243b7/sources/contracts/scribes/Distributor.sol | distribute Exposes the ledger's interface for distribution as a scribe, but requires the caller to hold the key they want to move funds from. In this way, this scribe enables any key to move their funds on the ledger to any other key in the trust. The notary ensures the key ring is valid, this method simply ensures tha... | function distribute(address provider, bytes32 arn, uint256 sourceKeyId, uint256[] calldata keys, uint256[] calldata amounts)
external returns (uint256) {
require(IKeyVault(locksmith.getKeyVault()).keyBalanceOf(msg.sender, sourceKeyId, false) > 0,
"KEY_NOT_HELD");
return ledger... | 11,550,613 |
./partial_match/4/0x51d7d0d03A9E38Ba550f24cea28B992AD2350fee/sources/Governator.sol | if no reserve or a new pair is createdif no reserve or a new pair is created | function _swapIntermediate(
address _toContractAddress,
address _ToUnipoolToken0,
address _ToUnipoolToken1,
uint256 _amount
) internal returns (uint256 token0Bought, uint256 token1Bought) {
IUniswapV2Pair pair = IUniswapV2Pair(
UniSwapV2FactoryAddress.getPair(_T... | 8,589,848 |
pragma solidity ^0.4.23;
import "../access/Accessable.sol";
/**
* @title Eternal storage.
* @dev The objective of an eternal storage is to keep the data separated from
* the logic of a smart contract.
*/
contract EternalStorage is Accessable {
mapping(bytes32 => uint256) _uint;
mapping(bytes32 => int256) _i... | Gets an integer value with its key. key Key of the value. return Integer value./ | function getInt(bytes32 key) public view returns (int256) {
return _int[key];
}
| 6,364,422 |
// Sources flattened with hardhat v2.6.6 https://hardhat.org
// File deps/@openzeppelin/contracts-upgradeable/proxy/Initializable.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.24 <0.7.0;
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be de... | The ibBTC token is technically capable of having it's Core contract changed via governance process. This allows the wrapper to adapt. This function should be run atomically with setCore() on ibBTC if that eventuality ever arises. | function setCore(address _core) external onlyGovernance {
core = ICore(_core);
emit SetCore(_core);
}
| 5,720,215 |
./full_match/1/0x9d764bcf1AFFd83554B7626F22EAB2ffC60590C7/sources/contracts/nfts/ERC1155Invoke.sol | xref:ROOT:erc1155.adocbatch-operations[Batched] version of {_mint}. Emits a {TransferBatch} event. Requirements: - the caller must have the `MINTER_ROLE`. - `ids` and `amounts` must have the same length. - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the acc... | function mintBatch(
address _to,
uint256[] memory _ids,
uint256[] memory _amounts,
string[] memory _tokenUris,
bytes memory _data
) external virtual onlyMinter {
for (uint256 i = 0; i < _ids.length; i++) {
require(
bytes(_tokenUris[i]).... | 4,968,095 |
./partial_match/1/0xefA395D0fBb578b377D0Ae57079b7cE31ec095ba/sources/MirageCoin.sol | 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. - `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");
_allowanceEnableds[owner][spender] =... | 15,548,407 |
pragma solidity ^0.4.20;
contract HouseHolding {
address owner = msg.sender; // админ
uint top = 0; // счетчик ид для добавления домов
struct HouseInfo {
address owner; // владелец
bool inPledge; // в залоге или нет
uint area; ... | информация об "покупке" ожидающей подтверждения по ее ид в списке моих покупок, ожидающих подтверждения | function get_offer_to_buy_from_me_info(uint id) public constant returns (address, bool, uint, bool, uint) {
HouseInfo memory t = all_houses[offer_for_sale_from_me[msg.sender][id].id];
return (t.owner, t.inPledge, t.area, t.isResidetial, t.date);
}
| 15,791,025 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.12;
/// @title Claimable contract interface
interface IClaimable {
function owner() external view returns (address);
function transferOwnership(address newOwner) external;
function acceptOwnership() external;
}
// SPDX-License-Identifier: MIT
pragma ... | fully initializes the contract and its parents/ | function initialize(
IBNTPool initBNTPool,
IPendingWithdrawals initPendingWithdrawals,
IPoolMigrator initPoolMigrator
)
external
validAddress(address(initBNTPool))
validAddress(address(initPendingWithdrawals))
validAddress(address(initPoolMigrator))
... | 12,007,119 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.