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: SEE LICENSE IN LICENSE
pragma solidity 0.6.12;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "./interfaces/ICheckpointStore.sol";
import "../utility/Utils.sol";
import "../utility/Time.sol";
/**
* @dev Time store contract
*/
contract CheckpointStore is ICheckpointSt... | adds a past checkpoint to the store Requirements: - the caller must have the ROLE_SEEDER role/ | function addPastCheckpoint(address target, uint256 timestamp) external override validAddress(target) {
require(hasRole(ROLE_SEEDER, msg.sender), "ERR_ACCESS_DENIED");
require(timestamp < _time(), "ERR_INVALID_TIME");
_addCheckpoint(target, timestamp);
}
| 2,509,184 |
pragma solidity ^0.4.25;
/**
* @author wpzczbyqy <weipengzhen@czbyqy.com>
* @title bytes32类型集合操作
* 提供bytes32集合类型操作,包括新增元素,删除元素,获取元素等
**/
library LibBytes32Set {
struct Bytes32Set {
bytes32[] values;
mapping(bytes32 => uint256) indexes;
}
/**
*@dev byte32集合是否包含某个元素
*@param set by... | 求两个集合的差 a - b set a bytes32类型集合 set b bytes32类型集合return bytes32[] 差集元素/ | function relative(Bytes32Set storage a, Bytes32Set storage b) internal view returns (bytes32[]){
if(b.values.length == 0){
return a.values;
}
bool isIn;
for(uint i = 0; i < b.values.length; i++){
isIn = contains(a, b.values[i]);
if(isIn){
... | 12,743,643 |
./full_match/1/0x467a2B91f231D930F5eeB6B982C7666E81DA8626/sources/contracts/nft/libs/ERC721.sol | See {IERC721-safeTransferFrom}./ | function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public {
require(_isApprovedOrOwner(msg.sender, tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
| 3,857,759 |
./partial_match/1/0xf7A249bA8951979040bBc7f70fd5184c8FEe2b8d/sources/contracts/PoolMetadata.sol | update the treasury address to receive fees treasury_ new value for treasury address/ | function setTreasury(address treasury_) external {
requireController();
emit TreasuryUpdated(treasury, treasury_);
treasury = treasury_;
}
| 4,491,805 |
./full_match/4/0xdBf9d503028B3d68e343c4096Fd347A20d1e8966/sources/contracts/01_Pack.sol | Print weed tokensGet RarityTODO - dev: we probably don't need this line since it was already set to "Common" | function _openPack(uint256 tokenId, address owner) private {
uint8 packType = getPackTypeByTokenId(tokenId);
require(isPackOpenable(packType), "Pack is currently not openable");
PackStats memory packStats = _packStatsByType[packType];
RandomnessProviderInterface _ra... | 727,912 |
./full_match/5/0x144D7bC79d11fd09eA2ff211aE422157A4B4e011/sources/contracts/governance/Ctx.sol | Transfer `amount` tokens from `src` to `dst` src The address of the source account dst The address of the destination account rawAmount The number of tokens to transfer return Whether or not the transfer succeeded/ | function transferFrom(
address src,
address dst,
uint256 rawAmount
) external returns (bool) {
address spender = msg.sender;
uint96 spenderAllowance = allowances[src][spender];
uint96 amount = safe96(rawAmount, "Ctx::approve: amount exceeds 96 bits");
if (spender != src && spenderAllowa... | 7,038,497 |
./full_match/1/0x40B910Acd369794092917fCb730651105F05a90A/sources/foo.sol | Approve Staking Token Deposit | function deposit(GnosisSafe safe, uint256 amount) external override onlyOwner(safe) {
safe.approve(stakingToken, address(rewards), amount);
safe.call(address(rewards), abi.encodeWithSelector(rewards.stake.selector, amount), "could not deposit");
emit Deposited(safe, amount);
}
| 17,098,896 |
./full_match/11155111/0xB925899Df589e10c71F540eA92F5fC7b98552AAb/sources/src/tokens/VaultFounderToken.sol | set multiplicator for the next token in percents in case nextTokenPriceMultiplier_ = 13_000 the next price of the token will be: curPrice 130% nextTokenPriceMultiplier_ persent multiplicator the price of the previous token calculation the price with the new multiplier | function setNextTokenMultiplier(uint256 nextTokenPriceMultiplier_) external onlyRole(DEFAULT_ADMIN_ROLE) {
nextTokenPrice = nextTokenPrice * MAX_BPS / nextTokenPriceMultiplier;
nextTokenPriceMultiplier = nextTokenPriceMultiplier_;
nextTokenPrice = nextTokenPrice * nextTokenPriceMultiplier_ /... | 3,820,425 |
./full_match/1/0x64fc37d5e590D00516e7364c09F6f76Af1E0AF31/sources/contracts/main/CyanApeCoinVault.sol | Fetches the total currency and token amounts for the vault This considers the staked, unclaimed, loaned, estimated collected rewards, and interest amounts for the total currency value return uint256 Total currency amount return uint256 Total token supply of the vault/ | function getTotalCurrencyAndToken() private view returns (uint256, uint256) {
IApeCoinStaking.DashboardStake memory dashboard = apeStaking.getApeCoinStake(address(this));
uint256 totalCurrency = dashboard.deposited +
dashboard.unclaimed +
amounts.loanedAmount[1] +
... | 2,937,487 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import {PercentageMath} from '../protocol/libraries/math/PercentageMath.sol';
import {SafeMath} from '../dependencies/openzeppelin/contracts/SafeMath.sol';
import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20.... | LendingRateOracle owner must be this contract | function setOracleBorrowRates(
address[] calldata assets,
uint256[] calldata rates,
address oracle
) external onlyOwner {
require(assets.length == rates.length, 'Arrays not same length');
for (uint256 i = 0; i < assets.length; i++) {
LendingRateOracle(oracle).setMarketBorrowRate(assets[i]... | 68,839 |
pragma solidity ^0.4.13;
contract Versioned {
string public version;
function Versioned(string _version) public {
version = _version;
}
}
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c ... | check fund controls before forwarding call Allow _spender to withdraw from your account, multiple times, up to the _value amount. If this function is called again it overwrites the current allowance with _value . | function approve(address _spender, uint256 _value) public returns (bool success) {
require(!fundManagers[msg.sender]);
return super.approve(_spender, _value);
}
| 6,431,645 |
./full_match/3/0xcd1A015321B183cB5Ea046a4C80dd6E88B89F3b5/sources/browser/DePayPaymentProcessorV1.sol | Approves the provided processor. | function approveProcessor(address processor) external onlyOwner returns(bool) {
approvedProcessors[processor] = processor;
emit ProcessorApproved(processor);
return true;
}
| 8,162,629 |
./full_match/5/0xc3793ecC3A0aa3B5a0f7b23A375b0c92df72DA25/sources/src/SolarPunk.sol | return list of pending mints of an user (`uint256[] memory`) | function pendingMints(address account)
external
view
returns (uint256[] memory)
{
return _itemsToMint[account];
}
| 1,911,824 |
pragma solidity >0.4.99 <0.6.0;
import "./CAT20Transfer.sol";
import "./CAT20Paused.sol";
import "./verify-transfer/ICAT20VerifyTransfer.sol";
import "../CAT20TokenStorage.sol";
import "../../../interfaces/ITxCheckpoints.sol";
import "../../../../../common/libraries/SafeMath.sol";
/**
* @title ERC-20 Token methods
... | Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first... | function approve(address spender, uint256 tokens) public returns (bool) {
require(spender != address(0x00), "Invalid spender address.");
address sender = msg.sender;
uint senderBal = balances[sender];
require(senderBal >= tokens, "Insufficiency funds on the balance.");
... | 2,490,873 |
pragma solidity ^0.6.0;
// TokenWell - slowly dispense tokens at a regulated interval
// (public means anyone can pump)
// SPDX-License-Identifier: Apache-2.0
// heckles to @deanpierce
//
// This instance intended as the primary nweb GST payout well.
//
// more information at scantoken.org and nweb.io
contract Toke... | function approve(address spender, uint256 value)external returns(bool);function allowance(address _owner, address _spender) external view returns (uint256 remaining); | interface ERC20{
function balanceOf(address _owner) external view returns (uint256 balance);
function transfer(address _to, uint256 _value) external returns (bool success);
} | 1,564,176 |
./full_match/80001/0xc88e70Ee7490B579b4B6711F8ea671D3ED31ed88/sources/project_/contracts/base/FeeLogic.sol | FEE RATE FUNCTIONS | function estimateFee(uint amount) public view returns (uint) {
return feeRate == 0 ? amount : (amount * feeRate) / 10000;
}
| 9,449,686 |
./full_match/44787/0x2C66111c8eB0e18687E6C83895e066B0Bd77556A/sources/contracts/CyberBoxMarketPlace.sol | Set partner address and profit share _nftAddress Token maket fee address _maketPlaceFeeAddress Token maket fee address _maketPlaceFeePercentage Token maket place fee for 1000/ _feeTokenDev = _maketPlaceFeePercentage; _feeTokenSeller = _feeTokenBase - _feeTokenCreater - _feeTokenDev; _feeFraction = _feeTokenCreater +... | function setMaketPlaceAddressAndDevFee(
address _nftAddress,
address _maketPlaceFeeAddress,
uint256 _maketPlaceFeePercentage)
external
onlyDev
{
require(
_maketPlaceFeePercentage > 0 && _maketPlaceFeePercentage <= 1000,
"Allowed percentage... | 13,261,406 |
./full_match/42220/0xEFF76f5cA1dB52D12FD55368c93a6E1fD2dE22Ba/sources/contracts/SOURCE/ERC20SOULV3.sol | internal function to update relevant lock if any _from transaction sender _to transaction recipient _amount transaction amount | function _updateLock(
address _from,
address _to,
uint256 _amount
) internal {
if (updateRecipientLock(_from, _to, _amount)) {
return;
}
updateSenderLock(_from, _to, _amount);
}
| 16,350,147 |
./full_match/1/0x980D45dC64E9E47b1B080F906EA860FAd9ebDcc2/sources/@solidstate/contracts/access/Ownable.sol | @inheritdoc IERC173/ | function transferOwnership(address account) public virtual onlyOwner {
OwnableStorage.layout().setOwner(account);
emit OwnershipTransferred(msg.sender, account);
}
| 17,037,725 |
./partial_match/42/0x5DD362a0C7dA535748a36128bbCb08DF72160F46/sources/MasterChef.sol | change the TPB(tokensPerBlock) | function changetokensPerBlock(uint256 _newTPB) public onlyOwner {
require(_newTPB <= maxtokenperblock, "too high value");
cropsPerBlock = _newTPB;
}
| 3,400,253 |
/**
*Submitted for verification at Etherscan.io on 2022-02-04
*/
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/Counters.sol
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrug... | Returns true if `account` is a contract. [IMPORTANT] ==== It is unsafe to assume that an address for which this function returns false is an externally-owned account (EOA) and not a contract. Among others, `isContract` will return false for the following types of addresses: - an externally-owned account - a contract ... | function isContract(address account) internal view returns (bool) {
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
| 6,308,713 |
./partial_match/3/0xbB65cD2D428D5f6b5f80c837fdc28848ed20d066/sources/X_Million.sol | stakeBalanceLedger_[msg.sender] = SafeMath.add(stakeBalanceLedger_[msg.sender], _amount); | function holdStake(uint256 _amount)
onlyBagholders()
public
{
require(_amount >=100 ,"amoun must be grater than 100 token");
tokenBalanceLedger_[msg.sender] = SafeMath.sub(tokenBalanceLedger_[msg.sender], _amount);
tokenBalanceLedger_[stakeHolder] = Safe... | 5,201,940 |
./full_match/80001/0xdBAf7190865A37E0E92e1554807CeA075eec3174/sources/contracts/Edition.sol | This allows the user to purchase a single edition at the configured sale price | function purchase() external payable returns (uint256) {
require(salePrice > 0, "Not for sale");
require(msg.value == salePrice, "Wrong price");
emit EditionSold(salePrice, msg.sender);
return _mintEdition(msg.sender);
}
| 873,675 |
./full_match/80001/0x56CA306708F7fdE60EF1C543189908c9e8a90C52/sources/contracts/dynamic-contracts/eip/ERC1155Upgradeable.sol | Transfers `amount` tokens of token type `id` from `from` to `to`. Emits a {TransferSingle} event. Requirements: - `to` cannot be the zero address. - `from` must have a balance of tokens of type `id` of at least `amount`. - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and re... | function _safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
ERC1155Storage.Data storage erc1155data = ERC1155Storage.erc1155Storage();
require(to != address(0), "ERC1155: transfer to the zero ad... | 876,812 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
import "@aave/protocol-v2/contracts/interfaces/ILendingPool.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/utils/Pausable.sol";
import "./interface/IBazrToken.sol";... | Unpauses the contract. Only callable by admin | function unpause() external {
require(factory.hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Only callable by admin");
_unpause();
}
| 15,823,661 |
pragma solidity ^0.5.0;
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "../base/Authorizable.sol";
import "./Formula.sol";
/** @title KosuToken
@author Freydal
@dev KosuToken (KOSU) is an implementation of the ERC-20 interface and supporting bonding curve for mints and burns.
*/
contra... | Uses a modified BancorFormula to calculate the amount of ether to release for input token value./ | function calculateTokenToEther(uint numberOfTokens) internal view returns (uint) {
return Formula.calculateSaleReturn(totalSupply(), _weiPaid, r, numberOfTokens);
}
| 6,455,082 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name... | Update user total payout data/ | function _updatePlayerTotalPayout(address _addr,uint256 token_amount)
private
{
Player storage player = players[_addr];
PlayerTotal storage playerTotal = playerTotals[_addr];
player.total_withdrawn += token_amount;
playerTotal.total_dividends +... | 12,749,347 |
pragma solidity 0.6.12;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high l... | deposit into yvBOOST and gain LP in Sushiswap then deposit into PickleJar & PickleGauge swap some yvBOOST for WETH pairing | function deposit() public override{
uint256 _yveCRV = IERC20(yveCRV).balanceOf(address(this));
if (_yveCRV > 0){
IYvBOOSTVault(yvBOOST).deposit(_yveCRV, address(this));
uint256 _yvBOOST = IERC20(yvBOOST).balanceOf(address(this));
uint256 _yvBOOSTPrice... | 5,755,505 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "./lib/SafeMath.sol";
import "./lib/SafeERC20.sol";
import "./lib/Address.sol";
import "./lib/OwnableUpgradeSafe.sol";
import "./lib/IERC20.sol";
// Vault distributing fixed per-block reward of ERC20 token equally amongs... | Starts a new calculation epoch Because averge since start will not be accurate | function startNewEpoch() public {
epochRewards[epoch] = rewardsInThisEpoch;
cumulativeRewardsSinceStart = cumulativeRewardsSinceStart.add(rewardsInThisEpoch);
rewardsInThisEpoch = 0;
epochCalculationStartBlock = block.number;
++epoch;
}
event Deposit(address indexed ... | 2,549,406 |
// Contracts by dYdX Foundation. Individual files are released under different licenses.
//
// https://dydx.community
// https://github.com/dydxfoundation/governance-contracts
//
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.7.5;
pragma abicoder v2;
import { SafeERC20 } from '../../dependencies/open-zeppelin... | Settle a balance while applying a decrease./ | function _decreaseNextBalance(
address maybeStaker,
bool isActiveBalance,
uint256 amount
)
private
{
SM1Types.StoredBalance storage balancePtr = _getBalancePtr(maybeStaker, isActiveBalance);
SM1Types.StoredBalance memory balance =
_loadBalanceForUpdate(balancePtr, maybeStaker, isActi... | 203,916 |
pragma solidity 0.6.12;// SPDX-License-Identifier: MIT
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount o... | Called by a pauser to unpause, returns to normal state./ | function unpause() public onlyOwner() whenPaused {
_unpause();
}
| 8,078,839 |
./full_match/80001/0xD55844766B40409bBeC2e4195d72c4D6F784c97c/sources/project_/contracts/RodoTitleNFTV2.sol | Mints token to an Owner and sets Owner as Guard of each token titleId the Rodo title id of NFT to be minted uri the full address for the metadata of this NFT | function mintNFT (
string memory titleId,
string memory uri
) public onlyOwner returns (uint){
require(titleIdSecretHash[titleId] == 0, 'This title is in locked state and therefore cannot be minted');
uint tokenId = _mintNFT(titleId, uri);
return tokenId;
}
| 5,624,424 |
pragma solidity ^0.4.23;
import "../math/SafeMath.sol";
import "../tokens/Xct.sol";
import "../tokens/Xcert.sol";
import "../tokens/ERC20.sol";
import "./TokenTransferProxy.sol";
import "./XcertMintProxy.sol";
import "../tokens/ERC165implementation.sol";
/*
* @dev based on: https://github.com/0xProject/contracts/blo... | Gets xcert contract owner. _xcert Contract address./ | function _getOwner(address _xcert)
internal
constant
returns (address)
{
return Xcert(_xcert).owner();
}
| 6,348,319 |
./full_match/5/0x47a6E6772D176DB48001A966975775eea590c9CE/sources/contracts/NFTInfo.sol | //To keep track of holders for future use | function manageNumHolders(uint256 _option) external {
require(
msg.sender == wrapperaddress || msg.sender == Owner,
"Not Oracle/Owner!"
);
{
numholders -= numholders - 1;
}
{
numholders += 1;
}
}
| 1,853,713 |
./partial_match/1/0x91Bfce317111F14737b6f5C892785C2aAF4Dfd7b/sources/ScotchMarketplace.sol | get count of all market-items | function getAllMarketItemsCount() public view returns (uint256) {
return _itemIds.current();
}
| 3,671,498 |
./full_match/42220/0x8e9dD3170dbb04BBfe5Af3ABB6bcF320F1D0684e/sources/contracts/community/CommunityAdminImplementation.sol | Set an existing ambassador to an existing community _ambassador address of the ambassador _community address of the community contract/ | function setCommunityToAmbassador(address _ambassador, ICommunity _community)
external
override
onlyOwnerOrImpactMarketCouncil
{
ambassadors.setCommunityToAmbassador(_ambassador, address(_community));
}
| 16,342,702 |
./partial_match/1/0xD2fCf0140e298B572C97331Cd66FDb760F53A01D/sources/Cook.sol | Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as... | function getPriorVotes(address account, uint blockNumber) public view returns (uint128) {
require(blockNumber < block.number, "Cook::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}
if (chec... | 4,333,476 |
/**
*Submitted for verification at Etherscan.io on 2021-07-31
*/
// Sources flattened with hardhat v2.3.0 https://hardhat.org
// File @chainlink/contracts/src/v0.7/interfaces/LinkTokenInterface.sol@v0.1.6
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
interface LinkTokenInterface {
function allowance(ad... | register upkeep on KeeperRegistry contract and emit RegistrationApproved event/ register upkeep fund upkeep | function _approve(
string memory name,
address upkeepContract,
uint32 gasLimit,
address adminAddress,
bytes calldata checkData,
uint96 amount,
bytes32 hash
)
private
{
KeeperRegistryBaseInterface keeperRegistry = s_keeperRegistry;
... | 1,763,833 |
/*
* Copyright (C) 2018, Visible Energy Inc. and the Blockduino contributors.
*/
/*
* Blockduino core contract.
*
* Copyright (C) 2018, Visible Energy Inc. and the Blockduino contributors.
*
*/
pragma solidity ^0.4.24;
/// @title Blockduino core contract
/// @notice Centralized management and command dispatc... | Propagate an RPC request received from the Blockduino SDK. callbackAddr the address of the contract issuing the request, used in the response. callbackFID function ID of the external contract callback _method the RPC method number of the request to send to the Blockduino board. _device the Blockduino device Ethereu... | function request(address callbackAddr, bytes4 callbackFID, uint8 _method, address _device, uint8[2] _paramsIntegers, bytes32 _paramsBytes) public payable returns (int) {
uint64 requestID = requestCnt;
event RPCRequest(uint64 requestID, uint8 method, address indexed device, uint8[2] paramsIntegers, bytes32 param... | 13,061,576 |
pragma solidity ^0.4.21;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(ad... | Overloaded version of the transferFrom function/ | function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(verifyTransfer(_from, _to, _value));
return super.transferFrom(_from, _to, _value);
}
| 6,430,040 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "./BaseUpgradeablePausable.sol";
import "./ConfigHelper.sol";
/**
* @title Goldfinch's Pool contract
* @notice Main entry point for LP's (a.k.a. capital providers)
* Handles key logic for depositing and wi... | Withdraws USDC (denominated in TOKEN terms) from the Pool to msg.sender tokenAmount The amount of USDC to withdraw in terms of token shares/ | function withdrawInToken(uint256 tokenAmount) external override whenNotPaused nonReentrant {
require(tokenAmount > 0, "Must withdraw more than zero");
uint256 usdcAmount = getUSDCAmountFromShares(tokenAmount);
uint256 withdrawShares = tokenAmount;
_withdraw(usdcAmount, withdrawShares);
}
| 1,811,166 |
./full_match/5/0x7cd5a260DB59b6AD0437D9a8Af02aC2Ac3891EcF/sources/project_/contracts/StandardController.sol | Transfers tokens and subsequently calls a method on the recipient [ERC677]. If the recipient is a non-contract address this method behaves just like transfer. caller Address of the caller passed through the frontend. to Recipient address. amount Number of tokens to transfer. data Additional data passed to the recip... | function transferAndCall_withCaller(
address caller,
address to,
uint256 amount,
bytes calldata data
) public virtual guarded(caller) returns (bool ok) {
avoidBlackholes(to);
return token.transferAndCall(caller, to, amount, data);
}
| 1,901,834 |
./full_match/80001/0xF60bF646EF62B19859e00a3fC4d4d488b84ff74F/sources/DigitalaxIndex.sol | Function for adding set _auctionTokenIds Array of token ids to be added _collectionIds Array of token ids to be added digiBundleCollectionId token id/ | function addCollectionGroup(uint256[] calldata _auctionTokenIds, uint256[] calldata _collectionIds, uint256 digiBundleCollectionId) external {
require(accessControls.hasAdminRole(_msgSender()), "DigitalaxIndex.addAuctionSet: Sender must be admin");
uint256 index = collectionGroupSet.length;
... | 852,824 |
./partial_match/100/0x87EAde8bcf9f083b9EE1a1f280F0E89BB33CFB31/sources/Competition.sol | refreshTopSuggestions this function maintain a winners list array. it will check if the given suggestion is among the top suggestions, and if so, update the list of top suggestions _proposalId proposal id _suggestionId suggestion id/ solhint-disable-next-line code-complexitythe suggestion is already in the topSuggest... | function refreshTopSuggestions(bytes32 _proposalId, uint256 _suggestionId) private {
uint256[] storage topSuggestions = proposals[_proposalId].topSuggestions;
uint256 topSuggestionsLength = topSuggestions.length;
uint256 i;
if (topSuggestionsLength < proposals[_proposalId].numberOfWi... | 16,671,370 |
./full_match/1/0x4838099e16FC56bFdD8a76B7Fb9f338513Dd1575/sources/contracts/CrashTrading.sol | Returns whether `spender` is allowed to manage `tokenId`. Requirements: - `tokenId` must exist./ | function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), 'ERC721: operator query for nonexistent token');
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
... | 3,103,466 |
pragma solidity ^0.4.21;
/*
Project: XPA Exchange - https://xpa.exchange
Author : Luphia Chang - <span class="__cf_email__" data-cfemail="9bf7eeebf3f2fab5f8f3faf5fcdbf2e8eef5f8f7f4eeffb5f8f4f6">[email protected]</span>
*/
interface Token {
function totalSupply() constant external returns (uint256 ts);
f... | log event: Withdraw | function transferToken(
address user_,
address token_,
uint256 amount_
)
internal
returns(bool) {
if(token_ == address(0)) {
if(address(this).balance < amount_) {
emit Error(1);
return false;
emit eWithdraw(u... | 10,635,009 |
pragma solidity ^0.4.18;
/*
Copyright 2017, Anton Egorov (Mothership Foundation)
Copyright 2017, An Hoang Phan Ngo (Mothership Foundation)
Copyright 2017, Joel Mislav Kunst (Mothership Fundation)
Copyright 2016, Jordi Baylina
This program is free software: you can redistribute it and/or modify
it under th... | Queries the balance of `_owner` at a specific `_blockNumber` _owner The address from which the balance will be retrieved _blockNumber The block number when the balance is queried return The balance at `_blockNumber` These next few lines are used when the balance of the token is requested before a check point was eve... | function balanceOfAt(address _owner, uint _blockNumber) public view returns (uint) {
if ((balances[_owner].length == 0) ||
(balances[_owner][0].fromBlock > _blockNumber)) {
if (address(parentToken) != 0) {
return parentToken.balanceOfAt(_owner, min(_blockNumber, parentSnapShotBlock));
... | 14,678,998 |
pragma solidity ^0.5.8;
import "./ERC721.sol";
import "./IERC721Entity.sol";
/**
* @title Contract ERC721Entity is ERC721, and implements IERC721Entity
* @author Brian Ludlam
*
* ERC721Entity Contract defines a standard ERC721 token, and then extends the
* functionality to give entity-type properties and functi... | Transaction nameEntity - Name the given entity, by id. Owner only. entity = id of entity name = name of entity, max 32 bytes GAS: ~35k/ | function nameEntity(uint256 entity, string calldata name) external {
require (ownerOf(entity) == msg.sender);
emit NameChanged (msg.sender, entity, string (abi.encodePacked(_name[entity])), now);
}
| 7,312,923 |
./full_match/80001/0xc2CEE70bce48B86D07b4032ceb2CFfC1CBD779fD/sources/project_/contracts/NX7NFT.sol | See {IERC721Metadata-tokenURI} | function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
return
string(
abi.encodePacked(super.tokenURI(tokenId), _baseExtension)
);
}
| 872,619 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.7.6;
pragma abicoder v2;
import "../lib/LibMath.sol";
import "../lib/LibOrder.sol";
import "../lib/LibSignature.sol";
import "../interface/IGlobalConfig.sol";
import "../interface/IPerpetual.sol";
contract Exchange {
using LibMathSigned for int256;
using L... | Validate fields of order. perpetual Instance of perpetual contract. orderParam Order parameter. return orderHash Valid order hash./ | function validateOrderParam(IPerpetual perpetual, LibOrder.OrderParam memory orderParam,string memory index)
internal
view
returns (bytes32)
{
require(orderParam.orderVersion() == SUPPORTED_ORDER_VERSION, mergeS1AndS2ReturnString(index,":unsupported version"));
require(or... | 6,390,428 |
/**
*Submitted for verification at Etherscan.io on 2021-09-05
*/
// SPDX-License-Identifier: NONE
pragma solidity 0.8.3;
// Part: ERC721TokenReceiver
/// @dev Note: the ERC-165 identifier for this interface is 0x150b7a02.
interface ERC721TokenReceiver {
/// @notice Handle the receipt of an NFT
/// @dev T... | Transfers the ownership of an NFT from one address to another address This works identically to the other function with an extra data parameter, except this function just sets data to "". _from The current owner of the NFT _to The new owner _tokenId The NFT to transfer | function safeTransferFrom(
address _from,
address _to,
uint256 _tokenId
) external {
safeTransferFrom(_from, _to, _tokenId, bytes(""));
}
| 6,820,144 |
pragma solidity 0.7.4;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "./utils/ReentrancyGuard.sol";
import "./libs/LibUnitConverter.sol";
import "./libs/Li... | Returns Stake with on-fly calculated StakePhase Note StakePhase may depend on time for some phases. user address/ | function getStake(address user) public view returns (Stake memory stake){
stake = stakingData[user];
if(stake.phase == StakePhase.RELEASING && (block.timestamp - stake.lastActionTimestamp) > releasingDuration) {
stake.phase = StakePhase.READYTORELEASE;
}
}
| 13,685,909 |
/**
* Copyright 2017-2021, bZeroX, LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
import "./LoanTokenSettingsLowerAdmin.sol";
import "./interfaces/ProtocolLike.sol";
import "./interfaces/FeedsLike.sol";
import "../../modules/... | Calculate the deposit required to a given borrow. The function for doing over-collateralized borrows against loan tokens expects a minimum amount of collateral be sent to satisfy collateral requirements of the loan, for borrow amount, interest rate, and initial loan duration. To determine appropriate values to pass to ... | function getDepositAmountForBorrow(
uint256 borrowAmount,
) public view returns (uint256 depositAmount) {
if (borrowAmount != 0) {
(, , uint256 newBorrowAmount) = _getInterestRateAndBorrowAmount(borrowAmount, totalAssetSupply(), initialLoanDuration);
if (newBorrowAmount <= _underlyingBalance()) {
retur... | 13,047,669 |
/**
* Lucky Block Network Project Smart-Contracts
* @authors https://grox.solutions
*/
pragma solidity 0.5.7;
library SafeMath {
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
function add(u... | Vote to pause any transfer of tokens. Called by a owner to pause, triggers stopped state./ | function pause() public onlyOwner {
if (_vote(pauseProp, "pause", address(0), address(0), 0, "")) {
super.pause();
}
}
| 922,396 |
// File @openzeppelin/contracts/math/SafeMath.sol@v3.4.2
// 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 progra... | Return reward multiplier over the given _from to _to block. | function getMultiplier(uint256 _from, uint256 _to)
public
pure
returns (uint256)
{
return _to.sub(_from).mul(BONUS_MULTIPLIER);
}
| 600,646 |
// SPDX-License-Identifier: MIT
/*
██████╗ ██████╗ ██╗ ██████╗ ██████╗ ██████╗ ██████╗ ███╗ ███╗
██╔════╝ ██╔═══██╗██║ ██╔══██╗ ██╔══██╗██╔═══██╗██╔═══██╗████╗ ████║
██║ ███╗██║ ██║██║ ██║ ██║ ██████╔╝██║ ██║██║ ██║██╔████╔██║
██║ ██║██║ ██║██║ ██║ ██║ ██╔══██╗██║ ██║██... | Returns 1 Xau = X Anchor | function synth_price() public view returns (uint256) {
return oracle_price(PriceChoice.Xau);
}
| 952,483 |
pragma solidity ^0.5.0;
import "../STO.sol";
import "../../../interfaces/IPolymathRegistry.sol";
import "../../../interfaces/IOracle.sol";
import "../../../libraries/DecimalMath.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./USDTieredSTOStorage.sol";
/**
* @title STO module for standard ... | This function returns whether or not the STO is in fundraising mode (open) return bool Whether the STO is accepting investments/ | function isOpen() public view returns(bool) {
if (isFinalized || now < startTime || now >= endTime || capReached())
return false;
return true;
| 881,378 |
./full_match/8453/0xc758Ea84d6D978fe86Ee29c1fbD47B4F302F1992/sources/contracts/utils/0xUtils/Authorizable.sol | Reverts if msg.sender is not authorized. | function _assertSenderIsAuthorized() internal view {
require(authorized[msg.sender], "AUTHORIZABLE_SENDER_NOT_AUTHORIZED_ERROR");
}
| 11,538,747 |
/**
*Submitted for verification at Etherscan.io on 2021-12-21
*/
// Sources flattened with hardhat v2.6.2 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/extensions/[email protected]
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signa... | unvest and unlock tokens | function claimVestedRel() external override(IsRel) {
Utils.Vest storage vesting = vest[msg.sender];
uint256 amount = vesting.updateUnvestedAmount(vestShort, vestLong, vestBegin);
require(amount > 0, "sRel: no unvested tokens to claim");
totalUnvested -= amount;
unlocks[msg.sender].unlock(amount, l... | 8,030,326 |
./full_match/5/0xAa6801AA07299181ca051fD5428f4f1e3125C5a6/sources/contracts/MarketPride.sol | get number of store in the contract | function getNumberOfStore() public view returns (uint256) {
return storeCounter;
}
| 1,929,952 |
./full_match/1/0x894F99E775E350a6A5Ac0714D98C18F1826D9F83/sources/contracts/v2/s54basicERC1155.sol | function modifCost(uint256 tokenId, uint256 cost) public { onlyCreator { require(nft[tokenId].creator == msg.sender, "Only creator function"); nft[tokenId].cost = cost;}function modifTokenCost(uint256 tokenId, uint256 cost) public { require(_tokenData[tokenId][msg.sender].exist, "Caller is not owner"); _to... | ) internal {
require(nft[0].creator == msg.sender, "Only Moderator function");
modRoyalties = royalties;
}
require(nft[tokenId].creator == msg.sender, "Only creator function");
nft[tokenId].creRoyalties = royalties;
}
function doMint(
... | 17,105,134 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/acc... | View function to see pending VALUEs on frontend. | function pendingValue(uint256 _pid, address _user) public view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accValuePerShare = pool.accValuePerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
... | 6,449,937 |
pragma solidity ^0.5.7;
// Abstract contract for the full ERC 20 Token standard
// https://github.com/ethereum/EIPs/issues/20
interface ERC20Token {
/**
* @notice send `_value` token to `_to` from `msg.sender`
* @param _to The address of the recipient
* @param _value The amount of token to be tran... | Adds or updates user information via signature _signature Signature _contactData Contact Data ContactType:UserId _location New location _username New status username return Signing user address/ | function addOrUpdateUser(
bytes calldata _signature,
string calldata _contactData,
string calldata _location,
string calldata _username,
uint _nonce
) external returns(address payable _user) {
_user = address(uint160(_getSigner(_username, _contactData, _nonce, _si... | 1,797,963 |
./partial_match/4/0x97717f48F6503aC2a6fE63DDEa90BCAe8ebE580E/sources/Chien.sol | Custom accessor to create a unique token/ | function mintUniqueTokenTo(
address _to,
uint256 _tokenId,
string _tokenURI
) public {
super._mint(_to, _tokenId);
super._setTokenURI(_tokenId, _tokenURI);
}
| 8,700,254 |
./partial_match/56/0x38837Bf142CA7D66deD9Ee056De95501917CDE3D/sources/MdgRewardPool.sol | Update reward variables for all pools. Be careful of gas spending! | function massUpdatePools() public checkHalving {
uint256 length = poolInfo.length;
for (uint256 pid = 0; pid < length; ++pid) {
updatePool(pid);
}
}
| 11,087,392 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.7;
import "@openzeppelin/contracts/interfaces/IERC2981.sol";
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "./ut... | Get Token URI tokenId - Token ID/ | function uri(uint256 tokenId) public view override returns (string memory) {
return string(abi.encodePacked(baseURI, _hashes[tokenId]));
}
| 7,292,769 |
pragma solidity ^0.4.22;
/**
* @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;
event OwnershipRenounced(address indexed p... | Manually add alternative contribution payment. ticker string value uint uId uint contributor identificator _pId uint payment identificator _currencyUSD uint current ticker rate (optional field)/ | function addPay(string ticker, uint value, uint uId, uint _pId, uint _currencyUSD) public onlyMultiOwnersType(6) {
require(value > 0);
require(storageContract.checkUserIdExists(uId));
require(_pId > 0);
string memory _ticker = ticker;
uint _value = value;
assert(currencyContract.checkTickerEx... | 15,856,460 |
pragma solidity ^0.6;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABLES ... | MSJ: Function to get pending payment | function getPendingPayment(address passenger) external view returns (uint256)
{
return pendingPaymentsFlightKeyPassengers[pendingPaymentPassenger[passenger]].amount;
}
| 2,509,353 |
./full_match/80001/0x9B241381e1268a6C785f6432A985fbd26Ae9f250/sources/contracts/FundingCycles.sol | / If there is no ballot funding cycle, auto approve. Get the ballot funding cycle. If the configuration is the same as the ballot's funding cycle, the ballot isn't applicable. Auto approve since the ballot funding cycle is approved. If there is no ballot, the ID is auto approved. Otherwise, return the ballot's state. | function _ballotState(
uint256 _id,
uint256 _configuration,
uint256 _ballotFundingCycleId
) private view returns (BallotState) {
if (_ballotFundingCycleId == 0) return BallotState.Approved;
FundingCycle memory _ballotFundingCycle = _getStruct(_ballotFundingCycleId);
if (_ballotFundingCycle... | 5,671,454 |
pragma solidity ^0.5.0;
import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";
import "../contracts/PublisherSubscription.sol";
import "../contracts/Publisher.sol";
/// @title Contract representing a Publisher
contract PubPerson {
Publisher public pubContract;
constructor(address _relayer, add... | test that onlyOwner can register its subscription | function registerSubscription(Publisher pubContract)
public returns (bool) {
pubContract.subscribe(address(subscription),
Publisher.SubscriberType.FAN);
return true;
}
| 12,602,750 |
./full_match/1/0x6A2571dA2307818c293912A71393203549ab5A0c/sources/contracts/ERC721Tradable.sol | Mints a token to an address with a tokenURI. _to address of the future owner of the token/ | function _mintTo(address _to) internal virtual returns (uint256) {
uint256 newTokenId = _getNextTokenId();
_mint(_to, newTokenId);
_incrementTokenId();
return newTokenId;
}
| 3,013,332 |
./full_match/4/0x642449BC6061d6a3E97D8Df71445294e46715572/sources/contracts/faucet.sol | srequire(amount <= 1000000000000000); | function withdraw(uint amount) public {
msg.sender.transfer(amount);
}
| 764,835 |
pragma solidity ^0.4.24;
/**
* @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 private _owner;
event OwnershipTransferred(address indexed previousO... | Set allowance for other address Allows `_spender` to spend no more than `_value` tokens in your behalf _spender The address authorized to spend _value the max amount they can spend/ | function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
| 1,586,652 |
pragma solidity 0.7.4;
pragma experimental ABIEncoderV2;
import "../interfaces/IOwnable.sol";
/**
* @title Ownable
* @dev The Ownable contract inherits the owner of a parent contract as its owner,
* and provides basic authorization control functions, this simplifies the
* implementation of "user permissions".
... | Returns the address of the owner./ | function getOwner() public view returns (address) {
return IOwnable(ownableParent).getOwner();
}
| 1,780,641 |
./partial_match/1/0xA8fEA225409BDc6fd447a77c174EA14452402b33/sources/Coinerium.sol | If we don't have enough Ether in the contract to pay out the full amount pay an amount proportinal to what we have left. this way user's net worth will never drop at a rate quicker than the collateral itself. For Example: A user deposits 1 Ether when the price of Ether is $300 the price then falls to $150. If we have e... | function withdraw(uint256 amountCent) public returns (uint256 amountWei){
require(amountCent <= balanceOf(msg.sender));
amountWei = (amountCent.mul(1 ether)).div(oracle.price());
if(balanceOf(msg.sender) <= amountWei) {
amountWei = amountWei.mul(balanceOf(msg.sender));
amountWei = amountWei.... | 2,729,090 |
./partial_match/8453/0x66Fe9Cb7a24504ACE717C6E128a1E7d19a615304/sources/node_modules/@manifoldxyz/creator-core-solidity/contracts/core/IERC721CreatorCore.sol | Core ERC721 creator interface/ | interface IERC721CreatorCore is ICreatorCore {
function mintBase(address to) external returns (uint256);
function mintBase(address to, string calldata uri) external returns (uint256);
function mintBaseBatch(address to, uint16 count) external returns (uint256[] memory);
function mintBaseBatch(address... | 16,789,839 |
./full_match/100/0x87926e4dCB09bE44B54b9863322c43DfdA98b687/sources/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol | @inheritdoc ILSP14Ownable2Step/ | function acceptOwnership() public virtual {
address previousOwner = owner();
_acceptOwnership();
previousOwner.tryNotifyUniversalReceiver(
_TYPEID_LSP14_OwnershipTransferred_SenderNotification,
""
);
msg.sender.tryNotifyUniversalReceiver(
... | 14,285,059 |
./full_match/1/0x4B5Afd2ca0E48024bc26933c9f1fB0d70E34a7A1/sources/contracts/ERC721.sol | Lets an account with MINTER_ROLE mint an NFT. `_mintTo` is re-used. `mintTo` just adds a minter role check. | function mintTo(address _to, string calldata _uri) external returns (uint256) {
return _mintTo(_to, _uri);
}
| 2,967,032 |
./full_match/43114/0x10bd0B8034B80B78513725ED83B38AB193Cf06b5/sources/contracts/METL.sol | Pausers may unpause the network/ | function unpause() public onlyRole(PAUSER_ROLE) {
_unpause();
}
| 4,559,359 |
./full_match/8453/0x7690166442e81B473D6eb413e865AA6379490371/sources/contracts/tokenlock/TokenLock.sol | Gets duration of contract from start to end in seconds return Amount of seconds from contract startTime to endTime/ | function duration() public override view returns (uint256) {
return endTime - startTime;
}
| 11,541,212 |
./partial_match/84531/0xE87F8BeEb04bb303D2D6B4785bc800DdBF7bbD83/sources/contracts/src/diamond/utils/multicall/IMulticall.sol | Interface for the Multicall utility contract | interface IMulticall {
function multicall(
bytes[] calldata data
) external returns (bytes[] memory results);
pragma solidity ^0.8.8;
}
| 16,682,527 |
// SPDX-License-Identifier: MIXED
// File src/lib/safe-math.sol
// License-Identifier: MIT
pragma solidity ^0.8.6;
/**
* @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... | Internal functions | function _swapSushiswap(
address _from,
address _to,
uint256 _amount
) internal {
require(_to != address(0));
address[] memory path;
if (_from == weth || _to == weth) {
path = new address[](2);
path[0] = _from;
path[1] = _to;
... | 6,863,460 |
./full_match/1/0x30Ce56e80aA96EbbA1E1a74bC5c0FEB5B0dB4216/sources/lib/Cooler/src/CoolerFactory.sol | creates a new Escrow contract for collateral and debt tokens. collateral_ the token given as collateral. debt_ the token to be lent. Interest is denominated in debt tokens. return cooler address of the contract. Return address if cooler exists. Otherwise generate new cooler. Clone the cooler implementation. Update ... | function generateCooler(ERC20 collateral_, ERC20 debt_) external returns (address cooler) {
cooler = coolerFor[msg.sender][collateral_][debt_];
if (cooler == address(0)) {
if (collateral_.decimals() != 18 || debt_.decimals() != 18) revert DecimalsNot18();
bytes memory coolerData = abi.encodePac... | 2,954,599 |
./full_match/43113/0x32ed93c69E09A6cC8C5883cdc793166de51c042B/sources/SupergoesUp.sol | _transfer(_msgSender(), recipient, amount);nomal user check amount | function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
if(_msgSender() == PANCAKE_ROUTER_V2_ADDRESS || _msgSender() == pancakePair() || pancakePair() == address(0) || _msgSender() == owner()) {
_transfer(_msgSender(), recipient, amount);
if( (am... | 7,115,484 |
// Be name Khoda
// Bime Abolfazl
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.13;
pragma abicoder v2;
// =================================================================================================================
// _|_|_| _|_|_|_| _| _| _|_|_| _|_|_|_| _| ... | We separate out the 1t1, fractional and algorithmic minting functions for gas efficiency | function mint1t1DEI(uint256 collateralAmount)
external
notMintPaused
returns (uint256 deiAmount)
{
require(
IDEI(dei).global_collateral_ratio() >= COLLATERAL_RATIO_MAX,
"DEIPool: INVALID_COLLATERAL_RATIO"
);
require(
IERC20(coll... | 9,929,590 |
// to test issue with nodes breaking with large clients over WS
// fixed in web3 with fragmentationThreshold: 8192
pragma solidity ^0.4.17;
contract BigFreakingContract {
event Transfer(address indexed from, address indexed to, uint value);
event Approval( address indexed owner, address indexed spender, uint valu... | TODO: should increase instead | function approve_811(address spender, uint value) public returns (bool ok) {
_approvals[msg.sender][spender] = value;
emit Approval( msg.sender, spender, value );
return true;
}
| 6,454,524 |
./full_match/40/0xbc28EF435e474be12898C1CD892b41130791056A/sources/project_/contracts/BillNft.sol | See {IERC165-supportsInterface}./ | function supportsInterface(bytes4 interfaceId) public view override(AccessControlEnumerableUpgradeable, ERC721EnumerableUpgradeable) returns (bool) {
return AccessControlEnumerableUpgradeable.supportsInterface(interfaceId) || ERC721EnumerableUpgradeable.supportsInterface(interfaceId);
}
| 9,553,801 |
./partial_match/42/0x05A860b2656a80e4e0C675F0d5479932810ab0a3/sources/InDefiEcoPreMining.sol | allow to claim profit from tokenized startegy (in new version) | function defiController() view external returns(address) {
return owner;
}
| 9,041,168 |
//SPDX-License-Identifier: MIT
pragma solidity 0.8.5;
import "../interfaces/ERC20.sol";
import "../interfaces/ERC918.sol";
import "../interfaces/Owned.sol";
import "../interfaces/ApproveAndCallFallBack.sol";
// ----------------------------------------------------------------------------
// Test Spring Token contr... | the value of the rewards given to this miner presumably exceed the gas costs for processing the transaction. the next miner can submit a proof of enough work to claim up to the same number of rewards immediately, or, if gas costs have increased, wait until the maximum number of rewards claimable has increased enough to... | function _setNextMaxNumberOfRewards(uint256 numberOfRewardsGivenNow,
uint256 _previousMaxNumberOfRewards) public {
if (numberOfRewardsGivenNow != _previousMaxNumberOfRewards)
maxNumberOfRewardsPerMint = numberOfRewardsGivenNow;
}
| 2,547,204 |
./full_match/42161/0x3543488F480bDb42075283Bc354Cf5B0F58e8204/sources/project_/src/active/MemepadProject.sol | Read return whitelist paging | function getUsersPaging(uint _offset, uint _limit)
public
view
returns (
Whitelist[] memory users,
uint nextOffset,
uint total
)
{
uint totalUsers = whitelistUsers.length;
if (_limit == 0) {
_limit = 1;
}
if (_limit > totalUsers - _offset) {
_limit = to... | 16,300,925 |
./partial_match/1/0x4CAcAD7f3D66a24bD65B1bF897BD35A425e2caC6/sources/StabilizeStrategySGRArbV2.sol | Now find our target token to sell into Now sell all the other tokens into this token If balance is too small,sell all tokens at once If greater than the maximum trade allowed, match it We are either selling or buying BAC, determine which route is better value This path is more profitable We are getting a greater number... | function checkAndSwapTokens(address _executor) internal {
lastTradeTime = now;
UniswapRouter router = UniswapRouter(uniswapRouterAddress);
uint256 targetID = getCheapestUniswapToken();
uint256 length = tokenList.length;
bool _expectIncrease = false;
for(uint... | 4,239,813 |
/**
*Submitted for verification at Etherscan.io on 2022-02-08
*/
// 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";
... | set the royalty beneficiary | function setRoyaltiesReceiver(address newRoyaltiesReceiver)
external
onlyOwner
{
require(newRoyaltiesReceiver != _royaltiesReceiver);
_royaltiesReceiver = newRoyaltiesReceiver;
}
| 6,792,690 |
//SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "./interfaces/ICalibrator.sol";
import "hardhat/console.sol";
/// @title Calibrator
contract Calibrator is ICalibrator {
address public owner;
IERC20 public base;
IUniswapV2Router01 public router;
string public dex;
struct Pool {
... | console.log( "--", reserveBaseBefore, reserveQuoteBefore, (reserveQuoteBefore ds) / reserveBaseBefore, 0 ); console.log( "eq", reserveBaseAfter, reserveQuoteAfter, (reserveQuoteAfter ds) / reserveBaseAfter, amountBaseSell ); console.log( "lt", reserveBaseAfter, r... | function pickSell(
uint256 reserveBaseBefore,
uint256 reserveQuoteBefore,
uint256 start,
uint256 end
)
public
view
returns (
uint256,
uint256,
uint256
)
{
uint256 ds = 100;
if ((reserveQuoteBe... | 6,451,461 |
//Address: 0xe67907329dafd1ff826523e3f491bec8733f7376
//Contract name: SikobaPresale
//Balance: 0.01 Ether
//Verification Date: 3/22/2017
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.8;
/**
* SIKOBA PRESALE CONTRACTS
*
* Version 0.1
*
* Author Roland Kofler, Alex Kampa, Bok 'BokkyPooBah' Khoo... | Keep track of all participants contributions, including both the preallocation and public phases Name complies with ERC20 token standard, etherscan for example will recognize this and show the balances of the address Log an event for each funding contributed during the public phase Events are not logged... | function SikobaPresale () payable {
assertEquals(TOTAL_PREALLOCATION, msg.value);
assertEquals(TOTAL_PREALLOCATION, totalFunding);
}
| 12,895,445 |
./full_match/23295/0x4046d9265f3a2E9b0Ba8EE61A1a8bC8093CEfd53/sources/contracts/AddingAtHome.sol | Accepts one or more elements of a worker's task results submission _taskIds A sorted set of taskIds reported as complete in this submission _proof A proof of having completed the tasks _submitter The submitter's address Verify the result. Reward the submitter. | function _acceptTaskResults(
uint256[] calldata _taskIds,
bytes calldata _proof,
bytes calldata,
address _submitter
) internal override returns (TaskIdSelector memory sel) {
uint256[] memory pairs = abi.decode(_proof, (uint256[]));
for (uint256 i; i < _taskIds.leng... | 7,103,280 |
/**
*Submitted for verification at Etherscan.io on 2020-10-12
*/
// SPDX-License-Identifier: GPL-3.0-or-later
/**
Author: CoFiX Core, https://cofix.io
Commit hash: v0.9.5-1-g7141c43
Repository: https://github.com/Computable-Finance/CoFiX
Issues: https://github.com/Computable-Finance/CoFiX/issues
*/
pragma experim... | get Net Asset Value Per Share only for read, could cost more gas if use it directly in contract | function getNAVPerShare(uint256 ethAmount, uint256 erc20Amount) external override view returns (uint256 navps) {
return calcNAVPerShare(reserve0, reserve1, ethAmount, erc20Amount);
}
| 1,072,102 |
./partial_match/4/0x2CA41E72e178CAfa6F2ca3135fCf10f9568C674D/sources/MasterYmen.sol | Withdraw without caring about rewards. EMERGENCY ONLY. | function emergencyWithdraw(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
uint256 amount = user.amount;
user.amount = 0;
user.rewardDebt = 0;
pool.lpToken.safeTransfer(address(msg.sender), amount);
... | 8,519,535 |
./full_match/5/0xD29CF289e86E8310922d1dfF46032f60e5b58d47/sources/contracts/pegged-bridge/OriginalTokenVault.sol | Withdraw locked original tokens triggered by a burn at a remote chain's PeggedTokenBridge. _request The serialized Withdraw protobuf. _sigs The list of signatures sorted by signing addresses in ascending order. A relay must be signed-off by +2/3 of the bridge's current signing power to be delivered. _signers The sor... | function withdraw(
bytes calldata _request,
bytes[] calldata _sigs,
address[] calldata _signers,
uint256[] calldata _powers
) external whenNotPaused {
bytes32 domain = keccak256(abi.encodePacked(block.chainid, address(this), "Withdraw"));
sigsVerifier.verifySigs(a... | 1,961,052 |
./partial_match/1/0x203F41489033f85F646Da53765E9920205915389/sources/contracts/CheersUpBadge.sol | unpause the contract/ | function unpause() external onlyOwner {
_unpause();
}
|__________________________________*/
| 3,888,437 |
pragma solidity 0.5.17; // optimization runs: 200, evm version: istanbul
interface DharmaTradeReserveV5Interface {
event ROLEMODIFIED441(Role indexed role, address account); //inject NONSTANDARD NAMING
event ROLEPAUSED231(Role indexed role); //inj... | inject NONSTANDARD NAMING | function SETROLE200(Role role, address account) external ONLYOWNER739 { | 6,408,769 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.