Feature Tip: Add private address tag to any address under My Name Tag !
Source Code
Latest 25 from a total of 895 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Claim | 24292162 | 4 days ago | IN | 0 ETH | 0.00007343 | ||||
| Multi Claim | 24288934 | 5 days ago | IN | 0 ETH | 0.00001008 | ||||
| Claim | 24239447 | 11 days ago | IN | 0 ETH | 0.00009474 | ||||
| Multi Claim | 24214327 | 15 days ago | IN | 0 ETH | 0.0040633 | ||||
| Multi Claim | 24194203 | 18 days ago | IN | 0 ETH | 0.0000129 | ||||
| Multi Claim | 24189464 | 18 days ago | IN | 0 ETH | 0.00000814 | ||||
| Claim | 24189122 | 19 days ago | IN | 0 ETH | 0.00006005 | ||||
| Multi Claim | 24177612 | 20 days ago | IN | 0 ETH | 0.00001804 | ||||
| Multi Claim | 24171134 | 21 days ago | IN | 0 ETH | 0.00009662 | ||||
| Multi Claim | 24168760 | 21 days ago | IN | 0 ETH | 0.00002725 | ||||
| Multi Claim | 24168709 | 21 days ago | IN | 0 ETH | 0.00001328 | ||||
| Multi Claim | 24168664 | 21 days ago | IN | 0 ETH | 0.00001139 | ||||
| Multi Claim | 24126690 | 27 days ago | IN | 0 ETH | 0.00004174 | ||||
| Multi Claim | 24114852 | 29 days ago | IN | 0 ETH | 0.00008981 | ||||
| Multi Claim | 24094583 | 32 days ago | IN | 0 ETH | 0.00004881 | ||||
| Claim | 24041525 | 39 days ago | IN | 0 ETH | 0.00005337 | ||||
| Multi Claim | 24040590 | 39 days ago | IN | 0 ETH | 0.00002302 | ||||
| Multi Claim | 24038965 | 39 days ago | IN | 0 ETH | 0.00000666 | ||||
| Multi Claim | 24038237 | 40 days ago | IN | 0 ETH | 0.00000339 | ||||
| Claim | 23988718 | 46 days ago | IN | 0 ETH | 0.00007194 | ||||
| Multi Claim | 23988449 | 47 days ago | IN | 0 ETH | 0.00001618 | ||||
| Claim | 23939095 | 53 days ago | IN | 0 ETH | 0.000061 | ||||
| Multi Claim | 23938760 | 54 days ago | IN | 0 ETH | 0.00000421 | ||||
| Multi Claim | 23895012 | 60 days ago | IN | 0 ETH | 0.00003231 | ||||
| Multi Claim | 23893271 | 60 days ago | IN | 0 ETH | 0.00022675 |
Advanced mode: Intended for advanced users or developers and will display all Internal Transactions including zero value transfers.
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
|||
|---|---|---|---|---|---|---|---|---|
| Notify Quest Cla... | 24292162 | 4 days ago | 0 ETH | |||||
| Transfer | 24292162 | 4 days ago | 0 ETH | |||||
| Notify Distribut... | 24289213 | 5 days ago | 0 ETH | |||||
| Update Quest Per... | 24289213 | 5 days ago | 0 ETH | |||||
| Add Quest Period | 24289186 | 5 days ago | 0 ETH | |||||
| Transfer | 24288934 | 5 days ago | 0 ETH | |||||
| Notify Quest Cla... | 24288934 | 5 days ago | 0 ETH | |||||
| Notify Quest Cla... | 24288934 | 5 days ago | 0 ETH | |||||
| Add Quest | 24268216 | 7 days ago | 0 ETH | |||||
| Quest Reward Tok... | 24247468 | 10 days ago | 0 ETH | |||||
| Quest Reward Tok... | 24247468 | 10 days ago | 0 ETH | |||||
| Quest Reward Tok... | 24247468 | 10 days ago | 0 ETH | |||||
| Quest Reward Tok... | 24247468 | 10 days ago | 0 ETH | |||||
| Quest Reward Tok... | 24247468 | 10 days ago | 0 ETH | |||||
| Quest Reward Tok... | 24247468 | 10 days ago | 0 ETH | |||||
| Quest Reward Tok... | 24247468 | 10 days ago | 0 ETH | |||||
| Quest Reward Tok... | 24247468 | 10 days ago | 0 ETH | |||||
| Quest Reward Tok... | 24247468 | 10 days ago | 0 ETH | |||||
| Quest Reward Tok... | 24247468 | 10 days ago | 0 ETH | |||||
| Quest Reward Tok... | 24247468 | 10 days ago | 0 ETH | |||||
| Quest Reward Tok... | 24247468 | 10 days ago | 0 ETH | |||||
| Quest Reward Tok... | 24247468 | 10 days ago | 0 ETH | |||||
| Quest Reward Tok... | 24247468 | 10 days ago | 0 ETH | |||||
| Quest Reward Tok... | 24247468 | 10 days ago | 0 ETH | |||||
| Quest Reward Tok... | 24247468 | 10 days ago | 0 ETH |
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
MultiMerkleDistributorV2
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 999999 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
//██████╗ █████╗ ██╗ █████╗ ██████╗ ██╗███╗ ██╗
//██╔══██╗██╔══██╗██║ ██╔══██╗██╔══██╗██║████╗ ██║
//██████╔╝███████║██║ ███████║██║ ██║██║██╔██╗ ██║
//██╔═══╝ ██╔══██║██║ ██╔══██║██║ ██║██║██║╚██╗██║
//██║ ██║ ██║███████╗██║ ██║██████╔╝██║██║ ╚████║
//╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═════╝ ╚═╝╚═╝ ╚═══╝
//SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.20;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "./utils/Owner.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./libraries/Errors.sol";
import {ILootCreator} from "./interfaces/ILootCreator.sol";
/** @title Quest Multi Merkle Distributor V2 */
/// @author Paladin
/*
Contract holds ERC20 rewards from Quests
Can handle multiple MerkleRoots
V2 to handle LOOT triggers
*/
contract MultiMerkleDistributorV2 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;
/** @notice Address of the Loot Creator contract */
address public lootCreator;
// 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);
/** @notice Event emitted when the Loot Creator address is updated */
event LootCreatorUpdated(address indexed oldCreator, address indexed newCreator);
// 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);
_triggerCreateLoot(account, questID, period, 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();
if(account == address(0)) revert Errors.AddressZero();
address lastToken;
uint256 transferAmount;
for(uint256 i; i < length;){
if(questMerkleRootPerPeriod[claims[i].questID][claims[i].period] == 0) revert Errors.MerkleRootNotUpdated();
if(isClaimed(claims[i].questID, claims[i].period, claims[i].index)) revert Errors.AlreadyClaimed();
// Check that the given parameters match the given Proof
bytes32 node = keccak256(abi.encodePacked(claims[i].questID, claims[i].period, claims[i].index, account, claims[i].amount));
if(!MerkleProof.verify(claims[i].merkleProof, questMerkleRootPerPeriod[claims[i].questID][claims[i].period], node)) revert Errors.InvalidProof();
// Set the rewards as claimed for that period
// And transfer the rewards to the user
address rewardToken = questRewardToken[claims[i].questID];
_setClaimed(claims[i].questID, claims[i].period, claims[i].index);
questRewardsPerPeriod[claims[i].questID][claims[i].period] -= claims[i].amount;
_triggerCreateLoot(account, claims[i].questID, claims[i].period, claims[i].amount);
emit Claimed(claims[i].questID, claims[i].period, claims[i].index, claims[i].amount, rewardToken, account);
if(rewardToken != lastToken){
if(lastToken != address(0)){
IERC20(lastToken).safeTransfer(account, transferAmount);
transferAmount = 0;
}
lastToken = rewardToken;
transferAmount += claims[i].amount;
} else {
transferAmount += claims[i].amount;
}
unchecked{ ++i; }
}
if(lastToken != address(0) && transferAmount != 0){
IERC20(lastToken).safeTransfer(account, transferAmount);
}
}
//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;
// Trigger Loot hook to store claim data for later Loot creation
_triggerCreateLoot(
account,
questID,
claims[i].period,
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];
}
/**
* @notice Triggers the notification of a Quest Claim to the Loot Creator contract
* @dev Triggers the notification of a Quest Claim to the Loot Creator contract
* @param user Address of the user
* @param questID ID of the Quest
* @param questID Timestamp of the period
* @param claimedAmount Amount of rewards claimed
*/
function _triggerCreateLoot(address user, uint256 questID, uint256 period, uint256 claimedAmount) internal {
if(lootCreator != address(0)) {
ILootCreator(lootCreator).notifyQuestClaim(
user,
questID,
period,
claimedAmount
);
}
}
// 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();
if(questMerkleRootPerPeriod[questID][period] != 0) revert Errors.PeriodAlreadyUpdated();
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;
// If a Loot Creator is set, notify it of the new Quest Period distributed
if(lootCreator != address(0)) {
ILootCreator(lootCreator).notifyDistributedQuestPeriod(questID, period, totalAmount);
}
emit QuestPeriodUpdated(questID, period, merkleRoot);
return true;
}
// Admin functions
/**
* @notice Sets the address for the Loot Creator
* @dev Sets the address for the Loot Creator
* @param _lootCreator Address of the Loot Creator
*/
function setLootCreator(address _lootCreator) external onlyOwner {
address oldCreator = lootCreator;
lootCreator = _lootCreator;
emit LootCreatorUpdated(oldCreator, _lootCreator);
}
/**
* @notice Recovers ERC2O tokens sent by mistake to the contract
* @dev Recovers ERC2O tokens sent by mistake to the contract
* @param token Address of 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;
// If a Loot Creator is set, notify it of the new Quest Period distributed
if(lootCreator != address(0) && addedRewardAmount > 0) {
ILootCreator(lootCreator).notifyAddedRewardsQuestPeriod(questID, period, addedRewardAmount);
}
emit QuestPeriodUpdated(questID, period, merkleRoot);
return true;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. 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;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @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 {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling 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 {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_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 v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.20;
/**
* @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.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
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].
*
* CAUTION: See Security Considerations above.
*/
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 v5.0.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @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 value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` 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 value) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../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;
/**
* @dev An operation with an ERC20 token failed.
*/
error SafeERC20FailedOperation(address token);
/**
* @dev Indicates a failed `decreaseAllowance` request.
*/
error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
forceApprove(token, spender, oldAllowance + value);
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
* value, non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
unchecked {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < requestedDecrease) {
revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
}
forceApprove(token, spender, currentAllowance - requestedDecrease);
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @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);
if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @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).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// 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 cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error AddressInsufficientBalance(address account);
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedInnerCall();
/**
* @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.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
if (address(this).balance < amount) {
revert AddressInsufficientBalance(address(this));
}
(bool success, ) = recipient.call{value: amount}("");
if (!success) {
revert FailedInnerCall();
}
}
/**
* @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 or custom error, it is bubbled
* up by this function (like regular Solidity function calls). However, if
* the call reverted with no returned reason, this function reverts with a
* {FailedInnerCall} error.
*
* 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.
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0);
}
/**
* @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`.
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
if (address(this).balance < value) {
revert AddressInsufficientBalance(address(this));
}
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
* was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
* unsuccessful call.
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
// only check if target is a contract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
if (returndata.length == 0 && target.code.length == 0) {
revert AddressEmptyCode(target);
}
return returndata;
}
}
/**
* @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
* revert reason or with a default {FailedInnerCall} error.
*/
function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
return returndata;
}
}
/**
* @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
*/
function _revert(bytes memory returndata) 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 FailedInnerCall();
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @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;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.20;
/**
* @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 The multiproof provided is not valid.
*/
error MerkleProofInvalidMultiproof();
/**
* @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}
*/
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.
*/
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}
*/
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.
*/
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.
*/
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).
*/
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 proofLen = proof.length;
uint256 totalHashes = proofFlags.length;
// Check proof validity.
if (leavesLen + proofLen != totalHashes + 1) {
revert MerkleProofInvalidMultiproof();
}
// 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) {
if (proofPos != proofLen) {
revert MerkleProofInvalidMultiproof();
}
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.
*/
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 proofLen = proof.length;
uint256 totalHashes = proofFlags.length;
// Check proof validity.
if (leavesLen + proofLen != totalHashes + 1) {
revert MerkleProofInvalidMultiproof();
}
// 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) {
if (proofPos != proofLen) {
revert MerkleProofInvalidMultiproof();
}
unchecked {
return hashes[totalHashes - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
/**
* @dev Sorts the pair (a, b) and hashes the result.
*/
function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
}
/**
* @dev Implementation of keccak256(abi.encode(a, b)) that doesn't allocate or expand memory.
*/
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 v5.0.0) (utils/ReentrancyGuard.sol)
pragma solidity ^0.8.20;
/**
* @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;
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
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
if (_status == ENTERED) {
revert ReentrancyGuardReentrantCall();
}
// 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: Unlicensed
pragma solidity 0.8.20;
interface ILootCreator {
struct MultiCreate {
// Address of the Distributor handling the Quest rewards
address distributor;
// ID of the Quest
uint256 questId;
// Timestamp of the period
uint256 period;
}
function getBudgetForPeriod(uint256 period) external view returns(uint256 palAmount, uint256 extraAmount);
function getGaugeBudgetForPeriod(
address gauge,
uint256 period
) external view returns(uint256 palAmount, uint256 extraAmount);
function getQuestAllocationForPeriod(
uint256 questId,
address distributor,
uint256 period
) external view returns(uint256 palPerVote, uint256 extraPerVote);
function getListedDistributors() external view returns(address[] memory);
function createLoot(address user, address distributor, uint256 questId, uint256 period) external;
function createMultipleLoot(address user, MultiCreate[] calldata params) external;
function notifyQuestClaim(address user, uint256 questId, uint256 period, uint256 claimedAmount) external;
function notifyDistributedQuestPeriod(uint256 questId, uint256 period, uint256 totalRewards) external;
function notifyAddedRewardsQuestPeriod(uint256 questId, uint256 period, uint256 addedRewards) external;
function notifyUndistributedRewards(uint256 palAmount) external;
function notifyNewBudget(uint256 palAmount, uint256 extraAmount) external;
function updatePeriod() external;
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;
library Errors {
// Commons
error AddressZero();
error NullAmount();
error InvalidParameter();
error SameAddress();
error ArraySizeMismatch();
error AlreadyInitialized();
// Access Control
error CannotBeOwner();
error CallerNotPendingOwner();
error CallerNotAllowed();
// Merkle Distributor
error EmptyParameters();
error InvalidProof();
error AlreadyClaimed();
error MerkleRootNotUpdated();
error EmptyMerkleRoot();
error IncorrectQuestID();
error QuestAlreadyListed();
error QuestNotListed();
error PeriodAlreadyUpdated();
error PeriodNotClosed();
error IncorrectPeriod();
error PeriodNotListed();
error TokenNotWhitelisted();
error IncorrectRewardAmount();
error CannotRecoverToken();
// HolyPalPower
error InvalidTimestamp();
// Vote Controller
error AlreadyListed();
error LockExpired();
error VotingPowerInvalid();
error VotingPowerExceeded();
error VotingPowerProxyExceeded();
error VotingCooldown();
error KilledGauge();
error NotKilledGauge();
error NotAllowedManager();
error NotAllowedProxyVoter();
error ExpiredProxy();
error ProxyAlreadyActive();
error ProxyPowerExceeded();
error ProxyDurationExceeded();
error NotAllowedVoteChange();
error MaxVoteListExceeded();
error MaxProxyListExceeded();
error InvalidGaugeCap();
// Loot
error CreatorAlreadySet();
error InvalidId(uint256 id);
error VestingNotStarted(uint256 id);
// Loot Creator
error NotListed();
// Loot Buget
error LootBudgetExceedLimit();
//Maths
error ConversionOverflow();
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;
import {Ownable} from "@openzeppelin/contracts/access/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);
constructor() Ownable(msg.sender) {}
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": 999999
},
"viaIR": true,
"evmVersion": "paris",
"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":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"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":"FailedInnerCall","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":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","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":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","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":"oldCreator","type":"address"},{"indexed":true,"internalType":"address","name":"newCreator","type":"address"}],"name":"LootCreatorUpdated","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 MultiMerkleDistributorV2.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":[],"name":"lootCreator","outputs":[{"internalType":"address","name":"","type":"address"}],"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 MultiMerkleDistributorV2.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":"_lootCreator","type":"address"}],"name":"setLootCreator","outputs":[],"stateMutability":"nonpayable","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
60a0346200010757601f6200295d38819003918201601f19168301916001600160401b038311848410176200010c578084926020946040528339810103126200010757516001600160a01b0380821680830362000107573315620000ee576000543360018060a01b0319821617600055604051923391167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3600160025515620000df575060805260405161283a90816200012382396080518181816103350152818161080601528181611271015281816115100152611e150152f35b639fabe1c160e01b8152600490fd5b604051631e4fbdf760e01b815260006004820152602490fd5b600080fd5b634e487b7160e01b600052604160045260246000fdfe6040608081526004908136101561001557600080fd5b600091823560e01c80630c3a0fff14611e395780631312279814611dca57806317fea75c14611c185780633a3e6a77146117a757806346fe84e9146116eb578063493b952c146116bf57806354ec46de1461166c57806358ad4064146114b7578063627614ac14611465578063657c5e8c1461125d5780636a9b8ce514610d205780636ec803bb14610cdf578063715018a614610c43578063726f3f2514610b9657806375d0d380146107db57806379ba5097146106dd5780638da5cb5b1461068c578063933803581461066057806395861d5c146106055780639e8c708e1461049d578063c25a4d9e146102f3578063e30c39781461029c578063f2fde38b146101915763f5ab16cc1461012957600080fd5b3461018d5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018d578160209360ff9273ffffffffffffffffffffffffffffffffffffffff61017c612130565b168252855220541690519015158152f35b8280fd5b503461018d5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018d576101c9612130565b906101d2612278565b73ffffffffffffffffffffffffffffffffffffffff80921692831561027657828554168414610250575050600154827fffffffffffffffffffffffff0000000000000000000000000000000000000000821617600155167fb3d55174552271a4f1aaf36b72f50381e892171636b3fb5447fe00e995e7a37b8380a380f35b517fd5e889bf000000000000000000000000000000000000000000000000000000008152fd5b517f9fabe1c1000000000000000000000000000000000000000000000000000000008152fd5b5050346102ef57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102ef5760209073ffffffffffffffffffffffffffffffffffffffff600154169051908152f35b5080fd5b50913461049a57610303366121f9565b929162093a8080920482810292818404149015171561046e5773ffffffffffffffffffffffffffffffffffffffff95867f0000000000000000000000000000000000000000000000000000000000000000163303610447578184526020966003885286852054161561042057818452600787528584208385528752858420546103f95782156103d35784156103ac57508252600785528382209082528452829020555160018152f35b85517fe5a74490000000000000000000000000000000000000000000000000000000008152fd5b85517e7af3d5000000000000000000000000000000000000000000000000000000008152fd5b85517f4daee9d2000000000000000000000000000000000000000000000000000000008152fd5b85517fe72eafc3000000000000000000000000000000000000000000000000000000008152fd5b85517f2af07d20000000000000000000000000000000000000000000000000000000008152fd5b6024836011887f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b80fd5b509190346102ef57602091827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261049a576104d9612130565b6104e1612278565b6104e9612604565b73ffffffffffffffffffffffffffffffffffffffff8091169081835285855260ff84842054166105dd578351927f70a0823100000000000000000000000000000000000000000000000000000000845230878501528584602481865afa9384156105d157819461059e575b5083156105765761056a949596505416906123e0565b60016002555160018152f35b8685517fe5a74490000000000000000000000000000000000000000000000000000000008152fd5b9093508581813d83116105ca575b6105b6818361230c565b810103126105c657519238610554565b8380fd5b503d6105ac565b508451903d90823e3d90fd5b8584517f80eb2a01000000000000000000000000000000000000000000000000000000008152fd5b503461018d5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018d578160209373ffffffffffffffffffffffffffffffffffffffff92358152600385522054169051908152f35b5050346102ef5780602092610674366121c5565b90825260068552828220908252845220549051908152f35b5050346102ef57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102ef5773ffffffffffffffffffffffffffffffffffffffff60209254169051908152f35b509190346102ef57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102ef5760015473ffffffffffffffffffffffffffffffffffffffff90818116928333036107b35750839450828454927fffffffffffffffffffffffff00000000000000000000000000000000000000009382858216178755167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08680a3166001557fb3d55174552271a4f1aaf36b72f50381e892171636b3fb5447fe00e995e7a37b8280a380f35b8590517f2f02da58000000000000000000000000000000000000000000000000000000008152fd5b50913461049a576107eb36612189565b919373ffffffffffffffffffffffffffffffffffffffff96877f00000000000000000000000000000000000000000000000000000000000000001633141580610b89575b610b625762093a80809604868102968188041490151715610b36578482526020976003895280888420541615610b0e578615610ae7578583526007895287832087845289528783205415610abf5785835260068952878320878452895287832054610a97578415610a6f578583526005895287832080549068010000000000000000821015610a4357906108c891600182018155612231565b81549060031b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8a831b921b1916179055858352600789528783208784528952878320548403610a1b57908291868a959452600685528883208884528552858984205560095416908161096a575b505050507f1d3b13bb6ce947c806a76a3476eafd33ec751e6ed2cbbdf7ab8503a4fb76a1ee918551908152a35160018152f35b9080929394503b1561018d578291868389936109c38c51988996879586947faee0838700000000000000000000000000000000000000000000000000000000865285016040919493926060820195825260208201520152565b03925af1908115610a1057509186917f1d3b13bb6ce947c806a76a3476eafd33ec751e6ed2cbbdf7ab8503a4fb76a1ee93610a01575b819381610937565b610a0a906122c9565b386109f9565b8651903d90823e3d90fd5b5086517f7b510d66000000000000000000000000000000000000000000000000000000008152fd5b6024856041867f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b5086517f85ac2b99000000000000000000000000000000000000000000000000000000008152fd5b5086517f4daee9d2000000000000000000000000000000000000000000000000000000008152fd5b5086517f48a0a74d000000000000000000000000000000000000000000000000000000008152fd5b5086517e7af3d5000000000000000000000000000000000000000000000000000000008152fd5b5086517fe72eafc3000000000000000000000000000000000000000000000000000000008152fd5b9060116024927f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b86517f2af07d20000000000000000000000000000000000000000000000000000000008152fd5b508782541633141561082f565b833461049a5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261049a57610bce612130565b610bd6612278565b6009549073ffffffffffffffffffffffffffffffffffffffff80911691827fffffffffffffffffffffffff0000000000000000000000000000000000000000821617600955167f8352ba19c21cdb525381f325922bf54276532b75cd30d187ea8d8733d60018988380a380f35b833461049a57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261049a57610c7a612278565b8073ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b5050346102ef57610cef366121c5565b92908152600560205281812090815484101561049a5750602092610d1291612231565b91905490519160031b1c8152f35b503461018d57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018d57610d57612130565b9160243567ffffffffffffffff811161125957610d779036908401612158565b91909282156112325773ffffffffffffffffffffffffffffffffffffffff928386161561120a579391908694879388935b828510610de0575050505050169182151580610dd7575b610dc7578380f35b610dd0926123e0565b3880808380f35b50811515610dbf565b909192939694610df18885856126b6565b358a526006602052818a206020610e098a87876126b6565b01358b52602052818a2054156111e257610e78610e278986866126b6565b356020610e358b88886126b6565b013584610e438c89896126b6565b013591604060ff91600193600091825260086020528282209082526020528181208560081c8252602052205492161b16151590565b6111ba57610f9d8a89610f9887868e89610f47610e968786846126b6565b3592610f1b6020610ea88a89876126b6565b0135916060610ec68b8a8a610ebe83838c6126b6565b0135986126b6565b01359087519586946020860198899390927fffffffffffffffffffffffffffffffffffffffff000000000000000000000000926094969486526020860152604085015260601b16606083015260748201520190565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0810183528261230c565b51902094896020610f87610f69610f5f8988866126b6565b60808101906126f6565b989096610f778282876126b6565b35865260068452868620946126b6565b01358252602052205492369161234d565b61263d565b1561119257888a91610fb08a87876126b6565b358352600360205289611068858b8187205416956110258a8a84610ff088610fd98186866126b6565b35946020610fe88383886126b6565b0135946126b6565b013591604060ff91600193600091825260086020528282209082526020528181208560081c82526020522092161b8154179055565b61103f6060611035868d8d6126b6565b0135948b8b6126b6565b35815260076020528d6020611058848420928d8d6126b6565b01358252602052209182546123a4565b905561109f6110788b88886126b6565b358b6060611096602061108c848d8d6126b6565b0135928b8b6126b6565b01359185612757565b8985877f9a5376f7dcf8631c2b6249c9bec3d715cb97bdd4c82d92e55d147f6b4eea419760606110f1896110e7876110d881888a6126b6565b35966020610ebe83838c6126b6565b0135958c8c6126b6565b89519586520135602085015273ffffffffffffffffffffffffffffffffffffffff871660408501528c861693606090a48089169083821461117357508061115d575b50506111516001919660606111498b88886126b6565b01359061274a565b975b0193929190610da8565b906111699297916123e0565b8894886001611133565b9790506001925061118c915060606111498b88886126b6565b97611153565b8482517f09bde339000000000000000000000000000000000000000000000000000000008152fd5b8482517f646cf558000000000000000000000000000000000000000000000000000000008152fd5b8482517fbc68df3f000000000000000000000000000000000000000000000000000000008152fd5b5090517f9fabe1c1000000000000000000000000000000000000000000000000000000008152fd5b90517fb68370bb000000000000000000000000000000000000000000000000000000008152fd5b8480fd5b50913461049a5761126d366121f9565b92907f00000000000000000000000000000000000000000000000000000000000000009173ffffffffffffffffffffffffffffffffffffffff91828416330361143d5762093a808091048181029181830414901517156114115784825260209760038952838884205416156113ea5781156113c457858352600789528783208284528952878320541561139d57858352600689528783208284528952878320546113765750908691858252600789528282208183528952828220549086835260078a528383209083528952868383205586811161134e575b88835160018152f35b61136a9661135b916123a4565b948152600388522054166123e0565b38808080848180611345565b87517f4daee9d2000000000000000000000000000000000000000000000000000000008152fd5b87517f48a0a74d000000000000000000000000000000000000000000000000000000008152fd5b87517e7af3d5000000000000000000000000000000000000000000000000000000008152fd5b87517fe72eafc3000000000000000000000000000000000000000000000000000000008152fd5b60248260118a7f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b8787517f2af07d20000000000000000000000000000000000000000000000000000000008152fd5b5050346102ef576020906114ae61147b366121f9565b91604060ff91600193600091825260086020528282209082526020528181208560081c8252602052205492161b16151590565b90519015158152f35b50913461049a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261049a578235906024359373ffffffffffffffffffffffffffffffffffffffff80861680960361018d57807f0000000000000000000000000000000000000000000000000000000000000000163303611644578383526003602052848320541661161d5784156115f65760209484838793867f6746344851206b5fc2dc76bcb3512131fd07c324969cd3ee2278192805477961965260038552828220847fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055838252845220805460ff8116156115c8575b50508451908152a25160018152f35b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905538806115b9565b83517ff84835a0000000000000000000000000000000000000000000000000000000008152fd5b83517f83d2396d000000000000000000000000000000000000000000000000000000008152fd5b5083517f2af07d20000000000000000000000000000000000000000000000000000000008152fd5b5050346102ef57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102ef5760209073ffffffffffffffffffffffffffffffffffffffff600954169051908152f35b5050346102ef57806020926116d3366121c5565b90825260078552828220908252845220549051908152f35b50823461049a57602091827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102ef5792919235815260058352818120908251808584549182815201908194845286842090845b818110611793575050508161175891038261230c565b83519485948186019282875251809352850193925b82811061177c57505050500390f35b83518552869550938101939281019260010161176d565b825484529288019260019283019201611742565b509190346102ef57606090817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018d576117e3612130565b906024359460443567ffffffffffffffff8111611c14576118079036908301612158565b611812939193612604565b73ffffffffffffffffffffffffffffffffffffffff97888616928315611bec578215611bc4578897828a5260209a60038c52828b2054169a8a5b85811061186857508a6118608b8b8f6123e0565b600160025580f35b84611878829c9e9d9c888c6126b6565b3503611b9c57848b526006808352848c2083611895848a8e6126b6565b01358d528352848c205415611b74576118f08a866118ba858b88610fe88383886126b6565b01359088604060ff91600193600091825260086020528282209082526020528181208560081c8252602052205492161b16151590565b611b4c57866119c191610f98888f8f908f896119b18a868f968f86610f1b8e9361198f9361193b888e611932828a8f61192a83838d6126b6565b0135996126b6565b0135978d6126b6565b0135908c519586948b860198899390927fffffffffffffffffffffffffffffffffffffffff000000000000000000000000926094969486526020860152604085015260601b16606083015260748201520190565b519020996119a1610f5f8383886126b6565b9a909887528452868620946126b6565b013582528952205492369161234d565b15611b24578689868e9f8e9f9e888b91886119dd8985896126b6565b0135826119eb8a868a6126b6565b0135611a249187604060ff91600193600091825260086020528282209082526020528181208560081c82526020522092161b8154179055565b87898b611a3283878b6126b6565b0135948784526007825284842092611a4a918a6126b6565b0135825289522090815490611a5e916123a4565b905586611a6c868c866126b6565b0135611a779161274a565b9d8d8286898d8a611a8984838b6126b6565b013592611a9691896126b6565b013591611aa293612757565b898787611ab08884886126b6565b013594878b611ac08286856126b6565b013593611acc926126b6565b8a519283520135602082015273ffffffffffffffffffffffffffffffffffffffff9190911660408201527f9a5376f7dcf8631c2b6249c9bec3d715cb97bdd4c82d92e55d147f6b4eea419790606090a460010161184c565b8784517f09bde339000000000000000000000000000000000000000000000000000000008152fd5b8885517f646cf558000000000000000000000000000000000000000000000000000000008152fd5b8885517fbc68df3f000000000000000000000000000000000000000000000000000000008152fd5b8784517f27140a4b000000000000000000000000000000000000000000000000000000008152fd5b8490517fb68370bb000000000000000000000000000000000000000000000000000000008152fd5b8490517f9fabe1c1000000000000000000000000000000000000000000000000000000008152fd5b8580fd5b50913461049a57611c2836612189565b9193611c32612278565b62093a80809504858102958187041490151715611d9e578381526020966003885273ffffffffffffffffffffffffffffffffffffffff80888420541615610b0e578615610ae7578583526006895287832087845289528783205415611d76578415610a6f57908291868a9594526006855288832088845285528589842055868352600785528883208884528552888320611ccd85825461274a565b9055600954169081151580611d6d575b611d1457505050507f1d3b13bb6ce947c806a76a3476eafd33ec751e6ed2cbbdf7ab8503a4fb76a1ee918551908152a35160018152f35b9080929394503b1561018d578291868389936109c38c51988996879586947f68f6df5200000000000000000000000000000000000000000000000000000000865285016040919493926060820195825260208201520152565b50831515611cdd565b5086517f226e5a6a000000000000000000000000000000000000000000000000000000008152fd5b806011887f4e487b71000000000000000000000000000000000000000000000000000000006024945252fd5b5050346102ef57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102ef576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b50903461018d5760c07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018d578135602435916044356064359473ffffffffffffffffffffffffffffffffffffffff928387169687810361212c576084359460a43567ffffffffffffffff811161212857611ebb9036908601612158565b611ec6959195612604565b8a1561210057888c52602095600687528c8b87822091528752858d2054156120d85760008a81526008602081815260408084208f85528252808420928c901c8452919052902054600160ff8a161b166120b057611fa191610f988b928f89908f868f8f8f610f1b8f938694611f85948a51968795860198899390927fffffffffffffffffffffffffffffffffffffffff000000000000000000000000926094969486526020860152604085015260601b16606083015260748201520190565b51902096825260068d528282209082528c52205492369161234d565b1561208957509161204b8689897f9a5376f7dcf8631c2b6249c9bec3d715cb97bdd4c82d92e55d147f6b4eea419799989795858f61207e9984825260038a5282822054169861201e8c8787604060ff91600193600091825260086020528282209082526020528181208560081c82526020522092161b8154179055565b848252600781528282209086835252206120398582546123a4565b90556120468482896123e0565b612757565b519384938491604091949373ffffffffffffffffffffffffffffffffffffffff9160608501968552602085015216910152565b0390a4600160025580f35b83517f09bde339000000000000000000000000000000000000000000000000000000008152fd5b8286517f646cf558000000000000000000000000000000000000000000000000000000008152fd5b8286517fbc68df3f000000000000000000000000000000000000000000000000000000008152fd5b5083517f9fabe1c1000000000000000000000000000000000000000000000000000000008152fd5b8a80fd5b8880fd5b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361215357565b600080fd5b9181601f840112156121535782359167ffffffffffffffff8311612153576020808501948460051b01011161215357565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc60809101126121535760043590602435906044359060643590565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc6040910112612153576004359060243590565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc606091011261215357600435906024359060443590565b80548210156122495760005260206000200190600090565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff60005416330361229957565b60246040517f118cdaa7000000000000000000000000000000000000000000000000000000008152336004820152fd5b67ffffffffffffffff81116122dd57604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176122dd57604052565b90929167ffffffffffffffff84116122dd578360051b60405192602080946123778285018261230c565b809781520191810192831161215357905b8282106123955750505050565b81358152908301908301612388565b919082039182116123b157565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b9190916040519260208401927fa9059cbb00000000000000000000000000000000000000000000000000000000845273ffffffffffffffffffffffffffffffffffffffff8092166024860152604485015260448452608084019167ffffffffffffffff92858110848211176122dd576040521692600080938192519082875af13d15612557573d91821161252a57906124b991604051916124a960207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116018461230c565b82523d84602084013e5b84612564565b908151918215159283612502575b5050506124d15750565b602490604051907f5274afe70000000000000000000000000000000000000000000000000000000082526004820152fd5b8192935090602091810103126102ef57602001519081159182150361049a57503880806124c7565b6024837f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b6124b991506060906124b3565b906125a3575080511561257957805190602001fd5b60046040517f1425ea42000000000000000000000000000000000000000000000000000000008152fd5b815115806125fb575b6125b4575090565b60249073ffffffffffffffffffffffffffffffffffffffff604051917f9996b315000000000000000000000000000000000000000000000000000000008352166004820152fd5b50803b156125ac565b60028054146126135760028055565b60046040517f3ee5aeb5000000000000000000000000000000000000000000000000000000008152fd5b90926000925b82518410156126ad576020808560051b850101519160008382106000146126a057506000525260406000205b927fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146123b15760010192612643565b916040938352522061266f565b91509291501490565b91908110156122495760051b810135907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6181360301821215612153570190565b9035907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe181360301821215612153570180359067ffffffffffffffff821161215357602001918160051b3603831361215357565b919082018092116123b157565b909273ffffffffffffffffffffffffffffffffffffffff9182600954169384612783575b505050505050565b843b1561215357600094608493869260405198899788967f39f474de0000000000000000000000000000000000000000000000000000000088521660048701526024860152604485015260648401525af180156127f8576127e9575b808080808061277b565b6127f2906122c9565b386127df565b6040513d6000823e3d90fdfea26469706673582212208537fe2f84ba411b64189e77ce46c9f1137a8445793b3443ef6f573819a478e464736f6c63430008140033000000000000000000000000aa1698f0a51e6d00f5533cc3e5d36010ee4558c6
Deployed Bytecode
0x6040608081526004908136101561001557600080fd5b600091823560e01c80630c3a0fff14611e395780631312279814611dca57806317fea75c14611c185780633a3e6a77146117a757806346fe84e9146116eb578063493b952c146116bf57806354ec46de1461166c57806358ad4064146114b7578063627614ac14611465578063657c5e8c1461125d5780636a9b8ce514610d205780636ec803bb14610cdf578063715018a614610c43578063726f3f2514610b9657806375d0d380146107db57806379ba5097146106dd5780638da5cb5b1461068c578063933803581461066057806395861d5c146106055780639e8c708e1461049d578063c25a4d9e146102f3578063e30c39781461029c578063f2fde38b146101915763f5ab16cc1461012957600080fd5b3461018d5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018d578160209360ff9273ffffffffffffffffffffffffffffffffffffffff61017c612130565b168252855220541690519015158152f35b8280fd5b503461018d5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018d576101c9612130565b906101d2612278565b73ffffffffffffffffffffffffffffffffffffffff80921692831561027657828554168414610250575050600154827fffffffffffffffffffffffff0000000000000000000000000000000000000000821617600155167fb3d55174552271a4f1aaf36b72f50381e892171636b3fb5447fe00e995e7a37b8380a380f35b517fd5e889bf000000000000000000000000000000000000000000000000000000008152fd5b517f9fabe1c1000000000000000000000000000000000000000000000000000000008152fd5b5050346102ef57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102ef5760209073ffffffffffffffffffffffffffffffffffffffff600154169051908152f35b5080fd5b50913461049a57610303366121f9565b929162093a8080920482810292818404149015171561046e5773ffffffffffffffffffffffffffffffffffffffff95867f000000000000000000000000aa1698f0a51e6d00f5533cc3e5d36010ee4558c6163303610447578184526020966003885286852054161561042057818452600787528584208385528752858420546103f95782156103d35784156103ac57508252600785528382209082528452829020555160018152f35b85517fe5a74490000000000000000000000000000000000000000000000000000000008152fd5b85517e7af3d5000000000000000000000000000000000000000000000000000000008152fd5b85517f4daee9d2000000000000000000000000000000000000000000000000000000008152fd5b85517fe72eafc3000000000000000000000000000000000000000000000000000000008152fd5b85517f2af07d20000000000000000000000000000000000000000000000000000000008152fd5b6024836011887f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b80fd5b509190346102ef57602091827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261049a576104d9612130565b6104e1612278565b6104e9612604565b73ffffffffffffffffffffffffffffffffffffffff8091169081835285855260ff84842054166105dd578351927f70a0823100000000000000000000000000000000000000000000000000000000845230878501528584602481865afa9384156105d157819461059e575b5083156105765761056a949596505416906123e0565b60016002555160018152f35b8685517fe5a74490000000000000000000000000000000000000000000000000000000008152fd5b9093508581813d83116105ca575b6105b6818361230c565b810103126105c657519238610554565b8380fd5b503d6105ac565b508451903d90823e3d90fd5b8584517f80eb2a01000000000000000000000000000000000000000000000000000000008152fd5b503461018d5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018d578160209373ffffffffffffffffffffffffffffffffffffffff92358152600385522054169051908152f35b5050346102ef5780602092610674366121c5565b90825260068552828220908252845220549051908152f35b5050346102ef57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102ef5773ffffffffffffffffffffffffffffffffffffffff60209254169051908152f35b509190346102ef57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102ef5760015473ffffffffffffffffffffffffffffffffffffffff90818116928333036107b35750839450828454927fffffffffffffffffffffffff00000000000000000000000000000000000000009382858216178755167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08680a3166001557fb3d55174552271a4f1aaf36b72f50381e892171636b3fb5447fe00e995e7a37b8280a380f35b8590517f2f02da58000000000000000000000000000000000000000000000000000000008152fd5b50913461049a576107eb36612189565b919373ffffffffffffffffffffffffffffffffffffffff96877f000000000000000000000000aa1698f0a51e6d00f5533cc3e5d36010ee4558c61633141580610b89575b610b625762093a80809604868102968188041490151715610b36578482526020976003895280888420541615610b0e578615610ae7578583526007895287832087845289528783205415610abf5785835260068952878320878452895287832054610a97578415610a6f578583526005895287832080549068010000000000000000821015610a4357906108c891600182018155612231565b81549060031b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8a831b921b1916179055858352600789528783208784528952878320548403610a1b57908291868a959452600685528883208884528552858984205560095416908161096a575b505050507f1d3b13bb6ce947c806a76a3476eafd33ec751e6ed2cbbdf7ab8503a4fb76a1ee918551908152a35160018152f35b9080929394503b1561018d578291868389936109c38c51988996879586947faee0838700000000000000000000000000000000000000000000000000000000865285016040919493926060820195825260208201520152565b03925af1908115610a1057509186917f1d3b13bb6ce947c806a76a3476eafd33ec751e6ed2cbbdf7ab8503a4fb76a1ee93610a01575b819381610937565b610a0a906122c9565b386109f9565b8651903d90823e3d90fd5b5086517f7b510d66000000000000000000000000000000000000000000000000000000008152fd5b6024856041867f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b5086517f85ac2b99000000000000000000000000000000000000000000000000000000008152fd5b5086517f4daee9d2000000000000000000000000000000000000000000000000000000008152fd5b5086517f48a0a74d000000000000000000000000000000000000000000000000000000008152fd5b5086517e7af3d5000000000000000000000000000000000000000000000000000000008152fd5b5086517fe72eafc3000000000000000000000000000000000000000000000000000000008152fd5b9060116024927f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b86517f2af07d20000000000000000000000000000000000000000000000000000000008152fd5b508782541633141561082f565b833461049a5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261049a57610bce612130565b610bd6612278565b6009549073ffffffffffffffffffffffffffffffffffffffff80911691827fffffffffffffffffffffffff0000000000000000000000000000000000000000821617600955167f8352ba19c21cdb525381f325922bf54276532b75cd30d187ea8d8733d60018988380a380f35b833461049a57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261049a57610c7a612278565b8073ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b5050346102ef57610cef366121c5565b92908152600560205281812090815484101561049a5750602092610d1291612231565b91905490519160031b1c8152f35b503461018d57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018d57610d57612130565b9160243567ffffffffffffffff811161125957610d779036908401612158565b91909282156112325773ffffffffffffffffffffffffffffffffffffffff928386161561120a579391908694879388935b828510610de0575050505050169182151580610dd7575b610dc7578380f35b610dd0926123e0565b3880808380f35b50811515610dbf565b909192939694610df18885856126b6565b358a526006602052818a206020610e098a87876126b6565b01358b52602052818a2054156111e257610e78610e278986866126b6565b356020610e358b88886126b6565b013584610e438c89896126b6565b013591604060ff91600193600091825260086020528282209082526020528181208560081c8252602052205492161b16151590565b6111ba57610f9d8a89610f9887868e89610f47610e968786846126b6565b3592610f1b6020610ea88a89876126b6565b0135916060610ec68b8a8a610ebe83838c6126b6565b0135986126b6565b01359087519586946020860198899390927fffffffffffffffffffffffffffffffffffffffff000000000000000000000000926094969486526020860152604085015260601b16606083015260748201520190565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0810183528261230c565b51902094896020610f87610f69610f5f8988866126b6565b60808101906126f6565b989096610f778282876126b6565b35865260068452868620946126b6565b01358252602052205492369161234d565b61263d565b1561119257888a91610fb08a87876126b6565b358352600360205289611068858b8187205416956110258a8a84610ff088610fd98186866126b6565b35946020610fe88383886126b6565b0135946126b6565b013591604060ff91600193600091825260086020528282209082526020528181208560081c82526020522092161b8154179055565b61103f6060611035868d8d6126b6565b0135948b8b6126b6565b35815260076020528d6020611058848420928d8d6126b6565b01358252602052209182546123a4565b905561109f6110788b88886126b6565b358b6060611096602061108c848d8d6126b6565b0135928b8b6126b6565b01359185612757565b8985877f9a5376f7dcf8631c2b6249c9bec3d715cb97bdd4c82d92e55d147f6b4eea419760606110f1896110e7876110d881888a6126b6565b35966020610ebe83838c6126b6565b0135958c8c6126b6565b89519586520135602085015273ffffffffffffffffffffffffffffffffffffffff871660408501528c861693606090a48089169083821461117357508061115d575b50506111516001919660606111498b88886126b6565b01359061274a565b975b0193929190610da8565b906111699297916123e0565b8894886001611133565b9790506001925061118c915060606111498b88886126b6565b97611153565b8482517f09bde339000000000000000000000000000000000000000000000000000000008152fd5b8482517f646cf558000000000000000000000000000000000000000000000000000000008152fd5b8482517fbc68df3f000000000000000000000000000000000000000000000000000000008152fd5b5090517f9fabe1c1000000000000000000000000000000000000000000000000000000008152fd5b90517fb68370bb000000000000000000000000000000000000000000000000000000008152fd5b8480fd5b50913461049a5761126d366121f9565b92907f000000000000000000000000aa1698f0a51e6d00f5533cc3e5d36010ee4558c69173ffffffffffffffffffffffffffffffffffffffff91828416330361143d5762093a808091048181029181830414901517156114115784825260209760038952838884205416156113ea5781156113c457858352600789528783208284528952878320541561139d57858352600689528783208284528952878320546113765750908691858252600789528282208183528952828220549086835260078a528383209083528952868383205586811161134e575b88835160018152f35b61136a9661135b916123a4565b948152600388522054166123e0565b38808080848180611345565b87517f4daee9d2000000000000000000000000000000000000000000000000000000008152fd5b87517f48a0a74d000000000000000000000000000000000000000000000000000000008152fd5b87517e7af3d5000000000000000000000000000000000000000000000000000000008152fd5b87517fe72eafc3000000000000000000000000000000000000000000000000000000008152fd5b60248260118a7f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b8787517f2af07d20000000000000000000000000000000000000000000000000000000008152fd5b5050346102ef576020906114ae61147b366121f9565b91604060ff91600193600091825260086020528282209082526020528181208560081c8252602052205492161b16151590565b90519015158152f35b50913461049a57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261049a578235906024359373ffffffffffffffffffffffffffffffffffffffff80861680960361018d57807f000000000000000000000000aa1698f0a51e6d00f5533cc3e5d36010ee4558c6163303611644578383526003602052848320541661161d5784156115f65760209484838793867f6746344851206b5fc2dc76bcb3512131fd07c324969cd3ee2278192805477961965260038552828220847fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055838252845220805460ff8116156115c8575b50508451908152a25160018152f35b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905538806115b9565b83517ff84835a0000000000000000000000000000000000000000000000000000000008152fd5b83517f83d2396d000000000000000000000000000000000000000000000000000000008152fd5b5083517f2af07d20000000000000000000000000000000000000000000000000000000008152fd5b5050346102ef57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102ef5760209073ffffffffffffffffffffffffffffffffffffffff600954169051908152f35b5050346102ef57806020926116d3366121c5565b90825260078552828220908252845220549051908152f35b50823461049a57602091827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102ef5792919235815260058352818120908251808584549182815201908194845286842090845b818110611793575050508161175891038261230c565b83519485948186019282875251809352850193925b82811061177c57505050500390f35b83518552869550938101939281019260010161176d565b825484529288019260019283019201611742565b509190346102ef57606090817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018d576117e3612130565b906024359460443567ffffffffffffffff8111611c14576118079036908301612158565b611812939193612604565b73ffffffffffffffffffffffffffffffffffffffff97888616928315611bec578215611bc4578897828a5260209a60038c52828b2054169a8a5b85811061186857508a6118608b8b8f6123e0565b600160025580f35b84611878829c9e9d9c888c6126b6565b3503611b9c57848b526006808352848c2083611895848a8e6126b6565b01358d528352848c205415611b74576118f08a866118ba858b88610fe88383886126b6565b01359088604060ff91600193600091825260086020528282209082526020528181208560081c8252602052205492161b16151590565b611b4c57866119c191610f98888f8f908f896119b18a868f968f86610f1b8e9361198f9361193b888e611932828a8f61192a83838d6126b6565b0135996126b6565b0135978d6126b6565b0135908c519586948b860198899390927fffffffffffffffffffffffffffffffffffffffff000000000000000000000000926094969486526020860152604085015260601b16606083015260748201520190565b519020996119a1610f5f8383886126b6565b9a909887528452868620946126b6565b013582528952205492369161234d565b15611b24578689868e9f8e9f9e888b91886119dd8985896126b6565b0135826119eb8a868a6126b6565b0135611a249187604060ff91600193600091825260086020528282209082526020528181208560081c82526020522092161b8154179055565b87898b611a3283878b6126b6565b0135948784526007825284842092611a4a918a6126b6565b0135825289522090815490611a5e916123a4565b905586611a6c868c866126b6565b0135611a779161274a565b9d8d8286898d8a611a8984838b6126b6565b013592611a9691896126b6565b013591611aa293612757565b898787611ab08884886126b6565b013594878b611ac08286856126b6565b013593611acc926126b6565b8a519283520135602082015273ffffffffffffffffffffffffffffffffffffffff9190911660408201527f9a5376f7dcf8631c2b6249c9bec3d715cb97bdd4c82d92e55d147f6b4eea419790606090a460010161184c565b8784517f09bde339000000000000000000000000000000000000000000000000000000008152fd5b8885517f646cf558000000000000000000000000000000000000000000000000000000008152fd5b8885517fbc68df3f000000000000000000000000000000000000000000000000000000008152fd5b8784517f27140a4b000000000000000000000000000000000000000000000000000000008152fd5b8490517fb68370bb000000000000000000000000000000000000000000000000000000008152fd5b8490517f9fabe1c1000000000000000000000000000000000000000000000000000000008152fd5b8580fd5b50913461049a57611c2836612189565b9193611c32612278565b62093a80809504858102958187041490151715611d9e578381526020966003885273ffffffffffffffffffffffffffffffffffffffff80888420541615610b0e578615610ae7578583526006895287832087845289528783205415611d76578415610a6f57908291868a9594526006855288832088845285528589842055868352600785528883208884528552888320611ccd85825461274a565b9055600954169081151580611d6d575b611d1457505050507f1d3b13bb6ce947c806a76a3476eafd33ec751e6ed2cbbdf7ab8503a4fb76a1ee918551908152a35160018152f35b9080929394503b1561018d578291868389936109c38c51988996879586947f68f6df5200000000000000000000000000000000000000000000000000000000865285016040919493926060820195825260208201520152565b50831515611cdd565b5086517f226e5a6a000000000000000000000000000000000000000000000000000000008152fd5b806011887f4e487b71000000000000000000000000000000000000000000000000000000006024945252fd5b5050346102ef57817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102ef576020905173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000aa1698f0a51e6d00f5533cc3e5d36010ee4558c6168152f35b50903461018d5760c07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018d578135602435916044356064359473ffffffffffffffffffffffffffffffffffffffff928387169687810361212c576084359460a43567ffffffffffffffff811161212857611ebb9036908601612158565b611ec6959195612604565b8a1561210057888c52602095600687528c8b87822091528752858d2054156120d85760008a81526008602081815260408084208f85528252808420928c901c8452919052902054600160ff8a161b166120b057611fa191610f988b928f89908f868f8f8f610f1b8f938694611f85948a51968795860198899390927fffffffffffffffffffffffffffffffffffffffff000000000000000000000000926094969486526020860152604085015260601b16606083015260748201520190565b51902096825260068d528282209082528c52205492369161234d565b1561208957509161204b8689897f9a5376f7dcf8631c2b6249c9bec3d715cb97bdd4c82d92e55d147f6b4eea419799989795858f61207e9984825260038a5282822054169861201e8c8787604060ff91600193600091825260086020528282209082526020528181208560081c82526020522092161b8154179055565b848252600781528282209086835252206120398582546123a4565b90556120468482896123e0565b612757565b519384938491604091949373ffffffffffffffffffffffffffffffffffffffff9160608501968552602085015216910152565b0390a4600160025580f35b83517f09bde339000000000000000000000000000000000000000000000000000000008152fd5b8286517f646cf558000000000000000000000000000000000000000000000000000000008152fd5b8286517fbc68df3f000000000000000000000000000000000000000000000000000000008152fd5b5083517f9fabe1c1000000000000000000000000000000000000000000000000000000008152fd5b8a80fd5b8880fd5b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361215357565b600080fd5b9181601f840112156121535782359167ffffffffffffffff8311612153576020808501948460051b01011161215357565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc60809101126121535760043590602435906044359060643590565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc6040910112612153576004359060243590565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc606091011261215357600435906024359060443590565b80548210156122495760005260206000200190600090565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff60005416330361229957565b60246040517f118cdaa7000000000000000000000000000000000000000000000000000000008152336004820152fd5b67ffffffffffffffff81116122dd57604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176122dd57604052565b90929167ffffffffffffffff84116122dd578360051b60405192602080946123778285018261230c565b809781520191810192831161215357905b8282106123955750505050565b81358152908301908301612388565b919082039182116123b157565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b9190916040519260208401927fa9059cbb00000000000000000000000000000000000000000000000000000000845273ffffffffffffffffffffffffffffffffffffffff8092166024860152604485015260448452608084019167ffffffffffffffff92858110848211176122dd576040521692600080938192519082875af13d15612557573d91821161252a57906124b991604051916124a960207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116018461230c565b82523d84602084013e5b84612564565b908151918215159283612502575b5050506124d15750565b602490604051907f5274afe70000000000000000000000000000000000000000000000000000000082526004820152fd5b8192935090602091810103126102ef57602001519081159182150361049a57503880806124c7565b6024837f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b6124b991506060906124b3565b906125a3575080511561257957805190602001fd5b60046040517f1425ea42000000000000000000000000000000000000000000000000000000008152fd5b815115806125fb575b6125b4575090565b60249073ffffffffffffffffffffffffffffffffffffffff604051917f9996b315000000000000000000000000000000000000000000000000000000008352166004820152fd5b50803b156125ac565b60028054146126135760028055565b60046040517f3ee5aeb5000000000000000000000000000000000000000000000000000000008152fd5b90926000925b82518410156126ad576020808560051b850101519160008382106000146126a057506000525260406000205b927fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146123b15760010192612643565b916040938352522061266f565b91509291501490565b91908110156122495760051b810135907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6181360301821215612153570190565b9035907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe181360301821215612153570180359067ffffffffffffffff821161215357602001918160051b3603831361215357565b919082018092116123b157565b909273ffffffffffffffffffffffffffffffffffffffff9182600954169384612783575b505050505050565b843b1561215357600094608493869260405198899788967f39f474de0000000000000000000000000000000000000000000000000000000088521660048701526024860152604485015260648401525af180156127f8576127e9575b808080808061277b565b6127f2906122c9565b386127df565b6040513d6000823e3d90fdfea26469706673582212208537fe2f84ba411b64189e77ce46c9f1137a8445793b3443ef6f573819a478e464736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000aa1698f0a51e6d00f5533cc3e5d36010ee4558c6
-----Decoded View---------------
Arg [0] : _questBoard (address): 0xAa1698f0A51e6d00F5533cc3E5D36010ee4558C6
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000aa1698f0a51e6d00f5533cc3e5d36010ee4558c6
Loading...
Loading
Loading...
Loading
Net Worth in USD
$58,136.77
Net Worth in ETH
19.97228
Token Allocations
T
66.85%
WETH
20.46%
ALCX
10.96%
Others
1.73%
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|---|---|---|---|---|
| ETH | 66.85% | $0.009056 | 4,291,494.0522 | $38,864.2 | |
| ETH | 20.46% | $2,910.87 | 4.087 | $11,896.62 | |
| ETH | 10.96% | $6.7 | 950.9698 | $6,371.5 | |
| ETH | 1.01% | $87,928 | 0.00668826 | $588.09 | |
| ETH | 0.31% | $0.034948 | 5,108.0822 | $178.52 | |
| ETH | 0.27% | $0.999611 | 154.8918 | $154.83 | |
| ETH | 0.06% | $0.99947 | 34.3708 | $34.35 | |
| ETH | 0.04% | $3,061.92 | 0.0083115 | $25.45 | |
| ETH | 0.02% | $0.342079 | 33.9774 | $11.62 | |
| ETH | 0.02% | $2.05 | 5.2469 | $10.78 | |
| ETH | <0.01% | $0.799289 | 1.0155 | $0.8116 |
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.