Feature Tip: Add private address tag to any address under My Name Tag !
Source Code
Latest 25 from a total of 49 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Multi Claim | 22250226 | 326 days ago | IN | 0 ETH | 0.00032881 | ||||
| Multi Claim | 20702034 | 542 days ago | IN | 0 ETH | 0.00019645 | ||||
| Multi Claim | 20376524 | 587 days ago | IN | 0 ETH | 0.00120519 | ||||
| Multi Claim | 20336117 | 593 days ago | IN | 0 ETH | 0.00168431 | ||||
| Multi Claim | 20302482 | 597 days ago | IN | 0 ETH | 0.00042771 | ||||
| Claim | 20110398 | 624 days ago | IN | 0 ETH | 0.00027972 | ||||
| Multi Claim | 20087561 | 628 days ago | IN | 0 ETH | 0.00077047 | ||||
| Multi Claim | 20082264 | 628 days ago | IN | 0 ETH | 0.00489201 | ||||
| Multi Claim | 20075189 | 629 days ago | IN | 0 ETH | 0.00830111 | ||||
| Multi Claim | 20052209 | 632 days ago | IN | 0 ETH | 0.00044931 | ||||
| Multi Claim | 20045053 | 633 days ago | IN | 0 ETH | 0.00060549 | ||||
| Claim | 20036647 | 635 days ago | IN | 0 ETH | 0.0007483 | ||||
| Claim | 20023368 | 636 days ago | IN | 0 ETH | 0.00046692 | ||||
| Claim | 19986154 | 642 days ago | IN | 0 ETH | 0.0007283 | ||||
| Multi Claim | 19945150 | 647 days ago | IN | 0 ETH | 0.00066549 | ||||
| Claim | 19939965 | 648 days ago | IN | 0 ETH | 0.00055115 | ||||
| Multi Claim | 19938797 | 648 days ago | IN | 0 ETH | 0.00228874 | ||||
| Claim | 19891784 | 655 days ago | IN | 0 ETH | 0.00037885 | ||||
| Multi Claim | 19882347 | 656 days ago | IN | 0 ETH | 0.00065292 | ||||
| Multi Claim | 19867463 | 658 days ago | IN | 0 ETH | 0.00077439 | ||||
| Claim | 19835216 | 663 days ago | IN | 0 ETH | 0.00030524 | ||||
| Claim | 19834903 | 663 days ago | IN | 0 ETH | 0.00025405 | ||||
| Emergency Update... | 19832160 | 663 days ago | IN | 0 ETH | 0.00014866 | ||||
| Multi Claim | 19811480 | 666 days ago | IN | 0 ETH | 0.00338789 | ||||
| Claim | 19785718 | 670 days ago | IN | 0 ETH | 0.00037959 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
MultiMerkleDistributor
Compiler Version
v0.8.16+commit.07a7930e
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
//██████╗ █████╗ ██╗ █████╗ ██████╗ ██╗███╗ ██╗
//██╔══██╗██╔══██╗██║ ██╔══██╗██╔══██╗██║████╗ ██║
//██████╔╝███████║██║ ███████║██║ ██║██║██╔██╗ ██║
//██╔═══╝ ██╔══██║██║ ██╔══██║██║ ██║██║██║╚██╗██║
//██║ ██║ ██║███████╗██║ ██║██████╔╝██║██║ ╚████║
//╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═════╝ ╚═╝╚═╝ ╚═══╝
//SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.16;
import "./oz/interfaces/IERC20.sol";
import "./oz/libraries/SafeERC20.sol";
import "./oz/utils/MerkleProof.sol";
import "./utils/Owner.sol";
import "./oz/utils/ReentrancyGuard.sol";
import "./libraries/Errors.sol";
/** @title Quest Multi Merkle Distributor */
/// @author Paladin
/*
Contract holds ERC20 rewards from Quests
Can handle multiple MerkleRoots
*/
contract MultiMerkleDistributor is Owner, ReentrancyGuard {
using SafeERC20 for IERC20;
/** @notice Seconds in a Week */
uint256 private constant WEEK = 604800;
/** @notice Mapping listing the reward token associated to each Quest ID */
// QuestID => reward token
mapping(uint256 => address) public questRewardToken;
/** @notice Mapping of tokens this contract is or was distributing */
// token address => boolean
mapping(address => bool) public rewardTokens;
// Periods: timestamp => start of a week, used as a voting period
// in the Curve GaugeController though the timestamp / WEEK * WEEK logic.
// Handled through the QuestManager contract.
// Those can be fetched through this contract when they are closed, or through the QuestManager contract.
/** @notice List of Closed QuestPeriods by Quest ID */
// QuestID => array of periods
mapping(uint256 => uint256[]) public questClosedPeriods;
/** @notice Merkle Root for each period of a Quest (indexed by Quest ID) */
// QuestID => period => merkleRoot
mapping(uint256 => mapping(uint256 => bytes32)) public questMerkleRootPerPeriod;
/** @notice Amount of rewards for each period of a Quest (indexed by Quest ID) */
// QuestID => period => totalRewardsAmount
mapping(uint256 => mapping(uint256 => uint256)) public questRewardsPerPeriod;
/** @notice BitMap of claims for each period of a Quest */
// QuestID => period => claimedBitMap
// This is a packed array of booleans.
mapping(uint256 => mapping(uint256 => mapping(uint256 => uint256))) private questPeriodClaimedBitMap;
/** @notice Address of the QuestBoard contract */
address public immutable questBoard;
// Events
/** @notice Event emitted when a user Claims */
event Claimed(
uint256 indexed questID,
uint256 indexed period,
uint256 index,
uint256 amount,
address rewardToken,
address indexed account
);
/** @notice Event emitted when a New Quest is added */
event NewQuest(uint256 indexed questID, address rewardToken);
/** @notice Event emitted when a Period of a Quest is updated (when the Merkle Root is added) */
event QuestPeriodUpdated(uint256 indexed questID, uint256 indexed period, bytes32 merkleRoot);
// Modifier
/** @notice Check the caller is either the admin or the QuestBoard contract */
modifier onlyAllowed(){
if(msg.sender != questBoard && msg.sender != owner()) revert Errors.CallerNotAllowed();
_;
}
// Constructor
constructor(address _questBoard){
if(_questBoard == address(0)) revert Errors.AddressZero();
questBoard = _questBoard;
}
// Functions
/**
* @notice Checks if the rewards were claimed for a user on a given period
* @dev Checks if the rewards were claimed for a user (based on the index) on a given period
* @param questID ID of the Quest
* @param period Amount of underlying to borrow
* @param index Index of the claim
* @return bool : true if already claimed
*/
function isClaimed(uint256 questID, uint256 period, uint256 index) public view returns (bool) {
uint256 claimedWordIndex = index >> 8;
uint256 claimedBitIndex = index & 0xff;
uint256 claimedWord = questPeriodClaimedBitMap[questID][period][claimedWordIndex];
uint256 mask = (1 << claimedBitIndex);
return claimedWord & mask != 0;
}
/**
* @dev Sets the rewards as claimed for the index on the given period
* @param questID ID of the Quest
* @param period Timestamp of the period
* @param index Index of the claim
*/
function _setClaimed(uint256 questID, uint256 period, uint256 index) private {
uint256 claimedWordIndex = index >> 8;
uint256 claimedBitIndex = index & 0xff;
questPeriodClaimedBitMap[questID][period][claimedWordIndex] |= (1 << claimedBitIndex);
}
//Basic Claim
/**
* @notice Claims the reward for a user for a given period of a Quest
* @dev Claims the reward for a user for a given period of a Quest if the correct proof was given
* @param questID ID of the Quest
* @param period Timestamp of the period
* @param index Index in the Merkle Tree
* @param account Address of the user claiming the rewards
* @param amount Amount of rewards to claim
* @param merkleProof Proof to claim the rewards
*/
function claim(uint256 questID, uint256 period, uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof) public nonReentrant {
if(account == address(0)) revert Errors.AddressZero();
if(questMerkleRootPerPeriod[questID][period] == 0) revert Errors.MerkleRootNotUpdated();
if(isClaimed(questID, period, index)) revert Errors.AlreadyClaimed();
// Check that the given parameters match the given Proof
bytes32 node = keccak256(abi.encodePacked(questID, period, index, account, amount));
if(!MerkleProof.verify(merkleProof, questMerkleRootPerPeriod[questID][period], node)) revert Errors.InvalidProof();
// Set the rewards as claimed for that period
// And transfer the rewards to the user
address rewardToken = questRewardToken[questID];
_setClaimed(questID, period, index);
questRewardsPerPeriod[questID][period] -= amount;
IERC20(rewardToken).safeTransfer(account, amount);
emit Claimed(questID, period, index, amount, rewardToken, account);
}
//Struct ClaimParams
struct ClaimParams {
uint256 questID;
uint256 period;
uint256 index;
uint256 amount;
bytes32[] merkleProof;
}
//Multi Claim
/**
* @notice Claims multiple rewards for a given list
* @dev Calls the claim() method for each entry in the claims array
* @param account Address of the user claiming the rewards
* @param claims List of ClaimParams struct data to claim
*/
function multiClaim(address account, ClaimParams[] calldata claims) external {
uint256 length = claims.length;
if(length == 0) revert Errors.EmptyParameters();
for(uint256 i; i < length;){
claim(claims[i].questID, claims[i].period, claims[i].index, account, claims[i].amount, claims[i].merkleProof);
unchecked{ ++i; }
}
}
//FullQuest Claim (form of Multi Claim but for only one Quest => only one ERC20 transfer)
//Only works for the given periods (in ClaimParams) for the Quest. Any omitted period will be skipped
/**
* @notice Claims the reward for all the given periods of a Quest, and transfer all the rewards at once
* @dev Sums up all the rewards for given periods of a Quest, and executes only one transfer
* @param account Address of the user claiming the rewards
* @param questID ID of the Quest
* @param claims List of ClaimParams struct data to claim
*/
function claimQuest(address account, uint256 questID, ClaimParams[] calldata claims) external nonReentrant {
if(account == address(0)) revert Errors.AddressZero();
uint256 length = claims.length;
if(length == 0) revert Errors.EmptyParameters();
// Total amount claimable, to transfer at once
uint256 totalClaimAmount;
address rewardToken = questRewardToken[questID];
for(uint256 i; i < length;){
if(claims[i].questID != questID) revert Errors.IncorrectQuestID();
if(questMerkleRootPerPeriod[questID][claims[i].period] == 0) revert Errors.MerkleRootNotUpdated();
if(isClaimed(questID, claims[i].period, claims[i].index)) revert Errors.AlreadyClaimed();
// For each period given, if the proof matches the given parameters,
// set as claimed and add to the to total to transfer
bytes32 node = keccak256(abi.encodePacked(questID, claims[i].period, claims[i].index, account, claims[i].amount));
if(!MerkleProof.verify(claims[i].merkleProof, questMerkleRootPerPeriod[questID][claims[i].period], node)) revert Errors.InvalidProof();
_setClaimed(questID, claims[i].period, claims[i].index);
questRewardsPerPeriod[questID][claims[i].period] -= claims[i].amount;
totalClaimAmount += claims[i].amount;
emit Claimed(questID, claims[i].period, claims[i].index, claims[i].amount, rewardToken, account);
unchecked{ ++i; }
}
// Transfer the total claimed amount
IERC20(rewardToken).safeTransfer(account, totalClaimAmount);
}
/**
* @notice Returns all current Closed periods for the given Quest ID
* @dev Returns all current Closed periods for the given Quest ID
* @param questID ID of the Quest
* @return uint256[] : List of closed periods
*/
function getClosedPeriodsByQuests(uint256 questID) external view returns (uint256[] memory) {
return questClosedPeriods[questID];
}
// Manager functions
/**
* @notice Adds a new Quest to the listing
* @dev Adds a new Quest ID and the associated reward token
* @param questID ID of the Quest
* @param token Address of the ERC20 reward token
* @return bool : success
*/
function addQuest(uint256 questID, address token) external returns(bool) {
if(msg.sender != questBoard) revert Errors.CallerNotAllowed();
if(questRewardToken[questID] != address(0)) revert Errors.QuestAlreadyListed();
if(token == address(0)) revert Errors.TokenNotWhitelisted();
// Add a new Quest using the QuestID, and list the reward token for that Quest
questRewardToken[questID] = token;
if(!rewardTokens[token]) rewardTokens[token] = true;
emit NewQuest(questID, token);
return true;
}
/**
* @notice Adds a new period & the rewards of this period for a Quest
* @dev Adds a new period & the rewards of this period for a Quest
* @param questID ID of the Quest
* @param period Timestamp of the period
* @param totalRewardAmount Total amount of rewards to distribute for the period
* @return bool : success
*/
function addQuestPeriod(uint256 questID, uint256 period, uint256 totalRewardAmount) external returns(bool) {
period = (period / WEEK) * WEEK;
if(msg.sender != questBoard) revert Errors.CallerNotAllowed();
if(questRewardToken[questID] == address(0)) revert Errors.QuestNotListed();
if(questRewardsPerPeriod[questID][period] != 0) revert Errors.PeriodAlreadyUpdated();
if(period == 0) revert Errors.IncorrectPeriod();
if(totalRewardAmount == 0) revert Errors.NullAmount();
questRewardsPerPeriod[questID][period] = totalRewardAmount;
return true;
}
function fixQuestPeriod(uint256 questID, uint256 period, uint256 newTotalRewardAmount) external returns(bool) {
if(msg.sender != questBoard) revert Errors.CallerNotAllowed();
period = (period / WEEK) * WEEK;
if(questRewardToken[questID] == address(0)) revert Errors.QuestNotListed();
if(period == 0) revert Errors.IncorrectPeriod();
if(questRewardsPerPeriod[questID][period] == 0) revert Errors.PeriodNotListed();
uint256 previousTotalRewardAmount = questRewardsPerPeriod[questID][period];
questRewardsPerPeriod[questID][period] = newTotalRewardAmount;
if(previousTotalRewardAmount > newTotalRewardAmount){
// Send back the extra amount of reward token that was incorrectly sent
// In the case of missing reward token, the Board will send them to this contract
uint256 extraAmount = previousTotalRewardAmount - newTotalRewardAmount;
IERC20(questRewardToken[questID]).safeTransfer(questBoard, extraAmount);
}
return true;
}
/**
* @notice Updates the period of a Quest by adding the Merkle Root
* @dev Add the Merkle Root for the eriod of the given Quest
* @param questID ID of the Quest
* @param period timestamp of the period
* @param totalAmount sum of all rewards for the Merkle Tree
* @param merkleRoot MerkleRoot to add
* @return bool: success
*/
function updateQuestPeriod(uint256 questID, uint256 period, uint256 totalAmount, bytes32 merkleRoot) external onlyAllowed returns(bool) {
period = (period / WEEK) * WEEK;
if(questRewardToken[questID] == address(0)) revert Errors.QuestNotListed();
if(period == 0) revert Errors.IncorrectPeriod();
if(questRewardsPerPeriod[questID][period] == 0) revert Errors.PeriodNotListed();
if(questMerkleRootPerPeriod[questID][period] != 0) revert Errors.PeriodAlreadyUpdated();
if(merkleRoot == 0) revert Errors.EmptyMerkleRoot();
// Add a new Closed Period for the Quest
questClosedPeriods[questID].push(period);
if(totalAmount != questRewardsPerPeriod[questID][period]) revert Errors.IncorrectRewardAmount();
// Add the new MerkleRoot for that Closed Period
questMerkleRootPerPeriod[questID][period] = merkleRoot;
emit QuestPeriodUpdated(questID, period, merkleRoot);
return true;
}
// Admin functions
/**
* @notice Recovers ERC2O tokens sent by mistake to the contract
* @dev Recovers ERC2O tokens sent by mistake to the contract
* @param token Address tof the EC2O token
* @return bool: success
*/
function recoverERC20(address token) external onlyOwner nonReentrant returns(bool) {
if(rewardTokens[token]) revert Errors.CannotRecoverToken();
uint256 amount = IERC20(token).balanceOf(address(this));
if(amount == 0) revert Errors.NullAmount();
IERC20(token).safeTransfer(owner(), amount);
return true;
}
//
/**
* @notice Allows to update the MerkleRoot for a given period of a Quest if the current Root is incorrect
* @dev Updates the MerkleRoot for the period of the Quest
* @param questID ID of the Quest
* @param period Timestamp of the period
* @param merkleRoot New MerkleRoot to add
* @return bool : success
*/
function emergencyUpdateQuestPeriod(uint256 questID, uint256 period, uint256 addedRewardAmount, bytes32 merkleRoot) external onlyOwner returns(bool) {
// In case the given MerkleRoot was incorrect:
// Process:
// 1 - block claims for the Quest period by using this method to set an incorrect MerkleRoot, where no proof matches the root
// 2 - prepare a new Merkle Tree, taking in account user previous claims on that period, and missing/overpaid rewards
// a - for all new claims to be added, set them after the last index of the previous Merkle Tree
// b - for users that did not claim, keep the same index, and adjust the amount to claim if needed
// c - for indexes that were claimed, place an empty node in the Merkle Tree (with an amount at 0 & the address 0xdead as the account)
// 3 - update the Quest period with the correct MerkleRoot
// (no need to change the Bitmap, as the new MerkleTree will account for the indexes already claimed)
period = (period / WEEK) * WEEK;
if(questRewardToken[questID] == address(0)) revert Errors.QuestNotListed();
if(period == 0) revert Errors.IncorrectPeriod();
if(questMerkleRootPerPeriod[questID][period] == 0) revert Errors.PeriodNotClosed();
if(merkleRoot == 0) revert Errors.EmptyMerkleRoot();
questMerkleRootPerPeriod[questID][period] = merkleRoot;
questRewardsPerPeriod[questID][period] += addedRewardAmount;
emit QuestPeriodUpdated(questID, period, merkleRoot);
return true;
}
}pragma solidity 0.8.16;
//SPDX-License-Identifier: MIT
library Errors {
// Common Errors
error AddressZero();
error NullAmount();
error CallerNotAllowed();
error IncorrectRewardToken();
error SameAddress();
error InequalArraySizes();
error EmptyArray();
error EmptyParameters();
error AlreadyInitialized();
error InvalidParameter();
error CannotRecoverToken();
error ForbiddenCall();
error CannotBeOwner();
error CallerNotPendingOwner();
error Killed();
error AlreadyKilled();
error NotKilled();
error KillDelayExpired();
error KillDelayNotExpired();
// Merkle Errors
error MerkleRootNotUpdated();
error AlreadyClaimed();
error InvalidProof();
error EmptyMerkleRoot();
error IncorrectRewardAmount();
error MerkleRootFrozen();
error NotFrozen();
error AlreadyFrozen();
// Quest Errors
error CallerNotQuestBoard();
error IncorrectQuestID();
error IncorrectPeriod();
error TokenNotWhitelisted();
error QuestAlreadyListed();
error QuestNotListed();
error PeriodAlreadyUpdated();
error PeriodNotClosed();
error PeriodStillActive();
error PeriodNotListed();
error EmptyQuest();
error EmptyPeriod();
error ExpiredQuest();
error QuestNotStarted();
error NotInitialized();
error NoDistributorSet();
error DisitributorFail();
error InvalidGauge();
error InvalidQuestID();
error InvalidPeriod();
error ObjectiveTooLow();
error NewObjectiveTooLow();
error RewardPerVoteTooLow();
error MinValueOverMaxValue();
error IncorrectDuration();
error IncorrectAddDuration();
error IncorrectTotalRewardAmount();
error IncorrectAddedRewardAmount();
error IncorrectFeeAmount();
error InvalidQuestType();
error QuestTypesIncompatible();
error CalletNotQuestCreator();
error LowerRewardPerVote();
error LowerObjective();
error CreatorNotAllowed();
error AlreadyListed();
error NotListed();
error MaxListSize();
error BoardIsNotAllowedDistributor();
// Proxy
error InvalidChainID();
error InvalidCaller();
error PeriodBiasNotUpdated();
error GaugeAlreadyAdded();
//Math
error NumberExceed48Bits();
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: 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 reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../interfaces/IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
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 generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of Merkle Tree proofs.
*
* The tree and the proofs can be generated using our
* https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
* You will find a quickstart guide in the readme.
*
* WARNING: You should avoid using leaf values that are 64 bytes long prior to
* hashing, or use a hash function other than keccak256 for hashing leaves.
* This is because the concatenation of a sorted pair of internal nodes in
* the merkle tree could be reinterpreted as a leaf value.
* OpenZeppelin's JavaScript library generates merkle trees that are safe
* against this attack out of the box.
*/
library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
/**
* @dev Calldata version of {verify}
*
* _Available since v4.7._
*/
function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
return processProofCalldata(proof, leaf) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leafs & pre-images are assumed to be sorted.
*
* _Available since v4.4._
*/
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Calldata version of {processProof}
*
* _Available since v4.7._
*/
function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by
* `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
*
* CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
*
* _Available since v4.7._
*/
function multiProofVerify(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProof(proof, proofFlags, leaves) == root;
}
/**
* @dev Calldata version of {multiProofVerify}
*
* CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
*
* _Available since v4.7._
*/
function multiProofVerifyCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProofCalldata(proof, proofFlags, leaves) == root;
}
/**
* @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
* proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
* leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
* respectively.
*
* CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
* is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
* tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
*
* _Available since v4.7._
*/
function processMultiProof(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the merkle tree.
uint256 leavesLen = leaves.length;
uint256 totalHashes = proofFlags.length;
// Check proof validity.
require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](totalHashes);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < totalHashes; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = _hashPair(a, b);
}
if (totalHashes > 0) {
unchecked {
return hashes[totalHashes - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
/**
* @dev Calldata version of {processMultiProof}.
*
* CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
*
* _Available since v4.7._
*/
function processMultiProofCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the merkle tree.
uint256 leavesLen = leaves.length;
uint256 totalHashes = proofFlags.length;
// Check proof validity.
require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](totalHashes);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < totalHashes; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = _hashPair(a, b);
}
if (totalHashes > 0) {
unchecked {
return hashes[totalHashes - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
}
function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "./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 functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;
import "../oz/utils/Ownable.sol";
import "../libraries/Errors.sol";
/** @title 2-step Ownership */
/// @author Paladin
/*
Extends OZ Ownable contract to add 2-step ownership transfer
*/
contract Owner is Ownable {
address public pendingOwner;
event NewPendingOwner(address indexed previousPendingOwner, address indexed newPendingOwner);
function transferOwnership(address newOwner) public override virtual onlyOwner {
if(newOwner == address(0)) revert Errors.AddressZero();
if(newOwner == owner()) revert Errors.CannotBeOwner();
address oldPendingOwner = pendingOwner;
pendingOwner = newOwner;
emit NewPendingOwner(oldPendingOwner, newOwner);
}
function acceptOwnership() public virtual {
if(msg.sender != pendingOwner) revert Errors.CallerNotPendingOwner();
address newOwner = pendingOwner;
_transferOwnership(pendingOwner);
pendingOwner = address(0);
emit NewPendingOwner(newOwner, address(0));
}
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"viaIR": false,
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_questBoard","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AddressZero","type":"error"},{"inputs":[],"name":"AlreadyClaimed","type":"error"},{"inputs":[],"name":"CallerNotAllowed","type":"error"},{"inputs":[],"name":"CallerNotPendingOwner","type":"error"},{"inputs":[],"name":"CannotBeOwner","type":"error"},{"inputs":[],"name":"CannotRecoverToken","type":"error"},{"inputs":[],"name":"EmptyMerkleRoot","type":"error"},{"inputs":[],"name":"EmptyParameters","type":"error"},{"inputs":[],"name":"IncorrectPeriod","type":"error"},{"inputs":[],"name":"IncorrectQuestID","type":"error"},{"inputs":[],"name":"IncorrectRewardAmount","type":"error"},{"inputs":[],"name":"InvalidProof","type":"error"},{"inputs":[],"name":"MerkleRootNotUpdated","type":"error"},{"inputs":[],"name":"NullAmount","type":"error"},{"inputs":[],"name":"PeriodAlreadyUpdated","type":"error"},{"inputs":[],"name":"PeriodNotClosed","type":"error"},{"inputs":[],"name":"PeriodNotListed","type":"error"},{"inputs":[],"name":"QuestAlreadyListed","type":"error"},{"inputs":[],"name":"QuestNotListed","type":"error"},{"inputs":[],"name":"TokenNotWhitelisted","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"questID","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"period","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"rewardToken","type":"address"},{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousPendingOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newPendingOwner","type":"address"}],"name":"NewPendingOwner","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"questID","type":"uint256"},{"indexed":false,"internalType":"address","name":"rewardToken","type":"address"}],"name":"NewQuest","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"questID","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"period","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"name":"QuestPeriodUpdated","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"questID","type":"uint256"},{"internalType":"address","name":"token","type":"address"}],"name":"addQuest","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"questID","type":"uint256"},{"internalType":"uint256","name":"period","type":"uint256"},{"internalType":"uint256","name":"totalRewardAmount","type":"uint256"}],"name":"addQuestPeriod","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"questID","type":"uint256"},{"internalType":"uint256","name":"period","type":"uint256"},{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"questID","type":"uint256"},{"components":[{"internalType":"uint256","name":"questID","type":"uint256"},{"internalType":"uint256","name":"period","type":"uint256"},{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"}],"internalType":"struct MultiMerkleDistributor.ClaimParams[]","name":"claims","type":"tuple[]"}],"name":"claimQuest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"questID","type":"uint256"},{"internalType":"uint256","name":"period","type":"uint256"},{"internalType":"uint256","name":"addedRewardAmount","type":"uint256"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"name":"emergencyUpdateQuestPeriod","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"questID","type":"uint256"},{"internalType":"uint256","name":"period","type":"uint256"},{"internalType":"uint256","name":"newTotalRewardAmount","type":"uint256"}],"name":"fixQuestPeriod","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"questID","type":"uint256"}],"name":"getClosedPeriodsByQuests","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"questID","type":"uint256"},{"internalType":"uint256","name":"period","type":"uint256"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"isClaimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"components":[{"internalType":"uint256","name":"questID","type":"uint256"},{"internalType":"uint256","name":"period","type":"uint256"},{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"}],"internalType":"struct MultiMerkleDistributor.ClaimParams[]","name":"claims","type":"tuple[]"}],"name":"multiClaim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"questBoard","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"questClosedPeriods","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"questMerkleRootPerPeriod","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"questRewardToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"questRewardsPerPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"recoverERC20","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewardTokens","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"questID","type":"uint256"},{"internalType":"uint256","name":"period","type":"uint256"},{"internalType":"uint256","name":"totalAmount","type":"uint256"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"name":"updateQuestPeriod","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60a06040523480156200001157600080fd5b50604051620020a8380380620020a88339810160408190526200003491620000ce565b6200003f336200007e565b60016002556001600160a01b0381166200006c57604051639fabe1c160e01b815260040160405180910390fd5b6001600160a01b031660805262000100565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060208284031215620000e157600080fd5b81516001600160a01b0381168114620000f957600080fd5b9392505050565b608051611f696200013f6000396000818161016101528181610ccc01528181610e5301528181610f8e0152818161112201526114e30152611f696000f3fe608060405234801561001057600080fd5b50600436106101425760003560e01c8063715018a6116100b857806395861d5c1161007c57806395861d5c146102ed5780639e8c708e14610316578063c25a4d9e14610329578063e30c39781461033c578063f2fde38b1461034f578063f5ab16cc1461036257600080fd5b8063715018a61461028e57806375d0d3801461029657806379ba5097146102a95780638da5cb5b146102b157806393380358146102c257600080fd5b8063493b952c1161010a578063493b952c146101f657806358ad40641461022f578063627614ac14610242578063657c5e8c146102555780636a9b8ce5146102685780636ec803bb1461027b57600080fd5b80630c3a0fff14610147578063131227981461015c57806317fea75c146101a05780633a3e6a77146101c357806346fe84e9146101d6575b600080fd5b61015a610155366004611af7565b610385565b005b6101837f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6101b36101ae366004611b72565b6105b2565b6040519015158152602001610197565b61015a6101d1366004611ba4565b61070e565b6101e96101e4366004611bfe565b610c5d565b6040516101979190611c17565b610221610204366004611c5b565b600760209081526000928352604080842090915290825290205481565b604051908152602001610197565b6101b361023d366004611c7d565b610cbf565b6101b3610250366004611ca9565b610e11565b6101b3610263366004611ca9565b610e46565b61015a610276366004611cd5565b610fc0565b610221610289366004611c5b565b6110d0565b61015a611101565b6101b36102a4366004611b72565b611115565b61015a61131f565b6000546001600160a01b0316610183565b6102216102d0366004611c5b565b600660209081526000928352604080842090915290825290205481565b6101836102fb366004611bfe565b6003602052600090815260409020546001600160a01b031681565b6101b3610324366004611d28565b6113a8565b6101b3610337366004611ca9565b6114bc565b600154610183906001600160a01b031681565b61015a61035d366004611d28565b6115ef565b6101b3610370366004611d28565b60046020526000908152604090205460ff1681565b61038d6116ad565b6001600160a01b0384166103b457604051639fabe1c160e01b815260040160405180910390fd5b600087815260066020908152604080832089845290915281205490036103ed5760405163bc68df3f60e01b815260040160405180910390fd5b6103f8878787610e11565b1561041657604051630c8d9eab60e31b815260040160405180910390fd5b60008787878787604051602001610431959493929190611d43565b60405160208183030381529060405280519060200120905061049f83838080602002602001604051908101604052809392919081815260200183836020028082843760009201829052508d81526006602090815260408083208f845290915290205492508591506117099050565b6104bc576040516309bde33960e01b815260040160405180910390fd5b60008881526003602090815260408083205460088084528285208c86528452828520908b901c855283528184208054600160ff8d161b1790558b8452600783528184208b8552909252822080546001600160a01b03909216928792610522908490611d8f565b9091555061053c90506001600160a01b038216878761171f565b856001600160a01b0316888a7f9a5376f7dcf8631c2b6249c9bec3d715cb97bdd4c82d92e55d147f6b4eea41978a89866040516105959392919092835260208301919091526001600160a01b0316604082015260600190565b60405180910390a450506105a96001600255565b50505050505050565b60006105bc611776565b62093a806105ca8186611da2565b6105d49190611dc4565b6000868152600360205260409020549094506001600160a01b031661060c5760405163e72eafc360e01b815260040160405180910390fd5b8360000361062c57604051627af3d560e01b815260040160405180910390fd5b60008581526006602090815260408083208784529091528120549003610665576040516311372d3560e11b815260040160405180910390fd5b6000829003610687576040516385ac2b9960e01b815260040160405180910390fd5b6000858152600660209081526040808320878452825280832085905587835260078252808320878452909152812080548592906106c5908490611de3565b9091555050604051828152849086907f1d3b13bb6ce947c806a76a3476eafd33ec751e6ed2cbbdf7ab8503a4fb76a1ee906020015b60405180910390a35060015b949350505050565b6107166116ad565b6001600160a01b03841661073d57604051639fabe1c160e01b815260040160405180910390fd5b8060008190036107605760405163b68370bb60e01b815260040160405180910390fd5b6000848152600360205260408120546001600160a01b0316815b83811015610c35578686868381811061079557610795611df6565b90506020028101906107a79190611e0c565b35146107c6576040516327140a4b60e01b815260040160405180910390fd5b6000878152600660205260408120908787848181106107e7576107e7611df6565b90506020028101906107f99190611e0c565b602001358152602001908152602001600020546000801b0361082e5760405163bc68df3f60e01b815260040160405180910390fd5b6108878787878481811061084457610844611df6565b90506020028101906108569190611e0c565b6020013588888581811061086c5761086c611df6565b905060200281019061087e9190611e0c565b60400135610e11565b156108a557604051630c8d9eab60e31b815260040160405180910390fd5b6000878787848181106108ba576108ba611df6565b90506020028101906108cc9190611e0c565b602001358888858181106108e2576108e2611df6565b90506020028101906108f49190611e0c565b604001358b8a8a8781811061090b5761090b611df6565b905060200281019061091d9190611e0c565b60600135604051602001610935959493929190611d43565b6040516020818303038152906040528051906020012090506109fe87878481811061096257610962611df6565b90506020028101906109749190611e0c565b610982906080810190611e2c565b8080602002602001604051908101604052809392919081815260200183836020028082843760009201829052508d8152600660205260408120935091508b90508a878181106109d3576109d3611df6565b90506020028101906109e59190611e0c565b6020013581526020019081526020016000205483611709565b610a1b576040516309bde33960e01b815260040160405180910390fd5b610aa788888885818110610a3157610a31611df6565b9050602002810190610a439190611e0c565b60200135898986818110610a5957610a59611df6565b9050602002810190610a6b9190611e0c565b6040013560009283526008602081815260408086209486529381528385209183901c85525291208054600160ff9093169290921b919091179055565b868683818110610ab957610ab9611df6565b9050602002810190610acb9190611e0c565b60600135600760008a81526020019081526020016000206000898986818110610af657610af6611df6565b9050602002810190610b089190611e0c565b6020013581526020019081526020016000206000828254610b299190611d8f565b909155508790508683818110610b4157610b41611df6565b9050602002810190610b539190611e0c565b610b61906060013585611de3565b9350886001600160a01b0316878784818110610b7f57610b7f611df6565b9050602002810190610b919190611e0c565b60200135897f9a5376f7dcf8631c2b6249c9bec3d715cb97bdd4c82d92e55d147f6b4eea41978a8a87818110610bc957610bc9611df6565b9050602002810190610bdb9190611e0c565b604001358b8b88818110610bf157610bf1611df6565b9050602002810190610c039190611e0c565b6040805192835260609182013560208401526001600160a01b038a16908301520160405180910390a45060010161077a565b50610c4a6001600160a01b038216888461171f565b505050610c576001600255565b50505050565b600081815260056020908152604091829020805483518184028101840190945280845260609392830182828015610cb357602002820191906000526020600020905b815481526020019060010190808311610c9f575b50505050509050919050565b6000336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610d0a5760405163015783e960e51b815260040160405180910390fd5b6000838152600360205260409020546001600160a01b031615610d40576040516383d2396d60e01b815260040160405180910390fd5b6001600160a01b038216610d67576040516307c241ad60e51b815260040160405180910390fd5b600083815260036020908152604080832080546001600160a01b0319166001600160a01b0387169081179091558352600490915290205460ff16610dc9576001600160a01b0382166000908152600460205260409020805460ff191660011790555b6040516001600160a01b038316815283907f6746344851206b5fc2dc76bcb3512131fd07c324969cd3ee22781928054779619060200160405180910390a25060015b92915050565b60009283526008602081815260408086209486529381528385209183901c855252912054600160ff9092169190911b16151590565b6000336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610e915760405163015783e960e51b815260040160405180910390fd5b62093a80610e9f8185611da2565b610ea99190611dc4565b6000858152600360205260409020549093506001600160a01b0316610ee15760405163e72eafc360e01b815260040160405180910390fd5b82600003610f0157604051627af3d560e01b815260040160405180910390fd5b60008481526007602090815260408083208684529091528120549003610f3a576040516348a0a74d60e01b815260040160405180910390fd5b6000848152600760209081526040808320868452909152902080549083905582811115610fb5576000610f6d8483611d8f565b600087815260036020526040902054909150610fb3906001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000008361171f565b505b506001949350505050565b806000819003610fe35760405163b68370bb60e01b815260040160405180910390fd5b60005b818110156110c9576110c184848381811061100357611003611df6565b90506020028101906110159190611e0c565b3585858481811061102857611028611df6565b905060200281019061103a9190611e0c565b6020013586868581811061105057611050611df6565b90506020028101906110629190611e0c565b604001358888888781811061107957611079611df6565b905060200281019061108b9190611e0c565b606001358989888181106110a1576110a1611df6565b90506020028101906110b39190611e0c565b610155906080810190611e2c565b600101610fe6565b5050505050565b600560205281600052604060002081815481106110ec57600080fd5b90600052602060002001600091509150505481565b611109611776565b61111360006117d0565b565b6000336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161480159061115b57506000546001600160a01b03163314155b156111795760405163015783e960e51b815260040160405180910390fd5b62093a806111878186611da2565b6111919190611dc4565b6000868152600360205260409020549094506001600160a01b03166111c95760405163e72eafc360e01b815260040160405180910390fd5b836000036111e957604051627af3d560e01b815260040160405180910390fd5b60008581526007602090815260408083208784529091528120549003611222576040516348a0a74d60e01b815260040160405180910390fd5b60008581526006602090815260408083208784529091529020541561125a576040516326d774e960e11b815260040160405180910390fd5b600082900361127c576040516385ac2b9960e01b815260040160405180910390fd5b60008581526005602090815260408083208054600181018255908452828420018790558783526007825280832087845290915290205483146112d157604051633da886b360e11b815260040160405180910390fd5b60008581526006602090815260408083208784528252918290208490559051838152859187917f1d3b13bb6ce947c806a76a3476eafd33ec751e6ed2cbbdf7ab8503a4fb76a1ee91016106fa565b6001546001600160a01b0316331461134a576040516305e05b4b60e31b815260040160405180910390fd5b6001546001600160a01b031661135f816117d0565b600180546001600160a01b03191690556040516000906001600160a01b038316907fb3d55174552271a4f1aaf36b72f50381e892171636b3fb5447fe00e995e7a37b908390a350565b60006113b2611776565b6113ba6116ad565b6001600160a01b03821660009081526004602052604090205460ff16156113f4576040516380eb2a0160e01b815260040160405180910390fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa15801561143b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145f9190611e76565b90508060000361148257604051630e5a744960e41b815260040160405180910390fd5b6114a86114976000546001600160a01b031690565b6001600160a01b038516908361171f565b60019150506114b76001600255565b919050565b600062093a806114cc8185611da2565b6114d69190611dc4565b9250336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146115215760405163015783e960e51b815260040160405180910390fd5b6000848152600360205260409020546001600160a01b03166115565760405163e72eafc360e01b815260040160405180910390fd5b60008481526007602090815260408083208684529091529020541561158e576040516326d774e960e11b815260040160405180910390fd5b826000036115ae57604051627af3d560e01b815260040160405180910390fd5b816000036115cf57604051630e5a744960e41b815260040160405180910390fd5b506000928352600760209081526040808520938552929052912055600190565b6115f7611776565b6001600160a01b03811661161e57604051639fabe1c160e01b815260040160405180910390fd5b6000546001600160a01b03166001600160a01b0316816001600160a01b03160361165b5760405163d5e889bf60e01b815260040160405180910390fd5b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907fb3d55174552271a4f1aaf36b72f50381e892171636b3fb5447fe00e995e7a37b90600090a35050565b60028054036117035760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b60028055565b6000826117168584611820565b14949350505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261177190849061186d565b505050565b6000546001600160a01b031633146111135760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016116fa565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600081815b8451811015611865576118518286838151811061184457611844611df6565b602002602001015161193f565b91508061185d81611e8f565b915050611825565b509392505050565b60006118c2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166119719092919063ffffffff16565b80519091501561177157808060200190518101906118e09190611ea8565b6117715760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016116fa565b600081831061195b57600082815260208490526040902061196a565b60008381526020839052604090205b9392505050565b6060610706848460008585600080866001600160a01b031685876040516119989190611eee565b60006040518083038185875af1925050503d80600081146119d5576040519150601f19603f3d011682016040523d82523d6000602084013e6119da565b606091505b50915091506119eb878383876119f6565b979650505050505050565b60608315611a65578251600003611a5e576001600160a01b0385163b611a5e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016116fa565b5081610706565b6107068383815115611a7a5781518083602001fd5b8060405162461bcd60e51b81526004016116fa9190611f00565b80356001600160a01b03811681146114b757600080fd5b60008083601f840112611abd57600080fd5b50813567ffffffffffffffff811115611ad557600080fd5b6020830191508360208260051b8501011115611af057600080fd5b9250929050565b600080600080600080600060c0888a031215611b1257600080fd5b873596506020880135955060408801359450611b3060608901611a94565b93506080880135925060a088013567ffffffffffffffff811115611b5357600080fd5b611b5f8a828b01611aab565b989b979a50959850939692959293505050565b60008060008060808587031215611b8857600080fd5b5050823594602084013594506040840135936060013592509050565b60008060008060608587031215611bba57600080fd5b611bc385611a94565b935060208501359250604085013567ffffffffffffffff811115611be657600080fd5b611bf287828801611aab565b95989497509550505050565b600060208284031215611c1057600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b81811015611c4f57835183529284019291840191600101611c33565b50909695505050505050565b60008060408385031215611c6e57600080fd5b50508035926020909101359150565b60008060408385031215611c9057600080fd5b82359150611ca060208401611a94565b90509250929050565b600080600060608486031215611cbe57600080fd5b505081359360208301359350604090920135919050565b600080600060408486031215611cea57600080fd5b611cf384611a94565b9250602084013567ffffffffffffffff811115611d0f57600080fd5b611d1b86828701611aab565b9497909650939450505050565b600060208284031215611d3a57600080fd5b61196a82611a94565b94855260208501939093526040840191909152606090811b6bffffffffffffffffffffffff191690830152607482015260940190565b634e487b7160e01b600052601160045260246000fd5b81810381811115610e0b57610e0b611d79565b600082611dbf57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611dde57611dde611d79565b500290565b80820180821115610e0b57610e0b611d79565b634e487b7160e01b600052603260045260246000fd5b60008235609e19833603018112611e2257600080fd5b9190910192915050565b6000808335601e19843603018112611e4357600080fd5b83018035915067ffffffffffffffff821115611e5e57600080fd5b6020019150600581901b3603821315611af057600080fd5b600060208284031215611e8857600080fd5b5051919050565b600060018201611ea157611ea1611d79565b5060010190565b600060208284031215611eba57600080fd5b8151801515811461196a57600080fd5b60005b83811015611ee5578181015183820152602001611ecd565b50506000910152565b60008251611e22818460208701611eca565b6020815260008251806020840152611f1f816040850160208701611eca565b601f01601f1916919091016040019291505056fea264697066735822122091f550d3267e90b8c3ef1c8e5ffbabfcbb8785fa76b2e7df5b5d3542c1979cc664736f6c63430008100033000000000000000000000000eb9c1dbd95dcf5190e6d31ba94f89593d48990be
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101425760003560e01c8063715018a6116100b857806395861d5c1161007c57806395861d5c146102ed5780639e8c708e14610316578063c25a4d9e14610329578063e30c39781461033c578063f2fde38b1461034f578063f5ab16cc1461036257600080fd5b8063715018a61461028e57806375d0d3801461029657806379ba5097146102a95780638da5cb5b146102b157806393380358146102c257600080fd5b8063493b952c1161010a578063493b952c146101f657806358ad40641461022f578063627614ac14610242578063657c5e8c146102555780636a9b8ce5146102685780636ec803bb1461027b57600080fd5b80630c3a0fff14610147578063131227981461015c57806317fea75c146101a05780633a3e6a77146101c357806346fe84e9146101d6575b600080fd5b61015a610155366004611af7565b610385565b005b6101837f000000000000000000000000eb9c1dbd95dcf5190e6d31ba94f89593d48990be81565b6040516001600160a01b0390911681526020015b60405180910390f35b6101b36101ae366004611b72565b6105b2565b6040519015158152602001610197565b61015a6101d1366004611ba4565b61070e565b6101e96101e4366004611bfe565b610c5d565b6040516101979190611c17565b610221610204366004611c5b565b600760209081526000928352604080842090915290825290205481565b604051908152602001610197565b6101b361023d366004611c7d565b610cbf565b6101b3610250366004611ca9565b610e11565b6101b3610263366004611ca9565b610e46565b61015a610276366004611cd5565b610fc0565b610221610289366004611c5b565b6110d0565b61015a611101565b6101b36102a4366004611b72565b611115565b61015a61131f565b6000546001600160a01b0316610183565b6102216102d0366004611c5b565b600660209081526000928352604080842090915290825290205481565b6101836102fb366004611bfe565b6003602052600090815260409020546001600160a01b031681565b6101b3610324366004611d28565b6113a8565b6101b3610337366004611ca9565b6114bc565b600154610183906001600160a01b031681565b61015a61035d366004611d28565b6115ef565b6101b3610370366004611d28565b60046020526000908152604090205460ff1681565b61038d6116ad565b6001600160a01b0384166103b457604051639fabe1c160e01b815260040160405180910390fd5b600087815260066020908152604080832089845290915281205490036103ed5760405163bc68df3f60e01b815260040160405180910390fd5b6103f8878787610e11565b1561041657604051630c8d9eab60e31b815260040160405180910390fd5b60008787878787604051602001610431959493929190611d43565b60405160208183030381529060405280519060200120905061049f83838080602002602001604051908101604052809392919081815260200183836020028082843760009201829052508d81526006602090815260408083208f845290915290205492508591506117099050565b6104bc576040516309bde33960e01b815260040160405180910390fd5b60008881526003602090815260408083205460088084528285208c86528452828520908b901c855283528184208054600160ff8d161b1790558b8452600783528184208b8552909252822080546001600160a01b03909216928792610522908490611d8f565b9091555061053c90506001600160a01b038216878761171f565b856001600160a01b0316888a7f9a5376f7dcf8631c2b6249c9bec3d715cb97bdd4c82d92e55d147f6b4eea41978a89866040516105959392919092835260208301919091526001600160a01b0316604082015260600190565b60405180910390a450506105a96001600255565b50505050505050565b60006105bc611776565b62093a806105ca8186611da2565b6105d49190611dc4565b6000868152600360205260409020549094506001600160a01b031661060c5760405163e72eafc360e01b815260040160405180910390fd5b8360000361062c57604051627af3d560e01b815260040160405180910390fd5b60008581526006602090815260408083208784529091528120549003610665576040516311372d3560e11b815260040160405180910390fd5b6000829003610687576040516385ac2b9960e01b815260040160405180910390fd5b6000858152600660209081526040808320878452825280832085905587835260078252808320878452909152812080548592906106c5908490611de3565b9091555050604051828152849086907f1d3b13bb6ce947c806a76a3476eafd33ec751e6ed2cbbdf7ab8503a4fb76a1ee906020015b60405180910390a35060015b949350505050565b6107166116ad565b6001600160a01b03841661073d57604051639fabe1c160e01b815260040160405180910390fd5b8060008190036107605760405163b68370bb60e01b815260040160405180910390fd5b6000848152600360205260408120546001600160a01b0316815b83811015610c35578686868381811061079557610795611df6565b90506020028101906107a79190611e0c565b35146107c6576040516327140a4b60e01b815260040160405180910390fd5b6000878152600660205260408120908787848181106107e7576107e7611df6565b90506020028101906107f99190611e0c565b602001358152602001908152602001600020546000801b0361082e5760405163bc68df3f60e01b815260040160405180910390fd5b6108878787878481811061084457610844611df6565b90506020028101906108569190611e0c565b6020013588888581811061086c5761086c611df6565b905060200281019061087e9190611e0c565b60400135610e11565b156108a557604051630c8d9eab60e31b815260040160405180910390fd5b6000878787848181106108ba576108ba611df6565b90506020028101906108cc9190611e0c565b602001358888858181106108e2576108e2611df6565b90506020028101906108f49190611e0c565b604001358b8a8a8781811061090b5761090b611df6565b905060200281019061091d9190611e0c565b60600135604051602001610935959493929190611d43565b6040516020818303038152906040528051906020012090506109fe87878481811061096257610962611df6565b90506020028101906109749190611e0c565b610982906080810190611e2c565b8080602002602001604051908101604052809392919081815260200183836020028082843760009201829052508d8152600660205260408120935091508b90508a878181106109d3576109d3611df6565b90506020028101906109e59190611e0c565b6020013581526020019081526020016000205483611709565b610a1b576040516309bde33960e01b815260040160405180910390fd5b610aa788888885818110610a3157610a31611df6565b9050602002810190610a439190611e0c565b60200135898986818110610a5957610a59611df6565b9050602002810190610a6b9190611e0c565b6040013560009283526008602081815260408086209486529381528385209183901c85525291208054600160ff9093169290921b919091179055565b868683818110610ab957610ab9611df6565b9050602002810190610acb9190611e0c565b60600135600760008a81526020019081526020016000206000898986818110610af657610af6611df6565b9050602002810190610b089190611e0c565b6020013581526020019081526020016000206000828254610b299190611d8f565b909155508790508683818110610b4157610b41611df6565b9050602002810190610b539190611e0c565b610b61906060013585611de3565b9350886001600160a01b0316878784818110610b7f57610b7f611df6565b9050602002810190610b919190611e0c565b60200135897f9a5376f7dcf8631c2b6249c9bec3d715cb97bdd4c82d92e55d147f6b4eea41978a8a87818110610bc957610bc9611df6565b9050602002810190610bdb9190611e0c565b604001358b8b88818110610bf157610bf1611df6565b9050602002810190610c039190611e0c565b6040805192835260609182013560208401526001600160a01b038a16908301520160405180910390a45060010161077a565b50610c4a6001600160a01b038216888461171f565b505050610c576001600255565b50505050565b600081815260056020908152604091829020805483518184028101840190945280845260609392830182828015610cb357602002820191906000526020600020905b815481526020019060010190808311610c9f575b50505050509050919050565b6000336001600160a01b037f000000000000000000000000eb9c1dbd95dcf5190e6d31ba94f89593d48990be1614610d0a5760405163015783e960e51b815260040160405180910390fd5b6000838152600360205260409020546001600160a01b031615610d40576040516383d2396d60e01b815260040160405180910390fd5b6001600160a01b038216610d67576040516307c241ad60e51b815260040160405180910390fd5b600083815260036020908152604080832080546001600160a01b0319166001600160a01b0387169081179091558352600490915290205460ff16610dc9576001600160a01b0382166000908152600460205260409020805460ff191660011790555b6040516001600160a01b038316815283907f6746344851206b5fc2dc76bcb3512131fd07c324969cd3ee22781928054779619060200160405180910390a25060015b92915050565b60009283526008602081815260408086209486529381528385209183901c855252912054600160ff9092169190911b16151590565b6000336001600160a01b037f000000000000000000000000eb9c1dbd95dcf5190e6d31ba94f89593d48990be1614610e915760405163015783e960e51b815260040160405180910390fd5b62093a80610e9f8185611da2565b610ea99190611dc4565b6000858152600360205260409020549093506001600160a01b0316610ee15760405163e72eafc360e01b815260040160405180910390fd5b82600003610f0157604051627af3d560e01b815260040160405180910390fd5b60008481526007602090815260408083208684529091528120549003610f3a576040516348a0a74d60e01b815260040160405180910390fd5b6000848152600760209081526040808320868452909152902080549083905582811115610fb5576000610f6d8483611d8f565b600087815260036020526040902054909150610fb3906001600160a01b03167f000000000000000000000000eb9c1dbd95dcf5190e6d31ba94f89593d48990be8361171f565b505b506001949350505050565b806000819003610fe35760405163b68370bb60e01b815260040160405180910390fd5b60005b818110156110c9576110c184848381811061100357611003611df6565b90506020028101906110159190611e0c565b3585858481811061102857611028611df6565b905060200281019061103a9190611e0c565b6020013586868581811061105057611050611df6565b90506020028101906110629190611e0c565b604001358888888781811061107957611079611df6565b905060200281019061108b9190611e0c565b606001358989888181106110a1576110a1611df6565b90506020028101906110b39190611e0c565b610155906080810190611e2c565b600101610fe6565b5050505050565b600560205281600052604060002081815481106110ec57600080fd5b90600052602060002001600091509150505481565b611109611776565b61111360006117d0565b565b6000336001600160a01b037f000000000000000000000000eb9c1dbd95dcf5190e6d31ba94f89593d48990be161480159061115b57506000546001600160a01b03163314155b156111795760405163015783e960e51b815260040160405180910390fd5b62093a806111878186611da2565b6111919190611dc4565b6000868152600360205260409020549094506001600160a01b03166111c95760405163e72eafc360e01b815260040160405180910390fd5b836000036111e957604051627af3d560e01b815260040160405180910390fd5b60008581526007602090815260408083208784529091528120549003611222576040516348a0a74d60e01b815260040160405180910390fd5b60008581526006602090815260408083208784529091529020541561125a576040516326d774e960e11b815260040160405180910390fd5b600082900361127c576040516385ac2b9960e01b815260040160405180910390fd5b60008581526005602090815260408083208054600181018255908452828420018790558783526007825280832087845290915290205483146112d157604051633da886b360e11b815260040160405180910390fd5b60008581526006602090815260408083208784528252918290208490559051838152859187917f1d3b13bb6ce947c806a76a3476eafd33ec751e6ed2cbbdf7ab8503a4fb76a1ee91016106fa565b6001546001600160a01b0316331461134a576040516305e05b4b60e31b815260040160405180910390fd5b6001546001600160a01b031661135f816117d0565b600180546001600160a01b03191690556040516000906001600160a01b038316907fb3d55174552271a4f1aaf36b72f50381e892171636b3fb5447fe00e995e7a37b908390a350565b60006113b2611776565b6113ba6116ad565b6001600160a01b03821660009081526004602052604090205460ff16156113f4576040516380eb2a0160e01b815260040160405180910390fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa15801561143b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145f9190611e76565b90508060000361148257604051630e5a744960e41b815260040160405180910390fd5b6114a86114976000546001600160a01b031690565b6001600160a01b038516908361171f565b60019150506114b76001600255565b919050565b600062093a806114cc8185611da2565b6114d69190611dc4565b9250336001600160a01b037f000000000000000000000000eb9c1dbd95dcf5190e6d31ba94f89593d48990be16146115215760405163015783e960e51b815260040160405180910390fd5b6000848152600360205260409020546001600160a01b03166115565760405163e72eafc360e01b815260040160405180910390fd5b60008481526007602090815260408083208684529091529020541561158e576040516326d774e960e11b815260040160405180910390fd5b826000036115ae57604051627af3d560e01b815260040160405180910390fd5b816000036115cf57604051630e5a744960e41b815260040160405180910390fd5b506000928352600760209081526040808520938552929052912055600190565b6115f7611776565b6001600160a01b03811661161e57604051639fabe1c160e01b815260040160405180910390fd5b6000546001600160a01b03166001600160a01b0316816001600160a01b03160361165b5760405163d5e889bf60e01b815260040160405180910390fd5b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907fb3d55174552271a4f1aaf36b72f50381e892171636b3fb5447fe00e995e7a37b90600090a35050565b60028054036117035760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b60028055565b6000826117168584611820565b14949350505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261177190849061186d565b505050565b6000546001600160a01b031633146111135760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016116fa565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600081815b8451811015611865576118518286838151811061184457611844611df6565b602002602001015161193f565b91508061185d81611e8f565b915050611825565b509392505050565b60006118c2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166119719092919063ffffffff16565b80519091501561177157808060200190518101906118e09190611ea8565b6117715760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016116fa565b600081831061195b57600082815260208490526040902061196a565b60008381526020839052604090205b9392505050565b6060610706848460008585600080866001600160a01b031685876040516119989190611eee565b60006040518083038185875af1925050503d80600081146119d5576040519150601f19603f3d011682016040523d82523d6000602084013e6119da565b606091505b50915091506119eb878383876119f6565b979650505050505050565b60608315611a65578251600003611a5e576001600160a01b0385163b611a5e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016116fa565b5081610706565b6107068383815115611a7a5781518083602001fd5b8060405162461bcd60e51b81526004016116fa9190611f00565b80356001600160a01b03811681146114b757600080fd5b60008083601f840112611abd57600080fd5b50813567ffffffffffffffff811115611ad557600080fd5b6020830191508360208260051b8501011115611af057600080fd5b9250929050565b600080600080600080600060c0888a031215611b1257600080fd5b873596506020880135955060408801359450611b3060608901611a94565b93506080880135925060a088013567ffffffffffffffff811115611b5357600080fd5b611b5f8a828b01611aab565b989b979a50959850939692959293505050565b60008060008060808587031215611b8857600080fd5b5050823594602084013594506040840135936060013592509050565b60008060008060608587031215611bba57600080fd5b611bc385611a94565b935060208501359250604085013567ffffffffffffffff811115611be657600080fd5b611bf287828801611aab565b95989497509550505050565b600060208284031215611c1057600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b81811015611c4f57835183529284019291840191600101611c33565b50909695505050505050565b60008060408385031215611c6e57600080fd5b50508035926020909101359150565b60008060408385031215611c9057600080fd5b82359150611ca060208401611a94565b90509250929050565b600080600060608486031215611cbe57600080fd5b505081359360208301359350604090920135919050565b600080600060408486031215611cea57600080fd5b611cf384611a94565b9250602084013567ffffffffffffffff811115611d0f57600080fd5b611d1b86828701611aab565b9497909650939450505050565b600060208284031215611d3a57600080fd5b61196a82611a94565b94855260208501939093526040840191909152606090811b6bffffffffffffffffffffffff191690830152607482015260940190565b634e487b7160e01b600052601160045260246000fd5b81810381811115610e0b57610e0b611d79565b600082611dbf57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611dde57611dde611d79565b500290565b80820180821115610e0b57610e0b611d79565b634e487b7160e01b600052603260045260246000fd5b60008235609e19833603018112611e2257600080fd5b9190910192915050565b6000808335601e19843603018112611e4357600080fd5b83018035915067ffffffffffffffff821115611e5e57600080fd5b6020019150600581901b3603821315611af057600080fd5b600060208284031215611e8857600080fd5b5051919050565b600060018201611ea157611ea1611d79565b5060010190565b600060208284031215611eba57600080fd5b8151801515811461196a57600080fd5b60005b83811015611ee5578181015183820152602001611ecd565b50506000910152565b60008251611e22818460208701611eca565b6020815260008251806020840152611f1f816040850160208701611eca565b601f01601f1916919091016040019291505056fea264697066735822122091f550d3267e90b8c3ef1c8e5ffbabfcbb8785fa76b2e7df5b5d3542c1979cc664736f6c63430008100033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000eb9c1dbd95dcf5190e6d31ba94f89593d48990be
-----Decoded View---------------
Arg [0] : _questBoard (address): 0xeB9C1Dbd95dcF5190E6D31Ba94f89593D48990bE
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000eb9c1dbd95dcf5190e6d31ba94f89593d48990be
Loading...
Loading
Loading...
Loading
Net Worth in USD
$3,968.96
Net Worth in ETH
2.030993
Token Allocations
GHO
67.44%
PYUSD
25.57%
ALCX
4.92%
Others
2.07%
Multichain Portfolio | 33 Chains
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.