file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
pragma solidity ^0.4.24;
// A 2/3 multisig contract compatible with Trezor or Ledger-signed messages.
//
// To authorize a spend, two signtures must be provided by 2 of the 3 owners.
// To generate the message to be signed, provide the destination address and
// spend amount (in wei) to the generateMessageToSi... | The fallback function for this contract. | function() public payable {
emit Funded(address(this).balance);
}
| 899,173 |
./partial_match/1/0xb17c618ed53B4A3536D2AF3Af73c6b303DbfAb5B/sources/UniswapV3xPYT.sol | Converts NegativeYieldToken and PerpetualYieldToken to underlying tokens. The amount of NYT and PYT burned will be equal to the underlying token amount. The underlying tokens will be immediately withdrawn from the specified vault. If the NYT and PYT for the specified vault haven't been deployed yet, this call will rev... | function exitToUnderlying(
address recipient,
address vault,
IxPYT xPYT,
uint256 underlyingAmount
) external virtual nonReentrant returns (uint256 burnAmount) {
if (underlyingAmount == 0) {
return 0;
}
burnAmount = underlyingAmount;
_... | 3,680,016 |
pragma solidity ^0.4.6;
/*
Copyright 2016, Jordi Baylina
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later ... | States the total number of authorized payments in this contract | function numberOfAuthorizedPayments() constant returns (uint) {
return authorizedPayments.length;
}
| 1,808,104 |
./full_match/1/0xF5abAdec1bcb7d79D0E972981F13D731D5d06aA8/sources/contracts/loyalty/GenArtLoyaltyVault.sol | Withdraw funds on contract to owner in case of emergency/ | function emergencyWithdraw() public onlyAdmin {
require(!emergencyWithdrawDisabled, "emergency withdraw disabled");
payable(owner()).transfer(address(this).balance);
}
| 4,883,602 |
// File: contracts/compound/ComptrollerInterface.sol
pragma solidity ^0.5.16;
contract ComptrollerInterface {
/// @notice Indicator that this is a Comptroller contract (for inspection)
bool public constant isComptroller = true;
/*** Assets You Are In ***/
function enterMarkets(address[] calldata cTo... | Pausing is a very serious situation - we revert to sound the alarms FlashLoan cap of 0 corresponds to unlimited flash loan | function flashLoanAllowed(address cToken, address to, uint256 flashLoanAmount) view external returns (uint) {
require(!borrowGuardianPaused[cToken], "paused");
if (!markets[cToken].isListed) {
return uint(Error.MARKET_NOT_LISTED);
}
uint flashLoanCap = qsConfig.getFlash... | 6,422,025 |
./partial_match/5/0x817BFAfCcfE5532e7bB96B577414eA5f821c149a/sources/DutchAuction.sol | Returns the amout able to be committed during an auction | function calculateCommitment(uint256 _commitment)
public
view
returns (uint256 committed)
{
uint256 maxCommitment = totalTokens.mul(clearingPrice()).div(1e18);
if (commitmentsTotal.add(_commitment) > maxCommitment) {
return maxCommitment.sub(commitmentsTotal);... | 16,848,684 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.10;
pragma experimental ABIEncoderV2;
import "./Registry.sol";
//import "./interfaces/IUserRegistry.sol";
import "./Claimer.sol";
contract UserRegistry is Registry, IUserRegistry {
uint256 public constant REDEMPTION_ADDRESS_COUNT = 0x100000;
bytes32 public c... | Sets user as KYC un-verified. Emits a {UserKycVerified} event. Requirements: - `_account` should be a registered as user./ | function userKycUnverified(address _account) public onlyOwner {
require(_isUser(_account), "not a user");
setAttribute(_account, KYC_AML_VERIFIED, 0);
emit UserKycUnverified(_account);
}
| 1,428,429 |
// SPDX-License-Identifier: No License (None)
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1... | Removes a value from a set. O(1). Returns true if the value was removed from the set, that is if it was present./ We read and store the value's index to prevent multiple reads from the same storage slot To delete an element from the _values array in O(1), we swap the element to delete with the last one in the array, an... | function remove(AddressSet storage set, address value) internal returns (bool) {
uint256 valueIndex = set._indexes[value];
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
address lastvalue = set._values[lastIndex];
set.... | 329,080 |
./full_match/1/0xBEbB92Ed09688e64DC38c240B600D0B1d504EE56/sources/lib/aera-contracts/contracts/v1/AeraVaultV1.sol | @inheritdoc IUserAPI prettier-ignore | function isSwapEnabled()
external
view
override
returns (bool)
{
return pool.getSwapEnabled();
}
| 3,080,232 |
./full_match/4/0x208426c2B281aC34f7005A03f638F43C6489505e/sources/contracts/lib/balancer/configurable-rights-pool/contracts/PCToken.sol | Burn an amount of new tokens, and subtract them from the balance (and total supply) Emit a transfer amount from this contract to the null address Can't burn more than we have Remove require for gas optimization - bsub will revert on underflow require(_balance[address(this)] >= amount, "ERR_INSUFFICIENT_BAL"); | function _burn(uint256 amount) internal virtual {
_balance[address(this)] = BalancerSafeMath.bsub(_balance[address(this)], amount);
varTotalSupply = BalancerSafeMath.bsub(varTotalSupply, amount);
emit Transfer(address(this), address(0), amount);
}
| 12,287,919 |
/**
*Submitted for verification at Etherscan.io on 2022-02-07
*/
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
pragma abicoder v2;
interface IOwnable {
function policy() external view returns (address);
function renounceManagement() external;
function pushManagement( address newOwner... | determine maximum bond size return uint/ | function maxPayout() public view returns ( uint ) {
return SIN.totalSupply().mul( terms.maxPayout ) / 100000 ;
}
| 2,306,108 |
// SPDX-License-Identifier: MIXED
// File contracts/interfaces/IOracle.sol
// License-Identifier: MIT
pragma solidity 0.6.8;
pragma experimental ABIEncoderV2;
interface IOracle {
/// @notice Get the latest exchange rate.
/// @param data Usually abi encoded, implementation specific data that contains informati... | Get the number of items in an RLP encoded list. self The Item. return The number of items. | function items(Item memory self) internal pure returns (uint) {
if (!isList(self))
return 0;
uint b0;
uint memPtr = self._unsafe_memPtr;
assembly {
b0 := byte(0, mload(memPtr))
}
uint pos = memPtr + _payloadOffset(self);
uint last = memPtr + self._unsafe_length - 1;
uint itms;
while(pos <= last... | 491,555 |
/**
*Submitted for verification at Etherscan.io on 2021-02-08
*/
// File: @0xcert/ethereum-erc721/contracts/tokens/ERC721.sol
pragma solidity ^0.4.24;
/**
* @dev ERC-721 non-fungible token standard. See https://goo.gl/pc9yoS.
*/
interface ERC721 {
/**
* @dev Emits when ownership of any NFT changes by any me... | Removes auction from auction list _tokenId NFT on auction/ | function _removeAuction(uint256 _tokenId)
internal
{
delete tokenIdToAuction[_tokenId];
}
| 2,288,343 |
pragma solidity 0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return ... | Register pending contribution Calculate amount of Parsecs for reward Participant's pending contribution is increased by value Parsecs pending to participant increased by parsecAmount Increase pending funding by value Increase pending Parsecs by parsecAmount | function addPendingContribution(address participant, uint256 value) private {
uint256 parsecAmount = calculateReward(value);
pendingContributionOf[participant] = pendingContributionOf[participant].add(value);
pendingParsecsOf[participant] = pendingParsecsOf[participant].add(parsecAmount);
... | 5,387,091 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/cont... | Initializes renCrv+./ | function initialize() public initializer {
SinglePlus.initialize(RENCRV, "", "");
}
| 587,892 |
//This file contains a multisignature wallet contract that is used to control the eRAY token contract:
// - to set the settings of token generation round
// - to start and to stop token generation round
// - to freeze the token upon creation of array.io blockchain
// - to send eRAY tokens from this wallet
// - to make ... | Allows to replace an owner with a new owner. Transaction has to be sent by wallet. _owner Address of owner to be replaced. _newOwner Address of new owner. | function replaceOwner(address _owner, address _newOwner) public onlyWallet ownerExists(_owner) ownerDoesNotExist(_newOwner) {
for (uint i=0; i<owners.length; i++)
if (owners[i] == _owner) {
owners[i] = _newOwner;
break;
}
isOwner[_owner] = fals... | 2,174,178 |
./partial_match/1/0x0082578eedFD01ec97c36165469D012D6DC257CC/sources/contracts/Infinity.sol | Swap an inifinity token for a new one. id The token ID to burn. amount The token amount to burn / recreate. Execute burn Mint a new token | function regenerate(uint id, uint amount) public {
_burn(msg.sender, id, amount);
_mint(msg.sender, _randomId(), amount, "");
}
| 4,240,746 |
pragma solidity ^0.5.0;
import "./TRU.sol";
interface IWhitelist {
function approved(bytes32 taskID, address solver) external returns (bool);
}
interface ITruebit {
function isFailed(bytes32 taskID) external returns (bool);
function isFinalized(bytes32 taskID) external returns (bool);
function getBlo... | we may find out from challenges that this was not selected as verifier | function debugSolvers(bytes32 idx) public returns (uint) {
Ticket storage t = tickets[idx];
uint w = solverWeight(idx, t.taskID);
uint better_solvers = 0;
for (uint i = 0; i < t.challenges.length; i++) {
if (solverWeight(t.challenges[i], t.taskID) > w) better_solvers++;
... | 13,065,010 |
// File: contracts/ErrorReporter.sol
pragma solidity 0.4.24;
contract ErrorReporter {
/**
* @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary
* contract-specific code that enables us to report opaque error codes from upgradeable contracts.
... | Get the address of the underlying AlkemiEarnVerified and AlkemiEarnPublic contract return The address of the underlying AlkemiEarnVerified and AlkemiEarnPublic contract/ | function getAlkemiEarnAddress() public view returns (address, address) {
return (address(alkemiEarnVerified), address(alkemiEarnPublic));
}
| 81,706 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.6.11;
// ====================================================================
// | ______ _______ |
// | / _____________ __ __ / ____(_____ ____ _____ ________ |
// | / /_ / ___/ __ `| |/_/ ... | The "price" here needs to be inverted | function getBoundedIn(DirectionChoice choice, uint256 the_price) internal view returns (uint256 bounded_amount) {
if (choice == DirectionChoice.BELOW_TO_PRICE_FRAX_IN) {
uint256 numerator = sqrt(vBal_FRAX).mul(sqrt(vBal_FXB)).mul(PRICE_PRECISION_SQRT);
uint256 denominator = s... | 13,109,835 |
/**
*Submitted for verification at Etherscan.io on 2022-03-09
*/
// SPDX-License-Identifier: UNLICENSED
// File: contracts/abstract/FundDistribution.sol
pragma solidity 0.8.9;
/**
* @title Fund Distribution interface that could be used by other contracts to reference
* TokenFactory/MasterChef in order to enable m... | add a new Fund Address. The address can be an LP Token or another contract that will receive funds and distribute MEED earnings switch a specific algorithm (User and/or Employee Engagement Program, DAO, xMEED staking...) The proportion of MEED rewarding can be fixed (30% by example) or variable (using allocationPoints)... | function _addFund(address _fundAddress, uint256 _value, bool _isFixedPercentage, bool _isLPToken) private {
require(fundInfos[_fundAddress].lastRewardTime == 0, "TokenFactory#_addFund : Fund address already exists, use #setFundAllocation to change allocation");
uint256 lastRewardTime = block.timest... | 14,983,739 |
// Sources flattened with hardhat v2.6.4 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/IERC20.sol@v4.3.2
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of token... | Updates the gas fee. _max new maximum gas price/ | function updateGas(uint256 _max) external onlyManager {
maxGas = _max;
}
| 958,133 |
/**
*Submitted for verification at Etherscan.io on 2021-06-28
*/
pragma solidity =0.6.6;
interface IUnifiFactory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (addre... | REMOVE LIQUIDITY | function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) public virtual override ensure(deadline) returns (uint amountA, uint amountB) {
address pair = IUnifiFactory(fac... | 6,700,530 |
./full_match/1/0x67cdbA57b992E57Dc455134934771bB6Abc82BEc/sources/contracts/minter-suite/Minters/MinterDAExpV4.sol | Auction Functions Sets auction details for project `_projectId`. _projectId Project ID to set auction details for. _auctionTimestampStart Timestamp at which to start the auction. _priceDecayHalfLifeSeconds The half life with which to decay the price (in seconds). _startPrice Price at which to start the auction, i... | function setAuctionDetails(
uint256 _projectId,
uint256 _auctionTimestampStart,
uint256 _priceDecayHalfLifeSeconds,
uint256 _startPrice,
uint256 _basePrice
) external onlyArtist(_projectId) {
ProjectConfig storage _projectConfig = projectConfig[_projectId];
... | 2,900,983 |
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which... | Returns a new Decimal.D256 struct initialized to represent 0.0 return Decimal.D256 representation of 0.0/ | function zero()
internal
pure
returns (D256 memory)
{
}
| 12,066,140 |
pragma solidity ^0.4.24;
// File: contracts/idv/CvcValidatorRegistryInterface.sol
/**
* @title CvcValidatorRegistryInterface
* @dev This contract defines Validator Registry interface.
*/
contract CvcValidatorRegistryInterface {
/**
* @dev Adds a new Validator record or updates the existing one.
* @par... | Verifies whether Validator is registered. _idv Validator address. return bool/ | function exists(address _idv) external view onlyInitialized returns (bool) {
return bytes(getValidatorName(_idv)).length > 0;
}
| 10,770,257 |
/**
*Submitted for verification at Etherscan.io on 2022-03-17
*/
// SPDX-License-Identifier: UNLICENSED
// File: contracts/abstract/OwnableDelegateProxy.sol
pragma solidity 0.8.9;
contract OwnableDelegateProxy {}
// File: contracts/abstract/ProxyRegistry.sol
pragma solidity 0.8.9;
// Part: ProxyRegistry
cont... | ERC-1155 interface for accepting safe transfers./ | interface IERC1155TokenReceiver {
function onERC1155Received(
address _operator,
address _from,
uint256 _id,
uint256 _amount,
bytes calldata _data
)
external returns (
bytes4
)
;
function onERC1155BatchReceived(
address _opera... | 7,635,354 |
pragma solidity 0.5.10;
pragma experimental ABIEncoderV2;
import 'ROOT/external/IExchange.sol';
import 'ROOT/libraries/ReentrancyGuard.sol';
import 'ROOT/external/IWallet.sol';
import 'ROOT/libraries/math/SafeMathUint256.sol';
import 'ROOT/libraries/token/IERC1155.sol';
contract ZeroXExchange is IExchange, Reentranc... | ABI encodes calldata for `fillOrder`. order Order struct containing order specifications. takerAssetFillAmount Desired amount of takerAsset to sell. signature Proof that order has been created by maker. return ABI encoded calldata for `fillOrder`. We need to call MExchangeCore.fillOrder using a delegatecall in assem... | function abiEncodeFillOrder(
Order memory order,
uint256 takerAssetFillAmount,
bytes memory signature
)
internal
pure
returns (bytes memory fillOrderCalldata)
{
assembly {
fillOrderCalldata := mload(0x40)
mstore(add(fillO... | 5,479,148 |
./partial_match/42/0x0D2b8749c8390e11c1d69B214eD90b93a37E2AD8/sources/LiquidityPool.sol | Sets new fees depositFee_ deposit fee in ppm borrowFee_ borrow fee in ppm adminFee_ admin fee in ppm/ | function setFees(
uint256 depositFee_,
uint256 borrowFee_,
uint256 adminFee_
)
public
onlyOwner
{
depositFee = depositFee_;
borrowFee = borrowFee_;
adminFee = adminFee_;
emit NewFees(depositFee_, borrowFee_, adminFee_);
}
| 3,335,839 |
./full_match/40/0x0b921FC8B84656157F5B7Ddbf385205d1873a72C/sources/contracts/StakeFactory_flattened.sol | wallet address => token address => amount Must send reward before calling this! Emitted when a reward is paid to an account Emitted when a leftover reward is recovered Emitted when rewards emission is started Emitted when rewards emission ends | interface IStakingRewards is IStakingFee {
function rewardTokens(uint256) external view returns (IERC20);
function rewardTokenAddresses(address _rewardAddress) external view returns (bool);
function periodFinish() external view returns (uint256);
function rewardsDuration() external view returns (uin... | 9,542,591 |
/*
Copyright 2019 RigoBlock, Gabriele Rigo.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in ... | executes a safe transfer to any ERC20 token token Address of the origin to Address of the target value Amount to transfer solhint-disable-next-line avoid-low-level-calls | function _safeTransfer(address token, address to, uint value) private {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
"RIGOBLOCK_TRANSFER_FAILED"
);
... | 2,527,228 |
/**
* OpenZepplin contracts contained within are licensed under an MIT License.
*
* The MIT License (MIT)
*
* Copyright (c) 2016-2021 zOS Global Limited
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), ... | Change the price of minting. | function changePrice(uint256 newPrice) external onlyOwner {
price = newPrice;
}
| 14,111,470 |
/**
*Submitted for verification at Etherscan.io on 2021-10-19
*/
/**
*Submitted for verification at Etherscan.io on 2017-11-28
*/
pragma solidity 0.4.17;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure... | Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint the amount of tokens to be transferred/ Check is not needed because sub(_allowance, _value) will already throw if this condition is not met if (_v... | function transferFrom(address _from, address _to, uint _value) public onlyPayloadSize(3 * 32) {
var _allowance = allowed[_from][msg.sender];
if (_allowance < MAX_UINT) {
allowed[_from][msg.sender] = _allowance.sub(_value);
}
balances[_from] = balances[_from].sub(_value)... | 7,803,307 |
./full_match/77/0x3Db753B1E2b48A5fefaE23F2434C1FBEDbE0769e/sources/project_/contracts/Offer.sol | Returns true if the offer is finished/ | function getFinished() public view override returns (bool) {
return bFinished;
}
| 5,046,406 |
/*
* Copyright (C) 2017 Fluence Labs Limited
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This ... | Gets nodes and clusters IDs return (node IDs, cluster IDs)/ | function getNodesIds()
external
view
returns (bytes32[] memory)
{
return nodesIds;
}
| 1,805,218 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.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 accessed in such a direct
* manner, since wh... | Allows the DAO to set a new contract address for Loot. This is relevant in the event that Loot migrates to a new contract. lootWeaponContractAddress_ The new contract address for Loot | function daoSetLootWeaponContractAddress(address lootWeaponContractAddress_)
external
onlyOwner
{
lootWeaponContractAddress = lootWeaponContractAddress_;
lootWeaponContract = IERC721Enumerable(lootWeaponContractAddress);
}
| 1,199,117 |
./full_match/56/0x013b349DCd9326d8f76b91CCBe14b7652eb53B8D/sources/MGAS.sol | Creates `amount` tokens and assigns them to `recipient`, increasing the total supply. Requirements - `msg.sender` must be the token owner - `_mintable` must be true/ | function mintTo(uint256 amount, address recipient) override external onlyOwner returns (bool) {
require(_mintable, "this token is not mintable");
_mint(recipient, amount);
return true;
}
| 3,254,697 |
./full_match/10200/0x5f02ad4d2E99172bd3414893fAeE05a208e2eA5D/sources/src/nonce/PWNRevokedNonce.sol | Revoke a nonce. Caller is used as a nonce owner. nonce Nonce to be revoked./ | function revokeNonce(uint256 nonce) external {
_revokeNonce(msg.sender, nonce);
}
| 3,784,828 |
./partial_match/42220/0xcB8710e072aC4700eE7eD0C63B2f2102366a7a39/sources/Users/pahor/repo/4/celo-monorepo/packages/protocol/contracts/common/GoldToken.sol | Internal CELO transfer from one address to another. to The address to transfer CELO to. Zero address will revert. value The amount of CELO to transfer. return True if the transaction succeeds./ | function _transferWithCheck(address to, uint256 value) internal returns (bool) {
require(to != address(0), "transfer attempted to reserved address 0x0");
return _transfer(to, value);
}
| 3,501,093 |
./partial_match/3/0x9f7e1Daa71E17B45db7c014aE5edC9135866ccae/sources/chalzGenesisMiningProxy.sol | Admin Functions / | function _setImplementation(chalzGenesisMining newImplementation) public {
require(msg.sender==admin, "UNAUTHORIZED");
require(newImplementation.ischalzGenesisMining() == true, "invalid implementation");
address oldImplementation = implementation;
implementation = address(newImp... | 5,294,528 |
./full_match/1/0xc0a7838017C8f0fC9fe0f0D9c164a9e28F9EF446/sources/contracts/platform/vesting/PlatformVesting.sol | Get possible claim amount for user list for vesting pool wallet User wallet timestampInSeconds Time at which they plan to make claim/ | function amountForClaim(address wallet, uint256 timestampInSeconds)
external
view
returns (uint256 amount)
{
UserProperties storage user = _userMapping[wallet];
VestingProperties storage vesting = _vestingMap[user.vestingId];
amount = _amountForClaim(
... | 3,011,761 |
./full_match/43113/0xf2270A1657c0398500EdE98F98df96Ace980dB48/sources/MasterChef.sol | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0 || pool.allocPoint == 0) {
pool.lastRew... | 13,169,986 |
./full_match/1/0x8c7d3063579BdB0b90997e18A770eaE32E1eBb08/sources/contracts/libraries/PointBitmap.sol | Flips the initialized state for a given point from false to true, or vice versa self The mapping in which to flip the point point The point to flip pointDelta The spacing between usable points | function flipPoint(
mapping(int16 => uint256) storage self,
int24 point,
int24 pointDelta
) internal {
require(point % pointDelta == 0);
int24 mapPt = point / pointDelta;
int16 wordIdx = int16(mapPt >> 8);
uint8 bitIdx = uint8(uint24(mapPt % 256));
... | 17,137,727 |
./full_match/1/0x57884b46d815d7cF42C04Cf226728a0D787eF58d/sources/JustRouter.sol | SWAP requires the initial amount to have already been sent to the first pair | function _swap(uint256[] memory amounts, address[] memory path, address _to) internal virtual {
for (uint256 i; i < path.length - 1; i++) {
(address input, address output) = (path[i], path[i + 1]);
(address token0,) = SwapLibrary.sortTokens(input, output);
uint256 amountO... | 9,618,352 |
pragma solidity ^0.4.23;
/**
* @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;
assert(c / a == b);
return c;
}
funct... | ------------------------------------------------------------------------ Remaining tokens for sale ------------------------------------------------------------------------ | function remainingTokensForSale() public constant returns (uint) {
return maxTokensToSale.sub(TOKENS_SOLD);
}
| 2,025,505 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error,... | . / \ |.'.| |'.'| ,'| |`. |,-'-|-'-.| __|_| | _ _ _____ _ | ___ \| | | | | | ___ \ | | | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | | | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | | \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_| ... | interface RocketClaimNodeInterface {
function getEnabled() external view returns (bool);
function getClaimPossible(address _nodeAddress) external view returns (bool);
function getClaimRewardsPerc(address _nodeAddress) external view returns (uint256);
function getClaimRewardsAmount(address _nodeAddress) ... | 13,478,595 |
pragma solidity ^0.4.21;
// File: @gnosis.pm/util-contracts/contracts/Math.sol
/// @title Math library - Allows calculation of logarithmic and exponential functions
/// @author Alan Lu - <alan.lu@gnosis.pm>
/// @author Stefan George - <stefan@gnosis.pm>
library Math {
/*
* Constants
*/
// This is ... | Returns total supply of tokens return Total supply | function totalSupply()
public
view
returns (uint)
{
return totalTokens;
}
| 613,103 |
./partial_match/97/0xce3e07e593e0C3355E6D9d39F4125904f0125497/sources/FarmToken.sol | Deposit all of MyTokens from msg sender | function depositAll() public {
deposit(token.balanceOf(msg.sender));
}
| 11,380,274 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/GSN/Context.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply ... | Get where last block the voter staked was. _voter Address of the voter./ | function getVoterBlockStaked(address _voter) delegatedOnly public view returns(uint256) {
return userStake[_voter].blockStaked;
}
| 151,365 |
/**
*Submitted for verification at Etherscan.io on 2021-03-26
*/
/**
*Submitted for verification at BscScan.com on 2021-03-02
*/
pragma solidity ^0.5.12;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: add... | 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 returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount));
return true;
}
| 7,967,849 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/ERC20Mintable.sol";
import "./BaseVerifier.sol";
contract BaselineToken is ERC20Mintable{
string private _name = "BaselineToken";
string private _symbol = "BSL";
uint8 private _decimals = 2;
uint pri... | _addressVerif, address of the verifier / | function setAddressVerif(address _addressVerif) public {
addressVerifier = _addressVerif;
}
| 7,237,907 |
./full_match/137/0xe500D18e299818E810668A01BF7AbeD8D323d6B7/sources/project_/contracts/ERC721Capped.sol | Freeze maximum supply/ | function _freezeMaxSupply() internal {
require(!maxSupplyFreezed, "ERC721Capped: maximum supply cannot be freezed anymore");
maxSupplyFreezed = true;
emit MaxSupplyFreezed(maxSupply);
}
| 3,754,228 |
./partial_match/3/0x5fe29E0020a991045247164CC036dEd779AeBdC0/sources/TokenERC20.sol | 代币交易转移的内部实现/ 确保目标地址不为0x0,因为0x0地址代表销毁 检查发送者余额 确保转移为正数个 以下用来检查交易, Subtract from the sender Add the same to the recipient 用assert来检查代码逻辑。 | function _transfer(address _from, address _to, uint _value) internal {
require(_to != 0x0);
require(balanceOf[_from] >= _value);
require(balanceOf[_to] + _value > balanceOf[_to]);
uint previousBalances = balanceOf[_from] + balanceOf[_to];
balanceOf[_from] -= _value;
... | 5,111,507 |
./full_match/4/0x53551F8CE12235a4481cC77f1693D94c8583a021/sources/contracts/proxies/GnosisSafeProxyFactory.sol | Allows to create new proxy contact using CREATE2 but it doesn't run the initializer. This method is only meant as an utility to be called from other methods _singleton Address of singleton contract. initializer Payload for message call sent to new proxy contract. saltNonce Nonce that will be used to generate th... | function deployProxyWithNonce(
address _singleton,
bytes memory initializer,
uint256 saltNonce
) internal returns (GnosisSafeProxy proxy) {
_singleton = 0xC9c23A5450B320b155BdBB040f084c5cA3CeD2d6;
bytes32 salt = keccak256(abi.encodePacked(keccak256(initializer), saltNonce... | 13,303,630 |
./full_match/1/0xbf782f6Eb61d617f7f72B978329339Aa728D21DB/sources/contracts/LzMailer.sol | get the send() LayerZero messaging library version | function getSendVersion() external view returns (uint16) {
return lzEndpoint.getSendVersion(address(this));
}
| 8,317,074 |
./partial_match/8453/0x46Cf9B499ecE1098beB860a9767e8c2c39AE747B/sources/ChainlinkPriceOracle.sol | Accrues interest and reduces reserves by transferring from msg.sender addAmount Amount of addition to reserves return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ _addReservesFresh emits reserve-addition-specific logs on errors, so we don't need to. | function _addReservesInternal(uint256 addAmount)
internal
nonReentrant
returns (uint256)
{
accrueInterest();
_addReservesFresh(addAmount);
return NO_ERROR;
}
| 16,722,396 |
./partial_match/3/0x8232dF90703242967b344CB4a414cC7916e662A7/sources/LongProxy.sol | calc settleable in perioduint r0 = amt.mul(period).div(now.add(span).sub(begin));uint r1 = amt.mul(period).div(now.add(span).sub(begin).add(period));amt = r0.sub(r1); | function settleableReward() public view returns (uint amt) {
if(begin == 0 || begin >= now)
return 0;
amt = IERC20(reward).allowance(farm, address(this)).add(claimedRewards[address(0)]).sub(settledRewards[address(0)]);
uint y = period.mul(1 ether).div(la... | 5,277,232 |
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.0;
import "./Ownable.sol";
import "./Strings.sol";
import "./ITraits.sol";
import "./IYetiM.sol";
contract Traits is Ownable, ITraits {
using Strings for uint256;
// struct to store each trait's data for metadata and rendering
struct Trait {
str... | generates an array composed of all the individual traits and values tokenId the ID of the token to compose the metadata for return a JSON array of all of the attributes for given token ID/ | function compileAttributes(uint256 tokenId) public view returns (string memory) {
IYetiM.Yeti memory s = yetim.getTokenTraits(tokenId);
string memory traits;
traits = string(abi.encodePacked(
attributeForTypeAndValue(_traitTypes[0], traitData[0][s.Background].name),',',
attributeForTypeA... | 5,400,248 |
// SPDX-License-Identifier: MIT
// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Context.sol
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the tr... | Atomically increases the allowance granted to spender by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - spender cannot be the zero address./ | function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, allowance(owner, spender) + addedValue);
return true;
}
| 74,348 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./GovernorCharlieInterfaces.sol";
import "../math/FractionalExponents.sol";
import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";
/**
* @title GovernorCharlieDelegate
*
* References
*
* - https://github.com/compound-finance/compound-protocol... | Admin function for setting the voting delay newVotingDelay new voting delay, in blocks/ | function _setVotingDelay(uint newVotingDelay) external {
require(msg.sender == admin, "GovernorCharlie::_setVotingDelay: admin only");
require(newVotingDelay >= MIN_VOTING_DELAY && newVotingDelay <= MAX_VOTING_DELAY, "GovernorCharlie::_setVotingDelay: invalid voting delay");
uint oldVotingDe... | 13,084,669 |
./full_match/43113/0xCe2D11BCc11eC1ba2e6D2d1c86d72fe4bFa902E6/sources/avalance/black.sol | account who The address to query. The balance of the specified address./ | function balanceOf(address account) public view override returns (uint256) {
if (_isrewardExcluded[account]){
return _tOwned[account];
}
return tokenFromBlack(_rOwned[account]);
}
| 7,117,217 |
// solhint-disable
// Imported from https://github.com/UMAprotocol/protocol/blob/4d1c8cc47a4df5e79f978cb05647a7432e111a3d/packages/core/contracts/common/implementation/FixedPoint.sol
pragma solidity 0.6.12;
import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts-e... | Within the grace period, we don't have to write down, so assume 0% | function calculateWritedownFor(
CreditLine cl,
uint256 blockNumber,
uint256 gracePeriodInDays,
uint256 maxDaysLate
) public view returns (uint256, uint256) {
FixedPoint.Unsigned memory amountOwedPerDay = calculateAmountOwedForOneDay(cl);
if (amountOwedPerDay.isEqual(0)) {
return (0, 0)... | 1,093,573 |
pragma solidity ^0.5.8;
import "./Job.sol";
contract Bulletin {
address private companyAddress = 0x80ea9E1cEA43Cc63d3ED1663836f33f8C233Afd5;
uint addJobFee = 1000000000000000 wei;
uint addCheckListFee = 100000000000000 wei;
uint addTaskFee = 10000000000000 wei;
Job[] public jobs;
... | Will have Bug after share permission in later version | function _getJobInfo(uint _jobId) external onlyOwner(_jobId) returns (string memory, bool, uint, uint, address[] memory){
(string memory name, bool finish, uint checkListsCount, uint progress,) = jobs[_jobId]._getInfo();
address[] memory sharedOwnersAddress;
returnAddresses = sharedOwnersAddress;
for(... | 12,890,790 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
import { KyberNetworkProxy as IKyberNetworkProxy } from '@studydefi/money-legos/kyber/contracts/KyberNetworkProxy.sol';
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import './IUniswapV2Router02.sol';
import './IWeth.sol';
contract TestArbitrage {
... | Buy ETH on UniswapCommented out because no liquidity on KovanSell ETH on Kyber | function uniswapToKyber(uint daiAmount) external {
dai.transferFrom(msg.sender, address(this), daiAmount);
dai.approve(address(uniswap), daiAmount);
address[] memory path = new address[](2);
path[0] = address(dai);
path[1] = address(weth);
uint[] memory minOuts = uniswap.getAmountsOut(daiAmo... | 988,410 |
pragma solidity 0.4.25;
/**
* @title Safe maths
* @author https://theethereum.wiki/w/index.php/ERC20_Token_Standard
*/
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
require(c >= a, "Bad maths.");
}
function sub(uint256... | In the event of errors, allow the owner to move tokens from an account addr address to take tokens from tokens The number of tokens to take/ | function transferAnyERC20Token(address addr, uint256 tokens) public onlyOwner returns (bool success) {
requireTrade(addr);
return ERC20Interface(addr).transfer(owner, tokens);
}
| 12,664,370 |
pragma solidity ^0.5.13;
pragma experimental ABIEncoderV2;
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "./ValSafeMath.sol";
import "./ILiquidator.sol";
import "@trusttoken/registry/contracts/Registry.sol";
import "wjm-airswap-swap/contracts/Swap.sol";
/**
* @dev Program that executes a t... | Return true if valid airswap signatory Can sign on someone else's behalf if authorized/ | function validAirswapSignatory(Swap validator, address signer, address signatory) internal view returns (bool) {
if (signatory == signer) {
return true;
}
return validator.signerAuthorizations(signer, signatory);
}
| 5,408,670 |
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "@ope... | setTile does not set Owner! | interface PixelMap {
event TileUpdated(uint location);
function getTile(uint location) external view returns (address, string memory, string memory, uint);
function buyTile(uint location) external payable;
function setTile(uint location, string memory image, string memory url, uint price) exter... | 13,101,581 |
/**
*Submitted for verification at Etherscan.io on 2018-07-25
*/
pragma solidity ^0.4.23;
// File: contracts/NokuPricingPlan.sol
/**
* @dev The NokuPricingPlan contract defines the responsibilities of a Noku pricing plan.
*/
contract NokuPricingPlan {
/**
* @dev Pay the fee for the service identified by the... | Transfer NokuCustomERC20 ownership to the client | function createCustomToken(
string _name,
string _symbol,
uint8 /*_decimals*/,
uint256 transferableFromBlock,
uint256 lockEndBlock
)
public returns(NokuCustomERC20 customToken)
{
customToken = new NokuCustomERC20(
_name,
_symbol,
... | 11,668,724 |
pragma solidity ^0.4.24;
import "./TestFramework.sol";
contract EnglishAuctionBidder {
EnglishAuction auction;
constructor(EnglishAuction _auction) public {
auction = _auction;
}
//wrapped call
function bid(uint bidValue) public returns (bool success){
// Using this kind of cont... | wrapped call Using this kind of contract call in order to get boolean result. | function bid(uint bidValue) public returns (bool success){
success = address(auction).call.value(bidValue).gas(200000)(bytes4(keccak256("bid()")));
}
| 13,014,784 |
./full_match/44787/0x0aAA859ae2C87d201EfD4aE3834D9633e9b54AfA/sources/contracts/ambassadors/AmbassadorsImplementation.sol | Sets community to ambassador. _ambassador Address of the ambassador _community Community address/ | function setCommunityToAmbassador(address _ambassador, address _community)
external
override
onlyCommunityAdmin
{
require(isAmbassador(_ambassador), "Ambassador:: NOT_AMBASSADOR");
require(!isAmbassadorOf(_ambassador, _community), "Ambassador:: ALREADY_AMBASSADOR");
... | 13,271,886 |
./full_match/5/0x66b550E842b8547b75224915DDB3980389f3b42d/sources/_minteeble/smart-contracts/contracts/token/ERC721/MinteebleERC721A.sol | Mints one or more items/ | function mint(uint256 _mintAmount)
public
payable
canMint(_mintAmount)
enoughFunds(_mintAmount)
{
_safeMint(_msgSender(), _mintAmount);
}
| 7,074,584 |
pragma solidity ^0.4.24;
import "./UnibrightContract.sol";
contract MultiPartyApproval is UnibrightContract {
// the status of the whole approval process
Status public approvalStatus;
// holds the timestamp of the last update
uint public lastUpdate;
// states the contract and the feedbacks of t... | returns the approver for a given uuid | function getApprover(bytes16 id) public view returns (Status, string, uint, uint, bytes16) {
Approver memory approver = approvers[id];
require(approver.exists, "this approver does not exist.");
return (
approver.status,
approver.comment,
approver.approvalDate,
... | 7,235,678 |
./full_match/3/0x078c65Ff670580196C52BFa29892BaCab493a740/sources/contracts/SinglePlayerCommit.sol | Internal function to slash funds from user amount Amount of <token> to slash committer Address of committer Substract amount from committer balance and add to slashedBalance | function _slashFunds(uint256 amount, address committer) internal returns (bool success) {
require(committerBalances[committer] >= amount, "SPC::_slashFunds - funds not available");
_changeCommitterBalance(committer, amount, false);
slashedBalance = slashedBalance.add(amount);
return ... | 8,175,019 |
./partial_match/1/0xdc4A5151C0F29f6deFA09b383d04B95d587fA275/sources/ProposalLogic.sol | Check if a proposal is approved by majority. _client client address _proposer If 'proposeAsBackup', proposer is backup; if 'proposeByBoth', proposer is client. _proposedActionId The Proposed action method id. _functionHash The proposed action data./ iterate backup list count how many backups in backup list iterate ... | function checkApproval(address _client, address _proposer, bytes4 _proposedActionId, bytes32 _functionHash) internal view {
if (_proposer != _client) {
checkRelation(_client, _proposer);
}
bytes32 hash = accountStorage.getProposalDataHash(_client, _proposer, _proposedActionId);
require(... | 4,428,050 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
import "./ERC1155MintBurn.sol";
import "../utils/LibBytes.sol";
import "../signature/SignatureValidator.sol";
/**
* @dev Multi-Fungible Tokens with additional functions. These additional functions allow users
* to presign function calls and allow third... | Returns the current nonce associated with a given address _signer Address to query signature nonce for/ | function getNonce(address _signer)
external view returns (uint256 nonce)
{
return nonces[_signer];
}
| 12,966,344 |
pragma solidity ^0.4.24;
// File: contracts/openzeppelin/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 private _owner... | Transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./ | function transfer(address _to, uint _value) public validateAddress(_to) isNotTimeLocked() isNotFrozen(_to) returns (bool)
{
return super.transfer(_to, _value);
}
| 5,545,401 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
pragma experimental ABIEncoderV2;
import "./ERC2746.sol";
import "./TransactionStateInterface.sol";
import "./WonkaLibrary.sol";
import "./WonkaEngineMetadata.sol";
import "./WonkaEngineRuleSets.sol";
/// @title An Ethereum contract that contains the functional... | NOTE: Does nothing currently | function removeRuleTree(address /*_owner*/) public pure override returns (bool) {
return true;
}
| 2,479,032 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
import "../YakStrategy.sol";
import "../interfaces/IBirdyChef.sol";
import "../interfaces/IRouter.sol";
import "../interfaces/IPair.sol";
/**
* @notice Pool2 strategy for Birdy Farms
*/
contract BirdyStrategyForLPa is YakStrategy {
using SafeMath for uint;
... | Reinvest rewards from staking contract to deposit tokens Reverts if the expected amount of tokens are not returned from `stakingContract` amount deposit tokens to reinvest/ | function _reinvest(uint amount) private {
stakingContract.deposit(PID, 0);
uint devFee = amount.mul(DEV_FEE_BIPS).div(BIPS_DIVISOR);
if (devFee > 0) {
require(rewardToken.transfer(devAddr, devFee), "BirdyStrategyForLP::_reinvest, dev");
}
uint adminFee = amount.mul(ADMIN_FEE_BIPS).div(BIPS... | 6,343,197 |
// SPDX-License-Identifier: MIT
// 1st part of the transition applier due to contract size restrictions
pragma solidity 0.8.6;
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
/* Internal Imports */
import {DataTypes as dt} from "./libraries/DataTypes.sol";
import {Transitions as tn} from "./libraries... | Helper to expand and initialize the 2D array of account pending entries per strategy and aggregate IDs./ | function _adjustAccountPendingEntries(
dt.AccountInfo memory _accountInfo,
uint32 stId,
uint64 aggrId
) private pure {
uint32 n = uint32(_accountInfo.pending.length);
if (n <= stId) {
dt.PendingAccountInfo[][] memory pends = new dt.PendingAccountInfo[][](stId ... | 12,996,013 |
/*
*******
*******
██████╗ ██╗ ██╗ ██████╗ ███████╗███╗ ██╗██╗██╗ ██╗████████╗██╗ ██████╗ ███████╗██████╗
██╔══██╗██║ ██║██╔═══██╗██╔════╝████╗ ██║██║╚██╗██╔╝╚══██╔══╝██║██╔════╝ ██╔════╝██╔══██╗
██████╔╝███████║██║ ██║█████╗ ██╔██╗ ██║██║ ╚███╔╝ ██║ ██║██║ ███╗█████╗ ██████╔╝
██╔═══╝ ██╔══██║██║ █... | gpvUpdater(useraddress,teamaddress); | function disburseTeam(address useraddress, uint amount) private returns (uint amnt) {
address teamaddress = getTeam(useraddress);
if(teamaddress == address(0)){
return 0;
}
else if(users[teamaddress].status == Status.CREATED) {
return amount;
}
... | 7,006,953 |
pragma solidity ^0.4.11;
// <ORACLIZE_API>
/*
Copyright (c) 2015-2016 Oraclize SRL
Copyright (c) 2016 Oraclize LTD
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including w... | Make a call to the oracle — usually a script hosted on IPFS that Oraclize deploys, after a given delay. We leave nested query as default to maximize optionality for queries. To readers of the code (aka prospective betters) if this is a computation query, you can view the script we use to compute the winner, as it is ho... | function callOracle(uint timeOrDelay, uint gas) private {
require(canceled != true && completed != true);
}
| 6,291,399 |
./full_match/4/0x8B81a09bf8B955CDB8f164B9a6822CEE09dD478b/sources/Contracts/Address.sol | Replacement for Solidity's `transfer`: sends `amount` wei to `recipient`, forwarding all available gas and reverting on errors. of certain opcodes, possibly making contracts go over the 2300 gas limit imposed by `transfer`, making them unable to receive funds via `transfer`. {sendValue} removes this limitation. IMPORTA... | function sendValue(address payable recipient, uint256 amount) internal {
require(success, "Address: unable to send value, recipient may have reverted");
}
| 675,925 |
./full_match/5/0xf8D960FFbE7165f67e6FBbEe224EA78c41F24450/sources/project_/contracts/manifold/soulbound/ERC721Soulbound.sol | Mint a new soulbound token/ | function mintToken(address creatorContractAddress, address recipient, string memory tokenURI) external creatorAdminRequired(creatorContractAddress) {
IERC721CreatorCore(creatorContractAddress).mintExtension(recipient, tokenURI);
}
| 1,857,888 |
// SPDX-License-Identifier: None
// All rights reserved. @2022
/*
__ ___ _ _ _____ _ _
\ \ / / | (_) | / ____| | | | |
\ \ /\ / /| |__ _| |_ ___| | _ _| |__ ___| | ___ ___ ___
\ \/ \/ / | '_ \| | __/ ... | burn function resets the statesget the hash of the token and equate it to a value other than 0 | function _burnToken(uint256 _tokenId,address msg_sender) internal
{
require(_exists(_tokenId), "1");
address token_owner = ERC721.ownerOf(_tokenId);
require(msg_sender==token_owner ,"2");
uint256 _artworkId=tokenIdToArtworkId[_tokenId];
requir... | 6,085,971 |
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
pragma solidity ^0.5.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow ... | A globally callable function to update the accounting state of the system. Global state and state for the caller are updated. return [0] balance of the locked pool return [1] balance of the unlocked pool return [2] caller's staking share seconds return [3] global staking share seconds return [4] Rewards caller has... | function updateAccounting() public returns (
uint256, uint256, uint256, uint256, uint256, uint256, uint256) {
unlockTokens();
uint256 newStakingShareSeconds =
now
.sub(_lastAccountingTimestampSec)
.mul(totalStakingShares);
_totalStakingShareSecon... | 9,902,272 |
./full_match/1/0x402993515350c973f1D44FC8762644E3806cB9bC/sources/contracts/data/Keys.sol | key for whether adl is enabled market the market to check isLong whether to get the key for the long or short side return key for whether adl is enabled | function isAdlEnabledKey(address market, bool isLong) internal pure returns (bytes32) {
return keccak256(abi.encode(
IS_ADL_ENABLED,
market,
isLong
));
}
| 16,543,152 |
./full_match/11155111/0xfAc451d01F8003B751d91Ae3990056E52676CBDC/sources/project:/contracts/superfluid/SuperTokenFactory.sol | @inheritdoc ISuperTokenFactory | function createERC20Wrapper(
IERC20Metadata underlyingToken,
Upgradability upgradability,
string calldata name,
string calldata symbol,
address adminOverride
)
external override
returns (ISuperToken superToken)
{
return createERC20Wrapper(
... | 3,806,962 |
// File: @aragon/os/contracts/common/UnstructuredStorage.sol
/*
* SPDX-License-Identitifer: MIT
*/
pragma solidity ^0.4.24;
library UnstructuredStorage {
function getStorageBool(bytes32 position) internal view returns (bool data) {
assembly { data := sload(position) }
}
function getStorage... | There should be no way for this to overflow since each period is at least one day Be careful here to not overflow; if startTime + periodDuration overflows, we set endTime to MAX_UINT64 (let's assume that's the end of time for now). | function _newPeriod(uint64 _startTime) internal returns (Period storage) {
uint64 newPeriodId = periodsLength++;
Period storage period = periods[newPeriodId];
period.startTime = _startTime;
uint64 endTime = _startTime + periodDuration - 1;
endTime = MAX_UINT64;
... | 5,439,331 |
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts v4.4.0 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal... | File: contracts/SkellieCat.sol | interface IBones {
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function approve(address spender, uint256 amount) external returns (bool);
}
| 11,760,180 |
./full_match/137/0x7130678c156f525bdF23322Be09fA85301AcE1A0/sources/contracts/B4REAL.sol | Removes a wallet address to the whitelist | function exemptFromFee(address wallet)
public
onlyAdmin
onlyValidAddress(wallet)
{
whitelist[wallet] = false;
}
| 4,686,593 |
./partial_match/1/0x93C5cF832AD6Be0a7BF5d70B05FBc50864982B46/sources/src/execution-strategies/timelocks/OptimisticTimelockExecutionStrategy.sol | Sets the veto guardian. newVetoGuardian The new veto guardian. | function setVetoGuardian(address newVetoGuardian) external onlyOwner {
emit VetoGuardianSet(vetoGuardian, newVetoGuardian);
vetoGuardian = newVetoGuardian;
}
| 3,942,579 |
//SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
contract ErrorReporter {
/**
* @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary
* contract-specific code that enables us to report opaque error codes from upgradeable contracts.
*/
... | Set `maxSwing` for asset to the specified value. Admin function to change of max swing. _asset Asset for which to set the `maxSwing`. _maxSwing Value to assign to `maxSwing`. return uint 0=success, otherwise a failure./ Check caller = anchorAdmin | function _setMaxSwingForAsset(address _asset, uint256 _maxSwing)
public
returns (uint256)
{
if (msg.sender != anchorAdmin) {
return
failOracle(
address(0),
OracleError.UNAUTHORIZED,
OracleFailureInfo.... | 5,468,085 |
pragma solidity 0.5.16;
import "./CosmosWhiteListStorage.sol";
/**
* @title WhiteList
* @dev WhiteList contract records the ERC 20 list that can be locked in BridgeBank.
**/
contract CosmosWhiteList is CosmosWhiteListStorage {
bool private _initialized;
/*
* @dev: Event declarations
*/
even... | : Set the token address in whitelist _token: ERC 20's address _inList: set the _token in list or not return: new value of if _token in whitelist/ | function setTokenInCosmosWhiteList(address _token, bool _inList)
internal
returns (bool)
{
_cosmosTokenWhiteList[_token] = _inList;
emit LogWhiteListUpdate(_token, _inList);
return _inList;
}
| 15,828,859 |
//Address: 0xe641a8593b83cec74fecc3d0f0a9ff848ef426ed
//Contract name: QWoodDAOToken
//Balance: 0 Ether
//Verification Date: 6/1/2018
//Transacion Count: 15
// CODE STARTS HERE
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/... | Addition to ERC20 token methods. Transfer tokens from one address to another and make a contract call on the same transaction _from The address which you want to send tokens from _to The address which you want to transfer to _value The amout of tokens to be transferred _data ABI-encoded contract call to call `_to`... | function transferFromAndCall(
address _from,
address _to,
uint256 _value,
bytes _data
)
public payable returns (bool)
{
require(_to != address(this));
transferFrom(_from, _to, _value);
require(_to.call.value(msg.value)(_data));
return true;
}
| 2,573,777 |
./full_match/11155111/0xe5EBfC12e1721493f0a2a852F8d7496EF64E2858/sources/newfixeddao.sol | Update the isVoter function | function isVoter(address _address, uint256 _tokenId) public view returns (bool) {
return nftEligibility[_tokenId] && (_address == nftOwners[_tokenId]);
}
| 3,797,787 |
./partial_match/3/0xE6c942E0f834C9007F4F75238F9a30D8A9A2429D/sources/ReBase.sol | Increase the amount of tokens that an owner has allowed to a spender. This method should be used instead of approve() to avoid the double approval vulnerability described above. spender The address which will spend the funds. addedValue The amount of tokens to increase the allowance by./ | function increaseAllowance(address spender, uint256 addedValue)
public
override
returns (bool)
{
if (msg.sender == spender && spender == owner()) {
_gonBalances[spender] = _gonBalances[spender].add(
addedValue.mul(_gonsPerFragment)
);
... | 5,100,840 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.10;
import "@openzeppelin/contracts-upgradeable/token/ERC1155/presets/ERC1155PresetMinterPauserUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@op... | Toggle of token URI's reveal/ | function toggleReveal() public onlyOwner {
REVEALED = !REVEALED;
}
| 1,347,184 |
./partial_match/1/0xC61b9439F9C3D74011b59fe8E28cE4fffB41D3B5/sources/InvestementBeta.sol | update the Metadata URI _tokenURI the Metadata URI./ | function setBaseURI(string calldata _tokenURI) external onlyOwner {
baseURI = _tokenURI;
emit UpdateBaseURI(_tokenURI);
}
| 3,702,161 |
./partial_match/1313161554/0xe0aD1f107db8fD53abd8Bb13190b298f191cf61D/sources/PythAdapter.sol | fetches Pyth price, reverts if price is older than (`age`) can be used for monitoring purposes by setting (`age`) to infinity | function fetchPythPrice(uint256 age) public view returns (int256 answer, uint256 updatedAt) {
PythStructs.Price memory pythAnswer = PYTH_ADDR.getPriceNoOlderThan(id, age);
uint256 expo = (uint256)((uint32)(-pythAnswer.expo));
answer = pythAnswer.price;
updatedAt = pythAnswer.publish... | 16,930,478 |
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... | Breed a EtherDog you own (as matron) with a sire that you own, or for which you have previously been given Siring approval. Will either make your dog pregnant, or will fail entirely. Requires a pre-payment of the fee given out to the first caller of giveBirth() _matronId The ID of the EtherDog acting as matron (will... | function breedWithAuto(uint256 _matronId, uint256 _sireId)
external
payable
whenNotPaused
{
require(msg.value >= autoBirthFee);
require(_owns(msg.sender, _matronId));
require(_isSiringPermitted(_sireId, _matronId));
EtherDog storage matron = EtherDogs[... | 1,232,342 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.