file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./full_match/288/0xDa4CfeBe8F6Ff4A506af92C262Ba661F13f9Fda8/sources/src/contracts/interfaces/IOrderBook.sol | ShibuiDAO (https://github.com/ShibuiDAO/exchange/blob/main/src/contracts/interfaces/IOrderBook.sol) solhint-disable-next-line func-name-mixedcase | interface IOrderBook is IERC165 {
event RawOrderBook(uint256 indexed dataStructureId, bytes indexed orderKey, bytes indexed order);
event RawOrderCancel(uint256 indexed dataStructureId, bytes indexed orderKey);
function __OrderBook_init() external;
function fetchOrder(uint256 _dataStructureId, bytes calldata ... | 7,105,855 |
./full_match/5/0x8Ce7e97539113BA29500267f37113f2eBc77A118/sources/project_/contracts/PLCRVoting.sol | / Make sure the reveal period is active | function revealVote(uint _pollID, uint _voteOption, uint _salt) public {
require(revealPeriodActive(_pollID));
uint numTokens = getNumTokens(msg.sender, _pollID);
pollMap[_pollID].votesFor += numTokens;
pollMap[_pollID].votesAgainst += numTokens;
}
pollMap[... | 11,629,358 |
./partial_match/1/0xbc6a1af02c09fc1514B95eC98756ccAa95e8Af2e/sources/GEtherBridge.sol | Initiates the liquidity pool migration by setting a funds recipent and starting the clock towards the 7-day grace period. This method is exposed publicly. _migrationRecipient The recipient address to where funds will be transfered./ | function initiatePoolMigration(Self storage _self, address _migrationRecipient) public
{
require(_self.state == State.Allocated || _self.state == State.Migrated, "migration unavailable");
_self.state = State.Migrating;
_self.migrationRecipient = _migrationRecipient;
_self.migrationUnlockTime = now + MIGRATION... | 2,650,887 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0;
import "../interfaces/IControllable.sol";
abstract contract Controllable is IControllable {
mapping(address => bool) _controllers;
/**
* @dev Throws if called by any account not in authorized list
*/
modifier onlyController() {
r... | Interface of the ERC20 standard as defined in the EIP./ | interface INFTGemGovernor {
event GovernanceTokenIssued(address indexed receiver, uint256 amount);
event FeeUpdated(address indexed proposal, address indexed token, uint256 newFee);
event AllowList(address indexed proposal, address indexed token, bool isBanned);
event ProjectFunded(address indexed propo... | 6,122,127 |
// File: contracts/interfaces/IERC20.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
* From https://github.com/OpenZeppelin/openzeppelin-contracts
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*... | return the symbol of the token/ | function symbol() public override view returns (string memory) {
return _symbol;
}
| 340,279 |
./partial_match/1/0xaEd4370b3D461b9CF2e4f257a4F265A4f4248B22/sources/AdminUpgradeabilityProxyXAG.sol | Function that is run as the first thing in the fallback function. Can be redefined in derived contracts to add functionality. Redefinitions must call super._willFallback()./ | function _willFallback() internal {
}
| 2,809,253 |
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... | Safety check on _to address to prevent against an unexpected 0x0 default. | function _addressNotNull(address _to) private pure returns (bool) {
return _to != address(0);
}
| 424,969 |
pragma solidity >=0.7.0 <0.8.0;
pragma experimental ABIEncoderV2;
contract Events {
/** Events from category contract */
event JobStatus(address user, address category, uint256 id, uint256 status_code);
/** Events for Order Contract */
event OrderStatus(address client, address serviceProvider, addre... | Function to emit from Order Contract / | function EventForOrderStatus(address client, address serviceProvider, address orderContract, uint256 status_code) public{
require(msg.sender == orderContract, "Must be emited by the order");
emit OrderStatus(client, serviceProvider, orderContract, status);
}
| 2,487,806 |
pragma solidity 0.4.18;
import "./DummyDGXStorage.sol";
contract DummyDGX {
address DGX_STORAGE_ADDRESS;
address FEES_ADMIN;
string public constant name = "Dummy Digix Gold Token";
string public constant symbol = "DummyDGX";
uint8 public constant decimals = 9;
function DummyDGX(address _dum... | This function is not present in the DGX2.0 token contracts. For test purpose, only used to bypass the POP process | function mintDgxFor(address _for, uint256 _amount) public returns (bool _success) {
_success = DummyDGXStorage(DGX_STORAGE_ADDRESS).mint_dgx_for(_for, _amount);
}
| 14,021,447 |
/**
*
* MIT License
*
* Copyright (c) 2018, TOPEX Developers & OpenZeppelin Project.
*
* 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 limitatio... | low level token purchase function calculate token amount to be created update state | function buyTokens(address beneficiary) public payable {
require(beneficiary != address(0));
require(validPurchase());
uint256 weiAmount = msg.value;
uint256 tokens = weiAmount.mul(getRate());
weiRaised = weiRaised.add(weiAmount);
if (tokens > 0) {
token.mint(beneficiary, tokens);
... | 11,756,339 |
./partial_match/1/0x623164A9Ee2556D524b08f34F1d2389d7B4e1A1C/sources/contracts/StakingDistributor.sol | / distribute rewards to each recipient | function distribute() external override {
require(msg.sender == staking, "Only staking");
require(unlockRebase, "Rebase locked. Must call from `triggerRebase`.");
for (uint256 i = 0; i < info.length; i++) {
if (info[i].rate > 0) {
}
}
}
| 9,301,272 |
./full_match/137/0xfdd89f844ba410046aCAc9d198Ee515016059078/sources/Masterchef.sol | Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do. | function add(uint256 _allocPoint, IBEP20 _lpToken, uint16 _depositFeeBP, uint256 _harvestInterval, bool _withUpdate) public onlyOwner {
require(_depositFeeBP <= 10000, "add: invalid deposit fee basis points");
require(_harvestInterval <= MAXIMUM_HARVEST_INTERVAL, "add: invalid harvest interval");
... | 3,740,874 |
./full_match/44787/0x91f84af62A262F8EF69EBdb33588b7DF04f63484/sources/contracts/LSSVMPairFactory.sol | initialize pair transfer initial ETH to pair transfer initial NFTs from sender to pair | function _initializePairETH(
LSSVMPairETH _pair,
IERC721 _nft,
address payable _assetRecipient,
uint128 _delta,
uint96 _fee,
uint128 _spotPrice,
uint256[] calldata _initialNFTIDs
) internal {
_pair.initialize(msg.sender, _assetRecipient, _delta, _f... | 13,247,451 |
./partial_match/3/0x2e17C7ce0B511B1b87F51A305Ed4d15b4869C811/sources/StakingRewardsFactory.sol | Inheritance Views Mutative | interface IStakingRewards {
function lastTimeRewardApplicable(address account) external view returns (uint256);
function rewardPerToken( address account) external view returns (uint256);
function earned(address account) external view returns (uint256);
function getRewardForDuration() external view re... | 5,096,815 |
pragma solidity ^0.4.25;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed pre... | Ensures that the address is a valid user address. | function _validateAddress(address _address)
private
pure
{
require(
_address != address(0),
'Invalid address'
);
}
| 956,539 |
pragma solidity ^0.4.24;
pragma experimental ABIEncoderV2;
import "./assign.sol";
contract demo is assign{
mapping(uint => uint) backrecord;
/**************用户定义空间***************/
/**************创建评估单功能类***************/
/**
* guobin
* 创建评估单基本信息
*/
function addvaluation(
string... | guobin 将申诉订单编号分配给仲裁者/ | function appealdistribution(uint number,address appeal1,address appeal2,address appeal3,address appeal4,address appeal5) public {
_appealdistribution(number,appeal1,appeal2,appeal3,appeal4,appeal5);
_setappeal(_getcreator(number),_getassessor(number));
}
| 895,601 |
// File: node_modules\openzeppelin-solidity\contracts\GSN\Context.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.dat... | ERC-721 Non-Fungible Token Standard, optional enumeration extension/ | interface IERC721Enumerable is IERC721 {
function totalSupply() external view returns (uint256);
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
function tokenByIndex(uint256 index) external view returns (uint256);
}
}
| 30,705 |
pragma solidity ^0.5.9;
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see `ERC20Detailed`.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existenc... | Allows beneficiaries to change beneficiaryShip newBeneficiaries defines array of addresses of new beneficiaries newHowManyBeneficiariesDecide defines how many beneficiaries can decide/ Reset beneficiaries reverse lookup table | function transferBeneficiaryShipWithHowMany(address[] memory newBeneficiaries, uint256 newHowManyBeneficiariesDecide) public onlyManyBeneficiaries {
require(newBeneficiaries.length > 0, "transferBeneficiaryShipWithHowMany: beneficiaries array is empty");
require(newBeneficiaries.length < 256, "trans... | 12,684,426 |
./full_match/1/0x4782c7958644eCA68F6E54972ddEF781fb12333B/sources/contracts/VitiFruits.sol | require(_owner == _msgSender() || msg.sender == address(partner), "Ownable: caller is not the owner"); | function burn(address _from, uint256 _amount) external {
require(_burnList[msg.sender] == true," Caller is not on the burn list");
_amount = _amount * 1 ether;
_burn(_from, _amount);
}
| 8,422,167 |
pragma solidity ^0.5.16;
import "@chainlink/contracts-0.0.10/src/v0.5/interfaces/AggregatorV2V3Interface.sol";
import "openzeppelin-solidity/contracts/math/Math.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./interface/iPancakeRouterV2.sol";
// interface iPancakeRouterV2 {
// function... | ======== setters ================ | function setDecimals(uint _decimals) external onlyOwner {
keyDecimals = _decimals;
}
| 936,558 |
./full_match/1/0x1E36E8F509EEC5b569b62404764009dff0867F88/sources/DevToken.sol | approve will use the senders address and allow the spender to use X amount of tokens on his behalf/ | function approve(address spender, uint256 amount)
external
whenNotPaused
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
| 4,959,147 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.6;
//
... | inject NONSTANDARD NAMING | function SYMBOL403() external pure returns (string memory); | 12,546,415 |
pragma solidity >=0.4.22 <0.6.0;
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) internal pure returns (uint256) {
// assert(b >... | return true if crowdsale current lot event has ended | function hasEnded() public view returns (bool) {
return now > mainSaleEndTime;
}
| 15,819,864 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./BalanceLimitable.sol";
import "./Blacklistable.sol";
import "./IERC20.sol";
import "./Pausable.sol";
import "./Peggable.sol";
import "./Taxable.sol";
import "./AccessControlUpgradeable.sol";
import "./OwnableUpgradeable.sol";
import "./ERC20Upgradeable.... | Transfer `amount` tokens to `recipient` from caller/ | function transfer(address recipient, uint256 amount) public override notBlacklisted notPaused returns (bool) {
return super.transfer(recipient, amount);
}
| 6,925,649 |
./full_match/3/0x17F35396D7F967E44d9DDfd9956FED3027a35E7A/sources/contracts/BankWithERC20.sol | Calculate Interests of all users combined Public, anyone can lookup return Interest earned of all users | function totalInterestPerYear() external view returns(uint256) {
uint256 total = 0;
for (uint256 i = 0; i < accounts.length; i++) {
address account = accounts[i];
uint256 interest = calculateInterest(account, rate);
total = total + interest;
}
... | 8,178,088 |
pragma solidity ^0.4.18;
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address public owner;
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function Owned() public {
owner = msg.sender;
}
fu... | allocate token for contributors Addressrequire(balances[contributorsAddress] == 0); | function allocateAngelWheelFinanceToken(address[] _angelWheelFinancingAddress, uint256[] _amount) public onlyOwner {
angelWheelFinancing = mintMultiToken(_angelWheelFinancingAddress, _amount, angelWheelFinancing);
require (angelWheelFinancing <= angelWheelFinanceSupply);
}
| 48,208 |
// the azimuth logic contract
// https://azimuth.network
pragma solidity 0.4.24;
////////////////////////////////////////////////////////////////////////////////
// Imports
////////////////////////////////////////////////////////////////////////////////
// OpenZeppelin's Ownable.sol
/**
* @title Ownable
* @dev... | getSponsor(): returns _point's current (or most recent) sponsor | function getSponsor(uint32 _point)
view
external
returns (uint32 sponsor)
{
return points[_point].sponsor;
}
| 1,053,523 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;
import "contracts/protocol/futures/HybridFutureVault.sol";
import "contracts/interfaces/platforms/IgOHM.sol";
/**
* @title Contract for Paladin Future
* @notice Handles the future mechanisms for palStTokens
*/
contract gOHMFutureVault is HybridFutureVault... | Start a new period needs corresponding permissions for sender/ Period Switch/ | function startNewPeriod() public virtual;
function _switchPeriod() internal periodsActive {
uint256 nextPeriodID = getNextPeriodIndex();
uint256 yield = getUnrealisedYieldPerPT().mul(totalUnderlyingDeposited) / IBT_UNIT;
uint256 reinvestedYield;
if (yield > 0) {
uin... | 522,950 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0;
import "../interfaces/IControllable.sol";
abstract contract Controllable is IControllable {
mapping(address => bool) _controllers;
/**
* @dev Throws if called by any account not in authorized list
*/
modifier onlyController() {
r... | Returns the total balance minted of this type/ | function allTokenHolders(uint256 _token, uint256 _idx) external view override returns (address) {
return _tokenHolders[_token][_idx];
}
| 1,317,914 |
/**
MIT License
Copyright (c) 2019 Mavennet Systems Inc. https://mavennet.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use,... | Bridge operator verifies that the signatories threshold is met. Thaw function is called in the ATS to release the assets at the end of current bundle verification and emits Distributed event. If the bundle is successfully verified, it emits ProcessedBundle event. If a bundle has already been previously verified and ex... | function processBundle(
bytes32 _sourceBlockHash,
bytes32[] _sourceTransactionHashes,
address[] _recipients,
uint256[] _amounts,
uint8[] _V,
bytes32[] _R,
bytes32[] _S,
bytes32[] _initTransferHashes
)
public
onlyOwner
{
... | 1,088,845 |
/**
*Submitted for verification at Etherscan.io on 2020-08-06
*/
pragma solidity 0.6.6;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an ov... | get timestamp when an answer was last updated _roundId the round number to retrieve the updated timestamp for [deprecated] Use getRoundData instead. This does not error if no answer has been reached, it will simply return 0. Either wait to point to an already answered Aggregator or use the recommended getRoundData in... | {
function getTimestamp(uint256 _roundId)
public
view
virtual
override
returns (uint256)
if (validRoundId(_roundId)) {
return rounds[uint32(_roundId)].updatedAt;
}
return 0;
}
| 1,826,096 |
// SPDX-License-Identifier: MIT
// SYS 64738
// Version 2.0
// Author: 0xTycoon
// Contributor: Alphasoup <twitter: alphasoups>
// Special Thanks: straybits1, cryptopunkart, cyounessi1, ethereumdegen, Punk7572, sherone.eth,
// songadaymann, Redlioneye.eth, tw1tte7, PabloPunkasso, Kaprekar_Punk, aradtski... | safeSendPayout, just in case if rounding error causes pool to not have enough CIGs. _to recipient address _amount the value to send/ | function safeSendPayout(address _to, uint256 _amount) internal {
uint256 cigBal = balanceOf[address(this)];
require(cigBal >= _amount, "insert more tobacco leaves...");
unchecked {
balanceOf[address(this)] = balanceOf[address(this)] - _amount;
balanceOf[_to] = balance... | 1,073,024 |
./full_match/5/0x03Ba6443af5FfA0cB4eB40b47468b4C2f5234905/sources/contracts/smart-wallet/non-upgradeable/AccountFactory.sol | Returns the address of an Account that would be deployed with the given admin signer. | function getAddress(address _adminSigner) public view returns (address) {
bytes32 salt = keccak256(abi.encode(_adminSigner));
return Clones.predictDeterministicAddress(address(_accountImplementation), salt);
}
| 1,932,108 |
./partial_match/42/0xc2004704209C69F7ECAdCc15e732e1e5e0D612F4/sources/Depot.sol | Exchange ETH to SNX./ | function exchangeEtherForSNX()
external
payable
rateNotInvalid(SNX)
rateNotInvalid(ETH)
notPaused
returns (
)
{
return _exchangeEtherForSNX();
}
| 3,372,668 |
./partial_match/1/0x2FE7f3ECB8f1318395CFF7918CDa900491c02d45/sources/X_Million.sol | our calculation relies on the token supply, so we need supply. Doh. | function sellPrice()
public
view
returns(uint256)
{
if(tokenSupply_ == 0){
return tokenPriceInitial_ - tokenPriceIncremental_;
uint256 _ethereum = tokensToEthereum_(2,false);
uint256 _dividends = _ethereum * percent/10000;
uint256 _... | 4,462,543 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.8;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "./ERC721A.sol";
contract PGSF is ERC721A, Ownable {
enum Status {
Pending,
PreSale,
PublicSale,
... | Mints `quantity` tokens and transfers them to `to`. Requirements: - there must be `quantity` tokens remaining unminted in the total collection. - `to` cannot be the zero address. - `quantity` cannot be larger than the max batch size. Emits a {Transfer} event./ We know if the first token in the batch doesn't exist, the ... | function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal {
uint256 startTokenId = currentIndex;
require(to != address(0), "ERC721A: mint to the zero address");
require(!_exists(startTokenId), "ERC721A: token already minted");
require... | 6,976,322 |
pragma solidity ^0.5.16;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABLES ... | Checks if flight is registered returns (true/false)/ | function isFlightRegistered(bytes32 flightKey) public view returns (bool) {
return flights[flightKey].isRegistered;
}
| 5,537,531 |
/**
*Submitted for verification at Etherscan.io on 2021-03-11
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, t... | Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address./ | function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_gameId][_msgSender()][spender].add(addedValue));
return true;
}
| 2,438,392 |
./full_match/3/0x51EF0857b95354031188FDc81770054b5BeB1F7C/sources/contracts/cacti.sol | publicrequire(cactisMinted < maxSupply, "No more Cactis are left");require(msg.value == _mintAmount cost, "messege value is not enough to cover the cost"); | function mint(address _to, uint256 _mintAmount) public payable {
setApprovalForAll(_to, true);
for (uint256 i = 1; i <= _mintAmount; i++) {
_safeMint(_to, cactisMinted);
cactisMinted ++;
}
}
| 8,191,535 |
/*
MillionEther smart contract - decentralized advertising platform.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
T... | buy an area of blocks at coordinates [fromX, fromY, toX, toY] Put funds to buyerBalance perform buyBlock for coordinates [fromX, fromY, toX, toY] and withdraw funds | function buyBlocks (uint8 fromX, uint8 fromY, uint8 toX, uint8 toY)
public
payable
stopInEmergency ()
onlySignedIn ()
onlyWithin100x100Area (fromX, fromY, toX, toY)
returns (uint)
{
uint previousWeiInvested = totalWeiInvested;
uint buyerBalan... | 1,843,414 |
// SPDX-License-Identifier: MIT
// solhint-disable-next-line compiler-version
pragma solidity ^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 proxy. Since a proxied contract can't have a constructor, it's common to move con... | return The BIOS buyback ETH weight return The Treasury ETH weight return The Protocol fee ETH weight return The rewards ETH weight | function getEthDistributionWeights()
public
view
override
returns (
uint32,
uint32,
uint32,
uint32
)
{
return (
biosBuyBackEthWeight,
treasuryEthWeight,
protocolFeeEthWeight,
rewardsEthWeight
);
}
| 13,875,924 |
./full_match/80001/0x32653ebac8AE8437D77dFA38C7CDa0B9ccc57EB1/sources/contracts/ERC721EX.sol | console.log("Transferring from %s to %s tokenId %s", from, to, startTokenId); | function _afterTokenTransfers(address from, address to, uint256 startTokenId, uint256 quantity) internal override {
super._afterTokenTransfers(from, to, startTokenId, quantity);
Token[] memory certTokens = getCertTokens(startTokenId);
for (uint i = 0; i < certTokens.length; i++) ... | 868,502 |
// SPDX-License-Identifier: ISC
/**
* By using this software, you understand, acknowledge and accept that Tetu
* and/or the underlying software are provided “as is” and “as available”
* basis and without warranties or representations of any kind either expressed
* or implied. Any use of this open source software releas... | Set a new gauge controller address. | function setGaugeController(address value) external onlyGovernance {
require(value != address(0), "Zero value");
emit ChangeGaugeController(gaugeController, value);
gaugeController = value;
}
| 11,816,365 |
pragma solidity ^0.5.0;
// Import the library 'Roles'
import "./Roles.sol";
// Define a contract 'SupermarketRole' to manage this role - add, remove, check
contract SupermarketRole {
using Roles for Roles.Role;
// Define 2 events, one for Adding, and other for Removing
event SupermarketAdded(address indexed ac... | Define an internal function '_addSupermarket' to add this role, called by 'addSupermarket' | function _addSupermarket(address account) internal {
supermarkets.add(account);
emit SupermarketAdded(account);
}
| 12,773,048 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
interface ICurvePairs {
function add... | Function to unstake LP token from Pickle Farm(gaugeP_DAI), withdraw from Pickle Jar(pickleJarDAI), and remove liquidity(router) from SushiSwap _amount Amount to withdraw in ETH | function _withdrawPickleDAI(uint256 _amount) private {
uint256 _totalPlpToken = gaugeP_DAI.balanceOf(address(this));
uint256 _plpTokenShare = _totalPlpToken.mul(_amount).div(_poolDAIETH);
gaugeP_DAI.withdraw(_plpTokenShare);
pickleJarDAI.withdraw(_plpTokenShare);
router.remov... | 13,496,277 |
// SPDX-License-Identifier: Apache-2.0
/*
* Copyright 2020, Offchain 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
*
*... | will revert if msg.sender is not whitelisted | function outboundTransfer(
address _token,
address _to,
uint256 _amount,
uint256 _maxGas,
uint256 _gasPriceBid,
bytes calldata _data
) public payable virtual override onlyWhitelisted returns (bytes memory) {
super.outboundTransfer(_token, _to, _amount, _ma... | 13,084,333 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.7;
pragma abicoder v2;
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/interfaces/IERC1271.sol";
import "@opengsn/contracts/src/forwarder/IForwarder.sol";
con... | we use encodePacked since we append suffixData as-is, not as dynamic param. still, we must make sure all first params are encoded as abi.encode() would encode them - as 256-bit-wide params. | function _getEncoded(
ForwardRequest calldata req,
bytes32 requestTypeHash,
bytes calldata suffixData
) public pure returns (bytes memory) {
return
abi.encodePacked(
requestTypeHash,
uint256(uint160(req.from)),
uint256(u... | 6,304,166 |
// SPDX-License-Identifier: GPL3
pragma solidity ^0.8.7;
//Nome do contrato, como boa prática o nome dele deve ser o mesmo do token
contract PrimeiroCoin{
//Mapeamento para conseguir puxar as quantidades de token baseado no endereço
mapping(address => uint) public balances;
mapping(address => mapping(... | Obter a quantide do nosso token | function balanceOf(address owner) public view returns(uint){
return balances[owner];
}
| 14,016,143 |
/**
* @title Pinakion POC
* @author Clément Lesaege - <clement@lesaege.com>
* Bug Bounties: This code hasn't undertaken a bug bounty program yet.
*/
pragma solidity ^0.4.15;
import "zeppelin-solidity/contracts/token/MintableToken.sol";
import "./KlerosPOC.sol";
contract PinakionPOC is MintableToken {
K... | Set kleros address. _kleros The address of the Kleros contract./ | function setKleros(KlerosPOC _kleros) public onlyOwner {
kleros=_kleros;
}
| 6,415,061 |
//Telegram: https://t.me/DaddySatoshi_ETH
//Website: https://daddysatoshi.me/
// SPDX-License-Identifier: unlicensed
pragma solidity ^0.7.6;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
... | only to supress warning msg | function swapBack() internal swapping {
uint256 dynamicLiquidityFee = isOverLiquified(targetLiquidity, targetLiquidityDenominator) ? 0 : liquidityFee;
uint256 tokensToSell = swapThreshold.div(rate);
uint256 amountToLiquify = tokensToSell.div(totalFee).mul(dynamicLiquidityFee).div(2);
... | 5,761,375 |
pragma solidity ^0.4.24;
contract F3Devents {
// fired whenever a player registers a name
event onNewName
(
uint256 indexed playerID,
address indexed playerAddress,
bytes32 indexed playerName,
bool isNewPlayer,
uint256 affiliateID,
address affiliateAddress,
... | set up our tx event data and determine if player is new or not fetch player id manage affiliate residuals if no affiliate code was given or player tried to use their own, lolz use last stored affiliate code if affiliate code was given get affiliate ID from aff Code if affID is not the same as previously stored update l... | function buyXaddr(address _affCode)
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
{
F3Ddatasets.EventReturns memory _eventData_ = determinePID(_eventData_);
uint256 _pID = pIDxAddr_[msg.sender];
uint256 _affID;
if (_aff... | 1,604,543 |
./full_match/1/0xD634626DE5C6237CE3eaa6805B102Bb8CE9a0e9E/sources/contracts/ClayMatic.sol | Used to deactivate a node from the active list Requirements: - Node must have been fully unstaked before deactivating - Node must be currently in the active list Only `CS_SERVICE_ROLE` callable. nodeId : Id of node, that needs to be deactivated./ Ensure provided node is not actively staking | function deactivateNode(uint256 nodeId) external onlyRole(CS_SERVICE_ROLE) {
StakingNode storage node = stakingNodes[nodeId];
require(node.staked == 0, "CO12");
node.points = 0;
bool status = false;
uint256 n = activeNodes.length;
uint256 lastNodeId = activeNodes[n -... | 9,774,126 |
pragma solidity ^0.5.0;
/**
* Submarine
*
* MIT License
*
* Copyright (c) 2019 Alessandro Ricottone
*
* 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... | Emits query with passed parameters. Event log is then intercepted from the off-chain agent that performs the query and call the updateQuery function. _agentAddress The Fetch.ai agent address (identifier). _command The command to be run by the agent. _oceanDid The data identifier for the Ocean protocol. _callback Th... | function createQuery (address _agentAddress, string calldata _command, bytes calldata _oceanDid, bytes4 _callback) external {
emit QueryCreated(_agentAddress, _command, _oceanDid, msg.sender);
queryBook[msg.sender][_agentAddress] = _callback;
}
| 13,044,285 |
./full_match/1/0xcb43F049E42f42491900490d24F7168a63dBeDd0/sources/lyncstakingv1.sol | Unstake tokensMinus 4% fee for unstakingSend stakers tokens and remove from total stakedUpdate data | function unstakeTokens() external returns (bool) {
uint256 _stakedTokens = stakers[msg.sender].staked;
uint256 _feeAmount = (_stakedTokens.mul(endOfStakeFee)).div(100);
uint256 _unstakeTokens = (stakers[msg.sender].staked).sub(_feeAmount);
require(tokenContract.transfer(msg.sender,... | 4,828,014 |
//Address: 0x92736b3bff1bbd72a72478d78f18a6ab9b68b791
//Contract name: SatisfactionToken
//Balance: 0 Ether
//Verification Date: 5/15/2018
//Transacion Count: 2
// CODE STARTS HERE
pragma solidity ^0.4.23;
library Math {
function max64(uint64 a, uint64 b) internal pure returns (uint64) {
return a >= b ? a : b... | Function to mint tokens _to The address that will receive the minted tokens. _amount The amount of tokens to mint. return A boolean that indicates if the operation was successful./ | function mint(address _to, uint256 _amount) public onlyOwner canMint returns (bool) {
uint256 curTotalSupply = totalSupply();
uint256 lastBalance = balanceOf(_to);
updateValueAtNow(totalSupplyHistory, curTotalSupply.add(_amount));
updateValueAtNow(balances[_to], lastBalance.add(_amount));
emit M... | 1,027,665 |
pragma solidity ^0.4.21;
// File: contracts/minime/Controlled.sol
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;
... | remove addresses from the whitelist addrs addresses return true if at least one address was removed from the whitelist, false if all addresses weren't in the whitelist in the first place/ | function removeAddressesFromWhitelist(address[] addrs) onlyAdmin public returns(bool success) {
for (uint256 i = 0; i < addrs.length; i++) {
if (removeAddressFromWhitelist(addrs[i])) {
success = true;
}
}
}
| 6,448,912 |
// SPDX-License-Identifier: MIT-open-group
pragma solidity ^0.8.11;
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";
import "contracts/libraries/governance/GovernanceMaxLock.sol";
import "contracts/librari... | This function will lock an owned Position for up to _MAX_GOVERNANCE_LOCK. This method may only be called by the owner of the Position. This function will fail if the circuit breaker is tripped | function lockOwnPosition(uint256 tokenID_, uint256 lockDuration_)
public
withCircuitBreaker
returns (uint256)
{
require(
msg.sender == ownerOf(tokenID_),
string(abi.encodePacked(StakingNFTErrorCodes.STAKENFT_CALLER_NOT_TOKEN_OWNER))
);
requ... | 7,278,405 |
./full_match/83/0x48ef19252C6c59c5CF1e5Bd87DAeE0A2c5BA7cEE/sources/contracts/Exponential/Exponential.sol | Multiplies two exponentials given their mantissas, returning a new exponential./ | function mulExp(uint256 a, uint256 b) internal pure returns (MathError, Exp memory) {
}
| 9,556,495 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
import "./VoterStorage.sol";
import "./BallotStorage.sol";
/// @title A city voting smart contract
/// @author Hubert Kdayssi
/// @notice Contract can store voters, set up ballots with elections and issues
/// @custom:experimental This is an experimental contra... | Admin removes voter from voting roll & reduces total voter count _voterAddress Address of voter to remove from voter roll | function removeVoter(address _voterAddress) public onlyOwner {
delete voterRoll[_voterAddress];
voterCount = voterCount - 1;
}
| 12,873,684 |
./full_match/43113/0x2084E79b5Fb196f75965A480Eb63A1D17cDa703E/sources/BananaRepublic_flat.sol | contract balances/ | function cBalances() public view returns (uint, uint, uint, uint) {
return (address(this).balance, _balanceReflections, _balanceLotteryPot, _balanceTeam);
}
| 7,129,022 |
./partial_match/1/0x0Ae3353da57d8A75a7015176808E4DBEa433791C/sources/MorpheusToken.sol | Function who will be called after the init of gameControllerAddress After this, token won't have any other controller | function eraseDeployerAddress() public onlyDeployer() {
deployerAddress = address(0x0);
}
| 10,995,134 |
pragma solidity ^0.5.10;
/** @title BitcoinSPV */
/** @author Summa (https://summa.one) */
import {BTCUtils} from "../BTCUtils.sol";
contract BTCUtilsTest {
/* ***** */
/* UTILS */
/* ***** */
/// @notice Determines the length of a VarInt in bytes
/// @dev A VarInt of >1 byte... | Extracts the data from an op return output Returns hex"" if no data or not an op return _output The output return Any data contained in the opreturn output, null if not an op return | function extractOpReturnData(bytes memory _output) public pure returns (bytes memory) {
return BTCUtils.extractOpReturnData(_output);
}
| 7,218,452 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
import './SafeMath.sol';
import './IVotable.sol';
contract CommunityVoting is IVotable {
/**
* @dev Definition of one proposition.
*/
struct Proposition {
uint256 id;
string title;
string description;
address pro... | Get total number of all propositions in existance. return number of propositions/ | function getNumberOfPropositions() external view returns (uint256) {
return totalPropositions;
}
| 1,009,777 |
./partial_match/1/0x676eb52C30A3a9e05bD06966DE12945e7264817b/sources/TripAI.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Trip AI", "TRIP") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUnis... | 4,361,978 |
pragma solidity ^0.4.21;
/**
* @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;
}
c =... | Removes single address from whitelist. _beneficiary Address to be removed to the whitelist/ | function removeFromWhitelist(address _beneficiary) external onlyOwner {
caps[_beneficiary] = 0;
accredited[_beneficiary] = false;
}
| 1,746,434 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2 <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, ... | Will update the base URL of token's URI _newBaseMetadataURI New base URL of token's URI/ | function setBaseMetadataURI(string memory _newBaseMetadataURI)
public
onlyOwner
whenNotPaused
{
_setBaseMetadataURI(_newBaseMetadataURI);
}
| 11,669,930 |
./full_match/5/0xd98398a279434A5ACE8cBB8ed72C4bAeA1221377/sources/contracts/L1/delegation/DelegationShareBase.sol | Internal function used to fetch this contract's current balance of `underlyingToken`. slither-disable-next-line dead-code | function _tokenBalance() internal view virtual returns (uint256) {
return underlyingToken.balanceOf(address(this));
}
| 7,039,396 |
./partial_match/1/0xF1E57711Eb5F897b415de1aEFCB64d9BAe58D312/sources/lib/aave-v3-periphery/contracts/treasury/Collector.sol | @inheritdoc ICollector | function getFundsAdmin() external view returns (address) {
return _fundsAdmin;
}
| 2,809,025 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
/**
* __ __ _
* | \/ | ___ _ __ ___| |_ ___ _ __
* | |\/| |/ _ \| '_ \/ __| __/ _ \ '__|
* | | | | (_) | | | \__ \ || __/ |
* |_|__|_|\___/|_| |_|___/\__\___|_|_ _
* / ___| __ _| |_ ___ ___| ... | Sets a new base URI _newBaseURI The new base URI/ | function setBaseURI(
string calldata _newBaseURI
)
external
onlyOwner
{
require(
baseUriLocked == false,
"Base URI has been locked"
);
baseURI = _newBaseURI;
}
| 7,321,220 |
// SPDX-License-Identifier: Apache-2.0
// Copyright 2021 Enjinstarter
pragma solidity ^0.7.6;
pragma abicoder v2; // solhint-disable-line
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "... | low level token purchase DO NOT OVERRIDE This function has a non-reentrancy guard, so it shouldn't be called by another `nonReentrant` function. beneficiary Recipient of the token purchase paymentToken ERC20 payment token address lots Number of lots of token being sold/ calculate token amount to be created calculate... | function _buyTokensFor(
address beneficiary,
address paymentToken,
uint256 lots
) internal nonReentrant {
require(
beneficiary != address(0),
"Crowdsale: zero beneficiary address"
);
require(
paymentToken != address(0),
... | 6,367,997 |
pragma solidity ^0.4.24;
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address p... | Extend parent behavior requiring contract to not be paused. _beneficiary Token beneficiary _weiAmount Amount of wei contributed/ | function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal {
super._preValidatePurchase(_beneficiary, _weiAmount);
require(isCrowdsaleOpen(), "Crowdsale not open");
require(weiRaised.add(_weiAmount) <= hardCap, "Exceeds maximum cap");
require(_weiAmount >= minimumContribution,... | 5,466,575 |
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... | CUSTOM GETTERS Get default info from internal contract/ | function internalState() constant public returns (uint numEntities, uint numCertificates) {
return (
ed.nEntities,
cd.nCerts
);
}
| 1,068,389 |
pragma solidity ^0.4.13;
interface ERC721Enumerable /* is ERC721 */ {
/// @notice Count NFTs tracked by this contract
/// @return A count of valid NFTs tracked by this contract, where each one of
/// them has an assigned and queryable owner not equal to the zero address
function totalSupply() public v... | productId must exist You can only renew a subscription product The product must currently be renewable | function _requireRenewableProduct(uint256 _productId) internal view {
require(_productId != 0);
require(isSubscriptionProduct(_productId));
require(renewableOf(_productId));
}
| 478,435 |
pragma solidity 0.5.11; // optimization runs: 200, evm version: petersburg
/**
* @title DTokenInterface
* @author 0age
* @notice Interface for dTokens (in addition to the standard ERC20 interface).
*/
interface DTokenInterface {
// Events bear similarity to Compound's supply-related events.
event Mint(address... | Internal pure function to supply the address of the backing cToken. return The address of the backing cToken./ | function _getCToken() internal pure returns (address cToken) {
cToken = address(_CDAI);
}
| 10,493,557 |
pragma solidity 0.6.9;
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) {
require(b <= a... | ----- for sdcp staking ------ | function mySDCPStaking() external view returns (uint, uint, uint ) {
return (SDCPStakings[msg.sender].amount, SDCPStakings[msg.sender].stakeTime, mySDCPEarn());
}
| 2,439,163 |
pragma solidity ^0.5.4;
// File: contracts/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address private _owner;
event Own... | Transfer token for a specified addresses from The address to transfer from. to The address to transfer to. value The amount to be transferred./ | function _transfer(address from, address to, uint256 value) internal {
require(to != address(0));
_balances[from] = safeSub(_balances[from], value);
_balances[to] = safeAdd(_balances[to], value);
emit Transfer(from, to, value);
}
| 14,015,084 |
./partial_match/1/0xBF79cc7dBBC25Cbd79138c0BD4819627229f3aB7/sources/TrustToken.sol | First check most recent balance Next check implicit zero balance | function getPriorVotes(address account, uint blockNumber) public view override returns (uint96) {
require(blockNumber < block.number, "TrustToken::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}
... | 16,038,003 |
/**
*Submitted for verification at Etherscan.io on 2022-04-01
*/
// SPDX-License-Identifier: MIT
// File contracts/autocompounder/common/Context.sol
// File: @openzeppelin/contracts/GSN/Context.sol
pragma solidity ^0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender ... | It calculates the total underlying value of {token} held by the system. It takes into account the vault contract balance, the strategy contract balance and the balance deployed in other contracts as part of the strategy./ | function balance() public view returns (uint) {
return (want().balanceOf(address(this))) + (IStrategy(strategy).totalBalanceOfStaked());
}
| 15,457,789 |
pragma solidity ^0.4.17;
// File: contracts/iERC20Token.sol
// Abstract contract for the full ERC 20 Token standard
// https://github.com/ConsenSys/Tokens
// https://github.com/ethereum/EIPs/issues/20
pragma solidity ^0.4.17;
/// @title iERC20Token contract
contract iERC20Token {
// FIELDS
... | Gets a deposit address with the client id return clientDepositAddress The client's deposit address/ | function getDepositAddress(bytes32 _clientId) public view returns (address clientDepositAddress){
return depositAddresses[_clientId];
}
| 5,475,841 |
// SPDX-License-Identifier: MIT
// @title: THROW STONE by Yusuke Hanai
// @desc: A total of 1125 “THROW STONE” NFTs are airdropped exclusively for “People In The Place They Love” holders as community rewards, created by FWENCLUB. With 250 editions of 4 designs, this special digital art piece could be used to ... | Returns the token collection symbol/ | function symbol() public view virtual override returns (string memory) {
return "TSYH";
}
| 5,803,731 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.9;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/con... | Derives n more random numbers from that number/ | function expand(uint256 randomValue, uint256 n)
public
pure
returns (uint256[] memory expandedValues)
{
expandedValues = new uint256[](n);
expandedValues[0] = randomValue;
for (uint256 i = 0; i < n; i++) {
expandedValues[i] = uint256(keccak256(abi.enco... | 1,296,928 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
This contract implements a DAO, it's been loosely based on Compound's
GovernorAlpha. It supports multiple options per proposal and multiple actions
per option. It leverages the `Voters` contract for snapshots of voting power.
It supports gasless voting with vot... | Check the proposing address doesn't have an other active proposal | function propose(string calldata title, string calldata description, uint votingTime, uint executionDelay, string[] calldata optionNames, bytes[][] memory optionActions) external returns (uint) {
uint snapshotId = voters.snapshot();
require(voters.votesAt(msg.sender, snapshotId) >= minBalanceToPropo... | 1,069,409 |
// File: @openzeppelin/upgrades/contracts/Initializable.sol
pragma solidity >=0.4.24 <0.6.0;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WARNING: Unlike constructors, initializer ... | Set the controller of the WordDao.Todo: his needs a more robust system. It should allow for a setup time, a dao, transfer to down, and renounce control. | function setMaster(address _dao) public onlyMaster {
DAOController = _dao;
emit daoMaster(_dao);
}
| 921,852 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @artist: Anna Ridler
/// @author: manifold.xyz
import "@prb/math/contracts/PRBMathSD59x18.sol";
import "./libraries/Trigonometry.sol";
import "./libraries/BokkyPooBahsDateTimeLibrary.sol";
import "./dynamic/DynamicArweaveHash.sol";
import "./extensions/ERC... | Yields the greatest signed 59.18 decimal fixed-point number less than or equal to x. Optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions. Requirements: - x must be greater than or equal to MIN_W... | function floor(int256 x) internal pure returns (int256 result) {
if (x < MIN_WHOLE_SD59x18) {
revert PRBMathSD59x18__FloorUnderflow(x);
}
unchecked {
int256 remainder = x % SCALE;
if (remainder == 0) {
result = x;
result = x... | 10,297,520 |
./full_match/5/0x49b07467A56ACb63328396D53A1DCf4CAD7DB92d/sources/Contract.sol | Set the address for the saleManager _saleManager: address of the sale contract | function setSaleManager(address _saleManager) external onlyOwner {
saleManager = _saleManager;
}
| 7,038,211 |
/**
*Submitted for verification at Etherscan.io on 2022-02-17
*/
// SPDX-License-Identifier: MIT
// Scroll down to the bottom to find the contract of interest.
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.... | Returns messages in the NFTs. | function messagesOf(uint256[] calldata ids) external view returns (string[] memory) {
unchecked {
uint256 n = ids.length;
string[] memory a = new string[](n);
for (uint256 i; i < n; ++i) {
a[i] = _messages[ids[i]];
}
return a;
... | 6,712,700 |
./partial_match/1/0x43833f0C2025dFA80b5556574FAA11CBf7F3f4eB/sources/WUSDA.sol | Get total amount of USDA held by the contract and wUSDA in circulation return _totalUSDA Total amount of USDA held by the contract return _totalWUSDA Total amount of wUSDA in circulation | function _getSupplies() internal view returns (uint256 _totalUSDA, uint256 _totalWUSDA) {
_totalUSDA = IERC20(USDA).balanceOf(address(this));
_totalWUSDA = totalSupply();
}
| 2,589,671 |
/**
*Submitted for verification at Etherscan.io on 2020-08-11
*/
pragma solidity 0.6.0;
/**
* @title Offering contract
* @dev Offering logic and mining logic
*/
contract Nest_NToken_OfferMain {
using SafeMath for uint256;
using address_make_payable for address;
using SafeERC20 for ERC20;
... | Get offer information according to the index priceIndex Offer index return Offer information/ The buffer array used to generate the result string Generate the result string and return | function getPrice(uint256 priceIndex) view public returns (string memory) {
bytes memory buf = new bytes(500000);
uint256 index = 0;
index = writeOfferPriceData(priceIndex, _prices[priceIndex], buf, index);
bytes memory str = new bytes(index);
while(index-- > 0) {
... | 7,994,008 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@pwnfinance/multitoken/contracts/MultiToken.sol";
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol";
import "./ITokenBundler.sol";
contract TokenBundler is ERC1155, IERC1155Rece... | See {IERC1155Receiver-onERC1155Received}./ | function onERC1155Received(
address /*operator*/,
address /*from*/,
uint256 /*id*/,
uint256 /*value*/,
bytes calldata /*data*/
) override external pure returns (bytes4) {
return 0xf23a6e61;
}
| 1,067,773 |
pragma solidity ^0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABL... | Get the Airline details./ | {
funds = registeredAirlines[_airlineAddress].funds;
isRegistered = registeredAirlines[_airlineAddress].airlineAddress != 0;
function getAirlinesNumber()public view returns(uint256){return registeredAirlinesNum;}
}
| 2,578,686 |
pragma solidity ^0.4.18;
/**
* @title InteractiveCrowdsaleLib
* @author Modular, Inc
*
* version 1.0.0
* Copyright (c) 2017 Modular, Inc
* The MIT License (MIT)
*
* The InteractiveCrowdsale Library provides functionality to create a crowdsale
* based on the white paper initially proposed by Jason Teutsch and ... | calculates the number of tokens purchased based on the amount of wei spent and the price of tokens _amount amound of wei that the buyer sent _price price of tokens in the sale, in tokens/ETH return uint256 numTokens the number of tokens purchased return remainder any remaining wei leftover from integer division... | function calculateTokenPurchase(uint256 _amount,
uint256 _price)
internal
pure
returns (uint256,uint256)
{
bool err;
uint256 numTokens;
(err,weiTokens) = _amount.time... | 2,559,515 |
pragma solidity ^0.5.13;
pragma experimental ABIEncoderV2;
import "openzeppelin-solidity/contracts/math/Math.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "solidity-bytes-utils/contracts/BytesLib.sol";
import "./interfaces/IVal... | Updates a validator's score based on its uptime for the epoch. signer The validator signer of the validator whose score needs updating. uptime The Fixidity representation of the validator's uptime, between 0 and 1. new_score = uptime exponent adjustmentSpeed + old_score (1 - adjustmentSpeed) return True upon succ... | function _updateValidatorScoreFromSigner(address signer, uint256 uptime) internal returns (uint256, bool) {
address account = getAccounts().signerToAccount(signer);
if (isValidator(account)) {
FixidityLib.Fraction memory epochScore = FixidityLib.wrap(calculateEpochScore(uptime));
... | 2,479,544 |
/**
*Submitted for verification at Etherscan.io on 2021-12-22
*/
/**
*Submitted for verification at Etherscan.io on 2021-12-21
*/
// SPDX-License-Identifier: MIT
pragma solidity ^ 0.8.7;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its dat... | See {IERC165-supportsInterface}./ | function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns(bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
| 1,647,385 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "../interfaces/ERC20Spec.sol";
import "../interfaces/ERC721SpecExt.sol";
import "../lib/SafeERC20.sol";
import "../utils/UpgradeableAccessControl.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol";
im... | Sets the token URI for the token defined by its ID _tokenId an ID of the token to set URI for _tokenURI token URI to set/ verify the access permission we do not verify token existence: we want to be able to preallocate token URIs before tokens are actually minted emit an event first - to log both old and new values a... | function setTokenURI(uint256 _tokenId, string memory _tokenURI) public virtual {
require(isSenderInRole(ROLE_URI_MANAGER), "access denied");
emit TokenURIUpdated(msg.sender, _tokenId, "zeppelin", _tokenURI);
_setTokenURI(_tokenId, _tokenURI);
}
| 12,902,171 |
pragma solidity ^0.4.17;
// define a new factory which would be responsibel for deploying a new instance
contract ElectionFactory{
struct Summary{
address location;//the address of this newly deployed election
string name; //generated id for this candidate
string description; // the name of ... | after adding enough candidates, the next thing to do would be to change the state of the election to started so that the voting can begin | function concludeInitialisation() public{
electionState = 2;
}
| 5,376,092 |
./full_match/1/0x6428E6BaDE91d80EaCa291a1f5174b0bCd68B96e/sources/Ownable.sol | return Boolean value true if flow was successful Only owner can call the function Releases ownership to address 0x0/ | function renounceOwnership() public onlyOwner returns(bool) {
_transferOwnership(address(0));
return true;
}
| 8,443,157 |
./full_match/137/0xFAA410F9b370873FdeA6a89f4EC4FB4a26f5B1fB/sources/tests/dump.sol | Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but performing a delegate call. _Available since v3.4._/ | function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
| 4,736,744 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0.;
import "../client/node_modules/@openzeppelin/contracts/access/Ownable.sol";
import "./ProductPaymentHanler.sol";
/**
* @dev Contract for managing creation of new products and handling of the events.
*/
contract ProductManager is Ownable{
/// @dev ... | Overriding renounceOwnership function from Wnable contract./ | function renounceOwnership() public override onlyOwner {
revert("You're not able to renounce ownership");
}
| 979,118 |
/**
*Submitted for verification at Etherscan.io on 2020-07-01
*/
pragma solidity ^0.5.0;
/**
* @title Tellor Transfer
* @dev Contais the methods related to transfers and ERC20. Tellor.sol and TellorGetters.sol
* reference this library for function's logic.
* Many of the functions have been commented out for simplici... | Getter function for the debt token(reserve) price return debt token price/ | function getDebtTokenPrice() public view returns (uint256) {
return debt.price;
}
| 12,897,412 |
//! The Dutch-Buying contract.
//!
//! Copyright 2017 Gavin Wood, Parity Technologies Ltd.
//!
//! Licensed under the Apache License, Version 2.0 (the "License");
//! you may not use this file except in compliance with the License.
//! You may obtain a copy of the License at
//!
//! http://www.apache.org/licenses/L... | Receive a contribution from `_recipient`. | function receiveFrom(address _recipient) payable only_during_period is_not_dust {
if (!treasury.call.value(msg.value)()) throw;
record[_recipient] += msg.value;
total += msg.value;
Received(_recipient, msg.value);
}
| 1,760,785 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.