file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
/**
*Submitted for verification at Etherscan.io on 2021-09-20
*/
pragma solidity 0.8.4;
/*
* @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 suc... | `Operator` sweeps `purchaseToken` from the sale contract to `to` address/ | function sweep(address to) external onlyOwner {
require(to != address(0), "IDOSale: ADDRESS_INVALID");
require(endTime <= block.timestamp, "IDOSale: SALE_NOT_ENDED");
uint256 bal = purchaseToken.balanceOf(address(this));
purchaseToken.transfer(to, bal);
emit Swept(to, bal);
... | 6,732,770 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract GreenCollectible is ERC721Enumerable, Ownable {
using Counters f... | authorizes a recipient which in this case is to be a non-profit organization which plants trees around the world Requirements: - msg.sender has to be the owner of this smart contract - `recipient` must not have been authorized. Emits an {Authorized} event./ | function authorizeRecipient(address recipient) external onlyOwner {
require(
!isAnEligibleNonProfitOrganization[recipient],
"Recipient has already been authorized."
);
isAnEligibleNonProfitOrganization[recipient] = true;
emit Authorized(recipient);
}
| 5,398,182 |
./full_match/43113/0x2Ad8a117CAA5574f34CF28312E5715c153a3a147/sources/contracts/Governed.sol | Helper function to block any action while the system is paused Reverts the execution if the system is paused | function enforceSystemNotPaused() internal view {
require(!paused, "paused");
}
| 7,165,458 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.3;
import './libs/SafeERC20.sol';
import './libs/Ownable.sol';
import './libs/SafeMath.sol';
/**
* @title TokenVesting
* @dev A token holder contract that can release its token balance gradually like a
* typical vesting scheme, with a cliff and vesting pe... | return the cliff time of the token vesting./ | function getCliff() external view returns (uint256) {
return cliff;
}
| 5,463,657 |
./full_match/80001/0x56b8F94348fafE882EE30c0e58b3BD597620f807/sources/contracts/SingleEditionMintableCreator.sol | Creates a new edition contract as a factory with a deterministic address Important: None of these fields (except the Url fields with the same hash) can be changed after calling _name Name of the edition contract _symbol Symbol of the edition contract _description Metadata: Description of the edition entry _animatio... | function createEdition(
string memory _name,
string memory _symbol,
string memory _description,
string memory _animationUrl,
bytes32 _animationHash,
string memory _imageUrl,
bytes32 _imageHash,
uint256 _editionSize,
uint256 _royaltyBPS
) ex... | 5,559,919 |
./full_match/1/0xF056374Dd1201FdDdC00A54AD92f68e48580c83C/sources/libraries/PoolActions.sol | Withdraws exact amount of liquidity pool Uniswap V3 pool tickLower The lower tick of the range tickUpper The upper tick of the range liquidity to burn to Recipient of amounts return amount0 Amount of token0 withdrawed return amount1 Amount of token1 withdrawed/ collect liquidity share including earned fees | function burnExactLiquidity(
IUniswapV3Pool pool,
int24 tickLower,
int24 tickUpper,
uint128 liquidity,
address to
) internal returns (uint256 amount0, uint256 amount1) {
uint128 liquidityInPool = pool.positionLiquidity(tickLower, tickUpper);
require(liquid... | 2,985,587 |
./full_match/43114/0x965A22fb58b47ee5b4365Ef1Fc7C33cF4A73c66e/sources/airdropping.sol | Adds airdropping points to an address, internal only address_ The address receiving airdropping points amount The amount of points to be added | function addAirdroppingPoints(address address_, uint amount) external {
require(msg.sender == address(this), "internal");
_addAirdroppingPoints(address_, amount);
}
| 4,620,977 |
./partial_match/4/0x9D807117931851b6B4D865888376e935bDeC09BD/sources/Dotc.sol | 只能由第一轮或第二轮仲裁合同设置资产释放仲裁标示, @_arb == 1 用户家胜 @_arb == 2 商家胜 | function setArb(uint256 i, uint256 _arb) external {
require(arbone == msg.sender || arbtwo == msg.sender, "Dotc/not-invite");
if (users[i].Umark == "sale" )
require((_arb == 2 && Tima <= sub(block.timestamp, tima[i])) || (_arb == 1 && Timb <= sub(block.timestamp, timb[i])), "Dotc/not-arbtime... | 8,505,768 |
./full_match/1/0x2a412Df7e18B847e953c2Bc6ae90581dEe8571e3/sources/contracts/Escrow.sol | this function is called by buyer or seller to tell the correct seller or buyer is matched. the transaction status should be SignedSeller to be called by this function/ | function confirmSigning(
bytes32 escrowID
) external onlyTransactionOwner(escrowID) {
require(
escrowTransactions[escrowID].status == EscrowStatus.SignedSeller,
"Seller/buyer didn't sign yet"
);
escrowTransactions[escrowID].status = EscrowStatus.SignedBoth;
}
| 3,155,426 |
./partial_match/1/0x99b57Abf76E69E52EfF39a5f876280d4B525119F/sources/contracts/cedar/drop/CedarERC721Drop.sol | stores terms accepted from a signed message this function is for acceptors that have signed a message offchain to accept the terms. The function calls the verifier contract to valid the signature before storing acceptance. | function storeTermsAccepted(address _acceptor, bytes calldata _signature)
external
virtual
override
onlyRole(DEFAULT_ADMIN_ROLE)
{
_storeTermsAccepted(_acceptor, _signature);
}
| 3,659,914 |
./partial_match/1/0x34cB8F75952dFbC5c40832745bcC851071aF8055/sources/MultiSigWallet.sol | call has been separated into its own function in order to take advantage of the Solidity's code generator to produce a loop that copies tx.data into memory. It includes callGas (700) + callVeryLow (3, to pay for SUB) + callValueTransferGas (9000) + callNewAccountGas (25000, in case the destination address does not exis... | function external_call(
address destination,
uint256 value,
uint256 dataLength,
bytes memory data
) private returns (bool) {
bool result;
assembly {
result := call(
destination,
value,
d,
x,
)
}
return result;
}
| 9,427,963 |
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 current address for a module by ID _id ID of the module being queried return Current address of the requested module/ | function _getModuleAddress(bytes32 _id) internal view returns (address) {
return currentModules[_id];
}
| 91,762 |
./partial_match/1/0x054D996EEd5e726722c1b8F4D1DD0179f5a06A6c/sources/Delegate.sol | Set a Trading Rule only callable by the owner of the contract 1 senderToken = priceCoef 10^(-priceExp) signerToken senderToken address Address of an ERC-20 token the delegate would send signerToken address Address of an ERC-20 token the consumer would send maxSenderAmount uint256 Maximum amount of ERC-20 token t... | function setRule(
address senderToken,
address signerToken,
uint256 maxSenderAmount,
uint256 priceCoef,
uint256 priceExp
) external onlyOwner {
_setRule(
senderToken,
signerToken,
maxSenderAmount,
priceCoef,
priceExp
);
}
| 3,598,609 |
./full_match/1/0x58C90b5Dbc69963Fb0CAbee1163747FDBB7A8b18/sources/contracts/erc20/utils/SolutionProxyERC20.sol | Make calls Push outputs to maker Take profits in native token | function callback(
MemswapERC20.Intent memory intent,
uint128 amountToFill,
bytes memory data
) external override restrictCaller(memswap) {
(uint128 amountToExecute, Call[] memory calls) = abi.decode(
data,
(uint128, Call[])
);
unchecked {... | 16,488,791 |
// SPDX-License-Identifier: MIT
// pragma solidity >=0.8.0 <0.9.0;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./dependencies/libraries/Structure... | IMarsGovernance(owner()).changeOutcome(_predictionMarket, marketStatus[_predictionMarket].outcomes); | function startVoting(address _predictionMarket) external override {
uint256 votingPeriod = parameters.getVotingPeriod();
require(block.timestamp >= marketStatus[_predictionMarket].dueDate + votingPeriod, "Still early to start voting");
require(marketStatus[_predictionMarket].finalized == fal... | 5,473,530 |
pragma solidity >=0.5.4 <0.6.0;
import './SafeMath.sol';
import './AOLibrary.sol';
import './TheAO.sol';
import './INameFactory.sol';
import './INameTAOPosition.sol';
import './INameAccountRecovery.sol';
import './TokenERC20.sol';
import './AOIon.sol';
/**
* @title NameTAOVault
*/
contract NameTAOVault is TheAO {
... | Transfer `_amount` of ERC20 Token from `_from` to `_to` _erc20TokenAddress The ERC20 Token Address _from The sender address _to The recipient address _amount The amount to transfer/ | function transferERC20(address _erc20TokenAddress, address _from, address _to, uint256 _amount) public isNameOrTAO(_from) onlyAdvocate(_from) senderNameNotCompromised {
require (AOLibrary.isValidERC20TokenAddress(_erc20TokenAddress));
TokenERC20 _erc20 = TokenERC20(_erc20TokenAddress);
require (_amount > 0 && _e... | 12,882,867 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which i... | Allow the owner to update the fee recipient. _nextFeeRecipient The address to start paying fees to. | function updateFeeRecipient(address _nextFeeRecipient) public onlyOwner {
require(_nextFeeRecipient != address(0x0), "Gateway: fee recipient cannot be 0x0");
feeRecipient = _nextFeeRecipient;
}
| 1,641,529 |
./partial_match/1/0x76E1DeB20301b710aC6252ce4f95F9Cc0ac17808/sources/TokenSpring.sol | updateAccounting(); checks 1. User Accounting Redeem from most recent stake and go backwards in time. normalized amount from this CD MUST fully redeem a past stake, CD gets destroyed Need to be penalized amountOfThisStake (totalLock - actualLock)/totalLock) / 2 this contract was fulfilled, make sure to pay out the rew... | function _unstake(uint256 amount) private returns (uint256) {
unlockTokens();
require(amount > 0, 'TokenSpring: unstake amount is zero');
require(totalStakedFor(msg.sender) >= amount,
'TokenSpring: unstake amount is greater than total user stakes');
uint256 stakingShares... | 4,456,933 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
import "../interfaces/AccessControlledInterface.sol";
import "../vendor/AccessControllerInterface.sol";
import "../vendor/ConfirmedOwner.sol";
contract AccessControlled is AccessControlledInterface, ConfirmedOwner(msg.sender) {
AccessControllerInterface intern... | get past rounds answers asset asset address denomination denomination address roundId the proxy round id number to retrieve the answer for overridden function to add the checkAccess() modifier We advise to use getRoundData() instead because it returns more in-depth information. This does not error if no answer ha... | function getAnswer(
address asset,
address denomination,
uint256 roundId
)
external
view
override
checkPairAccess()
returns (
int256 answer
)
{
if (roundId > MAX_ID) return 0;
(uint16 phaseId, uint64 aggregatorRoundId) = _parseIds(roundId);
AggregatorV2V3Inter... | 14,647,441 |
./partial_match/8453/0x614747C53CB1636b4b962E15e1D66D3214621100/sources/CookieToken.sol | Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/ | function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
bytes32 domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name())),
... | 16,794,000 |
./full_match/4/0xAA1009fF5c7AdBd8C0730621dFCC292ceB26358C/sources/contracts/PriceConsumerV3.sol | Returns the latest price/ | function getTokenPrice(address token) public view returns (int256)
{
address oracle = oracle_addresses[token];
if (oracleAvailable(token) == false)
{
return int256(0);
}
AggregatorV3Interface priceFeed = AggregatorV3Interface(oracle);
... | 12,447,947 |
./full_match/97/0xAFF60E6d6119D7807247809B4D39995dA2E0eF92/sources/project:/contracts/tokens/CELLIT.sol | This method is used to withdraw tokens from vesting Emits a {Unvest} event./ | function unvest() external whenNotPaused returns (uint unvested) {
require (_vestingNonces[msg.sender] > 0, "CELLIT::unvest:No vested amount");
for (uint i = 1; i <= _vestingNonces[msg.sender]; i++) {
if (_vestingAmounts[msg.sender][i] == _unvestedAmounts[msg.sender][i]) continue;
... | 3,274,489 |
./partial_match/1/0x478059f577Cb739f0AF0f37A365DD069Ba5BD8Be/sources/CryptostampGoldenUnicorn.sol | Both the actual create control key and the shipping control key that delivers the on-chain raffle can mint Golden Unicorns. | {
require(msg.sender == createControl || msg.sender == shippingControl, "createControl or shippingControl key required for this function.");
_;
}
| 9,358,473 |
pragma solidity ^0.4.20;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, ui... | fallback function can be used to buy tokens | function () external payable {
buyTokens(msg.sender);
}
| 897,286 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
/**
* @dev Utility library of inline functions on addresses.
*/
library AddressUtils {
/**
* @dev Returns whether the target address is a contract.
* @param _addr Address to check.
*/
function isContract(
address _addr
)
internal
vi... | Get token from giver, find balanceOf(self), tokenOfOwnerByIndex(0) should not throw./ | function checkZeroTokenOfOwnerByIndex(
address _target
)
internal
{
require(ERC721(_target).balanceOf(address(this)) > 0);
ERC721Enumerable(_target).tokenOfOwnerByIndex(address(this), 0);
}
| 993,543 |
./partial_match/42/0xd434a1bDD41689160ecd24F78df7C354f054166A/sources/FlexibleLeverageStrategyAdapter.sol | Update state on this strategy adapter to track last trade timestamp and whether to clear TWAP leverage ratio or store new TWAP leverage ratio. There are 3 cases to consider: - End TWAP / regular rebalance: if chunk size is equal to total notional, then rebalances are not chunked and clear TWAP state. - Start TWAP: If c... | function _updateTradeState(
uint256 _chunkRebalanceNotional,
uint256 _totalRebalanceNotional,
uint256 _newLeverageRatio
)
internal
{
lastTradeTimestamp = block.timestamp;
if (_chunkRebalanceNotional == _totalRebalanceNotional) {
delete twapLeverag... | 3,425,723 |
./full_match/5/0x8d9ca9aADC3A0Fb904229744BF1270D8739e77Ff/sources/_aave/core-v3/contracts/interfaces/IPriceOracle.sol | IPriceOracle Aave Defines the basic interface for a Price oracle./ | interface IPriceOracle {
function getAssetPrice(address asset) external view returns (uint256);
function setAssetPrice(address asset, uint256 price) external;
pragma solidity 0.8.10;
}
| 1,895,303 |
./full_match/8453/0xC64149c0e8A67A88Fc2345A450367088c2341612/sources/@aave/periphery-v3/contracts/treasury/AaveEcosystemReserveV2.sol | Returns the available funds for the given stream id and address. Throws if the id does not point to a valid stream. streamId The id of the stream for which to query the balance. who The address for which to query the balance. Returns the total funds allocated to `who` as uint256./ If the stream `balance` does not e... | function balanceOf(uint256 streamId, address who)
public
view
streamExists(streamId)
returns (uint256 balance)
{
Stream memory stream = _streams[streamId];
BalanceOfLocalVars memory vars;
uint256 delta = deltaOf(streamId);
vars.recipientBalance = delta * stream.ratePerSecond;
i... | 11,546,434 |
/*
Copyright 2021 Empty Set Squad <emptysetsquad@protonmail.com>
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 ... | Claim all accrued reward tokens withdraw all underlying tokens for caller/ | function exit() external {
withdraw(balanceOfUnderlying[msg.sender]);
claim();
}
| 12,680,414 |
pragma solidity ^0.4.21;
// File: contracts/ISimpleCrowdsale.sol
interface ISimpleCrowdsale {
function getSoftCap() external view returns(uint256);
function isContributorInLists(address contributorAddress) external view returns(bool);
function processReservationFundContribution(
address contributo... | ICrowdsaleFund Fund methods used by crowdsale contract/ | interface ICrowdsaleFund {
function processContribution(address contributor) external payable;
function onCrowdsaleEnd() external;
function enableCrowdsaleRefund() external;
}
| 574,515 |
./full_match/1313161554/0x85B70E933Fe6d0e5FBe83B8D93141499E4C556aa/sources/contracts/RewardDistributor.sol | Set the Comptroller address/ | function setComptroller(address _comptroller) public {
require(msg.sender == admin, "only admin can set Comptroller");
comptroller = Comptroller(_comptroller);
}
| 13,231,541 |
// File: contracts/interfaces/IMarketHandler.sol
pragma solidity 0.6.12;
/**
* @title BiFi's market handler interface
* @author BiFi(seinmyung25, Miller-kk, tlatkdgus1, dongchangYoo)
*/
interface IMarketHandler {
function setCircuitBreaker(bool _emergency) external returns (bool);
function setCircuitBreakWithOwn... | BiFi's market handler data storage interface BiFi(seinmyung25, Miller-kk, tlatkdgus1, dongchangYoo)/ | interface IMarketHandlerDataStorage {
function setCircuitBreaker(bool _emergency) external returns (bool);
function setNewCustomer(address payable userAddr) external returns (bool);
function getUserAccessed(address payable userAddr) external view returns (bool);
function setUserAccessed(address payable userAddr,... | 1,420,202 |
pragma solidity ^0.5.0;
/**
* @title FixidityLib
* @author Gadi Guy, Alberto Cuesta Canada
* @notice This library provides fixed point arithmetic with protection against
* overflow.
* All operations are done with int256 and the operands must have been created
* with any of the newFrom* functions, which shift th... | Converts to positive if negative./ | function abs(int256 x) internal pure returns (int256) {
if (x >= 0) {
return x;
return negative(x);
}
}
| 12,826,793 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "./ERC721TypedMintByLockingERC20.sol";
import "./BoxWithTimeLock.sol";
/**
* @title CryptoTreasure is a typed ERC721 token able to store other tokens (ETH, ERC20, ERC721 & ERC1155)
* @notice Th... | lock a crypto treasure until a timestamp Only owner or approved can execute this Throw if the crypto treasure is already locked boxId id of the box unlockTimestamp unlock timestamp/ | function lockBox(uint256 boxId, uint256 unlockTimestamp) external {
require(_isApprovedOrOwner(_msgSender(), boxId), "e4");
onlyNotLockedBox(boxId);
_lockBox(boxId, unlockTimestamp);
}
| 6,486,629 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.4;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {ERC20Permit} from ... | Burns wAMPLs from {msg.sender} and transfers AMPLs back. wamples The amount of wAMPLs to burn. return The amount of AMPLs withdrawn. | function burn(uint256 wamples) external returns (uint256) {
uint256 amples = _wampleToAmple(wamples, _queryAMPLSupply());
_withdraw(_msgSender(), _msgSender(), amples, wamples);
return amples;
}
| 10,434,876 |
./partial_match/1/0xc6CadA314389430d396C7b0C70c6281e99ca7fe8/sources/src/contracts/FraxlendPairCore.sol | The ```_removeCollateral``` function is the internal implementation for removing collateral from a borrower's position _collateralAmount The amount of Collateral Token to remove from the borrower's position _receiver The address to receive the Collateral Token transferred _borrower The borrower whose account will be... | function _removeCollateral(uint256 _collateralAmount, address _receiver, address _borrower) internal {
userCollateralBalance[_borrower] -= _collateralAmount;
totalCollateral -= _collateralAmount;
if (_receiver != address(this)) {
collateralContract.safeTransfer(_receiver, _colla... | 2,823,181 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts-upgradeable/token/ERC20/presets/ERC20PresetFixedSupplyUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.s... | called when token is deposited on root chain Should be callable only by ChildChainManager Should handle deposit by minting the required amount for user Make sure minting is done only by this function user user address for whom deposit is being done depositData abi encoded amount/ | function deposit(address user, bytes calldata depositData)
external
{
require(_msgSender() == childChainManagerProxy, "You're not allowed to deposit");
uint256 amount = abi.decode(depositData, (uint256));
_mint(user, amount);
}
| 5,422,466 |
pragma solidity ^0.4.17;
// ----------------------------------------------------------------------------
// Processables
//
// Copyright (c) 2017 OpenST Ltd.
// https://simpletoken.org/
//
// The MIT Licence.
// ----------------------------------------------------------------------------
import "./Owned.sol";
/// @t... | Sets status to Completed, to be called by inheriting contracts with access control return true | function completeInternal()
internal
onlyIfApproved
returns(bool result)
{
status = Status.Completed;
Completed();
return true;
}
| 6,490,494 |
./partial_match/97/0x05ebb9d8e50Ff5f4d441A11E0230e079d81dB52c/sources/GET_NFT_V3.sol | invalidates the nft, making it impossible to move originAddress address of getNFT owner to be invalidated/ set invalidated to true _nftInvalidated[nftIndex] = true; uint256 minterBalance = FUELTOKEN.balanceOf(address(this)); require(minterBalance > transferGETfee, "getNFT factory has too little GET - Please top-up GET... | function invalidateAddressNFT(address originAddress) public onlyRelayer() {
uint256 nftIndex;
nftIndex = tokenOfOwnerByIndex(originAddress, 0);
require(_nftInvalidated[nftIndex] != true, "GET TX FAILED Func: invalidateAddressNFT - getNFT is is already set to true");
_setnft... | 11,470,325 |
// 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... | Excess deposit pool balance (in excess of minipool queue capacity) Get minipool queue capacity Calculate and return | function getExcessBalance() override public view returns (uint256) {
RocketMinipoolQueueInterface rocketMinipoolQueue = RocketMinipoolQueueInterface(getContractAddress("rocketMinipoolQueue"));
uint256 minipoolCapacity = rocketMinipoolQueue.getEffectiveCapacity();
uint256 balance = getBalance... | 12,600,992 |
./partial_match/80001/0x636C4701Fdd1C46e47177cef7032b26402Bf7251/sources/minter1.sol | Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation./ | function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
| 8,818,664 |
pragma solidity ^0.5.17;
pragma experimental ABIEncoderV2;
import "./StakingStorage.sol";
import "./SafeMath96.sol";
/**
* @title Checkpoints contract.
* @notice Increases and decreases storage values for users, delegatees and
* total daily stake.
* */
contract Checkpoints is StakingStorage, SafeMath96 {
/// ... | Increases the delegatee's stake for a giving lock date and writes a checkpoint. delegatee The delegatee address. lockedTS The lock date. value The value to add to the staked balance. / | function _increaseDelegateStake(
address delegatee,
uint256 lockedTS,
uint96 value
) internal {
uint32 nCheckpoints = numDelegateStakingCheckpoints[delegatee][lockedTS];
uint96 staked = delegateStakingCheckpoints[delegatee][lockedTS][nCheckpoints - 1].stake;
_writ... | 923,037 |
pragma solidity ^0.4.15;
import './Queue.sol';
import './Token.sol';
/**
* @title Crowdsale
* @dev Contract that deploys `Token.sol`
* Is timelocked, manages buyer queue, updates balances on `Token.sol`
*/
contract Crowdsale {
// YOUR CODE HERE
//keep track of number tokens sold, start & end time,
uint end... | add new tokens to totalSupply | function mint(uint _numNewTokens) requireOwner() {
token.addTokens(_numNewTokens);
}
| 7,327,072 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// It's important to avoid vulnerabilities due to numeric overflow bugs
// OpenZeppelin's SafeMath library, when used correctly, protects agains such bugs
// More info: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2018/november/smart-contract-in... | https:solidity-by-example.org/sending-ether/ | function safeTransfer(address payable _to, uint256 _amount)
public
payable
requireIsOperational
{
require(sent, "Failed to send Ether");
}
receive()
external
payable
| 12,969,845 |
pragma solidity ^0.5.0;
import "./ERC721Full.sol";
import "./Ownable.sol";
contract PlantBase is ERC721Full, Ownable {
// Name and Symbol for plant tokens
constructor() ERC721Full("Ethgarden.io", "GROW") public {
}
// Grown event to be emitted when shipIt is called
event Grown(uint256 plantId, u... | Mints new token backed by Ether Require enough payment Subtract shipping fee from plant value Plant instance | function mint() public payable {
require(msg.value >= shippingFee + minPlantPrice, "A plant cost more than that");
uint256 _value = uint256(msg.value - shippingFee);
Plant memory _plant = Plant({
seed: 0,
value: _value,
plantTime: block.number,
... | 13,094,800 |
./partial_match/3/0x5b0503bBBB3e5c35139A52A342E6dbF2F7642ED4/sources/INV.sol | Approve `spender` to transfer up to `amount` from `src` This will overwrite the approval amount for `spender` spender The address of the account which may transfer tokens rawAmount The number of tokens that are approved (2^256-1 means infinite) return Whether or not the approval succeeded/ | function approve(address spender, uint rawAmount) external returns (bool) {
uint96 amount;
if (rawAmount == uint(-1)) {
amount = uint96(-1);
amount = safe96(rawAmount, "INV::approve: amount exceeds 96 bits");
}
allowances[msg.sender][spender] = amount;
... | 5,279,931 |
./full_match/80001/0x950b1756c44c95a4469e915484b6AEdFA134F434/sources/project_/contracts/Traductores.sol | Función para ver el numero de traductores que hay | function getTraductorLength() external view returns (uint256) {
return s_traductores.length;
}
| 9,538,188 |
/**
*Submitted for verification at Etherscan.io on 2020-10-27
*/
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.5.2;
/**
* @title ERC20 interface
* @dev see https://eips.ethereum.org/EIPS/eip-20
*/
interface IERC20 {
function transfer(address to, uint256 value) external re... | inject PUBLIC FUNC TO EXTERNAL | function updateCommissionRate(uint256 newCommissionRate) public onlyValidator { | 13,098,170 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
pragma abicoder v2;
// OpenZeppelin v4
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { Initializable } from "@openzeppelin/contracts-upgr... | Check treasury fee is paid Transfer to treasury If the treasury contract fails (eg. with revert()) the tx or consumes more than 2300 gas railgun transactions will fail If this is ever the case, changeTreasury() will neeed to be called to change to a good contract Check deposit amount is not 0 Check token is on the whit... | function generateDeposit(
uint256[2] calldata _pubkey,
uint256 _random,
uint256 _amount,
address _tokenField
) external payable {
require(msg.value >= transferFee, "RailgunLogic: Fee not paid");
treasury.transfer(msg.value);
require(_amount > 0, "RailgunLogic: Cannot deposit 0 tokens")... | 6,141,175 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.6.8;
import "./ProtoBufRuntime.sol";
import "./GoogleProtobufAny.sol";
library IbcLightclientsIbft2V1ClientState {
//struct definition
struct Data {
string chain_id;
bytes ibc_store_address;
uint64 latest_height;
}
// Decoder section
/... | The decoder for internal usage p The offset of bytes array to start decode bs The bytes array to be decoded sz The number of bytes expected return The decoded struct return The number of bytes decoded/ | function _decode(uint256 p, bytes memory bs, uint256 sz)
internal
pure
returns (Data memory, uint)
{
Data memory r;
uint[5] memory counters;
uint256 fieldId;
ProtoBufRuntime.WireType wireType;
uint256 bytesRead;
uint256 offset = p;
uint256 pointer = p;
while (pointer < of... | 913,122 |
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./ConverterVersion.sol";
import "./interfaces/IConverter.sol";
import "./interfaces/IConverterAnchor.sol";
import "./interfaces/IConverterUpgrader.sol";
import "./interfaces/IBancorF... | upgrades the converter to the latest version can only be called by the owner note that the owner needs to call acceptOwnership on the new converter after the upgrade/ trigger de-activation event | function upgrade() public ownerOnly {
IConverterUpgrader converterUpgrader = IConverterUpgrader(addressOf(CONVERTER_UPGRADER));
emit Activation(converterType(), anchor, false);
transferOwnership(address(converterUpgrader));
converterUpgrader.upgrade(version);
acceptOwnershi... | 12,556,880 |
pragma solidity 0.5.10;
// This is a staking token ERC677 contract
// (a copy of the token contract from https://github.com/poanetwork/tokenbridge-contracts repo).
// Since the source `ERC677BridgeTokenRewardable` requires solc v0.4.24 but truffle
// doesn't allow using different versions of compiler at the same time... | Adds one more bridge contract into the list _bridge bridge contract address/ | function addBridge(address _bridge) external onlyOwner {
require(bridgeCount < MAX_BRIDGES);
require(AddressUtils.isContract(_bridge));
require(!isBridge(_bridge));
address firstBridge = bridgePointers[F_ADDR];
require(firstBridge != address(0));
bridgePointers[F_ADD... | 6,346,678 |
/*
.'''''''''''.. ..''''''''''''''''.. ..'''''''''''''''..
.;;;;;;;;;;;'. .';;;;;;;;;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;,.
.;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;,.
.;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;;;,. .;;;;;;;;;;;;;;;;;;;;,.
';;;;;;;;'. .';;;;;;;;;;;;;;;;;;... | Dependency file: contracts/truefi2/interface/ISAFU.sol pragma solidity 0.6.10; | interface ISAFU {
function poolDeficit(address pool) external view returns (uint256);
}
| 1,201,424 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.6;
import '@openzeppelin/contracts/math/SafeMath.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
/*
TODO list:
- QUESTION let's remove powerThreshold? and use totalPower / 2 + 1?
*/
/**
* Dfinance PegZone.
*/
contract Peggy {
using Sa... | Validators checkpoint./ | function makeCheckpoint(
address[] memory _validators,
uint256[] memory _powers,
uint256 _valsetNonce,
bytes32 _peggyId
) public pure returns (bytes32) {
bytes32 checkpoint = keccak256(
abi.encode(_peggyId, CHECKPOINT_METHOD_NAME, _valsetNonce, _validators, _p... | 1,043,379 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts-up... | / (address receiver, ERC20Payment[] memory _erc20paymetsData) = convertValidateERC20Input( payload, signature); if next erc20 payment related to the same ERC20 contract then collect amounts, related to the current requestor | function withdrawERC20(bytes calldata payload, bytes memory signature) public {
(ERC20Payment[] memory _erc20paymetsData) = convertValidateERC20Input( payload, signature);
uint _collectedAmount;
uint currentAmount;
for (uint i = 0; i < _erc20paymetsData.length; i++ ){
... | 13,498,784 |
pragma solidity 0.5.17;
/**
* @title BondingCurveHook
* @author Nick Furfaro
* This contract is meant to be registered as a hook,
* to be called on each key purchase from a Lock contract.
* It tracks the token(key) supply for the lock, and adjusts
* the price as the supply grows according to a modified binary lo... | If the lock owner has registered an implementer then this hook is called with every key sold. from the msg.sender making the purchase recipient the account which will be granted a key referrer the account which referred this key sale data arbitrary data populated by the front-end which initiated the sale minKeyPri... | function onKeyPurchase(
address /*from**/,
address /*recipient**/,
address /*referrer**/,
bytes calldata data,
uint /*minKeyPrice**/,
uint /*pricePaid**/
) external
{
require(msg.sender == lockAddress, 'UNAUTHORIZED_ACCESS');
address author = bytesToAddress(data);
IPublicLock... | 6,364,900 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.12;
/// @creator: Dumbfoundead
/// @author: op3n.world
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Royalty.sol";
import "@op... | Set baseTokenURI Can only be called by the admin./ | function setBaseTokenURI(string memory baseTokenURI_) external onlyAdmin {
_baseTokenURI = baseTokenURI_;
}
| 13,894,559 |
// File: contracts/GodMode.sol
/****************************************************
*
* Copyright 2018 BurzNest LLC. All rights reserved.
*
* The contents of this file are provided for review
* and educational purposes ONLY. You MAY NOT use,
* copy, distribute, or modify this software without
* explic... | Close the auction and claim its unrevealed amount as taxes _id The id of the auction to be closed Lookup the auction's info Require that an auction exists Require that the auction hasn't already been closed Require that it is after the reveal span Set the auction to closed If nobody won the auction Mark that there is... | function closeAuction(uint _id) public notPaused
{
AuctionInfo storage _auctionInfo = auctionInfo[_id];
require(0 != _auctionInfo.startTime);
require(!_auctionInfo.closed);
require(_auctionInfo.startTime + bidSpan + revealSpan < now);
_auctionInfo.closed = true;
... | 15,781,775 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, s... | Function to change stake target for variable rewards | function setStakeTarget(uint256 _stakeTarget) external onlyOwner {
require(_stakeTarget > 0, "Please don't break the math!");
stakeTarget = _stakeTarget;
emit SetStakeTarget(stakeTarget);
}
| 5,912,258 |
./partial_match/1/0xc8024fB5C7beD98CcE0e498E54B7D89816B3521B/sources/GenesisLiquidityPool.sol | Get the price of collateral relative to GEX | function collateralQuote() public view returns(uint256) {
if (balanceCollateral == 0)
return (collateralPrice() * 1e18) / initPoolPrice;
return (balanceGEX * 1e18) / balanceCollateral;
}
| 3,668,751 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
import {SafeMath} from '../../dependencies/openzeppelin/contracts/SafeMath.sol';
import {IReserveInterestRateStrategy} from '../../interfaces/IReserveInterestRateStrategy.sol';
import {WadRayMath} from '../libraries/math/WadRayMath.sol';
import {PercentageMa... | Executes a percentage multiplication value The value of which the percentage needs to be calculated percentage The percentage of the value to be calculated return The percentage of value/ | function percentMul(uint256 value, uint256 percentage) internal pure returns (uint256) {
if (value == 0 || percentage == 0) {
return 0;
}
require(
value <= (type(uint256).max - HALF_PERCENT) / percentage,
Errors.MATH_MULTIPLICATION_OVERFLOW
);
return (value * percentage + HALF_... | 65,759 |
./full_match/5/0x05F21089728C02C392bdcaEA1697DCF24d91559f/sources/contracts/VoteScatter.sol | See {IGovernor-castVoteWithReasonAndParamsBySig}./ | function castVoteWithReasonAndParamsBySig(
uint256 proposalId,
uint8 support,
string calldata reason,
bytes memory params,
uint8 v,
bytes32 r,
bytes32 s
) public virtual override nftHolderOnly returns (uint256) {
address voter = ECDSA.recover(
... | 1,942,427 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./interfaces/Constants.sol";
import { PoolParams } from "./interfaces/Types.sol";
import "./interfaces/IVestingPools.sol";
import "./utils/Claimable.sol";
import "./utils/DefaultOwnable.sol";
impor... | Returns token amount the specified stakeholder may withdraw now | function releasableAmount(address holder) external view returns (uint256) {
Stake memory stake = _getStake(holder);
return _releasableAmount(stake, uint256(factor));
}
| 12,762,068 |
pragma solidity ^0.5.15;
pragma experimental ABIEncoderV2;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount... | We might end up with more JUN USTONKSA than we have debt. These will get sent to the treasury for future redemption We might end up with more debt than we have JUN USTONKS. In this case, only redeem MAX(minSponsorTokens, ustonksBalance) The extra debt will need to be handled externally, by either waiting until expiry, ... | function _repayAndWithdraw() internal {
JUN_USTONKS.approve(address(minter), uint256(-1));
SynthMinter.PositionData memory position = minter.positions(
address(this)
);
uint256 ustonksBalance = JUN_USTONKS.balanceOf(address(this));
if (ustonksBalance >= position.t... | 13,907,885 |
./full_match/137/0x44963709F103c7d8611838e0DD3C53e499e05699/sources/Vault.sol | Lets owner pause depositing and harvesting and withdraws all from stake pool | function panic() public onlyOwner {
pause();
uint stake = stakeContract.balanceOf(address(this));
if (stake > 0) {
stakeContract.withdraw(stake);
}
}
| 4,668,064 |
pragma solidity 0.4.18;
// File: contracts/PermissionGroups.sol
contract PermissionGroups {
address public admin;
address public pendingAdmin;
mapping(address=>bool) internal operators;
mapping(address=>bool) internal alerters;
address[] internal operatorsGroup;
address[] internal alertersGro... | Make sure this order actually in the list. | function verifyCanRemoveOrderById(uint32 orderId) private view {
require(orderId != 0 && orderId != HEAD_ID && orderId != TAIL_ID);
Order storage order = orders[orderId];
require(order.prevId != 0 && order.nextId != 0 && order.prevId != TAIL_ID && order.nextId != HEAD_ID);
}
| 10,210,509 |
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
interface IERC20Upgradeable {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf... | https:etherscan.io/address/0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2bcodeL1091 | function mintableCVX(uint256 _amount) public view returns (uint256) {
uint256 _toMint = 0;
uint256 supply = IERC20Upgradeable(rewardTokenCVX).totalSupply();
uint256 cliff = supply.div(ICvxMinter(rewardTokenCVX).reductionPerCliff());
uint256 totalCliffs = ICvxMinter(rewardTokenCVX).to... | 1,553,331 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.6;
// CONTRACT FOR CUSTOMER RELATED OPERATIONS
contract SCFCustomerOperations {
// BookingStatus of customer
enum SCFBookingStatus {INITIATED, CONFIRMED, AIRLINE_CANCELLED_REFUND_COMPLETED, USER_CANCELLED_REFUND_COMPLETED, CLAIM_REFUND_COMPLE... | Get function: Returns flight status update time | function getFlightStatusUpdateTime() public view returns(uint) {
return (_flightData.flight_status_updatetime);
}
| 6,369,711 |
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// Global Enums and Structs
library VestingEntries {
struct VestingEntry {
uint64 endTime;
uint256 escrowAmount;
}
struct VestingEntryWithID {
uint64 endTime;
uint256 escrowAmou... | Part: ISynthetix Mutative Functions Liquidations Restricted Functions | interface ISynthetix {
function anySynthOrSNXRateIsInvalid()
external
view
returns (bool anyRateInvalid);
function availableCurrencyKeys() external view returns (bytes32[] memory);
function availableSynthCount() external view returns (uint256);
function collateral(address ... | 6,274,717 |
//Address: 0x8515ee7b050b62e99444f235fe92cdf1aac6bcff
//Contract name: RaceSmart4h
//Balance: 0 Ether
//Verification Date: 2/27/2018
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.18;
/**
* How addresses of non ERC20 coins were defined:
* address(web3.sha3(coin_symbol_in_upper_case))
*
* Exampl... | Check that we are not out of limit and still can sell tokens: | function sell(address _to, uint256 _value) onlyOwner public returns (bool) {
require(tokensSold.add(_value) <= saleLimit);
require(_to != address(0));
require(_value > 0);
require(_value <= balances[seller]);
balances[seller] = balances[seller].sub(_value);
balance... | 1,015,475 |
./partial_match/3/0x39a57cc583434cA75CC423396760568D3A5629d4/sources/Oracle.sol | decode a UQ112x112 into a uint112 by truncating after the radix point | function decode(uq112x112 memory self) internal pure returns (uint112) {
return uint112(self._x >> RESOLUTION);
}
| 5,053,285 |
./partial_match/4/0xa17583ac2762e659e127E14056DB4a3CA12e95b7/sources/MockChainLinkPriceFeed.sol | getRoundData and latestRoundData should both raise "No data present" if they do not have data to report, instead of returning unset values which could be misinterpreted as actual reported values. | function getRoundData(uint80 _roundId)
external
view
override
returns (
uint80 _rId,
int256 _answer,
uint256 _startedAt,
uint256 _updatedAt,
uint80 _answeredInRound
) {
FeedRecord memory rec = priceFeed[_roundId];
return (_roundId, rec.price, rec.startedAt, r... | 8,651,366 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzep... | Assume fees pay in USDT | function getAllPoolInETH(bool includeVestedILV) external view returns (uint) {
uint USDTAmt = USDT.balanceOf(address(this));
if (USDTAmt > 1e6) {
WETHAmt = (sushiRouter.getAmountsOut(USDTAmt, getPath(address(USDT), address(WETH))))[1];
}
uint USDCAmt = USDC.balanceOf(add... | 372,659 |
pragma solidity ^0.4.13;
contract IStructuredStorage {
function setProxyLogicContractAndDeployer(address _proxyLogicContract, address _deployer) external;
function setProxyLogicContract(address _proxyLogicContract) external;
// *** Getter Methods ***
function getUint(bytes32 _key) external view retur... | Function to emit created event every time conversion happened under AcquisitionCampaign _campaign is the address of the deployed campaign _converterPlasma is the converter address _baseTokens is the amount of tokens bought _bonusTokens is the amount of bonus tokens received _conversionAmount is the amount of conve... | function convertedAcquisition(
address _campaign,
address _converterPlasma,
uint256 _baseTokens,
uint256 _bonusTokens,
uint256 _conversionAmount,
bool _isFiatConversion,
uint _conversionId
)
external
onlyAllowedContracts
{
emit Converte... | 10,197,599 |
./partial_match/8453/0x1365E01C8Ab4C6Cd8db2fE9eA640CD64C2239087/sources/FeeConfiguration.sol | Update the minimum fee allowed. newFee the new minimum fee allowed. | function setMinimumFee(uint16 newFee) external override onlyOwner {
require(newFee <= maximumFee, "cannot update");
minimumFee = newFee;
emit MinimumFee(newFee);
}
| 16,741,751 |
./full_match/1/0xD270702a8344C4801Afbd0951cf17A2798700046/sources/Users/Elena/Source/argent-contracts/contracts/infrastructure/ITokenRegistry.sol | ITokenRegistry TokenRegistry interface/ | interface ITokenRegistry {
function isTokenTradable(address _token) external view returns (bool _isTradable);
function areTokensTradable(address[] calldata _tokens) external view returns (bool _areTradable);
pragma solidity ^0.8.3;
} | 3,175,911 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
contract Bank {
// 此合約的擁有者
address payable private owner;
// 沒 payable 會有 error, 因為 selfdestruct 要求是 payable address.
// 儲存所有會員的ether餘額
mapping (address => uint256) private balance;
// 儲存所有會員的coin餘額
mapping (address => uint256) private... | 提錢 emit WithdrawEvent | function withdraw(uint256 etherValue) external payable {
uint256 weiValue = etherValue * 1 ether;
address payable _sender = payable(msg.sender);
require(balance[_sender] >= weiValue, "your balances are not enough");
balance[_sender] -= weiValue;
_sender.transfer(weiValue);
... | 6,486,496 |
./full_match/80001/0xD8F57aD257B2801A407e685F5cDb02A49D02DF7C/sources/contracts/Contract.sol | Ensure the player has a tool Calculate the rewards they are owed, and pay them out. Send the tool back to the player Update the playertool mapping Update the playerLastUpdate mapping | function withdraw() external nonReentrant {
require(playertool[msg.sender].isData, "You do not have a tool to withdraw.");
uint256 reward = calculateRewards(msg.sender);
rewardsToken.transfer(msg.sender, reward);
toolNftCollection.safeTransferFrom(address(this), msg.sender,playerto... | 5,565,926 |
/**
*Submitted for verification at Etherscan.io on 2021-10-15
*/
// File: contracts/IOceanIncNFTToken.sol
// SPDX-License-Identifier: MIT
pragma experimental ABIEncoderV2;
pragma solidity ^0.8.0;
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IOceanIncNFTToken {
/**
* @dev R... | return the crowdsale secondary sale time./ | function secondaryTime() public view virtual returns (uint256) {
return _secondarySaleTime;
}
| 2,275,895 |
./full_match/97/0x2CEB138B99743f3601982cfe905E69797ddd6A89/sources/project_/contracts/diamond/facets/LimitOrderFacet.sol | todo: 更新 LibPriceFacade 里的价格 | function executeLimitOrder(KeeperExecution[] memory executeOrders) external override {
LibAccessControlEnumerable.checkRole(Constants.KEEPER_ROLE);
require(executeOrders.length > 0, "LimitBookFacet: Parameters are empty");
LibLimitOrder.LimitOrderStorage storage los = LibLimitOrder.limitOrde... | 5,045,096 |
./partial_match/1/0x0654e8168C0aF99c99C2c3d2D3039B5184951ddB/sources/FacultyPool.sol | receive funds. gas limited. min contrib. Now the code we have an open cap, no limits we set it to the default cap | function _receiveDeposit() isOpenContract internal {
require(tx.gasprice <= gasLimit, "Gas too high");
require(address(this).balance <= totalPoolCap, "Deposit will put pool over limit. Reverting.");
Beneficiary storage b = beneficiaries[msg.sender];
uint256 newBalance = b.balance.add... | 2,786,483 |
./partial_match/5/0xC53C7B8129429ba0C8f7cB00791BD0c3d408e535/sources/ManagerFactory.sol | solhint-disable-next-line no-inline-assembly call `CREATE2` w/ 4 arguments. pass along failure message from failed contract deployment and revert. | function debugNewManager(
string calldata tokenName,
string calldata tokenSymbol,
uint256 mintingAmount,
uint256 requireAmount,
uint256 burningAmount
) external payable returns (address result) {
address token =
tokenTemplateKey,
"1... | 16,856,693 |
// SPDX-License-Identifier: MIXED
// File @violinio/defi-interfaces/contracts/IPancakeSwapMC.sol@v0.0.8
// License-Identifier: MIT
pragma solidity ^0.8.0;
interface IPancakeSwapMC {
function BONUS_MULTIPLIER() external view returns (uint256);
function deposit(uint256 _pid, uint256 _amount) external;
fu... | Lists the strategy hashes within a specific range in the listing. | function getStrategies(uint256 from, uint256 amount)
external
view
returns (bytes32[] memory)
{
return getPaginated(strategies, from, amount);
}
| 993,943 |
./full_match/69/0x8e8cb0839211B91CE357783dAeEF92bc52c9D26a/sources/contracts/OptionMarketPricer.sol | Calculates vega utilisation to be used as part of the trade fee. If the trade reduces net standard vega, this component is omitted from the fee. trade The Trade. pricing The Pricing. pricingGlobals The PricingGlobals./ | function getVegaUtil(
IOptionMarket.Trade memory trade,
Pricing memory pricing,
ILyraGlobals.PricingGlobals memory pricingGlobals
) public override pure returns (uint vegaUtil) {
if (abs(pricing.preTradeAmmNetStdVega) >= abs(pricing.postTradeAmmNetStdVega)) {
return 0;
}
uint normVol ... | 13,238,808 |
./partial_match/3/0xeC1556E45e284909432a23d67117Ee7843f8881D/sources/Governance.sol | ~3 days in blocks (assuming 15s blocks) | function votingPeriod() public pure returns (uint) { return 17; } | 5,237,891 |
pragma solidity ^0.4.25;
/**
* @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) {
... | Internal transfer, only can be called by this contract/ Prevent transfer to 0x0 address. Use burn() instead Check if the sender has enough Check for overflows Check if sender is frozen Check if recipient is frozen Save this for an assertion in the future Subtract from the sender Add the same to the recipient Asserts ar... | function _transfer(address _from, address _to, uint256 _value) canTransfer internal {
require(_to != 0x0);
require(balanceOf[_from] >= _value);
require(balanceOf[_to] + _value > balanceOf[_to]);
require(!frozenAccount[_from]);
require(!frozenAccount[_to]);
uint256 pre... | 933,754 |
// SPDX-License-Identifier: MIT
// ██▓▓████████████████████
// ██████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░░░▒▒██████
// ██░░▒▒▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████ ... | Returns contract symbol | function symbol() external view returns(string memory) {
return symbol_;
}
| 1,729,830 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.0;
import "../../interfaces/IGovernance.sol";
import "../../interfaces/IMemberRoles.sol";
import "../../interfaces/INXMMaster.sol";
import "../../interfaces/INXMToken.sol";
import "../../interfaces/ITokenController.sol";
contract VotePower {
string con... | SPDX-License-Identifier: GPL-3.0-only | interface INXMToken {
function burn(uint256 amount) external returns (bool);
function burnFrom(address from, uint256 value) external returns (bool);
function operatorTransfer(address from, uint256 value) external returns (bool);
function mint(address account, uint256 amount) external;
function isLockedFo... | 6,326,149 |
pragma solidity >=0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIAB... | Initial funding for the insurance. Unless there are too many delayed flights resulting in insurance payouts, the contract should be self-sustaining/ | function fund(address airlineAddress)public payable
requireIsOperational requireAirLineRegistered(airlineAddress){
require(msg.value >= 10 ether, "No suffecient funds supplied");
airlines[airlineAddress].funded = true;
fundedAirlinesCount = fundedAirlinesCount.add(1);
emit Airlin... | 12,940,830 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.3;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol";
contract StartAppBank is ERC20 {
constructor( ) ERC20("StartAppToken", "SAT") {
}
function getFreeTokens(uint256 value) public ... | Initalizare marketplace 0 - manager 1 - financier1 2 - financier2 3 - evaluator 4 - freelancer2 5 - freelancer2/ | function initStartApp(address _addr0,address _addr1,address _addr2,
address _addr3,address _addr4, address _addr5) public
{
uint expertise = 1;
string memory name = "ManagerName1";
saveManager( _addr0, name );
name = "Financier1";
saveFinancier(_addr1, na... | 12,704,670 |
./partial_match/7700/0x3Ff1E9004cE02A140628734a3C1a57618F9697d7/sources/src/DelayedWithdrawalTool.sol | claims previously requested and fulfilled orders on behalf of specified address at least 2 cycles should past to complete the request | function _setClaimed(address _account) internal returns (uint256, uint256, uint256) {
uint256 index = requestIndex[_account];
if (index == 0) revert RequestNotFound();
if (index + 1 >= fulfillmentIndex) revert EarlyClaim();
uint256 underlyingAmount = underlyingRequested[_account];... | 3,505,332 |
pragma solidity ^0.4.24;
/*
* FOMO Fast-PlayerBook - v0.3.14
*/
interface PlayerBookReceiverInterface {
function receivePlayerInfo(uint256 _pID, address _addr, bytes32 _name, uint256 _laff) external;
function receivePlayerNameList(uint256 _pID, bytes32 _name) external;
}
contract PlayerBook {
using Na... | ============================================================================== _|_ _ _ | _ . | (_)(_)|_\ .============================================================================== set the new player bool to true | function determinePID(address _addr)
private
returns (bool)
{
if (pIDxAddr_[_addr] == 0)
{
pID_++;
pIDxAddr_[_addr] = pID_;
plyr_[pID_].addr = _addr;
return (true);
return (false);
}
}
| 1,275,744 |
./full_match/80001/0xE0F5dbda323Da22c30A908ACb267Ae56c8AC915B/sources/project_/contracts/GSPTToken.sol | distribute token for team, marketing, foundation, .../ distribute for ecosystem and stacking | function _genesisDistributeAndLock() internal {
address seedAddress = 0x85B74d1285d97A291d400EA37b22Bf74fa10CEbD;
address privateSaleAddress = 0x7df00d4C3b090E8a68B327292A8a60e17b8Dce80;
address presaleAddress = 0xE2Cfbc6B7416295Da77CAE8a0f1502F620Cf36ea;
address publicsaleAddress = ... | 9,506,775 |
./full_match/1/0xEe91188cC5C2623B26da7C326371CE348EE57a6D/sources/gist-314004e0d4de055bd488390866f8ac4a/TokenVesting.sol | Returns information about current account vesting state return releasedTokens - sum of all tokens allowed to be released (already claimed founds included) return salesStageBalance - all bought and earned tokens during sale stages return claimedTokensAmount - already withdrawn amount of tokens To get actual tokensToCla... | function getAddressVestingInfo() external view returns (uint256 releasedTokens, uint256 salesStageBalance, uint256 claimedTokensAmount, uint256 filledTimeframesCount) {
VestingUser memory vestingUserSummary = _vestingUsers[msg.sender];
uint256 timeNow = block.timestamp;
uint256 vestingStartT... | 8,308,114 |
./full_match/1/0x9D2617c00D9aCBEe3c6326DcC8CEfb541e6c6a9c/sources/src/AxiomV02StoragePf.sol | Verify a storage proof for 10 storage slots in a single account at a single block | function attestSlots(IAxiomV0.BlockHashWitness calldata blockData, bytes calldata proof) external {
if (block.number - blockData.blockNumber <= 256) {
require(
IAxiomV0(axiomAddress).isRecentBlockHashValid(blockData.blockNumber, blockData.claimedBlockHash),
"Block... | 2,979,284 |
pragma solidity 0.5.11;
import "../../proxies/smart-wallet/UpgradeBeaconProxyV1.sol";
import "../../../interfaces/DharmaSmartWalletFactoryV2Interface.sol";
import "../../../interfaces/DharmaSmartWalletImplementationV0Interface.sol";
import "../../../interfaces/DharmaKeyRegistryInterface.sol";
/**
* @title DharmaSma... | Private function for determining the salt and the target deployment address for the next deployed contract (using `CREATE2`) based on the contract creation code./ Get the keccak256 hash of the init code for address derivation. Set the initial nonce to be provided when constructing the salt. Declare variable for code si... | function _getSaltAndTarget(
bytes memory initCode
) private view returns (uint256 nonce, address target) {
bytes32 initCodeHash = keccak256(initCode);
nonce = 0;
uint256 codeSize;
while (true) {
)
)
)
)
);
if (codeSize == 0) {
... | 5,357,456 |
./full_match/1/0xf9Cb96dbD94652f00f3a2aeC5539Fb4ebE45ee38/sources/contracts/Auction.sol | Sets the base URI for the token's metadata baseUri The new base URI | function setURI(string calldata baseUri) external onlyOwner {
_setURI(baseUri);
}
| 3,146,925 |
./full_match/80001/0x09403Ef661ec7fA4f20395fB2B91A93F08C779D5/sources/contracts/starter.sol | Calculate rewards for the msg.sender, check if there are any rewards claim, set unclaimedRewards to 0 and transfer the ERC20 Reward token to the user. | function claimRewards() external {
uint256 rewards = calculateRewards(msg.sender) + stakers[msg.sender].unclaimedRewards;
require(rewards > 0, "You have no rewards to claim");
stakers[msg.sender].timeOfLastUpdate = block.timestamp;
for (uint256 i = 0; i < stakers[msg.sender]._stake... | 5,624,072 |
/**
*Submitted for verification at Etherscan.io on 2022-03-03
*/
/**
Contract is by captain ike and frens
,--. ,--. ,--.,--.
,---. ,--,--. ,---. ,-' '-. ,--,--.`--',--,--, `--'| |,-. ,---.
| .--'' ,-. || .-. |'-. .-'' ,-. |,--.| \ ,--.| /| .-. :
\ `--.\ '-' || '-' ' | | \ '-' || || || | | || \ \\ --.
`---... | Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but performing a static call. _Available since v3.3._/ | function functionStaticCall(address target, bytes memory data)
internal
view
returns (bytes memory)
{
return
functionStaticCall(
target,
data,
"Address: low-level static call failed"
);
}
| 2,311,601 |
./full_match/1/0x32e7CfAd2ff05C415f599c66ED860B9b481E4Bc8/sources/src/karmaHeadNFT.sol | Avilable buffered WETH to be claimed by `account` | function claimableWethByAddress(address account) public view returns (uint256) {
return bufferByAddress[account][wethAddress];
}
| 3,111,938 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.