file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// Sources flattened with hardhat v2.5.0 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/IERC20.sol@v4.2.0
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of token... | Encode the uint value as a floating-point representation in the form of fraction 16 ^ exponent value Destination uint value return float format | function _encodeFloat(uint value) private pure returns (uint56) {
uint exponent = 0;
while (value > 0x3FFFFFFFFFFFF) {
value >>= 4;
++exponent;
}
return uint56((value << 6) | exponent);
}
| 482,512 |
./partial_match/1/0x0e20655885C38b1b5CEDfFF5b15289b76F3CdefC/sources/FounderSociety.sol | Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length and makes the '0x' prefix optional. MODIFIED: Scrypted Inc./ | function toHexString(uint256 value, uint256 length, bool prefix) internal pure returns (string memory) {
uint8 offset = prefix ? 2 : 0;
uint256 buffer_len = 2 * length + offset;
bytes memory buffer = new bytes(buffer_len);
for (uint256 i = offset; i <= buffer_len - 1; i++) {
... | 15,739,734 |
//Address: 0xf7eD56c1AC4d038e367a987258b86FC883b960a1
//Contract name: EDCoreVersion1
//Balance: 1.258461497246029186 Ether
//Verification Date: 3/10/2018
//Transacion Count: 10653
// CODE STARTS HERE
pragma solidity ^0.4.19;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basi... | Updates the fee for calling recruitHero(). | function setRecruitHeroFee(uint _newRecruitHeroFee) onlyOwner external {
recruitHeroFee = _newRecruitHeroFee;
}
| 965,664 |
./full_match/1/0x47e58594Ab4044849dAC01b2861708C31b9e02A9/sources/farmMintLP.sol | overrides transfer function to meet tokenomics swap and liquify | function _transfer(address sender, address recipient, uint256 amount) internal virtual override antiWhale(sender, recipient, amount) {
if (
swapAndLiquifyEnabled == true
&& _inSwapAndLiquify == false
&& address(garudaSwapRouter) != address(0)
&& garudaSwapPair... | 3,110,191 |
./full_match/137/0xCF77e2E32EDDc54d29cF8BF106024b1012bFbcCC/sources/home/hellwolf/Projects/superfluid/protocol-monorepo/packages/ethereum-contracts/contracts/superfluid/Superfluid.sol | the non static callback should not return empty ctx | function callAppAfterCallback(
ISuperApp app,
bytes calldata callData,
bool isTermination,
bytes calldata ctx
)
external override
onlyAgreement
returns(bytes memory newCtx)
{
(bool success, bytes memory returnedData) = _callCallback(app, false,... | 4,754,815 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
library ProtobufLib {
/// @notice Protobuf wire types.
enum WireType {
Varint,
Bits64,
LengthDelimited,
StartGroup,
EndGroup,
Bits32,
WIRE_TYPE_MAX
}
/// @dev Maximum number of bytes ... | Decode varint int64. n Number return Marshaled bytes | function encode_int64(int64 n) internal pure returns (bytes memory) {
return encode_varint(uint64(n));
}
| 1,795,610 |
./full_match/5/0xb93278af83Ab7FC2A9d08EF096f49EE8616C95A2/sources/contracts/Miratashi.sol | Allows the owner to set active status of dutch auction phase./ | function setAuctionActive(bool _isActive) external onlyOwner {
isAuctionActive = _isActive;
}
| 11,588,463 |
pragma solidity ^0.5.0;
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
function totalSupply() exter... | to remove liquidity from pool. ETH and token quantity is decided as per the exchange token qty to burn token ERC20 address of Uniswap's pool (eg:- DAI address, MKR address, etc) amount Uniswap pool's ERC20 token QTY to burn minEth Min ETH user to be returned minTokens Min Tokens to be returned/ | function removeLiquidity(
address token,
uint amount,
uint minEth,
uint minTokens
) public returns (uint ethReturned, uint tokenReturned)
{
address poolAddr = getAddressPool(token);
setApproval(poolAddr, amount, poolAddr);
(ethReturned, tokenReturned)... | 2,530,350 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
... | Draw down amount currently available (based on the block timestamp) beneficiary beneficiary of the vested tokens return amount tokens due from vesting schedule/ | function availableDrawDownAmount(address beneficiary) external view returns (uint256) {
return _availableDrawDownAmount(beneficiary);
}
| 2,517,941 |
./full_match/137/0x43369C08Aa7efbf00F8b181A0a851e31D91315B0/sources/MaticSwapRouter.sol | performs chained getAmountOut calculations on any number of pairs | function getAmountsOut(address factory, uint amountIn, address[] memory path) internal view returns (uint[] memory amounts) {
require(path.length >= 2, 'MatisSwapLibrary: INVALID_PATH');
amounts = new uint[](path.length);
amounts[0] = amountIn;
for (uint i; i < path.length - 1; i++) ... | 4,755,945 |
pragma solidity ^0.4.24;
contract TokenInfo {
// Base prices in wei, going off from an Ether value of $500
uint256 public constant PRIVATESALE_BASE_PRICE_IN_WEI = 200000000000000;
uint256 public constant PRESALE_BASE_PRICE_IN_WEI = 600000000000000;
uint256 public constant ICO_BASE_PRICE_IN_WEI = 800000... | Standard ERC20 transfer tokens function _to {address} _amount {uint} return success {bool}/ | function transfer(address _to, uint256 _amount) public returns (bool success) {
return doTransfer(msg.sender, _to, _amount);
}
| 611,066 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.2;
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { PoseidonT3, PoseidonT6, Hasher } from "../crypto/Hasher.sol";
import { MerkleZeros as MerkleBinary0 } from "./zeros/MerkleBinary0.sol";
import { MerkleZeros as MerkleBinaryMaci } from ... | Returns the subroot tree (SRT) root. Its value must first be computed using mergeSubRoots./ | function getSmallSRTroot() public view returns (uint256) {
require(subTreesMerged, "AccQueue: subtrees must be merged first");
return smallSRTroot;
}
| 1,050,960 |
./partial_match/80001/0x4a06E89BD8833a49Ad6Edf7245F39e8E08497499/sources/Forwarder.sol | Forward a call _target - target address to call _data - call data to be used return whether the call was a success or not return response in bytes if any/ | function forwardCall(address _target, bytes calldata _data) external payable returns (bool, bytes memory) {
require(
msg.sender == caller,
"Owner#forwardCall: UNAUTHORIZED_SENDER"
);
}
| 8,805,446 |
./full_match/1/0xf607014406bc3Fa7aAB224a85A0318b4556e9C28/sources/browser/CryptographIndexLogicV1.sol | Create a new cryptograph edition starting at 0 and return the new index position Only callable by Factory _minter The address of the user wallet that will have the responsability to mint all the editions _editionSize The maximum number of cryptograph that can be minted in the edition return (uint) The new index posi... | function createAGGBMA(address _minter, uint256 _editionSize) external restrictedToFactory() returns(uint){
require(_minter != address(0) && _editionSize != 0,
"Minter address and edition size must be greater than 0"
);
EditionIndexerProxiedV1 _proxied = new EditionIndexerProxied... | 3,151,771 |
/*
Copyright 2017 Dharma Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writi... | Helper function for querying this contract's allowance for transferring the given token./ Limit gas to prevent reentrancy. | function getAllowance(
address token,
address owner,
address granter
)
view
internal
returns (uint _allowance)
{
return ERC20(token).allowance.gas(EXTERNAL_QUERY_GAS_LIMIT)(
owner,
granter
);
}
| 6,438,116 |
./full_match/43113/0x49E101b346621e5CE74C14DB2d8Be36C751bc4BA/sources/TicketMaketPlace.sol | send the token from the smart contract back to the one who listed it | function cancelProduct(uint256 _ticketId) public isCheck(_ticketId, 1) isCheck(_ticketId, 2) {
_transfer(address(this), msg.sender, _ticketId);
emit cancelSell(_ticketId, ListProduct[_ticketId].price, msg.sender);
delete claimableByAccount[_ticketId];
clenup(_ticketId);
}
| 13,181,684 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721Holder.sol";
import "@openzeppelin/cont... | Buy nft from the contract. | function buy() external payable nonReentrant {
require(msg.value == price, "!not enough or more over");
uint256 tokenId = nft.totalSupply();
nft.mint(msg.sender, tokenId);
emit Swap(msg.sender, tokenId);
}
| 12,803,957 |
pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) i... | Allows the current owner to transfer control of the contract to a newOwner. newOwner The address to transfer ownership to./ | function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
owner = newOwner;
}
| 548,062 |
./partial_match/1/0x322Bb91ADD29446465571bd87Ee167F94996d674/sources/PushinP.sol | FOR GOERLI uniswapV2Pair = IUniswapV2Factory(0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f).createPair(address(this), 0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6); FOR BSCSCAN uniswapV2Pair = IUniswapV2Factory(0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73).createPair(address(this), 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);... | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
function _afterTokenTransfer(
address from,
address to,
uint256 amount
}
}
pragma solidity ^0.8.0;
constructor() ERC20("PushinP", "$P") {
_mint(msg.sender, (maxSupply * LIQUID_... | 15,609,570 |
./partial_match/1/0x860aCd0f9E6436E15407977602bf11fD39db29f1/sources/Dubai1764.sol | Function to change URI for each tier | function changeDiamondUri(string memory newUri) public onlyOwner {
diamondTier = newUri;
}
| 16,136,231 |
pragma solidity ^0.5.17;
interface IERC20 {
function TOTALSUPPLY3() external view returns (uint256); //inject NONSTANDARD NAMING
function BALANCEOF367(address account) external view returns (uint256); //inject NONSTANDARD NAMING
function TR... | inject NONSTANDARD NAMING | function _CHECKDEBTCEILING877(uint _amt) internal view returns (bool) { | 12,996,885 |
./partial_match/42/0xA106A93cb03748A678F21e44ddA50420136582ae/sources/MasterchefDelegator.sol | overflow is desired, casting never truncates cumulative price is in (uq112x112 price seconds) units so we simply wrap it after division by time elapsed | function updateTokenOracle(TokenPairInfo storage _pairInfo) internal returns (FixedPoint.uq112x112 memory _price) {
FixedPoint.uq112x112 memory cachedPrice = _pairInfo.price;
if(cachedPrice._x > 0 && _pairInfo.lastPriceUpdateHeight.sub(block.number) <= updateTokenPriceTerm){
return cache... | 3,313,460 |
/*
Copyright 2018 RigoBlock, Rigo Investment Sagl.
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... | Allows a whitelister to whitelist an token wrapper _wrapper Address of the target token wrapper _isWhitelisted Bool whitelisted | function whitelistWrapper(address _wrapper, bool _isWhitelisted)
external
onlyWhitelister
{
accounts[_wrapper].account = _wrapper;
accounts[_wrapper].authorized = _isWhitelisted;
accounts[_wrapper].groups[_isWhitelisted].wrapper = _isWhitelisted;
types.list.push(L... | 980,955 |
/*
Copyright 2017 Dharma Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writi... | Adds an address to the list of agents authorized to make 'modifyBeneficiary' mutations to the registry./ | function addAuthorizedEditAgent(address agent)
public
onlyOwner
{
entryEditPermissions.authorize(agent, EDIT_CONTEXT);
}
| 1,013,232 |
// SPDX-License-Identifier: Apache-2.0
/*
Modifications Copyright 2022 Element.Market
Copyright 2021 ZeroEx Intl.
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.or... | Core settlement logic for buying an ERC1155 asset. Used by `buyERC1155` and `batchBuyERC1155s`. | function _buyERC1155(
LibNFTOrder.ERC1155SellOrder memory sellOrder,
LibSignature.Signature memory signature,
uint128 buyAmount
) internal {
(uint256 erc20FillAmount, bytes32 orderHash) = _buyNFT(
sellOrder.asNFTSellOrder(),
signature,
buyAmoun... | 1,499,014 |
./full_match/11155111/0xF3B8ea87e9783CbA0609372161FD6067f579f191/sources/myTokenContract.sol | Setter function to change the contractWebPage. Only callable by the owner. | function setDigitalTwin(string memory newDigitalTwin) public onlyOwner {
_digitalTwin = newDigitalTwin;
}
| 3,814,534 |
pragma solidity ^0.4.24;
// File: contracts\utils\SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (... | users may choose to withdraw eth from cryptower game, allow dev team to withdraw eth from this contract to fund center. | function gameWithdraw(uint _amount) onlyCOO public {
uint _total = getTotalGamePot();
uint _remainingBalance = _total.sub(gameWithdrawed);
if(_amount > 0) {
require(_amount <= _remainingBalance);
_amount = _remainingBalance;
}
fundCenter.transfer(_amount);
gameWithdraw... | 6,511,476 |
./full_match/1/0x4637EAef1d9488955cBf08376bb3BE0F2371A58F/sources/BancorArbitrage/contracts/token/TokenLibrary.sol | compares between a token and another raw ERC20 token/ | function isEqual(Token token, IERC20 erc20Token) internal pure returns (bool) {
return toIERC20(token) == erc20Token;
}
| 16,488,632 |
./full_match/97/0x9FeDf352f6D8a198CE0a9C72635c19A83ba4F739/sources/project_/contracts/FundingPool.sol | Returns the installment amount to be paid at the called timestamp. Returned value is type uint256. _poolId The Id of the pool. _ERC20Address The address of the erc20 funds. _bidId The Id of the bid. _lender The lender address. return installment amount in uint256./ | function viewInstallmentAmount(
uint256 _poolId,
address _ERC20Address,
uint256 _bidId,
address _lender
) external view returns(uint256){
FundDetail storage fundDetail = lenderPoolFundDetails[_lender][_poolId][
_ERC20Address
][_bidId];
uint32 L... | 3,280,545 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;... | transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./ SafeMath.sub will throw if there is not enough balance. | function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
| 167,319 |
./partial_match/1/0xD59BcAbd00721B754aCB79FE668faE4B6A063fF8/sources/contracts/token/Token.sol | returns whether the provided token represents an ERC20 or the native token reserve/ | function isNative(Token token) pure returns (bool) {
return token == NATIVE_TOKEN;
}
| 2,647,119 |
./partial_match/8453/0x21fed85E54507164FD6c9Eb76870AFF41098106b/sources/contracts/mint/MintManager.sol | Verify, and update the state of a gated mint claim claim Claim signature Signed + encoded claim msgSender Expected claimer/ | function _verifyAndUpdateClaim(
Claim calldata claim,
bytes calldata signature,
address msgSender
) private {
address signer = _claimSigner(claim, signature);
if (msgSender != claim.claimer) {
_revert(SenderNotClaimer.selector);
}
claim.nu... | 16,779,428 |
/*
⚠⚠⚠ WARNING WARNING WARNING ⚠⚠⚠
This is a TARGET contract - DO NOT CONNECT TO IT DIRECTLY IN YOUR CONTRACTS or DAPPS!
This contract has an associated PROXY that MUST be used for all integrations - this TARGET will be REPLACED in an upcoming Synthetix release!
The proxy can be found by looking up the PROXY propert... | transfers to FEE_ADDRESS will be exchanged into sUSD and recorded as fee transfers to 0x address will be burned | function transfer(address to, uint value) public optionalProxy returns (bool) {
_ensureCanTransfer(messageSender, value);
if (to == FEE_ADDRESS) {
return _transferToFeeAddress(to, value);
}
if (to == address(0)) {
return _internalBurn(messageSender, value);
... | 84,657 |
./full_match/80001/0x56EBA30A7Aa8655215C20ffA1983910B9F5a8a77/sources/contracts/Tasks/Tasks.sol | @inheritdoc ITasks Task is open or deadline past Task is taken and deadline has not past | function cancelTask(
uint256 _taskId,
string calldata _explanation
) external returns (uint8 cancelTaskRequestId) {
Task storage task = _getTask(_taskId);
_ensureSenderIsManager(task);
_ensureTaskNotClosed(task);
if (task.state == TaskState.Open || task.deadline... | 5,582,000 |
// SPDX-License-Identifier: MIT
pragma solidity >0.5.0 <0.8.0;
/* Library Imports */
import { Lib_ErrorUtils } from "../utils/Lib_ErrorUtils.sol";
import { Lib_PredeployAddresses } from "../constants/Lib_PredeployAddresses.sol";
/**
* @title Lib_ExecutionManagerWrapper
* @dev This library acts as a utility for easi... | Performs a safe ovmINCREMENTNONCE call./ | function ovmINCREMENTNONCE()
internal
{
_callWrapperContract(
abi.encodeWithSignature(
"ovmINCREMENTNONCE()"
)
);
}
| 5,370,249 |
pragma solidity ^0.5.2;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../../uniswap/interfaces/IUniswapFactory.sol";
import "../../uniswap/interfaces/IUniswapExchange.sol";
import "./IExchangeAdapter.sol";
import "./UniswapPriceGetter.sol";
contract UniswapWithExcessOutput is IExchangeAdapter, UniswapPr... | execute swap on Uniswap exchange contract for token transfer token amount to msg.sender transfer excess token to excessRecipient | function ethToTokenSwap(IERC20 token, uint tokenAmount) external payable {
IUniswapExchange uniswapExchange = IUniswapExchange(_uniswapFactory.getExchange(address(token)));
uint tokensBought = uniswapExchange.ethToTokenSwapInput.value(msg.value)(tokenAmount, now);
token.transfer(msg.sender, tokenAmount)... | 6,462,733 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, s... | permits Goop to be spent within the illogics ecosystem/ | function spendGoop(uint256 _item, uint256 _count) public override {
addressPurchases[_msgSender()][_item] += _count;
require(spendState, "GOOP: spending not enabled");
require(saleItems[_item].saleStatus, "Item not currently for sale");
require(saleItems[_item].supply >= _count, "It... | 13,679,499 |
// 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... | Emergency withdraw the contract funds governance function called only by the migration manager used in emergencies only, where migrateBucket is not a suitable solution erc20 is the erc20 address of the token to withdraw | function emergencyWithdraw(address erc20) external override onlyMigrationManager {
IERC20 _token = IERC20(erc20);
emit EmergencyWithdrawal(msg.sender, address(_token));
require(_token.transfer(msg.sender, _token.balanceOf(address(this))), "FeesWallet::emergencyWithdraw - transfer failed");
... | 5,910,440 |
// solhint-disable reason-string
// solhint-disable contract-name-camelcase
pragma solidity 0.4.16;
/**
* token contract functions
*/
contract Token {
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function ... | Extend lock Duration/set new unlock time | function extendLockDuration(uint256 _id, uint256 _unlockTime) public {
require(_unlockTime < 10000000000);
require(_unlockTime > lockedToken[_id].unlockTime);
require(!lockedToken[_id].withdrawn);
require(msg.sender == lockedToken[_id].withdrawalAddress);
lockedToken[_id].unlockTime = _unlockTime... | 2,138,543 |
pragma solidity >=0.5.0 <0.6.0;
import '../libs/collections/AddressMap.sol';
import '../libs/lifecycle/LockableDestroyable.sol';
import '../libs/ownership/Ownable.sol';
import "../libs/strings/AddressToASCII.sol";
import "./IRegistry.sol";
/**
* @title Registry
*/
contract Registry is IRegistry, Ownable, Lockabl... | Returns the lineage addresses of all the addresses THROWS when any account doesn't exist Only contains existant ancestors, stopping at the first non-existent account addresses The addresses to retrieve the lineage for return The lineage of the given addresses/ Get the total lineage count for all addresses | function accountLineage(address[] memory addresses)
public
view
returns(address[] memory) {
uint256 count;
for (uint256 i = 0; i < addresses.length; i++) {
count += lineageCount(addresses[i]);
}
uint256 i = 0;
for (uint256 j = 0; j < addresses.length;... | 12,591,973 |
./full_match/4/0x3ABc8aCa8163B53754741F52612C47a457db5D00/sources/contracts/conduit/ConduitController.sol | Retrieve the total number of open channels for a given conduit. conduit The conduit for which to retrieve the total channel count. return totalChannels The total number of open channels for the conduit./ Ensure that the conduit in question exists. Retrieve the total open channel count for the conduit in question. | function getTotalChannels(address conduit)
external
view
override
returns (uint256 totalChannels)
{
_assertConduitExists(conduit);
totalChannels = _conduits[conduit].channels.length;
}
| 660,904 |
./partial_match/1/0xf64752B870178085BC1d343a6136656D33598950/sources/ERC721A.sol | See {IERC721Metadata-tokenURI}./ | function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
require(
_exists(tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
return
bytes(_baseURI).length > 0
? string(abi.encodePacked(_baseURI, tokenId.toString(... | 4,378,969 |
//SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.7.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./XToken.sol";
import "./XTokenWrapper.sol";
import "../interfaces/IOperationsRegistry.sol";
import "../interfaces/IEurPriceFeed.sol";
/**
* @title XTokenFactory
* @author Protofire
* @dev ... | Sets `_operationsRegistry` as the new Operations Registry module. Requirements: - the caller must be the owner. - `_operationsRegistry` should not be the zero address. _operationsRegistry The address of the new Operations Registry module./ | function setOperationsRegistry(address _operationsRegistry) external onlyOwner {
_setOperationsRegistry(_operationsRegistry);
}
| 9,989,694 |
./full_match/97/0x6Af8af4A32f98836142C324B860C04da93A83587/sources/project:/contracts/Predix.sol | Set minBetAmount Callable by admin/ | function setMinBetAmount(uint256 _minBetAmount) external whenPaused onlyAdmin {
require(_minBetAmount != 0, 'Must be superior to 0');
minBetAmount = _minBetAmount;
emit NewMinBetAmount(currentEpoch, minBetAmount);
}
| 5,023,586 |
pragma solidity ^0.4.20; // Solidity compiler version supported by Azure Blockchain Workbench
//---------------------------------------------
//Generated automatically for application 'RefrigeratedTransportation' by AppCodeGen utility
//---------------------------------------------
import "./RefrigeratedTransportat... | Transition preconditions Call overridden function IngestTelemetry in this contract Transition postconditions | function Transition_Created_Number_1_IngestTelemetry (int256 humidity, int256 temperature, int256 timestamp) public {
require(State == StateType.Created);
require(msg.sender == Device);
IngestTelemetry(humidity, temperature, timestamp);
assert(State == StateType.OutOfCompliance ||... | 5,533,605 |
/**
*Submitted for verification at Etherscan.io on 2021-02-24
*/
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount o... | Deposit LP tokens to MasterChef for SUSHI allocation. | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accSushiPerShare).div(1e12).sub(user.reward... | 6,592,966 |
// SPDX-License-Identifier: MIT LICENSE
/**
. ' , ' , . ' .
_________ _________ _________
_ /_|_____|_\ _ _ /_|_____|_\ _ _ /_|_____|_\ _
'. \ / .' '. \ / .' '. \ / .'
'.\ /.' '.\ /.' '.\ /.'
... | updates the mint price/ | function setMintPrice(uint256 _mintPrice) external onlyOwner {
MINT_PRICE = _mintPrice;
}
| 10,060,812 |
/**
* SPDX-License-Identifier: MIT
*
* Copyright (c) 2020 Coinbase, 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
... | Maximum number of open proposals per approver for a given type of contract call targetContract Address of the contract selector Selector of the function in the contract return Minimum number of approvals required for execution/ | function getMaxOpenProposals(address targetContract, bytes4 selector)
external
view
returns (uint256)
{
return _types[targetContract][selector].config.maxOpenProposals;
}
| 925,747 |
./partial_match/56/0x628449b26804B9AFb704eF3317C43841c2955996/sources/TokenGeyser.sol | 1. User data Fake redeem from most recent stake and go backwards in time to compute all pending rewards as if unstaking while (sharesLeftToBurn > 0) { fully redeem a past stake | function pendingUserReward(address user) public view returns (uint256) {
Stake[] storage accountStakes = _userStakes[user];
uint256 stakingSharesToBurn = totalStakingShares.mul(totalStakedFor(user)).div(totalStaked());
uint256 stakingShareSecondsToBurn = 0;
uint256 ... | 11,196,806 |
./full_match/137/0xDbF5E966E8A912b4FcAaCc28beCE5761c3E61dF9/sources/contracts/MultiChainERC721.sol | set the token to be on another chain - only a token owner can do this we also keep a record of where it's been put - and potentuall an alternative tokenid do the transfer | function moveOffChain(uint256 _tokenId, uint _chainId, string memory _altTokenId) virtual public {
require(_isApprovedOrOwner(_msgSender(), _tokenId), "ERC721: transfer caller is not owner nor approved");
address owner = ownerOf(_tokenId);
_tokenChains[_tokenId].chainId = _chainId;
... | 4,777,344 |
./partial_match/43113/0x26639692ec4bFB0767f505BbEbC871b84C3D4bbE/sources/contracts/SingleStakeFactory_flattened.sol | Override _beforeStake() hook to ensure staking is only possible when rewards are emitting/ | function _beforeStake(
address _account,
uint256 _amount
) internal virtual override whenEmitting returns (uint256) {
return super._beforeStake(_account, _amount);
}
| 16,909,107 |
./partial_match/42/0x4E951A6FB550c0eab2615619253900B2Dbc5F363/sources/STYK_I.sol | getRoundData and latestRoundData should both raise "No data present" if they do not have data to report, instead of returning unset values which could be misinterpreted as actual reported values. | interface AggregatorV3Interface {
function decimals() external view returns (uint8);
function description() external view returns (string memory);
function version() external view returns (uint256);
function getRoundData(uint80 _roundId)
external
view
returns (
uint256 roundId,
int256 ... | 3,304,621 |
pragma solidity ^0.4.21;
/**
* @title Maths
* A library to make working with numbers in Solidity hurt your brain less.
*/
library Maths {
/**
* @dev Adds two addends together, returns the sum
* @param addendA the first addend
* @param addendB the second addend
* @return sum the sum of the equation (e.... | Multiplies two factors, returns the product factorA the first factor factorB the second factor return product the product of the equation (e.g. factorA factorB)/ | function mul(
uint256 factorA,
uint256 factorB
) public pure returns (uint256 product) {
if (factorA == 0 || factorB == 0) return 0;
product = factorA * factorB;
assert(product / factorA == factorB);
}
| 482,029 |
// Upgraded Date: 01-28-2022
// Commits: https://github.com/Sperax/USDs/commit/177c1f24c9de18940ec0b5ddce996f87b2343b8d#diff-b094db7ce2f99cbcbde7ec178a6754bac666e2192f076807acbd70d49ddd0559
// https://github.com/Sperax/USDs/commit/7d5d63260f7b0088f4aac60c690bc4a1b9265f2f#diff-b094db7ce2f99cbcbde7ec178a6754bac6... | Convert between USDC and USDT using Chainlink oracle The calculation here assume two tokens have the same decimals index_from Index of the token to convert from index_to Index of the token to convert to amount_from amount of the token to convert from return amount_to amount of the token to convert to/ | function _convertBewteen(
uint256 index_from,
uint256 index_to,
uint256 amount_from
) internal view returns (uint256 amount_to) {
require(index_from != index_to, 'Conversion between the same asset');
address token_from = assetsMapped[index_from];
address token_to ... | 2,572,238 |
./full_match/80001/0x612C2Cb1EDf055BAeb6c841aC930A5992043f083/sources/project_/contracts/IERC4973.sol | Account-bound tokens See https://eips.ethereum.org/EIPS/eip-4973 Note: the ERC-165 identifier for this interface is 0x6352211e. | interface IERC4973 /* is ERC165, ERC721Metadata */ {
event Attest(address indexed _to, uint256 indexed _tokenId);
event Revoke(address indexed _to, uint256 indexed _tokenId);
function ownerOf(uint256 _tokenId) external view returns (address);
function burn(uint256 _tokenId) external;
pragma solidity ^0.8.6;
} | 9,515,620 |
pragma solidity 0.4.24;
contract AccessControl {
/// @dev Emited when contract is upgraded - See README.md for updgrade plan
event ContractUpgrade(address newContract);
// The addresses of the accounts (or contracts) that can execute actions within each roles.
address public ceoAddress;
a... | Result: [Draw] => Return money to host and guest players (No fee)Result: [Win] => Return money to winner (Winner will pay 1% fee) | function joinGameAndBattle(uint _id, uint _gestureGuest)
external
payable
verifiedGesture(_gestureGuest)
verifiedValueBet(msg.value)
verifiedGameAvailable(_id)
{
uint result = GAME_RESULT_DRAW;
uint gestureHostCached = 0;
GameInfo memory gameInfo... | 12,638,728 |
pragma solidity ^0.4.24;
/**
* @title -FoMo-3D v0.7.1
* ┌┬┐┌─┐┌─┐┌┬┐ ╦╦ ╦╔═╗╔╦╗ ┌─┐┬─┐┌─┐┌─┐┌─┐┌┐┌┌┬┐┌─┐
* │ ├┤ ├─┤│││ ║║ ║╚═╗ ║ ├─┘├┬┘├┤ └─┐├┤ │││ │ └─┐
* ┴ └─┘┴ ┴┴ ┴ ╚╝╚═╝╚═╝ ╩ ┴ ┴└─└─┘└─┘└─┘┘└┘ ┴ └─┘
* _____ _____
* ... | converts all incoming ethereum to keys. -functionhash- 0x8f38f309 (using ID for affiliate) -functionhash- 0x98a0871d (using address for affiliate) -functionhash- 0xa65b37a1 (using name for affiliate) _affCode the ID/address/name of the player who gets the affiliate fee _team what team is the player playing for?/ set ... | function buyXid(uint256 _affCode, uint256 _team) isActivated() isHuman() isWithinLimits(msg.value) public payable {
F3Ddatasets.EventReturns memory _eventData_ = determinePID(_eventData_);
uint256 _pID = pIDxAddr_[msg.sender];
if (_affCode == 0 || _affCode == _pID) {
_affCode =... | 7,297,137 |
/*NEXGEN dApp - The World's First Most Sustainable Decentralized Application */
/**
* Source Code first verified at https://etherscan.io on Wednesday, June 18, 2019
(UTC) */
pragma solidity ^0.4.20;
contract Nexgen {
/*=================================
= MODIFIERS =
... | Return the sell price of 1 individual token./ | function buyPrice()
public
view
returns(uint256)
{
if(tokenSupply_ == 0){
return tokenPriceInitial_ ;
uint256 _ethereum = tokensToEthereum_(1e18);
return _ethereum;
}
}
| 6,354,309 |
./full_match/1/0x691a269751ee4Ef10Ed3de20efeb632e2983D810/sources/sparkleswap/SparkleswapV2Router02.sol | SparkleSwap -> Uniswapv2Router02 - > (Swaps) Sparkleswap permission Sparkleswap transfer Uniswap permission Give rebate | function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline) external {
require(IERC20(path[0]).approve(address(this), amountIn), 'approve failed.');
require(IERC20(path[0]).transferFrom(msg.sender, ... | 4,881,168 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./lib/nf-token.sol";
import "./lib/ownable.sol";
import "./clock-auction-base.sol";
/**
* @dev Implementation of ERC-721 non-fungible token standard.
*/
contract MockNFToken is NFToken, Ownable {
address private auctionAddress;
receive() external ... | Override transfer from to check if the auction contract is initiating the transfer. Throws unless `msg.sender` is the current owner, an authorized operator, or the approved address for this NFT or the auction contract. Throws if `_from` is not the current owner. Throws if `_to` is the zero address. Throws if `_tokenId... | function transferFrom(
address _from,
address _to,
uint256 _tokenId
) external override canTransferAuction(_tokenId) validNFToken(_tokenId) {
address tokenOwner = idToOwner[_tokenId];
require(tokenOwner == _from, NOT_OWNER);
require(_to != address(0), ZERO_ADDRESS);
_transfer(_to, _toke... | 12,677,873 |
pragma solidity ^0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
... | TODO: handle single address can be whiteListed multiple time using unique signed hashes | function isWhitelistedAddress(bytes32 hash, uint8 v, bytes32 r, bytes32 s) public returns (bool){
require(owner == ecrecover(hash, v, r, s));
whiteListed[hash] = msg.sender;
return true;
}
| 1,044,652 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
/**
* @title PaymentSplitter
* @dev This contract allows to split Ether payments among a group of... | Returns the multiplication of two unsigned integers, reverting on overflow. Counterpart to Solidity's `` operator. Requirements: - Multiplication cannot overflow./ | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
| 280 |
./full_match/5/0xeD55b1E0f658B3f7201AA8a339CE457149DbDC18/sources/contracts/MAYClone.sol | Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting. this hook is inherited from ERC721A use this hook to apply any state changes before transfer of tokens or minting this is to avoid any exploits or reentrancy like attacks Add our custom logic to burn the s... | function _beforeTokenTransfers(
address,
address,
uint256,
uint256 quantity
) internal virtual override {
serum.burn(
quantity*2
);
}
| 1,902,773 |
/**
*Submitted for verification at Etherscan.io on 2022-01-19
*/
/*
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░╔═╗░╔╦═══╦════╗╔═══╗░░░░░░░░╔╗░░░░░░░╔═══╗░░╔╗░░░░
░║║╚╗║║╔══╣╔╗╔╗║║╔═╗║░░░░░░░░║║░░░░░░░║╔═╗║░░║║░░░░
░║╔╗╚╝║╚══╬╝║║╚╝║║░╚╬══╦══╦══╣║╔══╦╗░╔╣║░╚╬╦═╣║╔══╗
░║║╚╗║║╔══╝░║║░░║║░╔╣╔╗║══╣╔╗║║║╔╗║║░║║║╔═... | Mints `tokenId` and transfers it to `to`. WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible Requirements: - `tokenId` must not exist. - `to` cannot be the zero address. Emits a {Transfer} event./ | function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_holderOfTokens[to].add(tokenId);
_owner... | 7,655,894 |
./full_match/4/0xd500667e9dA2462adE81121810e0f57589b32837/sources/browser/Kudo.sol | Give kudo to receiver | function kudo(address payable from, address payable to) public isOwner {
Kudoer storage sender = addressToKU[from];
Kudoer storage receiver = addressToKU[to];
if (!sender.created) {
setKudoer(from, sender);
}
if (!receiver.created) {
setKudoer(to, rece... | 668,792 |
pragma solidity ^0.4.18;
contract EthPyramid {
// scaleFactor is used to convert Ether into tokens and vice-versa: they're of different
// orders of magnitude, hence the need to bridge between the two.
uint256 constant scaleFactor = 0x10000000000000000; // 2^64
// CRR = 50%
// CRR is Cash Reserve Ratio (in t... | Converts a number tokens into an Ether value. How much reserve Ether do we have left in the contract? If you're the Highlander (or bagholder), you get The Prize. Everything left in the vault. If there would be excess Ether left after the transaction this is called within, return the Ether corresponding to the equation ... | function getEtherForTokens(uint256 tokens) public constant returns (uint256 ethervalue) {
var reserveAmount = reserve();
if (tokens == totalSupply)
return reserveAmount;
return sub(reserveAmount, fixedExp((fixedLog(totalSupply - tokens) - price_coeff) * crr_d/crr_n));
}
uint256 constant sqrt2 = 0x16... | 424,950 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint25... | Gets the balance of the specified address. _owner The address to query the the balance of. return An uint256 representing the amount owned by the passed address./ | function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
| 14,117,478 |
// SPDX-License-Identifier: MIT
// @unsupported: ovm
pragma solidity >0.5.0 <0.8.0;
pragma experimental ABIEncoderV2;
import 'hardhat/console.sol';
/* Library Imports */
import {Lib_OVMCodec} from '../../libraries/codec/Lib_OVMCodec.sol';
import {Lib_AddressResolver} from '../../libraries/resolver/Lib_AddressResolver... | Retrieves the nonce of the current ovmADDRESS. return _nonce Nonce of the current contract./ | function ovmGETNONCE() external override returns (uint256 _nonce) {
console.log('lxd test ovmGETNONCE is touched');
return _getAccountNonce(ovmADDRESS());
}
| 5,528,694 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.8.10;
/******************************************************************************\
* Author: Evert Kors <[email protected]> (https://twitter.com/evert0x)
* Sherlock Protocol: https://sherlock.xyz
/*******************************************************... | Sherlock core interface for governance Evert Kors | interface ISherlockGov {
event ClaimPayout(address receiver, uint256 amount);
event YieldStrategyUpdateWithdrawAllError(bytes error);
event YieldStrategyUpdated(IStrategyManager previous, IStrategyManager current);
event ProtocolManagerUpdated(ISherlockProtocolManager previous, ISherlockProtocolManager current)... | 1,145,863 |
pragma solidity ^0.4.24;
import "./Owned.sol";
import "./Stash.sol";
import "./StashFactory.sol";
import "./RedeemAgent.sol";
import "./PledgeAgent.sol";
contract Bank is Owned {// Regulator node (MAS) should be the owner
function Bank() {
owner = msg.sender;
}
StashFactory public sf;
Redeem... | Central bank controls all the stashes | function isCentralBankNode() view returns (bool) {
return sf.isCentralBankNode();
}
| 13,102,813 |
./partial_match/5/0x7106619Bb2c60ab9d4DAF5FC4941d46cba6Aa4Ed/sources/OOF.sol | Calculates floor(x y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 with further edits by Uniswap Labs also under MIT license./ 512-bit multiply [prod1 prod0] = x y. Compute the product mod 2^256 and mod 2^256 - 1, then use use the Chinese Remainder Theorem to reconstruct... | function mulDiv(
uint256 x,
uint256 y,
uint256 denominator
) internal pure returns (uint256 result) {
unchecked {
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(su... | 16,847,089 |
// SPDX-License-Identifier: UNLICENSED
/*
$$$$$$$\ $$\ $$\ $$\ $$\ $$$$$$$$\ $$\
$$ __$$\ $$ | $$ | \__| $$ | $$ _____|\__|
$$ | $$ | $$$$$$\ $$$$$$$\ $$$$$$$\ $$\ $$$$$$\ $$ | $$\ $$$$$$$\ $$$$$$\ $$$$$$$\ $$$$$$$\ $$$$$$\
$$$$$$... | See `IERC20.approve`. Requirements: - `spender` cannot be the zero address./ | function approve(address spender, uint256 value) override public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
| 7,242,168 |
./full_match/43113/0x30F86EF7DE7970d01fb81cB7c4Ef73230DBAD984/sources/contracts/test.sol | require( _exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); | function tokenURI(uint256 tokenId)
public view override returns (string memory) {
if (!_exists(tokenId)) {
return notRevealedUri;
}
if (revealed == false) {
return notRevealedUri;
}
return bytes(baseURI).length > 0
? string(abi.e... | 7,205,960 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
library ECStructs {
struct ECDSASig {
uint8 v;
bytes32 r;
bytes32 s;
}
}
contract ILotteryForCoke {
struct Ticket {
address payable ticketAddress;
uint256 period;
address payable bu... | Internal function that mints an amount of the token and assigns it to an account. This encapsulates the modification of balances such that the proper events are emitted. account The account that will receive the created tokens. value The amount that will be created./ | function _mint(address account, uint256 value) internal {
require(account != address(0), "ERC20 _mint, account can not be 0x00");
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Transfer(address(0), account, value);
}
| 7,326,961 |
./full_match/1/0x8235Ed3eAaE46846d6a97726b69F2953d1cd21d9/sources/contracts/Claimer.sol | DANGER: this will block all claims that use this asset. | function withdraw(IERC20 asset) external onlyOwner {
SafeERC20.safeTransfer(
asset,
msg.sender,
asset.balanceOf(address(this))
);
}
| 16,450,190 |
// SPDX-License-Identifier: MIT
/**
* @authors: [*@epiqueras, @shotaronowhere]
* @reviewers: []
* @auditors: []
* @bounties: []
* @deployments: [ ]
*/
pragma solidity ^0.4.24;
/**
* @title DualSortitionSumTreeFactory
* @author Shotaro - <shawtarohgn@gmail.com>
* @dev A factory of dual trees that kee... | Set a value of a tree. _key The key of the tree. _value The new value. _ID The ID of the value. `O(log_k(n))` where `k` is the maximum number of childs per node in the tree, and `n` is the maximum number of nodes ever appended./ | function set(DualSortitionSumTrees storage self, bytes32 _key, uint _value, bytes32 _ID) public {
SortitionSumTree storage treeSet = self.sortitionSumSetTrees[_key];
SortitionSumTree storage treeDraw = self.sortitionSumDrawTrees[_key];
if (self.lastThresholdUpdate > 2*(treeSet.nodes[0]+tr... | 6,369,290 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.12;
import './interface/ComptrollerInterface.sol';
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
error MarketNotList();
error InsufficientLiquidity();
error PriceError();
error NotLiquidatePosition();
error AdminOnly();
error ProtocolPaused();
... | The Pause Guardian can pause certain actions as a safety mechanism. Actions which allow users to remove their own assets cannot be paused. Liquidation / seizing can only be paused globally, not by market./ | function getMintGuardianPaused(address lendTokenAddress) external view returns(bool){ return mintGuardianPaused[lendTokenAddress];}
| 15,849,546 |
pragma solidity ^0.4.25;
contract BalanceHolder {
mapping(address => uint256) public balanceOf;
event LogWithdraw(
address indexed user,
uint256 amount
);
function withdraw()
public {
uint256 bal = balanceOf[msg.sender];
balanceOf[msg.sender] = 0;
... | Submit the answer whose hash you sent in a previous submitAnswerCommitment() transaction Checks the parameters supplied recreate an existing commitment, and stores the revealed answer Updates the current answer unless someone has since supplied a new answer with a higher bond msg.sender is intentionally not restricted... | function submitAnswerReveal(bytes32 question_id, bytes32 answer, uint256 nonce, uint256 bond)
external {
}
| 1,808,939 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
// OpenZeppelin library for performing math operations without overflows.
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
// OpenZeppelin security library for preventing reentrancy attacks.
import "@openzep... | Sending ETH is not guaranteed complete, and the method used here will return false if it fails. For example, a contract can block ETH transfer, or might use an excessive amount of gas, thereby griefing a new bidder. We should limit the gas used in transfers, and handle failure cases. Here increase the gas limit a reaso... | function attemptETHTransfer(address to, uint256 value)
private
returns (bool)
{
return success;
}
| 109,255 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20Burnable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
interface IBrincStaking {
function ... | mint will create specified number of tokens to specified address. only a minter will be able to call this method. _to address to mint tokens to _amount amount of tokens to mint/ if_succeeds {:msg "mint: The sender must be Minter"} isMinter[msg.sender] == true; if_succeeds {:msg "mint: balance of receiving address is ... | function mint(address _to, uint256 _amount) public onlyMinter {
_mint(_to, _amount);
emit Mint(_to, _amount);
}
| 1,727,775 |
./partial_match/43114/0xbcdf6876582C371B53BFA9759388EE3190719EeD/sources/contracts/Ola/Peripheral/PriceOracle/Fixed/FixedPriceOracle.sol | Get the underlying price of a cToken asset asset The asset (Erc20 or native) return The asset price mantissa (scaled by 1e(36 - assetDecimals)). Zero means the price is unavailable./ All fixed prices are scaled by 1e6 | function _getPriceForAssetInternal(address asset) internal view returns (uint) {
uint storedFixedPrice = prices[asset];
uint8 assetDecimals = assetsDecimals[asset];
if (storedFixedPrice == 0) {
return 0;
return (mul(1e30, storedFixedPrice) / (10 ** assetDecimals));
... | 3,505,237 |
// 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.... | Gets the configuration paramters of the reserve from a memory object self The reserve configuration return The state params representing ltv, liquidation threshold, liquidation bonus, the reserve decimals/ | function getParamsMemory(DataTypes.ReserveConfigurationMap memory self)
internal
pure
returns (
uint256,
uint256,
uint256,
uint256,
uint256
)
{
return (
self.data & ~LTV_MASK,
(self.data & ~LIQUIDATION_THRESHOLD_MASK) >> LIQUIDATION_THRESHOLD_START_BIT_P... | 68,405 |
./partial_match/1/0xCDdE7BAB4896B9818aaFFEC71B2ff8576F8550E5/sources/genesis.sol | on-chain whitelist setting ================================================================================ Description of validate address recipient Description of address recipient return value : true if the address in whitelist/ | function validate(address recipient) public view returns (bool) {
return _whitelist[recipient];
}
| 15,938,212 |
./full_match/1/0x77337dEEA78720542f0A1325394Def165918D562/sources/src/libraries/SplitSwapLibrary.sol | Given some asset amount and reserves, returns an amount of the other asset representing equivalent value Require replaced with revert custom error amountA Amount of token A reserveA Reserves for tokenA reserveB Reserves for tokenB return amountB Amount of token B returned | function quote(
uint256 amountA,
uint256 reserveA,
uint256 reserveB
) internal pure returns (uint256 amountB) {
if (_isZero(amountA)) revert ZeroAmount();
if (_isZero(reserveA) || _isZero(reserveB)) revert InsufficientLiquidity();
amountB = (amountA * reserveB) / ... | 16,514,071 |
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.0;
import "./Ownable.sol";
import "./Strings.sol";
import "./interfaces/ITraits.sol";
import "./interfaces/IWoolf.sol";
contract Traits is Ownable, ITraits {
using Strings for uint256;
// struct to store each trait's data for metadata and rendering... | generates a base64 encoded metadata response without referencing off-chain content tokenId the ID of the token to generate the metadata for return a base64 encoded JSON dictionary of the token's metadata and SVG/ | function tokenURI(uint256 tokenId)
public
view
override
returns (string memory)
{
IWoolf.SheepWolf memory s = woolf.getTokenTraits(tokenId);
string memory metadata = string(
abi.encodePacked(
'{"name": "',
s.isSheep ? "... | 12,545,759 |
pragma solidity 0.5.17;
import "./MToken.sol";
import "./MomaPool.sol"; // unused currently
import "./Governance/Moma.sol";
import "./MomaFactoryInterface.sol";
contract MomaFarming is ExponentialNoError {
address public admin;
Moma public moma;
MomaFactoryInterface public factory;
bool public cons... | Transfer MOMA to the user Note: If there is not enough MOMA, will do not perform the transfer user The address of the user to transfer MOMA to amount The amount of token to (possibly) transfer return The amount of token which was NOT transferred to the user/ | function grantMomaInternal(address user, uint amount) internal returns (uint) {
uint remaining = moma.balanceOf(address(this));
if (amount > 0 && amount <= remaining) {
moma.transfer(user, amount);
return 0;
}
return amount;
}
| 12,691,511 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import "./base/Controllable.sol";
import "sol-temple/src/tokens/ERC721.sol";
import "sol-temple/src/tokens/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
/// @title Ape Runners RUN
/// @au... | See {ERC721Enumerable.tokenByIndex}. | function tokenByIndex(uint256 index_) public view virtual returns (uint256) {
require(index_ < totalSupply, "ERC721Enumerable: Index out of bounds");
return index_;
}
| 13,632,914 |
./partial_match/1/0x420D08Dad4fcd7896500d5E183D8BA934c919220/sources/EaselyFixedCollection.sol | Hash that the owner or alternate wallet must sign to enable a {mintAllow} for a user return Hash of message prefix and order hash per Ethereum format/ | function _hashForAllowList(
address allowedAddress,
uint256 nonce,
uint256 version,
uint256 price,
uint256 amount
) internal view returns (bytes32) {
return keccak256(abi.encode(address(this), block.chainid, owner(), allowedAddress, nonce, version, price, ... | 2,825,429 |
./partial_match/1/0xfdB5Dee856A2709F9D356ABb6A38c391c6eBCe6C/sources/CountdownGriefingEscrow_Factory.sol | Deposit Stake. - tokens (ERC-20) are transfered from the caller and requires approval of this contract for appropriate amount. - if buyer already deposited the payment, finalize the escrow. Access Control: buyer OR operator State Machine: before finalize() OR before cancel() restrict access cont... | function depositStake() public {
require(isSeller(msg.sender) || Operated.isOperator(msg.sender), "only seller or operator");
require(_data.seller != address(0), "seller not yet set");
_depositStake();
}
| 4,386,929 |
// SPDX-License-Identifier: MIT
//
/**
Babas is Babas
*/
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfac... | Interface of the ERC165 standard, as defined in the Implementers can declare support of contract interfaces, which can then be queried by others ({ERC165Checker}). For an implementation, see {ERC165}./ | interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
Babas is Babas
pragma solidity ^0.8.0;
}
| 1,435,679 |
// SPDX-License-Identifier: MIT
// Sources flattened with hardhat v2.6.1 https://hardhat.org
// File @openzeppelin/contracts/utils/introspection/IERC165.sol@v4.3.0
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implemen... | Return an empty array | function tokensOfOwner(address _owner) external view returns(uint256[] memory ) {
uint256 tokenCount = this.balanceOf(_owner);
if (tokenCount == 0) {
return new uint256[](0);
uint256[] memory result = new uint256[](tokenCount);
uint256 index;
for (inde... | 9,963,886 |
// TODO: Remove this mock once Chainlink supports v0.8 mocks
pragma solidity ^0.8.0;
import './token/LinkERC20.sol';
import './ERC677Token.sol';
contract LinkToken is LinkERC20, ERC677Token {
uint private constant TOTAL_SUPPLY = 10**27;
string private constant NAME = 'ChainLink Token';
string private constant S... | Hook that is called when this contract is created. Useful to override constructor behaviour in child contracts (e.g., LINK bridge tokens). Default implementation mints 1027 tokens to msg.sender/ | function _onCreate()
internal
virtual
{
_mint(msg.sender, TOTAL_SUPPLY);
}
| 6,369,774 |
./partial_match/42/0xf567Bc19381aA04fB235B4ABBBC4a51ac175A233/sources/YAMDelegate.sol | who The address to query. return The balance of the specified address./ | function balanceOf(address who)
external
view
returns (uint256)
{
return _yamBalances[who].mul(yamsScalingFactor).div(internalDecimals);
}
| 3,489,226 |
./partial_match/1/0x7894760FF403394fc9a85730fD411b12E901E093/sources/QualityDigital.sol | New function to control selling | function setSellEnabled(bool _sellEnabled) external onlyOwner { | 4,405,279 |
./full_match/1/0xa691c1f85448B28106aF5302E4ACfD1373bF327a/sources/contracts/PoolStakingLock.sol | Withdraw pending AUTO | function harvest() external nonReentrant {
UserInfo storage user = userInfo[msg.sender];
_updatePool();
require(payOrLockupPending(user), "Harvests locked");
_updateRewardDebt(user);
}
| 17,158,270 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import "./ERC721A_M.sol";
import "./meltable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/interfaces/IERC721.sol";
/////////////////////////////////... | Burns the 16 NFTs and sends the mosaic NFT to the msg.sender. Can only be called if the msg.sender owns all the 16 NFTs and this address owns the mosaic NFT./ | function melt() external {
if (balanceOf(msg.sender) != 16) revert NotOwnerOfAll();
_burnAll();
IERC721(mosaicNftAddress).safeTransferFrom(address(this), msg.sender, 1);
_currentIndex = 1;
}
| 12,622,373 |
pragma solidity 0.5.12;
contract RelatorioDeHorasTrabalhadas
{
uint256 mes;
uint256 ano;
uint256 dia1;
uint256 dia2;
uint256 dia3;
uint256 dia4;
uint256 dia5;
uint256 dia6;
uint256 dia7;
uint256 dia8;
uint256 dia9;
uint256 dia10;
uint256 dia11;
uint256 dia12;... | não consegui declarar os 30 dias, como fazer? | {
uint256 mes;
uint256 ano;
uint256 dia1;
uint256 dia2;
uint256 dia3;
uint256 dia4;
uint256 dia5;
uint256 dia6;
uint256 dia7;
uint256 dia8;
uint256 dia9;
uint256 dia10;
uint256 dia11;
uint256 dia12;
uint256 dia13;
uint256 dia14;
uint256 dia15;
uint... | 1,052,275 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
// dependencies
import {AggregatorV3Interface} from "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
import {SafeCast} from "@openzeppelin/contracts/utils/math/SafeCast.sol";
import {Context} from "@openzeppelin/contracts/utils/Context.sol";
... | notional sell derivative tokens on (external) market | function _closePositionOnMarket(uint256 amount, LibPerpetual.Side direction) internal returns (uint256) {
uint256 quoteSold = 0;
if (direction == LibPerpetual.Side.Long) {
quoteSold = market.mintVQuote(amount);
quoteSold = market.burnVQuote(amount);
}
return q... | 994,505 |
/**
*Submitted for verification at Etherscan.io on 2021-03-08
*/
pragma solidity ^0.7.6;
library SafeMathUpgradeable {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - ... | Contract initializer. _logic Address of the initial implementation. _data Data to send as msg.data to the implementation to initialize the proxied contract. It should include the signature and the parameters of the function to be called, as described in This parameter is optional, if no data is given the initializati... | function initialize(address _logic, bytes memory _data) public payable {
require(_implementation() == address(0));
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
_setImplementation(_logic);
if (_data.length > 0) {
(bool success, ) = _logic.delegatecall(_data);
require(su... | 7,899,409 |
./full_match/53935/0x794C07912474351b3134E6D6B3B7b3b4A07cbAAa/sources/contracts/dex/UniswapV2Pair.sol | this low-level function should be called from a contract which performs important safety checks scope for _token{0,1}, avoids stack too deep errors scope for reserve{0,1}Adjusted, avoids stack too deep errors | function swap(
uint256 amount0Out,
uint256 amount1Out,
address to,
bytes calldata data
) external lock {
require(amount0Out > 0 || amount1Out > 0, "UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT");
require(amount0Out < _reserve0 && amount1Out < _reserve1, "UniswapV2: INSUF... | 3,786,349 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.