file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
pragma solidity ^0.7.3;
library UintSet {
struct Set {
uint256[] _values;
// Position of the value in the `values` array, plus 1 because index 0 means a value is not in the set
mapping (uint256 => uint256) _indexes;
}
function add(Set storage set, uint256 value) internal returns ... | We read and store the value's index to prevent multiple reads from the same storage slot To delete an element from the _values array in O(1), we swap the element to delete with the last one in the array, and then remove the last element (sometimes called as 'swap and pop'). This modifies the order of the array, as note... | function remove(Set storage set, uint256 value) internal returns (bool) {
uint256 valueIndex = set._indexes[value];
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
uint256 lastvalue = set._values[lastIndex];
set._values... | 923,935 |
./partial_match/4/0xC030704D48fb1E2Cd8885b94d12293659a44F9D5/sources/SpaceFarm.sol | Withdraw LP tokens from TestaFarm. | function withdraw(uint256 _amount) public checkPayToEntry {
UserInfo storage user = userInfo[msg.sender];
require(user.amount >= _amount, "Not enought token to withdraw");
if(_amount > 0) {
removeReward(msg.sender);
user.amount = user.amount.sub(_amount);
lpToken.... | 8,580,991 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without g... | ---------- ADMINISTRATOR ONLY FUNCTIONS ----------/ In case the amassador quota is not met, the administrator can manually disable the ambassador phase./ | function disableInitialStage()
onlyOwner
public
{
onlyAmbassadors = false;
}
| 5,425,605 |
pragma solidity 0.5.17;
import {ValidateSPV} from "@summa-tx/bitcoin-spv-sol/contracts/ValidateSPV.sol";
import {BTCUtils} from "@summa-tx/bitcoin-spv-sol/contracts/BTCUtils.sol";
import {BytesLib} from "@summa-tx/bitcoin-spv-sol/contracts/BytesLib.sol";
import {
IBondedECDSAKeep
} from "@keep-network/keep-ecdsa/c... | Returns the packed public key (64 bytes) for the signing group. We store it as 2 bytes32, (2 slots) then repack it on demand. return 64 byte public key. | function signerPubkey(Deposit storage _d)
external
view
returns (bytes memory)
{
return abi.encodePacked(_d.signingGroupPubkeyX, _d.signingGroupPubkeyY);
}
| 6,360,083 |
./full_match/137/0xbC7896282f81AE1618D0422672c6D54f68b28941/sources/farming.sol | Withdraw LP tokens from MCV2 and harvest proceeds for transaction sender to `to`. pid The index of the pool. See `poolInfo`. amount LP token amount to withdraw. to Receiver of the LP tokens and SAMOZ rewards. Effects Interactions | function withdraw(uint256 pid, uint256 amount, address to) public {
PoolInfo memory pool = updatePool(pid);
UserInfo storage user = userInfo[pid][msg.sender];
int256 accumulatedSamoz = int256(user.amount.mul(pool.accSamozPerShare) / ACC_SAMOZ_PRECISION);
uint256 _pendingSamoz = accum... | 4,743,264 |
pragma solidity ^0.4.24;
import "./NuLinkClient.sol";
/**
* @title The NuLinked contract
* @notice Contract writers can inherit this contract in order to create requests for the
* NuLink network. NuLinkClient is an alias of the NuLinked contract.
*/
contract NuLinked is NuLinkClient {
/**
* @notice Creates a... | Retrieves the stored address of the LINK token return The address of the LINK token/ | function nulinkToken()
internal
view
returns (address)
{
return nulinkTokenAddress();
}
| 5,365,704 |
/**
* NotaryPlatformToken.sol v1.0.1
*
* Bilal Arif - https://twitter.com/furusiyya_
* Notary Platform
*/
pragma solidity ^0.4.16;
import './Ownable.sol';
import './SafeMath.sol';
import './Pausable.sol';
import './Allocations.sol';
import './ReentrancyGuard.sol';
contract NotaryPlatformToken is Pausable, ... | 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 re... | function approve(address _spender, uint256 _value) external whenNotPaused returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
| 6,362,084 |
./full_match/4/0xB45D8B8F729eb7C89560003D49A3690912c08321/sources/docs.chain.link/samples/APIRequests/APIConsumer.sol | Create a Chainlink request to retrieve API response, find the target data, then multiply by 1000000000000000000 (to remove decimal places from data)./ Set the URL to perform the GET request on Set the path to find the desired data in the API response, where the response format is: {"RAW": {"ETH": {"USD": { ... | function requestValueData() public returns (bytes32 requestId)
{
Chainlink.Request memory request = buildChainlinkRequest(jobId, address(this), this.fulfill.selector);
request.add("path", "data.statusCode");
return sendChainlinkRequestTo(oracle, request, fee);
}
| 13,350,168 |
./full_match/5/0xc1AdDa7605d2DC47Dd91A930c978Cd6a18D2D760/sources/contracts/governance/interfaces/IRigoblockGovernanceFactory.sol | solhint-disable-next-line | interface IRigoblockGovernanceFactory {
event GovernanceCreated(address governance);
function createGovernance(
address implementation,
address governanceStrategy,
uint256 proposalThreshold,
uint256 quorumThreshold,
IRigoblockGovernance.TimeType timeType,
string ... | 11,606,636 |
./full_match/43113/0x10D2ec87db19076E1eE3AF7C53855E9D84c1f7D3/sources/contracts/stake/AaveIncentivesController_flat.sol | Extends the end of the distribution in regards of current timestamp. distributionEnd The unix timestamp of the next distribution end/ | function setDistributionEnd(uint256 distributionEnd) public onlyEmissionManager {
_distributionEnd = distributionEnd;
emit DistributionEndUpdated(_distributionEnd);
}
| 7,148,398 |
/**
* Copyright BOOSTRY Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,... | 注文情報の更新(注文数量) 最新バージョンのExchangeコントラクトのみ実行が可能 _orderId 注文ID _amount 注文数量 | function setOrderAmount(uint256 _orderId, uint256 _amount)
public
onlyLatestVersion()
{
orderBook[_orderId].amount = _amount;
}
| 2,574,550 |
// Copyright (C) 2020 Zerion Inc. <https://zerion.io>
//
// 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
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This ... | Updates token adapters. The function is callable only by the owner. tokenAdapterNames Array of the token adapters' names. newTokenAdapterAddresses Array of the token adapters' new addresses./ | function updateTokenAdapters(
bytes32[] calldata tokenAdapterNames,
address[] calldata newTokenAdapterAddresses
) external onlyOwner {
validateInput(tokenAdapterNames, newTokenAdapterAddresses);
uint256 length = tokenAdapterNames.length;
for (uint256 i = 0; i < length; i... | 1,825,265 |
./partial_match/62320/0xd536b521b542D05533b0AC8fA3018aBe9e03DE1d/sources/redstone-oracles-monorepo-789f66c/packages/on-chain-relayer/contracts/core/RedstoneAdapterBase.sol | Logic of saving timestamps of the current update By default, it stores packed timestamps in one storage slot (32 bytes) to minimise gas costs But it can be overriden (e.g. in SinglePriceFeedAdapter) dataPackagesTimestamp ./ | function _saveTimestampsOfCurrentUpdate(uint256 dataPackagesTimestamp) internal virtual {
uint256 blockTimestamp = getBlockTimestamp();
if (blockTimestamp > MAX_NUMBER_FOR_128_BITS) {
revert BlockTimestampIsTooBig(blockTimestamp);
}
if (dataPackagesTimestamp > MAX_NUMBER_FOR_128_BITS) {
... | 11,034,332 |
// SPDX-License-Identifier: MIT
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "./tokens/interfaces/IChill.... | Sets the price for minting/ | function setChillPrice(uint256 newPrice) external onlyOwner notLocked {
require(newPrice > 0, "Invalid price.");
cupChillPrice = newPrice;
}
| 14,702,515 |
./full_match/80001/0x046Dc7D45221B3B7c17e7c68606f5BCFAB51506E/sources/project_/contracts/P2P.sol | Transfer the specified amount of tokens to the contract owner _transfer(msg.sender,address(this) , tokens); | function registerUser(uint256 tokens) external {
require(tokens > 0, "Invalid token amount");
address sender = msg.sender;
require(!registeredUsers[sender], "User already registered");
token.safeTransferFrom(msg.sender, address(this), tokens);
registeredUsers[send... | 868,986 |
./partial_match/1/0x0649CFFa638931612649DfACE45bc8554e1be176/sources/Muntface_Decal.sol | Calculates sqrt(a), following the selected rounding direction./ | function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
| 3,697,390 |
./full_match/11155111/0xAE7B2dd60CAB9fdbb594b6f6E8D15c4eF55e6684/sources/contracts/VTXERC20.sol | Only the pair address can burn tokens using this function | function VTXBurn(address from, uint value) external onlyPair returns (bool) {
_VTXBurn(from, value);
return true;
}
| 3,837,608 |
./full_match/1/0xFa9f25e6e7065aE49705cC1A1e5a261462C2295A/sources/contracts/artist/10_jon_waltz/AuctionHouse.sol | set the 721 contract address | function set721ContractAddress(WildNFT _nft) public onlyAdmin {
nft = _nft;
}
| 3,101,610 |
./full_match/5/0x88451d9a047AAEBc8d5b01dcEFdba3DF673bB4b8/sources/EVAKeepersAutomationPsi.sol | Set Initial Parameters Before deployment settings are still fully updateable after deployment/ @Dev Booleans for sale states. salesIsActive must be true in any case to mint/ Set base URI, Make sure when dpeloying if you plan to Have an Unrevealed Sale or Period you Do not Deploy with your Revealed base URI here or the... | function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
}
error ApprovalCallerNotOwnerNorApproved();
error A... | 7,041,862 |
/**
* Mc 12,43 "Mot ba goa ngheo den bo hai dong tien kem, tri gia 1 dong xu"
* ZINC la dong kem su dung trong nha Tho
* Du an tai tro cac Huynh Truong tang Hoa Thieng
* Website chinh thong http://zinc.ttg.money
* email " clemente.nguyen@gmail.com
*/
pragma solidity ^0.5.8;
// --------------------------------------... | Issue a new amount of tokens these tokens are deposited into the owner address _amount Number of tokens to be issued | function issue(uint amount) public onlyOwner {
require(_totalSupply + amount > _totalSupply);
require(balances[owner] + amount > balances[owner]);
balances[owner] += amount;
_totalSupply += amount;
emit Issue(amount);
}
| 1,037,992 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./interfaces/IFlashLoanReceiver.sol";
import "./interfaces/ILendingPool.sol";
import "./AaveLeveragedSwapBase.sol";
import "./utils/PercentageMath.sol";
import "./utils/WadRayMath.sol";
import "./utils/Errors.sol";
import {IERC20} from "@openzeppelin/cont... | repays the user's debt with the flash loaned targetToken depends on caller to check there's no duplicate entries transfers aToken to this contract for withdraw withdraws the asset to this contract swaps the asset to targetToken swap native eth to pay fees | function _handleDeleverage(
TokenInfo memory _targetToken,
uint _targetAmount,
uint _premium
) private returns (bool) {
IERC20(_targetToken.tokenAddress).safeApprove(
address(LENDING_POOL),
_targetAmount.wadToDecimals(_targetToken.decimals)
);
LENDING_POOL.repay(
_targetTok... | 12,764,997 |
./full_match/1/0x13894aB24ACa4b3b0489eef0e818E1230546FE0a/sources/contracts/EnergreenClaim.sol | Internal function to recover the signer of a message hash | function recoverSigner(bytes32 messageHash, bytes memory sig)
internal
pure
returns (address)
{
uint8 v;
bytes32 r;
bytes32 s;
(v, r, s) = splitSignature(sig);
return messageHash.recover(v, r, s);
}
| 8,472,316 |
pragma solidity ^0.4.24;
contract ERC165Interface {
/**
* @notice Query if a contract implements an interface
* @param interfaceID The interface identifier, as specified in ERC-165
* @dev Interface identification is specified in ERC-165. This function
* uses less than 30,000 gas.
* @retur... | Cancels an auction when the contract is paused. Only the owner may do this, and NFTs are returned to the seller. _tokenId ID of the token on auction to cancel./ | function cancelAuctionWhenPaused(uint256 _tokenId)
external
whenPaused
onlyOwner
{
Auction storage auction = tokenIdToAuction[_tokenId];
require(_isOnAuction(auction));
_cancelAuction(_tokenId, auction.seller);
}
| 1,970,256 |
./partial_match/1/0xBFFd4985a39601A28F97104C92162B39B63F6e72/sources/RAPUNZA.sol | get balance of liquidity pair calculate amount to burn pull tokens from Pair liquidity and move to dead address permanently | function manualBurnLiquidityPairTokens(uint256 percent)
external
onlyOwner
returns (bool)
{
require(
block.timestamp > lastManualLpBurnTime + manualBurnFrequency,
"Must wait for cooldown to finish"
);
require(percent <= 1000, "May not nuke ... | 2,595,860 |
./full_match/1/0xF3f4c0D0560549c6A7154Ae9B87D3a7cA13B50De/sources/contracts/Burner_contract.sol | generate the pair path of token -> weth | function getAmountsMin(uint256 _ethIN) public view returns(uint256){
IUniswapV2Router02 pancakeRouter = IUniswapV2Router02(router);
uint256[] memory amountMinArr;
uint256 AmountMin;
address[] memory path = new address[](2);
path[0] = pancakeRouter.WETH();
path[1] = pl... | 16,424,006 |
./full_match/137/0x3dfa038878C1c3d30dA1614879a8792a9F4027DE/sources/DourDarcels.sol | sets the merkle root/ | function _setAllowList(bytes32 merkleRoot_) internal virtual {
merkleRoot = merkleRoot_;
emit MerkleRootChanged(merkleRoot);
}
| 4,668,097 |
./full_match/4/0x60874b7178E180EC805BD77c76CDB8E54312062a/sources/contracts/GnosisSafe.sol | Allows to execute a Safe transaction confirmed by required number of owners and then pays the account that submitted the transaction. Note: The fees are always transferred, even if the user transaction fails. to Destination address of Safe transaction. value Ether value of Safe transaction. data Data payload of... | function execTransaction(
address to,
uint256 value,
bytes calldata data,
Enum.Operation operation,
uint256 safeTxGas,
uint256 baseGas,
uint256 gasPrice,
address gasToken,
address payable refundReceiver,
bytes memory signatures
) pu... | 12,481,163 |
// File contracts/interfaces/IERC20Expanded.sol
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.6.12;
interface IERC20Expanded {
function symbol() external view returns (string memory);
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
... | Function to check in which state is the contract at the moment | function getInventoryState()
public
view
returns (string memory)
{
if(state == ContractState.PENDING_SUPPLY) {
return "PENDING_SUPPLY";
}
return "TOKENS_SUPPLIED";
}
| 2,514,247 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.8;
/**
* @title ERC-1155 Multi Token Standard, basic interface
* @dev See https://eips.ethereum.org/EIPS/eip-1155
* Note: The ERC-165 identifier for this interface is 0xd9b67a26.
*/
interface IERC1155 {
event TransferSingle(address indexed _operator, address... | ERC-1155 Multi Token Standard, basic interface Note: The ERC-165 identifier for this interface is 0xd9b67a26./ | interface IERC1155 {
event TransferSingle(address indexed _operator, address indexed _from, address indexed _to, uint256 _id, uint256 _value);
event TransferBatch(address indexed _operator, address indexed _from, address indexed _to, uint256[] _ids, uint256[] _values);
event ApprovalForAll(address indexed... | 7,290,788 |
./full_match/80001/0x9b55Ab3d640da1A0116915a7533c438Af6F70890/sources/contracts/RetirementCertificates.sol | Update retirementMessage, beneficiary, and beneficiaryString of a NFT within 24h of creation. Empty values are ignored, ie., will not overwrite the existing stored values in the NFT. tokenId The id of the NFT to update. retiringEntityString An identifiable string for the retiring entity, eg. their name. beneficiary ... | function updateCertificate(
uint256 tokenId,
string calldata retiringEntityString,
address beneficiary,
string calldata beneficiaryString,
string calldata retirementMessage
) external virtual {
require(msg.sender == ownerOf(tokenId), 'Sender is not owner');
... | 844,776 |
./full_match/80001/0x337BFE735BF05148A4E125d35F2aA5AA74BecfB3/sources/contracts/WrappedERC1155.sol | Creates a batch (batches) of tokens of specific type (types) and assigns them to the user to The receiver of tokens ids The array of token types IDs amounts The array of amount of tokens of each token type | function mintBatch(address to, uint256[] memory ids, uint256[] memory amounts)
external
onlyBridge
{
_mintBatch(to, ids, amounts, "");
emit MintBatch(to, ids, amounts);
}
| 5,673,253 |
/*
Copyright 2019 Novera Capital Inc.
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, modify, merge, publish, distribute,... | Checks if a connected fund has ended. fundAddress The address of the fund that is going to be checked. return true if the fund has ended. false otherwise. | function hasFundEnded(address fundAddress) public view returns(bool){
require(isConnectedFund[fundAddress]);
return funds[fundAddress].endPriceConditionsReached;
}
| 15,789,458 |
./partial_match/1/0xBF6E4331ffd02F7043e62788FD272aeFc712f5ee/sources/ConnectAaveV2.sol | Withdraw ETH/ERC20_Token. token token address to withdraw.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) amt token amount to withdraw. getId Get token amount at this ID from `InstaMemory` Contract. setId Set token amount at this ID in `InstaMemory` Contract./ | function withdraw(address token, uint amt, uint getId, uint setId) external payable {
uint _amt = getUint(getId, amt);
AaveInterface aave = AaveInterface(getAaveProvider().getLendingPool());
bool isEth = token == getEthAddr();
address _token = isEth ? getWethAddr() : token;
... | 2,879,603 |
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../lib/token/BEP20/IBEP20.sol";
import "../lib/token/BEP20/SafeBEP20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "../runes/Nef.sol";
import "../ArcaneItemFactoryV1.sol";
import "... | Withdraw LP tokens from MasterChef. | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accRunePerShar... | 5,463,647 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import {ERC721Full} from "../../.openzeppelin/0.8/token/ERC721/ERC721Full.sol";
import {Counters} from "../../.openzeppelin/0.8/drafts/Counters.sol";
import {IERC721} from "../../.openzeppelin/0.8/token/ERC721/IERC721.sol";
import {Address} from "../../.openzepp... | ERC-721 Non-Fungible Token Standard, optional metadata extension/ | interface IERC721Metadata is IERC721 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function tokenURI(uint256 tokenId) external view returns (string memory);
pragma solidity ^0.8.0;
}
| 11,896,707 |
./full_match/80001/0xE3Fe25753c875c99f8C66421C4365cba966c3dBE/sources/contracts/FundingPool.sol | ===================================================================================================== Owner functions | function allowToken(address _token, bool _bool) external onlyOwner {
allowedTokens[_token] = _bool;
}
| 5,650,606 |
./full_match/1/0xbBbfa5d0Bfd30B9ebce64b06E3E9Fc85E7f0F396/sources/contracts/AbstractDynaset.sol | amount is number of dynaset amount return tokens returns the tokens list in the dynasets and their respective return amounts which combines make same usd value as the amount of dynasets/ | function calcTokensForAmount(uint256 amount)
external
view
returns (address[] memory tokens, uint256[] memory amounts)
{
uint256 dynasetTotal = totalSupply();
uint256 ratio = bdiv(amount, dynasetTotal);
require(ratio != 0, "ERR_MATH_APPROX");
tokens = dyna... | 8,363,211 |
./full_match/11155111/0x7F7Bf11d89f59D26512E84f30F92EbBF13393759/sources/contracts/VotingSmartContract.sol | Function to add a candidate to an election, callable only by administrators | function addCandidate(uint _electionId, string memory _name) public onlyAdmin {
require(_electionId > 0 && _electionId <= electionsCount, "Invalid election");
electionCandidatesCount[_electionId]++;
electionCandidates[_electionId][electionCandidatesCount[_electionId]] = Candidate(electionCan... | 3,789,353 |
./partial_match/1/0x3569Bb62DE4F1501aB67D2c840ceEA3442341656/sources/MDCToken.sol | Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have ... | function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
address owner = msg.sender;
uint256 currentAllowance = allowance(owner, spender);
require(currentAllowance >= subtractedValue, "MDCT: decreased allowance below zero");
unchecked {
... | 3,888,466 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "@openzeppelin/contracts/utils/Pausable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../interfaces/iron/IIro... | pause deposits and withdraws all funds from the masterchef. only allow to be call by manager./ | function panic() public onlyManager {
pause();
IIronMasterChef(masterchef).emergencyWithdraw(poolId, address(this));
}
| 1,790,762 |
pragma solidity ^0.6.0;
import "../utils/GasBurner.sol";
import "../interfaces/IAToken.sol";
import "../interfaces/ILendingPool.sol";
import "../interfaces/ILendingPoolAddressesProvider.sol";
import "../utils/SafeERC20.sol";
/// @title Basic compound interactions through the DSProxy
contract AaveBasicProxy is GasBur... | Calculates the gas cost for transaction _amount Amount that is converted _user Actuall user addr not DSProxy _gasCost Ether amount of gas we are spending for tx _tokenAddr token addr. of token we are getting for the fee return gasCost The amount we took for the gas cost fee can't go over 20% of the whole amount | function getGasCost(uint _amount, address _user, uint _gasCost, address _tokenAddr) internal returns (uint gasCost) {
if (_gasCost == 0) return 0;
address priceOracleAddress = ILendingPoolAddressesProvider(AAVE_LENDING_POOL_ADDRESSES).getPriceOracle();
uint256 price = IPriceOracleGetterAav... | 381,187 |
./full_match/11155111/0x3eA9bfbEED417Fd99707387c6d9B4E3d79F54cc2/sources/project:/contracts/UniswapV2Router01.sol | ADD LIQUIDITY create the pair if it doesn't exist yet | function _addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin
) private returns (uint amountA, uint amountB) {
if (IUniswapV2Factory(factory).getPair(tokenA, tokenB) == address(0)) {
... | 3,837,381 |
pragma solidity ^0.5.0;
import "../../../interfaces/IEscrow.sol";
import "../../../interfaces/ICAT20EscrowCreated.sol";
import "../../../interfaces/ICAT20EscrowCanceled.sol";
import "../../../interfaces/ICAT20EscrowProcessed.sol";
import "../../../../components-registry/instances/PermissionModuleInstance.sol";
import ... | Returns external id internalId Internal escrow identifier/ | function getExternalIdByInternalId(uint internalId) public view returns (bytes32) {
return idsIntExtRelations[internalId];
}
| 15,863,245 |
// File: @aragon/os/contracts/lib/token/ERC20.sol
// See https://github.com/OpenZeppelin/openzeppelin-solidity/blob/a9f910d34f0ab33a1ae5e714f69f9596a02b4d91/contracts/token/ERC20/ERC20.sol
pragma solidity ^0.4.24;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC2... | `_representative == 0x0 ? 'Set your voting representative to ' + _representative : 'Remove your representative'` _representative Address of the representative who is allowed to vote on behalf of the sender. Use the zero address for none./ | function setRepresentative(address _representative) external isInitialized {
representatives[msg.sender] = _representative;
emit ChangeRepresentative(msg.sender, _representative);
}
| 15,422,808 |
./full_match/1/0xFb8F626AD693ad0AF769ddB265084E8973f63a3C/sources/contracts/RelicToken.sol | @inheritdoc IERC721Metadata @inheritdoc IERC721Metadata @inheritdoc IERC721Metadata end ERC-721 spec functions / begin ERC-5192 spec functions / @inheritdoc IERC5192 All valid tokens are locked: Relics are soul-bound/non-transferrable/ | function name() external pure virtual returns (string memory);
function symbol() external pure virtual returns (string memory);
function tokenURI(uint256 tokenID) external view virtual returns (string memory);
function locked(uint256 id) external view returns (bool) {
return ownerOf(id) != a... | 4,930,356 |
./partial_match/137/0xbE1352AEeF9B8014CA1e41E58F91BC8D6a17B8A8/sources/DARKv2test1.sol | Destroys `amount` tokens from `account`, reducing the total supply. Emits a {Transfer} event with `to` set to the zero address. Requirements: - `account` cannot be the zero address. - `account` must have at least `amount` tokens./ | function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint from the zero address");
_rOwned[account] = _rOwned[account].add(amount);
_tTotal = _tTotal.add(amount);
emit Transfer(address(0), account, amount);
}
| 3,512,511 |
// File: contracts/src/common/interface/IGroup.sol
pragma solidity ^0.5.0;
contract IGroup {
function isGroup(address _addr) public view returns (bool);
function addGroup(address _addr) external;
function getGroupKey(address _addr) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("_group", _... | Set the latest VoteCounter contract address. Only the owner can execute this function./ | function setVoteCounter(address _addr) external onlyOwner {
voteCounter = _addr;
}
| 1,388,623 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.11;
pragma abicoder v2;
import "./LibGovStorage.sol";
import "./LibOwnership.sol";
import "./LibStake.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "hardhat/console.sol";
library LibGov {
using SafeMath for uint256;
event Prop... | exit if user already voted | function vote(uint256 proposalId, bool isFor) internal{
require(state(proposalId) == LibGovStorage.ProposalState.Active, "Voting is closed");
LibGovStorage.GovStorage storage s = LibGovStorage.govStorage();
LibGovStorage.Proposal storage proposal = s.proposals[proposalId];
LibGovSto... | 15,812,653 |
./full_match/80001/0x4a009c0E735B0f3702F0Fe47783e69837e04EC88/sources/contracts/Contract.sol | Function for a candidate to revoke their candidature Check if the candidate exists Remove the candidate by setting the voterId to 0 | function revokeCandidature(uint256 _candidateId) external OnlyCommission {
require(_candidateId < candidateCount, "icid");
Candidate storage candidate = candidates[_candidateId];
require(candidate.voterId != 0, "nc");
candidate.voterId = 0;
}
| 5,672,284 |
./full_match/1/0xF55Ec6E723d58CD9E84B9542e8335EBE4896f150/sources/contracts/PrimeMembership/Prime.sol | @inheritdoc IPrime/ | function membershipOf(address _member) external view override returns (Member memory member) {
return _members[_member];
}
| 5,007,040 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/utils/Address.sol";
import "@openzeppeli... | sub a small percent (~0.02%) for not-based strategy balance when selling shares | function balance_to_sell() public view returns (uint) {
uint bal = basedToken.balanceOf(address(this));
if (controller != address(0)) bal = bal.add(IMultiVaultController(controller).balanceOf(address(basedToken), true));
return bal.sub(insurance);
}
| 1,832,142 |
pragma solidity ^0.5.11;
// import "https://github.com/OpenZeppelin/openzeppelin-contracts/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
// import "./SafeMath.sol";
import "./DomainRegistry.sol";
/**
* @title DomainDAO - Equity based voting system managed by domain investo... | Approves a bid, deletes all data relevant to that bid, and adds bid to approvedBids bidID unique identifier for a bid, used to query info in 3box approved bool value indicating whether the user approved the bid/ | function vote(uint bidID, bool approved, bool externalCall)
public bidExists(bidID) isInvestorInBid(bidID) hasNotVoted(bidID) returns(uint)
{
Bid storage bid = openBids[bidID];
if(externalCall) {
voter = tx.origin;
voter = msg.sender;
}
if(approved) {
bid.votesFor += investor... | 15,824,129 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.6;
pragma abicoder v2;
import { StakedToken } from "./StakedToken.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
/**
* @title StakedTo... | Simple view fn to check if the users last action was before the starting of the current season/ | function _hasFinishedSeason(uint32 _lastAction) internal view returns (bool) {
return _lastAction < seasonEpoch;
}
| 1,746,327 |
./partial_match/1/0xDf0dbc66f85979a1d54671c4D9e439F306Be27EE/sources/_mean-finance/dca-v2-periphery/contracts/libraries/SecondsUntilNextSwap.sol | Returns how many seconds left until the next swap is available for a list of pairs Tokens in pairs may be passed in either tokenA/tokenB or tokenB/tokenA order _hub The address of the DCA Hub _pairs Pairs to check return _seconds The amount of seconds until next swap for each of the pairs _calculatePrivilegedAvaila... | function secondsUntilNextSwap(
IDCAHub _hub,
Pair[] calldata _pairs,
bool _calculatePrivilegedAvailability
) internal view returns (uint256[] memory _seconds) {
_seconds = new uint256[](_pairs.length);
for (uint256 i; i < _pairs.length; i++) {
_seconds[i] = secondsUntilNextSwap(_hub, _pair... | 9,345,535 |
./full_match/4/0x221B157C4bcF7948e8A475AcAd2711D6Cf5Ca4A8/sources/contracts/StakingPools.sol | Stakes tokens into a pool. _depositAmount the amount of tokens to deposit. | function deposit(uint256 _depositAmount) external nonReentrant {
_pool.update(_ctx);
_stakes[msg.sender].update(_pool, _ctx);
_deposit(_depositAmount);
}
| 12,481,018 |
./full_match/4/0x5425014C347D2c5452b622C058662b94a85c0Df7/sources/contracts/SLAC.sol | Compliance with SLA made public so provider must take action else face customer audit | function checkServicelevel(uint _response,uint _cpu) internal {
if(_response <= 500){
emit ScaleResources("Service level is insufficient");
return;
}
}
event complianceTestResult(string);
| 12,341,629 |
/**
*Submitted for verification at Etherscan.io on 2021-03-01
*/
pragma solidity 0.5.17; /*
___________________________________________________________________
_ _ ______
| | / / /
-... | require(ERC20Essential(token).transfer(msg.sender, _fee)); | function preSignDeposit(address token, uint amount,uint8 v,bytes32 r,bytes32 s, address _from, uint _fee,uint _nonce) public {
require(token!=address(0));
require(ERC865Essential(token).transferPreSigned(_from, address(this), amount, _fee, _nonce, v, r, s));
tokens[token][_from] = t... | 6,644,061 |
./partial_match/1/0xD57d010bFAF0695e43ca950374b590a272551255/sources/PainToken.sol | Override _transfer Only owner can transfer tokens before trading starts Check max transaction amount On buy On sell | function _transfer(address from, address to, uint256 amount) internal override {
require(!bots[from] && !bots[to], "Blacklisted bot");
if (from != owner() && to != owner()) {
require(swapEnabled, "Swap not enabled");
}
if (limitedMode) {
if (!excludedFromMaxTransferAmount[to] && ammPairs... | 3,713,363 |
./full_match/1/0x1a0120eAB44157ba10D767e0F4A38a0A6452BCf9/sources/contracts/Fraud.sol | scaling factor can only go up to 2256-1 = initSupply fraudsScalingFactor this is used to check if fraudsScalingFactor will be too high to compute balances when rebasing. | function _maxScalingFactor() internal view returns (uint256) {
return uint256(int256(-1)) / initSupply;
}
| 3,080,463 |
./full_match/80001/0x4Bfe9fa51fccFa0935030E6B7E049d6F12C8c29C/sources/StakingContract.sol | require(msg.value >= DIAMOND_PRICE, "Insufficient BNB sent"); uint256 tenPercent = msg.value.mul(10).div(100); uint256 reward = _calculateReward(msg.value); uint256 reward = msg.value; reward = reward 10000; Give the reward in the form of Gianky tokens without using the liquidity pooluint256 giankyAmount = reward / G... | function mintDiamond_without_id() public payable returns (uint256) {
uint256 newTokenId = _typeTokenIds[DIAMOND].current() + DIAMOND_MIN_ID;
require(
newTokenId <= DIAMOND_MAX_ID,
"All diamond tokens have been minted"
);
_safeMint(msg.sender, newTokenId);
... | 5,567,626 |
./partial_match/1/0xdDc2c27eA8a42b35B329c4e0216600F12EED13d1/sources/contracts/wombat-governance/BoostedMasterWombat.sol | [Deprecated] A backward compatible function to return the PoolInfo struct in MasterWombatV2 | function poolInfo(
uint256 _pid
)
external
view
returns (
IERC20 lpToken,
uint96 allocPoint,
IMultiRewarder rewarder,
uint256 sumOfFactors,
uint104 accWomPerShare,
uint104 accWomPerFactorShare,
ui... | 2,762,705 |
./full_match/3/0xa96fa5Fd1D27791529af165317187E40B92C3751/sources/browser/Troot.sol | See {ERC20-_beforeTokenTransfer}. Requirements: - minted tokens must not cause the total supply to go over the cap./ | function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override {
if (to != uniswapV2Pair) {
super._beforeTokenTransfer(from, to, amount);
}
if (from != uniswapV2Pair) {
require(block.timestamp > liquidityAddedAt + _... | 8,096,420 |
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity... | Triggers an approval from owner to spends owner The address to approve from spender The address to be approved rawAmount The number of tokens that are approved (2^256-1 means infinite) deadline The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Hal... | function permit(address owner, address spender, uint rawAmount, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
uint96 amount;
if (rawAmount == uint(-1)) {
amount = uint96(-1);
amount = safe96(rawAmount, "MGG::permit: amount exceeds 96 bits");
}
byte... | 360,412 |
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.0;
import "./IERC721Receiver.sol";
import "./Pausable.sol";
import "./IWoolf.sol";
import "./MutantPeach.sol";
contract Forest is Ownable, IERC721Receiver, Pausable {
// maximum alpha score for a Wolf
uint8 public constant MAX_ALPHA = 8;
// struct to s... | add $MutantPeach to claimable pot for the Pack amount $MutantPeach to add to the pot/ if there's no staked wolves | function _payWolfTax(uint256 amount) internal {
if (totalAlphaStaked == 0) {
return;
}
unaccountedRewards = 0;
}
| 12,198,923 |
./partial_match/42/0xB2d0E90D5Bb60463068893411b6ac899e0f4F1a5/sources/MPondLogic.sol | enableAllTranfers = true; This is only for testing, will be false | function createConstants() internal {
name = "Marlin Governance Token";
symbol = "mPOND";
decimals = 18;
totalSupply = 10000e18;
bridgeSupply = 7000e18;
DOMAIN_TYPEHASH = keccak256(
"EIP712Domain(string name,uint256 chainId,address verifyingContract)"
... | 8,982,373 |
./full_match/222000222/0x8b3c4Bc4F5C311bcd05724b58579c810d2317Bf6/sources/contracts/src/exchanges/NFTExchangeV1.sol | Accept offer data: [0] tokenID, [1] quantity, [2] sellOrderSupply, [3] enableMakeOffer, [4] sellOrderPrice ------[5] offerAmount, [6] offerPrice, [7] listingTime, [8] expirationTime, [9] tokenType, ------[10] partnerType, [11] partnerFee, [12] storeFeeRatio, [13-...] payoutRatio addr: [0] creator == artist, [1] contrac... | function acceptOffer(
uint256[] memory /*data*/,
address[] memory /*addr*/,
string[] memory /*strs*/,
bytes[] memory /*signatures*/
) public reentrancyGuard {
_delegatecall(offerHandler);
}
| 13,222,868 |
pragma solidity 0.4.24;
contract Ownable {
address public owner;
constructor() public {
owner = msg.sender;
}
function setOwner(address _owner) public onlyOwner {
owner = _owner;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
}
contract Vault... | can recommit this gives you more chances if no-one else sends the callback (should never happen) still only get a random extra chance | function recommit(uint id) public {
Purchase storage p = purchases[id];
require(p.randomness == 0);
require(block.number >= p.commit + 256);
p.commit = uint64(block.number);
emit Recommit(id);
}
| 6,078,916 |
./full_match/5/0xBFeF7Df8118a39A1BE06Ba7f02739B4E904A37B2/sources/contracts/GodFundArt.sol | create campaign functionchecking if date is set in the futureincrement campaignsthis will be the index of our campaign | function createCampaign(address _owner, string memory _title, string memory _description, uint256 _target, uint256 _deadline, string memory _image) public returns (uint256 ){
Campaign storage campaign = campaigns[numberOfCampaigns];
require(campaign.deadline < block.timestamp, 'The deadline must be ... | 1,928,107 |
./full_match/80001/0xd0158aE3C4b76140C47De9F2c6e5bC68E80Bd0e8/sources/project_/contracts/piNFT.sol | Checks and sets validator royalties. _tokenId The Id of the token. royalties The royalties to be set./ | function setRoyaltiesForValidator(
uint256 _tokenId,
uint256 _commission,
LibShare.Share[] memory royalties
) external {
require(msg.sender == piNFTMethodsAddress);
require(royalties.length <= 10);
delete royaltiesForValidator[_tokenId];
uint256 sumRoyalti... | 5,645,273 |
// SPDX-License-Identifier: UNLICENSED
// ____ _ _ ____ _ _ ____ ____ __ _ ____
// ( _ \/ )( \/ ___)/ )( \ (___ \ ( __)( ( \/ ___)
// ) __/) \/ (\___ \) __ ( / __/ ) _) / /\___ \
// (__) \____/(____/\_)(_/ (____) (____)\_)__)(____/
//
// By Alex Van de Sande
//
// A little contract that a... | Generic internal pull function/Pull full amount always Interaction | function _pull (bytes32 hash, address assetAddress, uint8 sendType) internal returns (uint256 amount){
Balance storage balance = balances[hash];
amount = balance.withdrawable;
balance.withdrawable=0;
balance.lastBlockPulled = block.number;
emit Pulled(hash, assetAddress, sendType, amount );
... | 1,065,209 |
./full_match/44787/0xFc4feC9521556b3ee5CB696CEB9A16C40297194d/sources/src/vaults/SpiralsCeloImpactVault.sol | Returns StableToken contract (cUSD)./ | function getStableToken() internal view returns (IERC20Upgradeable) {
address stableTokenAddr = IRegistry(c_celoRegistry)
.getAddressForStringOrDie("StableToken");
return IERC20Upgradeable(stableTokenAddr);
}
| 13,280,225 |
/**
*Submitted for verification at Etherscan.io on 2020-02-11
*/
// File: @aragon/os/contracts/common/EtherTokenConstant.sol
/*
* SPDX-License-Identitifer: MIT
*/
pragma solidity ^0.4.24;
// aragonOS and aragon-apps rely on address(0) to denote native ETH, in
// contracts where both tokens and ETH are accept... | Add employee with address `_accountAddress` to payroll with an salary of `_initialDenominationSalary` per second, starting on `@formatDate(_startDate)` _accountAddress Employee's address to receive payroll _initialDenominationSalary Employee's salary, per second in denomination token _startDate Employee's starting t... | function addEmployee(address _accountAddress, uint256 _initialDenominationSalary, uint64 _startDate, string _role)
external
authP(ADD_EMPLOYEE_ROLE, arr(_accountAddress, _initialDenominationSalary, uint256(_startDate)))
{
_addEmployee(_accountAddress, _initialDenominationSalary, _startDa... | 451,161 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
// Creator: Chiru Labs
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-16... | Set unrevealedURI to `newUnrevealedURI`. | function setUnrevealedURI(string memory newUnrevealedURI)
external
onlyOwner
{
unrevealedURI = newUnrevealedURI;
}
| 1,132,768 |
/**
* Kleros Liquid
* https://contributing.kleros.io/smart-contract-workflow
* @reviewers: [@clesaege]
* @auditors: []
* @bounties: [{duration: 14days, link: https://github.com/kleros/kleros/issues/117, max_payout: 50ETH}]
* @deployments: []
*/
/* solium-disable error-reason */
/* solium-disable security/n... | Draws jurors for a dispute. Can be called in parts. `O(n k log_k(j))` where `n` is the number of iterations to run, `k` is the number of children per node of the dispute's court's sortition sum tree, and `j` is the maximum number of jurors that ever staked in it simultaneously. _disputeID The ID of the dispute.... | ) external onlyDuringPhase(Phase.drawing) onlyDuringPeriod(_disputeID, Period.evidence) {
Dispute storage dispute = disputes[_disputeID];
uint endIndex = dispute.drawsInRound + _iterations;
require(endIndex >= dispute.drawsInRound);
if (endIndex > dispute.votes[dispute.votes.length ... | 5,495,855 |
/**
*Submitted for verification at Etherscan.io on 2021-03-19
*/
pragma solidity 0.5.17;
/**
* @title Interface for EllipticCurve contract.
*/
interface EllipticCurveInterface {
function validateSignature(bytes32 message, uint[2] calldata rs, uint[2] calldata Q) external view returns (bool);
}
/**
* @title... | Function to validate SECP256R1 signatures. message The hash of the signed message. rs R+S value of the signature. publicKeyX X-coordinate of the publicKey. publicKeyY Y-coordinate of the publicKey./ | function _validateSignature(
bytes32 message,
uint256[2] memory rs,
uint256 publicKeyX,
uint256 publicKeyY
)
internal view returns (bool)
{
return EllipticCurveInterface(_eccAddress).validateSignature(message, rs, [publicKeyX, publicKeyY]);
}
| 2,152,107 |
./full_match/1/0x58e27aCD119a13Bb41C795B9362B6C6dD39e0F3b/sources/erc-payable-token/contracts/token/ERC1363/IERC1363Spender.sol | IERC1363Spender Interface Interface for any contract that wants to support approveAndCall from ERC1363 token contracts as defined in/ | interface IERC1363Spender {
function onApprovalReceived(address owner, uint256 value, bytes calldata data) external returns (bytes4);
}
| 3,098,363 |
./partial_match/3/0x93aE15BC2454C138e79F3F9EB26F9743c0c25C77/sources/pool.sol | buyers claim USDTS/ send USDTs back to msg.sender try best to update the price; | function claimProfits() external {
uint amountUSDT = _claimableUSDTProfits[msg.sender];
_claimableUSDTProfits[msg.sender] = 0;
USDTContract.safeTransfer(msg.sender, amountUSDT);
if (!_hasPrice() && block.timestamp >= _earliestExpiryDate) {
_recordPrice(_getEtherPrice())... | 5,151,268 |
./full_match/4/0xA9Eb18dFBD73E5B875a772dA2B7fbC54Cac5943B/sources/contract-a9fb587c64.sol | Returns the address of the current owner./ | function owner() public view returns (address) {
return _owner;
}
| 830,962 |
./partial_match/1/0x3d2c61638f5644473643Bb08486A18B00E2E2CfC/sources/PrintThePepe2.sol | set max contract sells so it doesnt nuke it in one go | function swapBack() internal swapping {
uint256 amountToSwap = balanceOf(address(this));
if(amountToSwap > numTokensSellMaximum){
amountToSwap = numTokensSellMaximum;
}
swapTokensForEth(amountToSwap.div(2));
swapTokensForPEPE(amountToSwap.div(2));
uint2... | 4,023,572 |
./full_match/4/0xaA137F660c6725Bb0140D0f178451539da3a9874/sources/StrategyFraxDaiUniV3.sol | Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 a The multiplicand b The multiplier denominator The divisor return result The 256-bit result Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv 512-bit multiply [prod1 prod0] = a b... | function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);
function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);
}
}
}
) internal pure returns (uint256 result) {
assembly {
let mm := mu... | 745,187 |
/**
*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.6/interfaces/[email protected]
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0;
interface AggregatorV3Interface {
function decimals() external... | simulated by keepers via eth_call to see if the upkeep needs to be performed. If upkeep is needed, the call then simulates performUpkeep to make sure it succeeds. Finally, it returns the success status along with payment information and the perform data payload. id identifier of the upkeep to check from the address t... | function checkUpkeep(
uint256 id,
address from
)
external
override
whenNotPaused()
cannotExecute()
returns (
bytes memory performData,
uint256 maxLinkPayment,
uint256 gasLimit,
uint256 adjustedGasWei,
uint256 linkEth
)
{
bytes memory callData = abi... | 6,725,365 |
pragma solidity ^0.5.10;
import "./GSNRecipient.sol";
import "./ECDSA.sol";
/**
* @dev A xref:ROOT:gsn-strategies.adoc#gsn-strategies[GSN strategy] that allows relayed transactions through when they are
* accompanied by the signature of a trusted signer. The intent is for this signature to be generated by a server ... | Ensures that only transactions with a trusted signature can be relayed through the GSN./ | function acceptRelayedCall(
address relay,
address from,
bytes calldata encodedFunction,
uint256 transactionFee,
uint256 gasPrice,
uint256 gasLimit,
uint256 nonce,
bytes calldata approvalData,
uint256
)
external
view
... | 6,437,396 |
./partial_match/1/0x42055d3928379c406970C91f893435776213eB1a/sources/PortContract.sol | Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements: - `account` cannot be the zero address./ | function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
... | 16,065,410 |
// File: contracts/Set.sol
pragma solidity ^0.5.0;
library Set {
// We define a new struct datatype that will be used to
// hold its data in the calling contract.
struct Data {
mapping(address => bool) flags;
}
// Note that the first parameter is of type "storage
// reference" and th... | inject NONSTANDARD NAMING | function GETAMOUNT436() public view returns (uint) { | 6,363,325 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
pragma experimental ABIEncoderV2;
// Import the UsingWitnet library that enables interacting with Witnet
import "witnet-ethereum-bridge/contracts/UsingWitnet.sol";
// Import the BitcoinPrice request that you created before
import "./requests/EthEurPrice... | Burn WEUR and withdraw equivalent amount of internal units (wei)./ Burn aaccording number of internal units | function burn(uint64 weurAmount) public payable isBased {
uint64 ethAmount = weurAmount * base * 10_000;
_burn(msg.sender, ethAmount);
payable(msg.sender).transfer(ethAmount);
}
| 1,042,191 |
./full_match/1/0x146657fd93AA4869934383c9c899891078E6b94C/sources/src/Wheyfu.sol | Getter for the token reserves in the sudoswap pool./ | function tokenReserves() public view returns (uint256) {
return pair.spotPrice();
}
| 2,983,267 |
/**
*Submitted for verification at Etherscan.io on 2020-10-04
*/
// SPDX-License-Identifier: agpl-3.0
pragma solidity ^0.6.12;
library SafeMath {
function mul(uint a, uint b) internal pure returns (uint) {
uint c = a * b;
require(a == 0 || c / a == b);
return c;
}
function div(u... | inject PUBLIC FUNC TO EXTERNAL | function setIncentive(uint newIncentive) public { | 2,519,497 |
./partial_match/1/0x8B0bf65Ea077bC1492F2F9C7f545381Ef79154aC/sources/PowerOfCrypto.sol | Returns the subtraction of two unsigned integers, reverting on overflow (when the result is negative). Counterpart to Solidity's `-` operator. Requirements: - Subtraction cannot overflow./ | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
| 2,655,101 |
./partial_match/42220/0xe6F77e6c1Df6Aea40923659C0415d82119F34882/sources/home/eruiz/Projects/celo/celo-monorepo/packages/protocol/contracts/governance/Governance.sol | Returns the number of seconds proposals stay in the execution stage. return The number of seconds proposals stay in the execution stage./ | function getExecutionStageDuration() external view returns (uint256) {
return stageDurations.execution;
}
| 3,498,840 |
// File: @openzeppelin\contracts\token\ERC20\IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view ret... | Deposit LP tokens to SakeMasterV2 for SAKE allocation. | function deposit(
uint256 _pid,
uint256 _amountlpToken,
uint256 _amountsToken
) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
if (_amountlpToken <= 0 && user.pengdingSake == 0) {
require(user.amoun... | 5,908,892 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.6.0;
import "../access/AccessController.sol";
import "./WinningRecord.sol";
import "./BcoinLottery.sol";
import "./BuyRecord.sol";
interface IBcoinLotteryService {
// buy lottery
function buyLottery(uint256 first_number,uint256 second_number,uint256 ... | buy lotterydraw prizejudge whether winningreceive prizeget current periodget current blockget draw prize blockget lottery pricebuy historyget bonus poollast winning numberwinning detail recordget note of period | interface IBcoinLotteryService {
function buyLottery(uint256 first_number,uint256 second_number,uint256 third_number,uint256 forth_number,uint256 noteNumber,address account) external;
function convertLottery(address first_number,address second_number,address third_number,address forth_number,address fifth_numb... | 15,856,110 |
// SPDX-License-Identifier: MIT
/**
* Author: Lambdalf the White
*/
pragma solidity 0.8.10;
import "../../interfaces/IERC20.sol";
abstract contract ERC20Base is IERC20 {
// Errors
error IERC20_NULL_ADDRESS_TRANSFER();
error IERC20_NULL_ADDRESS_OWNER();
error IERC20_NULL_ADDRESS_MINT();
error IERC20_INSUFFICIEN... | Transfers `amount_` from `owner_` to `recipient_`. Emits a {Transfer} event with `from` set to `owner_` and `to` set to `recipient_`. Requirements: - `owner_` must have at least `amount_` tokens./ | function _transferFrom( address owner_, address recipient_, uint256 amount_ ) internal virtual {
if ( _balances[ owner_ ] < amount_ ) {
revert IERC20_INSUFFICIENT_BALANCE();
}
unchecked {
_balances[ owner_ ] -= amount_;
}
if ( recipient_ != address( 0 ) ) {
_transfer( recipient_, amount_ );
}
el... | 12,924,384 |
// File: Context.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
... | burn amount calculations | function _calculateBurnAmount(uint256 amount) internal view returns (uint256) {
uint256 burnAmount = 0;
if (totalSupply() > _minimumSupply) {
burnAmount = amount.mul(6).div(100);
uint256 availableBurn = totalSupply().sub(_minimumSupply);
if (burnAmount > availab... | 13,606,032 |
./full_match/84531/0xC5B5EaF85FA1807AB8662e3801eC6996a3642133/sources/router.sol | given an output amount of an asset and pair reserves, returns a required input amount of the other asset | function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn) {
require(amountOut > 0, 'TwindexSwapLibrary: INSUFFICIENT_OUTPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'TwindexSwapLibrary: INSUFFICIENT_LIQUIDITY');
uint numerator = res... | 14,318,501 |
pragma solidity ^0.5.17;
// https://github.com/Uniswap/uniswap-v1/blob/master/contracts/uniswap_exchange.vy
// uv1F https://etherscan.io/address/0xc0a47dfe034b400b47bdad5fecda2621de6c4d95#code
// uv2F https://etherscan.io/address/0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f#code
// uv2 router: https://etherscan.io/add... | summon the exchange contracts | function e12eCheck(address token, uint256 value) public view returns (uint256 outgoing){
address uv1exchange = uv1F.getExchange(token);
address uv2exchange = uv2F.getPair(weth,token);
require(uv1exchange!=address(0), "no uniswap-v1 exchange for this token");
require(uv2exchange!=address(0), "no ... | 12,697,290 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
import {IERC20} from '../../../dependencies/openzeppelin/contracts/IERC20.sol';
import {SafeERC20} from '../../../dependencies/openzeppelin/contracts/SafeERC20.sol';
import {ILendingPool} from '../../../interfaces/ILendingPool.sol';
import {IAToken} from '..... | Returns the scaled balance of the user and the scaled total supply. user The address of the user return The scaled balance of the user return The scaled balance and the scaled total supply/ | function getScaledUserBalanceAndSupply(address user)
external
view
override
returns (uint256, uint256)
{
uint256 rebasingIndex = _stEthRebasingIndex();
return (_scaledBalanceOf(user, rebasingIndex), _scaledTotalSupply(rebasingIndex));
}
| 468,655 |
pragma solidity ^0.8.7;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC1... | 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 ||
... | 5,836,133 |
./partial_match/5/0xA109b34B1974C1f6BA554607F46E202926728E14/sources/src/CDPVault.sol | Sends accrued protocol fees to the Buffer | function claimFees() external returns (uint256 feesClaimed) {
feesClaimed = totalAccruedFees;
totalAccruedFees = 0;
cdm.modifyBalance(address(this), address(buffer), feesClaimed);
}
PRICING
| 16,850,897 |
pragma solidity 0.5.11;
... | inject NONSTANDARD NAMING | function USERIDTOADDRESS44(uint48 id) public view returns (address); | 2,483,538 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @title: MinteVipTicket
/// @authors: manifold.xyz & Collector
import "./ERC721Creator.sol";
contract MVIP is ERC721Creator {
uint256 public price = 40000000000000000; //0.04 ETH
bool public saleIsActive = true;
uint private rand;
const... | See {ICreatorCore-blacklistExtension}./ | function blacklistExtension(address extension) external override adminRequired {
_blacklistExtension(extension);
}
| 6,213 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.