Source Code
Latest 25 from a total of 1,341 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Claim | 36433266 | 10 hrs ago | IN | 0 ETH | 0.0000085 | ||||
| Claim | 36422257 | 11 hrs ago | IN | 0 ETH | 0.00000741 | ||||
| Claim | 36402172 | 13 hrs ago | IN | 0 ETH | 0.00000847 | ||||
| Claim | 36399073 | 14 hrs ago | IN | 0 ETH | 0.00000818 | ||||
| Claim | 36391688 | 14 hrs ago | IN | 0 ETH | 0.00000741 | ||||
| Claim | 36383749 | 16 hrs ago | IN | 0 ETH | 0.00000741 | ||||
| Claim | 36354541 | 19 hrs ago | IN | 0 ETH | 0.00000818 | ||||
| Claim | 36329527 | 23 hrs ago | IN | 0 ETH | 0.00000847 | ||||
| Claim | 36316138 | 25 hrs ago | IN | 0 ETH | 0.00000727 | ||||
| Claim | 36306943 | 26 hrs ago | IN | 0 ETH | 0.00000741 | ||||
| Claim | 36303234 | 27 hrs ago | IN | 0 ETH | 0.00000742 | ||||
| Claim | 36262308 | 32 hrs ago | IN | 0 ETH | 0.00000743 | ||||
| Claim | 36256726 | 33 hrs ago | IN | 0 ETH | 0.00000743 | ||||
| Claim | 36244402 | 35 hrs ago | IN | 0 ETH | 0.00000819 | ||||
| Claim | 36241741 | 36 hrs ago | IN | 0 ETH | 0.00000819 | ||||
| Claim | 36239020 | 36 hrs ago | IN | 0 ETH | 0.00000423 | ||||
| Claim | 36238951 | 36 hrs ago | IN | 0 ETH | 0.00000742 | ||||
| Claim | 36215823 | 40 hrs ago | IN | 0 ETH | 0.00000741 | ||||
| Claim | 36203798 | 42 hrs ago | IN | 0 ETH | 0.00000818 | ||||
| Claim | 36201675 | 42 hrs ago | IN | 0 ETH | 0.00000741 | ||||
| Claim | 36189809 | 44 hrs ago | IN | 0 ETH | 0.00000741 | ||||
| Claim | 36178232 | 46 hrs ago | IN | 0 ETH | 0.00000847 | ||||
| Claim | 36177933 | 46 hrs ago | IN | 0 ETH | 0.00000848 | ||||
| Claim | 36163725 | 2 days ago | IN | 0 ETH | 0.0000087 | ||||
| Claim | 36155154 | 2 days ago | IN | 0 ETH | 0.00000741 |
Latest 1 internal transaction
Advanced mode:
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 29812404 | 45 days ago | Contract Creation | 0 ETH |
Cross-Chain Transactions
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
ERC20StakingPointsRewardsLinearPool
Compiler Version
v0.8.30+commit.73712a01
ZkSolc Version
v1.5.15
Optimization Enabled:
Yes with Mode 3
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity 0.8.30;
import {LinearPool} from "@animoca/ethereum-contracts-5.0/contracts/staking/linear/LinearPool.sol";
import {ERC20StakingLinearPool} from "@animoca/ethereum-contracts-5.0/contracts/staking/linear/stake/ERC20StakingLinearPool.sol";
import {LinearPool_PointsRewards} from "./reward/LinearPool_PointsRewards.sol";
import {IForwarderRegistry} from "@animoca/ethereum-contracts-5.0/contracts/metatx/interfaces/IForwarderRegistry.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IPointsV2} from "../../points/interface/IPointsV2.sol";
/// @title ERC20StakingPointsRewardsLinearPool
/// @notice This contract is used to stake ERC20 tokens and obtain Points rewards.
/// @notice Staking can be done by the user or via a claim contract.
contract ERC20StakingPointsRewardsLinearPool is ERC20StakingLinearPool, LinearPool_PointsRewards {
address public immutable CLAIM_CONTRACT;
/// @dev Reverts with {InvalidPointsContract} if the points contract address is zero.
/// @param claimContract The address of the claim contract.
/// @param stakingToken The ERC20 token used for staking.
/// @param pointsContract The address of the points contract.
/// @param depositReasonCode The reason code for the deposit.
constructor(
address claimContract,
IERC20 stakingToken,
IPointsV2 pointsContract,
bytes32 depositReasonCode
) ERC20StakingLinearPool(stakingToken, 64, IForwarderRegistry(address(0))) LinearPool_PointsRewards(pointsContract, depositReasonCode) {
CLAIM_CONTRACT = claimContract;
}
/// @inheritdoc ERC20StakingLinearPool
function onERC20Received(address operator, address from, uint256 value, bytes calldata data) external virtual override returns (bytes4) {
require(msg.sender == address(STAKING_TOKEN), InvalidToken());
bool requiresTransfer = false;
if (operator == CLAIM_CONTRACT) {
address staker = abi.decode(data, (address));
_stake(staker, abi.encode(requiresTransfer, abi.encode(value)));
} else {
_stake(from, abi.encode(requiresTransfer, abi.encode(value)));
}
return this.onERC20Received.selector;
}
function claim() external {
super.claim(msg.data[:0]); // using msg.data[:0] as a workaround since only calldata is accepted
}
/// @inheritdoc LinearPool_PointsRewards
function _computeClaim(
address staker,
uint256 reward,
bytes calldata claimData
) internal virtual override(LinearPool, LinearPool_PointsRewards) returns (uint256 claimed, uint256 unclaimed) {
return LinearPool_PointsRewards._computeClaim(staker, reward, claimData);
}
/// @inheritdoc LinearPool_PointsRewards
function _computeAddReward(address rewarder, uint256 reward) internal virtual override(LinearPool, LinearPool_PointsRewards) {
LinearPool_PointsRewards._computeAddReward(rewarder, reward);
}
}// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.28;
interface IPointsV2 {
/// @notice Emitted when an amount is deposited to a balance.
/// @param depositor The depositor.
/// @param reasonCode The reason code of the deposit.
/// @param holder The holder of the balance deposited to.
/// @param amount The amount deposited.
event Deposited(address indexed depositor, bytes32 indexed reasonCode, address indexed holder, uint256 amount);
/// @notice Emitted when an approval is made.
/// @param holder The holder of the balance.
/// @param spender The spender allowed to spend the balance.
/// @param amount The amount approved.
event Approval(address indexed holder, address indexed spender, uint256 amount);
/// @notice Emitted when an amount is spent from a balance.
/// @param spender The spender of the balance.
/// @param holder The holder of the balance spent from.
/// @param amount The amount spent.
event Spent(address indexed spender, address indexed holder, uint256 amount);
/// @notice Deposits an amount to a holder's balance for a given reason code.
/// @dev Emits a {Deposited} event.
/// @param holder The holder of the balance to deposit to.
/// @param amount The amount to deposit.
/// @param depositReasonCode The reason code for the deposit.
function deposit(address holder, uint256 amount, bytes32 depositReasonCode) external;
/// @notice Approves a spender to spend an amount from the caller's balance.
/// @dev Emits an {Approval} event.
/// @param spender The spender allowed to spend the balance.
/// @param amount The amount approved.
function approve(address spender, uint256 amount) external;
/// @notice Approves a spender to spend an amount from a holder's balance using a signature.
/// @dev Emits an {Approval} event.
/// @param holder The holder of the balance.
/// @param spender The spender allowed to spend the balance.
/// @param amount The amount approved.
/// @param deadline The deadline timestamp by which the signature must be submitted.
/// @param signature The signature of the approval.
function approveWithSignature(address holder, address spender, uint256 amount, uint256 deadline, bytes calldata signature) external;
/// @notice Spends an amount from a holder's balance.
/// @dev Emits an {Approval} event if the caller is not the holder.
/// @dev Emits a {Spent} event.
/// @param holder The holder of the balance to spend from.
/// @param amount The amount to spend.
function spendFrom(address holder, uint256 amount) external;
/// @notice Spends an amount and calls a target contract with data.
/// @dev Emits a {Spent} event.
/// @param amount The amount to spend.
/// @param target The target contract to call.
/// @param data The data to call the target contract with.
function spendAndCall(uint256 amount, address target, bytes calldata data) external;
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.30;
import {IPointsV2} from "../../../points/interface/IPointsV2.sol";
/// @title LinearPool_PointsRewards
/// @notice This contract is used to handle the points rewards for linear pools.
// solhint-disable-next-line contract-name-capwords
abstract contract LinearPool_PointsRewards {
IPointsV2 public immutable POINTS_CONTRACT;
bytes32 public immutable DEPOSIT_REASON_CODE;
error InvalidPointsContract();
/// @dev Reverts with {InvalidPointsContract} if the points contract address is zero.
/// @param pointsContract The address of the points contract.
/// @param depositReasonCode The reason code for the deposit.
constructor(IPointsV2 pointsContract, bytes32 depositReasonCode) {
require(address(pointsContract) != address(0), InvalidPointsContract());
POINTS_CONTRACT = pointsContract;
DEPOSIT_REASON_CODE = depositReasonCode;
}
/// @notice Deposits `reward` points to the `sender`'s account.
/// @param sender The address of the user receiving the points.
/// @param reward The amount of points to be deposited.
/// @return claimed The amount of points claimed.
/// @return unclaimed The amount of points unclaimed (always 0).
function _computeClaim(address sender, uint256 reward, bytes calldata) internal virtual returns (uint256 claimed, uint256 unclaimed) {
claimed = reward;
unclaimed = 0;
POINTS_CONTRACT.deposit(sender, reward, DEPOSIT_REASON_CODE);
}
/// @notice Computes the reward for a staker.
/// @dev This function is empty since the rewards do not need to be transferred to this contract.
function _computeAddReward(address, uint256) internal virtual {}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
/// @title Meta-Transactions Forwarder Registry.
interface IForwarderRegistry {
/// @notice Checks whether an account is as an approved meta-transaction forwarder for a sender account to a target contract.
/// @param sender The sender account.
/// @param forwarder The forwarder account.
/// @param target The target contract.
/// @return isApproved True if `forwarder` is an approved meta-transaction forwarder for `sender` to `target`, false otherwise.
function isApprovedForwarder(address sender, address forwarder, address target) external view returns (bool isApproved);
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.30;
import {LinearPool} from "./../LinearPool.sol";
import {ERC20Receiver} from "./../../../token/ERC20/ERC20Receiver.sol";
import {TokenRecoveryBase} from "./../../../security/base/TokenRecoveryBase.sol";
import {SafeERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IForwarderRegistry} from "./../../../metatx/interfaces/IForwarderRegistry.sol";
/// @title ERC20StakingLinearPool
/// @notice A linear pool that allows staking of ERC20 tokens.
/// @notice WARNING: This contract is not compatible with fee-on-transfer and rebasing tokens.
abstract contract ERC20StakingLinearPool is LinearPool, ERC20Receiver {
using SafeERC20 for IERC20;
IERC20 public immutable STAKING_TOKEN;
error InvalidToken();
error InvalidRecoveryAmount(uint256 requested, uint256 recoverable);
constructor(
IERC20 stakingToken,
uint8 scalingFactorDecimals,
IForwarderRegistry forwarderRegistry
) LinearPool(scalingFactorDecimals, forwarderRegistry) {
STAKING_TOKEN = stakingToken;
}
/// @notice Callback called when the contract receives ERC20 tokens via the IERC20SafeTransfers functions.
/// @dev Reverts with {InvalidToken} if the sender is not the staking token.
/// @param from The address of the sender.
/// @param value The amount of tokens received.
/// @return bytes4 The function selector of the callback.
function onERC20Received(address, address from, uint256 value, bytes calldata) external virtual override returns (bytes4) {
if (msg.sender != address(STAKING_TOKEN)) revert InvalidToken();
bool requiresTransfer = false;
_stake(from, abi.encode(requiresTransfer, abi.encode(value)));
return this.onERC20Received.selector;
}
/// @inheritdoc LinearPool
/// @param stakeData The data to be used for staking, encoded as (uint256 value)
function stake(bytes calldata stakeData) public payable virtual override {
bool requiresTransfer = true;
_stake(_msgSender(), abi.encode(requiresTransfer, stakeData));
}
/// @inheritdoc LinearPool
/// @param stakeData The data to be used for staking, encoded as (bool requiresTransfer, bytes data) where data is (uint256 value).
function _computeStake(address staker, bytes memory stakeData) internal virtual override returns (uint256 stakePoints) {
(bool requiresTransfer, bytes memory data) = abi.decode(stakeData, (bool, bytes));
stakePoints = abi.decode(data, (uint256));
if (requiresTransfer) {
STAKING_TOKEN.safeTransferFrom(staker, address(this), stakePoints);
}
}
/// @inheritdoc LinearPool
/// @param withdrawData The data to be used for withdrawing, encoded as (uint256 value)
function _computeWithdraw(address staker, bytes memory withdrawData) internal virtual override returns (uint256 stakePoints) {
stakePoints = abi.decode(withdrawData, (uint256));
STAKING_TOKEN.safeTransfer(staker, stakePoints);
}
/// @inheritdoc TokenRecoveryBase
/// @dev Reverts with {InvalidRecoveryAmount} if recovering some STAKING_TOKEN in greater quatity than what is recoverable.
function recoverERC20s(address[] calldata accounts, IERC20[] calldata tokens, uint256[] calldata amounts) public virtual override {
uint256 stakingTokenRecoveryAmount;
for (uint256 i; i < tokens.length; ++i) {
if (tokens[i] == STAKING_TOKEN) {
stakingTokenRecoveryAmount += amounts[i];
}
}
if (stakingTokenRecoveryAmount != 0) {
uint256 recoverable = STAKING_TOKEN.balanceOf(address(this)) - totalStaked;
if (stakingTokenRecoveryAmount > recoverable) {
revert InvalidRecoveryAmount(stakingTokenRecoveryAmount, recoverable);
}
}
super.recoverERC20s(accounts, tokens, amounts);
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.30;
import {ContractOwnership} from "./../../access/ContractOwnership.sol";
import {AccessControl} from "./../../access/AccessControl.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import {TokenRecovery} from "./../../security/TokenRecovery.sol";
import {Context} from "@openzeppelin/contracts/utils/Context.sol";
import {ForwarderRegistryContextBase} from "./../../metatx/base/ForwarderRegistryContextBase.sol";
import {ForwarderRegistryContext} from "./../../metatx/ForwarderRegistryContext.sol";
import {AccessControlStorage} from "./../../access/libraries/AccessControlStorage.sol";
import {SafeERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
import {ILinearPool} from "./interfaces/ILinearPool.sol";
import {IForwarderRegistry} from "./../../metatx/interfaces/IForwarderRegistry.sol";
// design inspired from https://github.com/k06a/Unipool/blob/master/contracts/Unipool.sol
/// @title Linear rewards distribution staking pool.
/// @notice Implements the base logic for linear reward pools, while the nature of the staking and rewards is left to the deriving contracts.
/// @notice Stakes, whether fungible or non-fungible, map to an amount of "stake points", then used to compute the user rewards share.
/// @notice NB: This contract inherits TokenRecovery functions. In the likely event that the deriving contract does keep tokens in stake,
/// @notice the corresponding functions must be overriden to prevent recovering tokens legitimately staked in the contract.
abstract contract LinearPool is ILinearPool, AccessControl, ReentrancyGuard, TokenRecovery, ForwarderRegistryContext {
using AccessControlStorage for AccessControlStorage.Layout;
using SafeERC20 for IERC20;
using Math for uint256;
bytes32 public constant REWARDER_ROLE = "rewarder";
uint256 public immutable SCALING_FACTOR;
uint256 public totalStaked;
uint256 public lastUpdated;
uint256 public rewardRate;
uint256 public rewardPerStakePointStored;
uint256 public distributionEnd;
mapping(address staker => uint256 stakePoints) public staked;
mapping(address staker => uint256 reward) public rewards;
mapping(address staker => uint256 paid) public rewardPerStakePointPaid;
event Staked(address indexed staker, bytes stakeData, uint256 stakePoints);
event Withdrawn(address indexed staker, bytes withdrawData, uint256 stakePoints);
event Claimed(address indexed staker, bytes claimData, uint256 claimed, uint256 unclaimed);
event RewardAdded(address indexed rewarder, uint256 reward, uint256 duration);
error ScalingFactorOutOfBounds();
error InvalidStakeAmount();
error InvalidWithdrawAmount();
error NotEnoughStake(address staker, uint256 stake, uint256 withdraw);
error InvalidClaimSum(uint256 claimable, uint256 claimed, uint256 unclaimed);
error InvalidRewardAmount();
error InvalidDuration();
error RewardDilution(uint256 currentRewardRate, uint256 newRewardRate);
error RewardOverflow();
/// @param scalingFactorDecimals The number of decimals for the scaling factor used to avoid precision loss in reward calculations.
/// @param forwarderRegistry The address of the forwarder registry contract.
/// @dev Reverts with {ScalingFactorOutOfBounds} if scalingFactorDecimals is 77 or more.
/// @dev It is recomended to use a scaling factor as high as possible without causing overflows in reward calculations.
/// Overflow would happen in addReward if the total remaining reward to be distributed overflows when scaled by the SCALING_FACTOR.
/// When rewardPerStakePoint() is computed, the reward is divided by totalStaked, so the highest the total staked gets,
/// the higher the precision loss can be if the scaling factor is too low.
constructor(
uint8 scalingFactorDecimals,
IForwarderRegistry forwarderRegistry
) ContractOwnership(msg.sender) ForwarderRegistryContext(forwarderRegistry) {
require(scalingFactorDecimals < 77, ScalingFactorOutOfBounds());
SCALING_FACTOR = 10 ** scalingFactorDecimals;
}
function _updateReward(address account) internal {
rewardPerStakePointStored = rewardPerStakePoint();
if (block.timestamp >= distributionEnd || totalStaked != 0) {
// ensure rewards before the first staker do not get lost
lastUpdated = lastTimeRewardApplicable();
}
if (account != address(0)) {
rewards[account] = earned(account);
rewardPerStakePointPaid[account] = rewardPerStakePointStored;
}
}
/// @notice Returns the last time rewards are applicable.
/// @return The minimum of the current block timestamp and the distribution end.
function lastTimeRewardApplicable() public view returns (uint256) {
uint256 currentDistributionEnd = distributionEnd;
return block.timestamp < currentDistributionEnd ? block.timestamp : currentDistributionEnd;
}
/// @notice Returns the current reward per stake point.
/// @return The sum of the last stored value and the new rewards since the last update
function rewardPerStakePoint() public view returns (uint256) {
uint256 currentTotalStaked = totalStaked;
if (currentTotalStaked == 0) {
return rewardPerStakePointStored;
}
return rewardPerStakePointStored + (((lastTimeRewardApplicable() - lastUpdated) * rewardRate) / currentTotalStaked);
}
/// @notice Returns the amount of rewards earned by the account.
/// @return The account's stake points times the difference between the current reward per stake point and the last paid reward per stake point.
/// @param account The address of the account to check.
function earned(address account) public view returns (uint256) {
return (staked[account] * (rewardPerStakePoint() - rewardPerStakePointPaid[account])) + rewards[account];
}
/// @notice Stakes to the pool.
/// @dev Reverts with {ReentrancyGuardReentrantCall} if the function is re-entered.
/// @dev Reverts with {InvalidStakeAmount} if the stake amount is 0.
/// @dev Emits a {Staked} event with the staker address, stakeData and stake points.
/// @dev The stakeData is passed to the _computeStake function, which must be implemented in the deriving contract.
/// @param stakeData The data to be used for the stake (encoding freely determined by the deriving contracts).
function stake(bytes calldata stakeData) public payable virtual {
_stake(_msgSender(), stakeData);
}
/// @notice Stakes to the pool.
/// NB: If a reward is ongoing while there are no stakers, the accumulated rewards so far will go to the first staker.
/// @dev Reverts with {ReentrancyGuardReentrantCall} if the function is re-entered.
/// @dev Reverts with {InvalidStakeAmount} if the stake amount is 0.
/// @dev Emits a {Staked} event with the staker address, stakeData and stake points.
/// @dev The stakeData is passed to the _computeStake function, which must be implemented in the deriving contract.
/// @param staker The address of the staker.
/// @param stakeData The data to be used for the stake (encoding freely determined by the deriving contracts).
function _stake(address staker, bytes memory stakeData) internal virtual nonReentrant {
_updateReward(staker);
uint256 stakePoints = _computeStake(staker, stakeData);
require(stakePoints != 0, InvalidStakeAmount());
totalStaked += stakePoints;
staked[staker] += stakePoints;
emit Staked(staker, stakeData, stakePoints);
}
/// @notice Withdraws from the pool.
/// @dev Reverts with {ReentrancyGuardReentrantCall} if the function is re-entered.
/// @dev Reverts with {InvalidWithdrawAmount} if the withdraw amount is 0.
/// @dev Reverts with {NotEnoughStake} if the staker does not have enough stake points to withdraw.
/// @dev Emits a {Withdrawn} event with the staker address, withdrawData and stake points.
/// @dev The withdrawData is passed to the _computeWithdraw function, which must be implemented in the deriving contract.
/// @param withdrawData The data to be used for the withdraw (encoding freely determined by the deriving contracts).
function withdraw(bytes calldata withdrawData) public virtual {
_withdraw(_msgSender(), withdrawData);
}
/// @notice Withdraws from the pool.
/// @dev Reverts with {ReentrancyGuardReentrantCall} if the function is re-entered.
/// @dev Reverts with {InvalidWithdrawAmount} if the withdraw amount is 0.
/// @dev Reverts with {NotEnoughStake} if the staker does not have enough stake points to withdraw.
/// @dev Emits a {Withdrawn} event with the staker address, withdrawData and stake points.
/// @dev The withdrawData is passed to the _computeWithdraw function, which must be implemented in the deriving contract.
/// @param staker The address of the staker.
/// @param withdrawData The data to be used for the withdraw (encoding freely determined by the deriving contracts).
function _withdraw(address staker, bytes memory withdrawData) internal virtual nonReentrant {
_updateReward(staker);
uint256 stakePoints = _computeWithdraw(staker, withdrawData);
require(stakePoints != 0, InvalidWithdrawAmount());
uint256 currentStaked = staked[staker];
require(currentStaked >= stakePoints, NotEnoughStake(staker, currentStaked, stakePoints));
unchecked {
// no underflow possible
staked[staker] = currentStaked - stakePoints;
totalStaked -= stakePoints;
}
emit Withdrawn(staker, withdrawData, stakePoints);
}
/// @notice Claims the rewards for the sender.
/// @dev Emits a {Claimed} event with the staker address, claimData and reward.
/// @param claimData The data to be used in the claim process (encoding freely determined by the deriving contracts).
function claim(bytes calldata claimData) public virtual nonReentrant {
address staker = _msgSender();
_updateReward(staker);
uint256 reward = earned(staker);
if (reward != 0) {
uint256 claimable = reward / SCALING_FACTOR;
uint256 dust = reward % SCALING_FACTOR;
(uint256 claimed, uint256 unclaimed) = _computeClaim(staker, claimable, claimData);
require(claimed + unclaimed == claimable, InvalidClaimSum(claimable, claimed, unclaimed));
rewards[staker] = dust + unclaimed * SCALING_FACTOR;
emit Claimed(staker, claimData, claimed, unclaimed);
}
}
/// @notice Adds rewards to the pool.
/// @notice If there is an ongoing distribution, the new rewards are added to the current distribution:
/// @notice - If the new distribution ends before the current one, the new rewards are added to the current distribution.
/// @notice - If the new distribution ends after the current one, the remaining rewards are added to the new distribution.
/// @dev Reverts with {NotRoleHolder} if the sender does not have the REWARDER_ROLE.
/// @dev Reverts with {InvalidRewardAmount} if the reward amount is 0.
/// @dev Reverts with {InvalidDuration} if the duration is 0.
/// @dev Reverts with {RewardOverflow} if the resulting total reward to be distributed overflows when scaled by the SCALING_FACTOR.
/// @dev Reverts with {RewardDilution} if the new reward rate is lower than the current one.
/// @dev Emits a {RewardAdded} event with the rewarder address, reward amount, and duration.
/// @param reward The amount of rewards to be added.
/// @param duration The duration of the rewards distribution.
function addReward(uint256 reward, uint256 duration) public payable virtual {
address rewarder = _msgSender();
AccessControlStorage.layout().enforceHasRole(REWARDER_ROLE, rewarder);
require(reward != 0, InvalidRewardAmount());
require(duration != 0, InvalidDuration());
(bool success, uint256 totalReward) = reward.tryMul(SCALING_FACTOR);
require(success, RewardOverflow());
_updateReward(address(0));
uint256 currentDistributionEnd = distributionEnd;
uint256 newDisrtibutionEnd = block.timestamp + duration;
if (block.timestamp >= currentDistributionEnd) {
// No current distribution
rewardRate = totalReward / duration;
distributionEnd = newDisrtibutionEnd;
} else {
uint256 currentRewardRate = rewardRate;
uint256 remainingReward = currentRewardRate * (currentDistributionEnd - block.timestamp);
(success, totalReward) = totalReward.tryAdd(remainingReward);
require(success, RewardOverflow());
if (newDisrtibutionEnd <= currentDistributionEnd) {
// New distribution ends before current distribution
// Keep the current distribution end and increase the reward rate accordingly
duration = currentDistributionEnd - block.timestamp;
rewardRate = totalReward / duration;
} else {
// New distribution ends after current distribution
// Extend the current distribution end and increase the reward rate accordingly
uint256 newRewardRate = totalReward / duration;
require(newRewardRate >= currentRewardRate, RewardDilution(currentRewardRate, newRewardRate));
rewardRate = newRewardRate;
distributionEnd = newDisrtibutionEnd;
}
}
lastUpdated = block.timestamp;
_computeAddReward(rewarder, reward);
emit RewardAdded(rewarder, reward, duration);
}
/// @notice Performs a stake (deposit some asset in the pool), for example by transferring staking tokens to this contract.
/// @notice Computes the amount of stake points for the sender based on the stakeData.
/// @param sender The address of the sender.
/// @param stakeData The data to be used for the stake (encoding freely determined by the deriving contracts).
/// @return stakePoints The amount of stake points computed from the stakeData.
function _computeStake(address sender, bytes memory stakeData) internal virtual returns (uint256 stakePoints);
/// @notice Performs a withdrawal (remove some asset from the pool), for example by transferring taking tokens from this contract.
/// @notice Computes the amount of stake points for the sender based on the withdrawData.
/// @param sender The address of the sender.
/// @param withdrawData The data to be used for the withdraw (encoding freely determined by the deriving contracts).
/// @return stakePoints The amount of stake points computed from the withdrawData.
function _computeWithdraw(address sender, bytes memory withdrawData) internal virtual returns (uint256 stakePoints);
/// @notice Performs a claim, for examples by transferring reward tokens to the sender.
/// @param sender The address of the sender.
/// @param claimable The amount of rewards which can be claimed.
/// @param claimData The data to be used in the claim process (encoding freely determined by the deriving contracts).
/// @return claimed The amount of rewards that was claimed.
/// @return unclaimed The amount of rewards that was not claimed.
function _computeClaim(address sender, uint256 claimable, bytes calldata claimData) internal virtual returns (uint256 claimed, uint256 unclaimed);
/// @notice Performs addition of rewards to the pool, for example by transferring rewards tokens to this contract.
/// @param sender The address of the sender.
/// @param reward The amount of rewards to be added.
function _computeAddReward(address sender, uint256 reward) internal virtual;
/// @inheritdoc ForwarderRegistryContextBase
function _msgSender() internal view virtual override(Context, ForwarderRegistryContextBase) returns (address) {
return ForwarderRegistryContextBase._msgSender();
}
/// @inheritdoc ForwarderRegistryContextBase
function _msgData() internal view virtual override(Context, ForwarderRegistryContextBase) returns (bytes calldata) {
return ForwarderRegistryContextBase._msgData();
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.2.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC-20 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 {
/**
* @dev An operation with an ERC-20 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.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
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.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
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.
*
* NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
* only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
* set here.
*/
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 Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
safeTransfer(token, to, value);
} else if (!token.transferAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
* has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferFromAndCallRelaxed(
IERC1363 token,
address from,
address to,
uint256 value,
bytes memory data
) internal {
if (to.code.length == 0) {
safeTransferFrom(token, from, to, value);
} else if (!token.transferFromAndCall(from, to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
* Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
* once without retrying, and relies on the returned value to be true.
*
* Reverts if the returned value is other than `true`.
*/
function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
forceApprove(token, to, value);
} else if (!token.approveAndCall(to, value, data)) {
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 {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
// bubble errors
if iszero(success) {
let ptr := mload(0x40)
returndatacopy(ptr, 0, returndatasize())
revert(ptr, returndatasize())
}
returnSize := returndatasize()
returnValue := mload(0)
}
if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
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 silently catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
bool success;
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
returnSize := returndatasize()
returnValue := mload(0)
}
return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
import {IERC20} from "@openzeppelin/contracts/interfaces/IERC20.sol";
import {IERC721} from "./../../token/ERC721/interfaces/IERC721.sol";
import {ITokenRecovery} from "./../interfaces/ITokenRecovery.sol";
import {ContractOwnershipStorage} from "./../../access/libraries/ContractOwnershipStorage.sol";
import {TokenRecoveryLibrary} from "./../libraries/TokenRecoveryLibrary.sol";
import {Context} from "@openzeppelin/contracts/utils/Context.sol";
/// @title Recovery mechanism for ETH/ERC20/ERC721 tokens accidentally sent to this contract (proxiable version).
/// @dev This contract is to be used via inheritance in a proxied implementation.
/// @dev Note: This contract requires ERC173 (Contract Ownership standard).
abstract contract TokenRecoveryBase is ITokenRecovery, Context {
using ContractOwnershipStorage for ContractOwnershipStorage.Layout;
/// @inheritdoc ITokenRecovery
/// @dev Reverts with {NotContractOwner} if the sender is not the contract owner.
/// @dev Reverts with {InconsistentArrayLengths} `accounts` and `amounts` do not have the same length.
/// @dev Reverts if one of the ETH transfers fails for any reason.
function recoverETH(address payable[] calldata accounts, uint256[] calldata amounts) public virtual {
ContractOwnershipStorage.layout().enforceIsContractOwner(_msgSender());
TokenRecoveryLibrary.recoverETH(accounts, amounts);
}
/// @inheritdoc ITokenRecovery
/// @dev Reverts with {NotContractOwner} if the sender is not the contract owner.
/// @dev Reverts with {InconsistentArrayLengths} if `accounts`, `tokens` and `amounts` do not have the same length.
/// @dev Reverts if one of the ERC20 transfers fails for any reason.
function recoverERC20s(address[] calldata accounts, IERC20[] calldata tokens, uint256[] calldata amounts) public virtual {
ContractOwnershipStorage.layout().enforceIsContractOwner(_msgSender());
TokenRecoveryLibrary.recoverERC20s(accounts, tokens, amounts);
}
/// @inheritdoc ITokenRecovery
/// @dev Reverts with {NotContractOwner} if the sender is not the contract owner.
/// @dev Reverts with {InconsistentArrayLengths} if `accounts`, `contracts` and `amounts` do not have the same length.
/// @dev Reverts if one of the ERC721 transfers fails for any reason.
function recoverERC721s(address[] calldata accounts, IERC721[] calldata contracts, uint256[] calldata tokenIds) public virtual {
ContractOwnershipStorage.layout().enforceIsContractOwner(_msgSender());
TokenRecoveryLibrary.recoverERC721s(accounts, contracts, tokenIds);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
import {ContractOwnershipStorage} from "./libraries/ContractOwnershipStorage.sol";
import {ContractOwnershipBase} from "./base/ContractOwnershipBase.sol";
import {InterfaceDetection} from "./../introspection/InterfaceDetection.sol";
/// @title ERC173 Contract Ownership Standard (immutable version).
/// @dev See https://eips.ethereum.org/EIPS/eip-173
/// @dev This contract is to be used via inheritance in an immutable (non-proxied) implementation.
abstract contract ContractOwnership is ContractOwnershipBase, InterfaceDetection {
using ContractOwnershipStorage for ContractOwnershipStorage.Layout;
/// @notice Initializes the storage with an initial contract owner.
/// @notice Marks the following ERC165 interface(s) as supported: ERC173.
/// @dev Emits an {OwnershipTransferred} if `initialOwner` is not the zero address.
/// @param initialOwner the initial contract owner.
constructor(address initialOwner) {
ContractOwnershipStorage.layout().constructorInit(initialOwner);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
import {AccessControlBase} from "./base/AccessControlBase.sol";
import {ContractOwnership} from "./ContractOwnership.sol";
/// @title Access control via roles management (immutable version).
/// @dev This contract is to be used via inheritance in an immutable (non-proxied) implementation.
abstract contract AccessControl is AccessControlBase, ContractOwnership {}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
import {IERC20Receiver} from "./interfaces/IERC20Receiver.sol";
import {InterfaceDetectionStorage} from "../../introspection/libraries/InterfaceDetectionStorage.sol";
import {InterfaceDetection} from "../../introspection/InterfaceDetection.sol";
/// @title ERC20 Fungible Token Standard, Receiver (immutable version).
/// @dev This contract is to be used via inheritance in an immutable (non-proxied) implementation.
abstract contract ERC20Receiver is IERC20Receiver, InterfaceDetection {
using InterfaceDetectionStorage for InterfaceDetectionStorage.Layout;
/// @notice Marks the following ERC165 interface(s) as supported: ERC20Receiver.
constructor() {
InterfaceDetectionStorage.layout().setSupportedInterface(type(IERC20Receiver).interfaceId, true);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
import {TokenRecoveryBase} from "./base/TokenRecoveryBase.sol";
import {ContractOwnership} from "./../access/ContractOwnership.sol";
/// @title Recovery mechanism for ETH/ERC20/ERC721 tokens accidentally sent to this contract (immutable version).
/// @dev This contract is to be used via inheritance in an immutable (non-proxied) implementation.
abstract contract TokenRecovery is TokenRecoveryBase, ContractOwnership {}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
import {IForwarderRegistry} from "./interfaces/IForwarderRegistry.sol";
import {IERC2771} from "./interfaces/IERC2771.sol";
import {ForwarderRegistryContextBase} from "./base/ForwarderRegistryContextBase.sol";
/// @title Meta-Transactions Forwarder Registry Context (immutable version).
/// @dev This contract is to be used via inheritance in an immutable (non-proxied) implementation.
/// @dev Derived from https://github.com/wighawag/universal-forwarder (MIT licence)
abstract contract ForwarderRegistryContext is ForwarderRegistryContextBase, IERC2771 {
/// @param forwarderRegistry_ The ForwarderRegistry contract address, or the zero address to disable meta-transactions.
constructor(IForwarderRegistry forwarderRegistry_) ForwarderRegistryContextBase(forwarderRegistry_) {}
function forwarderRegistry() external view returns (IForwarderRegistry) {
return _FORWARDER_REGISTRY;
}
/// @inheritdoc IERC2771
function isTrustedForwarder(address forwarder) external view virtual returns (bool) {
// ERC2771 meta-transactions disabled
if (_FORWARDER_REGISTRY == IForwarderRegistry(address(0))) {
return false;
}
return forwarder == address(_FORWARDER_REGISTRY);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
import {IForwarderRegistry} from "./../interfaces/IForwarderRegistry.sol";
import {ERC2771Calldata} from "./../libraries/ERC2771Calldata.sol";
/// @title Meta-Transactions Forwarder Registry Context (proxiable version).
/// @dev This contract is to be used via inheritance in a proxied implementation.
/// @dev Derived from https://github.com/wighawag/universal-forwarder (MIT licence)
abstract contract ForwarderRegistryContextBase {
IForwarderRegistry internal immutable _FORWARDER_REGISTRY;
/// @param forwarderRegistry The ForwarderRegistry contract address, or the zero address to disable meta-transactions.
constructor(IForwarderRegistry forwarderRegistry) {
_FORWARDER_REGISTRY = forwarderRegistry;
}
/// @notice Returns the message sender depending on the ForwarderRegistry-based meta-transaction context.
function _msgSender() internal view virtual returns (address) {
// ERC2771 meta-transactions disabled
if (_FORWARDER_REGISTRY == IForwarderRegistry(address(0))) {
return msg.sender;
}
// Optimised path in case of an EOA-initiated direct tx to the contract or a call from a contract not complying with EIP-2771
// solhint-disable-next-line avoid-tx-origin
if (msg.sender == tx.origin || msg.data.length < 24) {
return msg.sender;
}
address sender = ERC2771Calldata.msgSender();
// Return the EIP-2771 calldata-appended sender address if the message was forwarded by the ForwarderRegistry or an approved forwarder
if (msg.sender == address(_FORWARDER_REGISTRY) || _FORWARDER_REGISTRY.isApprovedForwarder(sender, msg.sender, address(this))) {
return sender;
}
return msg.sender;
}
/// @notice Returns the message data depending on the ForwarderRegistry-based meta-transaction context.
function _msgData() internal view virtual returns (bytes calldata) {
// ERC2771 meta-transactions disabled
if (_FORWARDER_REGISTRY == IForwarderRegistry(address(0))) {
return msg.data;
}
// Optimised path in case of an EOA-initiated direct tx to the contract or a call from a contract not complying with EIP-2771
// solhint-disable-next-line avoid-tx-origin
if (msg.sender == tx.origin || msg.data.length < 24) {
return msg.data;
}
// Return the EIP-2771 calldata (minus the appended sender) if the message was forwarded by the ForwarderRegistry or an approved forwarder
if (
msg.sender == address(_FORWARDER_REGISTRY) ||
_FORWARDER_REGISTRY.isApprovedForwarder(ERC2771Calldata.msgSender(), msg.sender, address(this))
) {
return ERC2771Calldata.msgData();
}
return msg.data;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
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.1.0) (interfaces/IERC1363.sol)
pragma solidity ^0.8.20;
import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";
/**
* @title IERC1363
* @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
*
* Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
* after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
*/
interface IERC1363 is IERC20, IERC165 {
/*
* Note: the ERC-165 identifier for this interface is 0xb0202a11.
* 0xb0202a11 ===
* bytes4(keccak256('transferAndCall(address,uint256)')) ^
* bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
* bytes4(keccak256('approveAndCall(address,uint256)')) ^
* bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
*/
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @param data Additional data with no specified format, sent in call to `spender`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.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 EIP-1153 (transient storage) is available on the chain you're deploying at,
* consider using {ReentrancyGuardTransient} instead.
*
* 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: 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
pragma solidity ^0.8.30;
import {NotRoleHolder, NotTargetContractRoleHolder} from "./../errors/AccessControlErrors.sol";
import {TargetIsNotAContract} from "./../errors/Common.sol";
import {RoleGranted, RoleRevoked} from "./../events/AccessControlEvents.sol";
import {IAccessControl} from "./../interfaces/IAccessControl.sol";
import {Address} from "./../../utils/libraries/Address.sol";
library AccessControlStorage {
using Address for address;
using AccessControlStorage for AccessControlStorage.Layout;
struct Layout {
mapping(bytes32 => mapping(address => bool)) roles;
}
bytes32 internal constant LAYOUT_STORAGE_SLOT = bytes32(uint256(keccak256("animoca.core.access.AccessControl.storage")) - 1);
/// @notice Grants a role to an account.
/// @dev Note: Call to this function should be properly access controlled.
/// @dev Emits a {RoleGranted} event if the account did not previously have the role.
/// @param role The role to grant.
/// @param account The account to grant the role to.
/// @param operator The account requesting the role change.
function grantRole(Layout storage s, bytes32 role, address account, address operator) internal {
if (!s.hasRole(role, account)) {
s.roles[role][account] = true;
emit RoleGranted(role, account, operator);
}
}
/// @notice Revokes a role from an account.
/// @dev Note: Call to this function should be properly access controlled.
/// @dev Emits a {RoleRevoked} event if the account previously had the role.
/// @param role The role to revoke.
/// @param account The account to revoke the role from.
/// @param operator The account requesting the role change.
function revokeRole(Layout storage s, bytes32 role, address account, address operator) internal {
if (s.hasRole(role, account)) {
s.roles[role][account] = false;
emit RoleRevoked(role, account, operator);
}
}
/// @notice Renounces a role by the sender.
/// @dev Reverts with {NotRoleHolder} if `sender` does not have `role`.
/// @dev Emits a {RoleRevoked} event.
/// @param sender The message sender.
/// @param role The role to renounce.
function renounceRole(Layout storage s, address sender, bytes32 role) internal {
s.enforceHasRole(role, sender);
s.roles[role][sender] = false;
emit RoleRevoked(role, sender, sender);
}
/// @notice Retrieves whether an account has a role.
/// @param role The role.
/// @param account The account.
/// @return hasRole_ Whether `account` has `role`.
function hasRole(Layout storage s, bytes32 role, address account) internal view returns (bool hasRole_) {
return s.roles[role][account];
}
/// @notice Checks whether an account has a role in a target contract.
/// @param targetContract The contract to check.
/// @param role The role to check.
/// @param account The account to check.
/// @return hasTargetContractRole_ Whether `account` has `role` in `targetContract`.
function hasTargetContractRole(address targetContract, bytes32 role, address account) internal view returns (bool hasTargetContractRole_) {
if (!targetContract.hasBytecode()) revert TargetIsNotAContract(targetContract);
return IAccessControl(targetContract).hasRole(role, account);
}
/// @notice Ensures that an account has a role.
/// @dev Reverts with {NotRoleHolder} if `account` does not have `role`.
/// @param role The role.
/// @param account The account.
function enforceHasRole(Layout storage s, bytes32 role, address account) internal view {
if (!s.hasRole(role, account)) revert NotRoleHolder(role, account);
}
/// @notice Enforces that an account has a role in a target contract.
/// @dev Reverts with {NotTargetContractRoleHolder} if the account does not have the role.
/// @param targetContract The contract to check.
/// @param role The role to check.
/// @param account The account to check.
function enforceHasTargetContractRole(address targetContract, bytes32 role, address account) internal view {
if (!hasTargetContractRole(targetContract, role, account)) revert NotTargetContractRoleHolder(targetContract, role, account);
}
function layout() internal pure returns (Layout storage s) {
bytes32 position = LAYOUT_STORAGE_SLOT;
assembly {
s.slot := position
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/math/Math.sol)
pragma solidity ^0.8.20;
import {Panic} from "../Panic.sol";
import {SafeCast} from "./SafeCast.sol";
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
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 success flag (no overflow).
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an success flag (no overflow).
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an success flag (no overflow).
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
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 success flag (no division by zero).
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a success flag (no division by zero).
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Branchless ternary evaluation for `a ? b : c`. Gas costs are constant.
*
* IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.
* However, the compiler may optimize Solidity ternary operations (i.e. `a ? b : c`) to only compute
* one branch when needed, making this function more expensive.
*/
function ternary(bool condition, uint256 a, uint256 b) internal pure returns (uint256) {
unchecked {
// branchless ternary works because:
// b ^ (a ^ b) == a
// b ^ 0 == b
return b ^ ((a ^ b) * SafeCast.toUint(condition));
}
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return ternary(a > b, a, b);
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return ternary(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.
Panic.panic(Panic.DIVISION_BY_ZERO);
}
// The following calculation ensures accurate ceiling division without overflow.
// Since a is non-zero, (a - 1) / b will not overflow.
// The largest possible result occurs when (a - 1) / b is type(uint256).max,
// but the largest value we can obtain is type(uint256).max - 1, which happens
// when a = type(uint256).max and b = 1.
unchecked {
return SafeCast.toUint(a > 0) * ((a - 1) / b + 1);
}
}
/**
* @dev Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
* denominator == 0.
*
* 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²⁵⁶ and mod 2²⁵⁶ - 1, then use
// the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2²⁵⁶ + 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²⁵⁶. Also prevents denominator == 0.
if (denominator <= prod1) {
Panic.panic(ternary(denominator == 0, Panic.DIVISION_BY_ZERO, Panic.UNDER_OVERFLOW));
}
///////////////////////////////////////////////
// 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²⁵⁶ / 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²⁵⁶. Now that denominator is an odd number, it has an inverse modulo 2²⁵⁶ such
// that denominator * inv ≡ 1 mod 2²⁵⁶. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv ≡ 1 mod 2⁴.
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⁸
inverse *= 2 - denominator * inverse; // inverse mod 2¹⁶
inverse *= 2 - denominator * inverse; // inverse mod 2³²
inverse *= 2 - denominator * inverse; // inverse mod 2⁶⁴
inverse *= 2 - denominator * inverse; // inverse mod 2¹²⁸
inverse *= 2 - denominator * inverse; // inverse mod 2²⁵⁶
// 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²⁵⁶. Since the preconditions guarantee that the outcome is
// less than 2²⁵⁶, 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;
}
}
/**
* @dev 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) {
return mulDiv(x, y, denominator) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0);
}
/**
* @dev Calculate the modular multiplicative inverse of a number in Z/nZ.
*
* If n is a prime, then Z/nZ is a field. In that case all elements are inversible, except 0.
* If n is not a prime, then Z/nZ is not a field, and some elements might not be inversible.
*
* If the input value is not inversible, 0 is returned.
*
* NOTE: If you know for sure that n is (big) a prime, it may be cheaper to use Fermat's little theorem and get the
* inverse using `Math.modExp(a, n - 2, n)`. See {invModPrime}.
*/
function invMod(uint256 a, uint256 n) internal pure returns (uint256) {
unchecked {
if (n == 0) return 0;
// The inverse modulo is calculated using the Extended Euclidean Algorithm (iterative version)
// Used to compute integers x and y such that: ax + ny = gcd(a, n).
// When the gcd is 1, then the inverse of a modulo n exists and it's x.
// ax + ny = 1
// ax = 1 + (-y)n
// ax ≡ 1 (mod n) # x is the inverse of a modulo n
// If the remainder is 0 the gcd is n right away.
uint256 remainder = a % n;
uint256 gcd = n;
// Therefore the initial coefficients are:
// ax + ny = gcd(a, n) = n
// 0a + 1n = n
int256 x = 0;
int256 y = 1;
while (remainder != 0) {
uint256 quotient = gcd / remainder;
(gcd, remainder) = (
// The old remainder is the next gcd to try.
remainder,
// Compute the next remainder.
// Can't overflow given that (a % gcd) * (gcd // (a % gcd)) <= gcd
// where gcd is at most n (capped to type(uint256).max)
gcd - remainder * quotient
);
(x, y) = (
// Increment the coefficient of a.
y,
// Decrement the coefficient of n.
// Can overflow, but the result is casted to uint256 so that the
// next value of y is "wrapped around" to a value between 0 and n - 1.
x - y * int256(quotient)
);
}
if (gcd != 1) return 0; // No inverse exists.
return ternary(x < 0, n - uint256(-x), uint256(x)); // Wrap the result if it's negative.
}
}
/**
* @dev Variant of {invMod}. More efficient, but only works if `p` is known to be a prime greater than `2`.
*
* From https://en.wikipedia.org/wiki/Fermat%27s_little_theorem[Fermat's little theorem], we know that if p is
* prime, then `a**(p-1) ≡ 1 mod p`. As a consequence, we have `a * a**(p-2) ≡ 1 mod p`, which means that
* `a**(p-2)` is the modular multiplicative inverse of a in Fp.
*
* NOTE: this function does NOT check that `p` is a prime greater than `2`.
*/
function invModPrime(uint256 a, uint256 p) internal view returns (uint256) {
unchecked {
return Math.modExp(a, p - 2, p);
}
}
/**
* @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m)
*
* Requirements:
* - modulus can't be zero
* - underlying staticcall to precompile must succeed
*
* IMPORTANT: The result is only valid if the underlying call succeeds. When using this function, make
* sure the chain you're using it on supports the precompiled contract for modular exponentiation
* at address 0x05 as specified in https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise,
* the underlying function will succeed given the lack of a revert, but the result may be incorrectly
* interpreted as 0.
*/
function modExp(uint256 b, uint256 e, uint256 m) internal view returns (uint256) {
(bool success, uint256 result) = tryModExp(b, e, m);
if (!success) {
Panic.panic(Panic.DIVISION_BY_ZERO);
}
return result;
}
/**
* @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m).
* It includes a success flag indicating if the operation succeeded. Operation will be marked as failed if trying
* to operate modulo 0 or if the underlying precompile reverted.
*
* IMPORTANT: The result is only valid if the success flag is true. When using this function, make sure the chain
* you're using it on supports the precompiled contract for modular exponentiation at address 0x05 as specified in
* https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise, the underlying function will succeed given the lack
* of a revert, but the result may be incorrectly interpreted as 0.
*/
function tryModExp(uint256 b, uint256 e, uint256 m) internal view returns (bool success, uint256 result) {
if (m == 0) return (false, 0);
assembly ("memory-safe") {
let ptr := mload(0x40)
// | Offset | Content | Content (Hex) |
// |-----------|------------|--------------------------------------------------------------------|
// | 0x00:0x1f | size of b | 0x0000000000000000000000000000000000000000000000000000000000000020 |
// | 0x20:0x3f | size of e | 0x0000000000000000000000000000000000000000000000000000000000000020 |
// | 0x40:0x5f | size of m | 0x0000000000000000000000000000000000000000000000000000000000000020 |
// | 0x60:0x7f | value of b | 0x<.............................................................b> |
// | 0x80:0x9f | value of e | 0x<.............................................................e> |
// | 0xa0:0xbf | value of m | 0x<.............................................................m> |
mstore(ptr, 0x20)
mstore(add(ptr, 0x20), 0x20)
mstore(add(ptr, 0x40), 0x20)
mstore(add(ptr, 0x60), b)
mstore(add(ptr, 0x80), e)
mstore(add(ptr, 0xa0), m)
// Given the result < m, it's guaranteed to fit in 32 bytes,
// so we can use the memory scratch space located at offset 0.
success := staticcall(gas(), 0x05, ptr, 0xc0, 0x00, 0x20)
result := mload(0x00)
}
}
/**
* @dev Variant of {modExp} that supports inputs of arbitrary length.
*/
function modExp(bytes memory b, bytes memory e, bytes memory m) internal view returns (bytes memory) {
(bool success, bytes memory result) = tryModExp(b, e, m);
if (!success) {
Panic.panic(Panic.DIVISION_BY_ZERO);
}
return result;
}
/**
* @dev Variant of {tryModExp} that supports inputs of arbitrary length.
*/
function tryModExp(
bytes memory b,
bytes memory e,
bytes memory m
) internal view returns (bool success, bytes memory result) {
if (_zeroBytes(m)) return (false, new bytes(0));
uint256 mLen = m.length;
// Encode call args in result and move the free memory pointer
result = abi.encodePacked(b.length, e.length, mLen, b, e, m);
assembly ("memory-safe") {
let dataPtr := add(result, 0x20)
// Write result on top of args to avoid allocating extra memory.
success := staticcall(gas(), 0x05, dataPtr, mload(result), dataPtr, mLen)
// Overwrite the length.
// result.length > returndatasize() is guaranteed because returndatasize() == m.length
mstore(result, mLen)
// Set the memory pointer after the returned data.
mstore(0x40, add(dataPtr, mLen))
}
}
/**
* @dev Returns whether the provided byte array is zero.
*/
function _zeroBytes(bytes memory byteArray) private pure returns (bool) {
for (uint256 i = 0; i < byteArray.length; ++i) {
if (byteArray[i] != 0) {
return false;
}
}
return true;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
* towards zero.
*
* This method is based on Newton's method for computing square roots; the algorithm is restricted to only
* using integer operations.
*/
function sqrt(uint256 a) internal pure returns (uint256) {
unchecked {
// Take care of easy edge cases when a == 0 or a == 1
if (a <= 1) {
return a;
}
// In this function, we use Newton's method to get a root of `f(x) := x² - a`. It involves building a
// sequence x_n that converges toward sqrt(a). For each iteration x_n, we also define the error between
// the current value as `ε_n = | x_n - sqrt(a) |`.
//
// For our first estimation, we consider `e` the smallest power of 2 which is bigger than the square root
// of the target. (i.e. `2**(e-1) ≤ sqrt(a) < 2**e`). We know that `e ≤ 128` because `(2¹²⁸)² = 2²⁵⁶` is
// bigger than any uint256.
//
// By noticing that
// `2**(e-1) ≤ sqrt(a) < 2**e → (2**(e-1))² ≤ a < (2**e)² → 2**(2*e-2) ≤ a < 2**(2*e)`
// we can deduce that `e - 1` is `log2(a) / 2`. We can thus compute `x_n = 2**(e-1)` using a method similar
// to the msb function.
uint256 aa = a;
uint256 xn = 1;
if (aa >= (1 << 128)) {
aa >>= 128;
xn <<= 64;
}
if (aa >= (1 << 64)) {
aa >>= 64;
xn <<= 32;
}
if (aa >= (1 << 32)) {
aa >>= 32;
xn <<= 16;
}
if (aa >= (1 << 16)) {
aa >>= 16;
xn <<= 8;
}
if (aa >= (1 << 8)) {
aa >>= 8;
xn <<= 4;
}
if (aa >= (1 << 4)) {
aa >>= 4;
xn <<= 2;
}
if (aa >= (1 << 2)) {
xn <<= 1;
}
// We now have x_n such that `x_n = 2**(e-1) ≤ sqrt(a) < 2**e = 2 * x_n`. This implies ε_n ≤ 2**(e-1).
//
// We can refine our estimation by noticing that the middle of that interval minimizes the error.
// If we move x_n to equal 2**(e-1) + 2**(e-2), then we reduce the error to ε_n ≤ 2**(e-2).
// This is going to be our x_0 (and ε_0)
xn = (3 * xn) >> 1; // ε_0 := | x_0 - sqrt(a) | ≤ 2**(e-2)
// From here, Newton's method give us:
// x_{n+1} = (x_n + a / x_n) / 2
//
// One should note that:
// x_{n+1}² - a = ((x_n + a / x_n) / 2)² - a
// = ((x_n² + a) / (2 * x_n))² - a
// = (x_n⁴ + 2 * a * x_n² + a²) / (4 * x_n²) - a
// = (x_n⁴ + 2 * a * x_n² + a² - 4 * a * x_n²) / (4 * x_n²)
// = (x_n⁴ - 2 * a * x_n² + a²) / (4 * x_n²)
// = (x_n² - a)² / (2 * x_n)²
// = ((x_n² - a) / (2 * x_n))²
// ≥ 0
// Which proves that for all n ≥ 1, sqrt(a) ≤ x_n
//
// This gives us the proof of quadratic convergence of the sequence:
// ε_{n+1} = | x_{n+1} - sqrt(a) |
// = | (x_n + a / x_n) / 2 - sqrt(a) |
// = | (x_n² + a - 2*x_n*sqrt(a)) / (2 * x_n) |
// = | (x_n - sqrt(a))² / (2 * x_n) |
// = | ε_n² / (2 * x_n) |
// = ε_n² / | (2 * x_n) |
//
// For the first iteration, we have a special case where x_0 is known:
// ε_1 = ε_0² / | (2 * x_0) |
// ≤ (2**(e-2))² / (2 * (2**(e-1) + 2**(e-2)))
// ≤ 2**(2*e-4) / (3 * 2**(e-1))
// ≤ 2**(e-3) / 3
// ≤ 2**(e-3-log2(3))
// ≤ 2**(e-4.5)
//
// For the following iterations, we use the fact that, 2**(e-1) ≤ sqrt(a) ≤ x_n:
// ε_{n+1} = ε_n² / | (2 * x_n) |
// ≤ (2**(e-k))² / (2 * 2**(e-1))
// ≤ 2**(2*e-2*k) / 2**e
// ≤ 2**(e-2*k)
xn = (xn + a / xn) >> 1; // ε_1 := | x_1 - sqrt(a) | ≤ 2**(e-4.5) -- special case, see above
xn = (xn + a / xn) >> 1; // ε_2 := | x_2 - sqrt(a) | ≤ 2**(e-9) -- general case with k = 4.5
xn = (xn + a / xn) >> 1; // ε_3 := | x_3 - sqrt(a) | ≤ 2**(e-18) -- general case with k = 9
xn = (xn + a / xn) >> 1; // ε_4 := | x_4 - sqrt(a) | ≤ 2**(e-36) -- general case with k = 18
xn = (xn + a / xn) >> 1; // ε_5 := | x_5 - sqrt(a) | ≤ 2**(e-72) -- general case with k = 36
xn = (xn + a / xn) >> 1; // ε_6 := | x_6 - sqrt(a) | ≤ 2**(e-144) -- general case with k = 72
// Because e ≤ 128 (as discussed during the first estimation phase), we know have reached a precision
// ε_6 ≤ 2**(e-144) < 1. Given we're operating on integers, then we can ensure that xn is now either
// sqrt(a) or sqrt(a) + 1.
return xn - SafeCast.toUint(xn > a / xn);
}
}
/**
* @dev 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 + SafeCast.toUint(unsignedRoundsUp(rounding) && result * result < a);
}
}
/**
* @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;
uint256 exp;
unchecked {
exp = 128 * SafeCast.toUint(value > (1 << 128) - 1);
value >>= exp;
result += exp;
exp = 64 * SafeCast.toUint(value > (1 << 64) - 1);
value >>= exp;
result += exp;
exp = 32 * SafeCast.toUint(value > (1 << 32) - 1);
value >>= exp;
result += exp;
exp = 16 * SafeCast.toUint(value > (1 << 16) - 1);
value >>= exp;
result += exp;
exp = 8 * SafeCast.toUint(value > (1 << 8) - 1);
value >>= exp;
result += exp;
exp = 4 * SafeCast.toUint(value > (1 << 4) - 1);
value >>= exp;
result += exp;
exp = 2 * SafeCast.toUint(value > (1 << 2) - 1);
value >>= exp;
result += exp;
result += SafeCast.toUint(value > 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 + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << result < value);
}
}
/**
* @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 + SafeCast.toUint(unsignedRoundsUp(rounding) && 10 ** result < value);
}
}
/**
* @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;
uint256 isGt;
unchecked {
isGt = SafeCast.toUint(value > (1 << 128) - 1);
value >>= isGt * 128;
result += isGt * 16;
isGt = SafeCast.toUint(value > (1 << 64) - 1);
value >>= isGt * 64;
result += isGt * 8;
isGt = SafeCast.toUint(value > (1 << 32) - 1);
value >>= isGt * 32;
result += isGt * 4;
isGt = SafeCast.toUint(value > (1 << 16) - 1);
value >>= isGt * 16;
result += isGt * 2;
result += SafeCast.toUint(value > (1 << 8) - 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 + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << (result << 3) < value);
}
}
/**
* @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
pragma solidity 0.8.30;
interface ILinearPool {
function lastTimeRewardApplicable() external view returns (uint256);
function rewardPerStakePoint() external view returns (uint256);
function earned(address account) external view returns (uint256);
function stake(bytes calldata stakeData) external payable;
function withdraw(bytes calldata withdrawData) external;
function claim(bytes calldata claimData) external;
function addReward(uint256 reward, uint256 duration) external payable;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
import {IERC20} from "@openzeppelin/contracts/interfaces/IERC20.sol";
import {IERC721} from "./../../token/ERC721/interfaces/IERC721.sol";
/// @title Uniquely identified seals management.
interface ITokenRecovery {
/// @notice Extract ETH tokens which were accidentally sent to the contract to a list of accounts.
/// @dev Note: While contracts can generally prevent accidental ETH transfer by implementating a reverting
/// `receive()` function, this can still be bypassed in a `selfdestruct(address)` scenario.
/// @dev Warning: this function should be overriden for contracts which are supposed to hold ETH tokens
/// so that the extraction is limited to only amounts sent accidentally.
/// @param accounts the list of accounts to transfer the tokens to.
/// @param amounts the list of token amounts to transfer.
function recoverETH(address payable[] calldata accounts, uint256[] calldata amounts) external;
/// @notice Extract ERC20 tokens which were accidentally sent to the contract to a list of accounts.
/// @dev Warning: this function should be overriden for contracts which are supposed to hold ERC20 tokens
/// so that the extraction is limited to only amounts sent accidentally.
/// @param accounts the list of accounts to transfer the tokens to.
/// @param tokens the list of ERC20 token addresses.
/// @param amounts the list of token amounts to transfer.
function recoverERC20s(address[] calldata accounts, IERC20[] calldata tokens, uint256[] calldata amounts) external;
/// @notice Extract ERC721 tokens which were accidentally sent to the contract to a list of accounts.
/// @dev Warning: this function should be overriden for contracts which are supposed to hold ERC721 tokens
/// so that the extraction is limited to only tokens sent accidentally.
/// @param accounts the list of accounts to transfer the tokens to.
/// @param contracts the list of ERC721 contract addresses.
/// @param tokenIds the list of token ids to transfer.
function recoverERC721s(address[] calldata accounts, IERC721[] calldata contracts, uint256[] calldata tokenIds) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
import {IERC165} from "./interfaces/IERC165.sol";
import {InterfaceDetectionStorage} from "./libraries/InterfaceDetectionStorage.sol";
/// @title ERC165 Interface Detection Standard (immutable or proxiable version).
/// @dev This contract is to be used via inheritance in an immutable (non-proxied) or proxied implementation.
abstract contract InterfaceDetection is IERC165 {
using InterfaceDetectionStorage for InterfaceDetectionStorage.Layout;
/// @inheritdoc IERC165
function supportsInterface(bytes4 interfaceId) external view returns (bool) {
return InterfaceDetectionStorage.layout().supportsInterface(interfaceId);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
import {InconsistentArrayLengths} from "./../../CommonErrors.sol";
import {IERC20} from "@openzeppelin/contracts/interfaces/IERC20.sol";
import {IERC721} from "./../../token/ERC721/interfaces/IERC721.sol";
import {IERC165} from "./../../introspection/interfaces/IERC165.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
library TokenRecoveryLibrary {
using SafeERC20 for IERC20;
using Address for address payable;
/// @notice Thrown when trying to recover a token of the wrong contract type.
/// @param tokenContract The token contract being recovered.
error IncorrectTokenContractType(address tokenContract);
/// @notice Extract ETH tokens which were accidentally sent to the contract to a list of accounts.
/// @dev Note: While contracts can generally prevent accidental ETH transfer by implementating a reverting
/// `receive()` function, this can still be bypassed in a `selfdestruct(address)` scenario.
/// @dev Warning: this function should be overriden for contracts which are supposed to hold ETH tokens
/// so that the extraction is limited to only amounts sent accidentally.
/// @dev Reverts with {InconsistentArrayLengths} `accounts` and `amounts` do not have the same length.
/// @dev Reverts if one of the ETH transfers fails for any reason.
/// @param accounts the list of accounts to transfer the tokens to.
/// @param amounts the list of token amounts to transfer.
function recoverETH(address payable[] calldata accounts, uint256[] calldata amounts) internal {
uint256 length = accounts.length;
if (length != amounts.length) revert InconsistentArrayLengths();
for (uint256 i; i < length; ++i) {
accounts[i].sendValue(amounts[i]);
}
}
/// @notice Extract ERC20 tokens which were accidentally sent to the contract to a list of accounts.
/// @dev Warning: this function should be overriden for contracts which are supposed to hold ERC20 tokens
/// so that the extraction is limited to only amounts sent accidentally.
/// @dev Reverts with {InconsistentArrayLengths} if `accounts`, `tokens` and `amounts` do not have the same length.
/// @dev Reverts if one of the ERC20 transfers fails for any reason.
/// @param accounts the list of accounts to transfer the tokens to.
/// @param tokens the list of ERC20 token addresses.
/// @param amounts the list of token amounts to transfer.
function recoverERC20s(address[] calldata accounts, IERC20[] calldata tokens, uint256[] calldata amounts) internal {
uint256 length = accounts.length;
if (length != tokens.length || length != amounts.length) revert InconsistentArrayLengths();
for (uint256 i; i < length; ++i) {
tokens[i].safeTransfer(accounts[i], amounts[i]);
}
}
/// @notice Extract ERC721 tokens which were accidentally sent to the contract to a list of accounts.
/// @dev Warning: this function should be overriden for contracts which are supposed to hold ERC721 tokens
/// so that the extraction is limited to only tokens sent accidentally.
/// @dev Reverts with {InconsistentArrayLengths} if `accounts`, `contracts` and `amounts` do not have the same length.
/// @dev Reverts if one of the ERC721 transfers fails for any reason.
/// @param accounts the list of accounts to transfer the tokens to.
/// @param contracts the list of ERC721 contract addresses.
/// @param tokenIds the list of token ids to transfer.
function recoverERC721s(address[] calldata accounts, IERC721[] calldata contracts, uint256[] calldata tokenIds) internal {
uint256 length = accounts.length;
if (length != contracts.length || length != tokenIds.length) revert InconsistentArrayLengths();
for (uint256 i; i < length; ++i) {
IERC721 tokenContract = contracts[i];
if (!IERC165(address(tokenContract)).supportsInterface(type(IERC721).interfaceId)) {
revert IncorrectTokenContractType(address(tokenContract));
}
contracts[i].safeTransferFrom(address(this), accounts[i], tokenIds[i]);
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
import {NotContractOwner, NotTargetContractOwner} from "./../errors/ContractOwnershipErrors.sol";
import {TargetIsNotAContract} from "./../errors/Common.sol";
import {OwnershipTransferred} from "./../events/ERC173Events.sol";
import {IERC173} from "./../interfaces/IERC173.sol";
import {Address} from "./../../utils/libraries/Address.sol";
import {ProxyInitialization} from "./../../proxy/libraries/ProxyInitialization.sol";
import {InterfaceDetectionStorage} from "./../../introspection/libraries/InterfaceDetectionStorage.sol";
library ContractOwnershipStorage {
using Address for address;
using ContractOwnershipStorage for ContractOwnershipStorage.Layout;
using InterfaceDetectionStorage for InterfaceDetectionStorage.Layout;
struct Layout {
address contractOwner;
}
bytes32 internal constant LAYOUT_STORAGE_SLOT = bytes32(uint256(keccak256("animoca.core.access.ContractOwnership.storage")) - 1);
bytes32 internal constant PROXY_INIT_PHASE_SLOT = bytes32(uint256(keccak256("animoca.core.access.ContractOwnership.phase")) - 1);
/// @notice Initializes the storage with an initial contract owner (immutable version).
/// @notice Marks the following ERC165 interface(s) as supported: ERC173.
/// @dev Note: This function should be called ONLY in the constructor of an immutable (non-proxied) contract.
/// @dev Emits an {OwnershipTransferred} if `initialOwner` is not the zero address.
/// @param initialOwner The initial contract owner.
function constructorInit(Layout storage s, address initialOwner) internal {
if (initialOwner != address(0)) {
s.contractOwner = initialOwner;
emit OwnershipTransferred(address(0), initialOwner);
}
InterfaceDetectionStorage.layout().setSupportedInterface(type(IERC173).interfaceId, true);
}
/// @notice Initializes the storage with an initial contract owner (proxied version).
/// @notice Sets the proxy initialization phase to `1`.
/// @notice Marks the following ERC165 interface(s) as supported: ERC173.
/// @dev Note: This function should be called ONLY in the init function of a proxied contract.
/// @dev Reverts with {InitializationPhaseAlreadyReached} if the proxy initialization phase is set to `1` or above.
/// @dev Emits an {OwnershipTransferred} if `initialOwner` is not the zero address.
/// @param initialOwner The initial contract owner.
function proxyInit(Layout storage s, address initialOwner) internal {
ProxyInitialization.setPhase(PROXY_INIT_PHASE_SLOT, 1);
s.constructorInit(initialOwner);
}
/// @notice Sets the address of the new contract owner.
/// @dev Reverts with {NotContractOwner} if `sender` is not the contract owner.
/// @dev Emits an {OwnershipTransferred} event if `newOwner` is different from the current contract owner.
/// @param newOwner The address of the new contract owner. Using the zero address means renouncing ownership.
function transferOwnership(Layout storage s, address sender, address newOwner) internal {
address previousOwner = s.contractOwner;
if (sender != previousOwner) revert NotContractOwner(sender);
if (previousOwner != newOwner) {
s.contractOwner = newOwner;
emit OwnershipTransferred(previousOwner, newOwner);
}
}
/// @notice Gets the address of the contract owner.
/// @return contractOwner The address of the contract owner.
function owner(Layout storage s) internal view returns (address contractOwner) {
return s.contractOwner;
}
/// @notice Checks whether an account is the owner of a target contract.
/// @param targetContract The contract to check.
/// @param account The account to check.
/// @return isTargetContractOwner_ Whether `account` is the owner of `targetContract`.
function isTargetContractOwner(address targetContract, address account) internal view returns (bool isTargetContractOwner_) {
if (!targetContract.hasBytecode()) revert TargetIsNotAContract(targetContract);
return IERC173(targetContract).owner() == account;
}
/// @notice Ensures that an account is the contract owner.
/// @dev Reverts with {NotContractOwner} if `account` is not the contract owner.
/// @param account The account.
function enforceIsContractOwner(Layout storage s, address account) internal view {
if (account != s.contractOwner) revert NotContractOwner(account);
}
/// @notice Enforces that an account is the owner of a target contract.
/// @dev Reverts with {NotTheTargetContractOwner} if the account is not the owner.
/// @param targetContract The contract to check.
/// @param account The account to check.
function enforceIsTargetContractOwner(address targetContract, address account) internal view {
if (!isTargetContractOwner(targetContract, account)) revert NotTargetContractOwner(targetContract, account);
}
function layout() internal pure returns (Layout storage s) {
bytes32 position = LAYOUT_STORAGE_SLOT;
assembly {
s.slot := position
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
/// @title ERC721 Non-Fungible Token Standard, basic interface (functions).
/// @dev See https://eips.ethereum.org/EIPS/eip-721
/// @dev This interface only contains the standard functions. See IERC721Events for the events.
/// @dev Note: The ERC-165 identifier for this interface is 0x80ac58cd.
interface IERC721 {
/// @notice Sets or unsets an approval to transfer a single token on behalf of its owner.
/// @dev Note: There can only be one approved address per token at a given time.
/// @dev Note: A token approval gets reset when this token is transferred, including a self-transfer.
/// @dev Reverts if `tokenId` does not exist.
/// @dev Reverts if `to` is the token owner.
/// @dev Reverts if the sender is not the token owner and has not been approved by the token owner.
/// @dev Emits an {Approval} event.
/// @param to The address to approve, or the zero address to remove any existing approval.
/// @param tokenId The token identifier to give approval for.
function approve(address to, uint256 tokenId) external;
/// @notice Sets or unsets an approval to transfer all tokens on behalf of their owner.
/// @dev Reverts if the sender is the same as `operator`.
/// @dev Emits an {ApprovalForAll} event.
/// @param operator The address to approve for all tokens.
/// @param approved True to set an approval for all tokens, false to unset it.
function setApprovalForAll(address operator, bool approved) external;
/// @notice Unsafely transfers the ownership of a token to a recipient.
/// @dev Note: Usage of this method is discouraged, use `safeTransferFrom` whenever possible.
/// @dev Resets the token approval for `tokenId`.
/// @dev Reverts if `to` is the zero address.
/// @dev Reverts if `from` is not the owner of `tokenId`.
/// @dev Reverts if the sender is not `from` and has not been approved by `from` for `tokenId`.
/// @dev Emits a {Transfer} event.
/// @param from The current token owner.
/// @param to The recipient of the token transfer. Self-transfers are possible.
/// @param tokenId The identifier of the token to transfer.
function transferFrom(address from, address to, uint256 tokenId) external;
/// @notice Safely transfers the ownership of a token to a recipient.
/// @dev Resets the token approval for `tokenId`.
/// @dev Reverts if `to` is the zero address.
/// @dev Reverts if `from` is not the owner of `tokenId`.
/// @dev Reverts if the sender is not `from` and has not been approved by `from` for `tokenId`.
/// @dev Reverts if `to` is a contract and the call to {IERC721Receiver-onERC721Received} fails, reverts or is rejected.
/// @dev Emits a {Transfer} event.
/// @param from The current token owner.
/// @param to The recipient of the token transfer.
/// @param tokenId The identifier of the token to transfer.
function safeTransferFrom(address from, address to, uint256 tokenId) external;
/// @notice Safely transfers the ownership of a token to a recipient.
/// @dev Resets the token approval for `tokenId`.
/// @dev Reverts if `to` is the zero address.
/// @dev Reverts if `from` is not the owner of `tokenId`.
/// @dev Reverts if the sender is not `from` and has not been approved by `from` for `tokenId`.
/// @dev Reverts if `to` is a contract and the call to {IERC721Receiver-onERC721Received} fails, reverts or is rejected.
/// @dev Emits a {Transfer} event.
/// @param from The current token owner.
/// @param to The recipient of the token transfer.
/// @param tokenId The identifier of the token to transfer.
/// @param data Optional data to send along to a receiver contract.
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
/// @notice Gets the balance of an address.
/// @dev Reverts if `owner` is the zero address.
/// @param owner The address to query the balance of.
/// @return balance The amount owned by the owner.
function balanceOf(address owner) external view returns (uint256 balance);
/// @notice Gets the owner of a token.
/// @dev Reverts if `tokenId` does not exist.
/// @param tokenId The token identifier to query the owner of.
/// @return tokenOwner The owner of the token identifier.
function ownerOf(uint256 tokenId) external view returns (address tokenOwner);
/// @notice Gets the approved address for a token.
/// @dev Reverts if `tokenId` does not exist.
/// @param tokenId The token identifier to query the approval of.
/// @return approved The approved address for the token identifier, or the zero address if no approval is set.
function getApproved(uint256 tokenId) external view returns (address approved);
/// @notice Gets whether an operator is approved for all tokens by an owner.
/// @param owner The address which gives the approval for all tokens.
/// @param operator The address which receives the approval for all tokens.
/// @return approvedForAll Whether the operator is approved for all tokens by the owner.
function isApprovedForAll(address owner, address operator) external view returns (bool approvedForAll);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../token/ERC20/IERC20.sol";// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
import {IllegalInterfaceId} from "./../errors/InterfaceDetectionErrors.sol";
import {IERC165} from "./../interfaces/IERC165.sol";
library InterfaceDetectionStorage {
struct Layout {
mapping(bytes4 => bool) supportedInterfaces;
}
bytes32 internal constant LAYOUT_STORAGE_SLOT = bytes32(uint256(keccak256("animoca.core.introspection.InterfaceDetection.storage")) - 1);
bytes4 internal constant ILLEGAL_INTERFACE_ID = 0xffffffff;
/// @notice Sets or unsets an ERC165 interface.
/// @dev Revertswith {IllegalInterfaceId} if `interfaceId` is `0xffffffff`.
/// @param interfaceId the interface identifier.
/// @param supported True to set the interface, false to unset it.
function setSupportedInterface(Layout storage s, bytes4 interfaceId, bool supported) internal {
if (interfaceId == ILLEGAL_INTERFACE_ID) revert IllegalInterfaceId();
s.supportedInterfaces[interfaceId] = supported;
}
/// @notice Returns whether this contract implements a given interface.
/// @dev Note: This function call must use less than 30 000 gas.
/// @param interfaceId The interface identifier to test.
/// @return supported True if the interface is supported, false if `interfaceId` is `0xffffffff` or if the interface is not supported.
function supportsInterface(Layout storage s, bytes4 interfaceId) internal view returns (bool supported) {
if (interfaceId == ILLEGAL_INTERFACE_ID) {
return false;
}
if (interfaceId == type(IERC165).interfaceId) {
return true;
}
return s.supportedInterfaces[interfaceId];
}
function layout() internal pure returns (Layout storage s) {
bytes32 position = LAYOUT_STORAGE_SLOT;
assembly {
s.slot := position
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
/// @dev Derived from https://github.com/OpenZeppelin/openzeppelin-contracts (MIT licence)
/// @dev See https://eips.ethereum.org/EIPS/eip-2771
library ERC2771Calldata {
/// @notice Returns the sender address appended at the end of the calldata, as specified in EIP-2771.
function msgSender() internal pure returns (address sender) {
assembly {
sender := shr(96, calldataload(sub(calldatasize(), 20)))
}
}
/// @notice Returns the calldata while omitting the appended sender address, as specified in EIP-2771.
function msgData() internal pure returns (bytes calldata data) {
unchecked {
return msg.data[:msg.data.length - 20];
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
import {IERC173} from "./../interfaces/IERC173.sol";
import {ContractOwnershipStorage} from "./../libraries/ContractOwnershipStorage.sol";
import {Context} from "@openzeppelin/contracts/utils/Context.sol";
/// @title ERC173 Contract Ownership Standard (proxiable version).
/// @dev See https://eips.ethereum.org/EIPS/eip-173
/// @dev This contract is to be used via inheritance in a proxied implementation.
/// @dev Note: This contract requires ERC165 (Interface Detection Standard).
abstract contract ContractOwnershipBase is IERC173, Context {
using ContractOwnershipStorage for ContractOwnershipStorage.Layout;
/// @inheritdoc IERC173
function owner() public view virtual returns (address) {
return ContractOwnershipStorage.layout().owner();
}
/// @inheritdoc IERC173
function transferOwnership(address newOwner) public virtual {
ContractOwnershipStorage.layout().transferOwnership(_msgSender(), newOwner);
}
}// SPDX-License-Identifier: MIT pragma solidity ^0.8.30; /// @notice Thrown when an account does not have the required role. /// @param role The role the caller is missing. /// @param account The account that was checked. error NotRoleHolder(bytes32 role, address account); /// @notice Thrown when an account does not have the required role on a target contract. /// @param targetContract The contract that was checked. /// @param role The role that was checked. /// @param account The account that was checked. error NotTargetContractRoleHolder(address targetContract, bytes32 role, address account);
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
import {IAccessControl} from "./../../access/interfaces/IAccessControl.sol";
import {AccessControlStorage} from "./../libraries/AccessControlStorage.sol";
import {ContractOwnershipStorage} from "./../libraries/ContractOwnershipStorage.sol";
import {Context} from "@openzeppelin/contracts/utils/Context.sol";
/// @title Access control via roles management (proxiable version).
/// @dev This contract is to be used via inheritance in a proxied implementation.
/// @dev Note: This contract requires ERC173 (Contract Ownership standard).
abstract contract AccessControlBase is IAccessControl, Context {
using AccessControlStorage for AccessControlStorage.Layout;
using ContractOwnershipStorage for ContractOwnershipStorage.Layout;
/// @notice Grants a role to an account.
/// @dev Reverts with {NotContractOwner} if the sender is not the contract owner.
/// @dev Emits a {RoleGranted} event if the account did not previously have the role.
/// @param role The role to grant.
/// @param account The account to grant the role to.
function grantRole(bytes32 role, address account) external virtual {
address operator = _msgSender();
ContractOwnershipStorage.layout().enforceIsContractOwner(operator);
AccessControlStorage.layout().grantRole(role, account, operator);
}
/// @notice Revokes a role from an account.
/// @dev Reverts with {NotContractOwner} if the sender is not the contract owner.
/// @dev Emits a {RoleRevoked} event if the account previously had the role.
/// @param role The role to revoke.
/// @param account The account to revoke the role from.
function revokeRole(bytes32 role, address account) external virtual {
address operator = _msgSender();
ContractOwnershipStorage.layout().enforceIsContractOwner(operator);
AccessControlStorage.layout().revokeRole(role, account, operator);
}
/// @inheritdoc IAccessControl
function renounceRole(bytes32 role) external virtual {
AccessControlStorage.layout().renounceRole(_msgSender(), role);
}
/// @inheritdoc IAccessControl
function hasRole(bytes32 role, address account) external view virtual returns (bool hasRole_) {
return AccessControlStorage.layout().hasRole(role, account);
}
}// SPDX-License-Identifier: MIT pragma solidity ^0.8.30; /// @notice Thrown when the target contract is actually not a contract. /// @param targetContract The contract that was checked error TargetIsNotAContract(address targetContract);
// SPDX-License-Identifier: MIT pragma solidity ^0.8.30; /// @notice Emitted when `role` is granted to `account`. /// @param role The role that has been granted. /// @param account The account that has been granted the role. /// @param operator The account that granted the role. event RoleGranted(bytes32 role, address account, address operator); /// @notice Emitted when `role` is revoked from `account`. /// @param role The role that has been revoked. /// @param account The account that has been revoked the role. /// @param operator The account that revoked the role. event RoleRevoked(bytes32 role, address account, address operator);
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
library Address {
/// @notice Checks if the address is a deployed smart contract.
/// @param addr The address to check.
/// @return hasBytecode True if `addr` is a deployed smart contract, false otherwise.
function hasBytecode(address addr) internal view returns (bool) {
uint256 size;
assembly {
size := extcodesize(addr)
}
return size != 0;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
/// @title ERC20 Token Standard, Tokens Receiver.
/// @notice Interface for supporting safe transfers from ERC20 contracts with the Safe Transfers extension.
/// @dev See https://eips.ethereum.org/EIPS/eip-20
/// @dev Note: the ERC-165 identifier for this interface is 0x4fc35859.
interface IERC20Receiver {
/// @notice Handles the receipt of ERC20 tokens.
/// @dev Note: this function is called by an {ERC20SafeTransfer} contract after a safe transfer.
/// @param operator The initiator of the safe transfer.
/// @param from The previous tokens owner.
/// @param value The amount of tokens transferred.
/// @param data Optional additional data with no specified format.
/// @return magicValue `bytes4(keccak256("onERC20Received(address,address,uint256,bytes)"))` (`0x4fc35859`) to accept, any other value to refuse.
function onERC20Received(address operator, address from, uint256 value, bytes calldata data) external returns (bytes4 magicValue);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
/// @title Access control via roles management (functions)
interface IAccessControl {
/// @notice Renounces a role by the sender.
/// @dev Reverts if `sender` does not have `role`.
/// @dev Emits a {RoleRevoked} event.
/// @param role The role to renounce.
function renounceRole(bytes32 role) external;
/// @notice Retrieves whether an account has a role.
/// @param role The role.
/// @param account The account.
/// @return hasRole_ Whether `account` has `role`.
function hasRole(bytes32 role, address account) external view returns (bool hasRole_);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
/// @title Secure Protocol for Native Meta Transactions.
/// @dev See https://eips.ethereum.org/EIPS/eip-2771
interface IERC2771 {
/// @notice Checks whether a forwarder is trusted.
/// @param forwarder The forwarder to check.
/// @return isTrusted True if `forwarder` is trusted, false if not.
function isTrustedForwarder(address forwarder) external view returns (bool isTrusted);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Panic.sol)
pragma solidity ^0.8.20;
/**
* @dev Helper library for emitting standardized panic codes.
*
* ```solidity
* contract Example {
* using Panic for uint256;
*
* // Use any of the declared internal constants
* function foo() { Panic.GENERIC.panic(); }
*
* // Alternatively
* function foo() { Panic.panic(Panic.GENERIC); }
* }
* ```
*
* Follows the list from https://github.com/ethereum/solidity/blob/v0.8.24/libsolutil/ErrorCodes.h[libsolutil].
*
* _Available since v5.1._
*/
// slither-disable-next-line unused-state
library Panic {
/// @dev generic / unspecified error
uint256 internal constant GENERIC = 0x00;
/// @dev used by the assert() builtin
uint256 internal constant ASSERT = 0x01;
/// @dev arithmetic underflow or overflow
uint256 internal constant UNDER_OVERFLOW = 0x11;
/// @dev division or modulo by zero
uint256 internal constant DIVISION_BY_ZERO = 0x12;
/// @dev enum conversion error
uint256 internal constant ENUM_CONVERSION_ERROR = 0x21;
/// @dev invalid encoding in storage
uint256 internal constant STORAGE_ENCODING_ERROR = 0x22;
/// @dev empty array pop
uint256 internal constant EMPTY_ARRAY_POP = 0x31;
/// @dev array out of bounds access
uint256 internal constant ARRAY_OUT_OF_BOUNDS = 0x32;
/// @dev resource error (too large allocation or too large array)
uint256 internal constant RESOURCE_ERROR = 0x41;
/// @dev calling invalid internal function
uint256 internal constant INVALID_INTERNAL_FUNCTION = 0x51;
/// @dev Reverts with a panic code. Recommended to use with
/// the internal constants with predefined codes.
function panic(uint256 code) internal pure {
assembly ("memory-safe") {
mstore(0x00, 0x4e487b71)
mstore(0x20, code)
revert(0x1c, 0x24)
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../utils/introspection/IERC165.sol";// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.
pragma solidity ^0.8.20;
/**
* @dev Wrappers over Solidity's uintXX/intXX/bool casting operators with added overflow
* checks.
*
* Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
* easily result in undesired exploitation or bugs, since developers usually
* assume that overflows raise errors. `SafeCast` restores this intuition by
* reverting the transaction when such an operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeCast {
/**
* @dev Value doesn't fit in an uint of `bits` size.
*/
error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);
/**
* @dev An int value doesn't fit in an uint of `bits` size.
*/
error SafeCastOverflowedIntToUint(int256 value);
/**
* @dev Value doesn't fit in an int of `bits` size.
*/
error SafeCastOverflowedIntDowncast(uint8 bits, int256 value);
/**
* @dev An uint value doesn't fit in an int of `bits` size.
*/
error SafeCastOverflowedUintToInt(uint256 value);
/**
* @dev Returns the downcasted uint248 from uint256, reverting on
* overflow (when the input is greater than largest uint248).
*
* Counterpart to Solidity's `uint248` operator.
*
* Requirements:
*
* - input must fit into 248 bits
*/
function toUint248(uint256 value) internal pure returns (uint248) {
if (value > type(uint248).max) {
revert SafeCastOverflowedUintDowncast(248, value);
}
return uint248(value);
}
/**
* @dev Returns the downcasted uint240 from uint256, reverting on
* overflow (when the input is greater than largest uint240).
*
* Counterpart to Solidity's `uint240` operator.
*
* Requirements:
*
* - input must fit into 240 bits
*/
function toUint240(uint256 value) internal pure returns (uint240) {
if (value > type(uint240).max) {
revert SafeCastOverflowedUintDowncast(240, value);
}
return uint240(value);
}
/**
* @dev Returns the downcasted uint232 from uint256, reverting on
* overflow (when the input is greater than largest uint232).
*
* Counterpart to Solidity's `uint232` operator.
*
* Requirements:
*
* - input must fit into 232 bits
*/
function toUint232(uint256 value) internal pure returns (uint232) {
if (value > type(uint232).max) {
revert SafeCastOverflowedUintDowncast(232, value);
}
return uint232(value);
}
/**
* @dev Returns the downcasted uint224 from uint256, reverting on
* overflow (when the input is greater than largest uint224).
*
* Counterpart to Solidity's `uint224` operator.
*
* Requirements:
*
* - input must fit into 224 bits
*/
function toUint224(uint256 value) internal pure returns (uint224) {
if (value > type(uint224).max) {
revert SafeCastOverflowedUintDowncast(224, value);
}
return uint224(value);
}
/**
* @dev Returns the downcasted uint216 from uint256, reverting on
* overflow (when the input is greater than largest uint216).
*
* Counterpart to Solidity's `uint216` operator.
*
* Requirements:
*
* - input must fit into 216 bits
*/
function toUint216(uint256 value) internal pure returns (uint216) {
if (value > type(uint216).max) {
revert SafeCastOverflowedUintDowncast(216, value);
}
return uint216(value);
}
/**
* @dev Returns the downcasted uint208 from uint256, reverting on
* overflow (when the input is greater than largest uint208).
*
* Counterpart to Solidity's `uint208` operator.
*
* Requirements:
*
* - input must fit into 208 bits
*/
function toUint208(uint256 value) internal pure returns (uint208) {
if (value > type(uint208).max) {
revert SafeCastOverflowedUintDowncast(208, value);
}
return uint208(value);
}
/**
* @dev Returns the downcasted uint200 from uint256, reverting on
* overflow (when the input is greater than largest uint200).
*
* Counterpart to Solidity's `uint200` operator.
*
* Requirements:
*
* - input must fit into 200 bits
*/
function toUint200(uint256 value) internal pure returns (uint200) {
if (value > type(uint200).max) {
revert SafeCastOverflowedUintDowncast(200, value);
}
return uint200(value);
}
/**
* @dev Returns the downcasted uint192 from uint256, reverting on
* overflow (when the input is greater than largest uint192).
*
* Counterpart to Solidity's `uint192` operator.
*
* Requirements:
*
* - input must fit into 192 bits
*/
function toUint192(uint256 value) internal pure returns (uint192) {
if (value > type(uint192).max) {
revert SafeCastOverflowedUintDowncast(192, value);
}
return uint192(value);
}
/**
* @dev Returns the downcasted uint184 from uint256, reverting on
* overflow (when the input is greater than largest uint184).
*
* Counterpart to Solidity's `uint184` operator.
*
* Requirements:
*
* - input must fit into 184 bits
*/
function toUint184(uint256 value) internal pure returns (uint184) {
if (value > type(uint184).max) {
revert SafeCastOverflowedUintDowncast(184, value);
}
return uint184(value);
}
/**
* @dev Returns the downcasted uint176 from uint256, reverting on
* overflow (when the input is greater than largest uint176).
*
* Counterpart to Solidity's `uint176` operator.
*
* Requirements:
*
* - input must fit into 176 bits
*/
function toUint176(uint256 value) internal pure returns (uint176) {
if (value > type(uint176).max) {
revert SafeCastOverflowedUintDowncast(176, value);
}
return uint176(value);
}
/**
* @dev Returns the downcasted uint168 from uint256, reverting on
* overflow (when the input is greater than largest uint168).
*
* Counterpart to Solidity's `uint168` operator.
*
* Requirements:
*
* - input must fit into 168 bits
*/
function toUint168(uint256 value) internal pure returns (uint168) {
if (value > type(uint168).max) {
revert SafeCastOverflowedUintDowncast(168, value);
}
return uint168(value);
}
/**
* @dev Returns the downcasted uint160 from uint256, reverting on
* overflow (when the input is greater than largest uint160).
*
* Counterpart to Solidity's `uint160` operator.
*
* Requirements:
*
* - input must fit into 160 bits
*/
function toUint160(uint256 value) internal pure returns (uint160) {
if (value > type(uint160).max) {
revert SafeCastOverflowedUintDowncast(160, value);
}
return uint160(value);
}
/**
* @dev Returns the downcasted uint152 from uint256, reverting on
* overflow (when the input is greater than largest uint152).
*
* Counterpart to Solidity's `uint152` operator.
*
* Requirements:
*
* - input must fit into 152 bits
*/
function toUint152(uint256 value) internal pure returns (uint152) {
if (value > type(uint152).max) {
revert SafeCastOverflowedUintDowncast(152, value);
}
return uint152(value);
}
/**
* @dev Returns the downcasted uint144 from uint256, reverting on
* overflow (when the input is greater than largest uint144).
*
* Counterpart to Solidity's `uint144` operator.
*
* Requirements:
*
* - input must fit into 144 bits
*/
function toUint144(uint256 value) internal pure returns (uint144) {
if (value > type(uint144).max) {
revert SafeCastOverflowedUintDowncast(144, value);
}
return uint144(value);
}
/**
* @dev Returns the downcasted uint136 from uint256, reverting on
* overflow (when the input is greater than largest uint136).
*
* Counterpart to Solidity's `uint136` operator.
*
* Requirements:
*
* - input must fit into 136 bits
*/
function toUint136(uint256 value) internal pure returns (uint136) {
if (value > type(uint136).max) {
revert SafeCastOverflowedUintDowncast(136, value);
}
return uint136(value);
}
/**
* @dev Returns the downcasted uint128 from uint256, reverting on
* overflow (when the input is greater than largest uint128).
*
* Counterpart to Solidity's `uint128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*/
function toUint128(uint256 value) internal pure returns (uint128) {
if (value > type(uint128).max) {
revert SafeCastOverflowedUintDowncast(128, value);
}
return uint128(value);
}
/**
* @dev Returns the downcasted uint120 from uint256, reverting on
* overflow (when the input is greater than largest uint120).
*
* Counterpart to Solidity's `uint120` operator.
*
* Requirements:
*
* - input must fit into 120 bits
*/
function toUint120(uint256 value) internal pure returns (uint120) {
if (value > type(uint120).max) {
revert SafeCastOverflowedUintDowncast(120, value);
}
return uint120(value);
}
/**
* @dev Returns the downcasted uint112 from uint256, reverting on
* overflow (when the input is greater than largest uint112).
*
* Counterpart to Solidity's `uint112` operator.
*
* Requirements:
*
* - input must fit into 112 bits
*/
function toUint112(uint256 value) internal pure returns (uint112) {
if (value > type(uint112).max) {
revert SafeCastOverflowedUintDowncast(112, value);
}
return uint112(value);
}
/**
* @dev Returns the downcasted uint104 from uint256, reverting on
* overflow (when the input is greater than largest uint104).
*
* Counterpart to Solidity's `uint104` operator.
*
* Requirements:
*
* - input must fit into 104 bits
*/
function toUint104(uint256 value) internal pure returns (uint104) {
if (value > type(uint104).max) {
revert SafeCastOverflowedUintDowncast(104, value);
}
return uint104(value);
}
/**
* @dev Returns the downcasted uint96 from uint256, reverting on
* overflow (when the input is greater than largest uint96).
*
* Counterpart to Solidity's `uint96` operator.
*
* Requirements:
*
* - input must fit into 96 bits
*/
function toUint96(uint256 value) internal pure returns (uint96) {
if (value > type(uint96).max) {
revert SafeCastOverflowedUintDowncast(96, value);
}
return uint96(value);
}
/**
* @dev Returns the downcasted uint88 from uint256, reverting on
* overflow (when the input is greater than largest uint88).
*
* Counterpart to Solidity's `uint88` operator.
*
* Requirements:
*
* - input must fit into 88 bits
*/
function toUint88(uint256 value) internal pure returns (uint88) {
if (value > type(uint88).max) {
revert SafeCastOverflowedUintDowncast(88, value);
}
return uint88(value);
}
/**
* @dev Returns the downcasted uint80 from uint256, reverting on
* overflow (when the input is greater than largest uint80).
*
* Counterpart to Solidity's `uint80` operator.
*
* Requirements:
*
* - input must fit into 80 bits
*/
function toUint80(uint256 value) internal pure returns (uint80) {
if (value > type(uint80).max) {
revert SafeCastOverflowedUintDowncast(80, value);
}
return uint80(value);
}
/**
* @dev Returns the downcasted uint72 from uint256, reverting on
* overflow (when the input is greater than largest uint72).
*
* Counterpart to Solidity's `uint72` operator.
*
* Requirements:
*
* - input must fit into 72 bits
*/
function toUint72(uint256 value) internal pure returns (uint72) {
if (value > type(uint72).max) {
revert SafeCastOverflowedUintDowncast(72, value);
}
return uint72(value);
}
/**
* @dev Returns the downcasted uint64 from uint256, reverting on
* overflow (when the input is greater than largest uint64).
*
* Counterpart to Solidity's `uint64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*/
function toUint64(uint256 value) internal pure returns (uint64) {
if (value > type(uint64).max) {
revert SafeCastOverflowedUintDowncast(64, value);
}
return uint64(value);
}
/**
* @dev Returns the downcasted uint56 from uint256, reverting on
* overflow (when the input is greater than largest uint56).
*
* Counterpart to Solidity's `uint56` operator.
*
* Requirements:
*
* - input must fit into 56 bits
*/
function toUint56(uint256 value) internal pure returns (uint56) {
if (value > type(uint56).max) {
revert SafeCastOverflowedUintDowncast(56, value);
}
return uint56(value);
}
/**
* @dev Returns the downcasted uint48 from uint256, reverting on
* overflow (when the input is greater than largest uint48).
*
* Counterpart to Solidity's `uint48` operator.
*
* Requirements:
*
* - input must fit into 48 bits
*/
function toUint48(uint256 value) internal pure returns (uint48) {
if (value > type(uint48).max) {
revert SafeCastOverflowedUintDowncast(48, value);
}
return uint48(value);
}
/**
* @dev Returns the downcasted uint40 from uint256, reverting on
* overflow (when the input is greater than largest uint40).
*
* Counterpart to Solidity's `uint40` operator.
*
* Requirements:
*
* - input must fit into 40 bits
*/
function toUint40(uint256 value) internal pure returns (uint40) {
if (value > type(uint40).max) {
revert SafeCastOverflowedUintDowncast(40, value);
}
return uint40(value);
}
/**
* @dev Returns the downcasted uint32 from uint256, reverting on
* overflow (when the input is greater than largest uint32).
*
* Counterpart to Solidity's `uint32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*/
function toUint32(uint256 value) internal pure returns (uint32) {
if (value > type(uint32).max) {
revert SafeCastOverflowedUintDowncast(32, value);
}
return uint32(value);
}
/**
* @dev Returns the downcasted uint24 from uint256, reverting on
* overflow (when the input is greater than largest uint24).
*
* Counterpart to Solidity's `uint24` operator.
*
* Requirements:
*
* - input must fit into 24 bits
*/
function toUint24(uint256 value) internal pure returns (uint24) {
if (value > type(uint24).max) {
revert SafeCastOverflowedUintDowncast(24, value);
}
return uint24(value);
}
/**
* @dev Returns the downcasted uint16 from uint256, reverting on
* overflow (when the input is greater than largest uint16).
*
* Counterpart to Solidity's `uint16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*/
function toUint16(uint256 value) internal pure returns (uint16) {
if (value > type(uint16).max) {
revert SafeCastOverflowedUintDowncast(16, value);
}
return uint16(value);
}
/**
* @dev Returns the downcasted uint8 from uint256, reverting on
* overflow (when the input is greater than largest uint8).
*
* Counterpart to Solidity's `uint8` operator.
*
* Requirements:
*
* - input must fit into 8 bits
*/
function toUint8(uint256 value) internal pure returns (uint8) {
if (value > type(uint8).max) {
revert SafeCastOverflowedUintDowncast(8, value);
}
return uint8(value);
}
/**
* @dev Converts a signed int256 into an unsigned uint256.
*
* Requirements:
*
* - input must be greater than or equal to 0.
*/
function toUint256(int256 value) internal pure returns (uint256) {
if (value < 0) {
revert SafeCastOverflowedIntToUint(value);
}
return uint256(value);
}
/**
* @dev Returns the downcasted int248 from int256, reverting on
* overflow (when the input is less than smallest int248 or
* greater than largest int248).
*
* Counterpart to Solidity's `int248` operator.
*
* Requirements:
*
* - input must fit into 248 bits
*/
function toInt248(int256 value) internal pure returns (int248 downcasted) {
downcasted = int248(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(248, value);
}
}
/**
* @dev Returns the downcasted int240 from int256, reverting on
* overflow (when the input is less than smallest int240 or
* greater than largest int240).
*
* Counterpart to Solidity's `int240` operator.
*
* Requirements:
*
* - input must fit into 240 bits
*/
function toInt240(int256 value) internal pure returns (int240 downcasted) {
downcasted = int240(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(240, value);
}
}
/**
* @dev Returns the downcasted int232 from int256, reverting on
* overflow (when the input is less than smallest int232 or
* greater than largest int232).
*
* Counterpart to Solidity's `int232` operator.
*
* Requirements:
*
* - input must fit into 232 bits
*/
function toInt232(int256 value) internal pure returns (int232 downcasted) {
downcasted = int232(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(232, value);
}
}
/**
* @dev Returns the downcasted int224 from int256, reverting on
* overflow (when the input is less than smallest int224 or
* greater than largest int224).
*
* Counterpart to Solidity's `int224` operator.
*
* Requirements:
*
* - input must fit into 224 bits
*/
function toInt224(int256 value) internal pure returns (int224 downcasted) {
downcasted = int224(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(224, value);
}
}
/**
* @dev Returns the downcasted int216 from int256, reverting on
* overflow (when the input is less than smallest int216 or
* greater than largest int216).
*
* Counterpart to Solidity's `int216` operator.
*
* Requirements:
*
* - input must fit into 216 bits
*/
function toInt216(int256 value) internal pure returns (int216 downcasted) {
downcasted = int216(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(216, value);
}
}
/**
* @dev Returns the downcasted int208 from int256, reverting on
* overflow (when the input is less than smallest int208 or
* greater than largest int208).
*
* Counterpart to Solidity's `int208` operator.
*
* Requirements:
*
* - input must fit into 208 bits
*/
function toInt208(int256 value) internal pure returns (int208 downcasted) {
downcasted = int208(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(208, value);
}
}
/**
* @dev Returns the downcasted int200 from int256, reverting on
* overflow (when the input is less than smallest int200 or
* greater than largest int200).
*
* Counterpart to Solidity's `int200` operator.
*
* Requirements:
*
* - input must fit into 200 bits
*/
function toInt200(int256 value) internal pure returns (int200 downcasted) {
downcasted = int200(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(200, value);
}
}
/**
* @dev Returns the downcasted int192 from int256, reverting on
* overflow (when the input is less than smallest int192 or
* greater than largest int192).
*
* Counterpart to Solidity's `int192` operator.
*
* Requirements:
*
* - input must fit into 192 bits
*/
function toInt192(int256 value) internal pure returns (int192 downcasted) {
downcasted = int192(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(192, value);
}
}
/**
* @dev Returns the downcasted int184 from int256, reverting on
* overflow (when the input is less than smallest int184 or
* greater than largest int184).
*
* Counterpart to Solidity's `int184` operator.
*
* Requirements:
*
* - input must fit into 184 bits
*/
function toInt184(int256 value) internal pure returns (int184 downcasted) {
downcasted = int184(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(184, value);
}
}
/**
* @dev Returns the downcasted int176 from int256, reverting on
* overflow (when the input is less than smallest int176 or
* greater than largest int176).
*
* Counterpart to Solidity's `int176` operator.
*
* Requirements:
*
* - input must fit into 176 bits
*/
function toInt176(int256 value) internal pure returns (int176 downcasted) {
downcasted = int176(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(176, value);
}
}
/**
* @dev Returns the downcasted int168 from int256, reverting on
* overflow (when the input is less than smallest int168 or
* greater than largest int168).
*
* Counterpart to Solidity's `int168` operator.
*
* Requirements:
*
* - input must fit into 168 bits
*/
function toInt168(int256 value) internal pure returns (int168 downcasted) {
downcasted = int168(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(168, value);
}
}
/**
* @dev Returns the downcasted int160 from int256, reverting on
* overflow (when the input is less than smallest int160 or
* greater than largest int160).
*
* Counterpart to Solidity's `int160` operator.
*
* Requirements:
*
* - input must fit into 160 bits
*/
function toInt160(int256 value) internal pure returns (int160 downcasted) {
downcasted = int160(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(160, value);
}
}
/**
* @dev Returns the downcasted int152 from int256, reverting on
* overflow (when the input is less than smallest int152 or
* greater than largest int152).
*
* Counterpart to Solidity's `int152` operator.
*
* Requirements:
*
* - input must fit into 152 bits
*/
function toInt152(int256 value) internal pure returns (int152 downcasted) {
downcasted = int152(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(152, value);
}
}
/**
* @dev Returns the downcasted int144 from int256, reverting on
* overflow (when the input is less than smallest int144 or
* greater than largest int144).
*
* Counterpart to Solidity's `int144` operator.
*
* Requirements:
*
* - input must fit into 144 bits
*/
function toInt144(int256 value) internal pure returns (int144 downcasted) {
downcasted = int144(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(144, value);
}
}
/**
* @dev Returns the downcasted int136 from int256, reverting on
* overflow (when the input is less than smallest int136 or
* greater than largest int136).
*
* Counterpart to Solidity's `int136` operator.
*
* Requirements:
*
* - input must fit into 136 bits
*/
function toInt136(int256 value) internal pure returns (int136 downcasted) {
downcasted = int136(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(136, value);
}
}
/**
* @dev Returns the downcasted int128 from int256, reverting on
* overflow (when the input is less than smallest int128 or
* greater than largest int128).
*
* Counterpart to Solidity's `int128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*/
function toInt128(int256 value) internal pure returns (int128 downcasted) {
downcasted = int128(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(128, value);
}
}
/**
* @dev Returns the downcasted int120 from int256, reverting on
* overflow (when the input is less than smallest int120 or
* greater than largest int120).
*
* Counterpart to Solidity's `int120` operator.
*
* Requirements:
*
* - input must fit into 120 bits
*/
function toInt120(int256 value) internal pure returns (int120 downcasted) {
downcasted = int120(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(120, value);
}
}
/**
* @dev Returns the downcasted int112 from int256, reverting on
* overflow (when the input is less than smallest int112 or
* greater than largest int112).
*
* Counterpart to Solidity's `int112` operator.
*
* Requirements:
*
* - input must fit into 112 bits
*/
function toInt112(int256 value) internal pure returns (int112 downcasted) {
downcasted = int112(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(112, value);
}
}
/**
* @dev Returns the downcasted int104 from int256, reverting on
* overflow (when the input is less than smallest int104 or
* greater than largest int104).
*
* Counterpart to Solidity's `int104` operator.
*
* Requirements:
*
* - input must fit into 104 bits
*/
function toInt104(int256 value) internal pure returns (int104 downcasted) {
downcasted = int104(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(104, value);
}
}
/**
* @dev Returns the downcasted int96 from int256, reverting on
* overflow (when the input is less than smallest int96 or
* greater than largest int96).
*
* Counterpart to Solidity's `int96` operator.
*
* Requirements:
*
* - input must fit into 96 bits
*/
function toInt96(int256 value) internal pure returns (int96 downcasted) {
downcasted = int96(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(96, value);
}
}
/**
* @dev Returns the downcasted int88 from int256, reverting on
* overflow (when the input is less than smallest int88 or
* greater than largest int88).
*
* Counterpart to Solidity's `int88` operator.
*
* Requirements:
*
* - input must fit into 88 bits
*/
function toInt88(int256 value) internal pure returns (int88 downcasted) {
downcasted = int88(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(88, value);
}
}
/**
* @dev Returns the downcasted int80 from int256, reverting on
* overflow (when the input is less than smallest int80 or
* greater than largest int80).
*
* Counterpart to Solidity's `int80` operator.
*
* Requirements:
*
* - input must fit into 80 bits
*/
function toInt80(int256 value) internal pure returns (int80 downcasted) {
downcasted = int80(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(80, value);
}
}
/**
* @dev Returns the downcasted int72 from int256, reverting on
* overflow (when the input is less than smallest int72 or
* greater than largest int72).
*
* Counterpart to Solidity's `int72` operator.
*
* Requirements:
*
* - input must fit into 72 bits
*/
function toInt72(int256 value) internal pure returns (int72 downcasted) {
downcasted = int72(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(72, value);
}
}
/**
* @dev Returns the downcasted int64 from int256, reverting on
* overflow (when the input is less than smallest int64 or
* greater than largest int64).
*
* Counterpart to Solidity's `int64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*/
function toInt64(int256 value) internal pure returns (int64 downcasted) {
downcasted = int64(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(64, value);
}
}
/**
* @dev Returns the downcasted int56 from int256, reverting on
* overflow (when the input is less than smallest int56 or
* greater than largest int56).
*
* Counterpart to Solidity's `int56` operator.
*
* Requirements:
*
* - input must fit into 56 bits
*/
function toInt56(int256 value) internal pure returns (int56 downcasted) {
downcasted = int56(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(56, value);
}
}
/**
* @dev Returns the downcasted int48 from int256, reverting on
* overflow (when the input is less than smallest int48 or
* greater than largest int48).
*
* Counterpart to Solidity's `int48` operator.
*
* Requirements:
*
* - input must fit into 48 bits
*/
function toInt48(int256 value) internal pure returns (int48 downcasted) {
downcasted = int48(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(48, value);
}
}
/**
* @dev Returns the downcasted int40 from int256, reverting on
* overflow (when the input is less than smallest int40 or
* greater than largest int40).
*
* Counterpart to Solidity's `int40` operator.
*
* Requirements:
*
* - input must fit into 40 bits
*/
function toInt40(int256 value) internal pure returns (int40 downcasted) {
downcasted = int40(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(40, value);
}
}
/**
* @dev Returns the downcasted int32 from int256, reverting on
* overflow (when the input is less than smallest int32 or
* greater than largest int32).
*
* Counterpart to Solidity's `int32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*/
function toInt32(int256 value) internal pure returns (int32 downcasted) {
downcasted = int32(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(32, value);
}
}
/**
* @dev Returns the downcasted int24 from int256, reverting on
* overflow (when the input is less than smallest int24 or
* greater than largest int24).
*
* Counterpart to Solidity's `int24` operator.
*
* Requirements:
*
* - input must fit into 24 bits
*/
function toInt24(int256 value) internal pure returns (int24 downcasted) {
downcasted = int24(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(24, value);
}
}
/**
* @dev Returns the downcasted int16 from int256, reverting on
* overflow (when the input is less than smallest int16 or
* greater than largest int16).
*
* Counterpart to Solidity's `int16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*/
function toInt16(int256 value) internal pure returns (int16 downcasted) {
downcasted = int16(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(16, value);
}
}
/**
* @dev Returns the downcasted int8 from int256, reverting on
* overflow (when the input is less than smallest int8 or
* greater than largest int8).
*
* Counterpart to Solidity's `int8` operator.
*
* Requirements:
*
* - input must fit into 8 bits
*/
function toInt8(int256 value) internal pure returns (int8 downcasted) {
downcasted = int8(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(8, value);
}
}
/**
* @dev Converts an unsigned uint256 into a signed int256.
*
* Requirements:
*
* - input must be less than or equal to maxInt256.
*/
function toInt256(uint256 value) internal pure returns (int256) {
// Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
if (value > uint256(type(int256).max)) {
revert SafeCastOverflowedUintToInt(value);
}
return int256(value);
}
/**
* @dev Cast a boolean (false or true) to a uint256 (0 or 1) with no jump.
*/
function toUint(bool b) internal pure returns (uint256 u) {
assembly ("memory-safe") {
u := iszero(iszero(b))
}
}
}// SPDX-License-Identifier: MIT pragma solidity ^0.8.30; /// @notice Thrown when trying to transfer tokens without calldata to the contract. error EtherReceptionDisabled(); /// @notice Thrown when the multiple related arrays have different lengths. error InconsistentArrayLengths(); /// @notice Thrown when an ETH transfer has failed. error TransferFailed();
// SPDX-License-Identifier: MIT pragma solidity ^0.8.30; /// @notice Thrown when an account is not the contract owner but is required to. /// @param account The account that was checked. error NotContractOwner(address account); /// @notice Thrown when an account is not the pending contract owner but is required to. /// @param account The account that was checked. error NotPendingContractOwner(address account); /// @notice Thrown when an account is not the target contract owner but is required to. /// @param targetContract The contract that was checked. /// @param account The account that was checked. error NotTargetContractOwner(address targetContract, address account);
// SPDX-License-Identifier: MIT pragma solidity ^0.8.30; /// @notice Emitted when the contract ownership changes. /// @param previousOwner the previous contract owner. /// @param newOwner the new contract owner. event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /// @notice Emitted when a new contract owner is pending. /// @param pendingOwner the address of the new contract owner. event OwnershipTransferPending(address indexed pendingOwner);
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
/// @title ERC165 Interface Detection Standard.
/// @dev See https://eips.ethereum.org/EIPS/eip-165.
/// @dev Note: The ERC-165 identifier for this interface is 0x01ffc9a7.
interface IERC165 {
/// @notice Returns whether this contract implements a given interface.
/// @dev Note: This function call must use less than 30 000 gas.
/// @param interfaceId the interface identifier to test.
/// @return supported True if the interface is supported, false if `interfaceId` is `0xffffffff` or if the interface is not supported.
function supportsInterface(bytes4 interfaceId) external view returns (bool supported);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
/// @title ERC-173 Contract Ownership Standard (functions)
/// @dev See https://eips.ethereum.org/EIPS/eip-173
/// @dev Note: the ERC-165 identifier for this interface is 0x7f5828d0
interface IERC173 {
/// @notice Sets the address of the new contract owner.
/// @dev Reverts if the sender is not the contract owner.
/// @dev Emits an {OwnershipTransferred} event if `newOwner` is different from the current contract owner.
/// @param newOwner The address of the new contract owner. Using the zero address means renouncing ownership.
function transferOwnership(address newOwner) external;
/// @notice Gets the address of the contract owner.
/// @return contractOwner The address of the contract owner.
function owner() external view returns (address contractOwner);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
import {InitializationPhaseAlreadyReached} from "./../errors/ProxyInitializationErrors.sol";
import {StorageSlot} from "@openzeppelin/contracts/utils/StorageSlot.sol";
/// @notice Multiple calls protection for storage-modifying proxy initialization functions.
library ProxyInitialization {
/// @notice Sets the initialization phase during a storage-modifying proxy initialization function.
/// @dev Reverts with {InitializationPhaseAlreadyReached} if `phase` has been reached already.
/// @param storageSlot the storage slot where `phase` is stored.
/// @param phase the initialization phase.
function setPhase(bytes32 storageSlot, uint256 phase) internal {
StorageSlot.Uint256Slot storage currentVersion = StorageSlot.getUint256Slot(storageSlot);
uint256 currentPhase = currentVersion.value;
if (currentPhase >= phase) revert InitializationPhaseAlreadyReached(currentPhase, phase);
currentVersion.value = phase;
}
}// SPDX-License-Identifier: MIT pragma solidity ^0.8.30; /// @notice Thrown when setting the illegal interfaceId 0xffffffff. error IllegalInterfaceId();
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.2.0) (utils/Address.sol)
pragma solidity ^0.8.20;
import {Errors} from "./Errors.sol";
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @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 Errors.InsufficientBalance(address(this).balance, amount);
}
(bool success, bytes memory returndata) = recipient.call{value: amount}("");
if (!success) {
_revert(returndata);
}
}
/**
* @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
* {Errors.FailedCall} 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 Errors.InsufficientBalance(address(this).balance, value);
}
(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 {Errors.FailedCall}) 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 {Errors.FailedCall} 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 {Errors.FailedCall}.
*/
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
assembly ("memory-safe") {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert Errors.FailedCall();
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC-165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[ERC].
*
* 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[ERC 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 pragma solidity ^0.8.30; /// @notice Emitted when trying to set a phase value that has already been reached. /// @param currentPhase The current phase. /// @param newPhase The new phase trying to be set. error InitializationPhaseAlreadyReached(uint256 currentPhase, uint256 newPhase);
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Errors.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of common custom errors used in multiple contracts
*
* IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library.
* It is recommended to avoid relying on the error API for critical functionality.
*
* _Available since v5.1._
*/
library Errors {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error InsufficientBalance(uint256 balance, uint256 needed);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedCall();
/**
* @dev The deployment failed.
*/
error FailedDeployment();
/**
* @dev A necessary precompile is missing.
*/
error MissingPrecompile(address);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.
pragma solidity ^0.8.20;
/**
* @dev Library for reading and writing primitive types to specific storage slots.
*
* Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
*
* Example usage to set ERC-1967 implementation slot:
* ```solidity
* contract ERC1967 {
* // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(newImplementation.code.length > 0);
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*
* TIP: Consider using this library along with {SlotDerivation}.
*/
library StorageSlot {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
struct Int256Slot {
int256 value;
}
struct StringSlot {
string value;
}
struct BytesSlot {
bytes value;
}
/**
* @dev Returns an `AddressSlot` with member `value` located at `slot`.
*/
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Int256Slot` with member `value` located at `slot`.
*/
function getInt256Slot(bytes32 slot) internal pure returns (Int256Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `StringSlot` with member `value` located at `slot`.
*/
function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` representation of the string storage pointer `store`.
*/
function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
assembly ("memory-safe") {
r.slot := store.slot
}
}
/**
* @dev Returns a `BytesSlot` with member `value` located at `slot`.
*/
function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
*/
function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
assembly ("memory-safe") {
r.slot := store.slot
}
}
}{
"viaIR": true,
"optimizer": {
"enabled": true,
"mode": "3"
},
"evmVersion": "paris",
"outputSelection": {
"*": {
"*": [
"abi"
]
}
},
"detectMissingLibraries": false,
"forceEVMLA": false,
"enableEraVMExtensions": false,
"codegen": "yul",
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"claimContract","type":"address"},{"internalType":"contract IERC20","name":"stakingToken","type":"address"},{"internalType":"contract IPointsV2","name":"pointsContract","type":"address"},{"internalType":"bytes32","name":"depositReasonCode","type":"bytes32"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"FailedCall","type":"error"},{"inputs":[],"name":"IllegalInterfaceId","type":"error"},{"inputs":[],"name":"InconsistentArrayLengths","type":"error"},{"inputs":[{"internalType":"address","name":"tokenContract","type":"address"}],"name":"IncorrectTokenContractType","type":"error"},{"inputs":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"InsufficientBalance","type":"error"},{"inputs":[{"internalType":"uint256","name":"claimable","type":"uint256"},{"internalType":"uint256","name":"claimed","type":"uint256"},{"internalType":"uint256","name":"unclaimed","type":"uint256"}],"name":"InvalidClaimSum","type":"error"},{"inputs":[],"name":"InvalidDuration","type":"error"},{"inputs":[],"name":"InvalidPointsContract","type":"error"},{"inputs":[{"internalType":"uint256","name":"requested","type":"uint256"},{"internalType":"uint256","name":"recoverable","type":"uint256"}],"name":"InvalidRecoveryAmount","type":"error"},{"inputs":[],"name":"InvalidRewardAmount","type":"error"},{"inputs":[],"name":"InvalidStakeAmount","type":"error"},{"inputs":[],"name":"InvalidToken","type":"error"},{"inputs":[],"name":"InvalidWithdrawAmount","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"NotContractOwner","type":"error"},{"inputs":[{"internalType":"address","name":"staker","type":"address"},{"internalType":"uint256","name":"stake","type":"uint256"},{"internalType":"uint256","name":"withdraw","type":"uint256"}],"name":"NotEnoughStake","type":"error"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"NotRoleHolder","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"uint256","name":"currentRewardRate","type":"uint256"},{"internalType":"uint256","name":"newRewardRate","type":"uint256"}],"name":"RewardDilution","type":"error"},{"inputs":[],"name":"RewardOverflow","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"ScalingFactorOutOfBounds","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":false,"internalType":"bytes","name":"claimData","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"claimed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"unclaimed","type":"uint256"}],"name":"Claimed","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":"address","name":"rewarder","type":"address"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"duration","type":"uint256"}],"name":"RewardAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"address","name":"operator","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"address","name":"operator","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":false,"internalType":"bytes","name":"stakeData","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"stakePoints","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":false,"internalType":"bytes","name":"withdrawData","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"stakePoints","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"CLAIM_CONTRACT","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEPOSIT_REASON_CODE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"POINTS_CONTRACT","outputs":[{"internalType":"contract IPointsV2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REWARDER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SCALING_FACTOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STAKING_TOKEN","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"reward","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"}],"name":"addReward","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"claimData","type":"bytes"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"distributionEnd","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"earned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"forwarderRegistry","outputs":[{"internalType":"contract IForwarderRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"hasRole_","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"forwarder","type":"address"}],"name":"isTrustedForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastTimeRewardApplicable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastUpdated","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC20Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"contract IERC20[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"recoverERC20s","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"contract IERC721[]","name":"contracts","type":"address[]"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"recoverERC721s","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"recoverETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardPerStakePoint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"staker","type":"address"}],"name":"rewardPerStakePointPaid","outputs":[{"internalType":"uint256","name":"paid","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardPerStakePointStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"staker","type":"address"}],"name":"rewards","outputs":[{"internalType":"uint256","name":"reward","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"stakeData","type":"bytes"}],"name":"stake","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"staker","type":"address"}],"name":"staked","outputs":[{"internalType":"uint256","name":"stakePoints","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"withdrawData","type":"bytes"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
9c4d535b0000000000000000000000000000000000000000000000000000000000000000010004ddb07b48702ce1fe46f7e412b37705b06799555a1bf574df3a65ed96b6000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000800000000000000000000000007e9b9b72f9aaf4e2aa4eb29411245742496c37fd0000000000000000000000002226444afcccf9e760c01649ef1f9e66985a4b350000000000000000000000002f65ffb50f16e3ee19a8d22606d9114d1ed66f2c5374616b696e6752657761726400000000000000000000000000000000000000
Deployed Bytecode
0x0002000000000002001900000000000200010000000103550000006003100270000004570030019d00000457033001970000000100200190000000210000c13d0000008002000039000000400020043f000000040030008c000009610000413d000000000201043b000000e002200270000004670020009c000000960000a13d000004680020009c000000d40000213d000004750020009c0000018b0000a13d000004760020009c000001ed0000a13d000004770020009c000008630000613d000004780020009c0000051e0000613d000004790020009c000009610000c13d0000000001000416000000000001004b000009610000c13d0000000401000039000008950000013d0000000002000416000000000002004b000009610000c13d0000001f0230003900000458022001970000014002200039000000400020043f0000001f0430018f00000459053001980000014002500039000000320000613d0000014006000039000000000701034f000000007807043c0000000006860436000000000026004b0000002e0000c13d000000000004004b0000003f0000613d000000000151034f0000000304400210000000000502043300000000054501cf000000000545022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000151019f0000000000120435000000800030008c000009610000413d000001400100043d0000045a0010009c000009610000213d000001600200043d000a00000002001d0000045a0020009c000009610000213d000001800200043d000900000002001d0000045a0020009c000009610000213d000001a00200043d000700000002001d0000000006000411000000000006004b000800000001001d000000630000613d0000045b01000041000000000201041a0000045c02200197000000000262019f000000000021041b0000000001000414000004570010009c0000045701008041000000c0011002100000045d011001c70000800d0200003900000003030000390000045e0400004100000000050000191157114d0000040f0000000100200190000009610000613d0000045f01000041000000000010043f0000046001000041000000200010043f0000000001000414000004570010009c0000045701008041000000c00110021000000461011001c70000801002000039115711520000040f0000000100200190000009610000613d000000000101043b000000000201041a000004d30220019700000001022001bf000000000021041b0000000101000039000000000010041b000000800000043f0000046201000041000000a00010043f0000046301000041000000000010043f0000046001000041000000200010043f0000000001000414000004570010009c0000045701008041000000c00110021000000461011001c70000801002000039115711520000040f00000008030000290000000100200190000009610000613d00000009050000290000045a00500198000000000101043b000000000201041a000004d30220019700000001022001bf000000000021041b0000000a04000029000000c00040043f000008ac0000c13d0000046501000041000000000010043f00000466010000410000115900010430000004810020009c000001750000a13d000004820020009c000001a90000a13d000004830020009c000001f70000a13d000004840020009c000008800000613d000004850020009c0000052d0000613d000004860020009c000009610000c13d000000440030008c000009610000413d0000002402100370000000000202043b000800000002001d0000000401100370000000000101043b000900000001001d11570ff60000040f000004b202000041000000000020043f000004a402000041000000200020043f000a00000001001d0000000001000414000004570010009c0000045701008041000000c00110021000000461011001c70000801002000039115711520000040f0000000100200190000009610000613d000000000101043b0000000a020000290000045a02200197000a00000002001d000000000020043f000000200010043f0000000001000414000004570010009c0000045701008041000000c00110021000000461011001c70000801002000039115711520000040f0000000100200190000009610000613d000000000101043b000000000101041a000000ff00100190000008e90000c13d000004b101000041000000000010043f000004b201000041000000040010043f0000000a01000029000000240010043f000004a1010000410000115900010430000004690020009c000001970000a13d0000046a0020009c0000021a0000a13d0000046b0020009c000008910000613d0000046c0020009c000005fd0000613d0000046d0020009c000009610000c13d0000000002000416000000000002004b000009610000c13d000000440030008c000009610000413d0000000402100370000000000202043b000004990020009c000009610000213d0000002304200039000000000034004b000009610000813d0000000404200039000000000441034f000000000504043b000004990050009c000009610000213d000700240020003d00000005025002100000000702200029000000000032004b000009610000213d0000002402100370000000000202043b000004990020009c000009610000213d0000002304200039000000000034004b000009610000813d0000000404200039000000000141034f000000000101043b000a00000001001d000004990010009c000009610000213d000600240020003d0000000a0100002900000005011002100000000601100029000000000031004b000009610000213d000500000005001d11570ff60000040f0000045a011001970000045b02000041000000000202041a0000045a02200197000000000021004b000008990000c13d0000000a02000029000000050020006b00000a380000c13d0000000503000029000000000003004b000009240000613d0000000004000019000000050140021000000007021000290000000102200367000000000202043b0000045a0020009c000009610000213d000900000002001d000800000004001d000000000034004b00000bd00000813d00000006011000290000000101100367000000000101043b000a00000001001d0000049c010000410000000000100443000000000100041000000004001004430000000001000414000004570010009c0000045701008041000000c0011002100000049d011001c70000800a02000039115711520000040f000000010020019000000e290000613d000000000101043b0000000a03000029000000000031004b000000090100002900000bd60000413d0000045a041001970000000001000414000004570010009c0000045701008041000000c001100210000000000003004b000001410000613d0000045d011001c700008009020000390000000005000019000001420000013d00000000020400191157114d0000040f00000060031002700000045705300198000000800400003900000060030000390000016d0000613d0000001f0350003900000458033001970000003f033000390000049e04300197000000400300043d0000000004430019000000000034004b00000000060000390000000106004039000004990040009c00000c7b0000213d000000010060019000000c7b0000c13d000000400040043f000000000453043600000459075001980000000006740019000001600000613d000000000801034f0000000009040019000000008a08043c0000000009a90436000000000069004b0000015c0000c13d0000001f055001900000016d0000613d000000000171034f0000000305500210000000000706043300000000075701cf000000000757022f000000000101043b0000010005500089000000000151022f00000000015101cf000000000171019f0000000000160435000000010020019000000be20000613d000000080400002900000001044000390000000503000029000000000034004b000001160000413d000009240000013d0000048e0020009c000001ba0000213d000004940020009c0000022e0000213d000004970020009c0000061e0000613d000004980020009c000009610000c13d0000000002000416000000000002004b000009610000c13d000000240030008c000009610000413d0000000401100370000000000101043b000004d100100198000009610000c13d0000008002000039000004d20010009c000008c80000a13d0000000001000019000009380000013d0000047c0020009c000001cb0000213d0000047f0020009c000002480000613d000004800020009c000009610000c13d0000000001000416000000000001004b000009610000c13d11570ef90000040f000000400200043d000009390000013d000004700020009c000001d60000213d000004730020009c0000024d0000613d000004740020009c000009610000c13d0000000002000416000000000002004b000009610000c13d000000240030008c000009610000413d0000000401100370000000000101043b0000045a0010009c000009610000213d000000000010043f0000000801000039000005290000013d000004890020009c000001df0000213d0000048c0020009c000003330000613d0000048d0020009c000009610000c13d0000000001000416000000000001004b000009610000c13d0000000001000412001100000001001d001000600000003d000080050100003900000044030000390000000004000415000000110440008a0000088a0000013d0000048f0020009c0000023e0000213d000004920020009c0000062a0000613d000004930020009c000009610000c13d0000000001000416000000000001004b000009610000c13d0000000001000412001500000001001d001400800000003d000080050100003900000044030000390000000004000415000000150440008a000002280000013d0000047d0020009c000003d80000613d0000047e0020009c000009610000c13d0000000001000416000000000001004b000009610000c13d000004b201000041000000800010043f000004a201000041000011580001042e000004710020009c000003dd0000613d000004720020009c000009610000c13d0000000001000416000000000001004b000009610000c13d0000000201000039000008950000013d0000048a0020009c000004b60000613d0000048b0020009c000009610000c13d0000000001000416000000000001004b000009610000c13d000000000100041a000000020010008c0000089e0000c13d000004d001000041000000000010043f000004660100004100001159000104300000047a0020009c0000069f0000613d0000047b0020009c000009610000c13d0000000001000416000000000001004b000009610000c13d0000045b01000041000000000101041a0000088d0000013d000004870020009c000006d10000613d000004880020009c000009610000c13d0000000002000416000000000002004b000009610000c13d000000240030008c000009610000413d0000000401100370000000000101043b000a00000001001d0000045a0010009c000009610000213d0000000001000412001900000001001d001800000000003d000080050100003900000044030000390000000004000415000000190440008a0000000504400210000004a3020000411157112f0000040f0000045a011001970000000a0010006b00000000020000390000000102006039000000000001004b0000000001000039000000010100c039000000000121016f000000800010043f000004a201000041000011580001042e0000046e0020009c000007ee0000613d0000046f0020009c000009610000c13d0000000001000416000000000001004b000009610000c13d0000000001000412000d00000001001d000c00200000003d0000800501000039000000440300003900000000040004150000000d0440008a0000000504400210000004a3020000411157112f0000040f000000800010043f000004a201000041000011580001042e000004950020009c0000084d0000613d000004960020009c000009610000c13d0000000002000416000000000002004b000009610000c13d000000240030008c000009610000413d0000000401100370000000000101043b0000045a0010009c000009610000213d000000000010043f0000000701000039000005290000013d000004900020009c000008580000613d000004910020009c000009610000c13d0000000001000416000000000001004b000009610000c13d11570ec60000040f000000400200043d000009390000013d0000000001000416000000000001004b000009610000c13d0000000301000039000008950000013d0000000002000416000000000002004b000009610000c13d000000640030008c000009610000413d0000000402100370000000000202043b000004990020009c000009610000213d0000002304200039000000000034004b000009610000813d0000000404200039000000000441034f000000000404043b000900000004001d000004990040009c000009610000213d000400240020003d000000090200002900000005022002100000000402200029000000000032004b000009610000213d0000002402100370000000000202043b000004990020009c000009610000213d0000002304200039000000000034004b000009610000813d0000000404200039000000000441034f000000000404043b000a00000004001d000004990040009c000009610000213d000300240020003d0000000a0200002900000005022002100000000302200029000000000032004b000009610000213d0000004402100370000000000202043b000004990020009c000009610000213d0000002304200039000000000034004b000009610000813d0000000404200039000000000141034f000000000101043b000800000001001d000004990010009c000009610000213d000200240020003d000000080100002900000005011002100000000201100029000000000031004b000009610000213d11570ff60000040f0000045a011001970000045b02000041000000000202041a0000045a02200197000000000021004b000008990000c13d0000000a02000029000000090020006b00000a380000c13d0000000802000029000000090020006b00000a380000c13d000000090000006b000009240000613d00000000010004100001045a0010019b000a00000000001d0000000a02000029000000090020006c00000bd00000813d00000005022002100000000301200029000500000001001d0000000101100367000000000301043b0000045a0030009c000009610000213d000700000002001d000000400400043d000800000004001d000004ad0100004100000000001404350000000401400039000004ae020000410000000000210435000004570040009c0000045701000041000000000104401900000040011002100000000002000414000004570020009c0000045702008041000000c002200210000000000112019f0000049b011001c7000600000003001d0000000002030019115711520000040f000000080a00002900000060031002700000045703300197000000200030008c00000020040000390000000004034019000000200640019000000000056a0019000002cb0000613d000000000701034f00000000080a0019000000007907043c0000000008980436000000000058004b000002c70000c13d0000001f07400190000002d80000613d000000000661034f0000000307700210000000000805043300000000087801cf000000000878022f000000000606043b0000010007700089000000000676022f00000000067601cf000000000686019f0000000000650435000000010020019000000d2a0000613d0000001f01400039000000600210018f0000000001a20019000000000021004b00000000020000390000000102004039000004990010009c00000c7b0000213d000000010020019000000c7b0000c13d000000400010043f000000200030008c00000007030000290000000602000029000009610000413d00000000010a0433000000010010008c000009610000213d000000000001004b00000d360000613d00000001010003670000000502100360000000000402043b0000045a0040009c000009610000213d0000000402300029000000000221034f000000000202043b000600000002001d0000045a0020009c000009610000213d0000000202300029000000000121034f000000000101043b000700000001001d000004a8010000410000000000100443000800000004001d00000004004004430000000001000414000004570010009c0000045701008041000000c0011002100000049d011001c70000800202000039115711520000040f000000010020019000000e290000613d000000000101043b000000000001004b0000000803000029000009610000613d000000400400043d000000440140003900000007020000290000000000210435000000240140003900000006020000290000000000210435000004af010000410000000000140435000000040140003900000001020000290000000000210435000004570040009c000700000004001d0000045701000041000000000104401900000040011002100000000002000414000004570020009c0000045702008041000000c002200210000000000112019f000004aa011001c700000000020300191157114d0000040f000000010020019000000d380000613d0000000701000029000004990010009c00000c7b0000213d000000400010043f0000000a020000290000000102200039000a00000002001d000000090020006c0000029d0000413d000009240000013d000000240030008c000009610000413d0000000402100370000000000202043b000004990020009c000009610000213d0000002304200039000000000034004b000009610000813d000900040020003d0000000901100360000000000101043b000a00000001001d000004990010009c000009610000213d0000000a012000290000002401100039000000000031004b000009610000213d11570ff60000040f000000400a00043d0000002009a0003900000001020000390000000000290435000000400ca00039000000400200003900000000002c04350000006002a000390000000a040000290000000000420435000004d4034001980000001f0440018f000000800ba0003900000000023b00190000000905000029000000200550003900000001055003670000035f0000613d000000000605034f00000000070b0019000000006806043c0000000007870436000000000027004b0000035b0000c13d000000000004004b0000036c0000613d000000000335034f0000000304400210000000000502043300000000054501cf000000000545022f000000000303043b0000010004400089000000000343022f00000000034301cf000000000353019f00000000003204350000000a0300002900000000023b001900000000000204350000001f02300039000004ab03200197000000600230003900000000002a04350000009f02300039000004c6022001970000000003a20019000000000023004b00000000020000390000000102004039000004990030009c00000c7b0000213d000000010020019000000c7b0000c13d00080000000c001d000a0000000a001d000900000009001d000000400030043f000000000200041a000000020020008c000001e90000613d0000000202000039000000000020041b000700000001001d11570f0d0000040f0000000a010000290000000002010433000004c40020009c000009610000213d000000400020008c000009610000413d00000009010000290000000001010433000000010010008c000009610000213d00000008030000290000000004030433000004990040009c000009610000213d00000009032000290000000a044000290000003f02400039000000000032004b0000000005000019000004c505008041000004c502200197000004c506300197000000000762013f000000000062004b0000000002000019000004c502004041000004c50070009c000000000205c019000000000002004b000009610000c13d00000020024000390000000002020433000004990020009c00000c7b0000213d0000001f05200039000004ab055001970000003f05500039000004c606500197000000400500043d0000000006650019000000000056004b00000000070000390000000107004039000004990060009c00000c7b0000213d000000010070019000000c7b0000c13d000000400060043f000000000625043600000040044000390000000007240019000000000037004b000009610000213d000000000002004b000003c70000613d000000000300001900000000076300190000000008340019000000000808043300000000008704350000002003300039000000000023004b000003c00000413d000000000226001900000000000204350000000002050433000004c40020009c000009610000213d000000200020008c000009610000413d0000000002060433000800000002001d000000000001004b00000c650000c13d000000080000006b00000c8d0000c13d000004cc01000041000000000010043f000004660100004100001159000104300000000001000416000000000001004b000009610000c13d0000000101000039000008950000013d0000000002000416000000000002004b000009610000c13d000000240030008c000009610000413d0000000402100370000000000202043b000004990020009c000009610000213d0000002304200039000000000034004b000009610000813d000900040020003d0000000901100360000000000101043b000a00000001001d000004990010009c000009610000213d0000000a012000290000002401100039000000000031004b000009610000213d000000000100041a000000020010008c000001e90000613d0000000201000039000000000010041b11570ff60000040f000800000001001d11570f0d0000040f000000080100002911570e550000040f000700000001001d000000000001004b000008a80000613d000004a301000041000000000010044300000000010004120000000400100443000000200100003900000024001004430000000001000414000004570010009c0000045701008041000000c001100210000004a7011001c70000800502000039115711520000040f000000010020019000000e290000613d000000000101043b000600000001001d000000000001004b000008e30000613d000004a301000041000000000010044300000000010004120000000400100443000000600100003900000024001004430000000001000414000004570010009c0000045701008041000000c001100210000004a7011001c70000800502000039115711520000040f000000010020019000000e290000613d000000000101043b000004a80200004100000000002004430000045a01100197000500000001001d00000004001004430000000001000414000004570010009c0000045701008041000000c0011002100000049d011001c70000800202000039115711520000040f000000010020019000000e290000613d000000000101043b000000000001004b000009610000613d000000060200002900000007122000f9000400000001001d000000400300043d0000002401300039000600000002001d0000000000210435000004a901000041000000000013043500000008010000290000045a02100197000800000003001d0000000401300039000700000002001d0000000000210435000004a301000041000000000010044300000000010004120000000400100443000000800100003900000024001004430000000001000414000004570010009c0000045701008041000000c001100210000004a7011001c70000800502000039115711520000040f000000010020019000000e290000613d000000000101043b000000080300002900000044023000390000000000120435000004570030009c0000045701000041000000000103401900000040011002100000000002000414000004570020009c0000045702008041000000c002200210000000000112019f000004aa011001c700000005020000291157114d0000040f000000010020019000000c020000613d0000000801000029000004990010009c00000c7b0000213d0000000801000029000000400010043f0000000701000029000000000010043f0000000701000039000000200010043f0000000001000414000004570010009c0000045701008041000000c00110021000000461011001c70000801002000039115711520000040f0000000100200190000009610000613d000000000101043b0000000402000029000000000021041b000000400100043d0000006002000039000000000221043600000060031000390000000a040000290000000000430435000004d4054001980000001f0640018f000000800310003900000000045300190000000907000029000000200770003900000001077003670000048d0000613d000000000807034f0000000009030019000000008a08043c0000000009a90436000000000049004b000004890000c13d000000000006004b0000049a0000613d000000000557034f0000000306600210000000000704043300000000076701cf000000000767022f000000000505043b0000010006600089000000000565022f00000000056501cf000000000575019f00000000005404350000000a050000290000000004350019000000000004043500000006040000290000000000420435000000400210003900000000000204350000001f02500039000004ab0220019700000000023200190000000002120049000004570020009c00000457020080410000006002200210000004570010009c00000457010080410000004001100210000000000112019f0000000002000414000004570020009c0000045702008041000000c002200210000000000121019f0000045d011001c70000800d020000390000000203000039000004ac0400004100000cd30000013d0000000002000416000000000002004b000009610000c13d000000440030008c000009610000413d0000000402100370000000000202043b000a00000002001d0000002401100370000000000101043b000900000001001d0000045a0010009c000009610000213d11570ff60000040f0000045a011001970000045b02000041000000000202041a0000045a02200197000000000021004b000008990000c13d000800000002001d0000000a01000029000000000010043f000004a401000041000000200010043f0000000001000414000004570010009c0000045701008041000000c00110021000000461011001c70000801002000039115711520000040f0000000100200190000009610000613d000000000101043b0000000902000029000000000020043f000000200010043f0000000001000414000004570010009c0000045701008041000000c00110021000000461011001c70000801002000039115711520000040f0000000100200190000009610000613d000000000101043b000000000101041a000000ff00100190000009240000c13d0000000a01000029000000000010043f000004a401000041000000200010043f0000000001000414000004570010009c0000045701008041000000c00110021000000461011001c70000801002000039115711520000040f0000000100200190000009610000613d000000000101043b0000000902000029000000000020043f000000200010043f0000000001000414000004570010009c0000045701008041000000c00110021000000461011001c70000801002000039115711520000040f0000000100200190000009610000613d000000000101043b000000000201041a000004d30220019700000001022001bf000000000021041b000000400100043d0000004002100039000000080300002900000000003204350000002002100039000000090300002900000000003204350000000a020000290000000000210435000004570010009c000004570100804100000040011002100000000002000414000004570020009c0000045702008041000000c002200210000000000112019f000004a5011001c70000800d020000390000000103000039000004cb04000041000009210000013d0000000002000416000000000002004b000009610000c13d000000240030008c000009610000413d0000000401100370000000000101043b0000045a0010009c000009610000213d000000000010043f0000000601000039000000200010043f00000000010000191157111e0000040f000008950000013d0000000002000416000000000002004b000009610000c13d000000640030008c000009610000413d0000000402100370000000000202043b000004990020009c000009610000213d0000002304200039000000000034004b000009610000813d0000000404200039000000000441034f000000000404043b000800000004001d000004990040009c000009610000213d000500240020003d000000080200002900000005022002100000000502200029000000000032004b000009610000213d0000002402100370000000000202043b000004990020009c000009610000213d0000002304200039000000000034004b000009610000813d0000000404200039000000000441034f000000000404043b000900000004001d000004990040009c000009610000213d0000002405200039000000090200002900000005022002100000000002520019000000000032004b000009610000213d0000004402100370000000000202043b000004990020009c000009610000213d0000002304200039000000000034004b000009610000813d0000000404200039000000000141034f000000000401043b000004990040009c000009610000213d000000240220003900000005014002100000000001210019000000000031004b000009610000213d000400000004001d000600000002001d000700000005001d000004a301000041000000000010044300000000010004120000000400100443000000400100003900000024001004430000000001000414000004570010009c0000045701008041000000c001100210000004a7011001c70000800502000039115711520000040f000000010020019000000e290000613d000000000101043b000000090000006b00000b710000c13d11570ff60000040f0000045a011001970000045b02000041000000000202041a0000045a02200197000000000021004b000008990000c13d0000000902000029000000080020006b00000a380000c13d0000000402000029000000080020006b00000a380000c13d000000080000006b00000007020000290000000604000029000009240000613d0000000005000019000000080050006c00000bd00000813d000000050150021000000000032100190000000102000367000000000332034f000000000303043b000a00000003001d0000045a0030009c000009610000213d0000000503100029000000000332034f000000000303043b0000045a0030009c000009610000213d000900000005001d0000000001410019000000000112034f000000000201043b000000400100043d000000440410003900000000002404350000002002100039000004be0400004100000000004204350000002404100039000000000034043500000044030000390000000000310435000004bf0010009c00000c7b0000213d0000008003100039000000400030043f000004570020009c000004570200804100000040022002100000000001010433000004570010009c00000457010080410000006001100210000000000121019f0000000002000414000004570020009c0000045702008041000000c002200210000000000121019f0000000a020000291157114d0000040f00000060031002700000045703300197000000200030008c000000200500003900000000050340190000002004500190000005cd0000613d000000000601034f0000000007000019000000006806043c0000000007870436000000000047004b000005c90000c13d0000001f05500190000005da0000613d000000000641034f0000000305500210000000000704043300000000075701cf000000000757022f000000000606043b0000010005500089000000000656022f00000000055601cf000000000575019f0000000000540435000000010020019000000d450000613d000000000003004b000000070200002900000006040000290000000905000029000005e60000613d000000000100043d000000010010008c00000000010000390000000101006039000005f70000013d000004a80100004100000000001004430000000a0100002900000004001004430000000001000414000004570010009c0000045701008041000000c0011002100000049d011001c70000800202000039115711520000040f000000010020019000000e290000613d000000000101043b000000070200002900000006040000290000000905000029000000000001004b00000d510000613d0000000105500039000000080050006c000005900000413d000009240000013d0000000002000416000000000002004b000009610000c13d000000240030008c000009610000413d0000000401100370000000000101043b000a00000001001d0000045a0010009c000009610000213d11570ff60000040f0000045a021001970000045b01000041000000000101041a0000045a05100197000000000052004b000008cc0000c13d0000000a0050006c000009240000613d0000045c011001970000000a06000029000000000161019f0000045b02000041000000000012041b0000000001000414000004570010009c0000045701008041000000c0011002100000045d011001c70000800d0200003900000003030000390000045e04000041000009210000013d0000000002000416000000000002004b000009610000c13d000000240030008c000009610000413d0000000401100370000000000101043b0000045a0010009c000009610000213d11570e550000040f000000400200043d000009390000013d0000000002000416000000000002004b000009610000c13d000000240030008c000009610000413d0000000402100370000000000202043b000004990020009c000009610000213d0000002304200039000000000034004b000009610000813d000900040020003d0000000901100360000000000101043b000a00000001001d000004990010009c000009610000213d0000000a01200029000800240010003d000000080030006b000009610000213d11570ff60000040f0000000a020000290000001f02200039000004ab022001970000003f02200039000004c602200197000000400300043d0000000004230019000000000034004b00000000020000390000000102004039000004990040009c00000c7b0000213d000000010020019000000c7b0000c13d000600000001001d000000400040043f000500000003001d0000000a010000290000000001130436000700000001001d0000000802000029000000000020007c000009610000213d0000000a03000029000004d4023001980000001f0330018f00000007080000290000000001280019000000090400002900000020044000390000000104400367000006670000613d000000000504034f0000000006080019000000005705043c0000000006760436000000000016004b000006630000c13d000000000003004b000006740000613d000000000224034f0000000303300210000000000401043300000000043401cf000000000434022f000000000202043b0000010003300089000000000232022f00000000023201cf000000000242019f00000000002104350000000a018000290000000000010435000000000100041a000000020010008c000001e90000613d0000000201000039000000000010041b000000060100002911570f0d0000040f00000005010000290000000001010433000004c40010009c000009610000213d000000200010008c000009610000413d00000007010000290000000001010433000a00000001001d000004a301000041000000000010044300000000010004120000000400100443000000400100003900000024001004430000000001000414000004570010009c0000045701008041000000c001100210000004a7011001c70000800502000039115711520000040f000000010020019000000e290000613d000000000101043b00000006020000290000000a03000029115710990000040f0000000a0000006b00000a5e0000c13d000004cf01000041000000000010043f000004660100004100001159000104300000000002000416000000000002004b000009610000c13d000000240030008c000009610000413d0000000401100370000000000101043b000a00000001001d11570ff60000040f0000000a02000029000000000020043f000004a402000041000000200020043f000900000001001d0000000001000414000004570010009c0000045701008041000000c00110021000000461011001c70000801002000039115711520000040f0000000100200190000009610000613d000000000101043b00000009020000290000045a02200197000900000002001d000000000020043f000000200010043f0000000001000414000004570010009c0000045701008041000000c00110021000000461011001c70000801002000039115711520000040f0000000100200190000009610000613d000000000101043b000000000101041a000000ff00100190000008ef0000c13d000004b101000041000000000010043f0000000a01000029000000040010043f0000000901000029000000240010043f000004a10100004100001159000104300000000002000416000000000002004b000009610000c13d000000840030008c000009610000413d0000000402100370000000000202043b000a00000002001d0000045a0020009c000009610000213d0000002402100370000000000202043b000900000002001d0000045a0020009c000009610000213d0000004402100370000000000202043b000800000002001d0000006402100370000000000202043b000004990020009c000009610000213d0000002304200039000000000034004b000009610000813d000600040020003d0000000601100360000000000101043b000700000001001d000004990010009c000009610000213d00000007012000290000002401100039000000000031004b000009610000213d000004a301000041000000000010044300000000010004120000000400100443000000400100003900000024001004430000000001000414000004570010009c0000045701008041000000c001100210000004a7011001c70000800502000039115711520000040f000000010020019000000e290000613d000000000101043b000500000001001d0000045a011001970000000002000411000000000012004b000009d10000c13d000004a301000041000000000010044300000000010004120000000400100443000000a00100003900000024001004430000000001000414000004570010009c0000045701008041000000c001100210000004a7011001c70000800502000039115711520000040f000000010020019000000e290000613d000000000101043b0000045a011001970000000a0010006b00000a7a0000c13d0000000701000029000000200010008c000009610000413d000000060100002900000020011000390000000101100367000000000101043b0000045a0010009c000009610000213d000000400500043d0000002002000039000000000225043600000008030000290000000000320435000004c30050009c00000c7b0000213d0000004003500039000900000003001d000000400030043f00000080045000390000004003000039000800000004001d0000000000340435000000a00450003900000000030504330000000000340435000000c0045000390000006005500039000a00000005001d0000000000050435000000000003004b000007440000613d000000000500001900000000064500190000000007250019000000000707043300000000007604350000002005500039000000000035004b0000073d0000413d000000000243001900000000000204350000001f02300039000004d4022001970000006003200039000000090400002900000000003404350000009f02200039000004d4032001970000000002430019000000000032004b00000000030000390000000103004039000004990020009c00000c7b0000213d000000010030019000000c7b0000c13d000000400020043f000000000200041a000000020020008c000001e90000613d0000045a011001970000000202000039000000000020041b000700000001001d11570f0d0000040f00000009010000290000000002010433000004c40020009c000009610000213d000000400020008c000009610000413d0000000a010000290000000001010433000000010010008c000009610000213d00000008030000290000000004030433000004990040009c000009610000213d0000000a0320002900000009044000290000003f02400039000000000032004b0000000005000019000004c505008041000004c502200197000004c506300197000000000762013f000000000062004b0000000002000019000004c502004041000004c50070009c000000000205c019000000000002004b000009610000c13d00000020024000390000000002020433000004990020009c00000c7b0000213d0000001f05200039000004ab055001970000003f05500039000004c606500197000000400500043d0000000006650019000000000056004b00000000070000390000000107004039000004990060009c00000c7b0000213d000000010070019000000c7b0000c13d000000400060043f000000000625043600000040044000390000000007240019000000000037004b000009610000213d000000000002004b0000079d0000613d000000000300001900000000076300190000000008340019000000000808043300000000008704350000002003300039000000000023004b000007960000413d000000000226001900000000000204350000000002050433000004c40020009c000009610000213d000000200020008c000009610000413d0000000002060433000800000002001d000000000001004b00000dd80000c13d000000080000006b000003d40000613d0000000101000039000000000201041a000000080020002a00000c550000413d0000000802200029000000000021041b0000000701000029000000000010043f0000000601000039000000200010043f0000000001000414000004570010009c0000045701008041000000c00110021000000461011001c70000801002000039115711520000040f0000000100200190000009610000613d000000000101043b000000000201041a000000080020002a00000c550000413d0000000802200029000000000021041b000000400100043d0000004002000039000000000321043600000009020000290000000002020433000000400410003900000000002404350000006004100039000000000002004b000007d50000613d000000000500001900000000064500190000000a07500029000000000707043300000000007604350000002005500039000000000025004b000007ce0000413d00000000044200190000000000040435000000080400002900000000004304350000001f02200039000004d4022001970000006002200039000004570020009c00000457020080410000006002200210000004570010009c00000457010080410000004001100210000000000112019f0000000002000414000004570020009c0000045702008041000000c002200210000000000112019f0000045d011001c70000800d020000390000000203000039000004c904000041000000070500002900000b420000013d0000000002000416000000000002004b000009610000c13d000000440030008c000009610000413d0000000402100370000000000202043b000a00000002001d0000002401100370000000000101043b000900000001001d0000045a0010009c000009610000213d11570ff60000040f0000045a011001970000045b02000041000000000202041a0000045a02200197000000000021004b000008990000c13d000800000002001d0000000a01000029000000000010043f000004a401000041000000200010043f0000000001000414000004570010009c0000045701008041000000c00110021000000461011001c70000801002000039115711520000040f0000000100200190000009610000613d000000000101043b0000000902000029000000000020043f000000200010043f0000000001000414000004570010009c0000045701008041000000c00110021000000461011001c70000801002000039115711520000040f0000000100200190000009610000613d000000000101043b000000000101041a000000ff00100190000009240000613d0000000a01000029000000000010043f000004a401000041000000200010043f0000000001000414000004570010009c0000045701008041000000c00110021000000461011001c70000801002000039115711520000040f0000000100200190000009610000613d000000000101043b0000000902000029000000000020043f000000200010043f0000000001000414000004570010009c0000045701008041000000c00110021000000461011001c70000801002000039115711520000040f0000000100200190000009610000613d000000000101043b000000000201041a000004d302200197000000000021041b000000400100043d0000004002100039000000080300002900000000003204350000002002100039000000090300002900000000003204350000000a020000290000000000210435000004570010009c000004570100804100000040011002100000000002000414000009190000013d0000000001000416000000000001004b000009610000c13d0000000001000412001700000001001d001600400000003d000080050100003900000044030000390000000004000415000000170440008a0000088a0000013d0000000001000416000000000001004b000009610000c13d0000000001000412001300000001001d001200000000003d000080050100003900000044030000390000000004000415000000130440008a0000088a0000013d0000000002000416000000000002004b000009610000c13d000000440030008c000009610000413d0000002402100370000000000202043b000a00000002001d0000045a0020009c000009610000213d0000000401100370000000000101043b000000000010043f000004a401000041000000200010043f00000000010000191157111e0000040f0000000a02000029000000000020043f000000200010043f00000000010000191157111e0000040f000000000101041a000000ff001001900000000001000039000000010100c039000000800010043f000004a201000041000011580001042e0000000001000416000000000001004b000009610000c13d0000000001000412000f00000001001d000e00a00000003d0000800501000039000000440300003900000000040004150000000f0440008a0000000504400210000004a3020000411157112f0000040f0000045a01100197000000800010043f000004a201000041000011580001042e0000000001000416000000000001004b000009610000c13d0000000501000039000000000101041a000000800010043f000004a201000041000011580001042e0000049a02000041000000000020043f000000040010043f0000049b0100004100001159000104300000000201000039000000000010041b11570ff60000040f000a00000001001d11570f0d0000040f0000000a0100002911570e550000040f000900000001001d000000000001004b000008d10000c13d0000000101000039000000000010041b0000000001000019000011580001042e000000e00050043f0000000706000029000001000060043f000001200030043f000000800100043d000001400000044300000160001004430000002001000039000000a00200043d0000018000100443000001a0002004430000004002000039000001c000200443000001e000400443000000600200003900000200002004430000022000500443000000800200003900000240002004430000026000600443000000a0020000390000028000200443000002a0003004430000010000100443000000060100003900000120001004430000046401000041000011580001042e000004ad0010009c000009260000c13d0000000101000039000009380000013d0000049a01000041000000000010043f000000040020043f0000049b010000410000115900010430000004a301000041000000000010044300000000010004120000000400100443000000200100003900000024001004430000000001000414000004570010009c0000045701008041000000c001100210000004a7011001c70000800502000039115711520000040f000000010020019000000e290000613d000000000101043b000000000001004b0000093f0000c13d000004bd01000041000000000010043f0000001201000039000000040010043f0000049b010000410000115900010430000000090000006b000009630000c13d000004ba01000041000000000010043f000004660100004100001159000104300000000a01000029000000000010043f000004a401000041000000200010043f0000000001000414000004570010009c0000045701008041000000c00110021000000461011001c70000801002000039115711520000040f0000000100200190000009610000613d000000000101043b0000000902000029000000000020043f000000200010043f0000000001000414000004570010009c0000045701008041000000c00110021000000461011001c70000801002000039115711520000040f0000000100200190000009610000613d000000000101043b000000000201041a000004d302200197000000000021041b000000400100043d000000400210003900000009030000290000000000320435000000200210003900000000003204350000000a020000290000000000210435000004570010009c000004570100804100000040011002100000000002000414000004570020009c0000045702008041000000c002200210000000000112019f000004a5011001c70000800d020000390000000103000039000004a6040000411157114d0000040f0000000100200190000009610000613d0000000001000019000011580001042e000000000010043f0000046001000041000000200010043f0000000001000414000004570010009c0000045701008041000000c00110021000000461011001c70000801002000039115711520000040f0000000100200190000009610000613d000000400200043d000000000101043b000000000101041a000000ff001001900000000001000039000000010100c039000000010110018f0000000000120435000004570020009c00000457020080410000004001200210000004b3011001c7000011580001042e000800000001001d000004a301000041000000000010044300000000010004120000000400100443000000600100003900000024001004430000000001000414000004570010009c0000045701008041000000c001100210000004a7011001c70000800502000039115711520000040f000000010020019000000e290000613d000000000101043b000004a80200004100000000002004430000045a01100197000700000001001d00000004001004430000000001000414000004570010009c0000045701008041000000c0011002100000049d011001c70000800202000039115711520000040f000000010020019000000e290000613d000000000101043b000000000001004b000009d50000c13d00000000010000190000115900010430000000080000006b000009690000c13d000004b901000041000000000010043f00000466010000410000115900010430000004a301000041000000000010044300000000010004120000000400100443000000200100003900000024001004430000000001000414000004570010009c0000045701008041000000c001100210000004a7011001c70000800502000039115711520000040f000000010020019000000e290000613d000000000101043b00000009031000b9000700000003001d00000009023000fa000000000012004b00000a340000c13d0000000401000039000000000101041a000600000001001d0000000101000039000000000101041a000500000001001d000000000001004b00000a3c0000c13d00000004010000390000000602000029000000000021041b0000000501000039000000000101041a000600000001001d000004b50100004100000000001004430000000001000414000004570010009c0000045701008041000000c001100210000004b6011001c70000800b02000039115711520000040f000000010020019000000e290000613d000000000101043b000500000001001d000000060010006c0000099f0000813d0000000101000039000000000101041a000000000001004b000009b20000613d0000000501000039000000000101041a000600000001001d000004b50100004100000000001004430000000001000414000004570010009c0000045701008041000000c001100210000004b6011001c70000800b02000039115711520000040f000000010020019000000e290000613d000000000101043b000000060010006c00000006010080290000000202000039000000000012041b0000000502000029000000080020002a00000c550000413d000000050300002900000008013000290000000502000039000000000502041a000000000435004b00000b6a0000a13d0000000302000039000000000302041a00000000064300a9000000000003004b000009c30000613d00000000073600d9000000000047004b00000c550000c13d000000070060002a00000a340000413d0000000706600029000000000051004b00000be90000a13d00000008046000fa000000000034004b00000c630000813d000004b801000041000000000010043f000000040030043f000000240040043f000004a1010000410000115900010430000004c201000041000000000010043f00000466010000410000115900010430000000080200002900000009122000f9000600000001001d000000400300043d0000002401300039000800000002001d0000000000210435000004a90100004100000000001304350000000a010000290000045a02100197000a00000003001d0000000401300039000900000002001d0000000000210435000004a301000041000000000010044300000000010004120000000400100443000000800100003900000024001004430000000001000414000004570010009c0000045701008041000000c001100210000004a7011001c70000800502000039115711520000040f000000010020019000000e290000613d000000000101043b0000000a0300002900000044023000390000000000120435000004570030009c0000045701000041000000000103401900000040011002100000000002000414000004570020009c0000045702008041000000c002200210000000000112019f000004aa011001c700000007020000291157114d0000040f000000010020019000000b4a0000613d0000000a01000029000004990010009c00000c7b0000213d0000000a01000029000000400010043f0000000901000029000000000010043f0000000701000039000000200010043f0000000001000414000004570010009c0000045701008041000000c00110021000000461011001c70000801002000039115711520000040f0000000100200190000009610000613d000000000101043b0000000602000029000000000021041b000000400100043d00000020021000390000000803000029000000000032043500000060020000390000000000210435000000800210003900000000000204350000006002100039000000000002043500000040021000390000000000020435000004570010009c000004570100804100000040011002100000000002000414000004570020009c0000045702008041000000c002200210000000000112019f000004ca011001c70000800d020000390000000203000039000004ac04000041000000090500002900000cd40000013d000004b401000041000000000010043f00000466010000410000115900010430000004c101000041000000000010043f000004660100004100001159000104300000000501000039000000000101041a000400000001001d000004b50100004100000000001004430000000001000414000004570010009c0000045701008041000000c001100210000004b6011001c70000800b02000039115711520000040f000000010020019000000e290000613d000000000101043b000000040010006c00000004010080290000000202000039000000000402041a000000000241004b00000c550000413d0000000303000039000000000503041a00000000032500a9000000000041004b00000a590000613d00000000012300d9000000000051004b00000c550000c13d00000005013000fa000000060010002a00000c550000413d000600060010002d000009860000013d00000006010000290000045a01100197000900000001001d000000000010043f0000000601000039000000200010043f0000000001000414000004570010009c0000045701008041000000c00110021000000461011001c70000801002000039115711520000040f0000000100200190000009610000613d000000000101043b000000000101041a0008000a0010007400000b900000813d000004ce02000041000000000020043f0000000902000029000000040020043f000000240010043f0000000a01000029000000440010043f000004aa010000410000115900010430000000400400043d0000002001000039000000000114043600000008020000290000000000210435000004c30040009c00000c7b0000213d0000004002400039000a00000002001d000000400020043f00000080034000390000004002000039000700000003001d0000000000230435000000a00340003900000000020404330000000000230435000000c0034000390000006004400039000800000004001d0000000000040435000000000002004b00000a990000613d000000000400001900000000053400190000000006140019000000000606043300000000006504350000002004400039000000000024004b00000a920000413d000000000132001900000000000104350000001f01200039000004d40110019700000060021000390000000a0300002900000000002304350000009f01100039000004d4021001970000000001320019000000000021004b00000000020000390000000102004039000004990010009c00000c7b0000213d000000010020019000000c7b0000c13d000000400010043f000000000100041a000000020010008c000001e90000613d0000000201000039000000000010041b000000090100002911570f0d0000040f0000000a010000290000000002010433000004c40020009c000009610000213d000000400020008c000009610000413d00000008010000290000000001010433000000010010008c000009610000213d00000007030000290000000004030433000004990040009c000009610000213d00000008032000290000000a044000290000003f02400039000000000032004b0000000005000019000004c505008041000004c502200197000004c506300197000000000762013f000000000062004b0000000002000019000004c502004041000004c50070009c000000000205c019000000000002004b000009610000c13d00000020024000390000000002020433000004990020009c00000c7b0000213d0000001f05200039000004ab055001970000003f05500039000004c606500197000000400500043d0000000006650019000000000056004b00000000070000390000000107004039000004990060009c00000c7b0000213d000000010070019000000c7b0000c13d000000400060043f000000000625043600000040044000390000000007240019000000000037004b000009610000213d000000000002004b00000af10000613d000000000300001900000000076300190000000008340019000000000808043300000000008704350000002003300039000000000023004b00000aea0000413d000000000226001900000000000204350000000002050433000004c40020009c000009610000213d000000200020008c000009610000413d0000000002060433000700000002001d000000000001004b00000d870000c13d000000070000006b000003d40000613d0000000101000039000000000201041a000000070020002a00000c550000413d0000000702200029000000000021041b0000000901000029000000000010043f0000000601000039000000200010043f0000000001000414000004570010009c0000045701008041000000c00110021000000461011001c70000801002000039115711520000040f0000000100200190000009610000613d000000000101043b000000000201041a000000070020002a00000c550000413d0000000702200029000000000021041b000000400100043d000000400200003900000000032104360000000a020000290000000002020433000000400410003900000000002404350000006004100039000000000002004b000000080800002900000b2a0000613d000000000500001900000000064500190000000007850019000000000707043300000000007604350000002005500039000000000025004b00000b230000413d00000000044200190000000000040435000000070400002900000000004304350000001f02200039000004d4022001970000006002200039000004570020009c00000457020080410000006002200210000004570010009c00000457010080410000004001100210000000000112019f0000000002000414000004570020009c0000045702008041000000c002200210000000000112019f0000045d011001c70000800d020000390000000203000039000004c90400004100000009050000291157114d0000040f0000000100200190000009610000613d0000000101000039000000000010041b0000046301000041000000400200043d000009390000013d00000060061002700000001f0460018f0000045905600198000000400200043d000000000352001900000b560000613d000000000701034f0000000008020019000000007907043c0000000008980436000000000038004b00000b520000c13d0000045706600197000000000004004b00000b640000613d000000000151034f0000000304400210000000000503043300000000054501cf000000000545022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000151019f00000000001304350000006001600210000004570020009c00000457020080410000004002200210000000000112019f0000115900010430000000070300002900000008023000fa0000000303000039000000000023041b0000000502000039000000000012041b00000bec0000013d0000045a0210019700000001010003670000000003000019000a00000000001d00000007060000290000000607000029000000040800002900000b7e0000013d0000000a05000029000a00000005001d0000000103300039000000090030006c00000c0f0000813d00000005043002100000000005640019000000000551034f000000000505043b0000045a0050009c000009610000213d000000000025004b00000b790000c13d000000000083004b0000000a0500002900000bd00000813d0000000004740019000000000441034f000000000404043b000000000045001a00000c550000413d000000000545001900000b7a0000013d0000000901000029000000000010043f0000000601000039000000200010043f0000000001000414000004570010009c0000045701008041000000c00110021000000461011001c70000801002000039115711520000040f0000000100200190000009610000613d000000000101043b0000000802000029000000000021041b0000000101000039000000000201041a0000000a0220006a000000000021041b000000400100043d0000004002000039000000000321043600000005020000290000000002020433000000400410003900000000002404350000006004100039000000000002004b000000070800002900000bb70000613d000000000500001900000000064500190000000007850019000000000707043300000000007604350000002005500039000000000025004b00000bb00000413d000000000442001900000000000404350000000a0400002900000000004304350000001f02200039000004d4022001970000006002200039000004570020009c00000457020080410000006002200210000004570010009c00000457010080410000004001100210000000000112019f0000000002000414000004570020009c0000045702008041000000c002200210000000000112019f0000045d011001c70000800d020000390000000203000039000004cd04000041000000090500002900000cd40000013d000004bd01000041000000000010043f0000003201000039000000040010043f0000049b0100004100001159000104300000000001000410000b00000001001d0000800a01000039000000240300003900000000040004150000000b0440008a00000005044002100000049c020000411157112f0000040f000004a002000041000000000020043f000000cf0000013d0000000001030433000000000001004b00000c5b0000c13d0000049f01000041000000000010043f0000046601000041000011590001043000000000014600d9000000000012041b000800000004001d00000002030000390000000501000029000000000013041b000000400100043d00000020021000390000000804000029000000000042043500000009020000290000000000210435000004570010009c000004570100804100000040011002100000000002000414000004570020009c0000045702008041000000c002200210000000000112019f00000461011001c70000800d02000039000004b7040000410000000a05000029000009210000013d00000060061002700000001f0460018f0000045905600198000000400200043d000000000352001900000b560000613d000000000701034f0000000008020019000000007907043c0000000008980436000000000038004b00000c0a0000c13d00000b560000013d0000000a0000006b0000057e0000613d000000400400043d000300000004001d000004bb010000410000000000140435000000040140003900000000030004100000000000310435000004570040009c0000045701000041000000000104401900000040011002100000000003000414000004570030009c0000045703008041000000c003300210000000000113019f0000049b011001c7115711520000040f00000060031002700000045703300197000000200030008c000000200400003900000000040340190000001f0640018f0000002007400190000000030b000029000000030570002900000c330000613d000000000801034f00000000090b0019000000008a08043c0000000009a90436000000000059004b00000c2f0000c13d000000000006004b00000c400000613d000000000771034f0000000306600210000000000805043300000000086801cf000000000868022f000000000707043b0000010006600089000000000767022f00000000066701cf000000000686019f0000000000650435000000010020019000000c810000613d0000001f01400039000000600210018f0000000001b20019000000000021004b00000000020000390000000102004039000004990010009c00000c7b0000213d000000010020019000000c7b0000c13d000000400010043f000000200030008c000009610000413d0000000101000039000000000101041a00000000020b0433000000000112004b0000000a0200002900000d710000813d000004bd01000041000000000010043f0000001101000039000000040010043f0000049b010000410000115900010430000004570040009c00000457040080410000004002400210000004570010009c00000457010080410000006001100210000000000121019f0000115900010430000000000042041b00000b6e0000013d000000400300043d00000064013000390000000802000029000000000021043500000000010004100000045a01100197000000440230003900000000001204350000002002300039000004c701000041000500000002001d000000000012043500000007010000290000045a011001970000002402300039000000000012043500000064010000390000000000130435000600000003001d000004c80030009c000000400200003900000cd80000a13d000004bd01000041000000000010043f0000004101000039000000040010043f0000049b0100004100001159000104300000001f0530018f0000045906300198000000400200043d000000000462001900000d620000613d000000000701034f0000000008020019000000007907043c0000000008980436000000000048004b00000c880000c13d00000d620000013d0000000101000039000000000101041a000000080010002a00000c550000413d00000008011000290000000102000039000000000012041b00000007010000290000045a01100197000700000001001d000000000010043f0000000601000039000000200010043f0000000001000414000004570010009c0000045701008041000000c00110021000000461011001c70000801002000039115711520000040f0000000100200190000009610000613d000000000101043b000000000201041a000000080020002a00000c550000413d0000000802200029000000000021041b000000400100043d000000400200003900000000032104360000000a020000290000000002020433000000400410003900000000002404350000006004100039000000000002004b000000090800002900000cbc0000613d000000000500001900000000064500190000000007850019000000000707043300000000007604350000002005500039000000000025004b00000cb50000413d00000000044200190000000000040435000000080400002900000000004304350000001f02200039000004d4022001970000006002200039000004570020009c00000457020080410000006002200210000004570010009c00000457010080410000004001100210000000000112019f0000000002000414000004570020009c0000045702008041000000c002200210000000000112019f0000045d011001c70000800d020000390000000203000039000004c90400004100000007050000291157114d0000040f0000000100200190000008a80000c13d000009610000013d0000000601000029000000a001100039000000400010043f000004a30100004100000000001004430000000001000412000000040010044300000024002004430000000001000414000004570010009c0000045701008041000000c001100210000004a7011001c70000800502000039115711520000040f000000010020019000000e290000613d0000000502000029000004570020009c0000045702008041000000400220021000000006030000290000000003030433000004570030009c00000457030080410000006003300210000000000323019f000000000201043b0000000001000414000004570010009c0000045701008041000000c001100210000000000113019f000600000002001d1157114d0000040f00000060031002700000045703300197000000200030008c000000200400003900000000040340190000001f0540018f000000200440019000000d090000613d000000000601034f0000000007000019000000006806043c0000000007870436000000000047004b00000d050000c13d000000000005004b00000d160000613d000000000641034f0000000305500210000000000704043300000000075701cf000000000757022f000000000606043b0000010005500089000000000656022f00000000055601cf000000000575019f0000000000540435000000010020019000000d570000613d000000000003004b00000d7a0000c13d000004a801000041000000000010044300000006010000290000045a0110019700000004001004430000000001000414000004570010009c0000045701008041000000c0011002100000049d011001c70000800202000039115711520000040f000000010020019000000e290000613d000000000101043b00000d7e0000013d0000001f0530018f0000045906300198000000400200043d000000000462001900000d620000613d000000000701034f0000000008020019000000007907043c0000000008980436000000000048004b00000d310000c13d00000d620000013d000004b001000041000008cd0000013d00000060061002700000001f0460018f0000045905600198000000400200043d000000000352001900000b560000613d000000000701034f0000000008020019000000007907043c0000000008980436000000000038004b00000d400000c13d00000b560000013d0000001f0530018f0000045906300198000000400200043d000000000462001900000d620000613d000000000701034f0000000008020019000000007907043c0000000008980436000000000048004b00000d4c0000c13d00000d620000013d000004c001000041000000000010043f0000000a01000029000000040010043f0000049b0100004100001159000104300000001f0530018f0000045906300198000000400200043d000000000462001900000d620000613d000000000701034f0000000008020019000000007907043c0000000008980436000000000048004b00000d5e0000c13d000000000005004b00000d6f0000613d000000000161034f0000000305500210000000000604043300000000065601cf000000000656022f000000000101043b0000010005500089000000000151022f00000000015101cf000000000161019f0000000000140435000000600130021000000b650000013d000000000012004b0000057e0000a13d000004bc02000041000000000020043f0000000a02000029000000040020043f000000240010043f000004a1010000410000115900010430000000000100043d000000010010008c00000000010000390000000101006039000000000001004b000003d20000c13d000004c001000041000000000010043f00000006010000290000045a01100197000000040010043f0000049b010000410000115900010430000000400100043d00000064021000390000000703000029000000000032043500000000020004100000045a02200197000000440310003900000000002304350000002002100039000004c703000041000000000032043500000024031000390000000904000029000000000043043500000064030000390000000000310435000004c80010009c00000c7b0000213d000000a003100039000000400030043f000004570020009c000004570200804100000040022002100000000001010433000004570010009c00000457010080410000006001100210000000000121019f0000000002000414000004570020009c0000045702008041000000c002200210000000000121019f00000005020000291157114d0000040f00000060031002700000045703300197000000200030008c000000200400003900000000040340190000001f0540018f000000200440019000000db80000613d000000000601034f0000000007000019000000006806043c0000000007870436000000000047004b00000db40000c13d000000000005004b00000dc50000613d000000000641034f0000000305500210000000000704043300000000075701cf000000000757022f000000000606043b0000010005500089000000000656022f00000000055601cf000000000575019f0000000000540435000000010020019000000e2a0000613d000000000003004b00000e360000c13d000004a8010000410000000000100443000000000100041100000004001004430000000001000414000004570010009c0000045701008041000000c0011002100000049d011001c70000800202000039115711520000040f000000010020019000000e290000613d000000000101043b00000e3a0000013d000000400100043d00000064021000390000000803000029000000000032043500000000020004100000045a02200197000000440310003900000000002304350000002002100039000004c703000041000000000032043500000024031000390000000704000029000000000043043500000064030000390000000000310435000004c80010009c00000c7b0000213d000000a003100039000000400030043f000004570020009c000004570200804100000040022002100000000001010433000004570010009c00000457010080410000006001100210000000000121019f0000000002000414000004570020009c0000045702008041000000c002200210000000000121019f00000005020000291157114d0000040f00000060031002700000045703300197000000200030008c000000200400003900000000040340190000001f0540018f000000200440019000000e090000613d000000000601034f0000000007000019000000006806043c0000000007870436000000000047004b00000e050000c13d000000000005004b00000e160000613d000000000641034f0000000305500210000000000704043300000000075701cf000000000757022f000000000606043b0000010005500089000000000656022f00000000055601cf000000000575019f0000000000540435000000010020019000000e420000613d000000000003004b00000e4e0000c13d000004a8010000410000000000100443000000000100041100000004001004430000000001000414000004570010009c0000045701008041000000c0011002100000049d011001c70000800202000039115711520000040f000000010020019000000e290000613d000000000101043b00000e520000013d000000000001042f0000001f0530018f0000045906300198000000400200043d000000000462001900000d620000613d000000000701034f0000000008020019000000007907043c0000000008980436000000000048004b00000e310000c13d00000d620000013d000000000100043d000000010010008c00000000010000390000000101006039000000000001004b00000afc0000c13d000004c001000041000000000010043f0000000001000411000000040010043f0000049b0100004100001159000104300000001f0530018f0000045906300198000000400200043d000000000462001900000d620000613d000000000701034f0000000008020019000000007907043c0000000008980436000000000048004b00000e490000c13d00000d620000013d000000000100043d000000010010008c00000000010000390000000101006039000000000001004b000007a80000c13d00000e3c0000013d00050000000000020000045a01100197000400000001001d000000000010043f0000000601000039000000200010043f0000000001000414000004570010009c0000045701008041000000c00110021000000461011001c70000801002000039115711520000040f000000010020019000000ebd0000613d0000000402000039000000000202041a000000000101043b000000000101041a000300000001001d0000000101000039000000000101041a000000000001004b000500000002001d00000e910000613d000100000001001d0000000501000039000000000101041a000200000001001d000004b50100004100000000001004430000000001000414000004570010009c0000045701008041000000c001100210000004b6011001c70000800b02000039115711520000040f000000010020019000000ec50000613d000000000101043b000000020010006c00000002010080290000000202000039000000000402041a000000000241004b000000050600002900000ebf0000413d0000000303000039000000000503041a00000000032500a9000000000041004b00000e8d0000613d00000000012300d9000000000051004b00000ebf0000c13d00000001013000fa000000000061001a00000ebf0000413d000500000061001d0000000401000029000000000010043f0000000801000039000000200010043f0000000001000414000004570010009c0000045701008041000000c00110021000000461011001c70000801002000039115711520000040f000000010020019000000ebd0000613d000000000101043b000000000101041a000000050110006b00000ebf0000413d00000003031000b9000000030000006b00000ea80000613d00000003023000fa000000000012004b00000ebf0000c13d000500000003001d0000000401000029000000000010043f0000000701000039000000200010043f0000000001000414000004570010009c0000045701008041000000c00110021000000461011001c70000801002000039115711520000040f000000010020019000000ebd0000613d000000000101043b000000000101041a0000000502000029000000000021001a00000ebf0000413d0000000001210019000000000001042d00000000010000190000115900010430000004bd01000041000000000010043f0000001101000039000000040010043f0000049b010000410000115900010430000000000001042f00030000000000020000000401000039000000000101041a0000000102000039000000000202041a000000000002004b00000ef10000613d000100000002001d000300000001001d0000000501000039000000000101041a000200000001001d000004b50100004100000000001004430000000001000414000004570010009c0000045701008041000000c001100210000004b6011001c70000800b02000039115711520000040f000000010020019000000ef80000613d000000000601043b000000020060006c00000002060080290000000202000039000000000402041a000000000246004b000000030100002900000ef20000413d0000000303000039000000000503041a00000000032500a9000000000046004b00000eed0000613d00000000022300d9000000000052004b00000ef20000c13d00000001023000fa000000000012001a00000ef20000413d0000000001120019000000000001042d000004bd01000041000000000010043f0000001101000039000000040010043f0000049b010000410000115900010430000000000001042f00010000000000020000000501000039000000000101041a000100000001001d000004b50100004100000000001004430000000001000414000004570010009c0000045701008041000000c001100210000004b6011001c70000800b02000039115711520000040f000000010020019000000f0c0000613d000000000101043b000000010010006c0000000101008029000000000001042d000000000001042f0005000000000002000500000001001d0000000401000039000000000401041a0000000101000039000000000101041a000000000001004b000000050200003900000f390000613d000200000001001d000400000004001d000000000102041a000300000001001d000004b50100004100000000001004430000000001000414000004570010009c0000045701008041000000c001100210000004b6011001c70000800b02000039115711520000040f000000010020019000000fef0000613d000000000101043b000000030010006c00000003010080290000000202000039000000000202041a000000000221004b000000040400002900000ff00000413d0000000301000039000000000301041a00000000012300a900000f340000613d00000000022100d9000000000032004b00000ff00000c13d00000002011000fa000000000041001a00000ff00000413d000000000441001900000005020000390000000401000039000000000041041b000000000102041a000400000001001d000004b50100004100000000001004430000000001000414000004570010009c0000045701008041000000c001100210000004b6011001c70000800b02000039115711520000040f000000010020019000000fef0000613d000000000101043b000000040010006c00000f4f0000813d0000000101000039000000000101041a000000000001004b00000f620000613d0000000501000039000000000101041a000400000001001d000004b50100004100000000001004430000000001000414000004570010009c0000045701008041000000c001100210000004b6011001c70000800b02000039115711520000040f000000010020019000000fef0000613d000000000101043b000000040010006c00000004010080290000000202000039000000000012041b00000005010000290000045a0110019800000fec0000613d000500000001001d000000000010043f0000000601000039000000200010043f0000000001000414000004570010009c0000045701008041000000c00110021000000461011001c70000801002000039115711520000040f000000010020019000000fed0000613d0000000402000039000000000202041a000000000101043b000000000101041a000300000001001d0000000101000039000000000101041a000000000001004b000400000002001d00000f9e0000613d000100000001001d0000000501000039000000000101041a000200000001001d000004b50100004100000000001004430000000001000414000004570010009c0000045701008041000000c001100210000004b6011001c70000800b02000039115711520000040f000000010020019000000fef0000613d000000000101043b000000020010006c00000002010080290000000202000039000000000202041a000000000221004b000000040400002900000ff00000413d0000000301000039000000000301041a00000000012300a900000f9a0000613d00000000022100d9000000000032004b00000ff00000c13d00000001011000fa000000000041001a00000ff00000413d000400000041001d0000000501000029000000000010043f0000000801000039000000200010043f0000000001000414000004570010009c0000045701008041000000c00110021000000461011001c70000801002000039115711520000040f000000010020019000000fed0000613d000000000101043b000000000101041a000000040110006b00000ff00000413d00040003001000bd000000030000006b00000fb60000613d000000040300002900000003023000fa000000000012004b00000ff00000c13d0000000501000029000000000010043f0000000701000039000000200010043f0000000001000414000004570010009c0000045701008041000000c00110021000000461011001c70000801002000039115711520000040f000000010020019000000fed0000613d000000000101043b000000000201041a000300000002001d000000040020002a00000ff00000413d0000000501000029000000000010043f0000000701000039000000200010043f0000000001000414000004570010009c0000045701008041000000c00110021000000461011001c70000801002000039115711520000040f000000010020019000000fed0000613d00000003030000290000000402300029000000000101043b000000000021041b0000000401000039000000000101041a000400000001001d0000000501000029000000000010043f0000000801000039000000200010043f0000000001000414000004570010009c0000045701008041000000c00110021000000461011001c70000801002000039115711520000040f000000010020019000000fed0000613d000000000101043b0000000402000029000000000021041b000000000001042d00000000010000190000115900010430000000000001042f000004bd01000041000000000010043f0000001101000039000000040010043f0000049b0100004100001159000104300003000000000002000004a30100004100000000001004430000000001000412000000040010044300000024000004430000000001000414000004570010009c0000045701008041000000c001100210000004a7011001c70000800502000039115711520000040f0000000100200190000010720000613d000000000101043b0000045a01100198000010240000613d000300000001001d000004d50100004100000000001004430000000001000414000004570010009c0000045701008041000000c001100210000004b6011001c70000800b02000039115711520000040f0000000100200190000010720000613d0000000002000031000000000301043b0000000001000411000000000031004b000010710000613d000000180020008c000010710000413d000000140220008a0000000102200367000000000202043b00000060042002700000000302000029000000000021004b000010260000c13d0000000001040019000000000001042d0000000001000411000000000001042d000000400600043d000200000006001d00000044036000390000000005000410000000000053043500000024036000390000000000130435000004d60100004100000000001604350000000401600039000100000004001d0000000000410435000004570060009c0000045701000041000000000106401900000040011002100000000003000414000004570030009c0000045703008041000000c003300210000000000113019f000004aa011001c7115711520000040f000000020b00002900000060031002700000045703300197000000200030008c000000200400003900000000040340190000001f0640018f000000200740019000000000057b00190000104d0000613d000000000801034f00000000090b0019000000008a08043c0000000009a90436000000000059004b000010490000c13d000000000006004b0000105a0000613d000000000771034f0000000306600210000000000805043300000000086801cf000000000868022f000000000707043b0000010006600089000000000767022f00000000066701cf000000000686019f00000000006504350000000100200190000010750000613d0000001f01400039000000600210018f0000000001b20019000000000021004b00000000020000390000000102004039000004990010009c000010930000213d0000000100200190000010930000c13d000000400010043f0000001f0030008c0000000102000029000010730000a13d00000000010b0433000000010010008c000010730000213d000000000001004b0000000001000411000010710000613d0000000001020019000000000001042d000000000001042f000000000100001900001159000104300000001f0530018f0000045906300198000000400200043d0000000004620019000010800000613d000000000701034f0000000008020019000000007907043c0000000008980436000000000048004b0000107c0000c13d000000000005004b0000108d0000613d000000000161034f0000000305500210000000000604043300000000065601cf000000000656022f000000000101043b0000010005500089000000000151022f00000000015101cf000000000161019f00000000001404350000006001300210000004570020009c00000457020080410000004002200210000000000112019f0000115900010430000004bd01000041000000000010043f0000004101000039000000040010043f0000049b01000041000011590001043000010000000000020000000005010019000000400100043d000000440410003900000000003404350000002003100039000004be0400004100000000004304350000045a022001970000002404100039000000000024043500000044020000390000000000210435000004d70010009c000010f80000813d0000008002100039000000400020043f000004570030009c000004570300804100000040023002100000000001010433000004570010009c00000457010080410000006001100210000000000121019f0000000002000414000004570020009c0000045702008041000000c002200210000000000121019f000100000005001d00000000020500191157114d0000040f00000060031002700000045703300197000000200030008c000000200400003900000000040340190000001f0540018f0000002004400190000010c80000613d000000000601034f0000000007000019000000006806043c0000000007870436000000000047004b000010c40000c13d000000000005004b000010d50000613d000000000641034f0000000305500210000000000704043300000000075701cf000000000757022f000000000606043b0000010005500089000000000656022f00000000055601cf000000000575019f00000000005404350000000100200190000010fe0000613d000000000003004b0000000102000029000010e10000613d000000000100043d000000010010008c00000000010000390000000101006039000000000001004b000010f20000613d000000000001042d000004a80100004100000000001004430000045a0120019700000004001004430000000001000414000004570010009c0000045701008041000000c0011002100000049d011001c70000800202000039115711520000040f00000001002001900000111c0000613d000000000101043b0000000102000029000000000001004b000010e00000c13d000004c001000041000000000010043f0000045a01200197000000040010043f0000049b010000410000115900010430000004bd01000041000000000010043f0000004101000039000000040010043f0000049b0100004100001159000104300000001f0530018f0000045906300198000000400200043d0000000004620019000011090000613d000000000701034f0000000008020019000000007907043c0000000008980436000000000048004b000011050000c13d000000000005004b000011160000613d000000000161034f0000000305500210000000000604043300000000065601cf000000000656022f000000000101043b0000010005500089000000000151022f00000000015101cf000000000161019f00000000001404350000006001300210000004570020009c00000457020080410000004002200210000000000112019f0000115900010430000000000001042f000000000001042f0000000002000414000004570020009c0000045702008041000000c002200210000004570010009c00000457010080410000004001100210000000000121019f00000461011001c70000801002000039115711520000040f00000001002001900000112d0000613d000000000101043b000000000001042d0000000001000019000011590001043000000000050100190000000000200443000000050030008c0000113d0000413d000000040100003900000000020000190000000506200210000000000664001900000005066002700000000006060031000000000161043a0000000102200039000000000031004b000011350000413d000004570030009c000004570300804100000060013002100000000002000414000004570020009c0000045702008041000000c002200210000000000112019f000004d8011001c70000000002050019115711520000040f00000001002001900000114c0000613d000000000101043b000000000001042d000000000001042f00001150002104210000000102000039000000000001042d0000000002000019000000000001042d00001155002104230000000102000039000000000001042d0000000002000019000000000001042d0000115700000432000011580001042e00001159000104300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffff00000000000000000000000000000000000000000000000000000001ffffffe000000000000000000000000000000000000000000000000000000000ffffffe0000000000000000000000000ffffffffffffffffffffffffffffffffffffffffc9ed16f33ab3a66c84bfd83099ccb2a8845871e2e1c1928f63797152f0fd54ccffffffffffffffffffffffff000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000008be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e07f5828d000000000000000000000000000000000000000000000000000000000ca9d3e17f264b0f3984e2634e94adb37fa3e6a8103f06aeae6fa59e21c769f5d02000000000000000000000000000000000000400000000000000000000000000000000000184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000004fc358590000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000001c0000001000000000000000000828f74a8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000007b0a47ed00000000000000000000000000000000000000000000000000000000c3666c3500000000000000000000000000000000000000000000000000000000d547741e00000000000000000000000000000000000000000000000000000000efa90b5300000000000000000000000000000000000000000000000000000000efa90b5400000000000000000000000000000000000000000000000000000000f2fde38b00000000000000000000000000000000000000000000000000000000f7ba94bd00000000000000000000000000000000000000000000000000000000d547741f00000000000000000000000000000000000000000000000000000000ef4cadc500000000000000000000000000000000000000000000000000000000c63ff8dc00000000000000000000000000000000000000000000000000000000c63ff8dd00000000000000000000000000000000000000000000000000000000d0b06f5d00000000000000000000000000000000000000000000000000000000c3666c3600000000000000000000000000000000000000000000000000000000c5c8f770000000000000000000000000000000000000000000000000000000008bb9c5be0000000000000000000000000000000000000000000000000000000091d148530000000000000000000000000000000000000000000000000000000091d148540000000000000000000000000000000000000000000000000000000098807d84000000000000000000000000000000000000000000000000000000009d696e36000000000000000000000000000000000000000000000000000000008bb9c5bf000000000000000000000000000000000000000000000000000000008da5cb5b00000000000000000000000000000000000000000000000000000000817b1cd100000000000000000000000000000000000000000000000000000000817b1cd2000000000000000000000000000000000000000000000000000000008580cf76000000000000000000000000000000000000000000000000000000007b0a47ee0000000000000000000000000000000000000000000000000000000080faa57d000000000000000000000000000000000000000000000000000000002d1e0c01000000000000000000000000000000000000000000000000000000004fc358580000000000000000000000000000000000000000000000000000000062ba90950000000000000000000000000000000000000000000000000000000062ba90960000000000000000000000000000000000000000000000000000000073c8a9580000000000000000000000000000000000000000000000000000000075c93bb9000000000000000000000000000000000000000000000000000000004fc3585900000000000000000000000000000000000000000000000000000000572b6c05000000000000000000000000000000000000000000000000000000002f2ff15c000000000000000000000000000000000000000000000000000000002f2ff15d000000000000000000000000000000000000000000000000000000004e71d92d000000000000000000000000000000000000000000000000000000002d1e0c02000000000000000000000000000000000000000000000000000000002d4c2f93000000000000000000000000000000000000000000000000000000000968f263000000000000000000000000000000000000000000000000000000002b4c9f15000000000000000000000000000000000000000000000000000000002b4c9f16000000000000000000000000000000000000000000000000000000002c9d0b80000000000000000000000000000000000000000000000000000000000968f264000000000000000000000000000000000000000000000000000000002196e445000000000000000000000000000000000000000000000000000000000479d643000000000000000000000000000000000000000000000000000000000479d644000000000000000000000000000000000000000000000000000000000700037d00000000000000000000000000000000000000000000000000000000008cc2620000000000000000000000000000000000000000000000000000000001ffc9a7000000000000000000000000000000000000000000000000ffffffffffffffff2ef4875e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000240000000000000000000000009cc7f708afc65944829bd487b90b72536b1951864fbfc14e125fc972a6507f39020000020000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000000000000000000000003ffffffe0d6bda27500000000000000000000000000000000000000000000000000000000cf4791810000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000440000000000000000000000000000000000000000000000000000000000000020000000800000000000000000310ab089e4439a4c15d089f94afb7896ff553aecb10793d0ab882de59d99a32ec8827d3282af6f37b64c3e9e6f3ac9df286ab0bb0fccd6f8661bf19adb368b220200000000000000000000000000000000000060000000000000000000000000f6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b02000002000000000000000000000000000000440000000000000000000000001806aa1896bbf26568e884a7374b41e002500962caba6a15023a8d90e8508b8326b3293f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000000000000001ffffffffffffffe0019eda09011e476781de26947e4b78ee0a834e7182f5ff2eb62bcf8c523f42ca01ffc9a70000000000000000000000000000000000000000000000000000000080ac58cd0000000000000000000000000000000000000000000000000000000042842e0e00000000000000000000000000000000000000000000000000000000986b9f1f000000000000000000000000000000000000000000000000000000007aa7288200000000000000000000000000000000000000000000000000000000726577617264657200000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000005008206500000000000000000000000000000000000000000000000000000000796b89b91644bc98cd93958e4c9038275d622183e25ac5af08cc6b5d9553913202000002000000000000000000000000000000040000000000000000000000006a6f77044107a33658235d41bedbbaf2fe9ccdceb313143c947a5e76e1ec847419e2447d000000000000000000000000000000000000000000000000000000007616640100000000000000000000000000000000000000000000000000000000385398650000000000000000000000000000000000000000000000000000000070a082310000000000000000000000000000000000000000000000000000000015c38d3e000000000000000000000000000000000000000000000000000000004e487b7100000000000000000000000000000000000000000000000000000000a9059cbb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffff7f5274afe7000000000000000000000000000000000000000000000000000000006582533600000000000000000000000000000000000000000000000000000000c1ab6dc100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffbf7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003ffffffffffffffe023b872dd00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffff5ff4679d394f1f97f1a3df1d73e193866ec5a813168ad5fa6958f9be21b10a594e02000000000000000000000000000000000000800000000000000000000000002f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d040ef8ec00000000000000000000000000000000000000000000000000000000aae638dec0d864ccb08558c28981bcfaee41330f57c4911cbe2d8432d0fb729e2b6a775800000000000000000000000000000000000000000000000000000000db73cdf0000000000000000000000000000000000000000000000000000000003ee5aeb50000000000000000000000000000000000000000000000000000000000000000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0938b5f3299a1f3b18e458564efbb950733226014eece26fae19012d850b48d83019a202800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffff8002000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a26469706673582212206f03659de388d2dd803418b337390197c02878566aed292a2fb92f9f17319ef964736f6c6378247a6b736f6c633a312e352e31353b736f6c633a302e382e33303b6c6c766d3a312e302e320055
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000007e9b9b72f9aaf4e2aa4eb29411245742496c37fd0000000000000000000000002226444afcccf9e760c01649ef1f9e66985a4b350000000000000000000000002f65ffb50f16e3ee19a8d22606d9114d1ed66f2c5374616b696e6752657761726400000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : claimContract (address): 0x7e9B9b72f9aaf4e2aA4EB29411245742496C37fD
Arg [1] : stakingToken (address): 0x2226444afcCCF9e760C01649eF1f9E66985A4b35
Arg [2] : pointsContract (address): 0x2f65ffB50f16e3Ee19A8D22606D9114D1ED66f2C
Arg [3] : depositReasonCode (bytes32): 0x5374616b696e6752657761726400000000000000000000000000000000000000
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000007e9b9b72f9aaf4e2aa4eb29411245742496c37fd
Arg [1] : 0000000000000000000000002226444afcccf9e760c01649ef1f9e66985a4b35
Arg [2] : 0000000000000000000000002f65ffb50f16e3ee19a8d22606d9114d1ed66f2c
Arg [3] : 5374616b696e6752657761726400000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$2,221,899.72
Net Worth in ETH
752.495221
Token Allocations
CHECK
100.00%
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|---|---|---|---|---|
| ABSTRACT | 100.00% | $0.079632 | 27,902,096.1469 | $2,221,899.72 |
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.