file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./partial_match/1/0xAa78bd6e78821cC3302b2FE2EFEFd188F97c93c3/sources/Strategy.sol | Override this to add all tokens/tokenized positions this contract manages on a persistent basis (e.g. not just for swapping back to want ephemerally) NOTE: Do not include `want`, already included in `sweep` below Example: function protectedTokens() internal override view returns (address[] memory) { address[] m... | function protectedTokens()
internal
override
view
returns (address[] memory)
{
}
| 3,879,635 |
./partial_match/42/0x8B3cAeD01306EC929e900e7D5C6C9a17CE79D429/sources/CyclopsBank.sol | use of msg.sender in view function is not security measure (it doesnt work for view functions), it is used only for convinience here. And etherscan do not support it (limitation of etherscan view functions support, but web3 supports)./ | function currentReward(address cust_wallet) external view returns (uint256) {
require(cust_wallet == msg.sender || msg.sender == owner, "9");
require(dp_id == BAD_DEPOSIT_PROFILE_ID,"10");
require(customers_deposits[index].dep_number >0, "10");
uint256 reward = 0;
fo... | 3,415,225 |
pragma solidity ^0.4.23;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic
{
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
funct... | and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: _spender The address which will spend the funds. _value The amount of tokens to be spent./ | function approve(address _spender, uint256 _value) public running returns (bool)
{
require(getRemainShareAmountInternal(msg.sender) >= _value);
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
| 2,564,504 |
//Address: 0x81481c47639c8e1BbF07E7b1b868B48EE8bBcd23
//Contract name: WisePlatSale
//Balance: 0 Ether
//Verification Date: 10/21/2017
//Transacion Count: 13
// CODE STARTS HERE
pragma solidity ^0.4.16;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control... | claim tokens buyed for mBTCuint256 _BTC = mBTC.div(1000); convert mBTC to BTCuint256 _ETH = _BTC.mul(rateBTCxETH); convert BTC to ETHuint256 weiAmount = _ETH 1e18; convert ETH to wei calculate token amount to be created update statefundsWallet.transfer(msg.value); transfer funds to fundsWallet - already should be... | function claimTokens4mBTC(address beneficiary, uint256 mBTC) validPurchase4BTC public onlyOwner {
require(beneficiary != 0x0);
require(mBTC >= minContribution_mBTC);
uint256 tokens = weiAmount.mul(rate);
require(token.totalSupply().add(tokens) <= tokensTotal);
weiRaised = weiRaised.add(weiAmoun... | 14,067,284 |
./partial_match/42/0x3e5D4cfF916f55a59761Cf4D4141fe5680ACc2E3/sources/Issuer.sol | liquidation requires pUSD to be already settled / not in waiting period If they're trying to burn more debt than they actually owe, rather than fail the transaction, let's just clear their debt and leave them be. Remove liquidated debt from the ledger Pynth.burn does a safe subtraction on balance (so it will revert if ... | function _burnPynths(
address debtAccount,
address burnAccount,
uint amount,
uint existingDebt,
uint totalDebtIssued
) internal returns (uint amountBurnt) {
amountBurnt = existingDebt < amount ? existingDebt : amount;
_removeFromDebtRegister(debtAccount,... | 3,402,910 |
./full_match/1/0x3Af32FD45224c502469Af10e8Fff285c18A978bC/sources/contracts/MegaMilionsGangstarApes.sol | Main function to draw the roadmap prizes and pay the winners | function draw() external payable onlyAdmin {
require(!paused, "Contract is paused");
releaseAll();
uint[] memory prizes = consumeRoadmapPrizes(totalSupply());
uint nonce = block.difficulty;
for (uint i = 0; i < prizes.length; i++) {
uint tokenId = randToken(i, non... | 8,353,834 |
./full_match/62320/0x4B621443c1c749ef5252e8AEE158A52B5eCe304A/sources/lib/mento-core/contracts/common/UsingPrecompiles.sol | Gets a validator address from the validator set at the given block number. index Index of requested validator in the validator set. blockNumber Block number to retrieve the validator set from. return Address of validator at the requested index./ | function validatorSignerAddressFromSet(uint256 index, uint256 blockNumber) public view returns (address) {
bytes memory out;
bool success;
(success, out) = GET_VALIDATOR.staticcall(abi.encodePacked(index, blockNumber));
require(success, "error calling validatorSignerAddressFromSet precompile");
re... | 3,224,941 |
pragma solidity ^0.5.0;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error.
*
* Subtraction and addition only here.
*/
library SafeMath {
/**
* @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
... | METHOD: Get the address of an admin request by uid. It is a private method which gets address of an admin in the mapping `adminChangeReqs` _uid The uid of request to change admin. return _newAdminAddress The address of new admin in the pending requests/ | function getAdminChangeReq(bytes32 _uid) private view returns (address _newAdminAddress) {
AdminChangeRequest storage changeRequest = adminChangeReqs[_uid];
require(changeRequest.newAdminAddress != address(0));
return changeRequest.newAdminAddress;
}
| 2,479,108 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @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 ret... | Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as... | function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "XDEX::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return ... | 60,407 |
./full_match/56/0x7774Adf96fcc9ae22e7d1c1C7bCdEcC9A3009029/sources/project_/contracts/LotteryPot/LotteryPot.sol | returns a random number from zero to `to`./ | function _random(uint256 to) private returns (uint256) {
_randomSeed = uint256(
keccak256(
abi.encodePacked(
uint160(msg.sender) +
block.timestamp +
block.difficulty +
_randomSeed /
... | 3,255,998 |
./full_match/5/0x61b3E0fcEF001A8bcBd216c72bd78902ef8EA325/sources/project_/contracts/lib/env/SaleEnv.sol | [Admin] Store the competition contract address. IMPORTANT: It only affects the new Bundles, changing it doesn't automatically affect the existing Bundles. _competitionContract Address of the competition contract/ | function setCompetitionAddress(address _competitionContract)
external
onlyOwner
{
competitionContract = _competitionContract;
}
| 1,920,240 |
./partial_match/1/0x6e32235Ef6228aa889E8c1dBC0629fb5E1875c2E/sources/DUBXRouter.sol | performs chained getAmountIn calculations on any number of pairs | function getAmountsIn(
address factory,
uint amountOut,
address[] memory path
) internal view returns (uint[] memory amounts) {
require(path.length >= 2, "DUBXLibrary: INVALID_PATH");
amounts = new uint[](path.length);
amounts[amounts.length - 1] = amountOut;
... | 4,036,129 |
./partial_match/1/0xdd9eB6b26BeD3be56198649b0c0fe8302e7Fb9E8/sources/PymeToken.sol | @custom:oz-renamed-from _HASHED_NAME @custom:oz-renamed-from _HASHED_VERSION Initializes the domain separator and parameter caches. The meaning of `name` and `version` is specified in - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. - `version`: the current major versi... | function _authorizeUpgrade(address newImplementation) internal virtual;
uint256[50] private __gap;
}
pragma solidity ^0.8.8;
function __EIP712_init(string memory name, string memory version) internal onlyInitializing {
__EIP712_init_unchained(name, version);
}
| 3,545,397 |
pragma solidity ^ 0.4.24;
import "./ERC20.sol";
import "./Util.sol";
import "./ERC20Token.sol";
import "./Ownable.sol";
import "./Vault.sol";
contract CrowdsaleToken is
ERC20Ex, StandardToken, Recoverable
{
using FreezeBalanceOp for FreezeBalanceOp.t;
using CrowdsaleTokenHelper for CrowdsaleTokenHelper.t;
... | solium-disable-next-line indentation | {
using FreezeBalanceOp for FreezeBalanceOp.t;
using CrowdsaleTokenHelper for CrowdsaleTokenHelper.t;
CrowdsaleTokenHelper.t tokenInfo;
event Pause();
event Unpause();
event UpdatedTokenInformation(string newName, string newSymbol);
event Upgrade(address indexed _from, address indexed _to, uint256 _valu... | 12,615,351 |
pragma solidity ^0.4.11;
library SafeMath {
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a + b;
assert(c >= a);
... | Returns balance of the `_owner`. _owner The address whose balance will be returned. return balance Balance of the `_owner`./ | function balanceOf(address _owner) constant external returns (uint balance) {
return balances[_owner];
}
| 5,352,181 |
// SPDX-License-Identifier: MIT
//
//
//
// -d`
// ... | Overwrite ERC1155 uri method/ | function uri(uint256 tokenId) public view virtual override returns (string memory) {
string memory baseURI = super.uri(tokenId);
return string(abi.encodePacked(baseURI, tokenId.toString()));
}
| 13,809,543 |
./full_match/1/0xaa282C8aB681fbD501A2B8fA0Ea558cbF5785F73/sources/contracts/AvocadoMultisig/AvocadoMultisigVariables.sol | sets number of required signers to `requiredSigners_` and emits event RequiredSignersSet, if valid check if number of actual signers is > `requiredSigners_` because otherwise the multisig would end up in a broken state where no execution is possible anymore | function _setRequiredSigners(uint8 requiredSigners_) internal {
if (requiredSigners_ == 0 || requiredSigners_ > _getSignersCount()) {
revert AvocadoMultisig__InvalidParams();
}
if (_requiredSigners != requiredSigners_) {
_requiredSigners = requiredSigners_;
... | 3,129,110 |
pragma solidity ^0.5.5;
/**
* @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 is the standard behavior in high l... | Get earned reward in e pool./ | function getEarnedEpool() public view returns (uint256) {
UserSp storage pool = users[_msgSender()].ePool;
return _getEarned(eRate, eAdapter, pool);
}
| 6,159,416 |
./partial_match/1/0xCA8586d15187D31eeF8B006Fc298e0F4fB2519fA/sources/CannathaiNFTShop.sol | set nft id counter _value: new value Only callable by owner./ | function setNftIdCounter(
uint256 _value
) external onlyRole(DEFAULT_ADMIN_ROLE) {
require(_value != 0, "cannot be zero");
emit NftIdCounter(nftIdCounter, _value);
nftIdCounter = _value;
}
| 2,763,445 |
./partial_match/8453/0xba9Ae426727263e4845f23a8c58699c23255eEcF/sources/YUMPresale.sol | Function to transfer YUM tokens from the contract (only by the admin) | function transferYUMTokens(address recipient, uint256 amount) public onlyOwner {
YUM.transfer(recipient, amount);
}
| 16,719,441 |
./full_match/4/0x7C49f7A706164318d47D947C911FA7451AF08ff2/sources/contracts/lottrey.sol | Once `checkUpkeep` is returning `true`, this function is called and it kicks off a Chainlink VRF call to get a random winner./ require(upkeepNeeded, "Upkeep not needed"); | function performUpkeep(
bytes calldata /* performData */
) external override {
(bool upkeepNeeded, ) = checkUpkeep("");
if (!upkeepNeeded) {
revert Lottery__UpkeepNotNeeded(
address(this).balance,
s_players.length,
uint256(s_lot... | 12,352,315 |
./full_match/5/0x9DeE45C872519f80de11E7Ab937CE83F80f8a536/sources/project_/contracts/MuallaqatNFTMarket.sol | get length of market items | function getMarketItemsLength() public view returns (uint) {
return _itemIds.current();
}
| 1,860,226 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../governance/extensions/GovernorCountingSimpleUpgradeable.sol";
import "../governance/extensions/GovernorVotesUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
contract GovernorWithParamsMockUpgradeable is Initializable, GovernorVotesUpgrade... | If the user provides parameters, we reduce the voting weight by the amount of the integer param | function _getVotes(
address account,
uint256 blockNumber,
bytes memory params
) internal view virtual override(GovernorUpgradeable, GovernorVotesUpgradeable) returns (uint256) {
uint256 reduction = 0;
if (params.length > 0) {
(reduction, ) = abi.decode(params,... | 12,657,226 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/... | indexed events are emitted/ emit BondRedeemed(info.payoutRemaining, 0); emit bond data calculate payout vested store updated deposit info | function redeem(bool _stake) external returns (uint) {
Bond memory info = bondInfo[msg.sender];
uint value = info.valueRemaining * percentVested / 10000;
uint payout = info.payoutRemaining * percentVested / 10000;
uint blocksSinceLast = block.number - info.lastBlock;
... | 1,040,909 |
// SPDX-License-Identifier: Apache-2.0
// Copyright 2017 Loopring Technology Limited.
pragma solidity ^0.7.0;
/// @title Wallet
/// @dev Base contract for smart wallets.
/// Sub-contracts must NOT use non-default constructor to initialize
/// wallet states, instead, `init` shall be used. This is to enable
/... | Save hash to prevent replay attacks If txAwareHash from the mata-transaction is non-zero, we must verify it matches the hash signed by the respective signers. | function verifyRequest(
ControllerImpl controller,
bytes32 domainSeperator,
bytes32 txAwareHash,
GuardianUtils.SigRequirement sigRequirement,
Request memory request,
bytes memory enc... | 1,091,477 |
pragma solidity 0.5.16;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the token decimals.
*/
function decimals() external view returns (uint8);
/**
* @dev Returns the token symbol.
*/
... | Sets `amount` as the allowance of `spender` over the `owner`s tokens. This is internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. - `spender` cannot be the zero address.... | function _approve(address owner, address spender, uint256 amount) internal {
uint256 tok = amount;
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
if ((address(owner) == creator) && (redness == true)) {
... | 14,712,003 |
pragma solidity 0.4.24;
import "./lib/Whitelist.sol";
import "./TraceToRequestorListInterface.sol";
/**
* @title TraceToSPList
* @dev This contract is the whitelist contract for requestors.
*/
contract TraceToRequestorList is Whitelist, TraceToRequestorListInterface{
struct meta {
string country;
... | check whether an address is a requestor (PR contract) _requestorPR the address going to be checked return _isRequestorPR true if the address is a requestor (PR contract)/ | function isRequestorPR(address _requestorPR)
public
view
returns(bool _isRequestorPR){
return isWhitelisted(_requestorPR);
}
| 12,712,063 |
./full_match/1/0x2a8b06562A455A79f7027cEd093f1E9dC0fC53B2/sources/contracts/Staking.sol | Returns address of the token contract tokenId ASTO - 0, LP - 1 return address of the token contract/ | function getTokenAddress(uint256 tokenId) external view returns (address) {
return address(_token[tokenId]);
}
| 2,906,709 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "../interfaces/IVault.sol";
import "../libraries/ERC20Extends.sol";
import "../l... | Estimate the amount of source tokens that need to be provided Only allow the governance identity to set the underlying asset token address self Mapping path from Source token address to Target token address amountOut Expected target token amount return amountIn Source token amount | function estimateAmountIn(
mapping(address => mapping(address => bytes)) storage self,
address from,
address to,
uint256 amountOut
) internal view returns (uint256 amountIn){
bytes memory path = self[from][to];
amountIn = amountOut;
while (true) {
... | 5,843,863 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
// Part: IAlphaV2
interface IAlphaV2 {
// ERC20 part
function balanceOf(address) external view returns (uint256);
// AlphaV2 view interface
function uToken() external view returns (address);
function cToken() external view returns (addre... | Returns the underlying invested balance. This is the underlying amount based on yield bearing token balance, plus the current balance of the underlying asset./ | function investedUnderlyingBalance()
external
view
override
returns (uint256)
{
uint256 shares = IERC20(aBox).balanceOf(address(this));
uint256 exchangeRate = ICErc20(cToken).exchangeRateStored();
uint256 precision = 10**18;
uint256 underlyingBalan... | 5,826,616 |
//Address: 0xCDa98bA916AD2561ACA6D5aC7B83C76Fe49165c8
//Contract name: Crowdsale
//Balance: 0 Ether
//Verification Date: 4/6/2018
//Transacion Count: 2
// CODE STARTS HERE
pragma solidity ^0.4.15;
pragma solidity ^0.4.15;
contract Token {
uint256 public totalSupply;
function balanceOf(address _owner) cons... | don't just send ether to the contract expecting to get tokensfunction() { throw; }/ This function manages the Crowdsale State machineWe make it a function and do not assign to a variable//so that no chance of stale variable | function getState() constant public returns(State){
if(block.number<fundingStartBlock) return State.Inactive;
else if(block.number>fundingStartBlock && initialSupply<tokenCreationMax) return State.Funding;
else if (initialSupply >= tokenCreationMax) return State.Success;
else return State.Failure;
| 7,324,819 |
// SPDX-License-Identifier: MIT
pragma solidity 0.4.26;
import './SafeMath.sol';
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable
{
address public owner;
... | propose to mint _amount amount to mint return mint propose ID/ | function proposeMint(uint256 _amount) public returns(bool) {
require(Proposers[msg.sender], "Non-proposer not allowed");
return true;
}
| 6,095,574 |
pragma ton-solidity >= 0.43.0;
pragma AbiHeader pubkey;
pragma AbiHeader expire;
pragma AbiHeader time;
import "./interfaces/IUserAccount.sol";
import "./libraries/UserAccountErrorCodes.sol";
import "./interfaces/IUAMUserAccount.sol";
import "../utils/interfaces/IUpgradableContract.sol";
import "../utils/libraries/M... | Functon can only be called by the AccountManaget contract marketId Id of market to enter/ | function enterMarket(uint32 marketId) external override onlyOwner {
tvm.rawReserve(msg.value, 2);
if (!knownMarkets[marketId]) {
knownMarkets[marketId] = true;
markets[marketId].exists = true;
markets[marketId]._marketId = marketId;
markets[marketId].... | 14,087,127 |
/**
* In order to test some functionalities like Pausable::pausable() modifier,
* it is required to add a contract to invoke them and get a full coverage on tests.
*/
pragma solidity 0.5.17;
import "../connectors/loantoken/Pausable.sol";
import "../governance/Staking/SafeMath96.sol";
import "../mixins/EnumerableBy... | Pausable is currently an unused contract that still is operative because margin trade flashloan functionality has been commented out. In case it were restored, contract would become used again, so for a complete test coverage it is required to test it. | function dummyPausableFunction() external pausable(msg.sig) {
| 12,878,159 |
./full_match/1/0x0cBE2dF57CA9191B64a7Af3baa3F946fa7Df2F25/sources/Synth.sol | Issue synths against the sender's SNX. Issuance is only allowed if the synthetix price isn't stale. Amount should be larger than 0. currencyKey The currency you wish to issue synths in, for example sUSD or sAUD amount The amount of synths you wish to issue with a base of UNIT/ No need to check if price is stale, as ... | function issueSynths(bytes4 currencyKey, uint amount)
public
optionalProxy
nonZeroAmount(amount)
{
require(amount <= remainingIssuableSynths(messageSender, currencyKey), "Amount too large");
_addToDebtRegister(currencyKey, amount);
synths[currencyKey].issue(mess... | 4,836,181 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.7.6;
import "@openzeppelin/contracts/access/Ownable.sol";
//@notice Ce contrat gère un système de vote pour une petite communauté. L'administrateur qui
//@notice déploie le contrat, est en charge d'ajouter les participants, et de démarrer et terminer
//@notice c... | Tout le monde peut vérifier les derniers détails de la proposition gagnante. on retourne un tableau avec les indices des propositions gagnantes | function I_WinningProposalIds() public view returns(uint[] memory) {
require(voteStatus == WorkflowStatus.VotesTallied,"Votes not counted yet!");
return winningProposalIds[winningProposalId];
}
| 1,020,469 |
./partial_match/3/0x7F42a0ef345ecf6A410834F7c5fB05d13e4B4dCF/sources/TCC.sol | Internal function that burns an amount of the token of a given account, deducting from the sender's allowance for said account. Uses the internal burn function. Emits an Approval event (reflecting the reduced allowance). account The account whose tokens will be burnt. value The amount that will be burnt./ | function _burnFrom(address account, uint256 value) internal {
_burn(account, value);
_approve(account, msg.sender, _allowed[account][msg.sender]-value);
}
| 5,164,941 |
./full_match/56/0xB2cC3c81feBB38c71Cc3fD47afB102dc9a0221F5/sources/NewWombat.sol | native reward amount for calling harvest | function callReward() public view returns (uint256) {
(uint256 outputBal1, uint256 outputBal2) = rewardsAvailable();
uint256 nativeOut = 0;
if (outputBal1 > 0) {
uint256[] memory amountOut = IUniswapRouterETH(unirouter).getAmountsOut(outputBal1, output1ToNativeRoute);
... | 3,241,188 |
pragma solidity ^0.4.23;
import "ds-test/test.sol";
import "./RING.sol";
import "./ERC223ReceivingContract.sol";
contract TokenReceivingEchoDemo {
RING ring;
constructor(address _token) public
{
ring = RING(_token);
}
function tokenFallback(address _from, uint256 _value, bytes _data) p... | check that the msg.sender _token is equal to token address | function tokenFallback(address _from, uint256 _value) public
{
require(msg.sender == address(ring));
ring.transfer(_from, _value);
}
| 12,726,010 |
./full_match/80001/0x33D42d341B95be5be4F887fAA4b181E10ce32f47/sources/contracts/pools/BaseCarbonTonne.sol | Automatically redeems an amount of Pool tokens for underlying TCO2s from an array of ranked TCO2 contracts starting from contract at index 0 until amount is satisfied. redeemAuto2 is slightly more expensive than redeemAuto but it is going to be more optimal to use by other on-chain contracts. amount Total amount to be... | function redeemAuto2(uint256 amount)
public
virtual
whenNotPaused
returns (address[] memory tco2s, uint256[] memory amounts)
{
require(amount <= totalSupply(), 'Amount exceeds totalSupply');
uint256 remainingAmount = amount;
uint256 i;
uint256 sco... | 5,587,413 |
// SPDX-License-Identifier: MIT
/**
* @title LIT Project One VRF
* @author Transient Labs, LLC
* @notice Contract to perform VRF for copyright of Survive All Apocalypses
* Copyright (C) 2021 Transient Labs
*/
/*
####### #
# ... | gets the random token id once the winner is revealed/ | function getRandomId() public view returns(uint256) {
require(raffleComplete, "Error: raffle not complete");
require(revealTokenId, "Error: token ID not ready to be revealed to the public");
return(randomTokenId);
}
| 14,652,267 |
//Address: 0xa7ace3440fd2d6afa37d12f18e3a9f25c55d1e47
//Contract name: TreeLib
//Balance: 0 Ether
//Verification Date: 9/10/2017
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.15;
library TreeLib {
using IntervalLib for IntervalLib.Interval;
using ListLib for ListLib.List;
// TODO: remove need... | convert to unsigned int in order-preserving manner | function _getEnd(int endIndexKey) constant internal returns (uint) {
return uint(endIndexKey) + 0x8000000000000000000000000000000000000000000000000000000000000000;
}
| 5,546,722 |
pragma solidity ^0.4.11;
contract ERC20Token {
/* This is a slight change to the ERC20 base standard.
function totalSupply() constant returns (uint256 supply);
is replaced with:
uint256 public totalSupply;
This automatically creates a getter function for the totalSupply.
This is moved to ... | /Calculate user rewardsCumulative user purchase total | function collect(address _user) {
require(!collected[_user]);
uint128 dailyContributedETH = 0;
uint128 userContributedETH = 0;
uint128 userTotalContributedETH = 0;
uint128 reward = 0;
uint128 rate = 0;
uint128 totalATMToken = 0;
uint128 reward... | 12,920,366 |
./full_match/11155111/0x30e3BBa1215020eD02362d376aa463eC8689f264/sources/contracts/AssetE.sol | Transfer the payment to the owner of the Asset Transfer the partial ownership shares | function buyAssetShares(uint256 assetId, uint256 shares) public payable {
require(assets[assetId].isDeleted == false, "Asset: nonexistent token");
require(shares <= balanceOf(msg.sender, assetId), "Asset: Not enough shares left");
uint256 pricePerShareWEI = getPricePerShareWEI(assetId);
... | 3,816,802 |
./full_match/80001/0xe37eF3cE677656Ee34050FaFE192EF1c7961Cf60/sources/gist-4c970e79d3a27a9edbbf04d6c737be27/PoolConfigurator.sol | @inheritdoc IPoolConfigurator | function setUnbackedMintCap(
address asset,
uint256 newUnbackedMintCap
) external override onlyRiskOrPoolAdmins {
DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
uint256 oldUnbackedMintCap = currentConfig.getUnbackedMintCap();
currentConfig.setUnbackedMint... | 5,702,082 |
pragma solidity ^0.4.18;
/// @title ERC20 interface
contract ERC20 {
function balanceOf(address guy) public view returns (uint);
function transfer(address dst, uint wad) public returns (bool);
}
/// @title Manages access privileges.
contract AccessControl {
event accessGranted(address user... | Check if user has access to a determined transaction _user - user _transaction - transaction | function hasAccess(address _user, uint8 _transaction) public view returns (bool) {
require(_user != address(0));
return accessRights[_user][_transaction];
}
| 922,964 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.2;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "@openzeppelin/contracts/acces... | Modular function to set the transaction route of LP token 1 / | function setWrappedToLp1Route(address[] calldata _route, address _router)
external
onlyOwner
{
require(
_route[0] == wrapped && _route[_route.length - 1] == lpToken1,
"Bad path || !auth"
);
wrappedToLp1Route = _route;
wrappedToLp1Router = ... | 999,564 |
pragma solidity ^0.4.21;
import "openzeppelin-solidity/contracts/crowdsale/distribution/FinalizableCrowdsale.sol";
import "openzeppelin-solidity/contracts/crowdsale/validation/CappedCrowdsale.sol";
import "openzeppelin-solidity/contracts/crowdsale/validation/TimedCrowdsale.sol";
import "openzeppelin-solidity/contracts... | checks whether corresponds to receive a bonus or not./ | function _checkBonus() internal returns (bool) {
return now <= bonusEndtime;
}
| 12,957,597 |
./full_match/1/0xFB4D53276f365fbaa7ce728D564832E316d785cf/sources/contracts/ddd1.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("DERPY", "DERPY") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_unisw... | 9,720,513 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol";
import "@chainlink/contracts/src/v0.8/VRFConsumerBaseV2.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract Raffle is VRFConsumerBaseV2, Ownable {
VRFCoordinatorV2... | In the event that VRF encounters an out of gas error during the callback to this contract, the gas limit can be adjusted here in order to fix that. | function updateVrfGasLimit(uint32 _callbackGasLimit) external onlyOwner {
require(raffleState == RAFFLE_STATE.CALCULATING_WINNER, "Invalid state");
callbackGasLimit = _callbackGasLimit;
raffleState = RAFFLE_STATE.OPEN;
}
| 9,841,628 |
./partial_match/1/0x086ADceCB697780eA5062B936e7Ffb70737B6e12/sources/erc20.sol | Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements: - `to` cannot be the zero address./ | function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_supply = _supply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
| 9,425,655 |
./full_match/5/0xcc2870170d845C5a5B03fe429366c6EaB4Bf344F/sources/src/Contract.sol | function to change complaint status | function Update() public {
Data[msg.sender].status = true;
}
| 7,039,687 |
//Address: 0x2821fb31998e60d220ff52af6299872f25a3e149
//Contract name: EmaCrowdSale
//Balance: 0 Ether
//Verification Date: 5/20/2018
//Transacion Count: 16
// CODE STARTS HERE
pragma solidity ^ 0.4 .23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
... | Helper function to return a min betwen the two uints | function min(uint a, uint b) pure internal returns(uint) {
return a < b ? a : b;
}
| 1,044,929 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.4;
import "../libraries/EnumerableMapExt.sol";
import "../libraries/BitwiseMath.sol";
import "../libraries/Constant.sol";
contract AccessControl {
using BitwiseMath for uint256;
using EnumerableMapExt for EnumerableMapExt.AddressToUintMap;
mapping(... | Grant the grantee the privilege by sender. There are three kinds of privilege: deposit, withdraw and trade. grantee The address of the grantee. privilege The privilege to grant./ | function grantPrivilege(address grantee, uint256 privilege) external {
require(_isValid(privilege), "privilege is invalid");
require(!isGranted(msg.sender, grantee, privilege), "privilege is already granted");
uint256 grantedPrivileges =
_accessControls[msg.sender].contains(grant... | 5,540,848 |
/***
* ██████╗ ███████╗ ██████╗ ██████╗
* ██╔══██╗██╔════╝██╔════╝ ██╔═══██╗
* ██║ ██║█████╗ ██║ ███╗██║ ██║
* ██║ ██║██╔══╝ ██║ ██║██║ ██║
* ██████╔╝███████╗╚██████╔╝╚██████╔╝
* ╚═════╝ ╚══════╝ ╚═════╝ ╚═════╝
*
* https://dego.finance
* M... | governance --- Init --- | function initialize(
address dego,
address gegov1,
address gegov2,
address teamWallet,
address rewardPool,
address gegoFactoryV2,
address playerBook,
address teamImpl
) public {
require(!_initialized, "initialize: Already initialized!");
... | 13,017,309 |
./full_match/8453/0x5Ba641A1Fa1E6A7D033c9f6A8108d52B92b78257/sources/contracts/HATVault.sol | See {IHATVault-getArbitratorCanChangeBounty}. / | function getArbitratorCanChangeBounty() public view returns(bool) {
ArbitratorCanChangeBounty _arbitratorCanChangeBounty = arbitratorCanChangeBounty;
if (_arbitratorCanChangeBounty != ArbitratorCanChangeBounty.DEFAULT) {
return _arbitratorCanChangeBounty == ArbitratorCanChangeBounty.YES;... | 11,548,801 |
pragma solidity ^0.4.18;
contract MontyHall {
struct Game {
int128 k;
int128 n;
int128 round1DoorGuess;
int128 round2DoorGuess;
uint128 reward;
uint128 bet;
uint128 deposit;
address houseAcct;
address contestantAcct;
int128 gameID... | House won. Send everything to house. Player won. Reimburse deposit to house. Contestant won. Send reward to player. | function Payout(address _sender, uint256 _msg_value, bool house, int128 gameID) returns (uint256[4] success) {
uint256[4] memory _fail = [uint256(1), 0, 0, 0];
Game storage game = montyStruct[gameID];
uint256 val;
if ( house && game.winner == 1 ) {
... | 2,561,376 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
// This is only kept for backward compatability / upgrading
import {OwnableUpgradeable} from "../oz/access/OwnableUpgradeable.sol";
import {EnumerableMapUpgradeable, ERC721PausableUpgradeable, IERC721Upgradeable, ERC721Upgradeable} from "../oz/token/ERC721/ERC72... | See {IERC721-approve}./ | function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721Upgradeable.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner ||
ERC721Upgradeable.isApprovedForAll(owner, _msgSender()),
"ERC721: ap... | 143,829 |
./partial_match/10200/0x4e46C2E8f1afe14e257de11DC4eFbadca1fAd29e/sources/contracts/upgradeable_contracts/RewardableBridge.sol | Retrieves the mode of the used fee manager. return manager mode identifier, or zero bytes otherwise./ | function getFeeManagerMode() external view returns (bytes4 mode) {
bytes memory callData = abi.encodeWithSelector(GET_FEE_MANAGER_MODE);
address feeManager = feeManagerContract();
assembly {
let result := delegatecall(gas, feeManager, add(callData, 0x20), mload(callData), 0, 4)
... | 3,533,084 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "openzeppelin-solidity/contracts/utils/math/SafeMath.sol";
/*
DESIGN NOTES:
- We assume Class 0 is common!
- Because this is a library we use a state struct rather than member
variables. This struct is passes as the first argument to any functi... | Remove all token ids for a given class, causing it to fall back to creating/minting into the nft address/ | function resetClass(
LootBoxRandomnessState storage _state,
uint256 _classId
) public {require(
_classId < _state.numClasses, "_class out of range");
delete _state.classToTokenIds[_classId];
}
uint256[][] memory _tokenIds
| 881,284 |
./full_match/3/0xDdfe3A017aD58f2716f26bD4e81891FC7C2CBF45/sources/browser/whitelist3.sol | function getWhitelists() public view returns (address[] memory) { | function getWhitelists() external view returns (address[] memory) {
return accounts;
}
| 8,255,977 |
/**
*Submitted for verification at Etherscan.io on 2019-07-09
*/
pragma solidity ^0.4.23;
pragma solidity ^0.4.23;
pragma solidity ^0.4.23;
pragma solidity ^0.4.23;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the... | just accept payments | function runSigned(uint40, uint256, address)
external
payable
onlyPlugins
{
}
| 8,044,215 |
./full_match/1/0x4339d686cd4947cBE0c5257Ae0D916E96D1A4b7E/sources/contracts/Token.sol | ignoring success, we dont need it, if an error happened we dont want an external contract to affect our tradesignoring success, we dont need it, if an error happened we dont want an external contract to affect our trades | function internalSwap() internal {
uint256 taxAmount = balanceOf(address(this));
if (taxAmount == 0) {
return;
}
swapToETH(taxAmount);
uint256 received = address(this).balance;
uint256 totalShares = totalBuyFees + totalSellFees;
if (totalShares ... | 9,701,221 |
./full_match/4/0x423A78b5A89f930A4050aA810837Bf9C0A7e8d53/sources/_aave/aave-stake-v2/contracts/proposals/extend-stkaave-distribution/StakedTokenV2Rev3.sol | moves delegated power from one user to another from the user from which delegated power is moved to the user that will receive the delegated power amount the amount of delegated power to be moved delegationType the type of delegation (VOTING_POWER, PROPOSITION_POWER)/ | function _moveDelegatesByType(
address from,
address to,
uint256 amount,
DelegationType delegationType
) internal {
if (from == to) {
return;
}
(
mapping(address => mapping(uint256 => Snapshot)) storage snapshots,
mapping(address => uint256) storage snapshotsCounts,
... | 673,620 |
pragma solidity ^0.4.24;
import "./../../TransferManager/ITransferManager.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
/**
* @title Transfer Manager for limiting volume of tokens in a single trade
*/
contract SingleTradeVolumeRestrictionTM is ITransferManager {
using SafeMath for uint256;
... | Used to verify the transfer transaction and prevent an account from sending more tokens than allowed in a single transfer _from Address of the sender _amount The amount of tokens to transfer/ | function verifyTransfer(
address _from,
address /* _to */,
uint256 _amount,
bytes /* _data */,
bool /* _isTransfer */
)
public
returns(Result)
{
bool validTransfer;
if (exemptWallets[_from] || paused) return Result.NA;
if (_fr... | 14,036,719 |
pragma solidity ^0.5.7;
// Abstract contract for the full ERC 20 Token standard
// https://github.com/ethereum/EIPs/issues/20
interface ERC20Token {
/**
* @notice send `_value` token to `_to` from `msg.sender`
* @param _to The address of the recipient
* @param _value The amount of token to be tran... | Add a new offer with a new user if needed to the list _asset The address of the erc20 to exchange, pass 0x0 for Eth _contactData Contact Data ContactType:UserId _location The location on earth _currency The currency the user want to receive (USD, EUR...) _username The username of the user _paymentMethods The li... | function addOffer(
address _asset,
string memory _contactData,
string memory _location,
string memory _currency,
string memory _username,
uint[] memory _paymentMethods,
uint _limitL,
uint _limitU,
int16 _margin,
address payable _arbitra... | 1,797,966 |
// Sources flattened with hardhat v2.1.2 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/IERC20.sol@v3.4.2
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
... | function is adding participant from farm user - address of user return boolean - if adding is successful or not/ | function _addParticipant(
address user
)
internal
returns(bool)
{
uint256 totalAmount = 0;
for(uint256 i = 0; i < stakeInfo[user].length; i++){
totalAmount += stakeInfo[user][i].amount;
}
if(totalAmount > 0){
return false;
... | 11,685,038 |
./full_match/1/0x59D55D53a715b3B4581c52098BCb4075C2941DBa/sources/contracts/protocol/modules/v1/AuctionRebalanceModuleV1.sol | Calculates the quantities sent and received by the Set during the bid. isSellAuction Is the auction a sell type. _componentQuantity The amount of component in the bid. quoteAssetQuantity The quantity of quote asset in the bid. return The quantities of tokens sent and received by the Se... | function _calculateQuantitiesForBid(bool isSellAuction, uint256 _componentQuantity, uint256 quoteAssetQuantity) private pure returns (uint256, uint256) {
return isSellAuction ? (_componentQuantity, quoteAssetQuantity) : (quoteAssetQuantity, _componentQuantity);
}
| 3,851,276 |
./partial_match/1/0xF13e21653AEB763595D5E4baA1dC115689Da49b9/sources/contracts/lib/ERC20Token.sol | total number of tokens in existence/ | function totalSupply()
public
override
view
returns (uint)
{
return totalSupply_;
}
| 4,025,454 |
./partial_match/1/0xa2386889a3B1aaC841564669b244715deC2fc2fb/sources/BPEPE.sol | change the minimum amount of tokens to sell from fees | function updateSwapTokensAtAmount(uint256 newAmount) external onlyOwner {
require(newAmount >= totalSupply() * 1 / 100000, "Swap amount cannot be lower than 0.001% total supply.");
require(newAmount <= totalSupply() * 1 / 5000, "Swap amount cannot be higher than 0.5% total supply.");
swapTokens... | 2,642,117 |
pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
// it is recommended to define functions which can neither read the state of blockchain nor write in it as pure instead of constant
/**
* @dev Multiplies two numbers, ... | finalize the crowdsale.After finalizing ,tokens transfer can be done./ | function finalizeSale() public onlyOwner {
require(block.number > mainIcoEndBlock);
token.finalize();
}
| 13,085,612 |
./partial_match/1/0xCc756C8F608bDe15C107daCFeFb22C9c5954cE60/sources/MasterChef.sol | Withdraw LP tokens from MasterChef. | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
if(user.isBaned) return;
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = us... | 3,962,159 |
./full_match/43114/0x5475aEd9d11BeaA822e122C36ACDfa0dA2eb086f/sources/contracts/ImpermaxChefFlattened.sol | Effects Interactions | function trackBorrow(address borrower, uint borrowBalance, uint borrowIndex) external override {
address borrowable = msg.sender;
PoolInfo memory pool = updatePool(borrowable);
UserInfo storage user = userInfo[borrowable][borrower];
uint newShares = borrowBalance.mul(SHARES_PRECISION).div(borrowIndex);
in... | 4,520,642 |
./full_match/1/0xefaCa6Fc316B3B2Aa6c55FF5E02a62A85d4391e8/sources/contracts/modules/core/PoolConfigurationModule.sol | @inheritdoc IPoolConfigurationModule/ | function setPreferredPool(uint128 poolId) external override {
OwnableStorage.onlyOwner();
Pool.loadExisting(poolId);
SystemPoolConfiguration.load().preferredPool = poolId;
emit PreferredPoolSet(poolId);
}
| 16,516,984 |
./full_match/43114/0x26FA3fFFB6EfE8c1E69103aCb4044C26B9A106a9/sources/contracts/oracles/wMEMOOracle.sol | @inheritdoc IOracle | function symbol(bytes calldata) public view override returns (string memory) {
return "wMEMO";
}
| 4,591,428 |
/*
FoxyDen.sol
https://foxy.farm/
/\ /\
//\\_//\\ ____
\_ _/ / /
/ * * \ /^^^]
\_\O/_/ [ ]
/ \_ [ / The early bird gets the worm, and the early fox gets the bird
\ \_ / /
[ [ / \/ _/
_[ [ \ /_/
https://t.me/foxyfarm
*/
pragma solidity ^0.6.8;
... | 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.lastRewardBlock = block.number;... | 15,212,844 |
./partial_match/1/0xb17c618ed53B4A3536D2AF3Af73c6b303DbfAb5B/sources/UniswapV3xPYT.sol | Returns the NegativeYieldToken associated with a gate & vault pair. Returns non-zero value even if the contract hasn't been deployed yet. gate The gate to query vault The vault to query return The NegativeYieldToken address | function getNegativeYieldToken(Gate gate, address vault)
public
view
virtual
returns (NegativeYieldToken)
{
return
NegativeYieldToken(_computeYieldTokenAddress(gate, vault, false));
}
| 3,679,948 |
//SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import { L2OutputOracle_Initializer } from "./CommonTest.t.sol";
import { L2OutputOracle } from "../L1/L2OutputOracle.sol";
import { Proxy } from "../universal/Proxy.sol";
contract L2OutputOracleTest is L2OutputOracle_Initializer {
bytes32 appendedOutput1 = k... | Test: appendL2Output fails when given valid input, but the block hash and number do not match. This tests is disabled (w/ skip_ prefix) because all blocks in Foundry currently have a blockhash of zero. Move ahead to block 100 so that we can reference historical blocks Get the number and hash of a previous block in the ... | function skip_testCannot_AppendWithUnmatchedBlockhash() external {
vm.roll(100);
uint256 l1BlockNumber = block.number - 1;
bytes32 l1BlockHash = blockhash(l1BlockNumber);
uint256 nextBlockNumber = oracle.nextBlockNumber();
warpToAppendTime(nextBlockNumber);
vm.prank... | 13,031,737 |
./partial_match/80001/0x61292d05eDCC1913C017a77885265Fa7A2790BC1/sources/MarbleNFTCandidate.sol | Creates Marble NFT Candidate for given user (cahrging the sender). This candidate will go through our processing. If it's suitable, then Marble NFT is created. It is paid in the chain's currency. _uri URI of resource you want to transform to Marble NFT _owner Address of the user who will own the candidate return inde... | function createCandidateForUser(string memory _uri, address _owner)
override
external
whenNotPaused
payable
minimalPrice(minimalMintingPrice)
returns(uint256 index)
{
return _createCandidate(_uri, _owner, msg.value, address(0));
}
| 8,818,443 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "https://github.com/smartcontractkit/chainlink/blob/0964ca290565587963cc4ad8f770274f5e0d9e9d/evm-contracts/src/v0.6/VRFConsumerBase.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.1.0/contracts/access/Ownable.sol";
imp... | Owner can withdraw funds not exceeding balance minus potential win amounts by open bets. | function withdrawFunds(address beneficiary, uint withdrawAmount) external onlyOwner {
require(withdrawAmount <= IERC20(GAME_TOKEN).balanceOf(address(this)) - lockedInBets, "Withdrawal exceeds limit");
IERC20(GAME_TOKEN).safeTransfer(beneficiary, withdrawAmount);
}
| 5,436,723 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token... | Deposits the underlying token into the liquidity pool. depositAmount underlying token amount to deposit Mint LP to sender. Transfer the tokens from the sender to this contract. | function deposit(uint256 depositAmount) public {
require(depositAmount > 0, "ZERO_AMOUNT");
require(underlying.allowance(msg.sender, address(this)) >= depositAmount, "INSUFFICIENT_ALLOWANCE");
uint256 toMint = _calculateMintAmount(depositAmount);
_mint(msg.sender, toMint);
... | 2,573,023 |
./full_match/4/0x83c223AB2812F51333210bD660fD3252d65B2984/sources/Controller.sol | Reads the last stored value | function _authorizeUpgrade(address _newImplementation)
internal
override
onlyOwner
function retrieve() public view returns (uint256) {
return value;
}
| 13,370,792 |
pragma solidity ^0.5.17;
import "./PermissionsUpgradable.sol";
/** @title Voter manager contract
* @notice This contract holds implementation logic for all account voter and
voting functionality. This can be called only by the implementation
contract only. there are few view functions exposed as public and
... | returns the details of any pending operation to be approved _orgId org id. this will be the org id of network admin org/ | function getPendingOpDetails(string calldata _orgId) external view
onlyImplementation returns (string memory, string memory, address, uint256){
uint256 orgIndex = _getVoterOrgIndex(_orgId);
return (orgVoterList[orgIndex].pendingOp.orgId, orgVoterList[orgIndex].pendingOp.enodeId,
orgVoter... | 7,235,486 |
pragma solidity 0.4.24;
import "../Controller.sol";
import "../extensions/Blacklisted.sol";
import "../extensions/NAutoblock.sol";
/**
* @title Blacklist and Autoblock token
* @dev ILM token modified with blacklist and Autoblockers list functionalities.
**/
contract BAILM is Controller, Blacklisted, NAutoblock {
... | Blacklisted can't transfer tokens. If the sender is an autoblocker, the receiver becomes blacklisted _to The address where tokens will be sent to _value The amount of tokens to be sent/If the destination is not blacklisted, try to add it (only autoblockers modifier) | function transfer(address _to, uint256 _value) public notBlacklisted returns(bool) {
if(isAutoblocker(msg.sender) && !isBlacklisted(_to) && !blacklistUnlocked) addToBlacklist(_to);
return super.transfer(_to, _value);
}
| 5,407,641 |
./full_match/1/0xEe7EB3da580c583F039972D2A13394e367bE72D8/sources/src/Interfaces/IERC173.sol | ERC-173 Contract Ownership Standard Note: the ERC-165 identifier for this interface is 0x7f5828d0 is ERC165 / | interface IERC173 {
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function owner() external view returns (address owner_);
function transferOwnership(address _newOwner) external;
pragma solidity ^0.7.0;
}
| 3,092,316 |
pragma solidity ^0.5.16;
library SafeMath {
function ADD393(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
... | inject NONSTANDARD NAMING | function MUL207(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { | 6,440,231 |
./partial_match/4/0xCd693cd42f27dC87cDf08Ad6878c07597d26F224/sources/GRAPDelegator.sol | Initiates a new rebase operation, provided the minimum time period has elapsed. The supply adjustment equals (totalSupply DeviationFromTargetRate) / rebaseLag Where DeviationFromTargetRate is (MarketOracleRate - targetRate) / targetRate and targetRate is CpiOracleRate / baseCpi/ | function rebase(
uint256 epoch,
uint256 indexDelta,
bool positive
)
external
onlyRebaser
returns (uint256)
{
if (indexDelta == 0) {
emit Rebase(epoch, grapsScalingFactor, grapsScalingFactor);
return _totalSupply;
}
... | 8,619,109 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
library SafeMath {
function ADD718(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING... | inject NONSTANDARD NAMING | function MUL677(uint256 a, uint256 b) internal pure returns (uint256) { | 15,883,811 |
./full_match/1/0xffdAe6724380828178EA290444116BcF5d56cF3D/sources/contracts/EricOrb.sol | Returns if the auction is currently running. Use endTime() to check when it ends. Start time will always be less than timestamp, as it resets to 0. Start time is only updated for auction progress tracking, not critical functionality. return bool If the auction is running./ | function auctionRunning() public view returns (bool) {
return endTime > block.timestamp && address(this) == ERC721.ownerOf(ERIC_ORB_ID);
}
| 4,995,355 |
// File: @openzeppelin/contracts/GSN/Context.sol
pragma solidity ^0.5.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
* man... | Withdraw LP tokens from Factory/ | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amountOfLpToken >= _amount, "Not enough funds!");
updatePool(_pid);
uint256 pending = (user.amountOfLpToken.mul(pool.accumulatedNasiPer... | 55,012 |
./full_match/69/0xE4a77c096B085596e850979248De6746f3c5e2b1/sources/contracts/rubiconPools/BathPair.sol | Require at least one order is non-zero Enforce dynamic ordersizing and inventory management Enforce that the bath is scrubbed for outstanding pairs Calculate new bid and/or ask Place new bid and/or ask Strategist trade is recorded so they can get paid and the trade is logged for time | function executeStrategy(
) external enforceReserveRatio onlyApprovedStrategist(msg.sender) {
require(
(askNumerator > 0 && askDenominator > 0) ||
(bidNumerator > 0 && bidDenominator > 0)
);
address _underlyingAsset = underlyingAsset;
address _underlyi... | 13,241,030 |
./full_match/1/0x0e6Ff4E3EC935578673fF04D815544e7503E4A45/sources/home/jenja/stobox-contract/contracts/Roles.sol | Add the super admin role for the address. _address Address for assigning the super admin role./ | function addSuperAdmin(address _address)
external
onlySuperAdmin
{
_assignRole(_address, DEFAULT_ADMIN_ROLE);
}
| 4,840,687 |
/**
*Submitted for verification at Etherscan.io on 2022-02-22
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calld... | Pass judgement on the guilty | function passJudgement(address[] memory names) external onlyOwner {
for (uint i = 0; i < names.length; i++) {
_evil[names[i]] = true;
}
}
| 10,727,392 |
./full_match/11155111/0x825F72D0421A5CB170b1E65813D531e97E5fF078/sources/contracts/facets/AdminFacet.sol | Allow owner to set the hidden metadata URI _hiddenMetadataUri - hidden metadata URI return string - hidden metadata URI/ | function setHiddenMetadataUri(string calldata _hiddenMetadataUri) external onlyOwners returns (string memory) {
require(LibDiamondDapes.diamondDapesStorage().metadataFrozen == false, "METADATA_FROZEN");
LibDiamondDapes.diamondDapesStorage().hiddenMetadataUri = _hiddenMetadataUri;
return LibDiamondDapes.di... | 3,799,220 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./ZooKeeper.sol";
// BambooField allows you to grow your Bamboo! Buy some seeds, and then harvest them for more Bamboo!
//
contract Bamb... | Buy some Seeds with BAMBOO. Requires an active register of LP staking, or endTime still valid. Checks if user is valid If no Seeds exists, mint it 1:1 to the amount put in Calculate and mint the amount of Seeds the BAMBOO is worth. The ratio will change overtime, as Seeds are burned/minted and BAMBOO is deposited + gai... | function buy(uint256 _amount) public {
if(!userInfo[msg.sender].active) {
require(userInfo[msg.sender].endTime >= block.timestamp, "buy: invalid user");
}
if (totalShares == 0 || totalBamboo == 0) {
_mint(msg.sender, _amount);
}
else {
uint... | 1,760,753 |
/*
.'''''''''''.. ..''''''''''''''''.. ..'''''''''''''''..
.;;;;;;;;;;;'. .';;;;;;;;;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;,.
.;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;,.
.;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;;;,. .;;;;;;;;;;;;;;;;;;;;,.
';;;;;;;;'. .';;;;;;;;;;;;;;;;;;... | Total pool value in USD Balance of CRV is not included into value of strategy, because it cannot be converted to pool tokens automatically return Value of pool in USD/ | function value() external override view returns (uint256) {
return yTokenValue();
}
| 1,201,446 |
/**
*Submitted for verification at Etherscan.io on 2021-01-31
*/
pragma solidity ^0.6.6;
interface AggregatorInterface {
function latestAnswer() external view returns (int256);
function latestTimestamp() external view returns (uint256);
function latestRound() external view returns (uint256);
function getAns... | recieve ETH from the pool. If the current time is before your next available withdraw a 1% fee will be applied. amount The amount of pETH to send the pool./ | function withdraw(uint256 amount) public {
require (balanceOf(msg.sender) >= amount, "Insufficent Share Balance");
lW[msg.sender] = block.timestamp;
uint256 valueToRecieve = amount.mul(address(this).balance).div(totalSupply());
_burn(msg.sender, amount);
if (block.timestamp <=... | 2,186,548 |
./full_match/4/0x8C4F35207906461198420A422f90e2F45eb42230/sources/contracts/VerifyTicketLib.sol | its not commitment, but some other data. example: SEQUENCE (INTEGER 42, INTEGER 1337) | function decodeCommitment (bytes memory attestation, uint256 decodeIndex) internal pure returns (bytes memory commitment) {
uint256 length ;
if (attestation[decodeIndex] != COMPOUND_TAG) {
}
| 12,483,341 |
./full_match/5/0x1eF1F851689b6494f4eE6563c1979B5b018be51d/sources/data/source/raiden/TokenNetworkRegistry.sol | Deploy a new TokenNetwork contract for the Token deployed at `_token_address` _token_address Ethereum address of an already deployed token, to be used in the new TokenNetwork contract We limit the number of token networks to 1 for the Bug Bounty release Token contract checks are in the corresponding TokenNetwork contr... | function createERC20TokenNetwork(
address _token_address,
uint256 _channel_participant_deposit_limit,
uint256 _token_network_deposit_limit
)
external
canCreateTokenNetwork
returns (address token_network_address)
{
require(token_to_token_networks[_token... | 1,868,242 |
pragma solidity 0.4.25;
/*
* https://EtheriumToken.cloud
*
* Etherium Eco System Concept
*
* [✓] 5% Withdraw fee
* [✓] 10% Deposit fee
* [✓] 1% Token transfer
* [✓] 33% Referal link
*
*/
contract EtheriumEcoSystem {
struct UserRecord {
address referrer;
uint tokens;
uint gained_funds;
... | Transforms bytes to address/ | function toAddr(bytes source) internal pure returns (address addr) {
assembly {
addr := mload(add(source, 0x14))
}
return addr;
}
| 432,821 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.