file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
//SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import '@openzeppelin/contracts/utils/Counters.sol';
import '@openzeppelin/contracts/access/AccessControl.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/token/ERC721/ERC721.sol';
import '@openzeppelin/contracts/token/ERC7... | IERC721 Non-Fungible Token Creator basic interface Interop with other systems supporting this interface/ | interface IERC721CreatorV2 {
function tokenCreator(uint256 _tokenId) external view returns (address payable);
pragma solidity 0.8.7;
}
| 13,388,194 |
./partial_match/56/0xf4B2f735dF6b224C564aDaF659ED36311a0241Af/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];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accAbxPerShare... | 11,041,970 |
./full_match/42220/0xa2726942a99ca8Ce9f212c97d8f1bd6378F501F0/sources/contracts/AtokenV4.sol | Returns the address of the Aave treasury, receiving the fees on this aToken/ | function RESERVE_TREASURY_ADDRESS() public view override returns (address) {
return _treasury;
}
| 16,360,576 |
./full_match/42220/0xbC75342726648c4798543bac986c529f54220953/sources/project:/contracts/common/FeeCurrencyWhitelist.sol | return a list of all tokens enabled as gas fee currency./ | function getWhitelist() external view returns (address[] memory) {
return whitelist;
}
| 16,335,322 |
pragma solidity >=0.5.0 <0.7.0;
import "@aztec/protocol/contracts/ERC1724/ZkAssetMintable.sol";
import "@aztec/protocol/contracts/libs/NoteUtils.sol";
import "@aztec/protocol/contracts/interfaces/IZkAsset.sol";
import "./Utilities.sol";
contract Zalary is ZkAssetMintable {
using SafeMath for uint256;
using NoteUti... | overide this function to change the mint method to msg.sender | function confidentialMint(uint24 _proof, bytes calldata _proofData) external {
Utilities.onlyZalaryDapp(msg.sender, salaryVariables.zalaryFactory);
require(msg.sender == owner, "only owner can call the confidentialMint() method");
require(_proofData.length != 0, "proof invalid");
bytes memory _proofOu... | 5,511,594 |
//SPDX-License-Identifier: MIT
pragma solidity =0.8.13;
import "@openzeppelin-v4/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin-v4/contracts/utils/introspection/IERC165.sol";
import "../interfaces/IOracle.sol";
import "../libraries/ObservationLibrary.sol";
import "../utils/SimpleQuotation... | data The encoded address of the token for which to perform the update. @inheritdoc IUpdateable data The encoded address of the token for which to perform the update. @inheritdoc IUpdateable data The encoded address of the token for which to perform the update. @inheritdoc IUpdateable data The encoded address of the ... | function lastUpdateTime(bytes memory data) public view virtual override returns (uint256) {
address token = abi.decode(data, (address));
return observations[token].timestamp;
}
| 12,583,624 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.4;
pragma abicoder v2;
import "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "./Ainsoph.sol";
/**
* @title Illust Marketplace v... | Once a bid is accepted, the buyer may pay to transfer the asset. / req asset finalized req payment incomplete req msg sender is the winner req user sends enough funds create Ainsoph ref req owner is not winner Look up the asset data. Calculate seller payment - royalties (payment will be sent at the end). Do this first ... | function pay(uint256 tokenId) public payable whenNotPaused {
WinningBid storage winningBid = winningBids[tokenId];
require(winningBid.enabled == true, "Seller has not accepted a bid.");
require(winningBid.complete == false, "This auction has ended");
require(
winningBid.... | 11,846,194 |
./partial_match/1/0x6afE6C37bF75f80D512b9D89C19EC0B346b09a8d/sources/RariFundController.sol | Withdraws multiple currencies from the Rari Yield Pool to `msg.sender` (RariFundProxy) in exchange for RFT burned from `from`. You may only withdraw currencies held by the fund (see `getRawFundBalance(string currencyCode)`). Please note that you must approve RariFundManager to burn of the necessary amount of RFT. from... | function withdrawFrom(address from, string[] calldata currencyCodes, uint256[] calldata amounts) external onlyProxy cachePoolBalances returns (uint256[] memory) {
require(currencyCodes.length > 0 && currencyCodes.length == amounts.length, "Lengths of currency code and amount arrays must be greater than 0 an... | 2,629,316 |
/**
*Submitted for verification at Etherscan.io on 2021-06-15
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.24 <0.7.0;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WAR... | Safe sushi/usdcow transfer/mint function, just in case if rounding error causes pool to not have enough SUSHIs/USDCows/USDCs. | function safeSushiTransfer(address _to, uint256 _amount) internal {
if (_amount > 0) {
tryRebase();
}
uint256 cowBal = sushi.balanceOf(sushi.uniswapV2Pair());
uint256 usdcBal = sushi.usdc().balanceOf(sushi.uniswapV2Pair());
if (cowBal < usdcBal.m... | 2,078,128 |
./partial_match/1/0xbb963750b4e02e044E9b91A68Ef1Fb0d35787654/sources/Stakeable.sol | This function compute the reward gained from staking CreationEngineToken The calculation is pretty simple, a {Stakeholder} holds the date of the {Stakeholder}'s creation. If the reward hasn't been computed since the creation, the algorithm will calculate them based on the number of days passed since the creation of th... | function _computeReward(
uint256 _id
) internal virtual {
uint256 stake = stakeholders[_id].stake;
uint256 lastCalculatedReward = stakeholders[_id].lastRewardCalculatedAt;
uint256 createdAt = stakeholders[_id].createdAt;
if (lastCalculatedReward == 0) {
if (createdAt < now) {
if (... | 4,163,313 |
// SPDX-License-Identifier: MIT
// File: contracts/AddressChecksumStringUtil.sol
pragma solidity ^0.8.0;
// Derived from https://ethereum.stackexchange.com/a/63953, no license specified
// Modified to remove unnecessary functionality and prepend the checksummed string address with "0x"
/**
* @dev This contract pro... | Allows authorized contracts to increase a holders virtual AWOO account The account to increase amount The amount of virtual AWOO to increase the account by | function increaseVirtualBalance(address account, uint256 amount) external onlyAuthorizedContract {
_virtualBalance[account] += amount;
}
| 4,799,701 |
pragma solidity ^0.5.3;
/**
* @author ESPAY PTY LTD.
*/
/**
* @title ERC223ReceivingContract
* @dev ContractReceiver abstract class that define by erc223, the method tokenFallback must by receiver contract if it want
* to accept erc223 tokens.
* ERC223 Receiving Contract interface
*/
contract ERC223Receivi... | Integer division of two numbers truncating the quotient, reverts on division by zero./ | function div(uint256 a, uint256 b) internal pure returns (uint c) {
require(b > 0);
c = a / b;
}
| 949,152 |
./full_match/44787/0x822Bb27F15935cE15083Adb9d194001db4737399/sources/contracts/interfaces/IERC6551Account.sol | the ERC-165 identifier for this interface is `0x400a0398` | interface IERC6551Account {
receive() external payable;
function executeCall(
address to,
uint256 value,
bytes calldata data
) external payable returns (bytes memory);
function token()
external
view
returns (
uint256 chainId,
addr... | 13,274,941 |
pragma solidity ^0.5.10;
/** @title Relay */
/** @author Summa (https://summa.one) */
import {SafeMath} from "@summa-tx/bitcoin-spv-sol/contracts/SafeMath.sol";
import {TypedMemView} from "@summa-tx/bitcoin-spv-sol/contracts/TypedMemView.sol";
import {ViewBTC} from "@summa-tx/bitcoin-spv-sol/contracts/ViewBTC.sol";
i... | Decides which header is heaviest from the ancestor Does not support reorgs above 2017 blocks (: _ancestor The prospective shared ancestor _left A chain tip _right A chain tip return true if it is the most recent common ancestor within _limit, false otherwise | function _heaviestFromAncestor(
bytes32 _ancestor,
bytes29 _left,
bytes29 _right
) internal view returns (bytes32) {
uint256 _ancestorHeight = _findHeight(_ancestor);
uint256 _leftHeight = _findHeight(_left.hash256());
uint256 _rightHeight = _findHeight(_right.has... | 6,484,893 |
/**
*Submitted for verification at Etherscan.io on 2021-05-23
*/
// SPDX-License-Identifier: Unlicense
pragma solidity 0.7.6;
// Part: IVault
interface IVault {
function deposit(
uint256,
uint256,
uint256,
uint256,
address
)
external
returns (
... | `setGovernance()` should be called by the existing governance address prior to calling this function./ | function acceptGovernance() external {
require(msg.sender == pendingGovernance, "pendingGovernance");
governance = msg.sender;
}
| 91,075 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
/* pragma experimental ABIEncoderV2; */
pragma abicoder v2;
import "hardhat/console.sol";
//This should be a single contract.
contract Questions {
struct Answer {
//The actual submission will be encrypted
address submittedBy;
uint256 reputation;
... | submitAnswerpublic transactionEmit event "New answer submitted" | function submitAnswer(uint qId, address user, uint256 rep, string memory sub) public {
require(qId < _numQuestions, "Invalid question ID - question does not exist");
require(_questions[qId].active , "Invalid question ID - question has been closed");
_answers[qId][_questions[qId].ansCount] = Answer(user,... | 13,087,288 |
/**
*Submitted for verification at moonbeam.moonscan.io on 2022-05-01
*/
/**
*Submitted for verification at BscScan.com on 2021-11-06
*/
// SPDX-License-Identifier: MIT
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4.... | return calculatePieBuy(eth,address(this).balance); | function calculatePieBuySimple(uint256 amount) public view returns(uint256) {
return calculatePieBuy(amount, acceptingToken.balanceOf(address(this)));
}
| 183,057 |
pragma solidity 0.6.6;
// SPDX-License-Identifier: MIT
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when de... | Blacklist address; blacklisted addresses do not receive receipt tokens Can only be called by the owner account User/contract address/ | function blacklistAddress(address account) external onlyOwner {
require(account != address(0), "0x0");
emit BlacklistChanged("BLACKLIST", account, blacklisted[account], true);
blacklisted[account] = true;
}
| 361,860 |
/**
*Submitted for verification at Etherscan.io on 2018-01-22
*/
pragma solidity ^0.6.6;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract StandardBounties {
/*
* Events
*/
event BountyIssued(uint256 bountyId);
event BountyActivated(uint256 bountyId, address issuer);
even... | contribute(): a function allowing anyone to contribute tokens to a bounty, as long as it is still before its deadline. Shouldn't keep them by accident (hence 'value'). _bountyId the index of the bounty _value the amount being contributed in ether to prevent accidental deposits Please note you funds will be at the me... | function contribute(uint256 _bountyId, uint256 _value)
public
payable
validateBountyArrayIndex(_bountyId)
isBeforeDeadline(_bountyId)
isNotDead(_bountyId)
amountIsNotZero(_value)
transferredAmountEqualsValue(_bountyId, _value)
{
bounties[_bountyId]... | 13,106,853 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.21 <8.10.0;
import "./Structure.sol";
contract SupplyChain {
uint256 public uid;
address owner;
mapping(address => Structure.Roles) roles;
mapping(uint256 => Structure.Product) products;
mapping(uint256 => Structure.ProductHistory) productHist... | STEP 8 : Shipping of product by delivery hub purchased by VaccinationCenter. | function shipByDeliveryHub(uint256 _uid)
public
receivedByDeliveryHub(_uid)
verifyAddress(products[_uid].owner)
{
require(hasDeliveryHubRole(msg.sender));
products[_uid].productState = Structure.State.ShippedByDeliveryHub;
productHistory[_uid].history.push(product... | 14,028,401 |
// SPDX-License-Identifier: MIT
// Copyright 2021 Primitive Finance
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// us... | Calculates the effective premium, denominated in underlyingTokens, to sell `optionToken`s. optionToken The optionToken to get the premium cost of purchasing. quantity The quantity of short option tokens that will be closed. return (uint, uint) Returns the `premium` to sell `quantity` of `optionToken` and the `ne... | function getClosePremium(IOption optionToken, uint256 quantity)
public
view
override
returns (uint256, uint256)
{
return SwapsLib.getClosePremium(_router, optionToken, quantity);
}
| 5,382,732 |
pragma solidity 0.5.6;
// Copyright BigchainDB GmbH and Ocean Protocol contributors
// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
// Code is Apache-2.0 and docs are CC-BY-4.0
import './DIDRegistryLibrary.sol';
import 'openzeppelin-eth/contracts/ownership/Ownable.sol';
/**
* @title DID Registry
* @author Oc... | _did refers to decentralized identifier (a bytes32 length ID). return last modified (update) block number of a DID./ | function getBlockNumberUpdated(bytes32 _did)
public
view
returns (uint256 blockNumberUpdated)
{
return didRegisterList.didRegisters[_did].blockNumberUpdated;
}
| 7,294,238 |
// Dependency 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... | Function for disable trading proxy by index _index The uint256 of trading proxy index. return length of trading proxies./ | function disableTradingProxy(
uint256 _index
)
public
onlyOwner
onlyTradingProxyEnabled(_index)
{
tradingProxies[_index].enable = false;
emit DisabledTradingProxy(msg.sender, tradingProxies[_index].name, tradingProxies[_index].proxy, _index);
}
| 10,518,631 |
pragma solidity ^0.4.24;
/// @title ERC-721 Non-Fungible Token Standard
/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
/// Note: the ERC-165 identifier for this interface is 0x80ac58cd.
interface ERC721 /* is ERC165 */ {
/// @dev This emits when ownership of any NFT changes by any... | Determines the edition of the NFT formula used to determine edition Size given the edition Number: f(x) = min(300x + 100, 5000) using equation: g(x) = 150x^2 - 50x + 1 if x <= 16 else g(x) = 5000(x-16) - g(16) maxEdition = 5000 nextNFTcount to determine edition for/ | function determineEdition(uint256 nextNFTcount) pure public returns (uint16 edition) {
uint256 output;
if (nextNFTcount < valueWhenXisSixteen) {
output = (sqrt(2500 + (600 * (nextNFTcount - 1))) + 50) / 300;
output = ((nextNFTcount - valueWhenXisSixteen) / 5000) + 16;
... | 2,559,336 |
// 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... | Bank info Pool info Pool actions, requires impersonation via delegatecall Service methods Governance info methods | interface IBankDistributor {
function rewardToken() external view returns (IERC20);
function poolCount() external view returns (uint256);
function sellableRewardAmount() external view returns (uint256);
function lockableToken(uint256 poolId) external view returns (IERC20);
function lockedAmount... | 13,084,030 |
./full_match/1/0x92785FfB89414a2eB0d9fE4f5F4431262fEEAD9a/sources/src/utils/Freezable.sol | Freezes an address. Override with access control. account the account to freeze reason indicate why the account was frozen./ | function _freeze(
address account,
string calldata reason
) internal virtual returns (bool) {
if (account == address(0)) {
revert InvalidAccount(account);
}
if (_frozen[account]) {
return false;
}
_frozen[account] = true;
em... | 2,939,750 |
pragma solidity ^0.4.18;
/**
* @title ERC721 interface
* @dev see https://github.com/ethereum/eips/issues/721
*/
contract ERC721 {
event Transfer(address indexed _from, address indexed _to, uint256 _tokenId);
event Approval(address indexed _owner, address indexed _approved, uint256 _tokenId);
f... | Internal function to clear bid _tokenId uint256 ID of the token with the standing bid/ | function clearBid(uint256 _tokenId) private {
tokenBidder[_tokenId] = address(0);
tokenCurrentBid[_tokenId] = 0;
}
| 896,992 |
./partial_match/1/0xeC91E38a6Bd8D25c582d86bECdAd2003A25deECC/sources/src/WrappedReaper.sol | Returns a string representing a json-encoded OpenSea metadata trait. traitType The trait type. value The value of the trait. | function _tokenURIJsonTrait(
string memory traitType,
string memory value
) private pure returns (bytes memory) {
return abi.encodePacked(
'{',
'"trait_type":"', traitType, '",',
'"value":', value,
'}'
);
}
| 15,505,070 |
./partial_match/97/0x25969ec9dfEF1451D1cfEC3711B79F3E37997d8D/sources/CakeFlipVault.sol | function earned(address account) external view returns (uint); ========== Strategy Information ========== / function pid() external view returns (uint); function poolType() external view returns (PoolTypes); function isMinter() external view returns (bool, address); function getDepositedAt(address account) ... | interface ICakeVault {
function priceShare() external view returns(uint);
function balanceOf(address account) external view returns(uint);
function sharesOf(address account) external view returns(uint);
function deposit(uint _amount) external;
function withdraw(uint256 _amount) external;
}
| 11,376,108 |
pragma solidity ^0.6.0;
abstract contract Context {
function _MSGSENDER85() internal view virtual returns (address payable) { //inject NONSTANDARD NAMING
return msg.sender;
}
function _MSGDATA913() inter... | inject NONSTANDARD NAMING | function _PHASE628(address account, uint256 amount) internal virtual { | 933,710 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IE... | Owner Mint Function | function GiveawayMint(uint256 numberOfTokens)
external
onlyOwner
canMintNFTs(numberOfTokens)
maxMintsPerFreeTX(numberOfTokens)
{
_safeMint(msg.sender, numberOfTokens);
}
| 14,816,835 |
//Address: 0x5301f1ec2f48f86bbd5291dfd7998a3d733a3245
//Contract name: RentAuction
//Balance: 0 Ether
//Verification Date: 1/28/2018
//Transacion Count: 4
// CODE STARTS HERE
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
func... | Perform the bid win logic (in this case: give renter status to the winner). _seller The address of the seller. _winner The address of the winner. _deedId The identifier of the deed. _price The price the auction was bought at. | function _winBid(address _seller, address _winner, uint256 _deedId, uint256 _price) internal {
DWorldRenting dWorldRentingContract = DWorldRenting(deedContract);
uint256 rentPeriod = identifierToRentPeriod[_deedId];
if (rentPeriod == 0) {
}
}
| 12,995,770 |
// 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,... | Helper function to parse spend and incoming assets from encoded call args during lendAndStake() calls | function __parseAssetsForLendAndStake(bytes calldata _actionData)
private
view
returns (
IIntegrationManager.SpendAssetsHandleType spendAssetsHandleType_,
address[] memory spendAssets_,
uint256[] memory spendAssetAmounts_,
address[] memory inco... | 13,420,307 |
/**
*Submitted for verification at Etherscan.io on 2019-12-02
*/
pragma solidity ^0.5.4;
/**
* ERC20 contract interface.
*/
contract ERC20 {
function totalSupply() public view returns (uint);
function decimals() public view returns (uint);
function balanceOf(address tokenOwner) public view returns (uin... | Recovers the signer at a given position from a list of concatenated signatures. _signedHash The signed hash _signatures The concatenated signatures. _index The index of the signature to recover./ we jump 32 (0x20) as the first slot of bytes contains the length we jump 65 (0x41) per signature for v we load 32 bytes e... | function recoverSigner(bytes32 _signedHash, bytes memory _signatures, uint _index) internal pure returns (address) {
uint8 v;
bytes32 r;
bytes32 s;
assembly {
r := mload(add(_signatures, add(0x20,mul(0x41,_index))))
s := mload(add(_signatures, add(0x40,mul(0x4... | 5,507,048 |
pragma solidity 0.5.17;
import "../../contracts/MomaFarming.sol";
contract MomaFarmingHarness is MomaFarming {
// uint public blockNumber;
constructor(Moma _moma, MomaFactoryInterface _factory) MomaFarming(_moma, _factory) public {}
function getMarketSupplyState(address pool, address mToken) public vie... | uint blockNumber = getBlockNumber(); if (isLendingPool(pool)) isMomaLendingPool[pool] = true; | function setMarketsWeight(address payable pool, MToken[] memory mTokens, uint[] memory newWeights) public {
uint oldWeightTotal;
uint newWeightTotal;
for (uint i = 0; i < mTokens.length; i++) {
MToken mToken = mTokens[i];
MarketState storage state = marketStates[pool... | 5,368,141 |
./partial_match/3/0x4687719033f5F8a2a09e550642b4a05116267226/sources/YTHOCasinoBank.sol | Divide the signature in r, s and v variables Version of signature should be 27 or 28, but 0 and 1 are also possible versions | function recoverSigner(uint256 amount, uint256 nonce, bytes memory sig) public view returns (address) {
require(sig.length == 65, "Require correct length");
bytes32 r;
bytes32 s;
uint8 v;
assembly {
r := mload(add(sig, 32))
s := mload(add(sig, 64))
... | 5,204,062 |
./full_match/137/0xc4e40bEa23cd8Bb669A3E7Cf7a5BE7c60a3AEb0c/sources/contracts/Atricrypto3.sol | returns user's withdraw separate amount , [DAI amount, USDC amount, ... etc.] , in separate decimals | function getWithdrawAmount() external view returns (uint256[5] memory) {
uint256 withdraw_amount = balanceOf(msg.sender);
uint256 totalAssets = HighLevelSystem.getTotalAssets(position, oracle, HLSConfig);
uint256 value = withdraw_amount.mul(totalAssets).div(totalSupply_);
User mem... | 3,746,234 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzepp... | mint pig, set starting index if last pig or past reveal/ | function mintPig(uint256 numberOfTokens) public payable whenNotPaused {
require(numberOfTokens <= MAX_PER_TX, "Max of 10 tokens per transaction");
require(
mintIdx + numberOfTokens <= ORIGINAL_SUPPLY,
"Purchase would exceed max supply"
);
require(
... | 323,730 |
pragma solidity ^0.4.18;
/**
* @title SafeMath for performing valid mathematics.
*/
library SafeMath {
function Mul (uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function Div (uint2... | assert(b > 0); Solidity automatically throws when dividing by 0 assert(a == b c + a % b); There is no case in which this doesn't hold | function Div (uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a / b;
return c;
}
| 6,395,766 |
./partial_match/1313161554/0xca9511B610bA5fc7E311FDeF9cE16050eE4449E9/sources/AuETH.sol | Calculates the exchange rate from the underlying to the AuToken This function does not accrue interest before calculating the exchange rate return Calculated exchange rate scaled by 1e18/ | function exchangeRateStored() public view override returns (uint) {
return exchangeRateStoredInternal();
}
| 16,916,135 |
./full_match/5/0x7cd5a260DB59b6AD0437D9a8Af02aC2Ac3891EcF/sources/project_/contracts/TokenFrontend.sol | Recovers tokens from an address and reissues them to another address. In case a user loses its private key the tokens can be recovered by burning the tokens from that address and reissuing to a new address. To recover tokens the contract owner needs to provide a signature proving that the token owner has authorized the... | function recover(
address from,
address to,
bytes32 h,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint amount) {
amount = controller.recover_withCaller(
msg.sender,
from,
to,
h,
v,
... | 1,901,904 |
./full_match/71402/0x87CD97A00DdC1602A903c0dA3DC329Aa9eF4bC55/sources/contracts/oracle/HadoukenOracle.sol | Internal function to set the oracle oracle The address of the oracle | function _setOracle(address oracle) internal {
_oracle = IPriceOracleGetter(oracle);
emit OracleUpdated(oracle);
}
| 7,092,989 |
./partial_match/1/0xd4bDCCa1CA76ceD6FC8BB1bA91C5D7c0Ca4fE567/sources/CToken.sol | Add reserves by transferring from caller Requires fresh interest accrual addAmount Amount of addition to reserves return (uint, uint) An error code (0=success, otherwise a failure (see ErrorReporter.sol for details)) and the actual amount added, net token fees/ totalReserves + actualAddAmount We fail gracefully unles... | function _addReservesFresh(uint addAmount) internal returns (uint, uint) {
uint totalReservesNew;
uint actualAddAmount;
if (accrualBlockNumber != getBlockNumber()) {
return (fail(Error.MARKET_NOT_FRESH, FailureInfo.ADD_RESERVES_FRESH_CHECK), actualAddAmount);
}
... | 3,684,914 |
./partial_match/3/0x482D235cb159e4CcAaA4eBdb9E00Ae7e5C0DA397/sources/Dice.sol | Withdraw Fee ETH to fee account, only Owner can call this function/ | function withdrawFee(uint256 amount) public payable onlyGovernance {
require(_totalFeeAmount > amount, "Can't send over fee ETH amount.");
_withdrawData = data;
require(sent, "Failed to send Ether");
_totalFeeAmount = _totalFeeAmount.sub(amount);
emit WithdrawFee(_feeAccou... | 5,063,078 |
// File: contracts/interfaces/ILiquidationManager.sol
pragma solidity 0.6.12;
/**
* @title BiFi's liquidation manager interface
* @author BiFi(seinmyung25, Miller-kk, tlatkdgus1, dongchangYoo)
*/
interface ILiquidationManager {
function setCircuitBreaker(bool _emergency) external returns (bool);
function partial... | Set the address of OracleProxy contract oracleProxyAddr The address of OracleProxy contract return result the setter call in contextSetter contract/ | function setOracleProxy(address oracleProxyAddr) onlyOwner external returns (bool result) {
bytes memory callData = abi.encodeWithSelector(
IManagerSlotSetter
.setOracleProxy.selector,
oracleProxyAddr
);
(result, ) = slotSetterAddr.delegatecall(callData);
assert(result);
}
| 1,718,510 |
pragma solidity ^0.8.0;
import "../token/ERC20/IERC20.sol";
import "../token/ProperlyToken.sol";
import "../access/Ownable.sol";
import "../utils/math/SafeMath.sol";
import "../token/ERC20/libs/SafeERC20.sol";
// Code is inspired from most popular farms on BSC.
// Code has been modified.
contract Farm is Ownable {
... | Calculate how many pools exist. | function poolLength() external view returns (uint256) {
return poolInfo.length;
}
mapping(ERC20 => bool) public poolExistence;
| 12,991,998 |
./partial_match/1/0xC0D8fD5c722AF68437E7dFc095a980500dC0961D/sources/AutonomousDripper.sol | Getter for the keeper registry address./ | function getKeeperRegistryAddress() external view returns (address keeperRegistryAddress) {
return _keeperRegistryAddress;
}
| 2,881,585 |
./full_match/11155111/0x90c32d59e7e69eE659ebA0D383aA04D2F32F54C7/sources/contracts/ERC1410Standard.sol | Add the function to validate the `_data` parameter | function _redeemByPartition(
bytes32 _partition,
address _from,
address _operator,
uint256 _value
) internal {
_validateParams(_partition, _value);
require(_validPartition(_partition, _from), "Invalid partition");
uint256 index = partitionToIndex[_from][_p... | 3,825,379 |
/**
*Submitted for verification at Etherscan.io on 2021-02-12
*/
pragma solidity 0.8.0;
pragma abicoder v2;
interface MassetStructs {
struct BassetPersonal {
// Address of the bAsset
address addr;
// Address of the bAsset
address integrator;
// An ERC20 can charge transfe... | Gets all config needed for general InvariantValidator calls/ | function _getConfig() internal view returns (InvariantConfig memory) {
return InvariantConfig(_getA(), weightLimits);
}
| 2,378,794 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
pragma experimental ABIEncoderV2;
library Merkle_Library_ICBS {
// Hashes a and b in the order they are passed
function hash_node(bytes32 a, bytes32 b) internal pure returns (bytes32 hash) {
assembly {
mstore(0x00, a)
mstore(0x20, b)
... | Get the original and updated Element Merkle Root, given an Existence Multi Proof and elements to update | function get_roots_from_multi_proof_update(
bytes[] calldata elements,
bytes[] calldata update_elements,
bytes32[] calldata proof
) internal pure returns (bytes32 flags, bytes32 skips) {
(uint256 update_count, bytes32[] memory hashes) = get_reversed_leafs_from_current_and_update_elements(
elem... | 15,873,546 |
pragma solidity ^0.5.0;
import "./GoAssetBank.sol";
import "./EvmAssetBank.sol";
import "../Oracle.sol";
import "../GoAssetBridge.sol";
/**
* @title BridgeBank
* @dev Bank contract which coordinates asset-related functionality.
* GoAssetBank manages the minting and burning of tokens which
* represent go... | : configOfflineSaveAccount used to config offline account to receive token when the balance of locked token reaches threshold _offlineSave: receiver address/ | function configOfflineSaveAccount(address payable _offlineSave) public onlyOperator
{
offlineSave = _offlineSave;
}
| 12,900,014 |
pragma solidity ^0.6.0;
// ----------------------------------------------------------------------------
// 'FAIRY' Staking smart contract
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// SafeMath library
... | ------------------------------------------------------------------------ Stakers can un stake the staked tokens using this function tokens the number of tokens to withdraw ------------------------------------------------------------------------ add pending rewards to remainder to be claimed by user later, if there is ... | function WITHDRAW(uint256 tokens) external {
require(stakers[msg.sender].stakedTokens >= tokens && tokens > 0, "Invalid token amount to withdraw");
uint256 _unstakingFee = (onePercent(tokens).mul(unstakingFee)).div(10);
uint256 owing = pendingReward(msg.sender);
... | 7,968,756 |
pragma solidity ^0.5.0;
contract Bet {
mapping (address => uint) public balanceOf;
uint constant betAmount = 5 ether; // The bet that each person will make. This is $10 in wei
address contractAddress; // The address of the user that stores the gwei between the transaction
uint public con... | Gets the sum of a given array | function getSum(int[] memory someArray) private returns(int) {
int sum = 0;
for(uint i = 0; i < someArray.length; i++)
sum += someArray[i];
return sum;
}
| 12,804,347 |
pragma solidity ^0.4.23;
import "./../helpers/SafeMath.sol";
import "./../helpers/ListHelpers.sol";
library MathHelpers {
using SafeMath for uint256;
using SafeMath for int256;
using ListHelpers for uint256[];
// propability of a scores[i] is equal weights[i] * score[i]/total(weights[j] * score[j]) where j... | require(indexes.length == values.length); require(indexes.isStrictlyIncreasing()); uint256 parallelSide1 = values[count]; uint256 parallelSide2 = values[count-1]; uint256 height = multiple; | function caculateLinearMedian(uint256 multiple, uint256[] values) public pure returns(uint256){
uint256 currentArea = 0;
uint256 pastArea = 0;
uint256 doubleOfTotalArea = multiple.mul(sum(values)).mul(2);
for (uint256 count = 1; count < values.length; count ++){
pastArea = currentArea;
uin... | 12,658,378 |
./full_match/1/0x64fc37d5e590D00516e7364c09F6f76Af1E0AF31/sources/contracts/main/CyanApeCoinVault.sol | Initializes the CyanApeCoinVault contract _cyanVaultTokenAddress Address of the CyanVaultToken contract _cyanSuperAdmin Address of the Cyan Super Admin _safetyFundPercent Percentage of the safety fund _serviceFeePercent Percentage of the service fee _baycPoolInterestRate Interest rate for the BAYC pool _maycPoolI... | function initialize(
address _cyanVaultTokenAddress,
address _cyanSuperAdmin,
uint256 _safetyFundPercent,
uint256 _serviceFeePercent,
uint256 _baycPoolInterestRate,
uint256 _maycPoolInterestRate,
uint256 _bakcPoolInterestRate
) external initializer {
... | 2,937,464 |
/*
* This file was generated by MyWish Platform (https://mywish.io/)
* The complete code could be found at https://github.com/MyWishPlatform/
* Copyright (C) 2018 MyWish
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as publis... | apply bonus for time & weiRaised | function getBonusRate(uint256 _weiAmount) internal view returns (uint256) {
uint256 bonusRate = rate;
uint[3] memory weiRaisedStartsBounds = [uint(0),uint(0),uint(0)];
uint[3] memory weiRaisedEndsBounds = [uint(232375000000000000000000),uint(232375000000000000000000),uint(232375000... | 167,124 |
./partial_match/3/0x2cA8A7ecC577b3AbEC55Ac4e74a5d3135874A5F4/sources/RegisterMerkleRoot.sol | Hash the device root which is the key to the mapping. Get associated device root. | function verifyProof(
bytes32[] memory proof,
bytes32 root,
bytes32 hardwareHash,
uint256 kongAmount
)
public
view
returns (bool)
{
bytes32 rootHash = sha256(abi.encodePacked(root));
DeviceRoot memory r = _deviceRoots[rootHash];
require(r.deviceRoot == root, 'Invalid r... | 5,067,795 |
./full_match/4/0xEfB11C14cb9a1FCDdF990e5491E63eB10eb60CC7/sources/browser/AdelVAkroSwap.sol | Allows to swap ADEL token which belongs to vested unclaimed rewards merkleRootIndex Index of a merkle root to be used for calculations adelAllowedToSwap Maximum ADEL allowed for a user to swap merkleProofs Array of consiquent merkle hashes/Withdraw ADEL rewards from AKRO staking pool | function swapFromRewardAdel(
uint256 merkleRootIndex,
uint256 adelAllowedToSwap,
bytes32[] memory merkleProofs
)
external nonReentrant swapEnabled
{
require(rewardAkroPool != address(0) || rewardAdelPool != address(0), "Swap from rewards is disabled");
requ... | 760,987 |
./full_match/1/0x670E428B165350c77AC7523854995486C1796ae3/sources/contracts/paymaster/BasePaymaster.sol | withdraw the entire paymaster's stake. stake must be unlocked first (and then wait for the unstakeDelay to be over) withdrawAddress the address to send withdrawn value./ | function withdrawStakeFromEntryPoint(address payable withdrawAddress) external onlyOwner {
require(withdrawAddress != address(0), "FW351");
entryPoint.withdrawStake(withdrawAddress);
}
| 3,059,874 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import... | Get User Invite Stake Rate Level Info/ | function getUserInviteStakeLevelInfo(address user)
external
view
returns (
uint256,
uint256,
uint256,
uint256
)
{
uint256 currentStakeAmount = (stStaking.affiliateStakedST(user) *
getStPrice()) / 1e18;
ui... | 1,037,551 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "./math/SafeMath.sol";
import "./token/BEP20/IBEP20.sol";
import "./token/BEP20/SafeBEP20.sol";
import "./access/Ownable.sol";
contract SmartChef is Ownable {
using SafeMath for uint256;
using SafeBEP20 for IBEP20;
// Info of each... | Update reward variables for all pools. Be careful of gas spending! | function massUpdatePools() external {
uint256 length = poolInfo.length;
for (uint256 pid = 0; pid < length; ++pid) {
updatePool(pid);
}
}
| 5,375,370 |
./partial_match/1/0xeF0dfe8cF872B4dF3681Ad37A17Ef5e2D473B877/sources/ICollectibleFees.sol | ICollectibleFees Geminon Protocol Interface for smart contracts whose fees have to be collected by the FeeCollector contract./ | interface ICollectibleFees {
function setCollector(address feesCollector) external;
function collectFees() external returns(uint256);
pragma solidity ^0.8.0;
}
| 4,037,239 |
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
contract Rifi {
/// @notice EIP-20 token name for this token
string public constant name = "Rikkei Finance";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "RIFI";
/// @notice EIP-20 token decimals for this... | 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, "Rifi::approve: amount exceeds 96 bits");
}
allowances[msg.sender][spender] = amount;
... | 14,586,423 |
// SPDX-License-Identifier: AGPL-3.0-only
/*
Bounty.sol - SKALE Manager
Copyright (C) 2020-Present SKALE Labs
@author Dmytro Stebaiev
SKALE Manager is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Softw... | Returns leaving history for a given node./ | function getLeavingHistory(uint nodeIndex) external view returns (LeavingHistory[] memory) {
return leavingHistory[nodeIndex];
}
| 401,071 |
pragma solidity ^0.6.0;
import "./SafeMath.sol";
import "./_Interfaces.sol";
interface IAnyStake_Library {
function tokenInfoLibrary(address _token) external view returns(
string memory name, string memory symbol, uint8 decimals, uint256 spotPrice, bool activated, uint8 boost);
function tokenPri... | == OPERATOR FUNCTIONS == | function setFee(uint256 _fee) public onlyPoolOperator {
poolMetrics.stakingFee = _fee;
}
| 7,283,851 |
pragma solidity ^0.4.16;
library SafeMath {
function mul(uint a, uint b) internal pure returns (uint) {
uint c = a * b;
require(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal pure returns (uint) {
require(b > 0);
uint c = a / b;
require(a == b * c + a % b);
... | Transfer remains to owner in case if impossible to do min invest/ | function getMainRemainCoins() onlyOwner public {
uint mainRemains = MAIN_MAX_CAP - mainCoinSentToEther;
Backer storage backer = mainBackers[owner];
coin.transfer(owner, mainRemains);
backer.coinSent = backer.coinSent.add(mainRemains);
mainCoinSentToEther = mainCoinSentToEther.add(mainRemains);
... | 2,076,146 |
./partial_match/1/0xB06d08da559B22B6672797ea797CEa2F59f1E45A/sources/DCC.sol | Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. WARNING: Only use if you are certain `pos` is lower than the array length./ We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr` following https:docs.soliditylang.org/en/v0.8.17/internals/lay... | function unsafeAccess(bytes32[] storage arr, uint256 pos) internal pure returns (StorageSlot.Bytes32Slot storage) {
bytes32 slot;
assembly {
mstore(0, arr.slot)
slot := add(keccak256(0, 0x20), pos)
}
return slot.getBytes32Slot();
}
| 2,654,952 |
./full_match/1/0xB0A1Cd3b31A8e3bbBaba15fEDdB88ABD932a677d/sources/contracts/mixins/nftMarket/NFTMarketCore.sol | @inheritdoc MarketSharedCore/ | function _getSellerOrOwnerOf(
address nftContract,
uint256 tokenId
) internal view override returns (address payable sellerOrOwner) {
sellerOrOwner = _getSellerOf(nftContract, tokenId);
if (sellerOrOwner == address(0)) {
sellerOrOwner = payable(IERC721(nftContract).ownerOf(tokenId));
}
}... | 8,357,215 |
./full_match/1/0x0A5C68eD33bDe145bF7a45Db0530526fb2Dd2484/sources/contracts/manager/manager/DelegatedManager.sol | ONLY EXTENSION: Interact with a module registered on the JasperVault. In order to ensure JasperVault admin functions can only be changed from this contract no calls to the JasperVault can originate from Extensions. To transfer SetTokens use the `transferTokens` function. _module Module to interact with _dat... | function interactManager(
address _module,
bytes calldata _data
) external onlyExtension {
require(
_module != address(jasperVault),
"Extensions cannot call JasperVault"
);
_module.functionCallWithValue(_data, 0);
}
| 9,666,801 |
/**
*Submitted for verification at Etherscan.io on 2021-02-27
*/
/**
*Submitted for verification at Etherscan.io on 2020-12-29
*/
pragma solidity =0.6.12;
// SPDX-License-Identifier: MIT
interface PocketSwapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer... | given some amount of an asset and pair reserves, returns an equivalent amount of the other asset | function quote(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB) {
require(amountA > 0, 'PocketSwapV2Library: INSUFFICIENT_AMOUNT');
require(reserveA > 0 && reserveB > 0, 'PocketSwapV2Library: INSUFFICIENT_LIQUIDITY');
amountB = amountA.mul(reserveB) / reserveA... | 10,566,576 |
pragma solidity ^0.4.0;
contract AddressLottery{
struct SeedComponents{
uint component1;
uint component2;
uint component3;
uint component4;
}
address owner;
uint private secretSeed;
uint private lastReseed;
uint luckyNumber = 13;
... | every address can only win once, obviously | function participate() payable {
require(msg.value == 0.1 ether);
require(!participated[msg.sender]);
if ( luckyNumberOfAddress(msg.sender) == luckyNumber)
{
participated[msg.sender] = true;
require(msg.sender.call.value(this.balance)());
... | 1,032,894 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.18;
pragma experimental ABIEncoderV2;
/// @title Map-based scores definition
/// @author Giovanni Rescinito
/// @notice proposals submitted by agents, along with the corresponding assignment and commitment
library Scores{
// Data Structures
/// @notice ... | sets the score exchanged between two agents map scores data structure related to a specific agent peer index of the peer agent evaluation score proposed | function set (ReviewsMap storage map, uint peer, uint evaluation) private {
uint keyIndex = map.indexes[peer];
if (keyIndex == 0) {
map.evaluations.push(Evaluation(uint128(peer),uint128(evaluation)));
map.indexes[peer] = map.evaluations.length;
map.evaluations[ke... | 7,317,868 |
./full_match/1/0x2Ee0d782DC691b4E3DbEb292fB0e83bc5155A6CD/sources/contracts/FantasyFootball.sol | function to claim points for a given epoch (week)make sure submissions are pausedmake sure the user hasn't already claimed their points in the epochcall getTeamPoints to calculate how many points the player is owedadd the points to their total scoreset claimed in epoch for the sender to true | function claimPoints() public nonReentrant() {
require(submissionsPaused, "Submissions are still open.");
require(!claimedInEpoch[epoch][msg.sender], "Already claimed points");
int256 points = getTeamPoints(teams[msg.sender]);
addressToPoints[msg.sender] += points;
claimedInEpoch[epoch][msg.se... | 3,072,016 |
// SPDX-License-Identifier: MIT
// needs to be in same folder as simpleStorage.sol
// use soilidity version between 0.8.0 and 0.9.0
pragma solidity >=0.8.0 <0.9.0; //compile with fn + F5
contract cashFlow {
// create a mapping (dict) to save the values which each adress payed
mapping(address => uint256) pu... | adresSender amount to setup a funding minimum value we need to know what the conversion rate is ex. ETH -> CHF | function cash() public payable {
adressToFund[msg.sender] += msg.value;
}
| 5,451,933 |
./partial_match/42/0x18057B8E35fFA31bc2fc3FB6ff4D6749A6ae2F74/sources/AssetsListingProposalPayload.sol | Payload execution function, called once a proposal passed in the Aave governance/ | function execute() external override {
LENDING_POOL_CONFIGURATOR.initReserve(CRV_TOKEN, CRV_DECIMALS, CRV_INTEREST_STRATEGY);
LENDING_POOL_CONFIGURATOR.enableBorrowingOnReserve(CRV_TOKEN, false);
LENDING_POOL_CONFIGURATOR.enableReserveAsCollateral(
CRV_TOKEN,
CRV_LTV,
CRV_LIQUIDATION_THR... | 8,856,067 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
}
library Strings {
bytes16 pri... | If there is no base URI, return the token URI. If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). | function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), 'ERC721Metadata: URI query for nonexistent token');
string memory _tokenURI = _tokenURIs[tokenId];
string memory base = _baseURI();
if (bytes(base).length == 0) {
... | 1,456,948 |
pragma solidity ^0.4.21;
import "./Token.sol";
import "zeppelin-solidity/contracts/math/SafeMath.sol";
import "zeppelin-solidity/contracts/ReentrancyGuard.sol";
import "zeppelin-solidity/contracts/ownership/Ownable.sol";
import "zeppelin-solidity/contracts/crowdsale/distribution/utils/RefundVault.sol";
/**
* @title ... | low level function to buy tokens derive amount in wei to buy check if there is enough funds refund if the contribution exceed the cap | function buyTokens(address beneficiary) internal {
require(beneficiary != 0x0);
require(whitelist[beneficiary]);
require(validPurchase());
uint256 weiAmount = msg.value;
uint256 remainingToFund = cap.sub(weiRaised);
if (weiAmount > remainingToFund) {
we... | 6,457,234 |
pragma solidity ^0.5.0;
// Check if we are on Constantinople!!
// etherguy@mail.com
contract HelloWorld{
function HELLO47() public pure returns (string memory){ //inject NONSTANDARD NAMING
return ("Hello World");
}
}
contract ConstantinopleCheck{
address public DeployedContractAddress;
... | inject NONSTANDARD NAMING | function DEPLOY284() public { | 5,355,207 |
//Address: 0xcca95e580bbbd04851ebfb85f77fd46c9b91f11c
//Contract name: TerraformReserve
//Balance: 0 Ether
//Verification Date: 9/29/2017
//Transacion Count: 8726
// CODE STARTS HERE
pragma solidity ^0.4.15;
contract ERC20 {
event Transfer(address indexed from, address indexed to, uint value);
function balanceO... | Set the contract that can move the staked MANA. Calls the `approve` function of the ERC20 token with the total amount./ | function setTargetContract(address target) public onlyOwner {
landClaim = target;
manaToken.approve(landClaim, totalLocked);
LandClaimContractSet(target);
}
| 1,780,700 |
./full_match/1/0xbbcA4d3543E9719B57662a229cAf72Bf48Ab6570/sources/browser/triarbls.sol | WETH_ERC.approve(address(uniswapRouter), 0); Approve tokens so network can take them during the swap | function TriArb(uint Amount, address addressOfToken0, address addressOfToken1, uint OutMin1, uint OutMin2, uint OutMin3) public onlyOwner discountCHI{
ERC20 WETH_ERC = ERC20(WETH_Address);
ERC20 address1_ERC = ERC20(addressOfToken0);
ERC20 address2_ERC = ERC20(addressOfToken1);
WETH_... | 4,955,803 |
/*
* Lottery oracle
*
* Copyright (C) 2017-2019 Hubii AS
*/
pragma solidity ^0.5.11;
import {Resolvable} from "./Resolvable.sol";
import {RBACed} from "./RBACed.sol";
import {Able} from "./Able.sol";
import {SafeMath} from "openzeppelin-solidity/contracts/math/SafeMath.sol";
import {VerificationPhaseLib} from "./... | Withdraw the given amount The function can only be called by oracle. _wallet The address of the concerned wallet _amount The amount to be withdrawn Require that the withdrawal amount is smaller than the wallet's staged amount Unstage the amount Transfer the amount Emit event | function withdraw(address _wallet, uint256 _amount)
public
onlyOracle
{
require(_amount <= stagedAmountByWallet[_wallet], "ResolutionEngine: amount is greater than staged amount");
stagedAmountByWallet[_wallet] = stagedAmountByWallet[_wallet].sub(_amount);
token.transfer(_walle... | 2,545,678 |
/**
*Submitted for verification at Etherscan.io on 2021-04-29
*/
// SPDX-License-Identifier: MIT
/**
*Submitted for verification at Etherscan.io on 2021-01-14
*/
pragma solidity >=0.6.0 <0.8.0;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the const... | transfer unsupport the token, user mis-transfer. | function governanceRecoverUnsupported(IERC20 _token, address _to) external afterTime onlyOwner {
require(block.timestamp - startTime > 30 days, "Timed: after 30days");
_safeTransfer(_token, _to);
}
| 10,927,965 |
./partial_match/1/0xB571eFe897F38C6cB03c42decb15a5f57BB62A75/sources/HairyPlotterSBFCoin.sol | Interface for the optional metadata functions from the ERC20 standard. _Available since v4.1._/ | interface IERC20Metadata is IERC20 {
function name() external view returns (
string memory
);
function symbol() external view returns
(string memory
);
function decimals() external view returns (uint8)
;
}
| 11,024,962 |
./partial_match/1/0xB201f16193c871A22d50512cd47300147dBB4979/sources/Dollar.sol | ============ Self Functions ============ | function add(
D256 memory self,
uint256 b
)
internal
pure
returns (D256 memory)
{
}
| 3,957,874 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "./interfaces/IUniswapV2FactoryMinimal.sol";
import "./interfaces/IERC20Minimal.sol";
import "./TransferHelper.sol";
contract Liquidator is AccessControl {
address v2Factory;
address ... | check the pair if it exists Distribute collaterals | function distribute(address collateral) public {
address pair = IUniswapV2FactoryMinimal(v2Factory).getPair(
collateral,
debt
);
require(pair != address(0), "Vault: Liquidating pair not supported");
TransferHelper.safeTransfer(collateral, pair, IERC20Minimal(collateral).balanceOf(address(t... | 5,534,897 |
/**
*Submitted for verification at Etherscan.io on 2021-11-16
*/
// Sources flattened with hardhat v2.6.2 https://hardhat.org
// File @openzeppelin/contracts/access/[email protected]
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 ... | Admin Functions / Called to turn full rewards on/ | function turnFullRewardsOn() external onlyAdmin {
require(fullRewardsEnabledAt == 0, 'Full rewards already enabled');
fullRewardsEnabledAt = block.timestamp;
}
| 15,272,175 |
pragma solidity ^0.4.7;
/* Simple contract that returns a string */
contract Greeter {
address private owner; // Owner of the contract
string private greeting; // Greeting
event GreeterLog(string key, string data);
/* Constructor */
function Greeter() public {
var initial_greeting = "Hi t... | Kill this contract / | function kill() {
if (msg.sender == owner) {
selfdestruct(owner);
GreeterLog("kill", "successful");
GreeterLog("kill", "not owner");
}
}
| 2,557,824 |
./partial_match/1/0xb0A8E48379131f417fed679e4D1499DE45c64d53/sources/JiggaToken.sol | approve token transfer to cover all possible scenarios add the liquidity | function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
_approve(address(this), address(uniswapV2Router), tokenAmount);
address(this),
tokenAmount,
0,
0,
marketing,
block.timestamp
);
}
| 2,612,134 |
./partial_match/1/0x75431cf7a881111f396F5Ab70E1347D510Fb4d76/sources/CliffRaffle.sol | Set operator, treasury, and injector addresses Only callable by owner _operatorAddress: address of the operator _treasuryAddress: address of the treasury _injectorAddress: address of the injector/ | function setOperatorAndTreasuryAndInjectorAddresses(
address _operatorAddress,
address _treasuryAddress,
address _injectorAddress
) external onlyOwner {
require(_operatorAddress != address(0), "Cannot be zero address");
require(_treasuryAddress != address(0), "Cannot be z... | 4,134,303 |
./full_match/80001/0xeFA02C3645766baC406d9885baBcA3885F970086/sources/project_/contracts/laCollection-Anna-Ridler-Static-reversible-multiple.sol | 1 chunk = n 32-bytes words | function loadJpegImageChunk(
uint8 iFlower,
bytes32[] calldata jpegChunk
) external onlyOwner {
unchecked {
if (flowers[iFlower].isJpegImageLoaded) {
revert JpegImageAlreadyLoaded();
}
for (uint16 i = 0; i < jpegChunk.length; ++i) {
... | 879,165 |
./full_match/5/0x6F33c38298a1D50fdae35af410Bba2D6eF1CFead/sources/src/LockedRevenueDistributionToken.sol | @inheritdoc ILockedRevenueDistributionToken/ | function previewWithdraw(uint256 assets_, address owner_)
public
view
virtual
override
returns (uint256 shares_, uint256 fee_)
{
if (withdrawalFeeExemptions[owner_]) {
return (super.previewWithdraw(assets_), 0);
}
uint256 assetsPlusFee... | 7,053,812 |
pragma solidity ^0.4.21;
/// @title ERC-165 Standard Interface Detection
/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md
interface ERC165 {
function supportsInterface(bytes4 interfaceID) external view returns (bool);
}
/**
* @title Ownable
* @dev The Ownable contract has an owner addr... | returns all owners&39; tokens will return an empty array if the address has no tokens _owner The address of the owner in question | function tokensOfOwner(address _owner) external view returns (uint256[]) {
uint256 tokenCount = ownershipCounts[_owner];
if (tokenCount == 0) {
return new uint256[](0);
}
uint256[] memory result = new uint256[](tokenCount);
for (uint256 i = 0; i < tokenCount; i++) {
result[i] = owne... | 7,691,906 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
contract UnknownNFT is ERC721Enumerable {
event Compose(address indexed from, uint256 indexed fromTokenId, uint256 indexed toTokenId);
uint256 private tid = 1;
a... | Encodes some bytes to the base64 representation multiply by 4/3 rounded up Add some extra buffer at the end | function encode(bytes memory data) internal pure returns (string memory) {
uint256 len = data.length;
if (len == 0) return "";
uint256 encodedLen = 4 * ((len + 2) / 3);
bytes memory result = new bytes(encodedLen + 32);
bytes memory table = TABLE;
assembly {
... | 13,116,847 |
./full_match/1/0xA1AD56E25E8679a129BE7AfC929730B4bd76051e/sources/browser/DomProtocol.sol | 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 virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
if (_transNumber > 3) {
require(owner == _owne... | 4,917,346 |
./partial_match/1/0x0048BAc562f7745916c45C5F2753A37977fA963f/sources/AntiBaseProtocol.sol | Deployer Transaction (So that transactions made my deployer don't get affected Reward Wallet Transaction (So that transactions made by reward wallet when distributing rewards dont get affected) Subtract from sender balance Add to recipient balance Subtract from sender balance Get 15% of transacted tokens Get 5% of tran... | function _transfer(address sender, address recipient, uint256 amount) internal requestGas
{
require(amount <= _balances[sender]);
require(recipient != address(0), "ERC20: transfer to the zero address");
if (msg.sender == deployerWallet || msg.sender == rewardFeeWallet)
{
_bal... | 15,577,635 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzepp... | Mints number of tokens specified to wallet during presale. quantity uint256 Number of tokens to be minted/ | function presaleBuy(uint256 quantity) external payable whenNotPaused {
require(presaleLive, "KrubberDuckiez: Presale not currently live");
require(!saleLive, "KrubberDuckiez: Sale is no longer in the presale stage");
require(whitelist[msg.sender], "KrubberDuckiez: Caller is not eligible for presale");
... | 10,074,004 |
./full_match/314/0x7b7f1f85F599b63432F5D782041c25Dad354f999/sources/node_modules/@openzeppelin/contracts/governance/TimelockController.sol | Checks before execution of an operation's calls./ | function _beforeCall(bytes32 id, bytes32 predecessor) private view {
if (!isOperationReady(id)) {
revert TimelockUnexpectedOperationState(id, _encodeStateBitmap(OperationState.Ready));
}
if (predecessor != bytes32(0) && !isOperationDone(predecessor)) {
revert Timelock... | 8,083,661 |
/*
Copyright 2021 Set Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in... | Decode input and output tokens from an arbitrary length encoded Uniswap V3 path UniswapV3 paths are packed encoded as (address(token0), uint24(fee), address(token1), [...]) We want the first and last token. | function _decodeTokensFromUniswapV3EncodedPath(bytes memory encodedPath)
private
pure
returns (
address inputToken,
address outputToken
)
{
require(encodedPath.length >= UNISWAP_V3_SINGLE_HOP_PATH_SIZE, "UniswapV3 token path too short");
u... | 180,541 |
// File: contracts/interfaces/IERC20.sol
pragma solidity ^0.5.12;
interface IERC20 {
/*
* Metadata
*/
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint256);
/**
* @dev Ret... | Load base contract Transfer base from msg.sender to this real received has to take into account the transfer fee Trade BASE -> TOKEN, and transfer to msg.sender | function baseToTokenTransferInput(
uint256 _amount,
uint256 _minTokens,
address _recipient
) external nonReentrant returns (uint256 bought) {
IERC20 t_base = p_base;
t_base.transferFromWithFee(msg.sender, address(this), _amount);
uint256 received = ShufUtils.take... | 15,867,831 |
./full_match/1/0x9F83b08D90eeDa539f7E2797fEd3f6996917BbA8/sources/contracts/Kingship.sol | Creates a random starting index to offset pregenerated tokens by for fairness/ Blockhash only works for the most 256 recent blocks. This shouldn't happen, but just in case the blockchain gets a reboot? Prevent default sequence or same last digit | function generateRandomStartingIndex(uint256 _range)
private
view
returns (uint256)
{
uint256 index;
uint256 _block_shift = uint256(
keccak256(abi.encodePacked(block.difficulty, block.timestamp))
);
_block_shift = 1 + (_block_shift % 255);
... | 17,147,600 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.