Source Code
Latest 1 internal transaction
Advanced mode:
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 25614928 | 151 days ago | 0.0035 ETH |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
Stake
Compiler Version
v0.8.30+commit.73712a01
Optimization Enabled:
Yes with 50000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1
/**
* @title Stake Contract
* @notice Mint Club V2 - Staking Contract
* @dev Allows users to create staking pools for any ERC20 tokens with timestamp-based reward distribution
*
* NOTICES:
* 1. We use timestamp-based reward calculation,
* so it inherently carries minimal risk of timestamp manipulation (±15 seconds).
* We chose this design because this contract may be deployed on various networks with differing block times,
* and block times may change in the future even on the same network.
* 2. We use uint40 for timestamp storage, which supports up to year 36,812.
* 3. Precision Loss: Due to integer division in reward calculations, small amounts
* of reward tokens may be lost as "dust" and remain in the contract permanently.
* This is most pronounced with small reward amounts relative to large staking amounts.
*/
pragma solidity =0.8.30;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC1155} from "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import {MCV2_ICommonToken} from "./interfaces/MCV2_ICommonToken.sol";
contract Stake is Ownable, ReentrancyGuard {
using SafeERC20 for IERC20;
// MARK: - Constants & Errors
uint256 private constant MAX_CLAIM_FEE = 2000; // 20% - for safety when admin privileges are abused
uint256 private constant REWARD_PRECISION = 1e30;
uint256 private constant MAX_STAKING_TOKEN_SUPPLY = 1e32; // Supports 100T token supply, prevents precision loss/overflow
uint256 private constant MIN_REWARD_DECIMALS = 4; // Minimum decimals to prevent precision loss
uint256 public constant MIN_REWARD_DURATION = 3600; // 1 hour in seconds
uint256 public constant MAX_REWARD_DURATION =
MIN_REWARD_DURATION * 24 * 365 * 10; // 10 years
// Gas stipend for external view calls to prevent DoS attacks on view functions
// 20000 gas handles very long token names/symbols (~256 chars) while preventing DoS
uint256 private constant METADATA_GAS_STIPEND = 20000;
uint256 private constant MAX_ITEMS_PER_PAGE = 500;
// MARK: - Error messages
error Stake__InvalidToken();
error Stake__TokenHasTransferFeesOrRebasing();
error Stake__InvalidCreationFee();
error Stake__FeeTransferFailed();
error Stake__InvalidDuration();
error Stake__PoolNotFound();
error Stake__PoolCancelled();
error Stake__PoolFinished();
error Stake__InsufficientBalance();
error Stake__InvalidPaginationParameters();
error Stake__Unauthorized();
error Stake__InvalidAddress();
error Stake__ZeroAmount();
error Stake__InvalidClaimFee();
error Stake__StakeAmountTooLarge();
error Stake__InvalidTokenId();
error Stake__RewardRateTooLow();
error Stake__InvalidRewardStartsAt();
error Stake__InvalidTokenType();
error Stake__StakingTokenTokenTooBig();
error Stake__RewardTokenTokenTooSmall();
// MARK: - Structs
// Gas optimized struct packing - fits in 7 storage slots
struct Pool {
address stakingToken; // 160 bits - slot 0 - immutable
bool isStakingTokenERC20; // 8 bit - slot 0 - immutable
address rewardToken; // 160 bits - slot 1 - immutable
address creator; // 160 bits - slot 2 - immutable
uint104 rewardAmount; // 104 bits - slot 3 - immutable
uint32 rewardDuration; // 32 bits - slot 3 (up to ~136 years in seconds) - immutable
uint40 rewardStartsAt; // 40 bits - slot 3 - immutable (0 for immediate start on the first stake, future time up to 1 week from now to allow pre-staking)
uint40 rewardStartedAt; // 40 bits - slot 3 (until year 36,812) - 0 until first stake
uint40 cancelledAt; // 40 bits - slot 3 - default 0 (not cancelled)
uint128 totalStaked; // 128 bits - slot 4
uint32 activeStakerCount; // 32 bits - slot 4 - number of unique active stakers
uint40 lastRewardUpdatedAt; // 40 bits - slot 4
uint256 accRewardPerShare; // 256 bits - slot 5
uint104 totalAllocatedRewards; // 104 bits - slot 6 - Track rewards allocated to users (earned but maybe not claimed)
}
// Gas optimized struct packing - fits in 3 storage slots
struct UserStake {
uint104 stakedAmount; // 104 bits - slot 0
uint104 claimedTotal; // 104 bits - slot 0 - informational
uint104 feeTotal; // 104 bits - slot 1 - informational
uint256 rewardDebt; // 256 bits - slot 2 - uses full slot for overflow safety
}
// MARK: - Protocol Config Variables
address public protocolBeneficiary;
uint256 public creationFee;
uint256 public claimFee; // BP: 10000 = 100%
// MARK: - Pool State Variables
uint256 public poolCount;
// poolId => Pool
mapping(uint256 => Pool) public pools;
// user => poolId => UserStake
mapping(address => mapping(uint256 => UserStake)) public userPoolStake;
// MARK: - Events
event PoolCreated(
uint256 poolId,
address indexed creator,
address indexed stakingToken,
bool isStakingTokenERC20,
address indexed rewardToken,
uint104 rewardAmount,
uint40 rewardStartsAt,
uint32 rewardDuration
);
event Staked(
uint256 indexed poolId,
address indexed staker,
uint104 indexed amount
);
event Unstaked(
uint256 indexed poolId,
address indexed staker,
uint104 indexed amount,
bool rewardClaimed
);
event RewardClaimed(
uint256 indexed poolId,
address indexed staker,
uint104 indexed reward,
uint104 fee
);
event PoolCancelled(
uint256 indexed poolId,
uint256 indexed leftoverRewards
);
event ProtocolBeneficiaryUpdated(
address oldBeneficiary,
address newBeneficiary
);
event CreationFeeUpdated(uint256 oldFee, uint256 newFee);
event ClaimFeeUpdated(uint256 oldFee, uint256 newFee);
constructor(
address protocolBeneficiary_,
uint256 creationFee_,
uint256 claimFee_
) Ownable(msg.sender) {
updateProtocolBeneficiary(protocolBeneficiary_);
updateCreationFee(creationFee_);
updateClaimFee(claimFee_);
}
// MARK: - Modifiers
modifier _checkPoolExists(uint256 poolId) {
if (poolId >= poolCount) revert Stake__PoolNotFound();
_;
}
// MARK: - Internal Helper Functions
/**
* @dev Calculates up-to-date accRewardPerShare for a pool without modifying state
* @param pool The pool struct
* @return updatedAccRewardPerShare The up-to-date accumulated reward per share
* @notice Integer division may cause precision loss in reward calculations
*/
function _getUpdatedAccRewardPerShare(
Pool memory pool
) internal view returns (uint256 updatedAccRewardPerShare) {
uint40 currentTime = uint40(block.timestamp);
// If rewards haven't started yet or no staked, no rewards to distribute
if (
pool.rewardStartedAt == 0 ||
pool.totalStaked == 0 ||
currentTime <= pool.lastRewardUpdatedAt
) return pool.accRewardPerShare;
uint256 endTime = pool.rewardStartedAt + pool.rewardDuration;
// If pool is cancelled, use cancellation time as end time
if (pool.cancelledAt > 0 && pool.cancelledAt < endTime)
endTime = pool.cancelledAt;
uint256 toTime = currentTime > endTime ? endTime : currentTime;
uint256 timePassed = toTime - pool.lastRewardUpdatedAt;
if (timePassed == 0) return pool.accRewardPerShare;
uint256 totalReward = Math.mulDiv(
timePassed,
pool.rewardAmount,
pool.rewardDuration
);
return
pool.accRewardPerShare +
Math.mulDiv(totalReward, REWARD_PRECISION, pool.totalStaked);
}
/**
* @dev Calculates claimable rewards (assumes pool is updated)
* @param updatedAccRewardPerShare The accumulated reward per share
* @param stakedAmount The amount of tokens staked
* @param originalRewardDebt The baseline reward amount to subtract, accounting for staking timing and already claimed rewards
* @return rewardClaimable The amount of rewards that can be claimed
* @notice Due to integer division, small amounts of rewards may be lost as "dust"
* This precision loss is most significant with small reward amounts relative to large total staked amounts
*/
function _claimableReward(
uint256 updatedAccRewardPerShare,
uint256 stakedAmount,
uint256 originalRewardDebt
) internal view returns (uint256 rewardClaimable, uint256 fee) {
if (stakedAmount == 0) return (0, 0);
uint256 accRewardAmount = Math.mulDiv(
stakedAmount,
updatedAccRewardPerShare,
REWARD_PRECISION
);
if (accRewardAmount <= originalRewardDebt) return (0, 0);
rewardClaimable = accRewardAmount - originalRewardDebt;
fee = Math.mulDiv(rewardClaimable, claimFee, 10000);
rewardClaimable -= fee;
}
/**
* @dev Internal function to claim rewards for a user
* @param poolId The ID of the pool
* @param user The address of the user
*/
function _claimRewards(uint256 poolId, address user) internal {
Pool storage pool = pools[poolId];
UserStake storage userStake = userPoolStake[user][poolId];
// Use the helper function to calculate claimable rewards
(uint256 claimAmount, uint256 fee) = _claimableReward(
pool.accRewardPerShare,
userStake.stakedAmount,
userStake.rewardDebt
);
uint256 rewardAndFee = claimAmount + fee;
assert(rewardAndFee <= pool.rewardAmount);
if (rewardAndFee == 0) return;
// Update user's reward debt and claimed rewards
userStake.rewardDebt += rewardAndFee;
// Safe to cast because claimAmount + fee <= pool.rewardAmount (uint104)
userStake.claimedTotal += uint104(claimAmount);
userStake.feeTotal += uint104(fee);
// Transfer reward tokens to user (reward tokens are always ERC20)
if (claimAmount > 0) {
IERC20(pool.rewardToken).safeTransfer(user, claimAmount);
}
if (fee > 0) {
IERC20(pool.rewardToken).safeTransfer(protocolBeneficiary, fee);
}
emit RewardClaimed(poolId, user, uint104(claimAmount), uint104(fee));
}
/**
* @dev Safely transfers tokens from one address to another with balance verification
* @param token The address of the token to transfer
* @param isERC20 Whether the token is ERC20 (true) or ERC1155 (false)
* @param from The address to transfer from
* @param to The address to transfer to
* @param amount The amount to transfer
*/
function _safeTransferFrom(
address token,
bool isERC20,
address from,
address to,
uint256 amount
) internal {
if (isERC20) {
uint256 balanceBefore = IERC20(token).balanceOf(to);
IERC20(token).safeTransferFrom(from, to, amount);
uint256 balanceAfter = IERC20(token).balanceOf(to);
if (balanceAfter - balanceBefore != amount) {
revert Stake__TokenHasTransferFeesOrRebasing();
}
} else {
// For ERC1155, we use token ID 0 only
uint256 balanceBefore = IERC1155(token).balanceOf(to, 0);
IERC1155(token).safeTransferFrom(from, to, 0, amount, "");
uint256 balanceAfter = IERC1155(token).balanceOf(to, 0);
if (balanceAfter - balanceBefore != amount) {
revert Stake__TokenHasTransferFeesOrRebasing();
}
}
}
/**
* @dev Updates the reward variables for a pool based on timestamp
* @param poolId The ID of the pool to update
*/
function _updatePool(uint256 poolId) internal {
Pool storage pool = pools[poolId];
uint40 currentTime = uint40(block.timestamp);
// Cache frequently accessed storage values
uint40 rewardStartedAt = pool.rewardStartedAt;
uint40 lastRewardUpdatedAt = pool.lastRewardUpdatedAt;
// If rewards haven't started yet or no time passed, no need to update
if (rewardStartedAt == 0 || currentTime <= lastRewardUpdatedAt) return;
// Cache more values for efficiency
uint32 rewardDuration = pool.rewardDuration;
uint40 cancelledAt = pool.cancelledAt;
uint256 endTime = rewardStartedAt + rewardDuration;
// If pool is cancelled, use cancellation time as end time
if (cancelledAt > 0 && cancelledAt < endTime) {
endTime = cancelledAt;
}
uint256 toTime = currentTime > endTime ? endTime : currentTime;
uint256 timePassed = toTime - lastRewardUpdatedAt;
// Track allocated rewards if there are stakers and time has passed
if (pool.totalStaked > 0 && timePassed > 0) {
uint256 totalReward = Math.mulDiv(
timePassed,
pool.rewardAmount,
pool.rewardDuration
);
// Track these rewards as allocated to users (earned, whether claimed or not)
pool.totalAllocatedRewards += uint104(totalReward);
}
// Update accRewardPerShare
pool.accRewardPerShare = _getUpdatedAccRewardPerShare(pool);
pool.lastRewardUpdatedAt = uint40(toTime);
}
/**
* @dev Checks if the token is a valid ERC20 or ERC1155 token
* @param token The address of the token to check
* @param isERC20 Whether the token is ERC20 (true) or ERC1155 (false)
* @return isValid True if the token is valid, false otherwise
*/
function _isTokenTypeValid(
address token,
bool isERC20
) internal view returns (bool) {
if (isERC20) {
// 1) IERC1155 interface claiming contract is rejected
(bool ok165, bytes memory ret165) = token.staticcall{
gas: METADATA_GAS_STIPEND
}(
abi.encodeWithSignature(
"supportsInterface(bytes4)",
bytes4(0xd9b67a26) // ERC1155 interface id
)
);
if (ok165 && ret165.length == 32 && abi.decode(ret165, (bool))) {
return false;
}
// 2) ERC20 balanceOf(address) exists and returns 32 bytes
(bool ok20, bytes memory ret20) = token.staticcall{
gas: METADATA_GAS_STIPEND
}(abi.encodeWithSignature("balanceOf(address)", address(this)));
if (!ok20 || ret20.length != 32) {
return false;
}
} else {
// Check if the token is an ERC1155 (balanceOf(address,uint256))
(bool ok1155, bytes memory ret1155) = token.staticcall{
gas: METADATA_GAS_STIPEND
}(
abi.encodeWithSignature(
"balanceOf(address,uint256)",
address(this),
uint256(0)
)
);
if (!ok1155 || ret1155.length != 32) {
return false;
}
}
return true;
}
// MARK: - Pool Management
/**
* @dev Creates a new staking pool with timestamp-based rewards
* @param stakingToken The address of the token to be staked
* @param rewardToken The address of the reward token
* @param rewardAmount The total amount of rewards to be distributed
* @param rewardStartsAt The timestamp when rewards should start (max 1 week from now)
* @param rewardDuration The duration in seconds over which rewards are distributed
* @return poolId The ID of the newly created pool
*/
function createPool(
address stakingToken,
bool isStakingTokenERC20,
address rewardToken,
uint104 rewardAmount,
uint40 rewardStartsAt,
uint32 rewardDuration
) external payable nonReentrant returns (uint256 poolId) {
if (stakingToken == address(0)) revert Stake__InvalidToken();
if (rewardToken == address(0)) revert Stake__InvalidToken();
if (rewardAmount == 0) revert Stake__ZeroAmount();
if (
rewardDuration < MIN_REWARD_DURATION ||
rewardDuration > MAX_REWARD_DURATION
) revert Stake__InvalidDuration();
// Validate that reward rate is meaningful to prevent precision loss
if (rewardAmount / rewardDuration == 0)
revert Stake__RewardRateTooLow();
if (rewardStartsAt > block.timestamp + 7 days)
revert Stake__InvalidRewardStartsAt();
if (msg.value != creationFee) revert Stake__InvalidCreationFee();
if (creationFee > 0) {
(bool success, ) = protocolBeneficiary.call{value: creationFee}("");
if (!success) revert Stake__FeeTransferFailed();
}
if (!_isTokenTypeValid(stakingToken, isStakingTokenERC20))
revert Stake__InvalidTokenType();
if (isStakingTokenERC20) {
IERC20 sToken = IERC20(stakingToken);
if (sToken.totalSupply() > MAX_STAKING_TOKEN_SUPPLY)
revert Stake__StakingTokenTokenTooBig();
}
MCV2_ICommonToken rToken = MCV2_ICommonToken(rewardToken);
if (rToken.decimals() < MIN_REWARD_DECIMALS)
revert Stake__RewardTokenTokenTooSmall();
poolId = poolCount;
poolCount = poolId + 1;
pools[poolId] = Pool({
stakingToken: stakingToken,
isStakingTokenERC20: isStakingTokenERC20,
rewardToken: rewardToken,
creator: msg.sender,
rewardAmount: rewardAmount,
rewardDuration: rewardDuration,
rewardStartsAt: rewardStartsAt,
rewardStartedAt: 0,
cancelledAt: 0,
totalStaked: 0,
activeStakerCount: 0,
lastRewardUpdatedAt: 0,
accRewardPerShare: 0,
totalAllocatedRewards: 0
});
// Transfer reward tokens from creator to contract (always ERC20)
_safeTransferFrom(
rewardToken,
true,
msg.sender,
address(this),
rewardAmount
);
emit PoolCreated(
poolId,
msg.sender,
stakingToken,
isStakingTokenERC20,
rewardToken,
rewardAmount,
rewardStartsAt,
rewardDuration
);
}
/**
* @dev Cancels a pool (only pool creator can call)
* @param poolId The ID of the pool to cancel
* @notice INTENTIONAL DESIGN: Pool creators can cancel their pools at any time, even during active staking periods.
* This may impact stakers who committed tokens expecting ongoing reward distribution for the full duration.
* Stakers risk losing expected future rewards when creators exercise this cancellation right.
* This design prioritizes creator flexibility over staker reward guarantees.
*/
function cancelPool(
uint256 poolId
) external nonReentrant _checkPoolExists(poolId) {
Pool storage pool = pools[poolId];
if (msg.sender != pool.creator) revert Stake__Unauthorized();
if (pool.cancelledAt > 0) revert Stake__PoolCancelled(); // Already cancelled
// Update pool rewards up to cancellation time
_updatePool(poolId);
uint40 currentTime = uint40(block.timestamp);
// Calculate leftover rewards to return to creator
// Only return rewards that haven't been allocated to users yet
// This prevents precision loss from permanently locking tokens and ensures
// that users can still claim rewards they've earned even after cancellation
uint256 leftoverRewards = pool.rewardAmount -
pool.totalAllocatedRewards;
// Set cancellation time
pool.cancelledAt = currentTime;
// Return leftover rewards to creator if any
if (leftoverRewards > 0) {
// Conditions that should never happen
assert(leftoverRewards <= pool.rewardAmount);
assert(
leftoverRewards <=
IERC20(pool.rewardToken).balanceOf(address(this))
);
// Reward tokens are always ERC20
IERC20(pool.rewardToken).safeTransfer(
pool.creator,
leftoverRewards
);
}
emit PoolCancelled(poolId, leftoverRewards);
}
// MARK: - Stake Operations
/**
* @dev Stakes tokens into a pool to earn rewards
* @param poolId The ID of the pool to stake in
* @param amount The amount of tokens to stake
*/
function stake(
uint256 poolId,
uint104 amount
) external nonReentrant _checkPoolExists(poolId) {
if (amount == 0) revert Stake__ZeroAmount();
Pool storage pool = pools[poolId];
if (pool.cancelledAt > 0) revert Stake__PoolCancelled();
// Cache frequently accessed storage values for gas efficiency
uint40 rewardStartedAt = pool.rewardStartedAt;
// Users can stake anytime now (pre-staking allowed), but check if rewards period has ended
if (
rewardStartedAt > 0 &&
block.timestamp >= rewardStartedAt + pool.rewardDuration
) {
revert Stake__PoolFinished();
}
UserStake storage userStake = userPoolStake[msg.sender][poolId];
// safely checks for overflow and reverts with the custom error
if (
type(uint104).max - amount < userStake.stakedAmount ||
type(uint128).max - amount < pool.totalStaked
) revert Stake__StakeAmountTooLarge();
// If this is the first stake in the pool, initialize the reward clock
if (rewardStartedAt == 0) {
uint40 currentTime = uint40(block.timestamp);
uint40 rewardStartsAt = pool.rewardStartsAt;
if (currentTime >= rewardStartsAt) {
// Start rewards immediately if we're past the scheduled start time
pool.rewardStartedAt = currentTime;
pool.lastRewardUpdatedAt = currentTime;
} else {
// Schedule rewards to start at rewardStartsAt (allow pre-staking)
pool.rewardStartedAt = rewardStartsAt;
pool.lastRewardUpdatedAt = rewardStartsAt;
}
}
_updatePool(poolId);
// If user has existing stake, claim pending rewards first to preserve them
if (userStake.stakedAmount > 0) {
_claimRewards(poolId, msg.sender);
} else {
// First time staking in this pool
pool.activeStakerCount++;
}
// Update user's staked amount
userStake.stakedAmount += amount;
userStake.rewardDebt = Math.mulDiv(
userStake.stakedAmount,
pool.accRewardPerShare,
REWARD_PRECISION
);
// Update pool's total staked amount
pool.totalStaked += amount;
// Transfer tokens from user to contract with balance check to prevent transfer fees/rebasing tokens
_safeTransferFrom(
pool.stakingToken,
pool.isStakingTokenERC20,
msg.sender,
address(this),
amount
);
emit Staked(poolId, msg.sender, amount);
}
/**
* @dev Unstakes tokens from a pool
* @param poolId The ID of the pool to unstake from
* @param amount The amount of tokens to unstake
*/
function unstake(
uint256 poolId,
uint104 amount
) external nonReentrant _checkPoolExists(poolId) {
_unstake(poolId, amount, true);
}
/**
* @dev Emergency unstake function that allows users to withdraw ALL their staking tokens
* without claiming rewards. Use this if reward claims are failing due to malicious reward tokens.
* WARNING: Any accumulated rewards will be forfeited and permanently locked in the contract.
* @param poolId The ID of the pool to unstake from
*/
function emergencyUnstake(
uint256 poolId
) external nonReentrant _checkPoolExists(poolId) {
// Unstake the total staked amount
_unstake(poolId, userPoolStake[msg.sender][poolId].stakedAmount, false);
}
/**
* @dev Internal function to handle unstaking logic
* @param poolId The ID of the pool to unstake from
* @param amount The amount of tokens to unstake
* @param shouldClaimRewards Whether to claim rewards before unstaking
*/
function _unstake(
uint256 poolId,
uint104 amount,
bool shouldClaimRewards
) internal {
if (amount == 0) revert Stake__ZeroAmount();
Pool storage pool = pools[poolId];
UserStake storage userStake = userPoolStake[msg.sender][poolId];
if (userStake.stakedAmount < amount)
revert Stake__InsufficientBalance();
_updatePool(poolId);
// Regular unstake: claim rewards
if (shouldClaimRewards) {
_claimRewards(poolId, msg.sender); // Transfers rewards and updates rewardDebt
}
// Emergency unstake: skip reward claiming (rewards are forfeited)
// Update user and pool's staked amount
unchecked {
userStake.stakedAmount -= amount; // Safe: checked above
pool.totalStaked -= amount; // Safe: total always >= user amount
}
// Reset rewardDebt for both regular and emergency unstake
userStake.rewardDebt = Math.mulDiv(
userStake.stakedAmount,
pool.accRewardPerShare,
REWARD_PRECISION
);
// If user completely unstaked, decrement active staker count
if (userStake.stakedAmount == 0) {
pool.activeStakerCount--;
}
// If everyone has unstaked before rewards actually started, reset the reward clock
// This prevents "wasted" rewards during periods when no one is staked
if (
pool.totalStaked == 0 &&
pool.rewardStartedAt > 0 &&
block.timestamp < pool.rewardStartedAt
) {
pool.rewardStartedAt = 0;
pool.lastRewardUpdatedAt = 0;
}
// Transfer tokens back to user
if (pool.isStakingTokenERC20) {
IERC20(pool.stakingToken).safeTransfer(msg.sender, amount);
} else {
// For ERC1155, we use token ID 0 only
IERC1155(pool.stakingToken).safeTransferFrom(
address(this),
msg.sender,
0,
amount,
""
);
}
emit Unstaked(poolId, msg.sender, amount, shouldClaimRewards);
}
/**
* @dev Claims rewards from a pool
* @param poolId The ID of the pool to claim rewards from
*/
function claim(
uint256 poolId
) external nonReentrant _checkPoolExists(poolId) {
_updatePool(poolId);
_claimRewards(poolId, msg.sender);
}
// MARK: - Admin Functions
function updateProtocolBeneficiary(
address protocolBeneficiary_
) public onlyOwner {
if (protocolBeneficiary_ == address(0)) revert Stake__InvalidAddress();
address oldBeneficiary = protocolBeneficiary;
protocolBeneficiary = protocolBeneficiary_;
emit ProtocolBeneficiaryUpdated(oldBeneficiary, protocolBeneficiary_);
}
function updateCreationFee(uint256 creationFee_) public onlyOwner {
uint256 oldFee = creationFee;
creationFee = creationFee_;
emit CreationFeeUpdated(oldFee, creationFee_);
}
function updateClaimFee(uint256 claimFee_) public onlyOwner {
if (claimFee_ > MAX_CLAIM_FEE) revert Stake__InvalidClaimFee();
uint256 oldFee = claimFee;
claimFee = claimFee_;
emit ClaimFeeUpdated(oldFee, claimFee_);
}
// MARK: - View Functions
/**
* @dev Returns claimable reward for a user in a specific pool
* @param poolId The ID of the pool
* @param staker The address of the staker
* @return rewardClaimable The amount of rewards that can be claimed
* @return fee The fee for claiming rewards
* @return claimedTotal The total amount of rewards already claimed
* @return feeTotal The total amount of fees already claimed
*/
function claimableReward(
uint256 poolId,
address staker
)
external
view
_checkPoolExists(poolId)
returns (
uint256 rewardClaimable,
uint256 fee,
uint256 claimedTotal,
uint256 feeTotal
)
{
Pool memory pool = pools[poolId];
UserStake memory userStake = userPoolStake[staker][poolId];
(rewardClaimable, fee) = _claimableReward(
_getUpdatedAccRewardPerShare(pool),
userStake.stakedAmount,
userStake.rewardDebt
);
claimedTotal = userStake.claimedTotal;
feeTotal = userStake.feeTotal;
}
/**
* @dev Returns claimable rewards for multiple pools that user have engaged (staked > 0 or claimable > 0 or claimed > 0)
* @param poolIdFrom The starting pool ID
* @param poolIdTo The ending pool ID (exclusive)
* @param staker The address of the staker
* @return results Array of [poolId, rewardClaimable, fee, claimedTotal, feeTotal] for pools with rewards only
*/
function claimableRewardBulk(
uint256 poolIdFrom,
uint256 poolIdTo,
address staker
) external view returns (uint256[5][] memory results) {
if (poolIdFrom >= poolIdTo || poolIdTo - poolIdFrom > 1000) {
revert Stake__InvalidPaginationParameters();
}
unchecked {
// Limit search to actual pool count
uint256 searchTo = poolIdTo > poolCount ? poolCount : poolIdTo;
if (poolIdFrom >= searchTo) {
return new uint256[5][](0);
}
// Single pass: collect results in temporary array, then resize
uint256 maxLength = searchTo - poolIdFrom;
uint256[5][] memory tempResults = new uint256[5][](maxLength);
uint256 validCount = 0;
for (uint256 i = poolIdFrom; i < searchTo; ++i) {
UserStake memory userStake = userPoolStake[staker][i];
// Skip if user has not engaged with the pool
if (userStake.stakedAmount == 0 && userStake.claimedTotal == 0)
continue;
// If the user currently has no staked amount, all rewards are claimed because unstaking claims all pending rewards
// We can simply return the claimed total and fee total
if (userStake.stakedAmount == 0) {
tempResults[validCount] = [
i,
0,
0,
userStake.claimedTotal,
userStake.feeTotal
];
++validCount;
continue;
}
// Now, staked > 0, so we need to calculate the claimable reward
(uint256 claimable, uint256 fee) = _claimableReward(
_getUpdatedAccRewardPerShare(pools[i]),
userStake.stakedAmount,
userStake.rewardDebt
);
tempResults[validCount] = [
i,
claimable,
fee,
userStake.claimedTotal,
userStake.feeTotal
];
++validCount;
}
// Create final array with exact size and copy results
results = new uint256[5][](validCount);
for (uint256 i = 0; i < validCount; ++i) {
results[i] = tempResults[i];
}
}
}
// Struct and view helper functions for getPool and getPools
struct TokenInfo {
string symbol;
string name;
uint8 decimals;
}
struct PoolView {
uint256 poolId;
Pool pool;
TokenInfo stakingToken;
TokenInfo rewardToken;
}
/**
* @dev Safely fetch token metadata with gas limits to prevent DoS
* @param tokenAddress The token contract address
* @return TokenInfo struct with token metadata
*/
function _getTokenInfo(
address tokenAddress
) internal view returns (TokenInfo memory) {
string memory symbol = "undefined";
string memory name = "undefined";
uint8 decimals = 0;
// Get symbol with gas limit
(bool successSymbol, bytes memory dataSymbol) = tokenAddress.staticcall{
gas: METADATA_GAS_STIPEND
}(abi.encodeWithSignature("symbol()"));
if (successSymbol && dataSymbol.length >= 64) {
symbol = abi.decode(dataSymbol, (string));
}
// Get name with gas limit
(bool successName, bytes memory dataName) = tokenAddress.staticcall{
gas: METADATA_GAS_STIPEND
}(abi.encodeWithSignature("name()"));
if (successName && dataName.length >= 64) {
name = abi.decode(dataName, (string));
}
// Get decimals with gas limit
(bool successDecimals, bytes memory dataDecimals) = tokenAddress
.staticcall{gas: METADATA_GAS_STIPEND}(
abi.encodeWithSignature("decimals()")
);
if (successDecimals && dataDecimals.length == 32) {
decimals = abi.decode(dataDecimals, (uint8));
}
return TokenInfo({symbol: symbol, name: name, decimals: decimals});
}
/**
* @dev Returns pool information for a single pool
* @param poolId The ID of the pool
* @return poolView The pool information
*/
function getPool(
uint256 poolId
) external view _checkPoolExists(poolId) returns (PoolView memory) {
Pool memory pool = pools[poolId];
TokenInfo memory stakingTokenInfo = _getTokenInfo(pool.stakingToken);
TokenInfo memory rewardTokenInfo = _getTokenInfo(pool.rewardToken);
return PoolView(poolId, pool, stakingTokenInfo, rewardTokenInfo);
}
/**
* @dev Returns pool information for a range of pools
* @param poolIdFrom The starting pool ID
* @param poolIdTo The ending pool ID (exclusive)
* @return poolList Array of Pool structs
*/
function getPools(
uint256 poolIdFrom,
uint256 poolIdTo
) external view returns (PoolView[] memory poolList) {
if (
poolIdFrom >= poolIdTo || poolIdTo - poolIdFrom > MAX_ITEMS_PER_PAGE
) {
revert Stake__InvalidPaginationParameters();
}
uint256 end = poolIdTo > poolCount ? poolCount : poolIdTo;
if (poolIdFrom >= end) {
return new PoolView[](0);
}
uint256 length = end - poolIdFrom;
poolList = new PoolView[](length);
for (uint256 i = 0; i < length; ++i) {
uint256 poolId = poolIdFrom + i;
Pool memory pool = pools[poolId];
poolList[i] = PoolView({
poolId: poolId,
pool: pool,
stakingToken: _getTokenInfo(pool.stakingToken),
rewardToken: _getTokenInfo(pool.rewardToken)
});
}
}
/**
* @dev Returns pool information for pools created by a specific creator within a range
* @param poolIdFrom The starting pool ID (inclusive)
* @param poolIdTo The ending pool ID (exclusive)
* @param creator The address of the pool creator to filter by
* @return poolList Array of PoolView structs for pools created by the specified creator
* @notice This function filters pools by creator and returns only matching pools
* The returned array size will match the number of pools found, not the input range
*/
function getPoolsByCreator(
uint256 poolIdFrom,
uint256 poolIdTo,
address creator
) external view returns (PoolView[] memory poolList) {
if (
poolIdFrom >= poolIdTo || poolIdTo - poolIdFrom > MAX_ITEMS_PER_PAGE
) {
revert Stake__InvalidPaginationParameters();
}
unchecked {
// Limit search to actual pool count
uint256 searchTo = poolIdTo > poolCount ? poolCount : poolIdTo;
if (poolIdFrom >= searchTo) {
return new PoolView[](0);
}
// Single pass: collect results in temporary array, then resize
uint256 maxLength = searchTo - poolIdFrom;
PoolView[] memory tempResults = new PoolView[](maxLength);
uint256 validCount = 0;
for (uint256 i = poolIdFrom; i < searchTo; ++i) {
Pool memory pool = pools[i];
// Skip pools not created by the specified creator
if (pool.creator != creator) continue;
tempResults[validCount] = PoolView({
poolId: i,
pool: pool,
stakingToken: _getTokenInfo(pool.stakingToken),
rewardToken: _getTokenInfo(pool.rewardToken)
});
++validCount;
}
// Create final array with exact size and copy results
poolList = new PoolView[](validCount);
for (uint256 i = 0; i < validCount; ++i) {
poolList[i] = tempResults[i];
}
}
}
/**
* @dev Returns the version of the contract
* @return The version string
*/
function version() external pure returns (string memory) {
return "1.1.0";
}
// MARK: - ERC1155 Receiver
/**
* @dev Handles the receipt of a single ERC1155 token type. This function is
* called at the end of a `safeTransferFrom` after the balance has been updated.
* Required for the contract to receive ERC1155 tokens.
*/
function onERC1155Received(
address,
address,
uint256 id,
uint256,
bytes memory
) external pure returns (bytes4) {
if (id != 0) revert Stake__InvalidTokenId();
return this.onERC1155Received.selector;
}
}// 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.1) (token/ERC1155/IERC1155.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC1155 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1155[EIP].
*/
interface IERC1155 is IERC165 {
/**
* @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`.
*/
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
/**
* @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
* transfers.
*/
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
/**
* @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
* `approved`.
*/
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
/**
* @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
*
* If an {URI} event was emitted for `id`, the standard
* https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
* returned by {IERC1155MetadataURI-uri}.
*/
event URI(string value, uint256 indexed id);
/**
* @dev Returns the value of tokens of token type `id` owned by `account`.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) external view returns (uint256);
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(
address[] calldata accounts,
uint256[] calldata ids
) external view returns (uint256[] memory);
/**
* @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the caller.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address account, address operator) external view returns (bool);
/**
* @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`.
*
* WARNING: This function can potentially allow a reentrancy attack when transferring tokens
* to an untrusted contract, when invoking {onERC1155Received} on the receiver.
* Ensure to follow the checks-effects-interactions pattern and consider employing
* reentrancy guards when interacting with untrusted contracts.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
* - `from` must have a balance of tokens of type `id` of at least `value` amount.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external;
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
*
* WARNING: This function can potentially allow a reentrancy attack when transferring tokens
* to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver.
* Ensure to follow the checks-effects-interactions pattern and consider employing
* reentrancy guards when interacting with untrusted contracts.
*
* Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments.
*
* Requirements:
*
* - `ids` and `values` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external;
}// 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/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Muldiv operation overflow.
*/
error MathOverflowedMulDiv();
enum Rounding {
Floor, // Toward negative infinity
Ceil, // Toward positive infinity
Trunc, // Toward zero
Expand // Away from zero
}
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds towards infinity instead
* of rounding towards zero.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
if (b == 0) {
// Guarantee the same behavior as in a regular Solidity division.
return a / b;
}
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
* denominator == 0.
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by
* Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0 = x * y; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
if (denominator <= prod1) {
revert MathOverflowedMulDiv();
}
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator.
// Always >= 1. See https://cs.stackexchange.com/q/138556/92363.
uint256 twos = denominator & (0 - denominator);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also
// works in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
* towards zero.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256 of a positive value rounded towards zero.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
}
}
/**
* @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
*/
function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
return uint8(rounding) % 2 == 1;
}
}// 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: BUSL-1.1
pragma solidity ^0.8.20;
interface MCV2_ICommonToken {
function totalSupply() external view returns (uint256);
function mintByBond(address to, uint256 amount) external;
function burnByBond(address account, uint256 amount) external;
function decimals() external pure returns (uint8);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
}{
"evmVersion": "paris",
"optimizer": {
"enabled": true,
"runs": 50000
},
"viaIR": true,
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"protocolBeneficiary_","type":"address"},{"internalType":"uint256","name":"creationFee_","type":"uint256"},{"internalType":"uint256","name":"claimFee_","type":"uint256"}],"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":"FailedInnerCall","type":"error"},{"inputs":[],"name":"MathOverflowedMulDiv","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":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"Stake__FeeTransferFailed","type":"error"},{"inputs":[],"name":"Stake__InsufficientBalance","type":"error"},{"inputs":[],"name":"Stake__InvalidAddress","type":"error"},{"inputs":[],"name":"Stake__InvalidClaimFee","type":"error"},{"inputs":[],"name":"Stake__InvalidCreationFee","type":"error"},{"inputs":[],"name":"Stake__InvalidDuration","type":"error"},{"inputs":[],"name":"Stake__InvalidPaginationParameters","type":"error"},{"inputs":[],"name":"Stake__InvalidRewardStartsAt","type":"error"},{"inputs":[],"name":"Stake__InvalidToken","type":"error"},{"inputs":[],"name":"Stake__InvalidTokenId","type":"error"},{"inputs":[],"name":"Stake__InvalidTokenType","type":"error"},{"inputs":[],"name":"Stake__PoolCancelled","type":"error"},{"inputs":[],"name":"Stake__PoolFinished","type":"error"},{"inputs":[],"name":"Stake__PoolNotFound","type":"error"},{"inputs":[],"name":"Stake__RewardRateTooLow","type":"error"},{"inputs":[],"name":"Stake__RewardTokenTokenTooSmall","type":"error"},{"inputs":[],"name":"Stake__StakeAmountTooLarge","type":"error"},{"inputs":[],"name":"Stake__StakingTokenTokenTooBig","type":"error"},{"inputs":[],"name":"Stake__TokenHasTransferFeesOrRebasing","type":"error"},{"inputs":[],"name":"Stake__Unauthorized","type":"error"},{"inputs":[],"name":"Stake__ZeroAmount","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newFee","type":"uint256"}],"name":"ClaimFeeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newFee","type":"uint256"}],"name":"CreationFeeUpdated","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":"poolId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"leftoverRewards","type":"uint256"}],"name":"PoolCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"poolId","type":"uint256"},{"indexed":true,"internalType":"address","name":"creator","type":"address"},{"indexed":true,"internalType":"address","name":"stakingToken","type":"address"},{"indexed":false,"internalType":"bool","name":"isStakingTokenERC20","type":"bool"},{"indexed":true,"internalType":"address","name":"rewardToken","type":"address"},{"indexed":false,"internalType":"uint104","name":"rewardAmount","type":"uint104"},{"indexed":false,"internalType":"uint40","name":"rewardStartsAt","type":"uint40"},{"indexed":false,"internalType":"uint32","name":"rewardDuration","type":"uint32"}],"name":"PoolCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldBeneficiary","type":"address"},{"indexed":false,"internalType":"address","name":"newBeneficiary","type":"address"}],"name":"ProtocolBeneficiaryUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"poolId","type":"uint256"},{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":true,"internalType":"uint104","name":"reward","type":"uint104"},{"indexed":false,"internalType":"uint104","name":"fee","type":"uint104"}],"name":"RewardClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"poolId","type":"uint256"},{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":true,"internalType":"uint104","name":"amount","type":"uint104"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"poolId","type":"uint256"},{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":true,"internalType":"uint104","name":"amount","type":"uint104"},{"indexed":false,"internalType":"bool","name":"rewardClaimed","type":"bool"}],"name":"Unstaked","type":"event"},{"inputs":[],"name":"MAX_REWARD_DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_REWARD_DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"}],"name":"cancelPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"address","name":"staker","type":"address"}],"name":"claimableReward","outputs":[{"internalType":"uint256","name":"rewardClaimable","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"uint256","name":"claimedTotal","type":"uint256"},{"internalType":"uint256","name":"feeTotal","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolIdFrom","type":"uint256"},{"internalType":"uint256","name":"poolIdTo","type":"uint256"},{"internalType":"address","name":"staker","type":"address"}],"name":"claimableRewardBulk","outputs":[{"internalType":"uint256[5][]","name":"results","type":"uint256[5][]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"stakingToken","type":"address"},{"internalType":"bool","name":"isStakingTokenERC20","type":"bool"},{"internalType":"address","name":"rewardToken","type":"address"},{"internalType":"uint104","name":"rewardAmount","type":"uint104"},{"internalType":"uint40","name":"rewardStartsAt","type":"uint40"},{"internalType":"uint32","name":"rewardDuration","type":"uint32"}],"name":"createPool","outputs":[{"internalType":"uint256","name":"poolId","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"creationFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"}],"name":"emergencyUnstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"}],"name":"getPool","outputs":[{"components":[{"internalType":"uint256","name":"poolId","type":"uint256"},{"components":[{"internalType":"address","name":"stakingToken","type":"address"},{"internalType":"bool","name":"isStakingTokenERC20","type":"bool"},{"internalType":"address","name":"rewardToken","type":"address"},{"internalType":"address","name":"creator","type":"address"},{"internalType":"uint104","name":"rewardAmount","type":"uint104"},{"internalType":"uint32","name":"rewardDuration","type":"uint32"},{"internalType":"uint40","name":"rewardStartsAt","type":"uint40"},{"internalType":"uint40","name":"rewardStartedAt","type":"uint40"},{"internalType":"uint40","name":"cancelledAt","type":"uint40"},{"internalType":"uint128","name":"totalStaked","type":"uint128"},{"internalType":"uint32","name":"activeStakerCount","type":"uint32"},{"internalType":"uint40","name":"lastRewardUpdatedAt","type":"uint40"},{"internalType":"uint256","name":"accRewardPerShare","type":"uint256"},{"internalType":"uint104","name":"totalAllocatedRewards","type":"uint104"}],"internalType":"struct Stake.Pool","name":"pool","type":"tuple"},{"components":[{"internalType":"string","name":"symbol","type":"string"},{"internalType":"string","name":"name","type":"string"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"internalType":"struct Stake.TokenInfo","name":"stakingToken","type":"tuple"},{"components":[{"internalType":"string","name":"symbol","type":"string"},{"internalType":"string","name":"name","type":"string"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"internalType":"struct Stake.TokenInfo","name":"rewardToken","type":"tuple"}],"internalType":"struct Stake.PoolView","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolIdFrom","type":"uint256"},{"internalType":"uint256","name":"poolIdTo","type":"uint256"}],"name":"getPools","outputs":[{"components":[{"internalType":"uint256","name":"poolId","type":"uint256"},{"components":[{"internalType":"address","name":"stakingToken","type":"address"},{"internalType":"bool","name":"isStakingTokenERC20","type":"bool"},{"internalType":"address","name":"rewardToken","type":"address"},{"internalType":"address","name":"creator","type":"address"},{"internalType":"uint104","name":"rewardAmount","type":"uint104"},{"internalType":"uint32","name":"rewardDuration","type":"uint32"},{"internalType":"uint40","name":"rewardStartsAt","type":"uint40"},{"internalType":"uint40","name":"rewardStartedAt","type":"uint40"},{"internalType":"uint40","name":"cancelledAt","type":"uint40"},{"internalType":"uint128","name":"totalStaked","type":"uint128"},{"internalType":"uint32","name":"activeStakerCount","type":"uint32"},{"internalType":"uint40","name":"lastRewardUpdatedAt","type":"uint40"},{"internalType":"uint256","name":"accRewardPerShare","type":"uint256"},{"internalType":"uint104","name":"totalAllocatedRewards","type":"uint104"}],"internalType":"struct Stake.Pool","name":"pool","type":"tuple"},{"components":[{"internalType":"string","name":"symbol","type":"string"},{"internalType":"string","name":"name","type":"string"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"internalType":"struct Stake.TokenInfo","name":"stakingToken","type":"tuple"},{"components":[{"internalType":"string","name":"symbol","type":"string"},{"internalType":"string","name":"name","type":"string"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"internalType":"struct Stake.TokenInfo","name":"rewardToken","type":"tuple"}],"internalType":"struct Stake.PoolView[]","name":"poolList","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolIdFrom","type":"uint256"},{"internalType":"uint256","name":"poolIdTo","type":"uint256"},{"internalType":"address","name":"creator","type":"address"}],"name":"getPoolsByCreator","outputs":[{"components":[{"internalType":"uint256","name":"poolId","type":"uint256"},{"components":[{"internalType":"address","name":"stakingToken","type":"address"},{"internalType":"bool","name":"isStakingTokenERC20","type":"bool"},{"internalType":"address","name":"rewardToken","type":"address"},{"internalType":"address","name":"creator","type":"address"},{"internalType":"uint104","name":"rewardAmount","type":"uint104"},{"internalType":"uint32","name":"rewardDuration","type":"uint32"},{"internalType":"uint40","name":"rewardStartsAt","type":"uint40"},{"internalType":"uint40","name":"rewardStartedAt","type":"uint40"},{"internalType":"uint40","name":"cancelledAt","type":"uint40"},{"internalType":"uint128","name":"totalStaked","type":"uint128"},{"internalType":"uint32","name":"activeStakerCount","type":"uint32"},{"internalType":"uint40","name":"lastRewardUpdatedAt","type":"uint40"},{"internalType":"uint256","name":"accRewardPerShare","type":"uint256"},{"internalType":"uint104","name":"totalAllocatedRewards","type":"uint104"}],"internalType":"struct Stake.Pool","name":"pool","type":"tuple"},{"components":[{"internalType":"string","name":"symbol","type":"string"},{"internalType":"string","name":"name","type":"string"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"internalType":"struct Stake.TokenInfo","name":"stakingToken","type":"tuple"},{"components":[{"internalType":"string","name":"symbol","type":"string"},{"internalType":"string","name":"name","type":"string"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"internalType":"struct Stake.TokenInfo","name":"rewardToken","type":"tuple"}],"internalType":"struct Stake.PoolView[]","name":"poolList","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"pools","outputs":[{"internalType":"address","name":"stakingToken","type":"address"},{"internalType":"bool","name":"isStakingTokenERC20","type":"bool"},{"internalType":"address","name":"rewardToken","type":"address"},{"internalType":"address","name":"creator","type":"address"},{"internalType":"uint104","name":"rewardAmount","type":"uint104"},{"internalType":"uint32","name":"rewardDuration","type":"uint32"},{"internalType":"uint40","name":"rewardStartsAt","type":"uint40"},{"internalType":"uint40","name":"rewardStartedAt","type":"uint40"},{"internalType":"uint40","name":"cancelledAt","type":"uint40"},{"internalType":"uint128","name":"totalStaked","type":"uint128"},{"internalType":"uint32","name":"activeStakerCount","type":"uint32"},{"internalType":"uint40","name":"lastRewardUpdatedAt","type":"uint40"},{"internalType":"uint256","name":"accRewardPerShare","type":"uint256"},{"internalType":"uint104","name":"totalAllocatedRewards","type":"uint104"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolBeneficiary","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"uint104","name":"amount","type":"uint104"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"uint104","name":"amount","type":"uint104"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"claimFee_","type":"uint256"}],"name":"updateClaimFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"creationFee_","type":"uint256"}],"name":"updateCreationFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"protocolBeneficiary_","type":"address"}],"name":"updateProtocolBeneficiary","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"userPoolStake","outputs":[{"internalType":"uint104","name":"stakedAmount","type":"uint104"},{"internalType":"uint104","name":"claimedTotal","type":"uint104"},{"internalType":"uint104","name":"feeTotal","type":"uint104"},{"internalType":"uint256","name":"rewardDebt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"}]Contract Creation Code
6080346101da57601f61476d38819003918201601f19168301916001600160401b038311848410176101df578084926060946040528339810103126101da5780516001600160a01b03811691908290036101da57604060208201519101519133156101c45760008054336001600160a01b0319821681178355916001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a3600180556100b56101f5565b80156101b357600280546001600160a01b031981168317909155604080516001600160a01b03909216825260208201929092527f5de302eeb1c80d4fb0c0953b692353f09ddf431411b8eb2034d5e8576956191292907fc49018c9854c68de72ec478f1962e3d872a70aadb0dba137983fefcedf687e03908390a16101386101f5565b600354908060035582519182526020820152a16101536101f5565b6107d081116101a25760407f3c4e14c3f450a320de9683e5ffeec6e95e4e02755f862e36ff6f8f6c21086f6091600454908060045582519182526020820152a160405161454e908161021f8239f35b630f92d19360e31b60005260046000fd5b63134ac20d60e31b60005260046000fd5b631e4fbdf760e01b600052600060045260246000fd5b600080fd5b634e487b7160e01b600052604160045260246000fd5b6000546001600160a01b0316330361020957565b63118cdaa760e01b6000523360045260246000fdfe6080604052600436101561001257600080fd5b6000803560e01c8063012ce501146124ba578063068bcd8d1461240557806327e381a91461232b578063379607f5146122e95780633f4520f5146122c8578063402c7c59146118385780634f285d29146117a757806354fd4d50146117465780635cc27d6f146117295780636fa23795146116d3578063715018a614611655578063827c7889146113b15780638da5cb5b1461137e578063990e60051461134a57806399d32fc41461132c578063ac4afa38146111ec578063b20b840314611164578063bbe9583714611141578063c432924a146110c0578063ca0b441f14611095578063d60b516414610fab578063dce0b4e414610f8d578063e4c54e6314610be1578063f05bcd6f1461030f578063f23a6e6114610236578063f2fde38b146101665763f525cb681461014657600080fd5b346101635780600319360112610163576020600554604051908152f35b80fd5b50346101635760206003193601126101635773ffffffffffffffffffffffffffffffffffffffff610195612a8e565b61019d613908565b16801561020a5773ffffffffffffffffffffffffffffffffffffffff8254827fffffffffffffffffffffffff00000000000000000000000000000000000000008216178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b6024827f1e4fbdf700000000000000000000000000000000000000000000000000000000815280600452fd5b50346101635760a060031936011261016357610250612a8e565b50610259612ab1565b508060843567ffffffffffffffff811161030c573660238201121561030c57806004013561028681612c86565b6102936040519182612c45565b81815236602483850101116103095781602460209401848301370101526044356102e15760206040517ff23a6e61000000000000000000000000000000000000000000000000000000008152f35b807fe61fdb0d0000000000000000000000000000000000000000000000000000000060049252fd5b50505b50fd5b50346101635760406003193601126101635760043561032c612ad4565b90610335613672565b600554811015610bb9576cffffffffffffffffffffffffff8216918215610b91578184526006602052604084209060038201908154918260d81c610b695764ffffffffff8360b01c169283159384159081610b43575b50610b1b573388526007602052604088208689526020526040882093876cffffffffffffffffffffffffff036cffffffffffffffffffffffffff8111610aee576cffffffffffffffffffffffffff808754169116108015610aa3575b610a7b57610968575b50506103fb84613957565b81546cffffffffffffffffffffffffff16156108c4576104366cffffffffffffffffffffffffff9161042d3387613b07565b82845416613646565b167fffffffffffffffffffffffffffffffffffffff00000000000000000000000000825416178155600261047f6cffffffffffffffffffffffffff8354166005850154906140ae565b91015560048101836fffffffffffffffffffffffffffffffff825416016fffffffffffffffffffffffffffffffff8111610897576fffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffff000000000000000000000000000000008254161790555460ff73ffffffffffffffffffffffffffffffffffffffff82169160a01c166000146106d357604051907f70a08231000000000000000000000000000000000000000000000000000000008252306004830152602082602481845afa91821561069357859261069e575b509060206024926105ae6040517f23b872dd00000000000000000000000000000000000000000000000000000000848201523386820152306044820152876064820152606481526105a8608482612c45565b826143e6565b604051938480927f70a082310000000000000000000000000000000000000000000000000000000082523060048301525afa80156106935784928691610655575b50906105fa91612f60565b0361062d575b33907f52acb05969c71d9f4ec3fa707b6ed04b3e2a38512c52b7d0f177ccc60c0776ae8480a46001805580f35b6004837f9d0ede4c000000000000000000000000000000000000000000000000000000008152fd5b919250506020813d60201161068b575b8161067260209383612c45565b8101031261068657518391906105fa6105ef565b600080fd5b3d9150610665565b6040513d87823e3d90fd5b91506020823d6020116106cb575b816106b960209383612c45565b81010312610686579051906020610556565b3d91506106ac565b6040517efdd58e000000000000000000000000000000000000000000000000000000008152306004820152846024820152602081604481855afa908115610693578591610865575b50813b1561085657846040517ff242432a00000000000000000000000000000000000000000000000000000000815233600482015230602482015281604482015285606482015260a060848201528160a4820152818160c48183885af1801561085a57610841575b50506020604492604051938480927efdd58e0000000000000000000000000000000000000000000000000000000082523060048301528960248301525afa80156106935784928691610808575b50906107db91612f60565b14610600576004837f9d0ede4c000000000000000000000000000000000000000000000000000000008152fd5b919250506020813d602011610839575b8161082560209383612c45565b8101031261068657518391906107db6107d0565b3d9150610818565b8161084b91612c45565b610856578438610783565b8480fd5b6040513d84823e3d90fd5b90506020813d60201161088f575b8161088060209383612c45565b8101031261068657513861071b565b3d9150610873565b6024867f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b6004830163ffffffff815460801c1663ffffffff811461093b5781547fffffffffffffffffffffffff00000000ffffffffffffffffffffffffffffffff16600190910160801b73ffffffff00000000000000000000000000000000161790556cffffffffffffffffffffffffff906104369061042d565b6024887f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b64ffffffffff4281169160881c16808210610a22575081547fffffffffff0000000000ffffffffffffffffffffffffffffffffffffffffffff1660b082901b7affffffffff000000000000000000000000000000000000000000001617909155610a1b905b60048501907fffffffffffffff0000000000ffffffffffffffffffffffffffffffffffffffff78ffffffffff000000000000000000000000000000000000000083549260a01b169116179055565b38806103f0565b82547fffffffffff0000000000ffffffffffffffffffffffffffffffffffffffffffff1660b082901b7affffffffff00000000000000000000000000000000000000000000161790925550610a76906109cd565b610a1b565b6004897f5ad55c6d000000000000000000000000000000000000000000000000000000008152fd5b50876fffffffffffffffffffffffffffffffff036fffffffffffffffffffffffffffffffff8111610aee576fffffffffffffffffffffffffffffffff806004890154169116106103e7565b60248a7f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b6004887f9b802cbe000000000000000000000000000000000000000000000000000000008152fd5b64ffffffffff9150610b5f9063ffffffff8460681c169061362a565b164210153861038b565b6004877f4cd78777000000000000000000000000000000000000000000000000000000008152fd5b6004847f4719ffdb000000000000000000000000000000000000000000000000000000008152fd5b6004837ffc3d5913000000000000000000000000000000000000000000000000000000008152fd5b503461016357604060031936011261016357600435610bfe612ad4565b90610c07613672565b600554811015610bb9576cffffffffffffffffffffffffff8216918215610b9157818452600660205260408420903385526007602052604085208386526020526040852090846cffffffffffffffffffffffffff83541610610f65579184916cffffffffffffffffffffffffff808895610c8088613957565b610c8a3389613b07565b818454160316167fffffffffffffffffffffffffffffffffffffff0000000000000000000000000082541617815560048201906fffffffffffffffffffffffffffffffff8085818554160316167fffffffffffffffffffffffffffffffff000000000000000000000000000000008354161782556cffffffffffffffffffffffffff815416906002610d206005860154846140ae565b91015515610ee2575b6fffffffffffffffffffffffffffffffff8154161580610ecb575b80610eb4575b610e5e575b50805460ff8160a01c16600014610db95750610d84925073ffffffffffffffffffffffffffffffffffffffff33915416613ec2565b60405190600182527fe2596fac793f3c02e1699ee0e62e33a967c44c62f723dc794446361c15278e3660203393a46001805580f35b73ffffffffffffffffffffffffffffffffffffffff16915050803b15610e5a5781809160c4604051809481937ff242432a00000000000000000000000000000000000000000000000000000000835230600484015233602484015281604484015289606484015260a060848401528160a48401525af1801561085a57610e41575b5050610d84565b81610e4b91612c45565b610e56578238610e3a565b8280fd5b5080fd5b600382017fffffffffff0000000000ffffffffffffffffffffffffffffffffffffffffffff81541690557fffffffffffffff0000000000ffffffffffffffffffffffffffffffffffffffff815416905538610d4f565b5064ffffffffff600383015460b01c164210610d4a565b5064ffffffffff600383015460b01c161515610d44565b63ffffffff9193508092505460801c1680156108975781547fffffffffffffffffffffffff00000000ffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90910160801b73ffffffff000000000000000000000000000000001617815584918491610d29565b6004867fa1c57736000000000000000000000000000000000000000000000000000000008152fd5b50346101635780600319360112610163576020600354604051908152f35b503461016357604060031936011261016357600435610fc8612ab1565b90600554811015610bb957604083826cffffffffffffffffffffffffff9360809652600660205273ffffffffffffffffffffffffffffffffffffffff61100f848420612d85565b951682526007602052828220908252602052208161107560405161103281612ba5565b835495838716825283602083019760681c1687528361106a600282600189015416976040860198895201549260608501938452613f24565b92511690519161405f565b939094511691511691604051938452602084015260408301526060820152f35b5034610163576110bc6110b06110aa36612b6e565b91613498565b60405191829182612af0565b0390f35b5034610163576110d86110d236612b6e565b91613222565b6040519060208201602083528151809152602060408401920193805b8282106111015784840385f35b9091928551819083915b6005831061112b575050506020959095019460a0019291600101906110f4565b602080600192845181520192019201919061110b565b5034610163576040600319360112610163576110bc6110b060243560043561306f565b503461016357602060031936011261016357600435611181613908565b6107d081116111c45760407f3c4e14c3f450a320de9683e5ffeec6e95e4e02755f862e36ff6f8f6c21086f6091600454908060045582519182526020820152a180f35b6004827f7c968c98000000000000000000000000000000000000000000000000000000008152fd5b50346101635760206003193601126101635760406101c091600435815260066020522080549073ffffffffffffffffffffffffffffffffffffffff6001820154169064ffffffffff73ffffffffffffffffffffffffffffffffffffffff60028301541660038301546004840154916cffffffffffffffffffffffffff60066005870154960154169560ff6040519873ffffffffffffffffffffffffffffffffffffffff81168a5260a01c1615156020890152604088015260608701526cffffffffffffffffffffffffff8116608087015263ffffffff8160681c1660a0870152828160881c1660c0870152828160b01c1660e087015260d81c6101008601526fffffffffffffffffffffffffffffffff811661012086015263ffffffff8160801c1661014086015260a01c166101608401526101808301526101a0820152f35b50346101635780600319360112610163576020600454604051908152f35b5034610163578060031936011261016357602073ffffffffffffffffffffffffffffffffffffffff60025416604051908152f35b503461016357806003193601126101635773ffffffffffffffffffffffffffffffffffffffff6020915416604051908152f35b5034610163576020600319360112610163576004356113ce613672565b60055481101561162d57808252600660205260408220906002820173ffffffffffffffffffffffffffffffffffffffff8154163303611605576003830192835460d81c6115dd5761141e83613957565b6cffffffffffffffffffffffffff8454166cffffffffffffffffffffffffff60068301541690036cffffffffffffffffffffffffff81116108975784547affffffffffffffffffffffffffffffffffffffffffffffffffffff164260d81b7fffffffffff000000000000000000000000000000000000000000000000000000161785556cffffffffffffffffffffffffff1693846114e5575b5050507fcb217dc5cde7608105c5fa8af63d961a4210e06dc3c3dafa9396d05251952f858380a36001805580f35b73ffffffffffffffffffffffffffffffffffffffff916115196cffffffffffffffffffffffffff6001935416871115612f2a565b015416604051907f70a08231000000000000000000000000000000000000000000000000000000008252306004830152602082602481845afa80156115d25785928791611597575b5061158f9361158773ffffffffffffffffffffffffffffffffffffffff92851115612f2a565b541690613ec2565b3880806114b7565b939250506020833d6020116115ca575b816115b460209383612c45565b810103126106865791519091849161158f611561565b3d91506115a7565b6040513d88823e3d90fd5b6004857f4cd78777000000000000000000000000000000000000000000000000000000008152fd5b6004847f77dc3587000000000000000000000000000000000000000000000000000000008152fd5b6004827ffc3d5913000000000000000000000000000000000000000000000000000000008152fd5b503461016357806003193601126101635761166e613908565b8073ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b5034610163576020600319360112610163577f5de302eeb1c80d4fb0c0953b692353f09ddf431411b8eb2034d5e857695619126040600435611713613908565b600354908060035582519182526020820152a180f35b50346101635780600319360112610163576020604051610e108152f35b5034610163578060031936011261016357506110bc604051611769604082612c45565b600581527f312e312e3000000000000000000000000000000000000000000000000000000060208201526040519182916020835260208301906128b1565b503461016357604060031936011261016357604060809173ffffffffffffffffffffffffffffffffffffffff6117db612a8e565b168152600760205281812060243582526020522080549060026cffffffffffffffffffffffffff600183015416910154906cffffffffffffffffffffffffff60405193818116855260681c16602084015260408301526060820152f35b5060c06003193601126101635761184d612a8e565b60243590811515908183036122c4576044359173ffffffffffffffffffffffffffffffffffffffff831680930361085657606435936cffffffffffffffffffffffffff85168095036122c05760843564ffffffffff81168091036122bc5760a4359163ffffffff83168093036122b8576118c5613672565b73ffffffffffffffffffffffffffffffffffffffff851694851561229057861561229057871561226857610e108410801561225b575b612233578315612206576cffffffffffffffffffffffffff84890416156121de5762093a804201804211610aee5783116121b65760035480340361218e578981849261212f575b505061194d91613d4c565b156121075761204c575b6040517f313ce567000000000000000000000000000000000000000000000000000000008152602081600481895afa9081156120415760049160ff918a91612012575b501610611fea576005549560018701808811611fbd576005556040516119bf81612bf0565b858152888060208301878152838b604082018c81526060830190338252608084019189835260a085018c815260c08601908c825260e08701928984526101008801948a86526101208901998b8b528b6101408b0199818b526101608c019b828d5261018081019e8f526101a0019e8f528152600660205260409020809e5173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681547fffffffffffffffffffffffff0000000000000000000000000000000000000000161790555115158d549060a01b74ff000000000000000000000000000000000000000016907fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16178d555173ffffffffffffffffffffffffffffffffffffffff1660018d019073ffffffffffffffffffffffffffffffffffffffff1681547fffffffffffffffffffffffff0000000000000000000000000000000000000000161790555173ffffffffffffffffffffffffffffffffffffffff1660028c019073ffffffffffffffffffffffffffffffffffffffff1681547fffffffffffffffffffffffff00000000000000000000000000000000000000001617905560038b0194516cffffffffffffffffffffffffff166cffffffffffffffffffffffffff1685547fffffffffffffffffffffffffffffffffffffff000000000000000000000000001617855551908454905160881b75ffffffffff0000000000000000000000000000000000169160681b70ffffffff0000000000000000000000000016907fffffffffffffffffffff000000000000000000ffffffffffffffffffffffffff16171783555164ffffffffff16611c8b9083907fffffffffff0000000000ffffffffffffffffffffffffffffffffffffffffffff7affffffffff0000000000000000000000000000000000000000000083549260b01b169116179055565b5181547affffffffffffffffffffffffffffffffffffffffffffffffffffff1660d89190911b7fffffffffff000000000000000000000000000000000000000000000000000000161790559151600486018054935173ffffffff0000000000000000000000000000000060809190911b166fffffffffffffffffffffffffffffffff9092167fffffffffffffffffffffffff0000000000000000000000000000000000000000909416939093171782555181547fffffffffffffff0000000000ffffffffffffffffffffffffffffffffffffffff1660a09190911b78ffffffffff000000000000000000000000000000000000000016179055516005830155516cffffffffffffffffffffffffff1690600601906cffffffffffffffffffffffffff1681547fffffffffffffffffffffffffffffffffffffff00000000000000000000000000161790556040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201528080885a92602491602094fa908115611fb2578991611f80575b50611e6f6040517f23b872dd00000000000000000000000000000000000000000000000000000000602082015233602482015230604482015283606482015260648152611e69608482612c45565b886143e6565b604051907f70a082310000000000000000000000000000000000000000000000000000000082523060048301526020826024818b5afa8015611f755783928b91611f3c575b5090611ebf91612f60565b03611f14576020975060405193878552888501526040840152606083015260808201527f2d07ab3d8a0000fcc86e521ba2df8be9ba7dd9159bf0cefedf38cc1e1e4b9b3460a03392a460018055604051908152f35b6004887f9d0ede4c000000000000000000000000000000000000000000000000000000008152fd5b919250506020813d602011611f6d575b81611f5960209383612c45565b810103126106865751829190611ebf611eb4565b3d9150611f4c565b6040513d8c823e3d90fd5b90506020813d602011611faa575b81611f9b60209383612c45565b81010312610686575138611e1b565b3d9150611f8e565b6040513d8b823e3d90fd5b6024897f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b6004877f952abc9d000000000000000000000000000000000000000000000000000000008152fd5b612034915060203d60201161203a575b61202c8183612c45565b810190612f11565b3861199a565b503d612022565b6040513d8a823e3d90fd5b6040517f18160ddd000000000000000000000000000000000000000000000000000000008152602081600481885afa80156120415788906120c7575b6d04ee2d6d415b85acef810000000091501115611957576004877f15161ded000000000000000000000000000000000000000000000000000000008152fd5b506020813d6020116120ff575b816120e160209383612c45565b81010312610686576d04ee2d6d415b85acef81000000009051612088565b3d91506120d4565b6004887f98bba0ae000000000000000000000000000000000000000000000000000000008152fd5b81809350809173ffffffffffffffffffffffffffffffffffffffff600254165af1612158612ee1565b501561216657818938611942565b6004897f8004a38f000000000000000000000000000000000000000000000000000000008152fd5b60048a7f80995ba7000000000000000000000000000000000000000000000000000000008152fd5b6004897f6a30cc01000000000000000000000000000000000000000000000000000000008152fd5b6004897f28d5a80d000000000000000000000000000000000000000000000000000000008152fd5b6024897f4e487b710000000000000000000000000000000000000000000000000000000081526012600452fd5b6004897f49b08957000000000000000000000000000000000000000000000000000000008152fd5b506312cc030084116118fb565b6004897f4719ffdb000000000000000000000000000000000000000000000000000000008152fd5b6004897f92dd44ae000000000000000000000000000000000000000000000000000000008152fd5b8780fd5b8680fd5b8580fd5b8380fd5b50346101635780600319360112610163575060206312cc0300604051908152f35b503461016357602060031936011261016357600435612306613672565b60055481101561162d578061231d61232492613957565b3390613b07565b6001805580f35b50346101635760206003193601126101635773ffffffffffffffffffffffffffffffffffffffff61235a612a8e565b612362613908565b1680156123dd5760407fc49018c9854c68de72ec478f1962e3d872a70aadb0dba137983fefcedf687e039160025490807fffffffffffffffffffffffff000000000000000000000000000000000000000083161760025573ffffffffffffffffffffffffffffffffffffffff8351921682526020820152a180f35b6004827f9a561068000000000000000000000000000000000000000000000000000000008152fd5b503461016357602060031936011261016357600435612422612ce1565b5060055481101561162d57612444604083836110bc9552600660205220612d85565b61246473ffffffffffffffffffffffffffffffffffffffff825116613747565b61248773ffffffffffffffffffffffffffffffffffffffff604084015116613747565b916040519361249585612ba5565b845260208401526040830152606082015260405191829160208352602083019061292c565b5034610163576020600319360112610163576004356124d7613672565b60055481101561162d573382526007602052604082208183526020526cffffffffffffffffffffffffff6040832054169081156128665780835260066020526040832033845260076020526040842082855260205260408420836cffffffffffffffffffffffffff8254161061283e578491849161255485613957565b6cffffffffffffffffffffffffff8084818454160316167fffffffffffffffffffffffffffffffffffffff0000000000000000000000000082541617815560048201906fffffffffffffffffffffffffffffffff8085818554160316167fffffffffffffffffffffffffffffffff000000000000000000000000000000008354161782556cffffffffffffffffffffffffff8154169060026125fa6005860154846140ae565b910155156127bb575b6fffffffffffffffffffffffffffffffff81541615806127a4575b8061278d575b612737575b50805460ff8160a01c16600014612692575061265e925073ffffffffffffffffffffffffffffffffffffffff33915416613ec2565b604051908382527fe2596fac793f3c02e1699ee0e62e33a967c44c62f723dc794446361c15278e3660203393a46001805580f35b73ffffffffffffffffffffffffffffffffffffffff16915050803b15610e5a57819060c4604051809481937ff242432a00000000000000000000000000000000000000000000000000000000835230600484015233602484015281604484015288606484015260a060848401528160a48401525af1801561272c57612718575b5061265e565b8361272591949294612c45565b9138612712565b6040513d86823e3d90fd5b600382017fffffffffff0000000000ffffffffffffffffffffffffffffffffffffffffffff81541690557fffffffffffffff0000000000ffffffffffffffffffffffffffffffffffffffff815416905538612629565b5064ffffffffff600383015460b01c164210612624565b5064ffffffffff600383015460b01c16151561261e565b63ffffffff9193508092505460801c1680156108975781547fffffffffffffffffffffffff00000000ffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90910160801b73ffffffff000000000000000000000000000000001617815584918491612603565b6004857fa1c57736000000000000000000000000000000000000000000000000000000008152fd5b6004837f4719ffdb000000000000000000000000000000000000000000000000000000008152fd5b60005b8381106128a15750506000910152565b8181015183820152602001612891565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f6020936128ed8151809281875287808801910161288e565b0116010190565b90604060ff8161292261291086516060875260608701906128b1565b602087015186820360208801526128b1565b9401511691015290565b612a8b91815181526cffffffffffffffffffffffffff6101a0602084015173ffffffffffffffffffffffffffffffffffffffff815116602085015260208101511515604085015273ffffffffffffffffffffffffffffffffffffffff604082015116606085015273ffffffffffffffffffffffffffffffffffffffff60608201511660808501528260808201511660a085015263ffffffff60a08201511660c085015264ffffffffff60c08201511660e085015264ffffffffff60e08201511661010085015264ffffffffff610100820151166101208501526fffffffffffffffffffffffffffffffff6101208201511661014085015263ffffffff6101408201511661016085015264ffffffffff61016082015116610180850152610180810151828501520151166101c08201526060612a7960408401516102206101e08501526102208401906128f4565b920151906102008184039101526128f4565b90565b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361068657565b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361068657565b602435906cffffffffffffffffffffffffff8216820361068657565b602081016020825282518091526040820191602060408360051b8301019401926000915b838310612b2357505050505090565b9091929394602080612b5f837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08660019603018752895161292c565b97019301930191939290612b14565b600319606091011261068657600435906024359060443573ffffffffffffffffffffffffffffffffffffffff811681036106865790565b6080810190811067ffffffffffffffff821117612bc157604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6101c0810190811067ffffffffffffffff821117612bc157604052565b6060810190811067ffffffffffffffff821117612bc157604052565b60a0810190811067ffffffffffffffff821117612bc157604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117612bc157604052565b67ffffffffffffffff8111612bc157601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60405190612ccd82612c0d565b600060408360608152606060208201520152565b60405190612cee82612ba5565b8160008152604051612cff81612bf0565b6000815260006020820152600060408201526000606082015260006080820152600060a0820152600060c0820152600060e08201526000610100820152600061012082015260006101408201526000610160820152600061018082015260006101a08201526020820152612d71612cc0565b60408201526060612d80612cc0565b910152565b90604051612d9281612bf0565b6101a06cffffffffffffffffffffffffff6006839560ff815473ffffffffffffffffffffffffffffffffffffffff8116875260a01c161515602086015273ffffffffffffffffffffffffffffffffffffffff600182015416604086015273ffffffffffffffffffffffffffffffffffffffff60028201541660608601526003810154838116608087015263ffffffff8160681c1660a087015264ffffffffff8160881c1660c087015264ffffffffff8160b01c1660e087015260d81c61010086015264ffffffffff60048201546fffffffffffffffffffffffffffffffff811661012088015263ffffffff8160801c1661014088015260a01c166101608601526005810154610180860152015416910152565b91908201809211612eb257565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b3d15612f0c573d90612ef282612c86565b91612f006040519384612c45565b82523d6000602084013e565b606090565b90816020910312610686575160ff811681036106865790565b15612f3157565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b91908203918211612eb257565b67ffffffffffffffff8111612bc15760051b60200190565b60405190612f94602083612c45565b600080835282815b828110612fa857505050565b602090612fb3612ce1565b82828501015201612f9c565b90612fc982612f6d565b612fd66040519182612c45565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe06130048294612f6d565b019060005b82811061301557505050565b602090613020612ce1565b82828501015201613009565b80518210156130405760209160051b010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9190808310801590613196575b61316c57600554908181111561316557505b8083101561315a57826130a091612f60565b6130a981612fbf565b9260005b8281106130b957505050565b806130c660019284612ea5565b8060005260066020526130dc6040600020612d85565b6130fc73ffffffffffffffffffffffffffffffffffffffff825116613747565b61311f73ffffffffffffffffffffffffffffffffffffffff604084015116613747565b916040519361312d85612ba5565b8452602084015260408301526060820152613148828861302c565b52613153818761302c565b50016130ad565b509050612a8b612f85565b905061308e565b7f20a305de0000000000000000000000000000000000000000000000000000000060005260046000fd5b506101f46131a48483612f60565b1161307c565b906131b482612f6d565b6131c16040519182612c45565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe06131ef8294612f6d565b019060005b82811061320057505050565b60209060a0604051906132138183612c45565b368237828285010152016131f4565b90929192808210801590613484575b61316c57600554908181111561347d57505b8082101561343457926132578285036131aa565b93600092915b8183106132aa57505050613270816131aa565b9260005b82811061328057505050565b8061328d6001928461302c565b51613298828861302c565b526132a3818761302c565b5001613274565b90919273ffffffffffffffffffffffffffffffffffffffff821660005260076020526040600020846000526020526040600020604051906132ea82612ba5565b8054916cffffffffffffffffffffffffff8084169384835260681c1692602082019380855260026cffffffffffffffffffffffffff600186015416946040850195865201549160608401928352158091819261342b575b5061341d579260019593926cffffffffffffffffffffffffff928796946133d1578391613387918c60005260066020528361106a6133826040600020612d85565b613f24565b604051959161339587612c29565b8c87526020870152604086015251166060840152511660808201526133ba828a61302c565b526133c5818961302c565b5001935b01919061325d565b505081604051936133e185612c29565b8a85526000602086015260006040860152511660608401525116608082015261340a828a61302c565b52613415818961302c565b5001936133c9565b5050505050926001906133c9565b90501538613341565b50506040519091506000613449602083612c45565b81526000805b81811061345b57505090565b60209060a06040519061346e8183612c45565b3682378282860101520161344f565b9050613243565b506103e86134928383612f60565b11613231565b90929192808210801590613616575b61316c57600554908181111561360f57505b8082101561360357926134cd828503612fbf565b93600092915b818310613520575050506134e681612fbf565b9260005b8281106134f657505050565b806135036001928461302c565b5161350e828861302c565b52613519818761302c565b50016134ea565b9091928360005260066020526135396040600020612d85565b73ffffffffffffffffffffffffffffffffffffffff60608201511673ffffffffffffffffffffffffffffffffffffffff8416036135f9576001918161359573ffffffffffffffffffffffffffffffffffffffff85945116613747565b6135b873ffffffffffffffffffffffffffffffffffffffff604084015116613747565b90604051926135c684612ba5565b8984526020840152604083015260608201526135e2828a61302c565b526135ed818961302c565b5001935b0191906134d3565b50926001906135f1565b50509050612a8b612f85565b90506134b9565b506101f46136248383612f60565b116134a7565b9064ffffffffff8091169116019064ffffffffff8211612eb257565b906cffffffffffffffffffffffffff809116911601906cffffffffffffffffffffffffff8211612eb257565b600260015414613683576002600155565b7f3ee5aeb50000000000000000000000000000000000000000000000000000000060005260046000fd5b604051906136bc604083612c45565b600982527f756e646566696e656400000000000000000000000000000000000000000000006020830152565b6020818303126106865780519067ffffffffffffffff8211610686570181601f8201121561068657805161371b81612c86565b926137296040519485612c45565b8184526020828401011161068657612a8b916020808501910161288e565b61374f612cc0565b506137586136ad565b6137606136ad565b600090818060405160208101907f95d89b410000000000000000000000000000000000000000000000000000000082526004815261379f602482612c45565b519087614e20fa6137ae612ee1565b90806138fc575b6138dd575b508160ff9394818060405160208101907f06fdde03000000000000000000000000000000000000000000000000000000008252600481526137fc602482612c45565b519084614e20fa61380b612ee1565b90806138d1575b6138b3575b50819060405160208101907f313ce56700000000000000000000000000000000000000000000000000000000825260048152613854602482612c45565b5191614e20fa613862612ee1565b90806138a8575b61388c575b506040519361387c85612c0d565b8452602084015216604082015290565b6138a191925060208082518301019101612f11565b903861386e565b506020815114613869565b82919350806020806138ca935183010191016136e8565b9290613817565b50604081511015613812565b60ff93506138f58160208086945183010191016136e8565b93506137ba565b506040815110156137b5565b73ffffffffffffffffffffffffffffffffffffffff60005416330361392957565b7f118cdaa7000000000000000000000000000000000000000000000000000000006000523360045260246000fd5b6000526006602052604060002064ffffffffff421690600381015464ffffffffff8160b01c16906004830192835464ffffffffff8160a01c169284158015613afd575b613af457613a65966fffffffffffffffffffffffffffffffff6139f964ffffffffff9763ffffffff8560681c1693896139d7868860d81c9461362a565b169180151580613aeb575b613ae3575b5081811115613adb5750965b87612f60565b9316151580613ad2575b613a67575b5050506005613a1961338283612d85565b91015582547fffffffffffffff0000000000ffffffffffffffffffffffffffffffffffffffff16911660a01b78ffffffffff000000000000000000000000000000000000000016179055565b565b6cffffffffffffffffffffffffff9283613a8293169061433f565b166cffffffffffffffffffffffffff613aa2600684019282845416613646565b167fffffffffffffffffffffffffffffffffffffff00000000000000000000000000825416179055388080613a08565b50821515613a03565b9050966139f3565b9150386139e7565b508281106139e2565b50505050505050565b508387111561399a565b9081600052600660205260406000209173ffffffffffffffffffffffffffffffffffffffff8216918260005260076020526040600020826000526020526040600020906005850154918054956002820192613b75845480966cffffffffffffffffffffffffff8b169061405f565b9190613b818382612ea5565b95613ba16cffffffffffffffffffffffffff600387015416881115612f2a565b8615613d2757613bd46020977f39ff35f451926ff5cd1926ae40ef218b8613cc15a7e9b567cbdecdfa65861b7f99612ea5565b90556cffffffffffffffffffffffffff8116997fffffffffffff00000000000000000000000000ffffffffffffffffffffffffff79ffffffffffffffffffffffffff00000000000000000000000000613c3f8d6cffffffffffffffffffffffffff8560681c16613646565b60681b16911617855560016cffffffffffffffffffffffffff841695016cffffffffffffffffffffffffff613c778782845416613646565b167fffffffffffffffffffffffffffffffffffffff0000000000000000000000000082541617905580613cfc575b505080613cb8575b5050604051908152a4565b73ffffffffffffffffffffffffffffffffffffffff6001613cf59301541673ffffffffffffffffffffffffffffffffffffffff6002541690613ec2565b3880613cad565b613d209173ffffffffffffffffffffffffffffffffffffffff600186015416613ec2565b3880613ca5565b5050505050505050505050565b90816020910312610686575180151581036106865790565b9015613e795760008060405160208101907f01ffc9a70000000000000000000000000000000000000000000000000000000082527fd9b67a2600000000000000000000000000000000000000000000000000000000602482015260248152613db5604482612c45565b519084614e20fa613dc4612ee1565b81613e6d575b81613e53575b50613e4d576000809160405160208101907f70a0823100000000000000000000000000000000000000000000000000000000825230602482015260248152613e19604482612c45565b5191614e20fa613e27612ee1565b9015908115613e40575b50613e3b57600190565b600090565b6020915051141538613e31565b50600090565b613e67915060208082518301019101613d34565b38613dd0565b80516020149150613dca565b6000809160405160208101907efdd58e00000000000000000000000000000000000000000000000000000000825230602482015283604482015260448152613e19606482612c45565b613a659273ffffffffffffffffffffffffffffffffffffffff604051937fa9059cbb000000000000000000000000000000000000000000000000000000006020860152166024840152604483015260448252613f1f606483612c45565b6143e6565b64ffffffffff42169064ffffffffff60e0820151169182158015614040575b801561402a575b61400757613fa99064ffffffffff613f6e60a085019563ffffffff8751169061362a565b169064ffffffffff6101008501511680151580614021575b614019575b508181111561401257505b64ffffffffff6101608401511690612f60565b91821561400757613fdd612a8b936140019263ffffffff6cffffffffffffffffffffffffff6080870151169151169161433f565b6fffffffffffffffffffffffffffffffff6101206101808501519401511690614188565b90612ea5565b506101809150015190565b9050613f96565b915038613f8b565b50828110613f86565b5064ffffffffff61016083015116811115613f4a565b506fffffffffffffffffffffffffffffffff6101208301511615613f43565b81156140a35761406e916140ae565b90808211156140995761408091612f60565b61409661408f600454836142ae565b8092612f60565b91565b5050600090600090565b505050600090600090565b9190916000838202917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8582099183808410930392808403931461417057826c0c9f2c9cd04674edea40000000111561414857507f7d33c22789773a07feda8b6f0930e26fa397c439f1d5cf4b2eb27d7306d2dc9993946c0c9f2c9cd04674edea40000000910990828211900360e21b9103601e1c170290565b807f227bc1530000000000000000000000000000000000000000000000000000000060049252fd5b5050506c0c9f2c9cd04674edea400000009192500490565b906c0c9f2c9cd04674edea400000008202907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6c0c9f2c9cd04674edea400000008409928280851094039380850394146142725783821115614248576c0c9f2c9cd04674edea40000000829109816000038216809204600281600302188082026002030280820260020302808202600203028082026002030280820260020302809102600203029360018380600003040190848311900302920304170290565b7f227bc1530000000000000000000000000000000000000000000000000000000060005260046000fd5b508092501561427f570490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b9190916000838202917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff858209918380841093039280840393146143325782612710111561414857507fbc01a36e2eb1c432ca57a786c226809d495182a9930be0ded288ce703afb7e919394612710910990828211900360fc1b910360041c170290565b5050506127109192500490565b9091828202917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff848209938380861095039480860395146143d8578483111561424857829109816000038216809204600281600302188082026002030280820260020302808202600203028082026002030280820260020302809102600203029360018380600003040190848311900302920304170290565b50508092501561427f570490565b60008073ffffffffffffffffffffffffffffffffffffffff61441d93169360208151910182865af1614416612ee1565b908361447b565b8051908115159182614460575b50506144335750565b7f5274afe70000000000000000000000000000000000000000000000000000000060005260045260246000fd5b6144739250602080918301019101613d34565b15388061442a565b906144ba575080511561449057805190602001fd5b7f1425ea420000000000000000000000000000000000000000000000000000000060005260046000fd5b8151158061450f575b6144cb575090565b73ffffffffffffffffffffffffffffffffffffffff907f9996b315000000000000000000000000000000000000000000000000000000006000521660045260246000fd5b50803b156144c356fea2646970667358221220150da3fea6532801b99af66d7095b133277680650ec51a9816fb116629638e4964736f6c634300081e003300000000000000000000000082ca6d313bffe56e9096b16633dfd414148d66b1000000000000000000000000000000000000000000000000000c6f3b40b6c0000000000000000000000000000000000000000000000000000000000000000190
Deployed Bytecode
0x6080604052600436101561001257600080fd5b6000803560e01c8063012ce501146124ba578063068bcd8d1461240557806327e381a91461232b578063379607f5146122e95780633f4520f5146122c8578063402c7c59146118385780634f285d29146117a757806354fd4d50146117465780635cc27d6f146117295780636fa23795146116d3578063715018a614611655578063827c7889146113b15780638da5cb5b1461137e578063990e60051461134a57806399d32fc41461132c578063ac4afa38146111ec578063b20b840314611164578063bbe9583714611141578063c432924a146110c0578063ca0b441f14611095578063d60b516414610fab578063dce0b4e414610f8d578063e4c54e6314610be1578063f05bcd6f1461030f578063f23a6e6114610236578063f2fde38b146101665763f525cb681461014657600080fd5b346101635780600319360112610163576020600554604051908152f35b80fd5b50346101635760206003193601126101635773ffffffffffffffffffffffffffffffffffffffff610195612a8e565b61019d613908565b16801561020a5773ffffffffffffffffffffffffffffffffffffffff8254827fffffffffffffffffffffffff00000000000000000000000000000000000000008216178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b6024827f1e4fbdf700000000000000000000000000000000000000000000000000000000815280600452fd5b50346101635760a060031936011261016357610250612a8e565b50610259612ab1565b508060843567ffffffffffffffff811161030c573660238201121561030c57806004013561028681612c86565b6102936040519182612c45565b81815236602483850101116103095781602460209401848301370101526044356102e15760206040517ff23a6e61000000000000000000000000000000000000000000000000000000008152f35b807fe61fdb0d0000000000000000000000000000000000000000000000000000000060049252fd5b50505b50fd5b50346101635760406003193601126101635760043561032c612ad4565b90610335613672565b600554811015610bb9576cffffffffffffffffffffffffff8216918215610b91578184526006602052604084209060038201908154918260d81c610b695764ffffffffff8360b01c169283159384159081610b43575b50610b1b573388526007602052604088208689526020526040882093876cffffffffffffffffffffffffff036cffffffffffffffffffffffffff8111610aee576cffffffffffffffffffffffffff808754169116108015610aa3575b610a7b57610968575b50506103fb84613957565b81546cffffffffffffffffffffffffff16156108c4576104366cffffffffffffffffffffffffff9161042d3387613b07565b82845416613646565b167fffffffffffffffffffffffffffffffffffffff00000000000000000000000000825416178155600261047f6cffffffffffffffffffffffffff8354166005850154906140ae565b91015560048101836fffffffffffffffffffffffffffffffff825416016fffffffffffffffffffffffffffffffff8111610897576fffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffff000000000000000000000000000000008254161790555460ff73ffffffffffffffffffffffffffffffffffffffff82169160a01c166000146106d357604051907f70a08231000000000000000000000000000000000000000000000000000000008252306004830152602082602481845afa91821561069357859261069e575b509060206024926105ae6040517f23b872dd00000000000000000000000000000000000000000000000000000000848201523386820152306044820152876064820152606481526105a8608482612c45565b826143e6565b604051938480927f70a082310000000000000000000000000000000000000000000000000000000082523060048301525afa80156106935784928691610655575b50906105fa91612f60565b0361062d575b33907f52acb05969c71d9f4ec3fa707b6ed04b3e2a38512c52b7d0f177ccc60c0776ae8480a46001805580f35b6004837f9d0ede4c000000000000000000000000000000000000000000000000000000008152fd5b919250506020813d60201161068b575b8161067260209383612c45565b8101031261068657518391906105fa6105ef565b600080fd5b3d9150610665565b6040513d87823e3d90fd5b91506020823d6020116106cb575b816106b960209383612c45565b81010312610686579051906020610556565b3d91506106ac565b6040517efdd58e000000000000000000000000000000000000000000000000000000008152306004820152846024820152602081604481855afa908115610693578591610865575b50813b1561085657846040517ff242432a00000000000000000000000000000000000000000000000000000000815233600482015230602482015281604482015285606482015260a060848201528160a4820152818160c48183885af1801561085a57610841575b50506020604492604051938480927efdd58e0000000000000000000000000000000000000000000000000000000082523060048301528960248301525afa80156106935784928691610808575b50906107db91612f60565b14610600576004837f9d0ede4c000000000000000000000000000000000000000000000000000000008152fd5b919250506020813d602011610839575b8161082560209383612c45565b8101031261068657518391906107db6107d0565b3d9150610818565b8161084b91612c45565b610856578438610783565b8480fd5b6040513d84823e3d90fd5b90506020813d60201161088f575b8161088060209383612c45565b8101031261068657513861071b565b3d9150610873565b6024867f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b6004830163ffffffff815460801c1663ffffffff811461093b5781547fffffffffffffffffffffffff00000000ffffffffffffffffffffffffffffffff16600190910160801b73ffffffff00000000000000000000000000000000161790556cffffffffffffffffffffffffff906104369061042d565b6024887f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b64ffffffffff4281169160881c16808210610a22575081547fffffffffff0000000000ffffffffffffffffffffffffffffffffffffffffffff1660b082901b7affffffffff000000000000000000000000000000000000000000001617909155610a1b905b60048501907fffffffffffffff0000000000ffffffffffffffffffffffffffffffffffffffff78ffffffffff000000000000000000000000000000000000000083549260a01b169116179055565b38806103f0565b82547fffffffffff0000000000ffffffffffffffffffffffffffffffffffffffffffff1660b082901b7affffffffff00000000000000000000000000000000000000000000161790925550610a76906109cd565b610a1b565b6004897f5ad55c6d000000000000000000000000000000000000000000000000000000008152fd5b50876fffffffffffffffffffffffffffffffff036fffffffffffffffffffffffffffffffff8111610aee576fffffffffffffffffffffffffffffffff806004890154169116106103e7565b60248a7f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b6004887f9b802cbe000000000000000000000000000000000000000000000000000000008152fd5b64ffffffffff9150610b5f9063ffffffff8460681c169061362a565b164210153861038b565b6004877f4cd78777000000000000000000000000000000000000000000000000000000008152fd5b6004847f4719ffdb000000000000000000000000000000000000000000000000000000008152fd5b6004837ffc3d5913000000000000000000000000000000000000000000000000000000008152fd5b503461016357604060031936011261016357600435610bfe612ad4565b90610c07613672565b600554811015610bb9576cffffffffffffffffffffffffff8216918215610b9157818452600660205260408420903385526007602052604085208386526020526040852090846cffffffffffffffffffffffffff83541610610f65579184916cffffffffffffffffffffffffff808895610c8088613957565b610c8a3389613b07565b818454160316167fffffffffffffffffffffffffffffffffffffff0000000000000000000000000082541617815560048201906fffffffffffffffffffffffffffffffff8085818554160316167fffffffffffffffffffffffffffffffff000000000000000000000000000000008354161782556cffffffffffffffffffffffffff815416906002610d206005860154846140ae565b91015515610ee2575b6fffffffffffffffffffffffffffffffff8154161580610ecb575b80610eb4575b610e5e575b50805460ff8160a01c16600014610db95750610d84925073ffffffffffffffffffffffffffffffffffffffff33915416613ec2565b60405190600182527fe2596fac793f3c02e1699ee0e62e33a967c44c62f723dc794446361c15278e3660203393a46001805580f35b73ffffffffffffffffffffffffffffffffffffffff16915050803b15610e5a5781809160c4604051809481937ff242432a00000000000000000000000000000000000000000000000000000000835230600484015233602484015281604484015289606484015260a060848401528160a48401525af1801561085a57610e41575b5050610d84565b81610e4b91612c45565b610e56578238610e3a565b8280fd5b5080fd5b600382017fffffffffff0000000000ffffffffffffffffffffffffffffffffffffffffffff81541690557fffffffffffffff0000000000ffffffffffffffffffffffffffffffffffffffff815416905538610d4f565b5064ffffffffff600383015460b01c164210610d4a565b5064ffffffffff600383015460b01c161515610d44565b63ffffffff9193508092505460801c1680156108975781547fffffffffffffffffffffffff00000000ffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90910160801b73ffffffff000000000000000000000000000000001617815584918491610d29565b6004867fa1c57736000000000000000000000000000000000000000000000000000000008152fd5b50346101635780600319360112610163576020600354604051908152f35b503461016357604060031936011261016357600435610fc8612ab1565b90600554811015610bb957604083826cffffffffffffffffffffffffff9360809652600660205273ffffffffffffffffffffffffffffffffffffffff61100f848420612d85565b951682526007602052828220908252602052208161107560405161103281612ba5565b835495838716825283602083019760681c1687528361106a600282600189015416976040860198895201549260608501938452613f24565b92511690519161405f565b939094511691511691604051938452602084015260408301526060820152f35b5034610163576110bc6110b06110aa36612b6e565b91613498565b60405191829182612af0565b0390f35b5034610163576110d86110d236612b6e565b91613222565b6040519060208201602083528151809152602060408401920193805b8282106111015784840385f35b9091928551819083915b6005831061112b575050506020959095019460a0019291600101906110f4565b602080600192845181520192019201919061110b565b5034610163576040600319360112610163576110bc6110b060243560043561306f565b503461016357602060031936011261016357600435611181613908565b6107d081116111c45760407f3c4e14c3f450a320de9683e5ffeec6e95e4e02755f862e36ff6f8f6c21086f6091600454908060045582519182526020820152a180f35b6004827f7c968c98000000000000000000000000000000000000000000000000000000008152fd5b50346101635760206003193601126101635760406101c091600435815260066020522080549073ffffffffffffffffffffffffffffffffffffffff6001820154169064ffffffffff73ffffffffffffffffffffffffffffffffffffffff60028301541660038301546004840154916cffffffffffffffffffffffffff60066005870154960154169560ff6040519873ffffffffffffffffffffffffffffffffffffffff81168a5260a01c1615156020890152604088015260608701526cffffffffffffffffffffffffff8116608087015263ffffffff8160681c1660a0870152828160881c1660c0870152828160b01c1660e087015260d81c6101008601526fffffffffffffffffffffffffffffffff811661012086015263ffffffff8160801c1661014086015260a01c166101608401526101808301526101a0820152f35b50346101635780600319360112610163576020600454604051908152f35b5034610163578060031936011261016357602073ffffffffffffffffffffffffffffffffffffffff60025416604051908152f35b503461016357806003193601126101635773ffffffffffffffffffffffffffffffffffffffff6020915416604051908152f35b5034610163576020600319360112610163576004356113ce613672565b60055481101561162d57808252600660205260408220906002820173ffffffffffffffffffffffffffffffffffffffff8154163303611605576003830192835460d81c6115dd5761141e83613957565b6cffffffffffffffffffffffffff8454166cffffffffffffffffffffffffff60068301541690036cffffffffffffffffffffffffff81116108975784547affffffffffffffffffffffffffffffffffffffffffffffffffffff164260d81b7fffffffffff000000000000000000000000000000000000000000000000000000161785556cffffffffffffffffffffffffff1693846114e5575b5050507fcb217dc5cde7608105c5fa8af63d961a4210e06dc3c3dafa9396d05251952f858380a36001805580f35b73ffffffffffffffffffffffffffffffffffffffff916115196cffffffffffffffffffffffffff6001935416871115612f2a565b015416604051907f70a08231000000000000000000000000000000000000000000000000000000008252306004830152602082602481845afa80156115d25785928791611597575b5061158f9361158773ffffffffffffffffffffffffffffffffffffffff92851115612f2a565b541690613ec2565b3880806114b7565b939250506020833d6020116115ca575b816115b460209383612c45565b810103126106865791519091849161158f611561565b3d91506115a7565b6040513d88823e3d90fd5b6004857f4cd78777000000000000000000000000000000000000000000000000000000008152fd5b6004847f77dc3587000000000000000000000000000000000000000000000000000000008152fd5b6004827ffc3d5913000000000000000000000000000000000000000000000000000000008152fd5b503461016357806003193601126101635761166e613908565b8073ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b5034610163576020600319360112610163577f5de302eeb1c80d4fb0c0953b692353f09ddf431411b8eb2034d5e857695619126040600435611713613908565b600354908060035582519182526020820152a180f35b50346101635780600319360112610163576020604051610e108152f35b5034610163578060031936011261016357506110bc604051611769604082612c45565b600581527f312e312e3000000000000000000000000000000000000000000000000000000060208201526040519182916020835260208301906128b1565b503461016357604060031936011261016357604060809173ffffffffffffffffffffffffffffffffffffffff6117db612a8e565b168152600760205281812060243582526020522080549060026cffffffffffffffffffffffffff600183015416910154906cffffffffffffffffffffffffff60405193818116855260681c16602084015260408301526060820152f35b5060c06003193601126101635761184d612a8e565b60243590811515908183036122c4576044359173ffffffffffffffffffffffffffffffffffffffff831680930361085657606435936cffffffffffffffffffffffffff85168095036122c05760843564ffffffffff81168091036122bc5760a4359163ffffffff83168093036122b8576118c5613672565b73ffffffffffffffffffffffffffffffffffffffff851694851561229057861561229057871561226857610e108410801561225b575b612233578315612206576cffffffffffffffffffffffffff84890416156121de5762093a804201804211610aee5783116121b65760035480340361218e578981849261212f575b505061194d91613d4c565b156121075761204c575b6040517f313ce567000000000000000000000000000000000000000000000000000000008152602081600481895afa9081156120415760049160ff918a91612012575b501610611fea576005549560018701808811611fbd576005556040516119bf81612bf0565b858152888060208301878152838b604082018c81526060830190338252608084019189835260a085018c815260c08601908c825260e08701928984526101008801948a86526101208901998b8b528b6101408b0199818b526101608c019b828d5261018081019e8f526101a0019e8f528152600660205260409020809e5173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681547fffffffffffffffffffffffff0000000000000000000000000000000000000000161790555115158d549060a01b74ff000000000000000000000000000000000000000016907fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16178d555173ffffffffffffffffffffffffffffffffffffffff1660018d019073ffffffffffffffffffffffffffffffffffffffff1681547fffffffffffffffffffffffff0000000000000000000000000000000000000000161790555173ffffffffffffffffffffffffffffffffffffffff1660028c019073ffffffffffffffffffffffffffffffffffffffff1681547fffffffffffffffffffffffff00000000000000000000000000000000000000001617905560038b0194516cffffffffffffffffffffffffff166cffffffffffffffffffffffffff1685547fffffffffffffffffffffffffffffffffffffff000000000000000000000000001617855551908454905160881b75ffffffffff0000000000000000000000000000000000169160681b70ffffffff0000000000000000000000000016907fffffffffffffffffffff000000000000000000ffffffffffffffffffffffffff16171783555164ffffffffff16611c8b9083907fffffffffff0000000000ffffffffffffffffffffffffffffffffffffffffffff7affffffffff0000000000000000000000000000000000000000000083549260b01b169116179055565b5181547affffffffffffffffffffffffffffffffffffffffffffffffffffff1660d89190911b7fffffffffff000000000000000000000000000000000000000000000000000000161790559151600486018054935173ffffffff0000000000000000000000000000000060809190911b166fffffffffffffffffffffffffffffffff9092167fffffffffffffffffffffffff0000000000000000000000000000000000000000909416939093171782555181547fffffffffffffff0000000000ffffffffffffffffffffffffffffffffffffffff1660a09190911b78ffffffffff000000000000000000000000000000000000000016179055516005830155516cffffffffffffffffffffffffff1690600601906cffffffffffffffffffffffffff1681547fffffffffffffffffffffffffffffffffffffff00000000000000000000000000161790556040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201528080885a92602491602094fa908115611fb2578991611f80575b50611e6f6040517f23b872dd00000000000000000000000000000000000000000000000000000000602082015233602482015230604482015283606482015260648152611e69608482612c45565b886143e6565b604051907f70a082310000000000000000000000000000000000000000000000000000000082523060048301526020826024818b5afa8015611f755783928b91611f3c575b5090611ebf91612f60565b03611f14576020975060405193878552888501526040840152606083015260808201527f2d07ab3d8a0000fcc86e521ba2df8be9ba7dd9159bf0cefedf38cc1e1e4b9b3460a03392a460018055604051908152f35b6004887f9d0ede4c000000000000000000000000000000000000000000000000000000008152fd5b919250506020813d602011611f6d575b81611f5960209383612c45565b810103126106865751829190611ebf611eb4565b3d9150611f4c565b6040513d8c823e3d90fd5b90506020813d602011611faa575b81611f9b60209383612c45565b81010312610686575138611e1b565b3d9150611f8e565b6040513d8b823e3d90fd5b6024897f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b6004877f952abc9d000000000000000000000000000000000000000000000000000000008152fd5b612034915060203d60201161203a575b61202c8183612c45565b810190612f11565b3861199a565b503d612022565b6040513d8a823e3d90fd5b6040517f18160ddd000000000000000000000000000000000000000000000000000000008152602081600481885afa80156120415788906120c7575b6d04ee2d6d415b85acef810000000091501115611957576004877f15161ded000000000000000000000000000000000000000000000000000000008152fd5b506020813d6020116120ff575b816120e160209383612c45565b81010312610686576d04ee2d6d415b85acef81000000009051612088565b3d91506120d4565b6004887f98bba0ae000000000000000000000000000000000000000000000000000000008152fd5b81809350809173ffffffffffffffffffffffffffffffffffffffff600254165af1612158612ee1565b501561216657818938611942565b6004897f8004a38f000000000000000000000000000000000000000000000000000000008152fd5b60048a7f80995ba7000000000000000000000000000000000000000000000000000000008152fd5b6004897f6a30cc01000000000000000000000000000000000000000000000000000000008152fd5b6004897f28d5a80d000000000000000000000000000000000000000000000000000000008152fd5b6024897f4e487b710000000000000000000000000000000000000000000000000000000081526012600452fd5b6004897f49b08957000000000000000000000000000000000000000000000000000000008152fd5b506312cc030084116118fb565b6004897f4719ffdb000000000000000000000000000000000000000000000000000000008152fd5b6004897f92dd44ae000000000000000000000000000000000000000000000000000000008152fd5b8780fd5b8680fd5b8580fd5b8380fd5b50346101635780600319360112610163575060206312cc0300604051908152f35b503461016357602060031936011261016357600435612306613672565b60055481101561162d578061231d61232492613957565b3390613b07565b6001805580f35b50346101635760206003193601126101635773ffffffffffffffffffffffffffffffffffffffff61235a612a8e565b612362613908565b1680156123dd5760407fc49018c9854c68de72ec478f1962e3d872a70aadb0dba137983fefcedf687e039160025490807fffffffffffffffffffffffff000000000000000000000000000000000000000083161760025573ffffffffffffffffffffffffffffffffffffffff8351921682526020820152a180f35b6004827f9a561068000000000000000000000000000000000000000000000000000000008152fd5b503461016357602060031936011261016357600435612422612ce1565b5060055481101561162d57612444604083836110bc9552600660205220612d85565b61246473ffffffffffffffffffffffffffffffffffffffff825116613747565b61248773ffffffffffffffffffffffffffffffffffffffff604084015116613747565b916040519361249585612ba5565b845260208401526040830152606082015260405191829160208352602083019061292c565b5034610163576020600319360112610163576004356124d7613672565b60055481101561162d573382526007602052604082208183526020526cffffffffffffffffffffffffff6040832054169081156128665780835260066020526040832033845260076020526040842082855260205260408420836cffffffffffffffffffffffffff8254161061283e578491849161255485613957565b6cffffffffffffffffffffffffff8084818454160316167fffffffffffffffffffffffffffffffffffffff0000000000000000000000000082541617815560048201906fffffffffffffffffffffffffffffffff8085818554160316167fffffffffffffffffffffffffffffffff000000000000000000000000000000008354161782556cffffffffffffffffffffffffff8154169060026125fa6005860154846140ae565b910155156127bb575b6fffffffffffffffffffffffffffffffff81541615806127a4575b8061278d575b612737575b50805460ff8160a01c16600014612692575061265e925073ffffffffffffffffffffffffffffffffffffffff33915416613ec2565b604051908382527fe2596fac793f3c02e1699ee0e62e33a967c44c62f723dc794446361c15278e3660203393a46001805580f35b73ffffffffffffffffffffffffffffffffffffffff16915050803b15610e5a57819060c4604051809481937ff242432a00000000000000000000000000000000000000000000000000000000835230600484015233602484015281604484015288606484015260a060848401528160a48401525af1801561272c57612718575b5061265e565b8361272591949294612c45565b9138612712565b6040513d86823e3d90fd5b600382017fffffffffff0000000000ffffffffffffffffffffffffffffffffffffffffffff81541690557fffffffffffffff0000000000ffffffffffffffffffffffffffffffffffffffff815416905538612629565b5064ffffffffff600383015460b01c164210612624565b5064ffffffffff600383015460b01c16151561261e565b63ffffffff9193508092505460801c1680156108975781547fffffffffffffffffffffffff00000000ffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90910160801b73ffffffff000000000000000000000000000000001617815584918491612603565b6004857fa1c57736000000000000000000000000000000000000000000000000000000008152fd5b6004837f4719ffdb000000000000000000000000000000000000000000000000000000008152fd5b60005b8381106128a15750506000910152565b8181015183820152602001612891565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f6020936128ed8151809281875287808801910161288e565b0116010190565b90604060ff8161292261291086516060875260608701906128b1565b602087015186820360208801526128b1565b9401511691015290565b612a8b91815181526cffffffffffffffffffffffffff6101a0602084015173ffffffffffffffffffffffffffffffffffffffff815116602085015260208101511515604085015273ffffffffffffffffffffffffffffffffffffffff604082015116606085015273ffffffffffffffffffffffffffffffffffffffff60608201511660808501528260808201511660a085015263ffffffff60a08201511660c085015264ffffffffff60c08201511660e085015264ffffffffff60e08201511661010085015264ffffffffff610100820151166101208501526fffffffffffffffffffffffffffffffff6101208201511661014085015263ffffffff6101408201511661016085015264ffffffffff61016082015116610180850152610180810151828501520151166101c08201526060612a7960408401516102206101e08501526102208401906128f4565b920151906102008184039101526128f4565b90565b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361068657565b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361068657565b602435906cffffffffffffffffffffffffff8216820361068657565b602081016020825282518091526040820191602060408360051b8301019401926000915b838310612b2357505050505090565b9091929394602080612b5f837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08660019603018752895161292c565b97019301930191939290612b14565b600319606091011261068657600435906024359060443573ffffffffffffffffffffffffffffffffffffffff811681036106865790565b6080810190811067ffffffffffffffff821117612bc157604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6101c0810190811067ffffffffffffffff821117612bc157604052565b6060810190811067ffffffffffffffff821117612bc157604052565b60a0810190811067ffffffffffffffff821117612bc157604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117612bc157604052565b67ffffffffffffffff8111612bc157601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60405190612ccd82612c0d565b600060408360608152606060208201520152565b60405190612cee82612ba5565b8160008152604051612cff81612bf0565b6000815260006020820152600060408201526000606082015260006080820152600060a0820152600060c0820152600060e08201526000610100820152600061012082015260006101408201526000610160820152600061018082015260006101a08201526020820152612d71612cc0565b60408201526060612d80612cc0565b910152565b90604051612d9281612bf0565b6101a06cffffffffffffffffffffffffff6006839560ff815473ffffffffffffffffffffffffffffffffffffffff8116875260a01c161515602086015273ffffffffffffffffffffffffffffffffffffffff600182015416604086015273ffffffffffffffffffffffffffffffffffffffff60028201541660608601526003810154838116608087015263ffffffff8160681c1660a087015264ffffffffff8160881c1660c087015264ffffffffff8160b01c1660e087015260d81c61010086015264ffffffffff60048201546fffffffffffffffffffffffffffffffff811661012088015263ffffffff8160801c1661014088015260a01c166101608601526005810154610180860152015416910152565b91908201809211612eb257565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b3d15612f0c573d90612ef282612c86565b91612f006040519384612c45565b82523d6000602084013e565b606090565b90816020910312610686575160ff811681036106865790565b15612f3157565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b91908203918211612eb257565b67ffffffffffffffff8111612bc15760051b60200190565b60405190612f94602083612c45565b600080835282815b828110612fa857505050565b602090612fb3612ce1565b82828501015201612f9c565b90612fc982612f6d565b612fd66040519182612c45565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe06130048294612f6d565b019060005b82811061301557505050565b602090613020612ce1565b82828501015201613009565b80518210156130405760209160051b010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9190808310801590613196575b61316c57600554908181111561316557505b8083101561315a57826130a091612f60565b6130a981612fbf565b9260005b8281106130b957505050565b806130c660019284612ea5565b8060005260066020526130dc6040600020612d85565b6130fc73ffffffffffffffffffffffffffffffffffffffff825116613747565b61311f73ffffffffffffffffffffffffffffffffffffffff604084015116613747565b916040519361312d85612ba5565b8452602084015260408301526060820152613148828861302c565b52613153818761302c565b50016130ad565b509050612a8b612f85565b905061308e565b7f20a305de0000000000000000000000000000000000000000000000000000000060005260046000fd5b506101f46131a48483612f60565b1161307c565b906131b482612f6d565b6131c16040519182612c45565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe06131ef8294612f6d565b019060005b82811061320057505050565b60209060a0604051906132138183612c45565b368237828285010152016131f4565b90929192808210801590613484575b61316c57600554908181111561347d57505b8082101561343457926132578285036131aa565b93600092915b8183106132aa57505050613270816131aa565b9260005b82811061328057505050565b8061328d6001928461302c565b51613298828861302c565b526132a3818761302c565b5001613274565b90919273ffffffffffffffffffffffffffffffffffffffff821660005260076020526040600020846000526020526040600020604051906132ea82612ba5565b8054916cffffffffffffffffffffffffff8084169384835260681c1692602082019380855260026cffffffffffffffffffffffffff600186015416946040850195865201549160608401928352158091819261342b575b5061341d579260019593926cffffffffffffffffffffffffff928796946133d1578391613387918c60005260066020528361106a6133826040600020612d85565b613f24565b604051959161339587612c29565b8c87526020870152604086015251166060840152511660808201526133ba828a61302c565b526133c5818961302c565b5001935b01919061325d565b505081604051936133e185612c29565b8a85526000602086015260006040860152511660608401525116608082015261340a828a61302c565b52613415818961302c565b5001936133c9565b5050505050926001906133c9565b90501538613341565b50506040519091506000613449602083612c45565b81526000805b81811061345b57505090565b60209060a06040519061346e8183612c45565b3682378282860101520161344f565b9050613243565b506103e86134928383612f60565b11613231565b90929192808210801590613616575b61316c57600554908181111561360f57505b8082101561360357926134cd828503612fbf565b93600092915b818310613520575050506134e681612fbf565b9260005b8281106134f657505050565b806135036001928461302c565b5161350e828861302c565b52613519818761302c565b50016134ea565b9091928360005260066020526135396040600020612d85565b73ffffffffffffffffffffffffffffffffffffffff60608201511673ffffffffffffffffffffffffffffffffffffffff8416036135f9576001918161359573ffffffffffffffffffffffffffffffffffffffff85945116613747565b6135b873ffffffffffffffffffffffffffffffffffffffff604084015116613747565b90604051926135c684612ba5565b8984526020840152604083015260608201526135e2828a61302c565b526135ed818961302c565b5001935b0191906134d3565b50926001906135f1565b50509050612a8b612f85565b90506134b9565b506101f46136248383612f60565b116134a7565b9064ffffffffff8091169116019064ffffffffff8211612eb257565b906cffffffffffffffffffffffffff809116911601906cffffffffffffffffffffffffff8211612eb257565b600260015414613683576002600155565b7f3ee5aeb50000000000000000000000000000000000000000000000000000000060005260046000fd5b604051906136bc604083612c45565b600982527f756e646566696e656400000000000000000000000000000000000000000000006020830152565b6020818303126106865780519067ffffffffffffffff8211610686570181601f8201121561068657805161371b81612c86565b926137296040519485612c45565b8184526020828401011161068657612a8b916020808501910161288e565b61374f612cc0565b506137586136ad565b6137606136ad565b600090818060405160208101907f95d89b410000000000000000000000000000000000000000000000000000000082526004815261379f602482612c45565b519087614e20fa6137ae612ee1565b90806138fc575b6138dd575b508160ff9394818060405160208101907f06fdde03000000000000000000000000000000000000000000000000000000008252600481526137fc602482612c45565b519084614e20fa61380b612ee1565b90806138d1575b6138b3575b50819060405160208101907f313ce56700000000000000000000000000000000000000000000000000000000825260048152613854602482612c45565b5191614e20fa613862612ee1565b90806138a8575b61388c575b506040519361387c85612c0d565b8452602084015216604082015290565b6138a191925060208082518301019101612f11565b903861386e565b506020815114613869565b82919350806020806138ca935183010191016136e8565b9290613817565b50604081511015613812565b60ff93506138f58160208086945183010191016136e8565b93506137ba565b506040815110156137b5565b73ffffffffffffffffffffffffffffffffffffffff60005416330361392957565b7f118cdaa7000000000000000000000000000000000000000000000000000000006000523360045260246000fd5b6000526006602052604060002064ffffffffff421690600381015464ffffffffff8160b01c16906004830192835464ffffffffff8160a01c169284158015613afd575b613af457613a65966fffffffffffffffffffffffffffffffff6139f964ffffffffff9763ffffffff8560681c1693896139d7868860d81c9461362a565b169180151580613aeb575b613ae3575b5081811115613adb5750965b87612f60565b9316151580613ad2575b613a67575b5050506005613a1961338283612d85565b91015582547fffffffffffffff0000000000ffffffffffffffffffffffffffffffffffffffff16911660a01b78ffffffffff000000000000000000000000000000000000000016179055565b565b6cffffffffffffffffffffffffff9283613a8293169061433f565b166cffffffffffffffffffffffffff613aa2600684019282845416613646565b167fffffffffffffffffffffffffffffffffffffff00000000000000000000000000825416179055388080613a08565b50821515613a03565b9050966139f3565b9150386139e7565b508281106139e2565b50505050505050565b508387111561399a565b9081600052600660205260406000209173ffffffffffffffffffffffffffffffffffffffff8216918260005260076020526040600020826000526020526040600020906005850154918054956002820192613b75845480966cffffffffffffffffffffffffff8b169061405f565b9190613b818382612ea5565b95613ba16cffffffffffffffffffffffffff600387015416881115612f2a565b8615613d2757613bd46020977f39ff35f451926ff5cd1926ae40ef218b8613cc15a7e9b567cbdecdfa65861b7f99612ea5565b90556cffffffffffffffffffffffffff8116997fffffffffffff00000000000000000000000000ffffffffffffffffffffffffff79ffffffffffffffffffffffffff00000000000000000000000000613c3f8d6cffffffffffffffffffffffffff8560681c16613646565b60681b16911617855560016cffffffffffffffffffffffffff841695016cffffffffffffffffffffffffff613c778782845416613646565b167fffffffffffffffffffffffffffffffffffffff0000000000000000000000000082541617905580613cfc575b505080613cb8575b5050604051908152a4565b73ffffffffffffffffffffffffffffffffffffffff6001613cf59301541673ffffffffffffffffffffffffffffffffffffffff6002541690613ec2565b3880613cad565b613d209173ffffffffffffffffffffffffffffffffffffffff600186015416613ec2565b3880613ca5565b5050505050505050505050565b90816020910312610686575180151581036106865790565b9015613e795760008060405160208101907f01ffc9a70000000000000000000000000000000000000000000000000000000082527fd9b67a2600000000000000000000000000000000000000000000000000000000602482015260248152613db5604482612c45565b519084614e20fa613dc4612ee1565b81613e6d575b81613e53575b50613e4d576000809160405160208101907f70a0823100000000000000000000000000000000000000000000000000000000825230602482015260248152613e19604482612c45565b5191614e20fa613e27612ee1565b9015908115613e40575b50613e3b57600190565b600090565b6020915051141538613e31565b50600090565b613e67915060208082518301019101613d34565b38613dd0565b80516020149150613dca565b6000809160405160208101907efdd58e00000000000000000000000000000000000000000000000000000000825230602482015283604482015260448152613e19606482612c45565b613a659273ffffffffffffffffffffffffffffffffffffffff604051937fa9059cbb000000000000000000000000000000000000000000000000000000006020860152166024840152604483015260448252613f1f606483612c45565b6143e6565b64ffffffffff42169064ffffffffff60e0820151169182158015614040575b801561402a575b61400757613fa99064ffffffffff613f6e60a085019563ffffffff8751169061362a565b169064ffffffffff6101008501511680151580614021575b614019575b508181111561401257505b64ffffffffff6101608401511690612f60565b91821561400757613fdd612a8b936140019263ffffffff6cffffffffffffffffffffffffff6080870151169151169161433f565b6fffffffffffffffffffffffffffffffff6101206101808501519401511690614188565b90612ea5565b506101809150015190565b9050613f96565b915038613f8b565b50828110613f86565b5064ffffffffff61016083015116811115613f4a565b506fffffffffffffffffffffffffffffffff6101208301511615613f43565b81156140a35761406e916140ae565b90808211156140995761408091612f60565b61409661408f600454836142ae565b8092612f60565b91565b5050600090600090565b505050600090600090565b9190916000838202917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8582099183808410930392808403931461417057826c0c9f2c9cd04674edea40000000111561414857507f7d33c22789773a07feda8b6f0930e26fa397c439f1d5cf4b2eb27d7306d2dc9993946c0c9f2c9cd04674edea40000000910990828211900360e21b9103601e1c170290565b807f227bc1530000000000000000000000000000000000000000000000000000000060049252fd5b5050506c0c9f2c9cd04674edea400000009192500490565b906c0c9f2c9cd04674edea400000008202907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6c0c9f2c9cd04674edea400000008409928280851094039380850394146142725783821115614248576c0c9f2c9cd04674edea40000000829109816000038216809204600281600302188082026002030280820260020302808202600203028082026002030280820260020302809102600203029360018380600003040190848311900302920304170290565b7f227bc1530000000000000000000000000000000000000000000000000000000060005260046000fd5b508092501561427f570490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b9190916000838202917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff858209918380841093039280840393146143325782612710111561414857507fbc01a36e2eb1c432ca57a786c226809d495182a9930be0ded288ce703afb7e919394612710910990828211900360fc1b910360041c170290565b5050506127109192500490565b9091828202917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff848209938380861095039480860395146143d8578483111561424857829109816000038216809204600281600302188082026002030280820260020302808202600203028082026002030280820260020302809102600203029360018380600003040190848311900302920304170290565b50508092501561427f570490565b60008073ffffffffffffffffffffffffffffffffffffffff61441d93169360208151910182865af1614416612ee1565b908361447b565b8051908115159182614460575b50506144335750565b7f5274afe70000000000000000000000000000000000000000000000000000000060005260045260246000fd5b6144739250602080918301019101613d34565b15388061442a565b906144ba575080511561449057805190602001fd5b7f1425ea420000000000000000000000000000000000000000000000000000000060005260046000fd5b8151158061450f575b6144cb575090565b73ffffffffffffffffffffffffffffffffffffffff907f9996b315000000000000000000000000000000000000000000000000000000006000521660045260246000fd5b50803b156144c356fea2646970667358221220150da3fea6532801b99af66d7095b133277680650ec51a9816fb116629638e4964736f6c634300081e0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000082ca6d313bffe56e9096b16633dfd414148d66b1000000000000000000000000000000000000000000000000000c6f3b40b6c0000000000000000000000000000000000000000000000000000000000000000190
-----Decoded View---------------
Arg [0] : protocolBeneficiary_ (address): 0x82CA6d313BffE56E9096b16633dfD414148D66b1
Arg [1] : creationFee_ (uint256): 3500000000000000
Arg [2] : claimFee_ (uint256): 400
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 00000000000000000000000082ca6d313bffe56e9096b16633dfd414148d66b1
Arg [1] : 000000000000000000000000000000000000000000000000000c6f3b40b6c000
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000190
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.01
Net Worth in ETH
0.000004
Token Allocations
POL
100.00%
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|---|---|---|---|---|
| POL | 100.00% | $0.122616 | 0.1 | $0.012262 |
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ 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.