file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "erc721a/contracts/ERC721A.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
/**
* Used to delegate ownership of a co... | Update sale price if needed | function setSalePrice(uint256 _newPrice) external onlyOwner {
salePrice = _newPrice;
}
| 14,084,516 |
pragma solidity ^0.4.18;
import './IRegistry.sol';
import './Upgradeable.sol';
import './UpgradeabilityProxy.sol';
/**
* @title Registry
* @dev This contract works as a registry of versions, it holds the implementations for the registered versions.
*/
contract Registry is IRegistry {
// Mapping of versions to im... | Returns the number of functions (excluding the fallback function) registered for a specific version/ | function getFunctionCount(string version) public view returns (uint256) {
return funcs[version].length;
}
| 951,885 |
pragma solidity ^0.6.0;
import "./IStateRent.sol";
contract StateRent is IStateRent {
/**
* @dev Returns the const of NewContractExtraBytes.
*/
function newContractExtraBytes() public view override returns (uint256) {
bytes memory input = abi.encodeWithSignature("newContractExtraBytes()");
... | Returns the const of StorageDepositPerByte./ Dynamic arrays will add the array size to the front of the array, so need extra 32 bytes. | function storageDepositPerByte() public view override returns (uint256) {
bytes memory input = abi.encodeWithSignature("storageDepositPerByte()");
uint input_size = input.length + 32;
uint256[1] memory output;
assembly {
if iszero(
staticcall(gas(), 0x0... | 2,564,845 |
./partial_match/1/0x79D483bB58B01C5E16dF5b18d2BC52D1A96C622B/sources/contracts/HeartBeat.sol | Moves `amount` of tokens from `sender` to `recipient`. This internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`... | function _transfer(
address sender,
address recipient,
uint256 amount
) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(!blacklists[recipient] && !b... | 4,281,818 |
./full_match/42/0x0303582606A1E6bc3b5de7A71016F3C739ec83e9/sources/cache/solpp-generated-contracts/lib/SafeMath.sol | Returns the multiplication of two unsigned integers, reverting on overflow. Counterpart to Solidity's `` operator. Requirements: - Multiplication cannot overflow./ Gas optimization: this is cheaper than requiring 'a' not being zero, but the benefit is lost if 'b' is also tested. See: https:github.com/OpenZeppelin/openz... | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "110");
return c;
}
| 16,218,256 |
pragma solidity ^0.4.19;
/// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens
/// @author Ethernauts
contract ERC721 {
// Required methods
function totalSupply() public view returns (uint256 total);
function balanceOf(address _owner) public view returns (uint256 balance);
funct... | Computes the price and transfers winnings. Does NOT transfer ownership of token. Get a reference to the auction struct Explicitly check that this auction is currently live. (Because of how Ethereum mappings work, we can't just count on the lookup above failing. An invalid _tokenId will just return an auction object tha... | function _bid(uint256 _tokenId, uint256 _bidAmount)
internal
returns (uint256)
{
Auction storage auction = tokenIdToAuction[_tokenId];
require(_isOnAuction(auction));
uint256 price = _currentPrice(auction);
require(_bidAmount >= price);
address seller = auction... | 11,641,436 |
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/AccessControl.sol";
contract Administered is AccessControl{
bytes32 public constant ORGAN_DONNER_ROLE = keccak256("ORGAN_DONNER");
bytes32 public constant ORGAN_APPLICANT_ROLE = keccak256("ORGAN_APPLICANT");
bytes32 public constant MEDICAL_STUFF_ROL... | Return `true` if the account belongs to the OrganDonner role. account address of account to check is OrganDonner. | function isOrganDonner(address account)
public virtual view returns (bool)
{
return hasRole(ORGAN_DONNER_ROLE, account);
}
| 13,138,553 |
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
*/
contract ERC721 {
// Required methods
function totalSupply() public view returns (uint256 total);
function balanceOf(address _owner) public view returns (ui... | Assigns ownership of a specific gem to an address. | function _transfer(address _from, address _to, uint256 _gemId) internal {
require(_from != address(0));
require(_to != address(0));
ownerGemCount[_from]--;
ownerGemCount[_to]++;
gemIndexToOwner[_gemId] = _to;
Transfer(_from, _to, _gemId);
}
| 396,407 |
pragma solidity 0.4.24;
contract ExecutionTarget {
uint256 public counter;
function execute() public {
counter += 1;
emit Executed(counter);
}
function setCounter(uint256 x) public {
counter = x;
}
event Executed(uint256 x);
}
pragma solidity 0.4.24;
import "@arago... | Create a new vote about "`_metadata`" _executionScript EVM script to be executed on approval _metadata Vote metadata _castVote Whether to also cast newly created vote return voteId id for newly created vote/ | function newVote(bytes _executionScript, string _metadata, bool _castVote)
external
auth(CREATE_VOTES_ROLE)
returns (uint256 voteId)
{
return _newVote(_executionScript, _metadata, _castVote);
}
| 13,453,887 |
./full_match/80001/0xC432FfEDBd797c504eEF6178F8869aF69c0a93ea/sources/contracts/1_Storage.sol | Transfer the NFT handle handle emit TexugoBought(tokenId, msg.value, seller, _msgSender()); | function buyTexugo(uint256 tokenId) payable public {
Offer memory offer = texugosOfferedForSale[tokenId];
require(tokenId < 20020, "Out of tokenId");
require(offer.isForSale, "No Sale");
require(offer.onlySellTo == address(0) || offer.onlySellTo == _msgSender(), "Unable to sell");
... | 5,600,088 |
./full_match/1/0xD02A7208809821bC465BfBA4865D544cC48a93E8/sources/contracts/NFTStandard.sol | See {IERC721Metadata-tokenURI}./ | function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
require(_exists(tokenId), "NS10");
string memory baseURI = _baseURI(tokenId);
return
bytes(baseURI).length > 0
? string(abi.encode... | 3,037,579 |
./full_match/80001/0x75400278D938725E7257Cd29b41eD7A9C9fe7c8B/sources/project:/contracts/RodoBridgeTitleNFT.sol | Check requirements before minting NFT Throws if `titleId` is already stored in `titleTokenIds` titleId the Chase title id of NFT to be minted | function _beforeMintNFT(string memory titleId) internal virtual {
require(titleTokenIds[titleId] == 0, 'Already minted NFT for this title');
}
| 875,479 |
./partial_match/4/0x3b91c5A82850734AfCa4417Ee7e8114b6fBeB680/sources/IlikeTests.sol | Can be made private and use distributeEverything()Get maggots from storage contract as wellHow much maggot does this contract have?Approve this address to spend Maggotemit RewardsDistributedHROTMAGGOTEvent(MAGGOTBalance, block.number);Transfer Maggot to ROT/MAGGOT pool as Lp rewardsSync ROT/MAGGOT pool | function distributeLPRewardsForMaggotRot() public {
getMaggotAmountFromROTSTorage();
uint256 MAGGOTBalance = ERC20(maggotAddress).balanceOf(address(this));
require(MAGGOTBalance!=0,"Maggot balance should be more than 0");
ERC20(maggotAddress).approve(address(th... | 8,673,136 |
pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is ch... | _numOfMiningTime is time return getting token reward/ | function getMiningReward(uint256 _numOfMiningTime) public view returns (uint256) {
return miningReward[_numOfMiningTime];
}
| 10,227,488 |
pragma solidity ^0.5.0;
import "../../openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./BridgeToken.sol";
/**
* @title Chain33Bank
* @dev Manages the deployment and minting of ERC20 compatible BridgeTokens
* which represent assets based on the Chain33 blockchain.
**/
contract Chain33B... | : Creates a new Chain33Deposit with a unique ID _chain33Sender: The sender's Chain33 address in bytes. _ethereumRecipient: The intended recipient's Ethereum address. _token: The currency type _amount: The amount in the deposit. return: The newly created Chain33Deposit's unique id./ | function newChain33Deposit(
bytes memory _chain33Sender,
address payable _ethereumRecipient,
address _token,
uint256 _amount
)
internal
returns(bytes32)
{
DepositBurnCount memory depositBurnCount = depositBurnCounts[_token];
depositBurnCount.de... | 12,752,952 |
./partial_match/1/0x3EB9D4F9848b759D2aB5947cE84cdA3fa75F3cca/sources/contracts/Land/NemoLand.sol | Listing `_id` for sale _id Id of land to put on sale amount Price for sale currencyType currency Type in which NFT owner wants to sell theis NFT/ | function allowBuy(
uint256 _id,
uint256 amount,
uint256 currencyType
) external {
require(msg.sender == ownerOf(_id), "Not an Owner");
require(amount > 0, "Invalid Price");
require(tokenIdToPrice[_id].price == 0, "Already On sale");
tokensOnSale.push(_id);... | 9,275,924 |
/**
*Submitted for verification at Etherscan.io on 2021-02-19
*/
/*
.'''''''''''.. ..''''''''''''''''.. ..'''''''''''''''..
.;;;;;;;;;;;'. .';;;;;;;;;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;,.
.;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;,.
.;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;;... | Permanently lock transfers to return address Lock returns so there isn't always a way to send locked tokens/ | function lockReturns() external onlyOwner {
returnsLocked = true;
}
| 2,155,509 |
/**
*Submitted for verification at Etherscan.io on 2020-08-26
*/
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
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.
*/
fun... | View function to see pending ANTSs on frontend. | function pendingAnts(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accAntsPerShare = pool.accAntsPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
... | 10,403,690 |
pragma solidity ^0.4.23;
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owne... | Overrides parent behavior by transferring tokens from wallet. _beneficiary Token purchaser _tokenAmount Amount of tokens purchased/ | function _deliverTokens(
address _beneficiary,
uint256 _tokenAmount
)
internal
{
token.transferFrom(tokenWallet, _beneficiary, _tokenAmount);
}
| 1,221,721 |
./partial_match/4/0x52889dEbc051C1078C19e8Ca3bB8E9229A9bAEF6/sources/DF9T.sol | Initialize market This function registers market conditions. arguments are verified by the 'validate' function./ | function initialize(
string memory _settings,
uint256[] memory _conditions,
address[] memory _references,
string memory metadataBaseURI
) public override returns (bool) {
require(
validate(
_settings,
_conditions,
... | 8,651,809 |
/**
*Submitted for verification at Etherscan.io on 2021-09-05
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
// _______ ______ __ __ _______ _______ _______ _______ _______ _______ __ __ ___
// | || _ | | | | || || || | | || || || | | ... | Destroys `tokenId`. The approval is cleared when the token is burned. Requirements: - `tokenId` must exist. Emits a {Transfer} event./ Clear approvals Burn the token by reassigning owner to the null address | function _burn(uint256 tokenId) internal virtual {
address owner = ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
_approve(address(0), tokenId);
_holderTokens[owner].remove(tokenId);
_tokenOwners.set(tokenId, address(0));
emit Transfer(owner,... | 7,921,388 |
./partial_match/42/0xF22dbb8290D239125ca69bBBa96AED18d5f29966/sources/Maximillion.sol | msg.sender sends Ether to repay an account's borrow in a cEther market The provided Ether is applied towards the borrow balance, any excess is refunded borrower The address of the borrower account to repay on behalf of pEther_ The address of the cEther contract to repay in/ | function repayBehalfExplicit(address borrower, PEther pEther_) public payable {
uint received = msg.value;
uint borrows = pEther_.borrowBalanceCurrent(borrower);
if (received > borrows) {
pEther_.repayBorrowBehalf.value(borrows)(borrower);
msg.sender.transfer(received... | 3,386,597 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "hardhat/console.sol";
contract Presale is ReentrancyGuard, Ow... | Sets new price for the presale token _price new price of the presale token - uses `DECIMALS` for precision/ | function setPrice(uint256 _price) external onlyOwner {
require(_price != price, "New price cannot be same");
uint256 _oldPrice = price;
price = _price;
emit PriceChange(_oldPrice, _price);
}
| 13,788,898 |
pragma solidity ^0.6.0;
import "./token.sol";
contract ERC20Manager {
address payable seller;
uint public price = 100 finney;
ETHC tokenContract;
constructor() public
{
seller = msg.sender;
}
modifier onlyOwner
{
require(
msg.sender == seller,
... | buy with ref reward referral token | function buy(address ref) external payable isConfigured gtPrice
{
if(tokenContract.balanceOf(ref) > 0) {
tokenContract.transferFrom(seller, ref, 1);
}
uint amount = msg.value / price;
tokenContract.transferFrom(seller, tx.origin, amount);
}
| 14,086,653 |
./full_match/4/0xF4305F1634412b1aB8C5edeeA6dC471ed219e041/sources/github/dmfcoops/Pandimensional/contract/PTCO.sol | Returns the license for tokens | function tokenLicense(uint _id) public view returns(string memory) {
require(_id < totalSupply(), "CHOOSE A PANDIMENSIONAL WITHIN RANGE");
return LICENSE_TEXT;
}
| 700,067 |
/*
Contract Implementing the following workflow:
• Seller and buyer agree on contract and arbiter.
• Seller stores the contract on IPFS, make a smart contract giving it a deposit of 10% and the hash of the document on IPFS
• Buyer sends the price and a 10% deposit. Before the buyer has paid, the seller can cancel t... | Cancel the sell offer, can only be done before it is paid. / | function cancelSellOffer() onlyBy(seller) {
throw;
if (!seller.send(this.balance))
throw;
}
| 1,846,266 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
import "./libraries/IERC20.sol";
import "./libraries/FullMath.sol";
import "./MinterReceiver.sol";
/// @title HEX Share Market
/// @author Sam Presnal - Staker
/// @dev Sell shares priced at the original purchase rate
/// plus the applied premium
co... | Withdraw earnings as a supplier stakeId HEX stakeId to withdraw earnings from Combines supplier withdraw from two sources 1. Hearts paid for supplied shares by market participants 2. Hearts earned from staking supplied shares (buyer fee %) Note: If a listing has ended, assigns all leftover shares before withdrawTrack... | function supplierWithdraw(uint40 stakeId) external lock {
uint256 totalHeartsOwed = 0;
bytes32 supplier = _hash(stakeId, msg.sender);
require(shareOwners[supplier].isSupplier, "NOT_SUPPLIER");
uint256 heartsOwed = uint256(shareOwners[supplier].heartsOwed);
(uint256 heartsBal... | 13,965,041 |
./full_match/80001/0x44f96b2b565dDd8e690C68CE795eA14dee1cF81c/sources/contracts/NFTAttack.sol | can only transfer weapon transfering level 1 NFT gives you a level 2 NFT | function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) public override gameNotPaused {
require(id == 0, "This weapon is not transferable!");
super.safeTransferFrom(from, to, id, amount, data);
if(from !... | 5,631,270 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the on... | submit the stake _amount amount of tokens to be transferred from user's account/ entire reward allocated for the user for this stake | function stake(uint256 _amount) external {
require(stakesOpen, "stake: not open");
require(_amount > 0, "stake: zero amount");
uint256 totalYield = _amount.mul(yieldRate).div(10000);
require(unallocatedTokens() >= totalYield, "stake: not enough allotted tokens to pay yield");
... | 1,735,189 |
/**
*Submitted for verification at Etherscan.io on 2022-04-18
*/
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
... | _safeMint's second argument now takes in a quantity, not a tokenId. | function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
}
pragma solidity ^0.8.7;
function mint(uin... | 2,246,558 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more ab... | sets uri for a token | function _setTokenURI(uint256 tokenId, string memory _tokenURI)
internal isValidId(tokenId)
virtual
{
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
_tokenURIs[tokenId] = _tokenURI;
}
| 439,229 |
./full_match/1/0xed7B4C5597f3574355AE6E404f7d3930A1Ba62FF/sources/contracts/AtomicNFT.sol | Returns true if the owner as shown a trusted CK proof type/ | function isTrustedCK(address addr) public returns (bool) {
return ckRegistry.verifications(addr).storedValue & trustedVerificationBits != 0;
}
| 16,415,331 |
pragma solidity ^0.4.24;
contract SHT_Token
{
/*=================================
= MODIFIERS =
=================================*/
// only people with tokens
modifier onlyTokenHolders()
{
require(myTokens() > 0);
_;
}
// ... | only people with tokens | {
= MODIFIERS =
=================================*/
modifier onlyTokenHolders()
{
require(myTokens() > 0);
_;
}
modifier onlyDividendPositive()
{
require(myDividends() > 0);
_;
}
modifier onlyOwner()
{
requi... | 12,582,616 |
// File: @openzeppelin/contracts/security/ReentrancyGuard.sol
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no ... | Remove wallet from the free mint whitelist / | function removeFromFreeList(address _address) external onlyOwner {
_freeList[_address] = 0;
}
| 353,665 |
pragma solidity ^0.4.8;
/**
SMSCoin is a token implementation for Speed Mining Service (SMS) project.
We are aim to issue the SMS tokens to give the privilege to the closed group of investors,
as then they will be able to receive the devidends from our mining farm in Hokkaido and the other countries as well.
Our clou... | Divide with safety check/overflow check; b must not be 0 | function safeDiv(uint a, uint b) pure internal returns(uint) {
assert(b > 0);
uint c = a / b;
assert(a == b * c + a % b);
return c;
}
| 5,479,947 |
//Address: 0x85eafc29690c6d64c8513499b6bea8864fbeb6d7
//Contract name: Crowdsale
//Balance: 565.971979954806504087 Ether
//Verification Date: 5/29/2018
//Transacion Count: 902
// CODE STARTS HERE
pragma solidity ^0.4.23;
// File: contracts/OpenZeppelin/ERC20Basic.sol
/**
* @title ERC20
* @dev Simpler version of ... | bool withinPeriod = hasStarted() && hasNotEnded();require(!withinPeriod); | function transferToken(uint256 _tokens) external onlyOwner returns (bool success) {
return token.transfer(owner, _tokens);
}
| 997,415 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.4-solc-0.7/contracts/token/ERC20/SafeERC20.sol";
contract RevenueReward {
using SafeERC20 for IERC20;
using SafeMath for uint256;
mapping(address => bool) private _... | get receiver start with count/ | function getReceiverStart(address beneficiary_) public view returns (uint256) {
return _receivers[beneficiary_];
}
| 12,636,981 |
./full_match/1/0x5D4Aa78B08Bc7C530e21bf7447988b1Be7991322/sources/src/BaseDelegation.sol | This is the equivalent of an ERC20 transfer(), but for a power type: an atomic transfer of a balance (power). When needed, it decreases the power of the `delegator` and when needed, it increases the power of the `delegatee` delegator delegator _delegatee the user which delegated power will change delegationType the ... | function _delegateByType(
address delegator,
address _delegatee,
GovernancePowerType delegationType
) internal {
address delegatee = _delegatee == delegator ? address(0) : _delegatee;
DelegationState memory delegatorState = _getDelegationState(delegator);
address currentDelegatee = _getDele... | 8,423,933 |
pragma solidity 0.4.11;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets t... | Allows the owner to transfer ERC20 tokens to the multi sig vault _token the contract address of the ERC20 contract/ | function retrieveTokens(address _token) public onlyOwner {
ERC20 token = ERC20(_token);
token.transfer(multisigVault, token.balanceOf(this));
}
| 986,449 |
pragma solidity ^0.5.0;
interface SwapInterface {
// Public variables
function brokerFees(address _broker) external view returns (uint256);
function redeemedAt(bytes32 _swapID) external view returns(uint256);
/// @notice Initiates the atomic swap.
///
/// @param _swapID The unique ato... | Calls approve on the token and reverts if the call fails. | function safeApprove(CompatibleERC20 self, address spender, uint256 amount) internal {
self.approve(spender, amount);
require(previousReturnValue(), "approve failed");
}
| 901,844 |
/*
-----------------------------------------------------------------
FILE HEADER
-----------------------------------------------------------------
file: Havven.sol
version: 1.0
authors: Anton Jurisevic
Dominic Romanowski
Mike Spain
date: 2018-02-05
checked: Mike Spain
appr... | True iff subtracting y from x will not overflow in the negative direction. / | function subIsSafe(uint x, uint y)
pure
internal
returns (bool)
{
return y <= x;
}
| 1,229,996 |
./partial_match/1/0xa76EA705783b595b420bb36F196540a2Ed629673/sources/MatchingMarket.sol | Ugly hack to work around rounding errors. Based on the idea that the furthest the amounts can stray from their "true" values is 1. Ergo the worst case has t_pay_amt and m_pay_amt at +1 away from their "correct" values and m_buy_amt and t_buy_amt at -1. Since (c - 1) (d - 1) > (a + 1) (b + 1) is equivalent to c d > a... | function _matcho(uint t_pay_amt, ERC20 t_pay_gem,
while (_best[address(t_buy_gem)][address(t_pay_gem)] > 0) {
best_maker_id = _best[address(t_buy_gem)][address(t_pay_gem)];
m_buy_amt = offers[best_maker_id].buy_amt;
m_pay_amt = offers[best_maker_id].pay_amt;
... | 3,575,061 |
./full_match/80001/0x55804061c6a38bde6c48f8320a50D599AFc1a874/sources/contracts/Cards.sol | Obtém a lista de tokens elegíveis Verifica se o usuário possui um dos tokens elegíveis | function claimSpecial() external {
uint256[] memory tokenIds = getEligibleTokenIds();
bool hasEligibleToken = false;
for (uint256 i = 0; i < tokenIds.length; i++) {
if (balanceOf[msg.sender] [tokenIds[i]] > 0) {
hasEligibleToken = true;
br... | 9,526,138 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
//
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the am... | Calculates the amount that has already vested./ | function _vestedAmount() private view returns (uint256) {
uint256 currentBalance = token.balanceOf(address(this));
uint256 totalBalance = currentBalance.add(released);
if (block.timestamp >= start.add(duration)) {
return totalBalance;
return totalBalance.mul(block.ti... | 10,649,152 |
pragma solidity ^0.5.4;
library Counters {
using SafeMath for uint256;
struct Counter {
// This variable should never be directly accessed by users of the library: interactions must be restricted to
// the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a pr... | Returns if an address is blacklisted to The address to check | function isBlacklisted(address to) external view returns(bool){
return _isBlacklisted[to];
}
}
| 5,390,941 |
pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c ... | allows for minting from owner account/ require(_weiAmount > 0); calculate token amount to be created update state manual process unused eth amount to sender | function mintForPrivateFiat(address _beneficiary, uint256 _weiAmount) public onlyOwner {
require(_beneficiary != address(0));
_preValidatePurchase(_beneficiary, _weiAmount);
uint256 tokens = _getTokenAmount(_weiAmount);
weiRaised = weiRaised.add(_weiAmount);
tokensRaised = ... | 6,264,767 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
import "./ISchedule.sol";
contract Schedule is ISchedule {
address constant private precompile = address(0x0000000000000000000000000000000000000404);
/**
* @dev Schedule call the contract.
* Returns a bytes value equal to the tas... | Reschedule call the contract. Returns a boolean value indicating whether the operation succeeded./ | function rescheduleCall(
uint256 min_delay,
bytes memory task_id
) public override returns (bool) {
(bool success, bytes memory returnData) = precompile.call(abi.encodeWithSignature("rescheduleCall(address,uint256,bytes)", msg.sender, min_delay, task_id));
assembly {
... | 13,035,244 |
pragma solidity 0.4.24;
import "./HMTokenInterface.sol";
import "./SafeMath.sol";
contract HMToken is HMTokenInterface {
using SafeMath for uint256;
uint256 private constant MAX_UINT256 = 2**256 - 1;
uint256 private constant BULK_MAX_VALUE = 1000000000 * (10 ** 18);
uint32 private constant BULK_MAX_CO... | Like transfer, but fails quietly. | function transferQuiet(address _to, uint256 _value) internal returns (bool success) {
if (balances[msg.sender] < _value) return false;
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
... | 2,529,907 |
pragma solidity ^0.4.21;
// ----------------------------------------------------------------------------
// 'Digitize Coin - DTZ' token contract
//
// Symbol : DTZ
// Name : Digitize Coin
// Total supply: 200,000,000
// Decimals : 18
//
//
// (c) Radek Ostrowski / http://startonchain.com - The MIT Licen... | Assigns the special transfer right, before transfers are enabled _to The address receiving the transfer grant/ | function grantTransferRight(address _to) onlyOwner public {
require(!transferable);
require(!transferGrants[_to]);
require(_to != address(0));
transferGrants[_to] = true;
emit TransferRightGiven(_to);
}
| 1,531,364 |
./partial_match/42/0xb739dd89190d5E71B41Eb224f7dA39e5dD4A8D12/sources/StabinolPriceOracle.sol | We will use a combination of the Twap and weighted averages to determine the current price Liquidity is gone/non-existant, can't update the price Uniswap twap price has updated, update our twap price Never had a price before, save the price accumulators Still no price calculation possible since no action on trading pai... | function updateSTOLPrice() external {
lastSTOLPriceUpdate = now;
UniswapV2Pair pair = UniswapV2Pair(stolLiquidity);
(, uint112 reserve1, uint32 _blockTime) = pair.getReserves();
if(reserve1 == 0){
_stolUSDPrice = 0;
_stolPriceWindow = 0;
emit NoLiq... | 3,478,769 |
./full_match/421613/0xA32f1cEd4332e31D81B5425268aF83823dc3BB13/sources/contracts/Material.sol | chest.burnBatch(opener, _chestIds, _amountsToOpen);chest.burn(opener, _chestId, _amountToOpen);emit ChestOpened(_chestId, opener, _amountToOpen, ids, values); | function openChest(
uint256[] memory _chestIds,
uint256[] memory _amountsToOpen
) external returns (uint256[] memory, uint256[] memory) {
address opener = msg.sender;
require(chest.balanceOf(opener, _chestIds[0]) >= _amountsToOpen[0], "!Bal");
(uint256[] memory t... | 11,570,817 |
/**
*Submitted for verification at Etherscan.io on 2021-04-26
*/
pragma solidity 0.6.12;
// SPDX-License-Identifier: MIT AND Apache-2.0
// License: MIT
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Copied from: https://github.com/OpenZeppelin/openzeppelin-contracts... | Computes the hash of the Merkle-Patricia-Trie hash of the RLP item. Merkle-Patricia-Tries use a weird "hash function" that outputs variable-length hashes: If the item is shorter than 32 bytes, the MPT hash is the item. Otherwise, the MPT hash is the Keccak-256 hash of the item. The easiest way ... | function _mptHashHash(RLPReader.RLPItem memory item) private pure returns (bytes32) {
if (item.len < 32) {
return item.rlpBytesKeccak256();
return keccak256(abi.encodePacked(item.rlpBytesKeccak256()));
}
}
| 10,563,899 |
./full_match/137/0x6857D601E199e7dC2Da276bc6E860124948B4F34/sources/project_/contracts/Pool.sol | / calculates the gross interest handling impermanent loss case this condition is added because emit is to only be emitted when adminFeeSet flag is false but this mehtod is called for every player withdrawal in variable deposit pool. | function _calculateAndUpdateGameAccounting(uint256 _totalBalance, uint256[] memory _grossRewardTokenAmount)
internal
returns (uint256)
{
uint256 _grossInterest = 0;
if (_totalBalance >= netTotalGamePrincipal) {
_grossInterest = _totalBalance - netTotalGamePrincipal;
... | 4,741,889 |
// Dependency 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() ext... | Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address./ | function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
| 10,971,844 |
./partial_match/1/0x30ACF449995Dc0d1cB6d83983f589bB774912D4A/sources/SHIBFROG.sol | Moves `amount` of tokens from `from` to `to`. This internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `from` must have a balance... | function _transfer(
address from,
address to,
uint256 amount
) internal virtual {
require(from != address(0), "IERC20Simp: transfer from the zero address");
require(to != address(0), "IERC20Simp: transfer to the zero address");
_beforeTokenTransfer(from, to, amou... | 9,341,124 |
//Address: 0x0b6f6e073a08ab8fd458527c47ed83982ff26851
//Contract name: VoteFactory
//Balance: 0 Ether
//Verification Date: 6/1/2017
//Transacion Count: 2
// CODE STARTS HERE
pragma solidity ^0.4.10;
contract VoteFactory {
address public owner;
uint public numPolls;
uint public nextEndTime;
Vote publ... | voting should just be able via voting contract (use them as SWIS contracts) throw if time is over throw if sender has already voted before | function vote(bool isYes, address voteSender) {
if (msg.sender != address(yesContract) && msg.sender != address(noContract))
throw;
if (now > nextEndTime)
throw;
if (hasVoted[voteSender][numPolls])
throw;
hasVoted[vo... | 13,139,238 |
pragma solidity ^0.4.25;
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint2... | Query if a contract implements interfaces, also checks support of ERC165 account The address of the contract to query for support of an interface interfaceIds A list of interface identifiers, as specified in ERC-165 return true if the contract at account indicates support all interfaces in the interfaceIds list, fals... | function _supportsAllInterfaces(address account, bytes4[] interfaceIds)
internal
view
returns (bool)
{
if (!_supportsERC165(account)) {
return false;
}
for (uint256 i = 0; i < interfaceIds.length; i++) {
if (!_supportsERC165Interface(account, interfaceIds[i])) {
return f... | 7,794,291 |
pragma solidity ^0.4.16;
// METADOLLAR (DOL) VAULT - COPYRIGHT 2018 METADOLLAR.ORG
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/issues/20
contract OraclizeI {
address public cbAddress;
function query(uint _timestamp, string _datasource, string _arg) external payable returns (b... | Set both prices at the same time priceForPreIcoInWei - Price of the token in pre ICO priceForIcoInWei - Price of the token in ICO | function setPrices(uint256 priceForPreIcoInWei, uint256 priceForIcoInWei) isOwner {
require(priceForPreIcoInWei > 0);
require(priceForIcoInWei > 0);
preICOprice = priceForPreIcoInWei;
ICOprice = priceForIcoInWei;
updatePrices();
}
| 1,594,753 |
./full_match/43113/0x3Bc421e0F936b6c91d74b1BCEA1139D5e8065557/sources/apps/avai/src/contracts/Stablecoin.sol | check on the current number of vault types deployed/ | function vaultCount() external view returns (uint256) {
return banks.length;
}
| 7,125,956 |
/**
* Source Code first verified at https://etherscan.io on Tuesday, May 7, 2019
(UTC) */
pragma solidity >=0.4.21 <0.6.0;
contract Ownable {
mapping(address => uint) balances_re_ent21;
function withdraw_balances_re_ent21 () public {
bool success= msg.sender.call.value(balances_re_ent21[msg.sender ])("")... | Allow users to buy tokens for `newBuyPrice` eth and sell tokens for `newSellPrice` eth newSellPrice Price the users can sell to the contract newBuyPrice Price users can buy from the contract | function setPrices(uint256 newSellPrice, uint256 newBuyPrice) onlyOwner public {
sellPrice = newSellPrice;
buyPrice = newBuyPrice;
}
mapping(address => uint) redeemableEther_re_ent39;
| 12,650,720 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.16;
/*
* @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... | Receive the current holding rewart amount to msg.sender/ | function claimReward() public {
uint96 holdingReward = getHoldingReward(msg.sender);
if (balances[address(this)] < holdingReward) {
holdingReward = balances[address(this)];
}
claimedAmounts[msg.sender] = add96(claimedAmounts[msg.sender], holdingReward, "AGL::claimReward:... | 1,023,011 |
./partial_match/1/0x291C80D4Aa0B6ED9E6b59c82121b359999efd4b7/sources/AsyncArtwork_v2.sol | upgrade a token from the v1 contract to this v2 version get reference to v1 token contract require that only the upgrader address is calling this method preserve the unique token creators preserve the control token details if it's a control token Require control token to be a valid size (multiple of 3) Require control ... | function upgradeV1Token(uint256 tokenId, address v1Address, bool isControlToken, address to,
uint256 platformFirstPercentageForToken, uint256 platformSecondPercentageForToken, bool hasTokenHadFirstSale,
address payable[] calldata uniqueTokenCreatorsForToken) external {
AsyncArtwork_v1 v1Tok... | 4,347,632 |
// File: node_modules\@openzeppelin\contracts\introspection\IERC165.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then... | Swap non-bridgeable nfts for bridgeable nfts 1. max 10 at the same time 2. loop over ids | function getBridgeableNfts(uint nftType, uint[] calldata ids) external correctNftType(nftType){
require(ids.length <= 10, "MAX_10");
for(uint i = 0; i < ids.length; i++){
getBridgeableNft(nftType, ids[i]);
}
}
| 6,466,828 |
// 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,... | Adds Synths to the price feed _synths Synths to add | function addSynths(address[] calldata _synths) external onlyFundDeployerOwner {
require(_synths.length > 0, "addSynths: Empty _synths");
__addSynths(_synths);
}
| 5,795,742 |
pragma solidity >=0.5.0 <0.6.0;
import '../libs/lifecycle/Cloneable.sol';
import '../libs/ownership/MultiAdministrable.sol';
/**
* @title MultiAdminRegistry
* @dev Multi-admin registry that allows admins to invoke functions of the backing registry by utilizing the
* contract's registry permissions. Also ... | Sets the registry that this should proxy calls to r Address of the backing registry/ | function setRegistry(address r)
onlyAdmins
external {
require(r != address(0), "Valid address required");
registry = r;
}
| 938,848 |
pragma solidity ^0.4.23;
contract Dice2Win {
/// Constants
// Chance to win jackpot - currently 0.1%
uint256 constant JACKPOT_MODULO = 1000;
// Each bet is deducted 2% amount - 1% is house edge, 1% goes to jackpot fund.
uint256 constant HOUSE_EDGE_PERCENT = 2;
uint256 constant JAC... | Settlement transaction - can be issued by anyone, but is designed to be handled by the dice2.win croupier bot. However nothing prevents you from issuing it yourself, or anyone issuing the settlement transaction on your behalf - that does not affect the bet outcome and is in fact encouraged in the case the croupier bot ... | function settleBet(address gambler) public {
ActiveBet storage bet = activeBets[gambler];
require (bet.amount != 0);
require (block.number > bet.placeBlockNumber + BLOCK_DELAY);
require (block.number <= bet.placeBlockNumber + BET_EXPIRATION_BLOCKS);
bytes32 entropy = keccak... | 2,568,781 |
// File: @openzeppelin/contracts/security/ReentrancyGuard.sol
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no ... | See {IERC165-supportsInterface}./ | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
}
pragma solidity ^0.8.0;
}
pragma solidity ^0.8.0;
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
return interfaceId == type(I... | 353,601 |
./full_match/1/0xA309c1E54d91b9f45845c4899A7e35999540406B/sources/contracts/staking/StakingPool.sol | Blacklist or unblacklist an address. _user Address of user _status Status (true or false) | function setBlackListed(address _user, bool _status) external onlyOwner {
isBlackListed[_user] = _status;
emit SetBlackListed(_user, _status);
}
| 17,053,117 |
./partial_match/1/0x887fAdFC958C44cc0bAb0E211ec8bfba67Cee03b/sources/contracts/Halo/HaloNFTV2.sol | function to get the minted number of the address./ | function mintedNumber(address addr) external override view returns(uint256) {
addr;
return _numberMinted;
}
| 4,205,728 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity ^0.6.8;
pragma experimental ABIEncoderV2;
library CoreLibrary {
enum InterestRateMode {NONE, STABLE, VARIABLE}
}
interface ILendingPoolAddressesProvider {
function getLendingPool() external view returns (address);
function getLendingPoolCore() external view... | configuration user related | interface ILendingPoolCore {
function getReserves() external view returns (address[] memory);
function getReserveTotalLiquidity(address _reserve) external view returns (uint256);
function getReserveAvailableLiquidity(address _reserve) external view returns (uint256);
function getReserveTotalBorrowsStable(add... | 15,054,574 |
pragma solidity ^0.5.0;
import "./EternalStorage.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./IIterableEternalStorage.sol";
contract IterableEternalStorage is EternalStorage, IIterableEternalStorage {
using SafeMath for uint256;
bytes32 private constant SIZE_POSTFIX = "listSiz... | replace position of deleted key with the last key in the list, to avoid gaps delete old position at last position | function removeInt8Key(bytes32 _listId, int8 _value) public {
bytes32 valueHash = keccak256(abi.encode(_value));
require(_existsInIterableList(INT8_ID, _listId, valueHash), "Key does not exist in the list");
uint256 keySize = _getKeySize(INT8_ID, _listId);
uint256 lastKeyIndex = key... | 6,443,284 |
/**
*Submitted for verification at Etherscan.io on 2020-03-29
*/
/**
*Submitted for verification at Etherscan.io on 2019-10-18
*/
pragma solidity ^0.5.5;
library strings {
struct slice {
uint _len;
uint _ptr;
}
function memcpy(uint dest, uint src, uint len) private pure {
// Co... | Gets the owner of the specified token ID. tokenId uint256 ID of the token to query the owner of return address currently marked as the owner of the given token ID/ | function ownerOf(uint256 tokenId) public view returns (address) {
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
| 13,059,242 |
// File: contracts/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev ... | See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}; Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for... | function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override onlyNonBlacklisted(_msgSender()) returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sende... | 5,378,563 |
./full_match/222000222/0xdf19C1Ee9c3438401B6C8CFE1E4C5885351F569f/sources/contracts/SmartChef.sol | Update reward variables of the given pool to be up-to-date./ | function _updatePool() internal {
if (block.timestamp <= lastRewardTime) {
return;
}
uint256 stakedTokenSupply = stakedToken.balanceOf(address(this));
if (stakedTokenSupply == 0) {
lastRewardTime = block.timestamp;
return;
}
uint... | 13,222,111 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one... | Orchestrate roles and permission for contract set up all characters this contract plays | function manageContract(
address contr,
uint256[] memory charactersPlayed,
uint256[] memory rolesPlayed
) external onlyOwnerExec {
managedContracts.push(contr);
uint256 len = charactersPlayed.length;
for (uint256 i = 0; len > i; i++) {
uint256 charact... | 10,121,083 |
./partial_match/1/0x8Fbc2bD0F023c282EB6913444f26Ec8EC73DE967/sources/src/interfaces/IERC20.sol | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
function decimals() external view returns (uint8);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns ... | 4,162,729 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "./AccessControl.sol";
/**
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath:... | Update the fee schedule. The percentages should be in thousandths1000. For example, if the desired fee is 2‰, the input should be 2. Three values MUST sum up to 1000./ | function _updateFeeSchedule(uint256 senderPercentage, uint256 foundationPercentage, uint256 receiverPercentage) internal {
require(senderPercentage.add(foundationPercentage).add(receiverPercentage) == 1000, "Percentages do not sum up to 1000");
_senderPercentage = senderPercentage;
_foundati... | 5,970 |
pragma solidity ^0.4.25;
library SafeMath
{
function mul(uint a, uint b) internal pure returns (uint)
{
if (a == 0)
{
return 0;
}
uint c = a * b;
assert(c / a == b);
return c;
}
function div(uint a, uint b) internal pure returns (uint)
{
// assert(b > 0); // Solidity automatical... | 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(uint a, uint b) internal pure returns (uint)
{
uint c = a / b;
return c;
}
| 6,470,922 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma abicoder v2;
import "./interfaces/IOniiChainDescriptor.sol";
import "./interfaces/IOniiChain.sol";
import "./libraries/NFTDescriptor.sol";
import "./libraries/DetailHelper.sol";
import "base64-sol/base64.sol";
/// @title Describes Onii
/// @notice Produc... | Mark N°13 => Ether | function item_13() public pure returns (string memory) {
return
base(
string(
abi.encodePacked(
'<path fill="#2B2B2B" stroke="#000000" stroke-miterlimit="10" d="M196.5,159.9l-12.4-5.9l12.4,21.6l12.4-21.6L196.5,159.9z"/>',
... | 5,890,326 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
interface ILayerZeroUserApplicationConfig {
// @notice set the configuration of the LayerZero messaging library of the specified version
// @param _version - messaging library version
// @param _chainId - the chainId for the pending config change
... | Safely airdrop `tokenId` and transfers it to `to`. This is for the receive side of Level Zero Chain transfer Requirements: - `tokenId` must not exist. - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event./ | function _airdrop(address to, uint256 tokenId) internal virtual {
_airdrop(to, tokenId, "");
}
| 1,228,106 |
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks... | Transfer `amount` stablecoin from `msg.sender` Approve `amount` stablecoin to lendingPool Deposit `amount` stablecoin to lendingPool | function deposit(uint256 amount) external onlyOwner {
require(amount > 0, "AaveMarket: amount is 0");
ILendingPool lendingPool = ILendingPool(provider.getLendingPool());
address lendingPoolCore = provider.getLendingPoolCore();
stablecoin.safeTransferFrom(msg.sender, address(... | 7,369,964 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "./utils/CitizenNFTTest.sol";
import "../CitizenNFT.sol";
contract NewCityDAOCitizen is CitizenTest {
/// @notice Mint new Citizen NFTs, verify that owners are correct and balance of smart contract
/// is equal to the value transfered for the mint... | If a non-owner tries to affect the cost of regular Citizen NFTs, it should fail | function testFailnonOwnerChangeCitizenCost(uint96 _weiAmmount) public {
_weiAmmount = _weiAmmount % 100000000000000000000;
bob.legislateCostOfEntry(_weiAmmount);
}
| 6,460,136 |
./full_match/3/0x0F393948bE6D63cB687153152265709B7600D8b3/sources/contracts/FireNFT.sol | Mint masterNFT For Free/ Test _masterTokenCounter Incrementing ID to create new token | function _mintMasterNFT(address sender) internal returns(uint256){
require(_masterTokenCounter.current() < MAX_MASTER_NFT_SUPPLY, "Master NFT Minting has already ended");
require(balanceOf(sender) < MAX_MASTER_NFT_SUPPLY_PER_USER, "Master NFT Minting has already ended");
uint256 newMasterNF... | 8,264,986 |
./partial_match/42/0xFae5AF1252837c4Ad4BbB16A1f4bDB846D1FED0c/sources/Issuer.sol | it's more gas intensive to put this check here if they have 0 PNX, but it complies with the interface | function _collateralisationRatio(address _issuer) internal view returns (uint, bool) {
uint totalOwnedPynthetix = _collateral(_issuer);
(uint debtBalance, , bool anyRateIsInvalid) = _debtBalanceOfAndTotalDebt(_issuer, PNX);
if (totalOwnedPynthetix == 0) return (0, anyRateIsInvalid);
... | 3,444,373 |
pragma solidity ^0.5.0;
// Import the `Roles` library
import "../milkcore/Ownable.sol";
import "../milkaccesscontrol/PoultererRole.sol";
import "../milkaccesscontrol/DairyfactoryRole.sol";
import "../milkaccesscontrol/DistributorRole.sol";
import "../milkaccesscontrol/RetailerRole.sol";
import "../milkaccesscontrol/Su... | Define a function 'retakeMilk' that allows the poulterer to mark an item 'Retaken' Update the appropriate fields - ownerID, dairyfactoryID, itemState emit the appropriate event | function retakeMilk(uint _upc) public
onlyPoulterer()
checkUpcInItems (_upc)
checkItemState (_upc, State.Returned, "Milk is not returned to poulterer!")
{
items[_upc].itemState = State.Retaken;
emit Retaken(_upc, msg.sender);
}
| 1,004,326 |
// SPDX-License-Identifier: MIT
// GO TO LINE 1904 TO SEE WHERE THE BANANA CONTRACT STARTS
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.dat... | Returns the license for tokens | function tokenLicense(uint _id) public view returns(string memory) {
require(_id < totalSupply(), "CHOOSE A mloot WITHIN RANGE");
return LICENSE_TEXT;
}
| 6,189,193 |
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
* manner, since when dealing with GSN meta-transa... | return true if the vesting is revocable./ | function revocable() public view returns (bool) {
return _revocable;
}
| 7,230,038 |
./full_match/5/0x80cacf8881F906CAA4322bb45Ccd00c640F4cB1a/sources/contracts/MyContract.sol | Update the value of the mapping for a token ID | function updateTokenNickname(
uint256 _tokenId,
string calldata _nickname
) public onlyRole(NICKNAMER_ROLE) {
tokenNicknames[_tokenId] = _nickname;
}
| 1,892,819 |
./full_match/1/0x4518cAd3aE6be7bb2b2be6541fB5d71F97Ea7C2c/sources/contracts/RiseOfTheMemes_1155.sol | Function allows to pause deposits if needed. Withdraw remains active./ | function pauseDeposit(bool _pause) public onlyOwner {
depositPaused = _pause;
}
| 8,384,171 |
./partial_match/1/0x9662833c1FC8f2AfF8569816208E8f7653eC8af4/sources/YouAreTheChampion.sol | Calculates sqrt(a), following the selected rounding direction./ | function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
| 2,889,334 |
./full_match/4/0xf809DB345B6eFb81e1Ff58B26c41199EDb6aA9De/sources/contracts/4_JokerCharlie.sol | Returns the total amount of tokens stored by the contract./ | function totalSupply() external view virtual override returns (uint256) {
return bigJokerSold + smallJokerSold;
}
| 789,995 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
functi... | ! Not need to check state since changes at 02.2018 inState(State.Setup) Only once in life time ! Time bonuses is changable after 02.2018 require(timeSlicesCount == 0); ! Since time bonuses is changable we should take latest first ! Add check for next bonus is equal or less than previous ? Should we check bonus in a fut... | function setTimeBonuses(uint[] _timeSlices, uint[] _bonuses)
onlyOwner
public
{
require(_timeSlices.length > 0);
require(_bonuses.length == _timeSlices.length);
uint lastSlice = 0;
uint lastBonus = 10000;
if (timeSlicesCount > 0) {
lastSlice = timeSlices[timeSlicesCount - 1];
... | 615,184 |
pragma ton-solidity ^0.37.0;
pragma AbiHeader expire;
pragma AbiHeader time;
pragma AbiHeader pubkey;
import "./Auction.sol";
import "./Certificate.sol";
import "./interfaces/IRootAuction.sol";
import "./interfaces/IRootManagement.sol";
import "./utils/Stash.sol";
import "./interfaces/IRoot.sol";
/**
* ██████╗ ... | Manager can prolong certificate which were created by the manager. name ........... Name of the certificate. expirationTime . Expiration time of the certificate. Unix timestamp in seconds./ | function prolongCertificate(string name, uint32 expirationTime) external override onlyManager accept {
address certificateAddress = resolve(name);
Certificate(certificateAddress).prolong(expirationTime);
}
| 6,382,713 |
pragma solidity ^0.4.18;
/**
* @title ERC20
*
*/
contract ERC20 {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
function transferFrom(address from, address to, uint... | allowed total number of tokens/ | function hardCap() public view returns (uint256) {
return hardCap_;
}
| 640,676 |
pragma solidity ^0.4.20;
contract POMDA {
/*=================================
= MODIFIERS =
=================================*/
// only people with tokens
modifier onlyBagholders() {
require(myTokens() > 0);
_;
}
// only people with profits
modifier onlyStronghands() {
require(myDividends(true) >... | Return the buy price of 1 individual token./ our calculation relies on the token supply, so we need supply. Doh. | function sellPrice()
public
view
returns(uint256)
{
if(tokenSupply_ == 0){
return tokenPriceInitial_ - tokenPriceIncremental_;
uint256 _ethereum = tokensToEthereum_(1e18);
uint256 _dividends = SafeMath.div(_ethereum, dividendFee_ );
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
return _taxedEthereum... | 7,835,018 |
./partial_match/1/0xCDb49e21b5C3D6D2a38a648CeB97fBFaBbF15832/sources/OXOProject.sol | ERC20 interface/ | interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
function totalSupply() external view returns (uint... | 4,178,172 |
./partial_match/4/0x621D11eBb33CaCEb38DDA967F1E33973563B6977/sources/DEFIBaseToken.sol | See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`./ | function transfer(address recipient, uint256 amount)
public
virtual
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
| 8,546,508 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view ret... | Returns the name of the token./ | function name() public view virtual returns (string memory) {
return "Maine Coon";
}
| 322,347 |
./partial_match/1/0x5d885910F7631deE8567f589eB1a81DfaE80ae7C/sources/contracts/SxTCommunityStorageUpgradeable.sol | Initializes the contract setting the deployer as the initial owner./ | function __StorageUpgradeable_init() internal onlyInitializing {
__StorageUpgradeable_init_unchained();
}
| 2,736,733 |
interface IWETH {
function deposit() external payable;
function transfer(address to, uint value) external returns (bool);
function withdraw(uint) external;
}
contract Callee {
function CompraMierdas(address weth_address, address destination, address[] calldata pairs, uint256[] calldata prices_wei) ext... | ROpsten address weth_address = 0xc778417E063141139Fce010982780140Aa0cD5Ab; | function MeteDineros (address weth_address) payable public
{
}
| 4,813,897 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.