file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./partial_match/137/0x48304908669633459c9381CB538Ff7bffF3a8e43/sources/darkUSD.sol | Returns X DB = 1 USD | function db_price() public view returns (uint256) {
return oracle_price(PriceChoice.DB);
}
| 3,525,547 |
/**
*Submitted for verification at Etherscan.io on 2019-12-02
*/
pragma solidity ^0.5.4;
/**
* ERC20 contract interface.
*/
contract ERC20 {
function totalSupply() public view returns (uint);
function decimals() public view returns (uint);
function balanceOf(address tokenOwner) public view returns (uin... | Creates a new pending action for a wallet. _action The target action. _wallet The target wallet. _token The target token for the action. _to The recipient of the action. _amount The amount of token associated to the action. _data The data associated to the action. return the identifier for the new pending action ... | function addPendingAction(
ActionType _action,
BaseWallet _wallet,
address _token,
address _to,
uint _amount,
bytes memory _data
)
internal
returns (bytes32 id, uint256 executeAfter)
{
id = keccak256(abi.encodePacked(_action, _token, _t... | 2,499,624 |
./full_match/42/0x39745603820AbCe80051044F2324c9DE80d2D8d1/sources/browser/Oliever/StakingWiithoutBotg.sol | This comparison also ensures there is no reentrancy. Snap the Epoch time to the start of this window. | function mintDistributeRewards() public {
require(inEpochWindow());
require(lastEpochTimestampSec.add(minEpochTimeIntervalSec) < now);
lastEpochTimestampSec = now.sub(
now.mod(minEpochTimeIntervalSec)).add(epochWindowOffsetSec);
if (mintedRewardToken == 0) ... | 9,577,253 |
pragma solidity ^0.5.7;
interface TubInterface {
function open() external returns (bytes32);
function join(uint) external;
function exit(uint) external;
function lock(bytes32, uint) external;
function free(bytes32, uint) external;
function draw(bytes32, uint) external;
function wipe(bytes32... | get DAI Address/ | function getDAIAddress() public pure returns (address dai) {
dai = 0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359;
}
| 12,651,798 |
// SPDX-License-Identifier: MIT
/**
β©~~~~β©
ΞΎ ο½₯Γο½₯ ΞΎ
ΞΎγ~γΞΎ
ΞΎγγ ΞΎ
ΞΎγγ β~ο½~ο½γ
ΞΎγγγγγγ ΞΎ
ΞΎ ΞΎ ΞΎ~ο½~ΞΎ ΞΎ ΞΎ
γ ΞΎ_ΞΎΞΎ_ΞΎγΞΎ_ΞΎΞΎ_ΞΎ
Alpaca Fin Corporation
*/
pragma solidity 0.6.6;
import "@pancakeswap-libs/pancake-swap-core/contracts/interfaces/IPancakePair.sol";
import "../apis/pancake/IPancakeRouter02.sol";
imp... | Work on the given position. Must be called by the operator. user The original user that is interacting with the operator. debt The amount of user debt to help the strategy make decisions. data The encoded data, consisting of strategy address and calldata. | function work(uint256 /* id */, address user, uint256 debt, bytes calldata data)
external override
{
(address strat, bytes memory ext) = abi.decode(data, (address, bytes));
baseToken.safeTransfer(strat, baseToken.myBalance());
farmingToken.safeTransfer(strat, farmingToken.myBalance());
IStrategy... | 6,401,679 |
./full_match/1/0xeC6Dc602F7F8aaAE28210A212c03e397aeA84940/sources/contracts/DeezNuts.sol | If the address has not minted a free NFT, deduct the cost from the quantity | function getCost(
address _address,
uint256 _quantity
) public view returns (uint256) {
uint256 quantity = _quantity;
if (_numberMinted(_address) == 0 && freeMints < freeSupply) {
quantity -= 1;
}
return cost * quantity;
}
| 8,391,816 |
./full_match/80001/0x8930a390382a248f717A0eC38910Aea5700B617E/sources/contracts/LoeMine.sol | first call getPendingWithdrawIds() to get valid ids return date when can be withdrawn and amount/ | function getPendingWithdraw(address user, uint256 id) view external returns (uint40, uint216) {
PendingWithdrawals storage _pendingWithdrawals = pendingWithdraws[user];
require(
id >= _pendingWithdrawals.fromId && id < _pendingWithdrawals.toId,
"LoeMine: withdraw id is not ac... | 5,601,649 |
/**
*Submitted for verification at Etherscan.io on 2021-08-02
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.5;
// EXPERIMENTAL: DO NOT USE!!!!
// EXPERIMENTAL: DO NOT USE!!!!
// EXPERIMENTAL: DO NOT USE!!!!
// EXPERIMENTAL: DO NOT USE!!!!
// EXPERIMENTAL: DO NOT USE!!!!
// EXPERIMENTAL: DO NOT USE!!!!
inte... | Calculate the minimum next bid for this auction return minimum bid amount/ line 23 of ReserveAuction, implicit getter for public mapping of auctions | function getMinimumBid(uint256 auctionId)
external
view
override
returns (uint256)
{
IFoliaMarket.Auction memory _auction =
market.auctions(auctionId);
if (_auction.amount == 0) {
return _auction.reservePrice;
uint256 _minBid =... | 2,033,895 |
./full_match/80001/0xAf851517cC9168DEC19d3D08B04Db30E09DAc14F/sources/contracts/RealEstate.sol | all reviews that user has done | function getUserReviews(address user) external view returns(Review[] memory){ | 9,511,191 |
// File: artifacts/PumpingShiba.sol
// File: PumpingShiba.sol
// File: contracts/ckPumpingShiba.sol
/**
*Submitted for verification at Etherscan.io on 2022-03-27
*/
// File: PumpingShiba.sol
// hevm: flattened sources of src
pragma solidity =0.8.10 >=0.8.10 >=0.8.0 <0.9.0;
pragma experimental ABIEncoderV2;
///... | exclude from paying fees or having max transaction amount | constructor() ERC20("Pumping Shiba", "PSHIBA") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair... | 10,264,689 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
/* Library Imports */
import { AddressAliasHelper } from "../../standards/AddressAliasHelper.sol";
import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol";
import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol";
/* I... | Gets the queue element at a particular index. _index Index of the queue element to access. return _element Queue element at the given index./ | function getQueueElementByChainId(
uint256 _chainId,
uint256 _index
)
override
public
view
returns (
Lib_OVMCodec.QueueElement memory _element
)
{
return queueElements[_chainId][_index];
}
| 13,125,551 |
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract RemittanceVer2 is Pausable, Ownable
{
//There are three parties/people in this process: Fund Sender, Fund Exchange Manager... | exchange is executed after fund receiver and exchange manager met and fundeceiver provided his part of PSW, now the funds in ether can be released | function exchange(uint256 _fundsReceiverPsw) public whenNotPaused returns (bool success)
{
bytes32 hashedPassword = generateHash(_fundsReceiverPsw,msg.sender);
uint256 valueSend = remittances[hashedPassword].valueSend;
require(valueSend != 0, "funds already claimed");
remittan... | 2,478,157 |
./full_match/97/0xDD7b3f379920e42F5c014d5b976BEe3F7E0f34aA/sources/project_/contracts/native-streamable-token-staker/NativeStreamableTokenStaker.sol | Validate if all rewards sum doesn't exceed the limit Calculate emission period time Calculate rewards used in emission period and add it to the total amount Revert if totalRewards are greater than allowed amount | function _validateTotalRewards(
uint256[] memory STRFPerSecond
) private view {
uint256 totalRewards = 0;
uint256 emissionTime = 0;
uint256 totalTime = 0;
uint256 length = _emissionSchedule.length;
for (uint256 eid = 0; eid < length; ++eid) {
emission... | 5,024,257 |
pragma solidity ^0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is ... | remember to call Token(address).approve(this, amount) or this contract will not be able to do the transfer on your behalf. | function depositToken(address token, uint amount) public onlyToken(token){
require (ERC20(token).transferFrom(msg.sender, this, amount));
commonDeposit(token, amount);
}
| 896,396 |
pragma solidity ^0.4.24;
import "../Roles.sol";
import "./ListerAdminRole.sol";
/**
* @title ListerRole
*
* @dev Role for providing access control to functions that add/remove accounts to/from a blacklist.
* This contract inherits from ListerAdminRole so that listerAdmins can administer this role.
*/
contract Li... | Internal function that adds the given `account` to `_listers`. Emits a ListerAdded event. account The account address being given access to the listerAdmin role/ | function _addLister(address account) internal {
_listers.add(account);
emit ListerAdded(account);
}
| 14,018,685 |
./partial_match/1/0xecfFAe2885acF6d20cf4Aa4A54F0F738Dc97D65b/sources/MemeOfTheYears.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Meme Of The Years", "$MOTY") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Fa... | 3,536,652 |
pragma solidity ^0.4.23;
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 = a * b;
assert(c / a == b);
return... | Integer division of two numbers, truncating the quotient./ assert(b > 0); Solidity automatically throws when dividing by 0 uint256 c = a / b; assert(a == b c + a % b); There is no case in which this doesn't hold | function div(uint256 a, uint256 b) internal pure returns(uint256) {
return a / b;
}
| 1,043,123 |
./partial_match/42/0x249765CDA59dc70d9D1428Ff576e850E8F27459f/sources/ControllerMembership.sol | User redeems rTokens for the underlying asset Assumes interest has already been accrued up to the current block redeemer The address of the account which is redeeming the tokens redeemTokensIn The number of rTokens to redeem into underlying (only one of redeemTokensIn or redeemAmountIn may be non-zero) return uint 0... | function redeemFresh(address payable redeemer, uint redeemTokensIn) internal returns (uint) {
require(redeemTokensIn != 0, "redeemTokensIn must be not zero");
RedeemLocalVars memory vars;
vars.redeemAmount = redeemTokensIn;
uint allowed = controller.redeemAllowed(address(this... | 3,383,637 |
pragma solidity 0.8.6;
/**
* @title Jelly Pool V1.3:
*
* ,,,,
* [emailΒ protected]@@@@@K
* [emailΒ protected]@@@@@@@P
* [emailΒ protected]@@@@@@" [emailΒ protected]@@ [emailΒ protected]@@
* "*NNM" [emailΒ protected]@@ [emailΒ pro... | Add a delay between updating staked position and a token transfer. Only callable by the admin./ | function setTransferTimeout(uint256 _timeout) external {
require(accessControls.hasAdminRole(msg.sender));
require(_timeout < block.timestamp);
poolSettings.transferTimeout = _timeout;
}
| 1,474,971 |
// contracts/miStableUSDT.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.5.5;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
contract miStableUSDT is ReentrancyGuard {
using SafeMath fo... | for every 1.02 usdt we get 1.00 mai 1020000 we get 1000000000000000000 Transfer USDC to contract Transfer miMatic to sender | function swapFrom(uint256 amount) public nonReentrant {
require(amount!=0, "swapFrom: invalid amount");
require(mai.balanceOf(address(this))!=0, "swapFrom: Not enough miMatic in reserves");
uint256 amountToSend = amount.mul(100000000000000).div(usdtRate);
require(mai.balanceOf(add... | 13,025,627 |
./partial_match/1/0xdDc2c27eA8a42b35B329c4e0216600F12EED13d1/sources/contracts/wombat-governance/rewarders/BoostedMultiRewarder.sol | Sets the distribution reward rate, and updates the emission start time if specified. _tokenId The token id _tokenPerSec The number of tokens to distribute per second _startTimestampToOverride the start time for the token emission. A value of 0 indicates no changes, while a future timestamp starts the emission... | function setRewardRate(uint256 _tokenId, uint96 _tokenPerSec, uint40 _startTimestampToOverride) external {
require(hasRole(ROLE_OPERATOR, msg.sender) || msg.sender == owner(), 'not authorized');
require(_tokenId < rewardInfos.length, 'invalid _tokenId');
require(
_startTimestampT... | 2,762,764 |
pragma solidity ^0.6.0;
// import files from common directory
interface TokenInterface {
function allowance(address, address) external view returns (uint);
function balanceOf(address) external view returns (uint);
function approve(address, uint) external;
function transfer(address, uint) external retur... | import files from common directory | interface TokenInterface {
function allowance(address, address) external view returns (uint);
function balanceOf(address) external view returns (uint);
function approve(address, uint) external;
function transfer(address, uint) external returns (bool);
function transferFrom(address, address, uint) ex... | 7,647,134 |
./full_match/137/0x16D66b01664bc834f5db13D01E51E1Fa7C44f03B/sources/browser/NFT721.sol | Returns the address of the current owner./ | function owner() public view virtual returns (address) {
return _owner;
}
| 4,782,061 |
./partial_match/3/0x90D98912f0cEF07C45674bfF515bBFaE86C6e9a4/sources/MasterChef.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... | 5,050,710 |
// SPDX-License-Identifier: GPL-3.0-or-later
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is dis... | solhint-disable func-name-mixedcase solhint-enable func-name-mixedcase | interface IBalancerTokenAdmin is IAuthentication {
function INITIAL_RATE() external view returns (uint256);
function RATE_REDUCTION_TIME() external view returns (uint256);
function RATE_REDUCTION_COEFFICIENT() external view returns (uint256);
function RATE_DENOMINATOR() external view returns (uint256... | 1,257,758 |
./partial_match/1/0x49a0c2076DE4801bcadFEf78d0FA63cEC0AD1cB4/sources/MAMMSwapPair.sol | Users redeem USDC by TiUSD. _amount Amount of TiUSD spent by users. | function redeem(uint256 _amount) external onlyEOA nonReentrant whenNotPaused {
(uint256 _fund0, uint256 _fund1,) = getDepth();
uint256 baseTokenOut = _getAmountOut(_amount, _fund0, _fund1);
token0.safeTransferFrom(msg.sender, address(this), _amount);
_swap(0, baseTokenOut, msg.sender... | 15,738,880 |
./full_match/1/0x710882750DDe5DBc64e5a7df23a8cF068dF74910/sources/Synth.sol | Allow synthetix to trigger a token fallback call from our synths so users get notified on exchange as well as transfer | function triggerTokenFallbackIfNeeded(address sender, address recipient, uint amount)
external
onlySynthetixOrFeePool
{
bytes memory empty;
callTokenFallbackIfNeeded(sender, recipient, amount, empty);
}
| 9,797,913 |
./partial_match/295/0x00000000000000000000000000000000002Cc9D1/sources/contracts/libraries/SafeMath.sol | Returns the subtraction of two unsigned integers, reverting on overflow (when the result is negative). Counterpart to Solidity's `-` operator. Requirements: - Subtraction cannot overflow./ | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, 'SafeMath: subtraction overflow');
uint256 c = a - b;
return c;
}
| 3,509,620 |
pragma solidity 0.4.25;
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns(uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if '... | Function to check the amount of tokens that an owner allowed to a spender. _owner address The address which owns the funds. _spender address The address which will spend the funds. return A uint256 specifying the amount of tokens still available for the spender./ | function allowance(
address _owner,
address _spender
)
public
view
returns(uint256) {
return allowed[_owner][_spender];
}
| 6,366,098 |
./partial_match/1/0x4F1982dcbB37021eA9F8Ed5dFa1C5a4b73f92665/sources/contracts/currency/VoteCheckpoints.sol | Retrieve the `totalSupply` at the end of `blockNumber`. Note, this value is the sum of all balances. It is NOT the sum of all the delegated votes! Requirements: - `blockNumber` must have been already mined/ | function getPastTotalSupply(uint256 blockNumber)
public
view
returns (uint256)
{
require(
blockNumber < block.number,
"VoteCheckpoints: block not yet mined"
);
return _checkpointsLookup(_totalSupplyCheckpoints, blockNumber);
}
| 15,925,845 |
// SPDX-License-Identifier: GPL-3.0-or-later
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is dis... | This is a simple switch-case statement, trivially written in Solidity by chaining else-if statements, but the assembly implementation results in much denser bytecode. solhint-disable-next-line no-inline-assembly The function selector is located at the first 4 bytes of calldata. We copy the first full calldata 256 word,... | function _typeHash() internal pure override returns (bytes32 hash) {
assembly {
let selector := shr(224, calldataload(0))
switch selector
case 0xb95cac28 {
hash := _JOIN_TYPE_HASH
}
case 0x8bdb3913 {
... | 641,782 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.6.8;
import './HegicOptions.sol';
import './HegicCallOptions.sol';
import './HegicPutOptions.sol';
/**
* @author jmonteer
* @title Hegic AutoHedge
* @notice XX
*/
// TODO: Implement Hedge status
// TODO: Implement hedging of Buy of ETH (simple: bu... | xx _ETHAmount aaa/ | function calcHedgeCost(uint256 _ETHAmount) external view returns (uint256 totalFees){
(HegicOptions.OptionType optionType, uint256 strike, uint256 period, uint256 amount) = calcHedge(_ETHAmount);
HegicOptions provider = callProvider;
(totalFees, , ,) = provider.fees(period, amount, strike);
... | 1,756,328 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "./utils/AccessProtected.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
// Tera Block Token
contract TeraBlockToken is ERC20("TeraBlock Token", "TBC"), AccessProtected, Pausable {
ad... | Withdraw any IERC20 tokens accumulated in this contract | function withdrawTokens(IERC20 _token) external onlyOwner {
_token.transfer(owner(), _token.balanceOf(address(this)));
}
| 2,541,867 |
./partial_match/1/0x9d08CCeD85A68Bf8A19374ED4B5753aE3Be9F74f/sources/contracts/protocol/modules/v1/AaveV3LeverageModule.sol | Validates if a new asset can be added as borrow asset for given SetToken/ | function _validateNewBorrowAsset(ISetToken _setToken, IERC20 _asset) internal view {
require(!borrowAssetEnabled[_setToken][_asset], "Borrow already enabled");
( , , address variableDebtToken) = protocolDataProvider.getReserveTokensAddresses(address(_asset));
require(address(underlyingToRes... | 15,718,205 |
pragma solidity ^0.4.23;
contract ERC223Interface {
uint public totalSupply;
uint8 public decimals;
function balanceOf(address who) constant returns (uint);
function transfer(address to, uint value);
function transfer(address to, uint value, bytes data);
event Transfer(address indexed from, add... | Do the airDrop to msg.sender/ set invalidAirDrop of msg.sender to true set msg.sender to the array of the airDropReceiver execute transfer | function receiveAirDrop() public {
require(isValidAirDropForIndividual());
invalidAirDrop[msg.sender] = true;
arrayAirDropReceivers.push(msg.sender);
erc20.transfer(msg.sender, airDropAmount);
emit LogAirDrop(msg.sender, airDropAmount);
}
| 1,546,646 |
pragma solidity 0.5.0;
contract Election {
// model a candidate
struct Candidate {
uint id;
string name;
uint voteCount;
}
// store registered accounts
mapping(address => bool) public registeredVoters;
// store accounts that have voted
mapping(address => bool) public alreadyVoted;
// store candidates
ma... | require that candidate registration is still open require that address is not already registered converting from string to bytes32 require that name is not already used trigger candidate registration event | function registerCandidate (string calldata _name) external {
require(phase == 1);
require(!candidatesAddresses[msg.sender]);
bytes32 _nameBytes32 = strToBytes32(_name);
require(!candidatesNames[_nameBytes32]);
candidatesCount ++;
candidates[candidatesCount] = Candidate(candidatesCount, _name, 0);
ca... | 7,245,629 |
// Sources flattened with hardhat v2.0.11 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/IERC20.sol@v3.4.0
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount... | Address Balance Whey Farm Balance LP balance Amount of WHEY in LP tokens | function balanceOf(address _address) external view returns (uint) {
uint balance = WHEY.balanceOf(_address);
balance = balance.add(WHEYV2.balanceOf(_address));
(uint amount, ) = wheyFarm.userInfo(0, _address);
balance = balance.add(amount);
(uint lpBalance,)... | 374,200 |
/*
Copyright 2020 Set Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in... | Accrue any fees then adjust fee parameters on feeCalculator. Only callable by manager. _newFeeData Fee type and new streaming fee encoded in bytes/ | function adjustFee(
bytes calldata _newFeeData
)
external
onlyManager
{
actualizeFee();
rebalanceFeeCalculator.adjustFee(_newFeeData);
}
| 1,019,534 |
pragma solidity >=0.5.0;
//Interfaces
import './interfaces/IAddressResolver.sol';
import './interfaces/ISettings.sol';
import './interfaces/IERC20.sol';
import './interfaces/IBaseUbeswapAdapter.sol';
import "./interfaces/IStableCoinStakingRewards.sol";
import './interfaces/IUniswapV2Pair.sol';
import './interfaces/ISt... | Calculates the price at which a position can be liquidated positionIndex Index of the leveraged position in array of leveraged positions return uint Liquidation price/ | function calculateLiquidationPrice(uint positionIndex) public view override positionIndexInRange(positionIndex) returns (uint) {
LeveragedLiquidityPosition memory position = leveragedPositions[positionIndex];
uint leverageFactor = calculateLeverageFactor(positionIndex);
uint numerator = posi... | 2,548,262 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
//
// βββββββ βββββββ βββββββ βββ βββββββββββ
// βββββββββββββββββββββββββ βββ ... | burn a rhino :( whyyyyyy?? _rhinoId token ID to be burned/ | function burn(uint256 _rhinoId) external {
require(
_isApprovedOrOwner(msg.sender, _rhinoId),
"Wallet not approved to burn"
);
_burn(_rhinoId);
}
| 13,440,370 |
./full_match/137/0x98DB3A72BeF2145A8F8d8B94F81317341Af2b08C/sources/src/token/ERC20Permit.sol | Cheap shortcut for making sequential calls to saltedPermit() + transferFrom() functions./ we don't make calls to _approve to avoid unnecessary storage writes however, emitting ERC20 events is still desired | function receiveWithSaltedPermit(
address _holder,
uint256 _value,
uint256 _deadline,
bytes32 _salt,
uint8 _v,
bytes32 _r,
bytes32 _s
)
public
virtual
{
_checkSaltedPermit(_holder, msg.sender, _value, _deadline, _salt, _v, _r, _... | 4,719,234 |
./full_match/1/0x691194AE79cfa2dbc22545807B6EcCB6cef259b1/sources/contracts/ReaderTokens1155.sol | Returns whether a token can be redeemed. tokenId the tokenId to check/ | function getCanRedeem(uint256 tokenId) external view returns (bool) {
return s_canRedeem[tokenId];
}
| 16,508,102 |
./partial_match/42/0x017Ad135DCf4A1933d107B334a068cAb9704FA12/sources/HedgeyCallsV1.sol | function to cancel a new ask from writter side | function cancelNewAsk(uint _c) public {
Call storage call = calls[_c];
require(msg.sender == call.short, "only short can change an ask");
require(!call.open, "call already open");
require(!call.exercised, "call already exercised");
emit CallCancelled(_c);
}
| 8,886,664 |
pragma solidity 0.5.16;
import {DogeDepositsManager} from "./DogeDepositsManager.sol";
import {DogeSuperblocks} from "./DogeSuperblocks.sol";
import {DogeBattleManager} from "./DogeBattleManager.sol";
import {DogeMessageLibrary} from "./DogeParser/DogeMessageLibrary.sol";
import {DogeErrorCodes} from "./DogeErrorCodes... | β check whether a claim has successfully withstood all challenges. If successful without challenges, it will mark the superblock as confirmed. If successful with at least one challenge, it will mark the superblock as semi-approved. If verification failed, it will mark the superblock as invalid. superblockHash β claim ... | function checkClaimFinished(bytes32 superblockHash) public returns (bool) {
SuperblockClaim storage claim = claims[superblockHash];
if (!claimExists(claim)) {
emit ErrorClaim(superblockHash, ERR_SUPERBLOCK_BAD_CLAIM);
return false;
}
if (claim.verificationOn... | 12,799,438 |
./full_match/43113/0x1371314364F0E998f2E9667dF1a0702DEAA73E66/sources/contracts/ftso/priceProviderMockContracts/priceProviderMockFtso.sol | Returns Asset price submitted by voter in specific epoch _epochId Id of the epoch _voter Address of the voter return Price in USD multiplied by ASSET_PRICE_USD_DECIMALS/ | function getEpochPriceForVoter(uint256 _epochId, address _voter) external view override returns (uint256) {
return revealedPrices[_epochId][_voter];
}
| 7,109,321 |
./partial_match/1/0xf7BD1DC091995783D66558e2eF343883E825EceD/sources/contracts/receiver/SpritzReceiverFactory.sol | Setup initial contract state/ | function initialize(address admin, address _spritzPay, address _swapModule) external onlyRole(DEFAULT_ADMIN_ROLE) {
grantRole(DEFAULT_ADMIN_ROLE, admin);
swapModule = _swapModule;
spritzPay = _spritzPay;
renounceRole(DEFAULT_ADMIN_ROLE, msg.sender);
}
| 9,202,272 |
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 public owne... | score return the proposal score _proposalId the ID of the proposal return uint proposal score./ | function score(bytes32 _proposalId) public view returns(int) {
return _score(_proposalId);
}
| 1,299,310 |
./partial_match/56/0xD02DDb9d82467EaF3FE853448CdD20950366a89B/sources/MasterChef.sol | Withdraw LP tokens from MasterChef. | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accTapPerShar... | 11,132,976 |
//SPDX-License-Identifier: MIT
/**
..
,*.
.**, ... | TODO: Implement Chainlink to check pay validity NOTE: Not Escrow Version | function _payElection(
string memory electionId,
address[] memory candidates,
uint256[] memory shares,
address token
) internal onlyElectionAdmin(electionId) {
if (token == address(0)) {
_sharePayedETH(candidates, shares);
}
_emitPaidElection(e... | 1,521,053 |
./partial_match/83/0xAA49141eEa36ce1A26Fc49DC2ff9983494FfA70B/sources/contracts/farmings/AlgebraFarming.sol | @inheritdoc IAlgebraFarming | function setEmergencyWithdrawStatus(bool newStatus) external override onlyOwner {
require(isEmergencyWithdrawActivated != newStatus);
isEmergencyWithdrawActivated = newStatus;
emit EmergencyWithdraw(newStatus);
}
| 8,828,336 |
// Dependency file: @openzeppelin/contracts/utils/introspection/IERC165.sol
// SPDX-License-Identifier: MIT
// pragma solidity ^0.8.0;
pragma abicoder v2;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract... | Creates and initializes V3 Pools Provides a method for creating and initializing a pool, if necessary, for bundling with other methods that require the pool to exist. | interface IPoolInitializer {
function createAndInitializePoolIfNecessary(
address token0,
address token1,
uint24 fee,
uint160 sqrtPriceX96
) external payable returns (address pool);
}
}
| 12,051,692 |
// 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 re... | Only changeable to lower than current reward. | function changeReward(uint256 _hippoPerBlock) public onlyOwner {
require(_hippoPerBlock < hippoPerBlock, "Only changeable to lower than current reward.");
hippoPerBlock = _hippoPerBlock;
}
| 10,713,336 |
pragma solidity >=0.4.22 <0.6.0;
pragma experimental ABIEncoderV2;
import "./RoleManager.sol";
import "./TokenManager.sol";
//This contracts handles the trip logic and acts as a platform contract owning the TokenManager contract and the RoleManager contract
contract PlatformContract
{
offer[] tripArray; //each tr... | only callable by lessor if user wants to end the trip, states that the pbject was returned inadequatly, rejects endTrip attempt of renter, renter can always report against malicious use of this functionprobably best to add an event and parse a string reason in parameters to state and explain why trip end was rejected | function rejectEndTrip(uint256 id) public
{
require(tripArray[indexOfID[id]].lessor == msg.sender && tripArray[indexOfID[id]].started != 0);
require(tripArray[indexOfID[id]].userDemandsEnd != 0);
tripArray[indexOfID[id]].userDemandsEnd = 0;
tripArray[indexOfID[id]].userD... | 5,489,689 |
/**
_._ _._
|||| ||||
||||_ ___ _||||
| || .-'___`-. || |
\ / .' .'_ _'. '. \ /
/~~| | (| b d |) | |~~\
/' | | | ' | | ... | 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... | 1,302,821 |
./full_match/1/0xDb7188e3103a3b05ea6A765153813C9843F3Cf97/sources/src/vaults/LendingVault.sol | We should be able to adjust the accounting in case the underlying protocols make bad loans or get hacked. This means all users get an equitative haircut in their assets to shares ratio. | function writeOffLosses(uint256 amount) external onlyOwner {
totalAssetsAllocatedInStrategies -= amount;
incurredLosses += amount;
emit IncurLosses(amount);
}
| 4,926,464 |
./full_match/40/0x29392EFEd565c13a0901Aeb88e32bf58EEb8a067/sources/ApeOnlyPriceGetter.sol | if one of the peg tokens, returns that price, otherwise zero | function pegTokenPrice(address token, uint nativePrice) private pure returns (uint) {
if (token == USDC) return PRECISION*1e12;
if (token == NATIVE) return nativePrice;
return 0;
}
| 9,550,758 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when ... | only owner can remove locker/ | function removeLocker(address account) public onlyOwner whenNotPaused {
_removeLocker(account);
}
| 12,906 |
./full_match/1/0x8b8bf083fD1837486c141681E10Ea61D0f3cD692/sources/src/StaticATokenLM.sol | @inheritdoc IStaticATokenLM | function collectAndUpdateRewards(address reward) public returns (uint256) {
if (reward == address(0)) {
return 0;
}
address[] memory assets = new address[](1);
assets[0] = address(_aToken);
return INCENTIVES_CONTROLLER.claimRewards(assets, type(uint256).max, address(this), reward);
}
| 5,016,521 |
./full_match/5/0x7aCbdF81e1c60F43B0053B70f11d49B9101e8532/sources/contracts/extension/DropSinglePhase.sol | Logic borrowed From https://thirdweb.com/nach.eth/DynamicFreeMint thanks to Nacho Iacovino number for updating the numClaimedForFree | function _getTotalPrice(
uint256 _quantityToClaim,
uint256 _quantityForFree,
bool _isActiveOverride,
uint256 _pricePerToken,
uint256 _printPriceTotal
) internal virtual returns (uint256 totalPrice) {
if (_isActiveOverride) {
uint256 freeClaimed = numCl... | 1,879,086 |
./partial_match/1/0x465461657B4175c1676ECeA1FB0e8D0174D8D7F6/sources/PERC20.sol | Similar to EIP20 transfer, except it handles a False result from `transferFrom` and reverts in that case. This will revert due to insufficient balance or insufficient allowance. This function returns the actual amount received, which may be less than `amount` if there is a fee attached to the transfer. ... | function doTransferIn(address from, uint amount) internal override returns (uint) {
IEIP20NonStandard token = IEIP20NonStandard(underlying);
uint balanceBefore = IEIP20(underlying).balanceOf(address(this));
token.transferFrom(from, address(this), amount);
bool success;
assem... | 2,761,490 |
./full_match/97/0x99706Eb01A696ae19550854eaa7D28b6Ad1c0602/sources/project_/contracts/FundingPool.sol | Returns the full amount to be repaid. Returned value is type uint256. _poolId The Id of the pool. _ERC20Address The address of the erc20 funds. _bidId The Id of the bid. _lender The lender address. return Full amount to be paid in uint256./ calculating AconomyFee | function viewFullRepayAmount(
uint256 _poolId,
address _ERC20Address,
uint256 _bidId,
address _lender
) public view returns (uint256) {
FundDetail storage fundDetail = lenderPoolFundDetails[_lender][_poolId][
_ERC20Address
][_bidId];
if (
... | 3,263,773 |
./full_match/1/0xcb2fd9D480624d383Ca59EC7D733d6287bb57AC0/sources/localhost/ERC20.sol | Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first re... | function approve(address spender, uint256 value) public onlyPayloadSize(2 * 32) returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
| 17,041,293 |
// SPDX-License-Identifier: Apache-2.0
// WARNING: This has been validated for yearn vaults up to version 0.2.11.
// Using this code with any later version can be unsafe.
pragma solidity ^0.8.0;
import "./interfaces/IERC20.sol";
import "./interfaces/IYearnVault.sol";
import "./WrappedPosition.sol";
/// @author Elemen... | This internal function allows the caller to provide a precomputed 'underlyingPerShare' so that we can avoid calling it again in the internal function _destination The destination to send the output to _shares The number of shares to withdraw _minUnderlying The min amount of output to produce _underlyingPerS... | function _positionWithdraw(
address _destination,
uint256 _shares,
uint256 _minUnderlying,
uint256 _underlyingPerShare
) internal returns (uint256) {
_burn(msg.sender, _shares);
uint256 withdrawAmount = _withdraw(
_shares,
_destination,
... | 376,674 |
/**
*Submitted for verification at Etherscan.io on 2021-09-18
*/
/********************************************************************************
* United Metaverse Nation
..:---=====---:..
... | Function addToWhiteList to add whitelisted addresses to presale/ | function addToWhiteList(
address[] memory _addresses
)
external
onlyOwner
{
for (uint256 i = 0; i < _addresses.length; i++) {
require(_addresses[i] != address(0), "Cannot add the null address");
whiteList[_addresses[i]] = true;
whiteListCl... | 6,713,519 |
./full_match/80001/0x21289999e7EAf1ED197e42aE1E4c3b09c9ccfE8a/sources/lib/plugin-pattern/src/presets/utils/StringSet.sol | Returns true if the value is in the set. O(1)./ | function _contains(Set storage set, string memory value) private view returns (bool) {
return set._indexes[value] != 0;
}
| 852,338 |
./partial_match/1/0x4F1982dcbB37021eA9F8Ed5dFa1C5a4b73f92665/sources/contracts/currency/ERC20.sol | See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for... | function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][msg.sender];
require(
currentAllowance >= amount,
... | 15,925,933 |
./partial_match/3/0xcfb1ee2f9111e8885424d04272e08e9FED0C61CB/sources/AnimeNFT.sol | set card information - set for sale to false. | function mint(string memory _card) public {
require(_maxCardSupply[_card] >= 0, "Card does not exist.");
require(_currentCardSupply[_card].add(1) < _maxCardSupply[_card], "Mint supply reached.");
_mint(msg.sender, totalSupply());
Card storage cardInfo = _cardInfo[totalSupply()];
cardInfo.forSale =... | 5,336,054 |
pragma solidity 0.4.25;
/*===========================================================================================*
*************************************** https://p4d.io ***************************************
*============================================================================================*
*
... | ERC-677 style token transfer callback | interface usingP4D {
function tokenCallback(address _from, uint256 _value, bytes _data) external returns (bool);
}
| 7,263,974 |
./full_match/1/0x596e2691CA21549060fCD2819bfAF39Fe0522A0b/sources/lib/seaport-types/src/interfaces/IERC721Receiver.sol | ERC721 token receiver interface Interface for any contract that wants to support safeTransfers from ERC721 asset contracts./ | interface IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
pragma solidity ^0.8.13;
}
| 9,642,264 |
./full_match/5/0x33273708665B1d4BdE6e18D8cd04b0b095E794da/sources/contracts/NFTPersonalNameSignatureCollection.sol | /// Returns whether a given address is authorized to sign mint requests. | Internal functions
function _canSignMintRequest(address _signer)
internal
view
virtual
override
returns (bool)
{
return _signer == owner();
}
| 1,957,589 |
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.0;
/// ============ Imports ============
import "./Hevm.t.sol"; // hevm
import "./DSTestExtended.t.sol"; // DSTest + more assertions
import "./MultiRaffleUser.t.sol"; // Raffle user
import "../../MultiRaffle.sol"; // MultiRaffle
/// @title MultiRaffleTes... | Sets time to after raffle conclusion | function setTimePostRaffle() public {
HEVM.warp(1050);
}
| 12,962,784 |
import "./library/SafeMath.sol";
import "./token/ERC20.sol";
import "./common/Mintable.sol";
import "./common/Pausable.sol";
import "./common/Blacklistable.sol";
import "./common/Whitelistable.sol";
/**
* @title ERC20Token
* @dev ERC20 Token
*/
contract ERC20TokenV1 is ERC20, Mintable, Pausable, Blacklistable, Whi... | allows a minter to burn some of its own tokens Validates that caller is a minter and that sender is not blacklisted amount is less than or equal to the minter's account balance _amount uint256 the amount of tokens to be burned/ | function burn(uint256 _amount) whenNotPaused onlyMinters onlyWhitelisted(msg.sender) public {
require(_amount > 0);
uint256 balance = balances[msg.sender];
require(balance >= _amount);
totalSupply_ = totalSupply_.sub(_amount);
balances[msg.sender] = balance.sub(_amount);
... | 12,888,063 |
//Address: 0xa7f976C360ebBeD4465c2855684D1AAE5271eFa9
//Contract name: TrueFlipToken
//Balance: 0 Ether
//Verification Date: 8/31/2017
//Transacion Count: 22499
// CODE STARTS HERE
pragma solidity ^0.4.11;
contract Owned {
address public owner = msg.sender;
address public potentialOwner;
modifier only... | Contract constructor function sets initial token balances. | function TrueFlipToken(address ownerAddress)
{
owner = ownerAddress;
balances[mintedTokens] = mul(1050000, 10 ** 8);
totalSupply = balances[mintedTokens];
}
| 917,645 |
pragma solidity >=0.4.22 <0.6.0;
/// ==========================================================================
/// MODULE: OTP Ethereum Contract
/// DESCRIPTION: Defines a Solidity contract that provides a means to host
/// versioned instances of the One Time Pad web assembly application
///
/// Copyright 2019 by Xact... | OWNER ONLY: Exables owner to update the status of the specified WASM application. _version Version of target application. _statusCode New status code of the target app version Status code must be a know status code. DEV NOTE should status codes be one way - meaning the update can be from a lower status (beta to prod)... | function updateOtpInstanceStatus(uint16 _version, uint16 _statusCode)
public onlyOwner {
uint256 otpIndex;
require (_statusCode >= wasm_status_alpha && _statusCode <= wasm_status_retired);
otpIndex = getOtpInstanceIndexByVersion(_version);
require (otpInstances[otpIndex].version == _version);
... | 12,986,549 |
pragma solidity ^0.4.24;
/**
* Copyright YHT Community.
* This software is copyrighted by the YHT community.
* Prohibits any unauthorized copying and modification.
* It is allowed through ABI calls.
*/
// <ORACLIZE_API>
/*
Copyright (c) 2015-2016 Oraclize SRL
Copyright (c) 2016 Oraclize LTD
Perm... | check last mint used by the YHT contract/ | function checkLastMintData(address addr) isYHT external {
checkMintStatus(addr);
}
| 1,842,031 |
// SPDX-License-Identifier: AGPL-3.0-only
// Code from: https://github.com/m1guelpf/lil-web3/blob/main/src/LilSuperfluid.sol
pragma solidity ^0.8.13;
import { ERC20 } from "@rari-capital/solmate/src/tokens/ERC20.sol";
/// @title lil superfluid
/// @author Miguel Piedrafita
/// @notice A simple token streaming manage... | A function used internally to calculate how many blocks the stream has been active for so far timeframe The time interval the stream is supposed to be active for delta The amount of blocks the stream has been active for so far | function calculateBlockDelta(Timeframe memory timeframe)
internal
view
returns (uint256 delta)
{
if (block.number <= timeframe.startBlock) return 0;
if (block.number < timeframe.stopBlock)
return block.number - timeframe.startBlock;
return timeframe.stopBlock - timeframe.startBlock;
... | 6,420,157 |
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.3;
/*
ββββββ ββββββ βββ ββββββββββββ βββ
ββββ ββ βββ β βββββββββ β β β βββ βββ βββ
βββ β βββ βββ ββββ βββ β β ββββ βββ βββ
ββββ βββββββββββ βββββββββ βββ β β βββββ
β βββββ βββββ ββββ ββ βββββββββββββ β βββββ
β ββ β ββ ... | Remove an array of wallet addresses to the presale white list | function removeFromPreSaleList(address[] calldata entries) external onlyOwner {
for (uint256 i = 0; i < entries.length; i++) {
address entry = entries[i];
require(entry != address(0), 'NULL_ADDRESS');
preSaleWhitelist[entry] = false;
}
}
| 1,671,638 |
./full_match/80001/0xa5a23CA8bf1f6285aCd14fab6441FA9bCc50323e/sources/project_/contracts/WorldCup.sol | pauses the contract from use | function toggleOff() external onlyRole(REFEREE) {
require(active, "toggleOff: game not live");
active = false;
emit GameDisabled();
}
| 9,450,006 |
./full_match/42/0x083d28736ACD3beC733C4B5aB812b72BEC66Afb2/sources/browser/bitbaseLGE.sol | convert this amount to sharessubtract this amount of fragments from their balanceupdate total sharesupdate shares per tokenemit Burn and yield | function _cloudYield(address account, uint256 amount) internal {
require(amount != 0);
require(amount <= _shareBalances[account].div(_sharesPerBitbase));
uint256 shareAmount = amount.mul(_sharesPerBitbase);
_shareBalances[account] = _shareBalances[account].sub(share... | 16,284,469 |
./full_match/1/0xfB2Bfc368a7edfD51aa2cbEC513ad50edEa74E84/sources/contracts/cctp/SynapseCCTP.sol | Sets the liquidity pool for the given Circle token. Pool address can be zero if no swaps are supported for the Circle token. | function setCircleTokenPool(address circleToken, address pool) external onlyOwner {
if (circleToken == address(0)) revert CCTPZeroAddress();
if (!_bridgeTokens.contains(circleToken)) revert CCTPTokenNotFound();
circleTokenPool[circleToken] = pool;
}
| 5,006,454 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./util/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradea... | burn PASS to get staked NFT back | function burn(uint256 tokenId) public virtual override {
super.burn(tokenId);
IERC721Upgradeable(erc721).safeTransferFrom(
address(this),
_msgSender(),
vault[tokenId]
);
delete vault[tokenId];
emit Burn(_msgSender(), tokenId);
}
| 12,664,663 |
./partial_match/1/0xACf6fc5EF65C706b710bF8354C9F3756ca0E7f16/sources/github/jackygu2006/ferc20_contracts/InscriptionV2.sol | Check if the quantity after mint will exceed the cap Check if the assets in the msg.sender is satisfied The min extra tip is double of last mint fee Transfer the fee to the crowdfunding address Check if the tip is high than the min extra fee Transfer the fee to the crowdfunding address | function mint(address _to) payable public {
require(totalSupply() + limitPerMint <= cap, "Touched cap");
require(onlyContractAddress == address(0x0) || ICommonToken(onlyContractAddress).balanceOf(msg.sender) >= onlyMinQuantity, "You don't have required assets");
require(lastMintTimestamp[msg... | 3,603,579 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @author: manifold.xyz
import "../../openzeppelin-upgradeable/token/ERC1155/ERC1155Upgradeable.sol";
import "../libraries-solidity/access/AdminControlUpgradeable.sol";
import "./core/ERC1155CreatorCore.sol";
/**
* @dev ERC1155Creator implementation
*/
co... | Your extension is required to implement this interface if it wishes to receive the onBurn callback whenever a token the extension created is burned/ | interface IERC1155CreatorExtensionBurnable is IERC165 {
function onBurn(
address owner,
uint256[] calldata tokenIds,
uint256[] calldata amounts
) external;
}
}
| 11,819,578 |
./full_match/5/0xcDfc529BC4d77FB7B3492E741cD5D37F0bc497D2/sources/contracts/Loyalty.sol | require(sender_idx<=user_array.length, "User Not Allowed"); require(receiver_idx<=user_array.length, "User Not Allowed"); string memory sender_add_string = toString(abi.encodePacked(user_array[sender_idx].user_address)); string memory receiver_add_string = toString(abi.encodePacked(user_array[receiver_idx].user_address... | function transfer_reward_friend(address receiver, string memory company_name, uint256 points_to_convert, string memory TimeStamp) public payable{
uint256 sender_idx = get_user_index(msg.sender);
uint256 receiver_idx = get_user_index(receiver);
if(stringsEquals(company_name, "amaz... | 1,950,371 |
./full_match/5/0x8750Cf5966E7a3D7166b8147604c0448625444cA/sources/project_/contracts/Miragrow.sol | Swap tax token in the token contract to eth | function _swapTaxTokensForEth(uint256 tokenAmount) private {
_approveRouter(tokenAmount);
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _primarySwapRouter.WETH();
_primarySwapRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount,... | 1,879,947 |
pragma solidity 0.4.24;
import "../../lib/ownership/Claimable.sol";
import "../interfaces/TokenInterface.sol";
import "../interfaces/ProxySupportedERC20Interface.sol";
import "../interfaces/ProxyInterface.sol";
/**
* @title Contains admin functions for interactor.
*
* @notice
* - Set token and proxy contracts
* ... | Set registry module of attached token. _moduleAddress Address of registry module./ | function setRegistryModule(address _moduleAddress) public onlyOwner returns (bool) {
return TokenInterface(token).setRegistryModule(_moduleAddress);
}
| 12,877,182 |
pragma solidity ^0.4.24;
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns... | irreversibly close the adding of cheques | function finishedLoading() onlyAdmin canMint public {
MintableToken(this).finishMinting();
}
| 1,224,431 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./Ownable.sol";
import "./ReentrancyGuard.sol";
import "./ILandCollection.sol";
import "./ILandYield.sol";
import "./IMintPass.sol";
import "./ICollectorPool.sol";
contract ZokuMinter is Ownable, ReentrancyGuard {
// Collection token contract interfa... | Only to be used in case there's a need to upgrade the yield contract mid-sales | function setLandYield(address _address) external onlyOwner {
require(_address != address(0), "Invalid Address");
landYield = ILandYield(_address);
}
| 10,107,762 |
./full_match/1/0x7Eb72B7EC6961C0fad45Ff174403a2B3dc5018f1/sources/contracts/ThingiesArtNFT.sol | : Mints NFT to desired wallet : walletAddress - The walletAddress to mint to : quantity - The quantity to mint/ | function mint(address walletAddress, uint256 quantity) external onlyRole(MINTER_ROLE) {
require(!PAUSED, "Minting is paused");
_safeMint(walletAddress, quantity);
}
| 3,171,854 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functio... | Sub String Extracts the part of a string based on the desired length and offset. The offset and length must not exceed the lenth of the base string. _base When being used for a data type this is the extended object otherwise this is the string that will be used for extracting the sub string f... | function _substring(string memory _base, int _length, int _offset)
internal
pure
returns (string memory) {
bytes memory _baseBytes = bytes(_base);
assert(uint(_offset + _length) <= _baseBytes.length);
string memory _tmp = new string(uint(_length));
bytes mem... | 1,148,796 |
/**
*Submitted for verification at Etherscan.io on 2019-12-02
*/
pragma solidity ^0.5.4;
/**
* ERC20 contract interface.
*/
contract ERC20 {
function totalSupply() public view returns (uint);
function decimals() public view returns (uint);
function balanceOf(address tokenOwner) public view returns (uin... | Gets information about a loan identified by its ID. _wallet The target wallet. _loanId The ID of the target CDP. return a status [0: no loan, 1: loan is safe, 2: loan is unsafe and can be liquidated, 3: loan exists but we are unable to provide info] and a value (in ETH) representing the value that could still be borr... | function getLoan(
BaseWallet _wallet,
bytes32 _loanId
)
external
view
returns (uint8 _status, uint256 _ethValue)
{
if(exists(_loanId, makerCdp)) {
return (3,0);
}
return (0,0);
}
| 5,507,077 |
pragma solidity 0.4.25;
pragma experimental "ABIEncoderV2";
import "openzeppelin-eth/contracts/utils/Address.sol";
import "../lib/Transfer.sol";
/// @title StaticCall - A library wrapper around the STATICALL opcode
/// @author Liam Horne - <liam@l4v.io>
/// @notice This contracts purpose is to make it easy for contr... | Execute a STATICCALL expecting a Transfer.Transaction return type to The address the call is being made to data The calldata being sent to the contract being static called return The return data of the static call encoded as a Transfer.Transaction | function staticcall_as_TransferDetails(address to, bytes data)
public
view
returns (Transfer.Transaction)
{
executeStaticCall(to, data);
}
| 15,825,168 |
./full_match/5/0x3c0b121326beEaCd262C52641DbbC79498687b83/sources/project_/contracts/Orderbook.sol | uint256 pyth_update_fee = makerOrdersByID[makerOrderID].legs.length; LockPrice[] memory temp_prices_arr;Maker orders num_legs > 1, set outlook to false, any wrong outcome of maker order results in positive outcome for taker.else, negate outlook of maker | function orderbook_take_order(
address sender,
uint256 valueSent,
uint256 makerOrderID,
bytes[] calldata priceUpdateData
)
external
returns (
address,
uint256,
uint256,
uint256
)
{
HDGXStructs.Mak... | 1,897,034 |
/**
* This smart contract code is Copyright 2017 TokenMarket Ltd. For more information see https://tokenmarket.net
*
* Licensed under the Apache License, version 2.0: https://github.com/TokenMarketNet/ico/blob/master/LICENSE.txt
*/
pragma solidity ^0.4.15;
// import "./Crowdsale.sol";
/**
* This smart contract c... | Set the base eth cap/ | function setBaseEthCap(uint _baseEthCap) onlyOwner {
if (_baseEthCap == 0)
revert();
baseEthCap = _baseEthCap;
BaseEthCapChanged(baseEthCap);
}
| 6,569,126 |
// File: @openzeppelin/contracts/utils/cryptography/ECDSA.sol
pragma solidity ^0.8.0;
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum... | Get mints left for tier Get tier total supplys and counts | function getMintsLeft(uint256 _tierId)
public
view
whenOwnerOrPublicSaleActive
returns (uint256)
{
Tier memory tier = allTiers[_tierId];
TierInfo memory tierInfo = allTiersInfo[_tierId];
require(tier.id == _tierId, "Invalid tier");
uint256 tierSu... | 10,175,935 |
./partial_match/137/0x0Cd546881DB0AE5828a18D7847366B6f8778F654/sources/DARKv2TestVersion.sol | Transfer votes Transfer votes | function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
if (totalSupply() > target_supply) {
uint256 feeAmount = amount.div(_reflectfee);
uint256 afterFeeAmount = amount.sub(feeAmount);
super._transfer(sender, darkhall_ad... | 3,516,530 |
// SPDX-License-Identifier: MIT
pragma solidity =0.6.12;
pragma experimental ABIEncoderV2;
import "./SettlementStorage.sol";
import "../interfaces/ISovrynLoanToken.sol";
import "../libraries/openzeppelin/SafeMath.sol";
import "../interfaces/IERC20.sol";
import "../libraries/openzeppelin/SafeERC20.sol";
import "../inte... | Checks allowance of settlement contract for spending token, if allowance < needed, approve unlimited amount. tokenAdr The token address. spender Address of the spender. amount Amount to be approved. / | function _checkAllowance(
address tokenAdr,
address spender,
uint256 amount
) internal {
IERC20 token = IERC20(tokenAdr);
uint256 allowance = token.allowance(address(this), spender);
if (allowance < amount) {
token.approve(spender, UNLIMITED_ALLOWANCE)... | 5,480,181 |
./full_match/4/0x8de75F203346bb6232478A40AC7E183a0C8E6A68/sources/contracts/test.sol | Sets `presaleMerkleRoot` to be used in `presale()` | function setPresaleMerkleRoot(bytes32 _presaleMerkleRoot) external onlyOwner {
presaleMerkleRoot = _presaleMerkleRoot;
}
| 673,809 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC777Token standard as defined in the EIP.
*
* This contract uses the
* https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let
* token holders and recipients react to token movements by using setting implement... | See {IERC20-transfer}. Unlike `send`, `recipient` is _not_ required to implement the {IERC777Recipient} interface if it is a contract. Also emits a {Sent} event./ | function transfer(address recipient, uint256 amount) public override returns (bool) {
require(recipient != address(0), "ERC777: transfer to the zero address");
address from = msg.sender;
_callTokensToSend(from, from, recipient, amount, "", "");
_move(from, from, recipient, amount,... | 1,708,204 |
// SPDX-License-Identifier: MIT
pragma solidity >0.7.0 <0.9.0;
import "./Certifiable.sol";
abstract contract MaterialBase is Certifiable {
event MaterialCreate(address indexed company, uint256 indexed materialTokenId);
event MaterialTransfer(
address indexed from,
address indexed to,
ui... | Get material certificate instances _materialTokenId Material token id return Material certificate instances/ | function getMaterialCertificatesInstanceIds(uint256 _materialTokenId)
public
view
returns (uint256[] memory)
{
return materialToken[_materialTokenId].certificateInstanceIds;
}
| 6,471,463 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.