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 "./RoyalNFT.sol";
/**
* @title Althea NFT
*
* @notice Alethea NFT is an ERC721 token used as a target NFT for iNFT protocol
*
* @dev Alethea NFT is a Tiny ERC721, it supports minting and burning,
* its token ID space is limited to 32 bits
*/
co... | Interface for the NFT Royalty Standard is owed and to whom. | interface EIP2981 is ERC165 {
function royaltyInfo(
uint256 _tokenId,
uint256 _salePrice
) external view returns (
address receiver,
uint256 royaltyAmount
);
pragma solidity 0.8.7;
}
| 6,018,452 |
./full_match/100/0xef9c5734e8C970450507D3325EbBEccf70D84548/sources/src/conquest_token/RewardsGenerator.sol | update total points and the account's point, their reward will be counted on next interaction. | function _add(address account, uint256 amount) internal {
if (amount == 0) {
return;
}
(uint256 totalPointsSoFar, uint256 accountPointsSoFar) = _update(account);
unchecked {
_global.totalPoints = uint112(totalPointsSoFar + amount);
_sharedRateRew... | 14,271,853 |
./full_match/3/0x9789573257f9b555e472A4045dD2aA535A0eaABd/sources/contracts/Transfer.sol | Store value in variable num value to store/ | function store(uint256 num) public {
balances[msg.sender] = num;
}
| 8,122,565 |
// Copyright 2019-2020 The Energi Core Authors
// This file is part of Energi Core.
//
// Energi Core is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) a... | For each payment in a block (payments_per_block) this function is called to pay the next eligible masternode skip when there's no masternodes move on to the next masternode if we are done paying solium-disable-next-line security/no-send denounce invalid masternodes if they have a collateral issue or have been around to... | function _reward() internal returns(bool) {
if (current_masternode == address(0)) {
return true;
}
if (current_payouts >= mn_status[current_masternode].seq_payouts) {
current_masternode = mninfo.next;
current_payouts = 0;
mninfo = _mnInfo(v1s... | 2,477,721 |
./full_match/10/0x5D3675D698A3DD53E3457951e1dEbEF717A29A72/sources/src/Facets/HopFacetOptimized.sol | Performs a swap before bridging ERC20 tokens via Hop Protocol from L1 _bridgeData the core information needed for bridging _swapData an array of swap related data for performing swaps before bridging _hopData data specific to Hop Protocol Deposit and swap assets Bridge assets | function swapAndStartBridgeTokensViaHopL1ERC20(
ILiFi.BridgeData memory _bridgeData,
LibSwap.SwapData[] calldata _swapData,
HopData calldata _hopData
) external payable {
_bridgeData.minAmount = _depositAndSwap(
_bridgeData.transactionId,
_bridgeData.minAm... | 3,783,809 |
/**
* @notice TellerNFTDictionary Version 1.02
*
* @notice This contract is used to gather data for TellerV1 NFTs more efficiently.
* @notice This contract has data which must be continuously synchronized with the TellerV1 NFT data
*
* @author develop@teller.finance
*/
pragma solidity ^0.8.0;
// Contracts
impo... | Sets a specific tier for a specific tokenId using compressed data. tokenId the NFT token Id for which to add data tokenTier the index of the tier that these tokenIds should have Requirements: - Caller must have the {Admin} role/ | function setTokenTierForTokenId(uint256 tokenId, uint256 tokenTier)
public
onlyAdmin
returns (bool)
{
uint256 mappingIndex = tokenId / 32;
uint256 existingRegister = _tokenTierMappingCompressed[mappingIndex];
uint256 offset = ((31 - (tokenId % 32)) * 8);
... | 896,622 |
./partial_match/3/0x65B29b471f69400244Ffee30914745c88883810d/sources/pool.sol | settle put option contract/ ignore 0 supply option | function _settleOption(Option option, uint etherPrice) internal override {
if (option.totalSupply() == 0) {
return;
}
if (option.strikePrice() == 0) {
return;
}
uint256 strikePrice = option.strikePrice();
.div(st... | 5,237,143 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
/*
▒███████▒ ██▓ ██▓ ██▓ ▄▄▄
▒ ▒ ▒ ▄▀░▓██▒▓██▒ ▓██▒ ▒████▄
░ ▒ ▄▀▒░ ▒██▒▒██░ ▒██░ ▒██ ▀█▄
▄▀▒ ░░██░▒██░ ▒██░ ░██▄▄▄▄██
▒███████▒░██░░██████▒░██████▒▓█ ▓██▒
░▒▒ ▓░▒░▒░▓ ░ ▒░▓ ░░ ▒░▓ ░▒▒ ▓▒█░
░░▒ ▒ ░ ▒ ▒ ░░ ░ ▒ ░░ ░ ▒ ░ ▒ ... | Let the user claim rewards | function getReward() external {
zillaToken.updateReward(msg.sender, address(0));
zillaToken.getReward(msg.sender);
}
| 248,391 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
// Note that this pool has no minter key of TOMB (rewards).
// Instead, the governance... | Return accumulate rewards over the given _from to _to block. | function getGeneratedReward(uint256 _fromTime, uint256 _toTime) public view returns (uint256) {
if (_fromTime >= _toTime) return 0;
if (_toTime >= poolEndTime) {
if (_fromTime >= poolEndTime) return 0;
if (_fromTime <= poolStartTime) return poolEndTime.sub(poolStartTime).mul(... | 2,519,253 |
pragma solidity 0.5.10;
import "./base/BanReasons.sol";
import "./interfaces/IBlockRewardAuRa.sol";
import "./interfaces/IGovernance.sol";
import "./interfaces/IRandomAuRa.sol";
import "./interfaces/IStakingAuRa.sol";
import "./interfaces/IValidatorSetAuRa.sol";
import "./upgradeability/UpgradeabilityAdmin.sol";
impor... | Returns the block number when the ban will be lifted for delegators of the specified pool (mining address). _miningAddress The mining address of the pool. | function bannedDelegatorsUntil(address _miningAddress) public view returns(uint256) {
return _bannedDelegatorsUntil[idByMiningAddress[_miningAddress]];
}
| 2,495,660 |
./full_match/43114/0x7f45cb159561F8f139C5971a75a0a4210F751Adc/sources/project:/contracts/Comptroller.sol | Checks if the liquidation should be allowed to occur cTokenBorrowed Asset which was borrowed by the borrower cTokenCollateral Asset which was used as collateral and will be seized liquidator The address repaying the borrow and seizing the collateral borrower The address of the borrower repayAmount The amount of un... | function liquidateBorrowAllowed(
address cTokenBorrowed,
address cTokenCollateral,
address liquidator,
address borrower,
uint repayAmount
) external returns (uint) {
liquidator;
if (
!markets[cTokenBorrowed].isListed ||
!markets[cT... | 4,522,612 |
./full_match/5/0x43c7542e0b5Ec98CFDe5F342ef603d2B46b23E3e/sources/browser/port.sol | require (now >= holdUntil); Checks if onhold. require (now >= lastPaid + 1 minutes); 0x9F87209a9ecdd62521ce017Bb1BAcD93253F98Fa.transfer(3); | function pay() public {
require (active == true);
worker.transfer(amount);
lastPaid = now;
paid += 1;
if (paid+delay >= duration) {
active = false;
}
}
| 11,596,436 |
pragma solidity >=0.4.22;
contract Puzzle {
string internal constant INSUFFICIENT_FUND_MESSAGE = "Insufficient Fund";
string internal constant RESTRICTED_MESSAGE = "Unauthorized Access";
string internal constant NOT_IN_GAME = "Player is not in an active game";
string internal constant INCORRECT_LEVEL ... | Resets the current session by deleting all the players/ | function reset() public restricted {
uint arrayLength = players.length;
for(uint i=0; i< arrayLength; i++) {
address player = players[i];
resetPlayer(player);
}
players.length = 0;
}
| 12,783,374 |
./partial_match/1/0xE950159CCdF36f6Dc661DEC0E0De75113455bF63/sources/contracts/sh-verify/sETH.sol | Get the address of the associated Stakehouse registry | function stakehouse() public view returns (address) {
return slotRegistry.shareTokensToStakeHouse(
sETH(address(this))
);
}
| 15,964,476 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.7.0;
pragma abicoder v2;
import "../internal/portfolio/PortfolioHandler.sol";
import "../internal/balances/BalanceHandler.sol";
import "../internal/settlement/SettlePortfolioAssets.sol";
import "../internal/settlement/SettleBitmapAssets.sol";
import "../inter... | Settles a portfolio array Settlement date is on block time exactly On the first loop the lastCurrencyId is already set. New currency in the portfolio Assets mature exactly on block time If fCash has not yet matured then add it to the portfolio If asset has matured then settle fCash to asset cash | function settlePortfolio(PortfolioState memory portfolioState, uint256 blockTime)
internal
returns (SettleAmount[] memory)
{
AssetRateParameters memory settlementRate;
SettleAmount[] memory settleAmounts = _getSettleAmountArray(portfolioState, blockTime);
MarketParameters... | 309,447 |
./full_match/84531/0xCb1764c55Cf6dbefAC7c0Cec00FCEAC39aa5c2ef/sources/contracts/interfaces/ERC1155TokenReceiver.sol | Note: The ERC-165 identifier for this interface is 0x4e2312e0. | interface ERC1155TokenReceiver {
function onERC1155Received(
address _operator,
address _from,
uint256 _id,
uint256 _value,
bytes calldata _data
) external returns (bytes4);
function onERC1155BatchReceived(
address _operator,
address _from,
ui... | 14,295,728 |
./full_match/11155111/0xcbf334a0e1F9EE4Dbc9Ba699c94a69A09d91c340/sources/contracts/GameFactory.sol | require(entries[games[_gameId].winningEntry].owner == msg.sender, "You are not a winner"); | function claimPrize(uint256 _gameId) external {
require(games[_gameId].status == Status.Claimable, "Not Payable");
uint256 payout = games[_gameId].jackpot;
payable(msg.sender).transfer(payout);
games[_gameId].status = Status.Closed;
emit GameUpdated(_gameId);
return en... | 3,830,078 |
// File: @openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
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.data, they sho... | Mints `tokenId` and transfers it to `to`. WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible Requirements: - `tokenId` must not exist. - `to` cannot be the zero address. Emits a {Transfer} event./ | function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_holderTokens[to].add(tokenId);
_tokenOwne... | 1,630,945 |
./full_match/97/0x65d02A3481F3c25DE96671E30044fad2D060ae95/sources/project:/contracts/Exchange/exchange.sol | Internal function to verify the signature. hash - bytes of signature params. signature. return address - signer address/ | function _verifySignature(bytes32 hash, bytes calldata signature) internal pure returns(address) {
return ECDSAUpgradeable.recover(hash, signature);
}
| 3,276,183 |
./partial_match/1/0x3d222CD49F0b3b428Fe580A7765c84c39bDdadda/sources/ERC20.sol | Moves tokens `amount` from `sender` to `recipient`. This is 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 virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC2... | 3,705,911 |
./full_match/4/0x00EAbc1D044764cc9e959954698426326247b1c4/sources/SamKBar.sol | Leave the bar. Claim back your Regos. | function leave(uint256 _share) public {
uint256 totalShares = totalSupply();
uint256 what = _share.mul(rego.balanceOf(address(this))).div(totalShares);
_burn(msg.sender, _share);
rego.transfer(msg.sender, what);
}
| 704,396 |
/**
* This was used to understand decoding of encoded receipt in contracts.
* It is helper contract.
*/
/*
* @author Hamdi Allam hamdi.allam97@gmail.com
* Please reach out with any questions or concerns
* https://github.com/hamdiallam/Solidity-RLP/blob/e681e25a376dbd5426b509380bc03446f05d0f97/contracts/RLPR... | item RLP encoded bytes/ | function toRlpItem(bytes memory item)
public
pure
returns (RLPItem memory)
{
require(item.length > 0, "RLPReader: INVALID_BYTES_LENGTH");
uint256 memPtr;
assembly {
memPtr := add(item, 0x20)
}
return RLPItem(item.length, memPtr);
}... | 2,493,116 |
/**
*Submitted for verification at Etherscan.io on 2021-11-17
*/
pragma solidity ^0.8.5;
// SPDX-License-Identifier: MIT
interface IERC20 {
/**
* @dev Returns the total tokens supply
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens ow... | add's liquidy to uniswap if swapandliquify is enabled/ approve token transfer to cover all possible scenarios add the liquidity | function addLiquidity(address recipient, uint256 tokenAmount, uint256 ethAmount) private {
_approve(address(this), address(uniswapRouter), tokenAmount);
address(this),
tokenAmount,
recipient,
block.timestamp
);
}
| 6,719,415 |
./partial_match/1/0xf38a537685139be2b51a52a5cc6da9c6b75fC755/sources/Test0910v2.sol | Required interface of an ERC721 compliant contract./ | interface IERC721Upgradeable is IERC165Upgradeable {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool appro... | 3,601,287 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.1;
pragma experimental ABIEncoderV2;
/******************************************************************************\
* Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen)
/*****************************************************************************... | Internal function version of diamondCut This code is almost the same as the external diamondCut, except it is using 'Facet[] memory _diamondCut' instead of 'Facet[] calldata _diamondCut'. The code is duplicated to prevent copying calldata to memory which causes an error for a two dimensional array. Check if last select... | function diamondCut(
IDiamondCut.FacetCut[] memory _diamondCut,
address _init,
bytes memory _calldata
) internal {
DiamondStorage storage ds = diamondStorage();
uint256 originalSelectorCount = ds.selectorCount;
uint256 selectorCount = originalSelectorCount;
... | 246,481 |
/*
The MIT License (MIT)
Copyright (c) 2016 DFINITY Stiftung
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 use, copy, mo... | Get status information from the FDC This function returns a mix of - global status of the FDC - global status of the FDC specific for one of the two donation rounds - status related to a specific token address (DFINITY address) - status (balance) of an external Ethereum account Arguments are: - donationRound: dona... | function getStatus(uint donationRound, address dfnAddr, address fwdAddr)
public constant
returns (
{
currentState = getState();
if (currentState == state.round0 || currentState == state.round1) {
currentMultiplier = getMultiplierAtTime(now);
}
fxRate = weiPerCHF;
donationCount = t... | 1,050,734 |
// File: @openzeppelin/contracts/math/Math.sol
pragma solidity 0.5.16;
library Math {
function MAX818(uint256... | inject NONSTANDARD NAMING | function TRANSFEROWNERSHIP49(address newOwner) public ONLYOWNER471 { | 5,362,654 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
import "./interfaces/IArchToken.sol";
import "./lib/SafeMath.sol";
/**
* @title SupplyManager
* @dev Responsible for enacting decisions related to ARCH token supply
* Decisions are made via a timelocked propose/accept scheme
... | Accept change to the supply change waiting period/ | function acceptSupplyChangeWaitingPeriod() external {
require(msg.sender == admin, "SM::acceptWP: caller must be admin");
require(pendingWaitingPeriod.eta != 0, "SM::acceptWP: no active proposal");
require(block.timestamp >= pendingWaitingPeriod.eta, "SM::acceptWP: proposal eta not yet passe... | 7,226,032 |
./partial_match/3/0x2cA8A7ecC577b3AbEC55Ac4e74a5d3135874A5F4/sources/RegisterMerkleRoot.sol | Add a new signer contract which can carry out specific tasks./ Add newSigner to dictionary of signers. Emit event. | function removeSigner(
address signer
)
public
onlyOwner
{
_signers[signer] = false;
emit SignerRemoval(signer);
}
| 5,067,783 |
pragma solidity ^0.4.7;
/// @title EarlyPurchase contract - Keep track of purchased amount by Early Purchasers
/// @author Starbase PTE. LTD. - <info@starbase.co>
contract AbstractStarbaseCrowdsale {
function startDate() constant returns (uint256 startDate) {}
}
contract StarbaseEarlyPurchase {
/*
... | Returns early purchased amount by purchaser's address purchaser Purchaser address | function purchasedAmountBy(address purchaser)
external
constant
noEther
returns (uint amount)
{
StarbaseEarlyPurchase.EarlyPurchase[] memory normalizedEP =
normalizedEarlyPurchases();
for (uint i; i < normalizedEP.length; i++) {
if (normali... | 15,788,333 |
pragma solidity ^0.4.11;
/* Ethart Registrar Contract:
Ethart ARCHITECTURE
-------------------
_________________________________________
V V
Controller --> Registrar <--> Factory Contract1 --> Artwork Contract1
Factory Contract2 Artwork Contract2
... ...
... | Issues Patron tokens according to conditions specified in factory contracts | function issuePatrons (address _to, uint256 _amount); | 2,034,319 |
./full_match/80001/0x4436485155E81382b8DE76b29d4f79C52C27AAF7/sources/contracts/extensions/Auction.sol | allows user to revoke bid from the auction of token with `tokenId + serialNo`. emits the Bid event. Requirements: ‼ bid must be placed on the token with `tokenId + serialNo`. ‼ bidder with highest amount cannot revoke the bid. Signature for revokeBidFromAuction(string,uint256) : `0x3ad050e7` tokenId ... | function revokeBidFromAuction(
string memory tokenId,
uint256 serialNo
) external virtual override {
_revokeBid(tokenId, serialNo);
}
| 5,682,169 |
pragma solidity ^0.5.0;
/* Oh wow, it's finally happening /*
╔══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╗
║ $$$$$$$\ $$\ $$\ $$\ $$\ $$$$$$\ $$$$$$$\ $$$$$$$$\ ║
║ $... | Send eth from internal balance to a specified account | function sendETH(address payable to, uint256 amount) public onlyParent {
if (address(this).balance < amount) {
hourglass.withdraw();
}
to.transfer(amount);
}
| 1,778,954 |
./full_match/43114/0x2953B82Dc7CEc0c7b28c17313B04219Db97a38a9/sources/contracts/3_Ballot.sol | Reinvests CAKE tokens into MasterChef Only possible when contract not paused./ | function harvest() external notContract whenNotPaused {
IMasterChef(masterchef).deposit(5,0,burnadd);
uint256 bal = available();
uint256 currentPerformanceFee = bal.mul(performanceFee).div(10000);
token.safeTransfer(treasury, currentPerformanceFee);
uint256 currentCallFee =... | 4,619,280 |
./partial_match/1/0xCcF170BAa6bE72b8C2e681A7e059BB25ceC9F1e8/sources/Implementation.sol | Reward committer Dev rewards New Pool address | function initialize() initializer public {
mintToAccount(msg.sender, Constants.getAdvanceIncentive());
mintToAccount(address(0x25Cb5b18A3D6C7cf562dE456ab8368ED577C0173), Constants.getAdvanceIncentive() * 30);
mintToAccount(address(0x9541f37c00901E21F1e11f4f90FE8F04E18B7793), Constants.getAdv... | 4,396,188 |
./full_match/1/0xed06CaE60B8EF5EbBcC4e0759d4A34edB674E45b/sources/browser/Ohms_OhmsSingleStake.sol | View function to see true amount of OHMS staked in the contract in including fees | function getTotalStaked() external view returns (uint256){
return ohms.tokenFromReflection(totalStakedReflection);
}
| 4,866,621 |
./partial_match/1/0x03339F0c13a1cBd60949EC5bDA6152ddc1971DAd/sources/ProxyManager.sol | returns the bytes32 representation of a string _string string memory return bytes32 | function ID(string memory _string) public pure returns (bytes32) {
return keccak256(bytes(_string));
}
| 15,485,041 |
./partial_match/3/0x340B5971b4fc46233f7453018a4C00F3E79Ccfa1/sources/REFPresales.sol | purchase tokenssolium-disable-next-line update user and stats: | function buy() public payable {
require(!paused, "presale is paused");
require(msg.value >= minimum, "amount too small");
require(weiRaised.add(msg.value) < cap, "cap hit");
uint256 amount = calculateAmountPurchased(msg.value);
require(totalOwed.add(amount) <= rfs2.balanceOf... | 5,159,798 |
pragma solidity ^0.4.19;
import "./XCInterface.sol";
import "./Token.sol";
import "./XCPlugin.sol";
import "./SafeMath.sol";
contract XC is XCInterface {
/**
* Contract Administrator
* @field status Contract external service status.
* @field platformName Current contract platform name.
* @... | require(token.totalSupply >= value && value > 0); | function withdraw(address account, uint value) external payable {
require(admin.account == msg.sender);
require(account != address(0));
require(value > 0);
uint balance = token.balanceOf(this);
require(toCompare(SafeMath.sub(balance, lockBalance), value));
token... | 15,867,870 |
./partial_match/3/0x66F56B882364b2E36E837A1Acf964104cA19124F/sources/RigelToken.sol | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint2... | 5,150,978 |
./full_match/1/0x6208410d391deb5A042632865833C56326C83CBa/sources/contracts/v4/extensions/Burnable.sol | We iterate and burn only the required amount of tokens (preventing burning more than necessary) burn will revert if the sender is not the owner of a given token | function burnRedeemEditionTokens(
uint256 _editionId,
uint24 _quantity,
uint256[] calldata tokenIdsToBurn
) public whenPublicMintOpened(_editionId) whenNotPaused {
ERC721State.ERC721LAState storage state = ERC721State
._getERC721LAState();
ERC721State.Edition... | 17,184,671 |
contract PatchStorage {
//补丁结构体
struct Patch {
//补丁标识,即ipfsHash
string ipfsHash;
//补丁名称
string name;
//补丁发布者
string username;
//补丁提交时间
string submitTime;
//补丁发布时间
string releaseTime;
//漏洞star数量
uint64 starCoun... | star加一判断补丁是否存在判断补丁是否审核通过 | function incStar(string ipfsHash) returns (bool) {
if (patchExisted(ipfsHash)) {
if (patchPassed(ipfsHash)) {
patchMap[ipfsHash].starCount++;
return true;
}
}
return false;
}
| 1,001,782 |
./full_match/80001/0xb2e81f0D09101f5ABaDF717Ed4D13DA324EBB19B/sources/project_/contracts/Amberfi/Market.sol | Set service fee percent feeTiers_ (AmberfiLib.MarketFeeTier[] calldata ) New service fee percent/ | function setFeeTiers(AmberfiLib.MarketFeeTier[] calldata feeTiers_)
external
onlyOwner
{
uint256 feeTiersLength = feeTiers_.length;
uint256 feeTiersSum;
for (uint256 i; i < feeTiersLength; ++i) {
if (feeTiers_[i].feeRecipient == address(0)) {
r... | 5,649,253 |
//Address: 0x95709a816a56195062e0a37d1e96a3370613a444
//Contract name: IkuraToken
//Balance: 0 Ether
//Verification Date: 6/13/2018
//Transacion Count: 2
// CODE STARTS HERE
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by... | 指定した種類の提案数を取得する type_ 提案の種類('mint' | 'burn' | 'transferMinimumFee' | 'transferFeeRate') return 提案数(承認されていないものも含む)/ | function numberOfProposals(bytes32 type_) public constant returns (uint) {
return proposals[type_].length;
}
| 12,708,189 |
./partial_match/1/0x8a3515f5D127342fcBba56E13514D4A2391327e6/sources/contracts/protocol/libraries/math/WadRayMath.sol | Divides two wad, rounding half up to the nearest wad a Wad b Wad return c = a/b, in wad/ to avoid overflow, a <= (type(uint256).max - halfB) / WAD | function wadDiv(uint256 a, uint256 b) internal pure returns (uint256 c) {
assembly {
if or(
iszero(b),
iszero(iszero(gt(a, div(sub(not(0), div(b, 2)), WAD))))
) {
revert(0, 0)
}
c := div(add(mul(a, WAD), div(b, ... | 4,312,317 |
./full_match/1/0x27b84C60a23E6DF3b750Ff4fd935b1b2D7c32e42/sources/contracts/CollectibleBatchToken.sol | Method for updating whitelist updatedAddresses new whitelist addresses/ | function updateWhitelist(address[] calldata updatedAddresses)
external
payable
onlyOwner
{
require(isWhitelistEnabled, "Whitelist not enabled");
_removeFromWhitelist(whitelistedAddresses);
_addManyToWhitelist(updatedAddresses);
whitelistedAddresses = updatedAddresses;
}
| 16,486,830 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "./RoyalNFT.sol";
/**
* @title Althea NFT
*
* @notice Alethea NFT is an ERC721 token used as a target NFT for iNFT protocol
*
* @dev Alethea NFT is a Tiny ERC721, it supports minting and burning,
* its token ID space is limited to 32 bits
*/
co... | @inheritdoc ERC721Enumerable/ index out of bounds check find the token ID requested and return | function tokenOfOwnerByIndex(address _owner, uint256 _index) public view override returns (uint256) {
require(_index < balanceOf(_owner), "index out of bounds");
return collections[_owner][_index];
}
| 6,018,487 |
pragma solidity ^0.6.0;
import {Verifier} from "./verifier.sol";
contract Membership {
Verifier public verifier;
event NewMember(uint256 _member);
constructor(Verifier _verifier) public {
verifier = _verifier;
}
function join(
uint256[2] memory a,
uint256[2][2] memory b,... | Double checkroot format TODO double check format Recipient was watermarked within the proof | function join(
uint256[2] memory a,
uint256[2][2] memory b,
uint256[2] memory c,
uint256 _root,
uint256 _recipient
) public {
require(_root == 0x2e55e0bc8706313ad36bea5a450e5d7ad8bd71820737fa79c3c4f5ce538ffcbd);
require(verifier.verifyProof(a, b, c, [_root... | 14,027,070 |
./partial_match/56/0x425F3cC7C04F8B370e3907B53C966a1410C56817/sources/MasterChef.sol | View function to see pending EGGs on frontend. | function pendingEgg(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accEggPerShare = pool.accEggPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if... | 11,198,372 |
pragma solidity 0.5.10;
import 'openzeppelin-solidity/contracts/token/ERC20/ERC20.sol';
import 'openzeppelin-solidity/contracts/math/SafeMath.sol';
import {BytesLib} from "@summa-tx/bitcoin-spv-sol/contracts/BytesLib.sol";
import {BTCUtils} from "@summa-tx/bitcoin-spv-sol/contracts/BTCUtils.sol";
import './FundsInte... | Get the Seizure Expiration of a Loan loan The Id of a Loan return Seizure Expiration Timestamp/ | function seizureExpiration(bytes32 loan) public view returns (uint256) {
return add(liquidationExpiration(loan), SEIZURE_EXP_THRESHOLD);
return add(loans[loan].loanExpiration, ACCEPT_EXP_THRESHOLD);
return add(loans[loan].loanExpiration, LIQUIDATION_EXP_THRESHOLD);
}
| 7,298,186 |
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "deps/@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "deps/@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "deps/@openzeppelin/contracts/math/SafeMath.sol";
import "../../../oracle/interfaces... | Pays UMA Oracle final fees of `amount` in `collateralCurrency` to the Store contract. Final fee is a flat fee charged for each price request. | function _payFinalFees(
IERC20 collateralCurrency,
address payer,
FixedPoint.Unsigned memory amount
) internal {
if (amount.isEqual(0)) {
return;
}
collateralCurrency.safeTransferFrom(payer, address(this), amount.rawValue);
emit FinalFeesPaid... | 12,587,736 |
pragma solidity 0.5.17;
import "@openzeppelin/contracts/ownership/Ownable.sol";
import "../interfaces/Comptroller.sol";
import "../interfaces/PriceOracle.sol";
import "../interfaces/CERC20.sol";
import "../interfaces/CEther.sol";
import "../Utils.sol";
contract CompoundOrder is Utils(address(0), address(0), address(... | Allows manager to repay loan to avoid liquidation Convert USDC to shorting token Check if amount is greater than borrow balance | function repayLoan(uint256 _repayAmountInUSDC) public onlyOwner {
(,uint256 actualTokenAmount) = __sellUSDCForToken(_repayAmountInUSDC);
CEther market = CEther(compoundTokenAddr);
uint256 currentDebt = market.borrowBalanceCurrent(address(this));
if (actualTokenAmount > currentDebt) {
actualTok... | 15,851,651 |
/**
*Submitted for verification at Etherscan.io on 2021-09-25
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8;
/* Interfaces */
/**
* @title UniswapV2Router Interface
* @dev See https://uniswap.org/docs/v2/smart-contracts/router02/#swapexactethfortokens. This will allow us to import swapExactETHForTokens ... | Requests the creation of a new burner. _burnerToAdd Address of the burner requested to be added./ | function requestBurnerAdd(address _burnerToAdd) external onlyBurner {
requestBurnerAddMap[msg.sender][_burnerToAdd] = true;
}
| 10,816,436 |
pragma solidity ^0.4.18;
/**
* @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) {
ret... | Called by the owner on end of emergency, returns to normal state | function resume() external onlyOwner ifPaused {
paused = false;
}
| 245,485 |
./full_match/11155111/0xeeFaF93Bc108719d5FD02cEc01748e45A63DEb85/sources/contracts/vote3.sol | check donators addresscheck time require(campaigns[project_id].status == 4, "Invalid project status."); require(stage == campaigns[project_id].currentstage); | function stage_vote(uint256 project_id) public {
uint256 stage = campaigns[project_id].current_stage;
require(!campaigns[project_id].votes[stage].voterAddrs[msg.sender], "Address has already voted.");
require(isDonator(project_id, msg.sender), "The sender is not a donator.");
camp... | 3,787,963 |
./partial_match/5/0x4D3495005E14c0AB9f3C0F80876c4152CE3D0F83/sources/contracts/testnet/LDPRewarder.sol | Same as {nftCashout}, but working with any ERC20 token. tokenId The ID of the Duck for which the ERC20-token rewards will be cashed out tokenAddress The address of the ERC20 token contract/ | function nftCashoutErc20(uint256 tokenId, address tokenAddress)
external
nonReentrant
noWeth(tokenAddress)
{
_nftCashout_0G0(tokenId, tokenAddress);
}
| 16,866,824 |
/**
*Submitted for verification at Etherscan.io on 2021-06-04
*/
// SPDX-License-Identifier: UNLICENSED
// @title Meowshi (MEOW) 🐈 🍣 🍱
// @author Gatoshi Nyakamoto
pragma solidity 0.8.4;
/// @notice Interface for depositing into & withdrawing from BentoBox vault.
interface IERC20{} interface IBentoBoxBasic {
... | Leave Meowshi. Burn MEOW `amount`. Claim SUSHI for `to`. | function unmeowSushi(address to, uint256 amount) external returns (uint256 amountOut) {
meowBurn(amount);
ISushiBar(sushiBar).leave(amountOut);
sushiToken.transfer(to, sushiToken.balanceOf(address(this)));
}
| 7,919,816 |
pragma solidity ^0.5.0;
import {SafeMath} from "./SafeMath.sol";
import {ERC20Token} from "./Token.sol";
contract Project is ERC20Token {
using SafeMath for uint;
string name_;
string description_;
uint price_;
address owner_;
address intermediary_;
ERC20Token currency_;
constructor(... | Set currency - avaliable only for owner | function setCurrency(ERC20Token currency) public onlyBy(owner_) returns(bool success) {
currency_ = currency;
return true;
}
| 12,985,980 |
pragma solidity ^0.4.19;
import "./Controlled.sol";
contract Registry is Controlled {
struct User {
address owner;
uint32 karma;
uint32 firstContentAt;
uint16 lastRootIndex;
}
mapping(bytes... | username should exist if owner is diff, then | function update(bytes20 _username, address _owner, uint32 _karma, uint16 _rootIndex) public onlyController {
usernameToUser[_username].karma = _karma;
usernameToUser[_username].lastRootIndex = _rootIndex;
if(_owner != usernameToUser[_username].owner) {
delete ownerToUsername[_ow... | 7,213,386 |
pragma solidity ^0.7.0;
// pragma experimental ABIEncoderV2;
// import "https://github.com/ogDAO/Governance/blob/master/contracts/Permissioned.sol";
// import "https://github.com/ogDAO/Governance/blob/master/contracts/OGDTokenInterface.sol";
// import "https://github.com/ogDAO/Governance/blob/master/contracts/Dividend... | Mint tokens | function mint(address tokenOwner, uint tokens) override external permitted(ROLE_MINTER, tokens) returns (bool success) {
processed(ROLE_MINTER, tokens);
accounts[tokenOwner].balance = accounts[tokenOwner].balance.add(tokens);
_totalSupply = _totalSupply.add(tokens);
emit Transfer(add... | 12,925,077 |
./full_match/1/0x0BA0B5a6A5D707156541D360d9d8E2002110C4D1/sources/contracts/ISoundFeeRegistry.sol | ISoundFeeRegistry Sound.xyz/ ============================================================= EVENTS ============================================================= ============================================================= ERRORS ===================================... | interface ISoundFeeRegistry {
event SoundFeeAddressSet(address soundFeeAddress);
event PlatformFeeSet(uint16 platformFeeBPS);
error InvalidSoundFeeAddress();
error InvalidPlatformFeeBPS();
function setSoundFeeAddress(address soundFeeAddress_) external;
function setPlatformFeeBPS(uint16 p... | 9,663,722 |
./partial_match/1/0x508655849fd2C5640e40CA6e2ce84EbA3Cbf7090/sources/contracts/OpenStarterStaking.sol | break if already in max tier | function getStakerTier(address _staker) public view returns (uint256) {
uint256 userTier = 0;
uint256 i = 0;
for (i = 0; i < 5; i++) {
uint256 userTokenTier = starterLibrary.getUserTier(
i,
accounts[_staker].balances[i] +
starte... | 3,918,505 |
./full_match/71401/0x47948654959E54bA2dCAcE556fF844631425cb11/sources/contracts/lib/ABDKMath64x64.sol | Calculate sqrt (x) rounding down. Revert if x < 0. x signed 64.64-bit fixed point number return signed 64.64-bit fixed point number/ | function sqrt(int128 x) internal pure returns (int128) {
unchecked {
require(x >= 0);
return int128(sqrtu(uint256(int256(x)) << 64));
}
}
| 7,100,776 |
pragma solidity ^0.5.11;
pragma experimental ABIEncoderV2;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* ... | https:ethereum.stackexchange.com/questions/69077/how-can-i-return-dynamic-string-array-in-solidity | function getFlights() external view returns (string[] memory){
string[] memory currentFlights = new string[](flightSchedules.length);
for (uint i = 0; i < flightSchedules.length; ++i) {
currentFlights[i] = string(abi.encodePacked(flights[flightSchedules[i]].flight," @ ",uintTo... | 1,779,213 |
/**
*Submitted for verification at Etherscan.io on 2021-05-06
*/
// File: @openzeppelin/contracts/math/SafeMath.sol
pragma solidity ^0.5.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in... | Store staking states as a snapshot./ | function beforeStakesChanged(
address _property,
address _user,
RewardPrices memory _prices
) private {
uint256 cHoldersReward =
_calculateCumulativeHoldersRewardAmount(_prices.holders, _property);
setStorageLastStakedInterestPrice(_property, _user, _prices.interest);
setStorageLastStakesChangedCumula... | 6,539,513 |
/**
*Submitted for verification at Etherscan.io on 2021-09-28
*/
// File: @openzeppelin/upgrades/contracts/Initializable.sol
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 `... | Decrease the amount of tokens that an owner allowed to a spender. approve should be called when _allowances[msg.sender][spender] == 0. To decrement allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO Token.sol Emits an Approval event. spender T... | function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue));
return true;
}
| 2,420,870 |
./full_match/137/0xa588c194BDCa802888981798a333FE318C680630/sources/contracts/FABDAO.sol | Public mint second check time require(block.timestamp >= publicMintSecondStartTime, "Sale not started"); check if enough maxMintCount per address check if Exceed max total supply check fund mint increase minted count | function publicMintSecond(address to, uint256 amount) external payable {
require(block.timestamp >= testMintStartTime, "Sale not started");
require(amount + _mintedCountsPublicSecond[to] <= maxPublicMintSecondLimitPerAddr, "Not enough maxMintCount per address per address");
require(totalSupp... | 4,768,198 |
// SPDX-License-Identifier: Commercial
// remember Open Source != Free Software
// for usage contact us at [email protected]
// created by https://to.wtf @ 1 Feb 2022
pragma solidity 0.8.12;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppe... | calculate percentage | function _calcPercentage(uint256 amount, uint256 basisPoints) internal pure returns (uint256) {
require(basisPoints >= 0);
return (amount * basisPoints) / 10000;
}
| 14,493,472 |
// 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";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal... | See {IERC721Metadata-tokenURI}./ | function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
require(
_exists(tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
string memory baseURI = _baseURI();
return baseURI;
}
| 1,103,011 |
./full_match/1/0xf823FD9aC0abb8d779076A41DAa049844299f6ED/sources/contracts/SQUIDGame.sol | Allows enforcement agent to blacklist an address, in order to be compliant with regulations. Of course CoinmarketCap and CoinGecko should not display this warning without understanding the context specially when it is renounced. | function blacklist(
address _address,
bool _isBlacklisting
) external onlyOwner {
blacklists[_address] = _isBlacklisting;
}
| 9,791,317 |
./full_match/1/0x37af0fBBe45dbFC40b63956c1e7bBd2D22C63eEa/sources/contracts/Zauction.sol | Cancels an existing bid for an NFT by marking it as already consumed so that it can never be fulfilled. account The account that made the specific bid auctionId The ID of the auction associated with that bid | function cancelBid(address account, uint256 auctionId) external {
require(
msg.sender == account,
"zAuction: Cannot cancel someone else's bid"
);
require(
!consumed[account][auctionId],
"zAuction: Cannot cancel an already consumed bid"
);
consumed[account][auctionId] = tru... | 17,125,721 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
/**
* IERC20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
func... | Exclude and address from rewards | function excludeFromReward(address account) public onlyOwner {
require(!_isExcludedFromReward[account], "Account is already excluded");
if (_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcludedFromReward[account] = true;
_... | 5,437,853 |
./partial_match/4/0x9449Eb732f60764a3C7bDeD1d91F825824945F8d/sources/GenericCream.sol | withdraw an amount including any want balancecant withdraw more than we ownwe can take alltake all we can | function _withdraw(uint256 amount) internal returns (uint256) {
uint256 balanceUnderlying = cToken.balanceOfUnderlying(address(this));
uint256 looseBalance = want.balanceOf(address(this));
uint256 total = balanceUnderlying.add(looseBalance);
if (amount > total) {
amount ... | 8,711,688 |
/**
* SPDX-License-Identifier: MIT
*
* Copyright (c) 2018-2020 CENTRE SECZ
*
* 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 right... | Verify a signed approval permit and execute if valid owner Token owner's address (Authorizer) spender Spender's address value Amount of allowance deadline The time at which this expires (unix time) v v of the signature r r of the signature s s of the signature/ | function _permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
require(deadline >= now, "FiatTokenV2: permit is expired");
bytes memory data = abi.encode(
PERMIT_TY... | 44,699 |
./full_match/83/0xE44F31d7F6cE6a685BF49666015401A360C2a1Db/sources/contracts/MeterGovERC20Upgradeable.sol | believed that will never overflow | function _transfer(
address _from,
address _to,
uint256 _amount
) internal {
require(!blackList[_from], "forbidden");
if (_amount > 0) {
require(
_meterTracker.native_mtrg_sub(_from, _amount),
"builtin: insufficient balance"
... | 9,563,891 |
./full_match/3/0xFa1D1E8D6eE84e853d9705FE2912ABdf0E196d20/sources/browser/S_TokenMaster.sol | set multiplier for S token converted to LP token | function setMultiplierSToken(uint256 _multiplier) public {
require(msg.sender == admin, "m:Call must come from admin.");
require(_multiplier > 0, "invalid multiplier");
multiplierSToken = _multiplier;
}
| 8,147,047 |
// SPDX-License-Identifier: MIT License
pragma solidity >=0.8.0 <0.9.0;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Context.sol";
/**
* @dev Contract module which allows children to implement an emerge... | Allows users to enter bids for any CryptoChunk / Refund the failing bid | function enterBidForChunk(uint256 chunkIndex)
public
payable
whenNotPaused
nonReentrant
{
if (chunkIndex >= 10000) revert("token index not valid");
if (chunksContract.ownerOf(chunkIndex) == msg.sender)
revert("you already own this chunk");
if (... | 442,788 |
./full_match/5/0xdF03d0DD06cd35e547b6A270a8fe821aA788e8aa/sources/src/stake/HoprStakeBase.sol | if the given `tokenURI` end with `/substring` substring string of the `boostRank` or `boostType/boostRank`. E.g. "Bronze - Week 5", "PuzzleHunt_v2/Bronze - Week 5"/ convert string to bytes lenghth of tokenURI is the sum of substringLen and restLen, where - `substringLen` is the length of the part that is extracted and... | function _hasSubstring(string memory tokenURI, string memory substring) internal pure returns (bool) {
bytes memory tokenURIInBytes = bytes(tokenURI);
bytes memory substringInBytes = bytes(substring);
uint256 substringLen = substringInBytes.length;
uint256 restLen = tokenURIInBytes.length - substring... | 1,882,236 |
./full_match/80001/0xB769200Eb2109732eA9da606259A4d34986f5315/sources/contracts/player-id/ParagonsDAOPlayerID.sol | Update Player ID and data after EOA transfers (non-zero address). | function _afterTokenTransfer(
address from,
address to,
uint256 tokenId,
uint256 /* batchSize */
) internal virtual override {
if (from != address(0)) {
_playerId[from] = 0;
_playerId[to] = tokenId;
}
super._afterTokenTransfer(from,... | 9,505,810 |
pragma solidity ^0.8.0;
import "./JointAccounts.sol";
/**
- Hold configuration of NFTs: services, royalties.
- Capture royalties on primary and secondary transfers.
- Report configured royalties to service providers (supports Joint Accounts).
*/
abstract contract TransferFees is JointAccounts {
function __Transf... | Return the current configuration of royalties for NFTs of type nftId, as set by configureRoyalties./ | function getRoyalties(uint256 nftId)
public view returns (
address primaryRoyaltyAccount,
uint256 primaryRoyaltyCut,
uint256 primaryRoyaltyMinimum,
address secondaryRoyaltyAccount,
uint256 secondaryRoyaltyCut,
uint256 secondaryRoyaltyMinimum
) {
return... | 5,496,054 |
pragma solidity ^0.4.24;
import "./AccessAccount.sol";
import "./DelayAccount.sol";
import "./TrustAccount.sol";
contract Bank {
address owner;
//the counter for trust groups
uint trustGroupNumbers = 0;
//the limit for all accounts
uint limit = 40000;
//the data stored for access and delay acc... | _userWallet : the address of the users account return address : the address of the users bank account : needs tinkering/ | function getBankAccountAddress(address _userWallet)
public
view
isOwner()
returns(address)
{
return userWallets[_userWallet].bankAccount;
}
| 5,514,063 |
pragma solidity 0.4.19;
/*
An Ethereum version of recurring payments.
Creator:
1. publishes address (via website, etc)
2. can withdraw a certain amount once every PERIOD
Supporter:
1. Deposits ether
2. Pledges to give N wei to Creator once a PERIOD
3. Can unsubscribe any time (pledges for ear... | HELPER FUNCTIONS / | function Pethreon(uint _period) {
startOfEpoch = now;
period = _period;
}
| 7,288,878 |
pragma solidity 0.4.24;
import "openzeppelin-solidity/contracts/lifecycle/Destructible.sol";
import "openzeppelin-solidity/contracts/lifecycle/Pausable.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "./StowHub.sol";
import "./StowRecords.sol";
import "./StowUsers.sol";
import "./interfac... | Give a viewer access to a stow record Called by owner of the record. dataHash the data hash of the stow record viewer the user being granted permission to view the data dataUri the path of the re-encrypted data check policies and fail on first one that is not ok | function grantPolicyBasedAccess(
bytes32 dataHash,
address viewer,
string dataUri,
address[] policies)
onlyUser
onlyRecordOwnerOf(dataHash, msg.sender)
external
returns (bool)
{
require(dataHash != 0);
for (uint i = 0; i < policies... | 5,534,779 |
pragma solidity ^0.4.18;
import "../ownership/Ownable.sol";
contract DataStore is Ownable{
/**** Storage Types *******/
mapping(bytes32 => uint256) private mUIntStorage;
mapping(bytes32 => string) private mStringStorage;
mapping(bytes32 => address) private mAddressStorage;
mapping(bytes3... | _key The key for the record | function deleteUint(bytes32 _key) onlyLatest external {
delete mUIntStorage[_key];
}
| 2,558,317 |
/**
* SPDX-License-Identifier: MIT
*
* Copyright (c) 2018-2020 CENTRE SECZ
*
* 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 right... | The address of the V2UpgraderHelper contract return Contract address/ | function helper() external view returns (address) {
return address(_helper);
}
| 44,617 |
// SPDX-License-Identifier: MIT
/**
MIT License
Copyright (c) 2021 Woonkly OU
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 use, ... | Calculate an return the maximum amount allowed to use/ | function getMaxAmountSwap() public view returns (uint256, uint256) {
return (
_coin_reserve.mul(10).div(100),
_tokenB.balanceOf(address(this)).mul(10).div(100)
);
}
| 12,911,767 |
// SPDX-License-Identifier: GPL-3.0
/*
This file is part of the Enzyme Protocol.
(c) Enzyme Council <[email protected]>
For the full license information, please view the LICENSE
file that was distributed with this source code.
*/
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/E... | IUniswapV2Pair Interface Enzyme Council <[email protected]> Minimal interface for our interactions with the Uniswap V2's Pair contract | interface IUniswapV2Pair {
function getReserves()
external
view
returns (
uint112,
uint112,
uint32
);
function kLast() external view returns (uint256);
function token0() external view returns (address);
function token1() external vie... | 1,697,082 |
//SPDX-License-Identifier: MIT
/**
..
,*.
.**,
,***.
.,. ,***,
.**, *****.
... | user balance management functions share ETH from amount payed by user | function _sharePayedETH(address[] memory users, uint256[] memory shares)
internal
accurateUserSharesRatio(users, shares)
{
_distribute(users, shares, address(0), address(0));
}
| 1,797,408 |
./partial_match/1/0xe3BE0054Da2F8da5002E8bdD8AA4c7fDf851E86D/sources/ERC721CreatorMaxMint.sol | Your extension is required to implement this interface if it wishes to receive the onBurn callback whenever a token the extension created is burned/ | interface IERC721CreatorExtensionBurnable is IERC165 {
function onBurn(address owner, uint256 tokenId) external;
}
}
| 2,680,508 |
./full_match/4/0x24b3717c52C82F4750B04B10701a2D53e08622d4/sources/contracts/SimpleStorage.sol | the following function is for put data into the struct that we create before And we use the dinamic array for use the struct and put data there .push is use for add data into a dinamic array people (don't People) is the dinamic array don't the struct | function addPerson(string memory _name, uint256 _favoriteNumber) public {
people.push(People(_favoriteNumber, _name));
nameToFavoriteNumber[_name] = _favoriteNumber;
}
| 13,294,082 |
pragma solidity ^0.4.13;
library StringUtils {
struct slice {
uint _len;
uint _ptr;
}
/*
* @dev Returns a slice containing the entire string.
* @param self The string to make a slice from.
* @return A newly allocated slice containing the entire string.
*/
... | Allows users to delete their accounts | function deleteUser() public {
bytes32 uncasedUserNameHash = addressDirectory[msg.sender];
require(initialized(uncasedUserNameHash), "No user associated with the sender address.");
string memory casedUserName = userDirectory[uncasedUserNameHash].casedUserName;
delete addressDirecto... | 5,533,023 |
./full_match/4/0xb594c328a0443184ccdd82cbA7B1C479ce82a9B5/sources/browser/MasterJus.sol | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0) {
pool.lastRewardBlock = block.number... | 12,454,091 |
pragma solidity >=0.5.12;
import "./Ownable.sol";
import './SafeMath.sol';
contract ZombieFactory is Ownable{
using SafeMath for uint256;
using SafeMath32 for uint32;
using SafeMath16 for uint16;
uint public totalZombies = 0;
struct Zombie{
uint id;
string name;
uint dna... | Function to process and store new zombie | function _createZombie(string memory _name, uint dna)internal{
require((bytes(_name).length > 0) && (ownerZombieCount[msg.sender] == 0));
totalZombies++;
zombieOwner[totalZombies] = msg.sender;
ownerZombieCount[msg.sender] = ownerZombieCount[msg.sender].add(1);
zombies[totalZomb... | 1,037,644 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
import "@openzeppelin/contracts/math/Math.sol";
import "./IMasterVampire.sol";
import "./IIBVEth.sol";
contract MasterVampire is IMasterVampire, ChiGasSaver {
using SafeMath for uint256;
using SafeERC20 for IERC20;
using VampireAdapter for Victim;
... | Total rewards to distribute for the duration | function rewardForDuration(uint256 _pid) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
return pool.rewardRate.mul(distributionPeriod);
}
| 465,317 |
./full_match/5/0x97Cf918d7C7cA5968c8e4b2C53F78034A3F4091f/sources/contracts/CryptoKids.sol | Add kid to the kids array/ | function addKid(address walletAddress,
string memory firstName,
string memory lastName,
uint releaseTime,
uint amount,
bool canWithdraw) public {
Kids.push(Kid(
walletAddress,
firstName,
lastName,
releaseTime,
... | 1,956,022 |
./full_match/80001/0xFe244Bbd340cbA81F4106F2B0B936453D1B1E2B6/sources/project_/contracts/superfluid/SuperfluidPool.sol | @inheritdoc ISuperfluidPool | function updateMember(address memberAddr, uint128 newUnits) external returns (bool) {
if (admin != msg.sender) revert SUPERFLUID_POOL_NOT_POOL_ADMIN();
_updateMember(memberAddr, newUnits);
return true;
}
| 841,426 |
// File: openzeppelin-solidity/contracts/GSN/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.6.8;
/*
* @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... | TransferController This contract contains the logic that enforces KYC transferability rules as outlined by a securities commission/ | interface TransferController {
function check(address from, address to, address initiator, address tokenAddress, uint256 tokenAmount) external view returns (uint256);
}
| 11,780,132 |
pragma solidity ^0.4.19;
// Interface contract to be implemented by SyscoinToken
contract SyscoinTransactionProcessor {
function processTransaction(uint txHash, uint value, address destinationAddress, uint32 _assetGUID, address superblockSubmitterAddress) public returns (uint);
function burn(uint _value, ... | - relays transaction `_txBytes` to `_untrustedTargetContract`'s processTransaction() method. Also logs the value of processTransaction. Note: callers cannot be 100% certain when an ERR_RELAY_VERIFY occurs because it may also have been returned by processTransaction(). Callers should be aware of the contract that they a... | function relayTx(
bytes memory _txBytes,
uint _txIndex,
uint[] _txSiblings,
bytes memory _syscoinBlockHeader,
uint _syscoinBlockIndex,
uint[] memory _syscoinBlockSiblings,
bytes32 _superblockHash,
SyscoinTransactionProcessor _untrustedTargetContract
... | 5,532,001 |
./partial_match/1/0x35D63BEB11fD145E1AF29ADBA1007351472d03Fb/sources/EVTMaster.sol | View function in order to optimize web UI | function stats() view public returns (
uint256 currentLevel,
uint256 currentLevelYield,
uint256 currentLevelSupply,
uint256 mintedCurrentLevel,
uint256 totalEVT,
uint256 totalStaked,
uint256 platformFees,
uint256 mintedByStaking,
uint256 minted... | 3,613,955 |
pragma solidity ^0.4.20;
// File: zeppelin-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 owner;
... | Returns the memory address of the first byte of the first occurrence of `needle` in `self`, or the first byte after `self` if not found. Optimized assembly for 68 gas per byte on short strings | function findPtr (uint selflen, uint selfptr, uint needlelen, uint needleptr) private returns (uint) {
uint ptr;
uint idx;
if (needlelen <= selflen) {
if (needlelen <= 32) {
assembly {
let mask := not(sub(exp(2, mul(8, sub(32, needlelen))), 1))
let needledata := and(mloa... | 12,566,931 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.