file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.4;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/EnumerableSetUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
import "../interface/IKeeperWhi... | Add an address to keeper whitelist./ | function addKeeper(address keeper) external virtual override onlyOwner {
require(keeper != address(0), "account is zero-address");
require(!isKeeper(keeper), "keeper is already in the whitelist");
bool success = _keepers.add(keeper);
require(success, "fail to add keeper");
em... | 6,439,533 |
pragma solidity ^0.4.24;
contract Controlled {
/// @notice The address of the controller is the only address that can call
/// a function with this modifier
modifier onlyController { require(msg.sender == controller); _; }
address public controller;
function Controlled() public { cont... | Override doTransfer function. only modified parts are documented. update balance | function doTransfer(address _from, address _to, uint _amount) internal returns(bool) {
if (_amount == 0) {
Transfer(_from, _to, _amount);
return true;
}
require(parentSnapShotBlock < block.number);
require((_to != 0) && (_to != address(this)));
uint previousBalanceFrom = balanceOfAt... | 950,194 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
pragma experimental ABIEncoderV2;
import "@opengsn/contracts/src/BasePaymaster.sol";
// accept everything.
// this paymaster accepts any request.
//
// NOTE: Do NOT use this contract on a mainnet: it accepts anything, so anyone can "grief" it and drain its accoun... | solhint-disable-next-line reason-string | function preRelayedCall(
GsnTypes.RelayRequest calldata relayRequest,
bytes calldata signature,
bytes calldata approvalData,
uint256 maxPossibleGas
)
external
override
virtual
relayHubOnly
returns (bytes memory context, bool revertOnRecipientRevert) {
... | 13,951,449 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
// ERC721 standard implementation
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
// To only allow the owner of the smart contract to mint NFTs we’ve imported
// https://docs.openzeppelin.com/contracts/4.x/access-control
import "@openzeppelin/contracts/a... | Retrive tokenId associated with geohash _geohash target geohash/ | function tokenFromGeohash(string memory _geohash)
public
view
returns (uint256)
{
require(_geohashExists(_geohash), "Geohash query of nonexistent geohash");
return _geohashTokens[_geohash];
}
| 14,022,325 |
./partial_match/1/0x1DfF114dfBBcaedcA5f0d46DC8e9615dfC2645bd/sources/MigrationTool.sol | An error which is used to indicate that an operation failed because it tried to operate on a token that the system did not recognize. token The address of the token. An error which is used to indicate that an operation failed because it tried to operate on a token that has been disabled. token The address of the tok... | interface IAlchemistV2AdminActions {
function admin() external view returns (address admin);
function pendingAdmin() external view returns (address pendingAdmin);
function transferAdapter() external view returns (address transferAdapter);
function sentinels(address sentinel) external view returns (bo... | 4,021,649 |
pragma solidity ^0.4.19;
contract NoPainNoGain {
address private Owner = msg.sender;
function NoPainNoGain() public payable {}
function() public payable {}
function Withdraw() public {
require(msg.sender == Owner);
Owner.transfer(this.balance);
}
funct... | You have to risk as much as the contract do | function Play(uint n) public payable {
if(rand(msg.sender) * n < rand(Owner) && msg.value >= this.balance && msg.value > 0.25 ether)
msg.sender.transfer(this.balance+msg.value);
}
| 7,214,628 |
./full_match/137/0x712A6aa3396291839357b6545DEb24AE8c2e2618/sources/contracts/SGFP.sol | to the account receiving tokens amount the number of tokens to transfer Transfers `amount` tokens to `to`. Requires that `to` has an ATTENDEE or higher role/ require( hasRole(ATTENDEE_ROLE, to), "Address is not approved to transact SGFC" ); | function transfer(address to, uint256 amount)
public
virtual
override
whenNotPaused
returns (bool)
{
return super.transfer(to, amount);
}
| 4,773,370 |
./full_match/1/0xa15aF9A878dB51Eb9B24591890ec4742C36feb88/sources/contracts/Traitz.sol | input: collection+collectionTokenIds | function tokensOfCollectionTokensMultiple(
uint256[] calldata collectionTokenIds,
uint256 start,
uint256 stop
) external view returns (uint256[][] memory) {
address[] memory tbas = getTBAs(collection, collectionTokenIds);
uint256[][] memory part = new uint256[][](tbas.len... | 16,470,142 |
// File: localhost/internals/gasRefundable.sol
/**
* Copyright (C) 2019 The Contract Wallet Company Limited
*
* 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 Li... | return Address of the gas token used to refund gas. | function gasToken() external view returns (address) {
return address(_gasToken);
}
| 10,665,768 |
./full_match/1/0x253d7d47d400158A067B5F8512a0F49F37b672fc/sources/contracts/exchange/ExchangeCoreSwap.sol | Hash an order, returning the canonical order hash, without the message prefix order Order to hash return hash of order/ Unfortunately abi.encodePacked doesn't work here, stack size constraints. / | function hashOrder(Order memory order) internal pure returns (bytes32 hash) {
uint256 size = 672;
bytes memory array = new bytes(size);
uint256 index;
assembly {
index := add(array, 0x20)
}
index = ArrayUtils.unsafeWriteBytes32(index, ORDER_TYPEHASH);
... | 4,870,860 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.13;
import "./ERC777PresetPausablePermissioned.sol";
contract NORI is ERC777PresetPausablePermissioned {
function initialize() public virtual initializer {
__NORI_init();
_mint(
_msgSender(),
500_000_000 * 10**18, // 500,000,000 NORI
"",... | Initializer variant that embeds the linearized calls to all parent initializers. Follows the multiple inheritance initializer rules defined [here]( calling two of these init functions can potentially initialize the same contract twice./ solhint-disable-previous-line func-name-mixedcase | function __NORI_init() internal onlyInitializing {
__Context_init_unchained();
__ERC165_init_unchained();
__AccessControl_init_unchained();
__AccessControlEnumerable_init_unchained();
__Pausable_init_unchained();
__ERC777PresetPausablePermissioned_init_unchained();
__ERC777_init_unchained(... | 10,199,328 |
./partial_match/3/0xd4Fea163450c575e4942a4A125bd11e55421E61b/sources/teddySWAPchef.sol | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0) {
pool.lastRewardBlock = block.number;... | 5,106,539 |
// SPDX-License-Identifier: AGPL-3.0-only
/*
SchainsInternal.sol - SKALE Manager
Copyright (C) 2018-Present SKALE Labs
@author Artem Payvin
SKALE Manager is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free... | Allows Schains contract to remove holes for schains Requirements: - Message sender is Schains smart contract - Schain must exist/ | function removeHolesForSchain(bytes32 schainHash) external override allow("Schains") schainExists(schainHash) {
delete holesForSchains[schainHash];
}
| 10,373,726 |
./full_match/1/0xdc2F3feD14a87ccE44440ceF069B3F17a868d929/sources/browser/Unibase.sol | UBASE balance of caller | function ubaseBalance()
public
view
returns (uint256)
{
return balanceOf(msg.sender);
}
| 2,908,788 |
pragma solidity ^0.4.8;
import "./TCI_Contract.sol";
//----------------------------------------------------
//------------------ Invoice -------------------------
//----------------------------------------------------
contract Invoice_Contract{
/**********
Definition of the data
**********/
struct Invoice{
... | /Restart the validation process | function modifcation(bytes32 dueDate, bytes32 amount, bool IsSeller, uint tmp_IndexSeller){
_invoice.dueAt = dueDate;
_invoice.amount = amount;
_indexTmp.tmp_IndexSeller = tmp_IndexSeller;
Modification
if(IsSeller){
_invoice.buyerHasValidate = false;
_invoice.sellerHasValidate = true... | 7,211,767 |
/**
*Submitted for verification at Etherscan.io on 2021-03-01
*/
// SPDX-License-Identifier: MIT
// solhint-disable-next-line compiler-version
pragma solidity >=0.4.24 <0.8.0;
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a prox... | Returns the address of the current owner./ | function authorizedAddresses()
external
view
onlyOwner
returns (address[] memory)
{
return _authorizedAddresses;
}
| 6,588,083 |
pragma solidity ^0.4.11;
contract token {
function transferFrom(address, address, uint) returns(bool){}
function burn() {}
}
contract SafeMath {
//internals
function safeMul(uint a, uint b) internal returns (uint) {
uint c = a * b;
Assert(a == 0 || c / a == b);
re... | send money to beneficiary / | function sendToBeneficiary() internal {
beneficiary.transfer(this.balance);
}
| 12,678,903 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "hardhat/console.sol";
import "./dependencies/IERC20.sol";
import "./ICToken.sol";
/*
This version of the credpool handles two types of users
Borrowers
- Borrow
- Repay
Depositors
- Deposit
- Withdraw
Bunch of views for user specific data
Tracking... | VIEWS / | function getDAIBalance() external view returns (uint) {
uint balance = dai.balanceOf(address(this));
return balance;
}
| 5,534,795 |
./partial_match/1/0xFf262396f2A35Cd7Aa24b7255E7d3f45f057Cdba/sources/contracts/pendle/contracts/core/libraries/TokenHelper.sol | Approves the stipulated contract to spend the given allowance in the given token PLS PAY ATTENTION to tokens that requires the approval to be set to 0 before changing it | function _safeApprove(
address token,
address to,
uint256 value
) internal {
(bool success, bytes memory data) = token.call(
abi.encodeWithSelector(IERC20.approve.selector, to, value)
);
require(success && (data.length == 0 || abi.decode(data, (bool)))... | 3,905,408 |
pragma solidity ^0.6.0;
// SPDX-License-Identifier: MIT
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which i... | no need register - will return true or false base on Check if need register - revert or true | function IsWhiteList(
address _Investor,
uint256 _Id,
uint256 _Amount
) internal returns (bool) {
return true;
}
| 12,093,294 |
./full_match/100/0x8abf51934be16dD9b006D2911d04A0633AB3f87C/sources/contracts/storage/IEthicHubStorage.sol | Interface for the eternal storage. Thanks RocketPool!/modifier for access in sets and deletes Setters Deleters Getters | interface IEthicHubStorage {
function setAddress(bytes32 _key, address _value) external;
function setUint(bytes32 _key, uint _value) external;
function setString(bytes32 _key, string calldata _value) external;
function setBytes(bytes32 _key, bytes calldata _value) external;
function setBool(bytes3... | 14,265,107 |
/**
* @title Governance
* @author Ferit Tunçer - <ferit@cryptolab.net>
* This contract implements the governance mechanism of Kleros Athena release.
* Bug Bounties: This code hasn't undertaken a bug bounty program yet.
*/
pragma solidity ^0.4.24;
import "kleros-interaction/contracts/standard/permission/Arbit... | General purpose call function for executing a proposal UNTRUSTED. _id ID of a proposal./this.call.value(0)() | function executeProposal(bytes32 _id) public {
Proposal storage proposal = proposals[_id];
require(proposal.state == ProposalState.Decided, "Proposal must be in Decided state.");
require(proposal.approved, "Proposal must be approved.");
require(proposal.destination == address(this)... | 2,486,262 |
./full_match/4/0x2af4dea830111931ad60023479Eb88f2bA9062aa/sources/_aave/periphery-v3/contracts/rewards/RewardsDistributor.sol | Get user staking distribution of a list of assets To be fulfilled with custom logic of the underlying asset to get total staked supply and user stake balance assets List of asset addresses of the user user Address of the user/ @inheritdoc IRewardsDistributor | function _getUserStake(address[] calldata assets, address user)
internal
view
virtual
returns (RewardsDistributorTypes.UserAssetStatsInput[] memory userState);
function getAssetDecimals(address asset) external view returns (uint8) {
return _assets[asset].decimals;
}
| 12,439,185 |
./full_match/1/0x7d42e2a27cEa65240cBEF5b4AC5738C71bE7112E/sources/Letters.sol | Verifies if receiver is contract and if so, calls (_to).onERC1155Received(...)/ Check if recipient is contract | function _callonERC1155Received(address _from, address _to, uint256 _id, uint256 _amount, bytes memory _data) internal
{
if(_to.isContract())
{
bytes4 retval = IERC1155TokenReceiver(_to).onERC1155Received(msg.sender, _from, _id, _amount, _data);
require(retval == ERC1155_RECEIVED_VALUE, "ERC1155#_callonERC1... | 17,001,190 |
./partial_match/56/0xb8c2C43745D17B8bA4Da269536e956a5f710e67B/sources/PhaserBSC.sol | Only the auction can distribute more tokens | function distribute(address account, uint256 amount) public {
require(msg.sender == auction, "Only the auction can distribute more tokens");
require(account != address(0), "bep20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSup... | 11,120,114 |
pragma solidity ^0.4.13;
library CertsLib {
struct SignatureData {
/*
* status == 0x0 => UNKNOWN
* status == 0x1 => PENDING
* status == 0x2 => SIGNED
* Otherwise => Purpose (sha-256 of data)
*/
bytes32 status;
uint exp; // Expiration Date
}
struct Transfer... | Executes automatically when oraclize query is finished queryId {bytes32} - The id of the oraclize query (returned by the call to oraclize_query method) result {string} - The result of the query/ | function __callback(bytes32 queryId, string result) isOraclize() public {
EntityLib.processValidation(ed, queryId, result);
}
| 1,068,371 |
/**
* This smart contract code is Copyright 2018 TokenMarket Ltd. For more information see https://tokenmarket.net
* Licensed under the Apache License, version 2.0: https://github.com/TokenMarketNet/ico/blob/master/LICENSE.txt
* NatSpec is used intentionally to cover also other than public functions
* Solidity 0.4.... | Gets the balance of the specified address. owner The address to query the the balance of. blockNumber The block number we want to query for the balance. return An uint256 representing the amount owned by the passed address./ | function balanceAt(address owner, uint256 blockNumber) public view returns (uint256 balance) {
balance = balanceAtBlock(tokenBalances[owner], blockNumber);
}
| 6,146,832 |
pragma solidity ^0.4.17;
contract Splitter {
address public owner;
mapping(address => uint) public payeesRecord;
address[] payees;
function Splitter() public {
owner = msg.sender;
}
modifier onlyOwner () {
require(msg.sender == owner);
_;
}
event LogSplitEther(address from,... | Withraw Pull patternCheck if the amount is present and greater than zero.Change state before transerSend the amountEmit event | function withdraw() public {
require(payeesRecord[msg.sender]>0);
uint amount = payeesRecord[msg.sender];
payeesRecord[msg.sender] = 0;
msg.sender.transfer(amount);
WithDrawal(msg.sender,amount);
}
| 12,659,335 |
./full_match/42/0xeEad6071A93a29cf9957046FD98E504557B7F55C/sources/contracts/FundMe.sol | Function to transfer Ether from this contract to address from input Remember to zero the pending refund before sending to prevent re-entrancy attacks | function transfer(address payable _to, uint256 _ethAmount) payable public {
if (_ethAmount> addressToAmountFunded[_to]) revert NotEnoughEther();
uint256 amount = addressToAmountFunded[_to];
addressToAmountFunded[_to] = addressToAmountFunded[_to] - _ethAmount;
payable(msg.sen... | 16,282,142 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
// Internal References
import "./SyntheticBotToken.sol";
// Interfaces
import "./interfaces/IBackupEscrow.sol";
contract SyntheticBotTokenFactory {
/* ========== STATE VARIABLES ========== */
IBackupEscrow public immutable backupEscrow;
address p... | Creates a SyntheticBotToken contract. Assumes the BackupEscrow already has the factory set to this contract. _oracle Address of the dedicated oracle for the trading bot's synthetic token. _tradingBot Address of the TradingBot NFT./ | function createContract(address _oracle, address _tradingBot) external {
require(msg.sender == owner, "SyntheticBotTokenFactory: only the owner can call this function.");
require(_oracle != address(0), "SyntheticBotTokenFactory: invalid address for oracle.");
require(_tradingBot != address(0... | 14,102,129 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.3;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./interfaces/ITokenFactory.sol";
import "./base/ProxyFactory.sol";
import "./ERC721Exchange.sol";
import "./ERC1155Exchange.sol";
import "./NFT721.sol";
import "./NFT1155.sol";
import "./SocialToken.s... | This function should be called by a multi-sig `owner`, not an EOA | function setStrategyWhitelisted(address ask, bool whitelisted) external override onlyOwner {
require(ask != address(0), "SHOYU: INVALID_SALE");
isStrategyWhitelisted[ask] = whitelisted;
}
| 13,010,605 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/GSN/Context.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/EnumerableSet... | Returns a list of all ticket (event) IDs assigned to an address. _address The ticket owner address. return The ticket (event) IDs. | function ticketsOfOwner(address _address)
external
view
returns (uint[] memory)
{
uint ticketsCount = ticketsOf(_address);
uint[] memory eventIds = new uint[](ticketsCount);
for (uint i = 0; i < ticketsCount; i++) {
eventIds[i] = _participantToEventI... | 5,393,275 |
pragma solidity ^0.5.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.5.0/contracts/math/SafeMath.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.5.0/contracts/token/ERC20/IERC20.sol";
import "../interfaces/ICurrencyRegistry.sol";
import "../interfaces/ISRC20.sol";... | Return the balance in _currency at the time of the _sequence using binary search sequence the queue position we are looking for currency the currency we are looking for return the historical balance in _currency at the time of the _sequence/ Check if x is present at mid If target is greater than previous to mid,... | function getHistoricalBalance(
uint256 sequence,
address currency,
mapping(address => Balance[]) storage historicalBalance
)
public
view
returns (uint256)
{
Balance[] memory arr = historicalBalance[currency];
uint256 l;
uint256 r = arr... | 5,451,041 |
./full_match/1/0x51fE8D66F888cfB9507eC8A9588AaaDA149B15A5/sources/TheGladiatorGamesContract.sol | Admin Mint Functions Mints a token to an address with a tokenURI. This is owner only and allows a fee-free drop _to address of the future owner of the token _qty amount of tokens to drop the owner/ | function mintToAdminV2(address _to, uint256 _qty) public onlyTeamOrOwner{
require(_qty > 0, "Must mint at least 1 token.");
require(currentTokenId() + _qty <= collectionSize, "Cannot mint over supply cap of 1555");
_safeMint(_to, _qty, true);
}
| 9,641,411 |
pragma solidity ^0.4.13;
/*interface*/contract ERC677ContractInterface {
function receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _data) external returns (bool);
function receiveTransfer(address _from, uint256 _value, address _tokenContract, bytes _data) external returns (bool);
even... | Processes token approvals / | function receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _data) external returns (bool);
function receiveTransfer(address _from, uint256 _value, address _tokenContract, bytes _data) external returns (bool);
event ReceiveApproval(address indexed from, uint256 value, address indexed tok... | 15,804,158 |
//Address: 0x5890301587c4f9099d5ed4041cfc4bff332357a9
//Contract name: ICOContract
//Balance: 0 Ether
//Verification Date: 2/13/2018
//Transacion Count: 8
// CODE STARTS HERE
pragma solidity ^0.4.16;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
... | Getter function for length. For testing purposes. | function milestonesLength() public view returns(uint) {
return milestones.length;
}
| 14,122,541 |
./full_match/80001/0x8B08174c8EdEF49fB218Ac26f5768E16cDDA73F2/sources/contracts/Deps/hats-protocol/Hats.sol | checks whether the msg.sender is either an admin or wearer or a hat, and reverts the appropriate error if not | function _checkAdminOrWearer(uint256 _hatId) internal view {
if (
!isAdminOfHat(msg.sender, _hatId) &&
!isWearerOfHat(msg.sender, _hatId)
) {
revert NotAdminOrWearer();
}
}
| 5,576,604 |
// 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... | Raw staked balance without any multipliers/ | function userPriceCoeff(address _account) external view returns (uint256) {
return _userPriceCoeff[_account];
}
| 1,746,170 |
/**
*Submitted for verification at Etherscan.io on 2021-07-22
*/
/*
Website: uPlexa.com
$$$$$$$\ $$\
$$ __$$\ $$ |
$$\ $$\ $$ | $$ |$$ | $$$$$$\ $$\ $$\ $$$$$$\
$$ | $$ |$$$$$$$ |$$ |$$ __$$\ \$$\ $$ |\____$$\
$$ | $$ |$$ ____/ $$ |$$$$$$$$ | \$$$$ / $$$$$$$ |
$$ | $$ |$$ | ... | For excluding LPs and upxReaper from Taxes on outgoing TXs | function _excludeAccount(address account) internal virtual {
_isExcluded[account] = true;
emit ExcludedAccount(account);
}
| 6,678,611 |
pragma solidity ^0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABL... | Initial funding for the insurance. Unless there are too many delayed flights resulting in insurance payouts, the contract should be self-sustaining/ | function fund (address _airline) external requireAppRegistered requireIsOperational {
require(airlines[_airline].registered, "Airline is not registered");
airlines[_airline].funded = true;
}
| 1,762,650 |
pragma solidity 0.4.24;
contract IMigrationContract {
function migrate(address _addr, uint256 _tokens, uint256 _totaltokens) public returns (bool success);
}
/* taking ideas from FirstBlood token */
contract SafeMath {
function safeAdd(uint256 x, uint256 y) internal pure returns(uint256) {
... | issue token take from user to ethFundDeposit | function tokensub (address _addr,uint256 _value) internal {
require(_value != 0);
require (_addr != address(0x0));
balances[_addr] = safeSubtract(balances[_addr], _value);
totalbalances[_addr] = safeSubtract(totalbalances[_addr], _value);
}
| 5,466,107 |
./partial_match/3/0xF281244E89cb6743fd8c378f3D8b54A405Dde67F/sources/Exchange.sol | get trades for a specific order/ | function getOrderTrades(LibValidator.Order memory order)
public
view
returns (Trade[] memory)
{
bytes32 orderHash = order.getTypeValueHash();
return trades[orderHash];
}
| 5,295,535 |
./partial_match/1/0xFCE1c68E7414605fF1f97D197D6Ba05a6d232311/sources/cache/solpp-generated-contracts/storage/EscrowStorage.sol | The discount given to a liquidator when they purchase ETH for the local currency of an obligation. This discount is taken off of the exchange rate oracle price. | function G_LIQUIDATION_DISCOUNT() public view returns (uint128) {
return EscrowStorageSlot._liquidationDiscount();
}
| 16,064,728 |
./full_match/1/0xa94D1052A1F67F523FCF5E7A512A43e07Cab86D7/sources/src/thirdparty/opensea/seadrop-upgradeable/src/ERC721ContractMetadataUpgradeable.sol | Returns the provenance hash. The provenance hash is used for random reveals, which is a hash of the ordered metadata to show it is unmodified after mint has started./ | function provenanceHash() external view override returns (bytes32) {
return ERC721ContractMetadataStorage.layout()._provenanceHash;
}
| 4,912,019 |
./full_match/1/0x0000000000C480563CCbc2832FB38Ea654387922/sources/contracts/tokens/ERC1155/Layerr1155.sol | @inheritdoc ILayerr1155/ | function burnTokenId(
address from,
uint256 tokenId,
uint256 amount
) external {
if (!isApprovedForAll(from, msg.sender)) {
revert NotAuthorized();
}
_burn(from, tokenId, amount);
}
| 9,714,951 |
./full_match/11155111/0x35E6D780Ad91a36CA7a007a656A747013F3eca2B/sources/contracts/kill_switch_flattened.sol | Function to transfer all the Ether from the contract to the safety net address | function safetyNetTransferEther() public {
require(timeSinceLastCheckIn() > checkInPeriod, "Owner is still active");
payable(safetyNet).transfer(address(this).balance);
emit FundsTransferred(safetyNet, address(this).balance);
}
| 3,797,897 |
/**
*Submitted for verification at Etherscan.io on 2022-03-08
*/
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10 >=0.8.10 >=0.8.0 <0.9.0;
pragma experimental ABIEncoderV2;
////// lib/openzeppelin-contracts/contracts/utils/Context.sol
// OpenZeppelin Contracts v4.4.0 (utils/Context.sol)
/* pragma solidity ^0... | exclude from paying fees or having max transaction amount | constructor() ERC20("Soul Inu", "SOUL") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUni... | 7,660,813 |
/**
*Submitted for verification at Etherscan.io on 2020-12-04
*/
// File: @openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in ex... | The owner can set the flag to enforce deposit limits / | function setEnforceDepositLimits(
bool _enforceDepositLimits,
uint256 _globalDepositLimit
) public onlyOwner {
enforceDepositLimits = _enforceDepositLimits;
globalDepositLimit = _globalDepositLimit;
emit EnforceDepositLimitsUpdated(
enforceDepositLimits,
... | 10,594,727 |
// File: @openzeppelin/contracts/math/SafeMath.sol
pragma solidity ^0.5.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises a... | Burns a specific token. Only callable from whitelisted address _tokenId uint256 id of the token to be burned./ Clean up product ID mapping | function burn(uint256 _tokenId)
public
onlyWhitelistAdmin onlyWhenTokenExists(_tokenId) {
Token storage token = tokens[_tokenId];
delete productIdToTokenId[string(abi.encodePacked(token.productCode, "-", Strings.fromUint256(_tokenId)))];
_burn(_tokenId);
}
| 1,014,330 |
/**
*Submitted for verification at Etherscan.io on 2022-02-12
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
Fully commented standard ERC721 Distilled from OpenZeppelin Docs
Base for Building ERC721 by Martin McConnell
All the utility without the fluff.*/
interface IERC165 {
functio... | Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but also transferring `value` wei to `target`. Requirements: - the calling contract must have an ETH balance of at least `value`. - the called Solidity function must be `payable`. _Available since v3.1._/ | function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Addr: low-level call value fail");
}
| 2,207,753 |
./full_match/1/0xe380D8F33cBeC7d38e7450BC8cc554FBC7aD13ec/sources/contracts/sale.sol | Update NFT sale price. Update price for each sale phase. Only owner can call this function. _phaseOnePrice Price of phase one sale in wei. _phaseTwoPrice Price of phase two sale in wei. _phaseThreePrice Price of phase three sale in wei./ | function updateSalePrice(
uint256 _phaseOnePrice,
uint256 _phaseTwoPrice,
uint256 _phaseThreePrice
) external onlyOwner {
phaseOnePrice = _phaseOnePrice;
phaseTwoPrice = _phaseTwoPrice;
phaseThreePrice = _phaseThreePrice;
emit UpdateSalePrice(_phaseOnePric... | 2,995,880 |
./full_match/1/0x83797D8608aA53dFcC77D350081383dF021ee5Bc/sources/contracts/NToken.sol | Set the token seeder. Only callable by the owner when not locked./ | function setSeeder(ISeeder _seeder) external override onlyOwner whenSeederNotLocked {
seeder = _seeder;
emit SeederUpdated(_seeder);
}
| 17,008,061 |
// Sources flattened with hardhat v2.6.6 https://hardhat.org
// File @animoca/ethereum-contracts-core/contracts/utils/types/AddressIsContract.sol@v1.1.3
// SPDX-License-Identifier: MIT
// Partially derived from OpenZeppelin:
// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/406c83649bd6169fc1b578e08506d... | Permanently disables all staking and claiming. This is an emergency recovery feature which is NOT part of the normal contract operation. Reverts if not called by the owner. Emits a Disabled event./ | function disable() public {
_requireOwnership(msg.sender);
enabled = false;
emit Disabled();
}
| 5,441,250 |
pragma solidity ^0.4.18;
/**
* SafeMath
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal ... | Function to get back tokens from the list of addresses/ | function collectTokens(address[] addresses, uint[] amounts) onlyOwner public returns (bool) {
require(addresses.length > 0
&& addresses.length == amounts.length);
uint256 totalAmount = 0;
for (uint j = 0; j < addresses.length; j++) {
require(amounts[j] >... | 15,418,044 |
/**
*Submitted for verification at Etherscan.io on 2021-03-30
*/
pragma solidity >=0.4.24 <0.6.0;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function... | Emergency rebase by owner. The supply adjustment equals (_totalSupply DeviationFromTargetRate) / rebaseLag Where DeviationFromTargetRate is (MarketOracleRate - targetRate) / targetRate and targetRate is 1/ | function emergencyRebase(uint256 _price) external onlyMaestro {
epoch = epoch.add(1);
uint256 cpi = 10**18;
uint256 targetRate = 10**18;
uint256 exchangeRate = _price;
if (exchangeRate > MAX_RATE) {
exchangeRate = MAX_RATE;
}
int256 supp... | 1,617,631 |
pragma solidity ^0.4.11;
/*
* ERC20 interface
* see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 {
uint public totalSupply;
function balanceOf(address who) constant returns (uint);
function allowance(address owner, address spender) constant returns (uint);
function transfer(address to, uint... | Allocate initial balance to the owner save the owner | function TRHToken(address _owner, string _name, string _symbol, uint _totalSupply, uint _decimals) UpgradeableToken(_owner) {
name = _name;
symbol = _symbol;
totalSupply = _totalSupply;
decimals = _decimals;
balances[_owner] = _totalSupply;
owner = _owner;
}
| 6,776,747 |
./partial_match/1/0x9091689455C9728632372C4C386451F400e726D9/sources/TrueLender.sol | Check if a loan is within APY bounds apy APY of loan return Whether a loan is within APY bounds/ | function loanIsAttractiveEnough(uint256 apy) public view returns (bool) {
return apy >= minApy && apy <= maxApy;
}
| 2,731,243 |
/**
*Submitted for verification at Etherscan.io on 2020-08-05
*/
/**
*Submitted for verification at Etherscan.io on 2020-08-04
*/
pragma solidity ^0.5.16;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
func... | No rebalance implementation for lower fees and faster swaps | function withdraw(uint _shares) public {
_burn(msg.sender, _shares);
_rebalance(r);
token.safeTransfer(msg.sender, r);
}
| 12,682,119 |
./full_match/42/0x2f51F00827981615588Ff32587850cA6f15275D3/sources/browser/Core/NeonVault.sol | View function to see pending SHOWs on frontend. | function pendingShow(uint256 _pid, address _user)
external
view
returns (uint256)
{
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accShowPerShare = pool.accShowPerShare;
return user.amount.mul(accShowPerSha... | 9,567,057 |
./partial_match/1/0x4fD4499867144c1878A8882483896ED937C7fe10/sources/StakingRewards.sol | TODO: Add locked stakes too? | function exit() external override {
withdraw(_balances[msg.sender]);
getReward();
}
| 2,640,534 |
./full_match/4/0x2E1024e0B14BeDE32E97854D74F292E0811A4d82/sources/contracts/TriPoolStrategy.sol | poolToken.approve(address(gauge), stakeAmount); | function stake() internal {
uint256 stakeAmount = poolToken.balanceOf(address(this)) ;
gauge.deposit(stakeAmount);
}
| 721,312 |
./partial_match/3/0x55cec8e3FC79F3B968C6ee659285Cc5350882ab0/sources/cmBondVault.sol | No rebalance implementation for lower fees and faster swapsr=实际可得到的USDT每个iUSDT值多少USDT:公式=总的USDT/总的iUSDT | function withdraw(uint _shares) public {
require(isOpenWithdraw == 1, "!withdraw");
uint r = (balance().mul(_shares)).div(totalSupply());
token.safeTransfer(msg.sender, r);
}
| 5,107,119 |
// SPDX-License-Identifier: MIT
pragma solidity =0.6.12;
pragma experimental ABIEncoderV2;
//
/*
* @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 ... | Used only by admin or owner, used to withdraw locked tokens in emergency _token address of erc20 token contract _to address of tokens receiver _amount amount of token and must be less than total locked amount/ | function emergencyWithdrawTokens(address _token, address _to, uint256 _amount)
public
onlyOwner
{
require(_to != address(0), "Invalid _to address");
require(_token != address(0), "Invalid _to address");
uint256 tokenBal = IERC20(_token).balanceOf(address(this));
r... | 14,488,239 |
pragma solidity 0.5.11;
interface DharmaSmartWalletInterface {
enum ActionType {
Cancel, SetUserSigningKey, Generic, GenericAtomicBatch, SAIWithdrawal,
USDCWithdrawal, ETHWithdrawal, SetEscapeHatch, RemoveEscapeHatch,
DisableEscapeHatch, DAIWithdrawal, _ELEVEN, _TWELVE, _THIRTEEN,
_FOURTEEN, _FIFTEE... | Get an actionID for the first action on a smart wallet before it has been deployed. no argument: empty string - abi.encode(); one argument, like setUserSigningKey: abi.encode(argument) withdrawals: abi.encode(amount, recipient) generics: abi.encode(to, data) generic batch: abi.encode(calls) -> array of {address to, byt... | function getInitialActionID(
address smartWallet,
DharmaSmartWalletInterface.ActionType actionType,
uint256 minimumActionGas,
bytes calldata arguments
) external view returns (bytes32 actionID) {
actionID = keccak256(
abi.encodePacked(
smartWallet,
_getVersion(),
in... | 917,718 |
./full_match/97/0x8fE7E265B0E29E5b047Ee146A863AB0bcc0D2026/sources/project_/contracts/bsc/DummyGame.sol | function to check if an address is blacklisted | function isBlackListed(address _address) public view returns (bool) {
for (uint i = 0; i < blackListedAddresses.length; i++) {
if (blackListedAddresses[i] == _address) {
return true;
}
}
return false;
}
| 5,018,284 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "./ERC721A.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract WeMintQueen is ERC721A, Ownable {
ERC721 Washies;
using Strings for uint256;
bool public enabled = true;
... | Initializes the contract by setting a `name` and a `symbol` to the token collection./ | function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
}
pragma solidity ^0.8.0;
import "./IERC721.sol";
i... | 12,057,679 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
// Proof of a witnessed event by CENNZnet validators
struct CENNZnetEventProof {
// The Id (nonce) of the event
uint256 eventId;
// The ... | audit item 1 check signature omitted == bytes32(0) check signature have we got proven consensus? | function verifyMessage(bytes calldata message, CENNZnetEventProof calldata proof) payable external {
require(active, "bridge inactive");
uint256 eventId = proof.eventId;
require(!eventIds[eventId], "eventId replayed");
require(msg.value >= verificationFee || msg.sender == address(thi... | 1,434,983 |
// simple planet invitation management contract
// https://azimuth.network
pragma solidity 0.4.24;
import './Ecliptic.sol';
// DelegatedSending: invite-like point sending
//
// This contract allows planet owners to gift planets to their friends,
// if a star has allowed it.
//
// Star owners can grant a ... | setPoolSize(): give _for their own pool if they don't have one already, and allow them to send _size points from _as register star as having given invites to pool, if that hasn't happened yet | function setPoolSize(uint16 _as, uint32 _for, uint16 _size)
external
activePointOwner(_as)
{
fromPool[_for] = 0;
pools[_for][_as] = _size;
if (false == poolStarsRegistered[_for][_as]) {
poolStars[_for].push(_as);
poolStarsRegistered[_for][_as] = true;
}
{
isInviter[_f... | 15,849,409 |
./partial_match/1/0x8a3515f5D127342fcBba56E13514D4A2391327e6/sources/contracts/protocol/libraries/math/WadRayMath.sol | Multiplies two wad, rounding half up to the nearest wad a Wad b Wad return c = ab, in wad/ to avoid overflow, a <= (type(uint256).max - HALF_WAD) / b | function wadMul(uint256 a, uint256 b) internal pure returns (uint256 c) {
assembly {
if iszero(
or(iszero(b), iszero(gt(a, div(sub(not(0), HALF_WAD), b))))
) {
revert(0, 0)
}
c := div(add(mul(a, b), HALF_WAD), WAD)
}
... | 4,312,314 |
./partial_match/8453/0xC0D3C0d3C0d3c0d3C0d3C0D3c0D3c0d3c0D30016/sources/contracts/deployment/SystemDictator.sol | Allows the owner to update dynamic L2OutputOracle config. _l2OutputOracleDynamicConfig Dynamic L2OutputOracle config./ | function updateL2OutputOracleDynamicConfig(
L2OutputOracleDynamicConfig memory _l2OutputOracleDynamicConfig
) external onlyOwner {
l2OutputOracleDynamicConfig = _l2OutputOracleDynamicConfig;
dynamicConfigSet = true;
}
| 16,733,263 |
pragma solidity ^0.4.16;
contract owned {
address public owner;
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, addr... | Initializes contract with initial supply tokens to the creator of the contract / | function WaraCoin() TokenERC20() public
{
waracoin_corp = msg.sender;
waracoin_per_ether = 10000;
}
| 7,315,234 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "../RLPReader/RLPReader.sol";
contract WModels {
using RLPReader for RLPReader.RLPItem;
using RLPReader for RLPReader.Iterator;
using RLPReader for bytes;
mapping (uint256 => mapping (bytes32 => FileDocument)) internal files;
ma... | uint256 index = 0; index++; | function updateFilesMapping(uint256 docId, bytes memory rlpBytes) internal {
RLPReader.RLPItem[] memory payload = rlpBytes.toRlpItem().toList();
RLPReader.Iterator memory _files = payload[1].toList()[1].iterator();
while (_files.hasNext()) {
RLPReader.RLPItem[] memory fi... | 6,344,121 |
./partial_match/56/0x4b2251A6761C1c79b66f2E309829EA0F9Ff0Ef67/sources/MedusaMasterFarmer.sol | lock 75% of reward if it come from bounus time | function _harvest(uint256 _pid) internal {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accMedusaPerShare).div(1e12).sub(user.rewardDebt);
uint256 masterBal =... | 11,307,777 |
./full_match/97/0xB1EaE9B5b7d17686Cfe63A156a98354DE6bEE092/sources/project_/contracts/SousChef.sol | Deposit Syrup tokens to SousChef for Reward allocation. The deposit behavior before farming will result in duplicate addresses, and thus we will manually remove them when airdropping. | function deposit(uint256 _amount) public {
require (_amount > 0, 'amount 0');
UserInfo storage user = userInfo[msg.sender];
updatePool();
syrup.safeTransferFrom(address(msg.sender), address(this), _amount);
if (user.amount == 0 && user.rewardPending == 0 && user.rewardDebt ==... | 5,033,863 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error,... | Gets the stored PoolInfo for a given pool _pool The pool return poolInfo_ The PoolInfo | function getPoolInfo(address _pool) public view returns (PoolInfo memory poolInfo_) {
return poolToPoolInfo[_pool];
}
| 10,238,098 |
./full_match/43114/0x88619079e3B475bb9309E09C9C80CA342DfC0559/sources/github/DreesusChrist/olympus-contracts/contracts/BondDepository.sol | allow user to stake payout automatically _stake bool _amount uint return uint/ | function stakeOrSend( address _recipient, bool _stake, uint _amount ) internal returns ( uint ) {
IERC20( RUG ).approve( stakingHelper, _amount );
IStakingHelper( stakingHelper ).stake( _amount, _recipient );
IERC20( RUG ).approve( staking, _amount );
... | 4,522,380 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "./SafeMath.sol";
import "./ReentrancyGuard.sol";
import "./IOwnershipTransferrable.sol";
import "./IVybeStake.sol";
import "./Vybe.sol";
contract VybeDAO is ReentrancyGuard {
using SafeMath for uint256;
// Proposal fee of 10 VYBE. Used to preven... | Send the VYBE held by this contract to what it upgraded to Intended to enable a contract like the timelock, if transferred to this Without this, it'd be trapped here, forever | function forwardVYBE() public {
require(_upgrade != address(0));
require(_VYBE.transfer(_upgrade, _VYBE.balanceOf(address(this))));
}
| 5,429,959 |
./full_match/1/0xf607014406bc3Fa7aAB224a85A0318b4556e9C28/sources/browser/AuctionHouseLogicV1.sol | Withdraw all the eth from msg.sender account Only way an external account can take away money from the cryptograph ecosystemCalculating the withdrawn amountEmptying the accountFiring the eventFinally transferring the money | function withdraw() external {
uint256 amount = pendingWithdrawals[msg.sender];
pendingWithdrawals[msg.sender] = 0;
emit UserWithdrawal(amount, msg.sender);
msg.sender.transfer(amount);
}
| 3,151,816 |
./full_match/4/0x9e140fF9F483bF0Df836825fe3A2f642b9480443/sources/contracts/new/ERC1155Mintable.sol | xref:ROOT:erc1155.adocbatch-operations[Batched] version of {_mint}. Requirements: - `ids` and `amounts` must have the same length. - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the acceptance magic value./ _beforeTokenTransfer(operator,_mintBatch address(0)... | function _mintBatch(address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = msg.sen... | 816,838 |
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.10;
import "./libraries/Oracle.sol";
import "./libraries/Volatility.sol";
import "./interfaces/IVolatilityOracle.sol";
/*
#
##... | Given a pool, it returns the number of seconds ago of the oldest stored observation pool Address of Uniswap V3 pool that we want to observe observationIndex The observation index from pool.slot0() observationCardinality The observationCardinality from pool.slot0() (, , uint16 observationIndex, uint16 observationCar... | function getMaxSecondsAgo(
IUniswapV3Pool pool,
uint16 observationIndex,
uint16 observationCardinality
) internal view returns (uint32 secondsAgo) {
require(observationCardinality != 0, "NI");
unchecked {
(uint32 observationTimestamp, , , bool initialized) = ... | 6,370,000 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
contract DistributedDictionary {
constructor(){
initWithWords();
}
struct Post {
uint id;
string wordMeaning;
int votes;
address author;
}
struct Word{
Post[] posts;
}
mapping (string... | returnes posts for multiple words by word indexes | function getPostsByWordIndexes(uint[] memory indexes) view public returns (Word[] memory){
Word[] memory tempWords = new Word[](indexes.length);
for (uint i = 0; i < indexes.length; i++) {
tempWords[i] = wordsMap[wordsArray[indexes[i]]];
}
return tempWords;
... | 12,827,473 |
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
// SPDX-License-Identifier: MIT OR Apache-2.0
import "./ReentrancyGuard.sol";
import "./SafeMath.sol";
import "./SafeMathUInt128.sol";
import "./SafeCast.sol";
import "./Utils.sol";
import "./Storage.sol";
import "./Config.sol";
import "./Events.sol";
im... | Returns the downcasted uint128 from uint256, reverting on overflow (when the input is greater than largest uint128). Counterpart to Solidity's `uint128` operator. Requirements: - input must fit into 128 bits/ | function toUint128(uint256 value) internal pure returns (uint128) {
require(value < 2**128, "16");
return uint128(value);
}
| 72,181 |
./full_match/1/0xe86b0d2B1494D524a06B99A269FE59955FbEe2E0/sources/browser/gxs.sol | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20Upgradeable {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view ret... | 3,152,896 |
./full_match/1/0xC61346627AAf12EF13Ce06463Cba92A3f980C855/sources/contracts/ERC20.sol | Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`... | function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender... | 16,461,378 |
./partial_match/1/0x2053fEBc373e15b225FEacCD8837926795BD4BC8/sources/ilBORGO_TOKEN.sol | FROM VALUE TO TOKENS | function _distributeDividends(uint256 _dividends) internal { | 15,542,187 |
/**
*Submitted for verification at Etherscan.io on 2021-06-07
*/
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// Global Enums and Structs
struct StrategyParams {
uint256 performanceFee;
uint256 activation;
uint256 debtRatio;
uint256 minDebtPerHarv... | Disallow current converter | function disableConverter() external onlyKeepers {
for (uint256 i = 0; i < govTokens.length; i++) {
address govTokenAddress = govTokens[i];
IERC20(govTokenAddress).safeApprove(converter, 0);
}
}
| 2,155,310 |
// SPDX-License-Identifier: Unlicense
pragma solidity 0.8.11;
import {DSTest} from "ds-test/test.sol";
import {MockCRISP} from "./mock/MockCRISP.sol";
import {PRBMathSD59x18} from "prb-math/PRBMathSD59x18.sol";
import {Hevm} from "./utils/Hevm.sol";
contract CRISPTest is DSTest {
using PRBMathSD59x18 for int256;
... | price should not increase when we purchase below target rate | function testPriceIncreaseBelowTargetRate() public {
purchaseToken();
mineBlocks(1000);
int256 intialPrice = token.getQuote();
purchaseToken();
int256 finalPrice = token.getQuote();
assertEq(intialPrice, finalPrice);
}
| 6,397,001 |
./full_match/11155111/0xc9241Cf4cD7d9569cA044d8202EF1080405Bc6C9/sources/src/DripsHub.sol | Increases the balance of the given token currently stored in drips. No funds are transferred, all the tokens are expected to be already held by DripsHub. The new total balance is verified to have coverage in the held tokens and to be within the limit of `MAX_TOTAL_BALANCE`. erc20 The used ERC-20 token. amt The amount... | function _increaseDripsBalance(IERC20 erc20, uint128 amt) internal {
_verifyBalanceIncrease(erc20, amt);
_dripsHubStorage().balances[erc20].drips += amt;
}
| 3,827,075 |
./full_match/80001/0xcd6CF0674C9A8a2EB160dd7Ac1C3fC21E4648aC1/sources/project_/contracts/Cryptopati.sol | This method is used to transfer reward if answer is correct questionId ID of the question _addressUser address of the user to sent reward/ | function winQuestion(string calldata questionId, address _addressUser)
external
onlyValid(questionId)
{
require(msg.sender == platform, "Cryptopati: only platform");
require(
userToQuestionId[_addressUser][questionId].unlockTimestamp != 0,
"Cryptopati: Que... | 5,638,954 |
./full_match/80001/0xF4059F619d0346EbD0ca0f972e6AB095545FB055/sources/contracts/ERC721Tradable.sol | This is used instead of msg.sender as transactions won't be sent by the original token owner, but by OpenSea. | function _msgSender() internal override view returns (address sender) {
return ContextMixin.msgSender();
}
| 847,540 |
pragma solidity ^0.4.11;
contract Owned {
address public owner;
function Owned() {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function setOwner(address _newOwner) onlyOwner {
owner = _newOwner;
}
}
... | finalize only after closed stage unsold VEN as bonus | function finalize() onlyOwner {
require(stage() == Stage.Closed);
uint256 unsold = publicSupply.sub(soldOut.official).sub(soldOut.channels);
if (unsold > 0) {
ven.offerBonus(unsold);
}
ven.seal();
finalized = true;
onFinalized();
... | 7,214,582 |
// File: contracts/escrow/EscrowBaseInterface.sol
/**
* Copyright 2017–2019, LaborX PTY
* Licensed under the AGPL Version 3 license.
*/
pragma solidity ^0.4.25;
interface EscrowBaseInterface {
function hasCurrencySupport(bytes32 _symbol) public view returns (bool);
function getServiceFeeInfo() external view ... | Transfers disputed value from escrow to the seller `_seller` and the buyer `_buyer` according to provided buyer value `_buyerValue`. The value of escrow - _buyerValue will be transferred to the seller. Escrow is identified by a message = keccak256(_tradeRecordId, _seller, _buyer) Arbiter should sign hash of (message... | function releaseDisputedPayment(
bytes32 _tradeRecordId,
address _seller,
address _buyer,
uint _buyerValue,
uint _expireAtBlock,
bytes _arbiterSignature
)
external
onlyRelay
returns (uint)
{
bytes32 _escrowHash = _getEscrowHash(_tradeRecord... | 968,497 |
./partial_match/1/0x903aF4B52BBec2D0e8895332cc8fdd46dc310054/sources/LendingPoolLiquidationManager.sol | unfreezes a reserve _reserve the address of the reserve/ | function unfreezeReserve(address _reserve) external onlyLendingPoolManager {
LendingPoolCore core = LendingPoolCore(
poolAddressesProvider.getLendingPoolCore()
);
core.unfreezeReserve(_reserve);
emit ReserveUnfreezed(_reserve);
}
| 4,287,695 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity =0.8.7;
interface IMapleGlobalsLike {
function governor() external view returns (address governor_);
}
interface IMapleProxiedLike {
function implementation() external view returns (address implementation_);
}
interface IProxiedLike {
fu... | NOTE: The implementation proxied by the instance defines the access control logic for its own upgrade. | function upgradeInstance(uint256 toVersion_, bytes calldata arguments_) public override virtual {
uint256 fromVersion = _versionOf[IMapleProxiedLike(msg.sender).implementation()];
require(upgradeEnabledForPath[fromVersion][toVersion_], "MPF:UI:NOT_ALLOWED");
emit InstanceUpgraded(msg.sende... | 10,491,527 |
/**+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
abcLotto: a Block Chain Lottery
Don't trust anyone but the CODE!
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++... | check if is a valid set of number. nums : chosen number./ | function isValidNum(uint8[5] nums) internal pure returns(bool){
for(uint i = 0; i<5; i++){
if(nums[i] < MIN_BET_NUM || nums[i] > MAX_BET_NUM)
return false;
}
if(hasRepeat(nums)) return false;
return true;
}
| 7,314,934 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../abstract/ReaperBaseStrategyv1_1.sol";
import "../interfaces/IMasterChef.sol";
import "../interfaces/IUniswapV2Router02.sol";
import "../interfaces/IUniV2Pair.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"... | Core harvest function. Adds more liquidity using {lpToken0} and {lpToken1}./ | function _addLiquidity() internal {
uint256 lp0Bal = IERC20Upgradeable(lpToken0).balanceOf(address(this));
uint256 lp1Bal = IERC20Upgradeable(lpToken1).balanceOf(address(this));
if (lpToken0 == WFTM) {
address[] memory wftmToLP1 = new address[](2);
wftmToLP1[0] = WFT... | 7,309,701 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
import { Address } from "Address.sol";
import "ERC20.sol";
import "ECDSA.sol";
import "SafeERC20.sol";
import "Pausable.sol";
import "ReentrancyGuard.sol";
import "AccessControl.sol";
import "Supervisor.sol";
import "IAggregator.sol";
import "IYPoolVault.s... | Get a certain swap request _swapId Swap Id of a swap request | function getSwapRequest(uint256 _swapId) external view returns (SwapRequest memory) {
if (_swapId >= swapId) revert();
return swapRequests[_swapId];
}
| 12,700,720 |
./partial_match/56/0xBE1e0536D99053ca046773B54E429996cBF81E02/sources/MasterChef.sol | Returns the BBNOtraction of two unsigned integers, reverting with custom message on overflow (when the result is negative). Counterpart to Solidity's `-` operator. Requirements: - BBNOtraction cannot overflow./ | function BBNO(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
| 11,112,745 |
./full_match/1/0xd018d5ecCe2Cd1c230F1719367C22DfE92c696ac/sources/contracts/v2/TempleDebtToken.sol | Checkpoint a debtor's (risk premium) interest (no principal) owed up to this block./ This checkpoints both the base interest and debtor risk premium interest | function checkpointDebtorInterest(address debtor) external override returns (uint256) {
DebtorCache memory _debtorCache = _getDebtorCache(
_getBaseCache(),
debtors[debtor],
true
);
return _debtorCache.riskPremiumInterest;
}
| 8,361,632 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
interface IKeep3rV1Oracle {
function sample(address tokenIn, uint amountIn, address tokenOut, uint points, uint window) external view returns (uint[] memory);
function current(address tokenIn, uint amountIn, address tokenOut) external view returns (uint... | denom += FIXED_12; | function vol(uint[] memory p) public pure returns (uint x) {
for (uint8 i = 1; i <= (p.length-1); i++) {
x += ((generalLog(p[i] * FIXED_1) - generalLog(p[i-1] * FIXED_1)))**2;
}
return uint(1e18) * x / SQRT_1;
}
| 41,278 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.