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: AGPL-3.0-or-later
pragma solidity 0.8.6;
import { IEmissionsController } from "../interfaces/IEmissionsController.sol";
import { IMasset } from "../interfaces/IMasset.sol";
import { IRevenueRecipient } from "../interfaces/IRevenueRecipient.sol";
import { DialData } from "../emissions/Emissi... | Gets a dial's recipient address. dialId Dial identifier starting from 0. return recipient Address of the recipient account associated with./ | function getDialRecipient(uint256 dialId) public view returns (address recipient) {
recipient = dials[dialId].recipient;
}
| 89,321 |
// 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... | get token id (serial ) of the given token hash. 0 if not a token, 1 if claim, 2 if gem/ | function allTokenHashes(uint256 ndx) external view override returns (uint256) {
return _tokenHashes[ndx];
}
| 11,794,164 |
// Sources flattened with hardhat v2.4.3 https://hardhat.org
// File @openzeppelin/contracts/utils/Context.sol@v4.3.0
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are... | Returns the license for tokens | function tokenLicense(uint256 _id) public view returns (string memory) {
require(_id < totalSupply(), "CHOOSE A BONG WITHIN RANGE");
return LICENSE_TEXT;
}
| 10,223,620 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/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 existence.
*/
function totalSupply() external view retu... | Returns everything about the pool except total in one call | function getPoolsDetails(uint256 _type) external view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
require(_type < tokenList.length,"Type out of range");
uint256 _3rdLastDeposit = 0;
if(tokenList[_type].mixerTotal == 3){
_3rdDepositSinceWithdraw = tokenList[_t... | 6,301,259 |
pragma solidity ^0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) pu... | 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) onlyOwner public returns (bool) {
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(address(0), _to, _amount);
return true;
}
| 14,391,099 |
./full_match/11155111/0x76Ca4d921dF3b1dDed488C2Ed62D3b52695fa3f3/sources/src/lending/Lender.sol | Increases given to borrower debt and total debt | function _increaseDebt(address borrower, uint256 amount) internal {
borrowersData[borrower].debt += amount;
totalDebt += amount;
emit BorrowerDebtChanged(borrower, borrowersData[borrower].debt, totalDebt);
}
| 3,825,130 |
/**
*Submitted for verification at Etherscan.io on 2020-09-04
*/
// Copyright (C) 2020 Maker Ecosystem Growth Holdings, INC.
//
// This program 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 Software Foundation, either... | https:github.com/makerdao/dss/blob/master/src/spot.sol | interface SpotAbstract {
function wards(address) external view returns (uint256);
function rely(address) external;
function deny(address) external;
function ilks(bytes32) external view returns (address, uint256);
function vat() external view returns (address);
function par() external view return... | 5,535,263 |
./partial_match/1/0x343E577Ba5Ee0D8EEa18c042801cBaA9eBa83E09/sources/SafeTransferLib.sol | Get a pointer to some free memory. Write the abi-encoded calldata into memory, beginning with the function selector. Set success to whether the call reverted, if not we check it either returned exactly 1 (can't just be non-zero data), or had no return data. We use 100 because the length of our calldata totals up like s... | function safeTransferFrom(
ERC20 token,
address from,
address to,
uint256 amount
) internal {
bool success;
assembly {
let freeMemoryPointer := mload(0x40)
mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000)
success := and(
... | 4,238,023 |
pragma solidity ^0.4.22;
// File: contracts/libraries/SafeMath.sol
/**
* @dev SafeMath by openzepplin
*/
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);
r... | public function that allows a token holder to manually trigger the latest lottery this saves on gas and potential failures during the purchase of tokens generate an oraclize query by calling wolfram alpha both the min and the max are inclusive | function invokeLottery() public {
require(tokenBalance[msg.sender] > 0);
Lottery storage lotto = lotteries[lottoQueue];
require(lotto.instantiated);
require(!lotto.completed);
require(!pendingOraclize);
pendingOraclize = true;
emit RandomRequested(lotto.identi... | 10,128,164 |
// File: @openzeppelin/contracts/math/SafeMath.sol
pragma solidity 0.5.17;
/**
* @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... | governance can drain tokens that are sent here by mistake | function emergencyERC20Drain(ERC20 token, uint amount) external {
require(msg.sender == governance, "!governance");
token.transfer(governance, amount);
}
| 14,933,187 |
/**
*Submitted for verification at Etherscan.io on 2021-03-08
*/
pragma solidity ^0.7.6;
library SafeMathUpgradeable {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - ... | Upgrade the backing implementation of the proxy. Only the admin can call this function. newImplementation Address of the new implementation./ | function upgradeTo(address newImplementation) external ifAdmin {
_upgradeTo(newImplementation);
}
| 7,899,400 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./interfaces/IArchangel.sol";
import "./interfa... | Return the information of the angel. The fountain needs to be added by angel. angel The angel to be queried. return The pid in angel. return The total balance deposited in angel. | function angelInfo(IAngel angel) external view returns (uint256, uint256) {
AngelInfo storage info = _angelInfos[angel];
_requireMsg(info.isSet, "angelInfo", "angel not set");
return (info.pid, info.totalBalance);
}
| 12,937,199 |
/**
*Submitted for verification at Etherscan.io on 2021-06-04
*/
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
pragma abicoder v2;
interface IERC20 {
function totalSupply() external view returns (uint256 supply);
function balanceOf(address _owner) external view returns (uint256 balance);
... | Common interface for the Trove Manager. --- Events --- | interface ITroveManager {
event BorrowerOperationsAddressChanged(address _newBorrowerOperationsAddress);
event PriceFeedAddressChanged(address _newPriceFeedAddress);
event LUSDTokenAddressChanged(address _newLUSDTokenAddress);
event ActivePoolAddressChanged(address _activePoolAddress);
event D... | 1,367,017 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
interface WalletInterface {
event CallSuccess(
bool rolledBack,
address to,
uint256 value,
bytes data,
bytes returnData
);
event CallFailure(
address to,
uint256 value,
bytes data,
string revertReason
);
// Use an a... | Ensure caller is this contract and self-call context is correctly set. Perform low-level call and set return values using result. Exit early - any calls after the first failed call will not execute. Note: this check could be performed prior to execution. Note: this check could be performed prior to execution. Note: thi... | function _simulateAdvanced(
AdvancedCall[] memory calls
) public returns (AdvancedCallReturn[] memory callResults) {
_enforceSelfCallFrom(this.simulateAdvanced.selector);
callResults = new AdvancedCallReturn[](calls.length);
for (uint256 i = 0; i < calls.length; i++) {
AdvancedCall memory a ... | 13,002,969 |
./full_match/1/0x4599E4F3Eea04BADD41501bF79183e67f6Cf569d/sources/contracts/HighTableVault.sol | @inheritdoc IHighTableVault No need for nonReentrant because this function does not call other contracts | function claimAndRequestWithdraw(uint256 _shares, address _owner) external override returns (uint256 shares) {
shares = claimOwedShares(msg.sender);
requestWithdraw(_shares, _owner);
}
| 17,149,047 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./libs/IStrategy.sol";... | Add a new want to the pool. Can only be called by the owner./ | function addPool(address _strat, string memory _desc) external onlyOwner nonReentrant {
require(!strats[_strat], "Existing strategy");
poolInfo.push(
PoolInfo({
want: IERC20(IStrategy(_strat).wantAddress()),
strat: _strat,
desc: _desc
... | 888,772 |
./full_match/1/0x9D6Dc3dbC7Cc5e1d7241601473FD63d2bD1573f9/sources/contracts/common/FeeCustomization.sol | Internal function to compute storage slot for fee storage. _feeType The type of fee. _user The address of user. return slot The destination storage slot. | function _computeStorageSlot(bytes32 _feeType, address _user) private pure returns (uint256 slot) {
bytes32 salt = SALT;
assembly {
mstore(0x00, _feeType)
mstore(0x20, xor(_user, salt))
slot := keccak256(0x00, 0x40)
}
}
| 16,500,636 |
./full_match/1/0xD6A6E8d9e82534bD65821142fcCd91ec9cF31880/sources/lib/Cooler/src/Cooler.sol | Function sig taken from gOHM contract | interface IDelegate {
function delegate(address to_) external;
pragma solidity ^0.8.15;
import {SafeTransferLib} from "solmate/utils/SafeTransferLib.sol";
import {ERC20} from "solmate/tokens/ERC20.sol";
import {Clone} from "clones/Clone.sol";
}
| 4,967,287 |
pragma solidity ^0.4.24;
import "./ERC20.sol";
contract TimeTest {
function currentTime() public view returns (uint) {
return now;
}
}
contract StandardCMToken is ERCCM20 {
uint256 public priceInSzabo = 1000;
uint public sdate1 = 1543190400; // 26 noviembre 2018
uint public edate... | same as above. Replace this line with the following if you want to protect against wrapping uints.if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) { | function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
balances[_to] += _value;
balances[_from] -= _value;
allowed[_from][msg.sender] -= _valu... | 1,069,583 |
pragma solidity ^0.5.0;
import "./zeppelin/token/ERC777/ERC777.sol";
interface ReversibleICO {
function getParticipantReservedTokens(address) external view returns (uint256);
}
contract ReversibleICOToken is ERC777 {
ReversibleICO public rICO;
bool public frozen; // default: false
bool public initi... | We need to override send / transfer methods in order to only allow transfers within RICO unlocked calculations The rico address can receive any amount for withdraw functionality If tokens are send to the rICO, OR tokens are sent to the migration contract allow transfers of the total balance full balance can be sent bac... | function _move(
address _operator,
address _from,
address _to,
uint256 _amount,
bytes memory _userData,
bytes memory _operatorData
)
internal
isNotFrozen
isInitialized
{
if(
_to == address(rICO) ||
_to == migrationA... | 5,508,825 |
./partial_match/56/0x5B36eDBc6067F2625A0a79b7C28FE02af4dF7C24/sources/MasterNiu.sol | Deposit LP tokens to MasterNiu for NIU allocation. | function deposit(uint256 _pid, uint256 _amount) public {
require (_pid != 0, 'deposit NIU by staking');
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = user.am... | 11,158,447 |
./full_match/80001/0xaE7600Cc70b3b8fF2B02D2532630a0901B02939e/sources/contracts/upgradeable/tokens/Vehicles.sol | solhint-disable-next-line orderingsolhint-disable-next-line not-rely-on-time | function mint(
address _receiver,
VehicleMetadataGenerator.MetadataParams memory _md
) public virtual onlyRole(MINTER_ROLE) whenNotPaused returns (uint256) {
require(_receiver != address(0), "receiver must exist");
uint256 _tokenId = nextTokenId;
nextTokenId++;
... | 5,668,676 |
pragma solidity 0.4.25;
// ----------------------------------------------------------------------------
// 'Gas Fund' token contract, having Crowdsale and Investment functionality
//
// Contract Owner : 0x956881bc9Fbef7a2D176bfB371Be9Ab3e66683fD
// Symbol : GAF
// Name : Gas Fund
// Total supp... | Just to check if dividend payment is available to send out This function will be called from the clients side to check if main dividend payment function should be called or not. return length or array of token holders. If 0, means not available. If more than zero, then the time has come for dividend payment/ | function checkDividendPaymentAvailable() public view returns (uint256){
require(now > (dividendStartDate.add(dividendMonthCounter.mul(2592000))));
return tokenHolders.length;
}
| 6,685,578 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.4;
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "openzeppelin-solidity/contracts/token/ERC721/IERC721.sol";
import "openzeppelin-solidity/contracts/token/ERC721/ERC721Holder.sol";
import "multi-token-standard/contracts/interfaces/IERC1155.so... | loanId The id of the loan/ | function getLoanRemainToPay(uint256 loanId) external view returns(uint256) {
return loans[loanId].amountDue.sub(loans[loanId].paidAmount);
}
| 1,767,353 |
pragma solidity ^0.4.13;
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
// assert(b > 0); // Solidity automatically t... | Information functions | function getHodlOwner(uint _instId) constant external returns (address) {
return instances[_instId].instOwner;
}
| 7,924,680 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/co... | Computes the releasable amount of tokens for a vesting schedule. return the amount of releasable tokens/ | function _computeReleasableAmount(VestingSchedule memory vestingSchedule)
internal
view
returns (uint256)
{
uint256 currentTime = getCurrentTime();
if (
(currentTime < vestingSchedule.cliff) ||
vestingSchedule.revoked == true
) {
... | 513,583 |
./full_match/1/0xEC681F28f4561c2a9534799AA38E0d36A83Cf478/sources/localhost/libs/ierc20.sol | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
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 returns (uint2... | 4,820,997 |
./partial_match/1/0x13bC172D8008629d71fd54369f796b4a51d57d9F/sources/PickleStrategy3PoolMainnet.sol | Converts all DAI to 3Crv using the Curve protocol./ | function curve3PoolFromDai() public {
uint256 daiBalance = IERC20(dai).balanceOf(address(this));
if (daiBalance > 0) {
IERC20(dai).safeApprove(curvePool, 0);
IERC20(dai).safeApprove(curvePool, daiBalance);
uint256 minimum = 0;
ICurve3Pool(curvePool).add_liquidity([daiBalance, 0, 0], mi... | 2,714,031 |
./partial_match/1/0x6b9E1a6fAFCCf4AA732228AA52b67507ee91A7FA/sources/SHIBA.sol | Temp Tax Rates Set Taxes to Zero | function remove_Taxes(bool isTrue) private {
if(isTrue && Total_Fees == 0 && CurrentBuyFee == 0 && CurrentSellFee == 0) return;
oldBuyFee = CurrentBuyFee;
oldSellFee = CurrentSellFee;
oldTotalFees = Total_Fees;
CurrentBuyFee = 0;
CurrentSellFee = 0;
Total_... | 15,680,248 |
/**
*Submitted for verification at Etherscan.io on 2021-05-29
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// ----------------------------------------------------------------------------
// USA Coin Token
//
// Deployed to : 0xeD93C9bf1559652dD74CeEFD1192022D32D3DDfe
// Symbol : USA
// Name : USA Coin... | Set role Minter / Burner/ | function setUpRole(bytes32 role, address account) public onlyOwner returns (bool){
_setupRole(role, account);
return true;
}
| 2,419,087 |
pragma solidity ^0.4.19;
// Turn the usage of callcode
contract SafeMath {
function safeMul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeSub(uint a, uint b) internal returns (uint) {
assert(b <= ... | When migration process is finished (1 year from Goldmint blockchain launch), then transaction fee is 1% GOLD. If the sender holds at least 10000 MNTP, then the transaction fee is 0.0333333% GOLD, but not more than 0.02 MNTP | function calculateFee(
bool _isMigrationStarted, bool _isMigrationFinished,
uint _mntpBalance, uint _value) public constant returns(uint)
{
if (_isMigrationFinished) {
return (_value / 100);
}
if (_mntpBalance >= (10000 * 1 ether)) {
... | 11,687,770 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./interfaces/IBondCalculator.sol";
import "./interfaces/IERC20Extended.s... | Sets terms for a new wallet | function setTerms(address _vester, uint _amountCanClaim, uint _rate ) external onlyOwner() returns ( bool ) {
terms[_vester].max = _amountCanClaim;
terms[_vester].initPercent = _rate;
return true;
}
| 12,150,380 |
./partial_match/1/0x6ecDE7a43647f65D910514ad41FebC8307960224/sources/NFTmint.sol | Determine the base price based on the NFT type | function price(NFTType _nftType, uint256 _count) public view returns (uint256) {
uint256 basePrice;
if (_nftType == NFTType.BRONZE) {
basePrice = PRICE_BRONZE;
basePrice = PRICE_SILVER;
basePrice = PRICE_GOLD;
revert("Invalid NFT type");
}... | 2,737,447 |
/**
*Submitted for verification at Etherscan.io on 2022-04-18
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/* use 0.6.12 compiler version
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally availab... | Deposit staked tokens and collect reward tokens (if any) _amount: amount to withdraw (in stakedToken)/ | function deposit(uint256 _amount) external nonReentrant {
UserInfo storage user = userInfo[msg.sender];
require(_amount > 0, "Can't deposit zero amount");
_updatePool();
if (user.amount > 0) {
uint256 pending = user.amount.mul(accTokenPerShare).div(PRECISION_F... | 6,761,672 |
./partial_match/1/0x17CE9F141745cC9E9769FC5454AF34b33fBc62ba/sources/PoolFactory.sol | return the inflation manager/ | function getInflationManager(IAddressProvider provider)
internal
view
returns (IInflationManager)
{
return IInflationManager(provider.getAddress(AddressProviderKeys._INFLATION_MANAGER_KEY));
}
| 4,325,422 |
//Address: 0x432bbc9e977d2700e15333c792e846751c03f81b
//Contract name: Nova
//Balance: 0 Ether
//Verification Date: 2/10/2018
//Transacion Count: 10
// CODE STARTS HERE
pragma solidity ^0.4.17;
contract NovaAccessControl {
mapping (address => bool) managers;
address public cfoAddress;
function NovaAccessCont... | This is function is used for sell Nova properpty only coin can only be trasfered to invoker, and invoker must be Nova contract | function consumeCoinForNova(address _from, uint _value) external {
require(msg.sender == novaContractAddress);
require(balanceOf[_from] >= _value);
var _to = novaContractAddress;
require(balanceOf[_to] + _value > balanceOf[_to]);
uint previousBalances = balanceOf[_from] + balanceOf[_to];
balan... | 940,929 |
./partial_match/4/0x52e61BBE8870c636992534eD3a48914a91077933/sources/HSU_MANAGER.sol | 2,1,10000000000000000000,1,1,0,0,0,0,0,0x6f4382D820632608618Ba1273f3E38685C5317fe,0xdd6038d07bd5285bbc09f7c62c35eee96b761ae9 | function initinalNewUser(
uint counterTmp001,
uint counterTmp,
uint mergeHsuNumberTmp,
uint depoistTimeTmp,
uint withdrawPermissionCountsTmp,
uint lastwithdrawBlockNumberTmp,
uint rewardsMergePoolTmp,
uint mergeAlreadyWithdrawTmp,
uint stakedA... | 8,646,698 |
pragma solidity >=0.6.0 <0.7.0;
import "./Ownership.sol";
import "./lib/SafeMath.sol";
import "./lib/IERC20.sol";
/**
* @title Reference implementation of the DeadManSwitch for Ether and ERC20 token locked.
*/
contract DeadManSwitch is Ownership {
using SafeMath for uint256;
// Storage
/**
* @dev ... | Ether fund ERC20 fund | function refund(
address _tokenAddress,
uint256 _amount
) public onlyAllowWithdrawal {
if (_tokenAddress == address(0)) {
address payable self = address(this);
require(_amount <= self.balance, "Insufficient ETH balance");
(bool success, ) = msg.sender.... | 14,086,773 |
./full_match/1/0x5026B28bAbd6490583Fc491fC3E4b59AEDA47bB3/sources/contracts/Token.sol | when buy if excluded from fees, take no fees only for buy and sell, don't take fees on wallet transfer on buy on sell | function _transfer(
address from,
address to,
uint256 amount
) internal override {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
if (amount == 0) {
super._transf... | 8,439,212 |
pragma solidity ^0.6.0;
import "./SafeMath.sol";
import "./Address.sol";
import "./Common.sol";
import "./IERC1155TokenReceiver.sol";
import "./IERC1155.sol";
// A sample implementation of core ERC1155 function.
contract ERC1155 is IERC1155, ERC165, CommonConstants, ERC1155TokenReceiver {
using SafeMath for uint2... | / The balance of any account can be calculated from the Transfer events history. However, since we need to keep the balances to validate transfer request, there is no extra cost to also privide a querry function. | function balanceOf(address _owner, uint256 _id)
external
virtual
override
view
returns (uint256)
{
return balances[_id][_owner];
}
@param _owners The addresses of the token holders
@param _ids ID of the Tokens
@return The _ow... | 6,483,974 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./lib/Babylonian.sol";
impor... | saved enough to pay debt, mint as usual rate | function allocateSeigniorage() external onlyOneBlock {
checkCondition();
checkEpoch();
checkOperator();
_updateCashPrice();
uint256 cashSupply = IERC20(cash).totalSupply().sub(seigniorageSaved);
uint256 cashPrice = getCashPrice();
emit NewEpoch(epoch, cashPri... | 12,536,001 |
pragma solidity ^0.4.4;
contract Leak {
// wikileaks admin address
address public admin;
uint last_visited;
bytes[] submittals;
// event to give the user confirmation once file upload succeeds
event Delivered(address from, address to, uint amount);
function Leak() {
// only gets called when the... | return true just for testing | function addSubmittal(bytes ipfs_hash, address toaddr) payable returns (bool) {
require(msg.value >= 50000000000000000);
require(toaddr.send(msg.value));
submittals.push(ipfs_hash);
Delivered(msg.sender, admin, msg.value);
return true;
}
| 12,718,048 |
./full_match/1/0x5Bb938861f7561a4Bc2332980CcBC92519173b70/sources/contracts/Auction.sol | require auctions to be active to call this method, so we don't double-widthdraw the buyer premium | function confirmAuction(uint256 auctionId, address premiumRecipient) public nonReentrant onlyAuctioneer {
AuctionData storage auction = _auctions[auctionId];
if (block.timestamp < auction.endTime + 1) {
revert Errors.AuctionActive(auctionId);
}
if (_auctionInExtendedBid... | 8,416,480 |
pragma solidity ^0.5.0;
import "../node_modules/@openzeppelin/contracts/math/SafeMath.sol";
contract User {
using SafeMath for uint256;
address contractOwner = msg.sender;
enum userStates {pending, active, deactivated, admin}
uint256 public numberOfUsers = 0;
struct user {
uint256 userI... | Creates a new user with supplied variables Requirements: - `_userwallet` supplied must be user's own address/ | function createUser(
address _userWallet,
string memory _about,
string memory _displayPictureHash,
string memory _displayName,
string memory _website
) public isUser(_userWallet) uniqueUser(_userWallet) {
user memory newUser = user(
numberOfUsers,
... | 1,789,266 |
pragma solidity ^0.4.23;
// ----------------------------------------------------------------------------
// 'buckycoin' CROWDSALE token contract
//
// Deployed to : 0xf4bea2e58380ea34dcb45c4957af56cbce32a943
// Symbol : BUC
// Name : buckycoin Token
// Total supply: 940000000
// Decimals : 18
//
// POWE... | event for token purchase logging purchaser who paid for the tokens beneficiary who got the tokens value weis paid for purchase amount amount of tokens purchased/You will change this to your wallet where you need the ETH durationInMinutes = _durationInMinutes;Here will come the checksum address we got | function Crowdsale() {
wallet = 0x965A2a21C60252C09E5e2872b8d3088424c4f58A;
addressOfTokenUsedAsReward = 0xF86C2C4c7Dd79Ba0480eBbEbd096F51311Cfb952;
tokenReward = token(addressOfTokenUsedAsReward);
}
bool public started = true;
| 1,324,733 |
//Address: 0xe06eda7435ba749b047380ced49121dde93334ae
//Contract name: TransferableMeetupToken
//Balance: 0 Ether
//Verification Date: 8/31/2017
//Transacion Count: 111
// CODE STARTS HERE
/*
An ERC20 compliant token that is linked to an external identifier. For exmaple, Meetup.com
This software is distributed in t... | Send amount amount of tokens from address _from to address _to Reentry protection prevents attacks upon the state | function transferFrom(address fromAddress, address toAddress, uint256 amount) public
{
require(amount <= allowed[fromAddress][msg.sender]);
allowed[fromAddress][msg.sender] -= amount;
xfer(fromAddress, toAddress, amount);
}
| 14,107,901 |
pragma solidity ^0.4.24;
contract ThreeKingdoms {
uint constant kingdomNum = 3; // number of kingdoms
struct KingdomInfo {
uint balance; // store balance for each kingdom
mapping(address => uint) votes; // store votes for each kingdom
address[] voters; // store voters for each kin... | get value to reward voters/ | function getRewardValue() public view returns(uint) {
uint total = address(this).balance;
return (total * ratio) / ratioDecimal;
}
| 13,067,532 |
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
interface Structs {
struct Val {
uint256 value;
}
enum ActionType {
Deposit, // supply tokens
Withdraw, // borrow tokens
Transfer, // transfer balance between accounts
Buy, // buy an amoun... | approve dydx solo pool | function flashloan(
address token,
uint256 amount,
bytes memory data
)
internal
{
IERC20(token).approve(address(pool), amount + 1);
Info[] memory _infos = new Info[](1);
ActionArgs[] memory _args = new ActionArgs[](3);
_in... | 7,502,469 |
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "zos-lib/contracts/migrations/Migratable.sol";
import "./Crucible.sol";
contract Foundry is Migratable, Ownable {
address[] public crucibles;
event CrucibleCreated(address contractAddress);
event CrucibleDeleted(add... | total number of Crucibles produced by the Foundry | function getCount()
external
view
returns(uint)
{
return crucibles.length;
}
| 12,954,853 |
pragma solidity 0.4.24;
//https://www.sperm.network/ponzi
//https://discord.gg/AkaGFuE
contract Sperm {
/*=====================================
= CONFIGURABLES =
=====================================*/
string public name = "Sperm Ponzi" ;
string public symbol = "Sperm";
uint8 cons... | Integer division of two numbers, truncating the quotient./ assert(b > 0); Solidity automatically throws when dividing by 0 assert(a == b c + a % b); There is no case in which this doesn't hold | function div(uint a, uint b) internal pure returns (uint) {
uint c = a / b;
return c;
}
| 1,163,884 |
// Copyright (C) 2020 Argent Labs Ltd. <https://argent.xyz>
// 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.
// Th... | Throws if the owner, guardian, version or version manager is invalid. _owner The owner address. _versionManager The version manager module _guardian The guardian address _version The version of feature bundle/ | function validateInputs(address _owner, address _versionManager, address _guardian, uint256 _version) internal view {
require(_owner != address(0), "WF: owner cannot be null");
require(IModuleRegistry(moduleRegistry).isRegisteredModule(_versionManager), "WF: invalid _versionManager");
requir... | 1,670,563 |
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
contract Adspot is ERC721URIStorage {
/// Todo: add an AdMarket Fee
/// Todo: Handle URL, NFT, Decentralised Storage?
/// Todo: Add information in AdSpot s... | Set the URI of the Adspot | function setAdSpotURI(uint256 adspotId, string memory _tokenURI) internal {
_setTokenURI(adspotId, _tokenURI);
}
| 15,828,584 |
/**
*Submitted for verification at Etherscan.io on 2021-05-26
*/
pragma solidity 0.8.0;
// SPDX-License-Identifier: Unlicensed
/*
* @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.da... | track operation fund after withdrawal | function withdrawOperationFund(uint256 amount, address walletAddress, string memory reason) public onlyOwner() {
require(amount < operationalFund, "You cannot withdraw more funds that you have in island fund");
require(amount <= _balance[address(this)], "You cannot withdraw more funds that you have in ... | 8,016,771 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
/// _ _ _ _ _ _
/// | |_ ___ ___| |_|_|___ ___| | | |_ ___ ___ ___ ___ ___ _____ ___ |_|___
/// | _| .'| _| _| | _| .'| | | _| .'| | . | _| .'| |_ -| _ | | . |
/// |... | Public mint method. Checks whether the paid price is correct and max. 14 Tans are minted per tx numTans number of Tans to mint | function mint(uint numTans) external payable
forPrice(numTans, PRICE_PUBLIC, msg.value)
inState(StateType.MINT)
limitTans(numTans, MAX_TANS_PUBLIC)
{
mintLocal(numTans);
}
| 12,225,905 |
./full_match/420/0x78C539a0Cc8442ca53Ec8442b2B94f149d9e4a5B/sources/contracts/Zengo.sol | TODO: constructing a constructor like this doesn't work figure out how to write it Done require( votingPoints[msg.sender] > 0, "You need voting points to submit a proposal" ); Evidence storage newEvidence = Evidence({ }); Structs.Proposal storage newProposal = proposals[proposalCount] = Structs.Proposal(0, prop... | function submitProposal(
string memory _title,
string memory _proposalDescription,
string memory _evidenceDescription,
string memory _evidenceUri,
string memory _proposalType,
string memory _streetAddress,
uint256 _latitude,
uint256 _longitude
) ex... | 13,226,674 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/****************************************
* @author: tos_nft *
* @team: TheOtherSide *
****************************************
* TOS-ERC721 provides low-gas *
* mints + transfers *
*****************... | Owner/Delegate sets the Whitelist active flag./ | function setWhitelistActive(bool isWhitelistActive_) external onlyDelegates{
require( isWhitelistActive != isWhitelistActive_ , "MOON: New value matches old" );
isWhitelistActive = isWhitelistActive_;
}
| 6,335,273 |
pragma solidity 0.4.24;
/**
* @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) {
// Gas optimization: this is che... | Allows the operator to create an asset but not put it up for sale yet. _tokenId the ID of the asset to mint _tokenURI the URI of the asset's metadata | function mintNFTNotForSale(uint256 _tokenId, string _tokenURI) public onlyOperator {
items.mint(_tokenId, _tokenURI);
emit LogNFTMintedNotForSale(_tokenId, operator);
}
| 1,789,912 |
pragma solidity ^0.4.23;
// Copyright 2018 OpenST Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by appl... | function to calculate redemption intent hash. _amount redemption amount _beneficiary unstake account _redeemer redeemer account _redeemerNonce nonce of staker _gasPrice price used for reward calculation _gasLimit max limit for reward calculation _token utility token address return bytes32 redemption intent hash/ | function hashRedemptionIntent(
uint256 _amount,
address _beneficiary,
address _redeemer,
uint256 _redeemerNonce,
uint256 _gasPrice,
uint256 _gasLimit,
address _token
)
external
pure
returns (bytes32)
{
return keccak256(
... | 13,132,716 |
./partial_match/1/0xe945ef2449a22958267c67a7DF63519454A339e4/sources/StanleyDsrDai.sol | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
... | 2,862,562 |
./full_match/11155111/0x8E894e74140cdaf843EB41c800Fe86085C3643B3/sources/project_/contracts/interfaces/IPropertyFactory.sol | Interface of the Property Factory./ | interface IPropertyFactory {
event PropertyMinted(
address indexed property,
address indexed propertyOwner,
address listingBroker,
address transferAgent,
address provider,
string streetAddress,
string documentationURI,
uint16 ownerRoyaltiesBps,
... | 3,790,845 |
./partial_match/42/0x9266D722f9F559D3a9588BB21579AED5f058b297/sources/AMMExchange.sol | Market Open Interest. If we're finalized we need actually calculate the value | function assertBalances(IMarket _market) public view {
uint256 _expectedBalance = 0;
uint256 _numTicks = _market.getNumTicks();
uint256 _numOutcomes = _market.getNumberOfOutcomes();
if (_market.isFinalized()) {
for (uint8 i = 0; i < _numOutcomes; i++) {
_e... | 3,418,370 |
./full_match/1/0xbbb6A6474729AEB3b2c83c4acCFf96711ff88589/sources/contracts/bridgeToken/adapters/optimism/OptimismBridgeAdapter.sol | Bridge In Funds, callable by Op Bridge _user Address to receive funds _amount Amount of BIFI to bridge in/ | function mint(
address _user,
uint256 _amount
) external onlyBridge {
xBIFI.mint(address(this), _amount);
if (address(lockbox) != address(0)) {
lockbox.withdraw(_amount);
BIFI.transfer(_user, _amount);
} else IERC20(address(xBIFI)).transfer(_user,... | 3,133,053 |
pragma solidity ^0.4.24;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(
address indexed p... | Withdraw corresponding amount of ETH to _addr and burn _value tokens _addr withdrawal address _amount amount of tokens to sell/ | function withdrawWbtToken(
address _addr,
uint256 _amount
)
onlyOwner public
{
wbtToken.burn(_addr, _amount);
uint256 etherValue = _amount * wbtToken.mrate() / wbtToken.rate();
_addr.transfer(etherValue);
}
| 10,359,567 |
./full_match/4/0xA5a793fD013F6C3d16eEF6E8aE41E519d3a06f64/sources/contracts/Test3.sol | Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. Initial upgrade and setup call | function _upgradeToAndCall(
address newImplementation,
bytes memory data
) internal {
_setImplementation(newImplementation);
if (data.length > 0) {
(bool success,) = newImplementation.delegatecall(data);
require(success, "Call failed");
}
}
... | 12,440,175 |
pragma solidity ^0.4.11;
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
// assert(b > 0); // So... | Change endTime to end ICO manually | function changeStartTime(uint256 _startTime) onlyOwner {
endTime = _endTime;
}
| 2,513,699 |
pragma solidity ^0.4.13;
contract ApolloDAECenter {
address public owner;
address public contractOwner;
uint public totalSubBalances;
bool public oneSet = false;
bool public voters = false;
address[] public subList;
uint public mainBalance;
mapping (address => uint) public subContracts... | makes a new contract for depositor from owner account. Owner account sending this will only be allowed to call this functionadds to array so we know all subcontracts we make. | function makeSubCon(address _userAdd, uint _userVote) public onlyOwner returns(address){
address newStore = new Storage(_userAdd, _userVote);
subContracts[newStore] = 1;
subList.push(newStore);
return newStore;
}
| 5,422,972 |
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 previousOwner);
... | ERC20 interface which doesn't specify the return type for transfer, transferFrom and approve. Modified to not return boolean Not modifier | interface CompatibleERC20 {
function transfer(address to, uint256 value) external;
function transferFrom(address from, address to, uint256 value) external;
function approve(address spender, uint256 value) external;
function totalSupply() external view returns (uint256);
function balanceOf(address w... | 13,835 |
pragma solidity 0.5.17;
import "./IRewardTransferLogic.sol";
import "./LockedSOVRewardTransferLogicStorage.sol";
import "../locked/ILockedSOV.sol";
import "../openzeppelin/ERC20.sol";
import "../openzeppelin/SafeERC20.sol";
contract LockedSOVRewardTransferLogic is IRewardTransferLogic, LockedSOVRewardTransferLogicSt... | _newLockedSOV The contract instance address of the lockedSOV vault./ | function changeLockedSOV(address _newLockedSOV) public onlyAuthorized {
require(_newLockedSOV != address(0), "Invalid address");
lockedSOV = ILockedSOV(_newLockedSOV);
emit LockedSOVChanged(_newLockedSOV);
}
| 939,650 |
./partial_match/1/0x000000931CF36C464623Bb0EefB6B0C205338d67/sources/TimeLockedController.sol | Change the minimum and maximum amounts that TrueUSD users can burn to newMin and newMax | function changeBurnBounds(uint newMin, uint newMax) public onlyOwner {
ChangeBurnBoundsEvent(newMin, newMax);
trueUSD.changeBurnBounds(newMin, newMax);
}
| 2,782,065 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
//
interface IERC20 {
function TOTALSUPPLY709()... | inject NONSTANDARD NAMING | function SETTREASURY672(address newTreasury) public ONLYOWNER378 { | 12,852,231 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import {IAddressBook} from "./interfaces/IAddressBook.sol";
import {IGammaController} from "./interfaces/IGammaController.sol";
import {IWhitelist} from "./interfaces/IWhitelist.sol";
import {IMarginCalculator} from "./interfaces/IMarginCalculator.sol";
import {Ac... | redeem otoken on behalf of owner _owner owner address _otoken otoken address _amount amount of otoken/ | function redeemOtoken(
address _owner,
address _otoken,
uint256 _amount
) internal returns (address payoutToken, uint256 payoutAmount) {
uint256 actualAmount = getRedeemableAmount(_owner, _otoken, _amount);
IERC20(_otoken).safeTransferFrom(_owner, address(this), actualAm... | 6,466,907 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "deps/@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "deps/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "deps/@openzeppelin/contracts-upgradeable/access/AccessC... | Claim accumulated rewards for a set of tokens at a given cycle number Verify the merkle proof. Claim each token If none claimable for token, skip | function claim(
address[] calldata tokens,
uint256[] calldata cumulativeAmounts,
uint256 index,
uint256 cycle,
bytes32[] calldata merkleProof
) external whenNotPaused {
require(cycle == currentCycle, "Invalid cycle");
bytes32 node = keccak256(abi.encode(i... | 881,317 |
./partial_match/42/0xf5e6DCFB5D3512446d36b8beB3844F0b430A64B9/sources/LunaSwap.sol | swap eth to luna fund tokens contain eth-twa lp, weth, uni, link, renBTC | function swapEthToLuna(uint256 _slippage)
public
payable
returns (uint256 poolAmountOutAfterFee, uint256 oddEth)
{
address[] memory tokens = lunaBP.getCurrentTokens();
(, , uint256 poolAmountOut) = calcSwapEthToLunaInputs(msg.value, tokens, _slippage);
return _swa... | 3,459,191 |
./partial_match/1/0x702ecF93156962e9ffE53FeaD114Dbd54209B796/sources/ERC1155LazyPayableClaim.sol | See {IERC1155LazyClaim-updateTokenURIParams}./ | function updateTokenURIParams(
address creatorContractAddress, uint256 claimIndex,
StorageProtocol storageProtocol,
string calldata location
) external override creatorAdminRequired(creatorContractAddress) {
Claim storage claim = _claims[creatorContractAddress][claimIndex];
... | 3,681,679 |
./full_match/80001/0xE2224F44829020EA89939b278DE7bee1f4B9C9AC/sources/project_/contracts/core/BufferRouter.sol | Check if slippage lies within the bounds bool isSlippageWithinRange = optionsContract.isStrikeValid( queuedTrade.slippage, price, queuedTrade.expectedStrike ); if (!isSlippageWithinRange) { _cancelQueuedTrade(queueId); emit CancelTrade( queuedTrade.user, queueId, "Slippage li... | function _openQueuedTrade(uint256 queueId, uint256 price) internal {
QueuedTrade storage queuedTrade = queuedTrades[queueId];
IBufferBinaryOptions optionsContract = IBufferBinaryOptions(
queuedTrade.targetContract
);
bool isReferralValid;
isReferralValid = tru... | 9,440,777 |
./full_match/10/0xBe3Ff103E3D94CdF40e0a76b0B864143C311FfFb/sources/project_/stable-swap/libraries/NomiswapLibrary.sol | given some amount of an asset and pair reserves, returns an equivalent amount of the other asset | function quote(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB) {
require(amountA > 0, 'NomiswapLibrary: INSUFFICIENT_AMOUNT');
require(reserveA > 0 && reserveB > 0, 'NomiswapLibrary: INSUFFICIENT_LIQUIDITY');
amountB = amountA * reserveB / reserveA;
}
| 3,784,130 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../core/Ownable.sol";
import "../accesscontrol/FisherRole.sol";
import "../accesscontrol/DistributorRole.sol";
import "../accesscontrol/RetailerRole.sol";
import "../accesscontrol/ConsumerRole.sol";
contract SupplyChain is Ownable, FisherRole, Distribut... | defines a function 'fishItem' that allows a fisher to mark an item 'Fished' Add the new item as part of Fished | function fishItem(
uint _upc,
address _originFisherID,
string memory _originFisherName,
string memory _originFisherInformation,
string memory _originFisherLatitude,
string memory _originFisherLongitude,
string memory _productNotes
) onlyFisher public {
... | 5,461,029 |
./partial_match/42/0xC31518D4fbA20E3618F6e7B24D1Bada43837Ed45/sources/GebProxyDebtAuctionActions.sol | Transfer rad amount of COIN from the safe address to a dst address. manager address - Safe Manager safe uint - Safe Id dst address - destination address uint rad - amount | function transferInternalCoins(
address manager,
uint safe,
address dst,
uint rad
) public {
ManagerLike(manager).transferInternalCoins(safe, dst, rad);
}
| 3,338,800 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
import '@openzeppelin/contracts/token/ERC1155/ERC1155.sol';
import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/utils/ReentrancyGuard.s... | Flash exercise an option on behalf of an address This is usable on options in the money, in order to use a portion of the option collateral to swap a portion of it to the token required to exercise the option and pay protocol fees, and send the profit to the address exercising. This allo... | function _flashExerciseOption(address _from, uint256 _optionId, uint256 _amount, address _referrer, IUniswapV2Router02 _router, uint256 _amountInMax, address[] memory _path) internal nonReentrant {
require(_amount > 0, "Amount <= 0");
burn(_from, _optionId, _amount);
optionData[_optionId].e... | 13,115,116 |
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-4.0.0/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts-4.0.0/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts-4.0.0/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts-4.0.0/token/ERC20/u... | Get number of listings | function getNumListings() external view returns (uint256) {
return listingIds.length();
}
| 619,641 |
// SPDX-License-Identifier: Apache-2.0
// Copyright 2021 Enjinstarter
pragma solidity ^0.7.6;
import "./interfaces/IFinaWhitelist.sol";
/**
* @title Whitelist
* @author Enjinstarter
*/
contract FinaWhitelist is IFinaWhitelist {
uint256 public constant BATCH_MAX_NUM = 200;
address public governanceAccount;... | IFinaWhitelist Enjinstarter/ | interface IFinaWhitelist {
function addWhitelisted(address account, uint256 amount) external;
function removeWhitelisted(address account) external;
function addWhitelistedBatch(
address[] memory accounts,
uint256[] memory amounts
) external;
function removeWhitelistedBatch(address... | 492,065 |
./full_match/1/0xdCD2Cc059bff18F33092EAE878b5813F44f506cc/sources/contracts/interfaces/ITreasury.sol | Interface for Tonpound Treasury contract, which is a part of gNFT token Authorization model is based on AccessControl and Pausable contracts from OpenZeppelin: (https://docs.openzeppelin.com/contracts/4.x/api/accessAccessControl) and (https://docs.openzeppelin.com/contracts/4.x/api/securityPausable) ... | interface ITreasury {
error Auth();
error ClaimingNotStarted();
error InvalidRewardToken();
error InvalidMarket();
error InvalidParameter();
error InvalidTokenOwnership();
error Paused();
error ZeroAddress();
event ReserveFactorUpdated(uint256 oldValue, uint256 newValue);
... | 17,073,205 |
// Copyright 2018, 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/LICENSE-2.0
//
// Unless required by applicable law or... | Report that a validator has misbehaved maliciously. | function baseReportMalicious(
address _reporter,
address _validator,
uint _blockNumber,
bytes memory _proof
)
internal
isValidator(_reporter)
isValidator(_validator)
isRecent(_blockNumber)
{
emit Report(_reporter, _validator, true);
}
| 13,099,858 |
pragma solidity 0.4.24;
contract ModulusExponential {
// bigModExp now resides at address 0x05, and performs b^e mod m, taking as input, in order:
// - length of the base;
// - length of the exponent;
// - length of the modulus;
// - the base itself (b above);
// - the exponent itself (e);
... | Call Modulus Exponential precompiled contract call(gasLimit, to, value, inputOffset, inputSize, outputOffset, outputSize) | function modulusExponential(uint256 base, uint256 exponent, uint256 modulus) public view returns (uint256 result) {
assembly {
let free_memory_pointer := mload(0x40)
let precompiled_moduls_exponential_pointer := 0x05
let success := call(not(0), precompiled_moduls_expon... | 12,920,080 |
./partial_match/1/0x755d1BBDD9929889Fe1376C65682f57BF270A25c/sources/contracts/erc721/MarketplaceFilterer/MarketplaceFiltererAbridged.sol | Check registry code length to facilitate testing in environments without a deployed registry. | function _checkFilterOperator(address operator) internal view {
if (operatorFiltererRegistry != address(0)) {
if (!IOperatorFilterRegistry(operatorFiltererRegistry).isOperatorAllowed(address(this), operator)) {
_revert(OperatorNotAllowed.selector);
}
}
}
| 16,128,655 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';
import './interfaces/IBuyBackAndBurn.sol';
import './interfaces/IMultiSignatureOracle.sol';
import './utils/MyPausableUpgradeable.sol';
import './token/MintableERC721.sol';
import 'hardhat/console.... | Adds a collection to the whitelist (effectively allowing bridge transactions for this token) can only be called by MANAGE_COLLECTION_WHITELIST_ROLE collectionAddress the address of the token in the network this contract was released on emits event AddedCollectionToWhitelist after successful whitelisting/ | function addCollectionToWhitelist(address collectionAddress) external {
require(
hasRole(MANAGE_COLLECTION_WHITELIST_ROLE, _msgSender()),
'CrossChainBridgeERC721: must have MANAGE_COLLECTION_WHITELIST_ROLE role to execute this function'
);
require(collectionAddress != address(0), 'CrossChainBr... | 1,512,058 |
/*
* The following is a smart contract written for University of Ontario Institute of Technology's Cloud Computing course
* The objective is to demonstrate a ticket deployment app, using Ethereum blockchain at its core
* This contract serves as a means for users to deploy tickets, view events, and resell purchase... | Selfdestruct function, which can only be used by the contract ownerTo be used when it is decided to delete the contract | function endContract() public {
require(msg.sender == owner);
selfdestruct(owner);
}
| 5,365,293 |
./full_match/1/0xFF7D9E718a43Ef51A31557227e0cC8e7d65D7a2D/sources/contracts/tokenomics/TORUSLockerV2.sol | Process all expired locks of msg.sender and withdraw unlocked TORUS. | function executeAvailableUnlocks() external override returns (uint256) {
return executeAvailableUnlocksFor(msg.sender);
}
| 2,986,415 |
pragma solidity ^0.5.0;
contract SensuiVault {
//Owner of the contract.
// - Can add operators
// - Can change Owner
// - Can set sensuiFee
address public owner;
//Balances for the diferent users
mapping(address => uint256) public balances;
//Operators allowed to fund users
mapping(address =... | -- Operator functions gasLimit: aprox 50000TODO: need a better txGas consumption logic | function fund(address payable receiver, address funder, uint256 amount) _onlyOperator public {
uint256 operatorFee = tx.gasprice * 70000;
uint totalAmount = amount + sensuiFee + operatorFee;
require(balances[funder] >= totalAmount,"funder insufficient balance");
balances[funder] -= tota... | 985,357 |
./full_match/80001/0x0F51F80bd7229F0923d8d718c934D7137Ea7e0Bb/sources/contracts/libraries/UserPollLibrary.sol | this function is used add information about _pollId pool created by user/ | function updatePollList(UserPoll storage self, uint _pollId) internal returns(bool){
self.pollCount++;
self.pollCreated[self.pollCount] = _pollId;
return true;
}
| 5,614,505 |
pragma solidity ^0.4.23;
// Copyright 2018 OpenST Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applic... | Decodes an RLP-encoded header into a Header struct. _blockHeaderRlp An RLP-encoded block header. return header_ The header struct with the data decoded from the input./ | function decodeHeader(
bytes memory _blockHeaderRlp
)
internal
pure
returns (Header memory header_)
{
bytes32 blockHash = keccak256(_blockHeaderRlp);
RLP.RLPItem memory header = RLP.toRLPItem(_blockHeaderRlp);
RLP.RLPItem[] memory headerFields = RLP.t... | 12,917,105 |
./full_match/44787/0x068eA05dd67080Ae4661f10fB24D83c8e0a53c7F/sources/src/ERC20/SweatToken.sol | See {ERC20-_beforeTokenTransfer} - transfer of token is disabled/ | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual override {
super._beforeTokenTransfer(from, to, amount);
if (from != treasury && from != address(0) && to != address(0)) revert SweatToken_SweatIsNonTransferable();
}
| 13,241,812 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.1;
/**
* @title Linked to ILV Marker Interface
*
* @notice Marks smart contracts which are linked to IlluviumERC20 token instance upon construction,
* all these smart contracts share a common ilv() address getter
*
* @notice Implementing smart contracts MU... | ERC20 token receiver interface Interface for any contract that wants to support safe transfers from ERC20 token smart contracts. Inspired by ERC721 and ERC223 token standards Basil Gorin/ | interface ERC20Receiver {
function onERC20Received(address _operator, address _from, uint256 _value, bytes calldata _data) external returns(bytes4);
}
| 6,185,441 |
./full_match/1/0x924D3b979a2C91730561fBE559547225dc70497D/sources/contracts/EPIKERC20.sol | See {ERC20-_beforeTokenTransfer}. See {ERC20Capped-_beforeTokenTransfer}./ | function _beforeTokenTransfer(address from, address to, uint256 amount) internal override(ERC20, ERC20Capped) {
super._beforeTokenTransfer(from, to, amount);
}
| 3,867,714 |
./full_match/1/0xBcbba981bFf1E9530CbcA0f40F67Aa85F8944038/sources/src/x-key/XKeys.sol | Withdraw function for the owner since only NFT sales funds can be withdrawn at any time and users' funds need to be protected, this is marked as nonReentrant/ | function withdraw(address payable receiver) external onlyOwner nonReentrant {
_withdraw(receiver);
}
| 9,610,496 |
./full_match/11155111/0xbE3d97A00b4bE98A626a5c6DEc64f74F5F28da1f/sources/contracts/honeycast.sol | Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override. WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant being that for any address 'a' the value returned by 'balanceOf(a)' must be equal to the number of tokens... | function _beforeTokenTransfer(
address from,
address to,
uint256 firstTokenId,
uint256 batchSize
function _afterTokenTransfer(
address from,
address to,
uint256 firstTokenId,
uint256 batchSize
function __unsafe_incre... | 3,815,541 |
pragma solidity ^0.4.24;
/**
* @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) {
... | Finalize presale. Leftover tokens will overflow to crowdsale. | function finalizePresale() external onlyPresale {
require(presaleFinalized == false);
uint256 amount = balanceOf(presaleAddress);
if (amount > 0) {
balances[presaleAddress] = 0;
balances[crowdsaleAddress] = balances[crowdsaleAddress].add(amount);
}
pre... | 7,319,199 |
// solhint-disable not-rely-on-time
// solhint-disable no-empty-blocks
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableS... | return difficulty for given timestamp / | function difficultyFor(uint256 timestamp) public view returns (uint256) {
uint256 dt = timestamp - _timestamp;
if (dt > _deltas[3]) {
return (100 * (dt - _deltas[3]) * _deltas[2]) / (_deltas[1] * 365_25 days) + _deltas[0];
}
return _deltas[0];
}
| 6,422,493 |
./full_match/5/0x0d3945a3d3B0Ce7d32B4EA9BA2e8e260C1F713E5/sources/contracts/Fund.sol | withdraw capital by deposit id transfer capital to the user | function withdrawCapital(uint256 id) public nonReentrant {
require(
depositState[id].investor == msg.sender,
"only investor of this id can claim reward"
);
require(
block.timestamp - depositState[id].depositAt > withdrawPeriod,
"withdraw lock t... | 7,086,884 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
interface AaveInterface {
function GETUSERRESERVEDATA664(address _reserve, address _user) external view returns ( //inject NONSTANDARD NAMING
uint256 currentATokenBalance,
ui... | inject NONSTANDARD NAMING | function GETLENDINGPOOLCORE22() external view returns (address); | 6,440,373 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.