Feature Tip: Add private address tag to any address under My Name Tag !
Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
Accountant
Compiler Version
v0.8.28+commit.7893614a
Optimization Enabled:
No with 200 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
/// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.28;
import {IStrategy} from "src/interfaces/IStrategy.sol";
import {IAccountant} from "src/interfaces/IAccountant.sol";
import {IProtocolController} from "src/interfaces/IProtocolController.sol";
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeCast} from "@openzeppelin/contracts/utils/math/SafeCast.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {Ownable2Step, Ownable} from "@openzeppelin/contracts/access/Ownable2Step.sol";
import {ReentrancyGuardTransient} from "@openzeppelin/contracts/utils/ReentrancyGuardTransient.sol";
/// @title Accountant - Reward Distribution and Accounting System
/// @notice A comprehensive system for managing reward distribution and accounting across vaults and users.
/// @dev Implements a gas-optimized packed storage system for efficient reward tracking and distribution.
/// Key responsibilities:
/// - Tracks user balances and rewards across vaults.
/// - Manages protocol fees and dynamic harvest fees.
/// - Handles reward distribution and claiming.
/// - Maintains integral calculations for reward accrual.
contract Accountant is ReentrancyGuardTransient, Ownable2Step, IAccountant {
using Math for uint256;
using Math for uint128;
using SafeCast for uint256;
using Address for address;
using SafeERC20 for IERC20;
//////////////////////////////////////////////////////
/// --- STORAGE STRUCTURES
//////////////////////////////////////////////////////
/// @notice Vault data structure.
struct VaultData {
uint256 integral;
uint128 supply;
uint128 feeSubjectAmount;
uint128 totalAmount;
uint128 netCredited;
}
/// @notice Account data structure for a specific Vault
struct AccountData {
uint128 balance;
uint256 integral;
uint256 pendingRewards;
}
/// @notice Struct that defines the fees parameters.
struct FeesParams {
uint128 protocolFeePercent;
uint128 harvestFeePercent;
}
//////////////////////////////////////////////////////
/// --- CONSTANTS & IMMUTABLES
//////////////////////////////////////////////////////
/// @notice RAY scaling factor used for fixed-point arithmetic precision.
uint128 public constant SCALING_FACTOR = 1e27;
/// @notice The maximum fee percent (40%).
uint128 public constant MAX_FEE_PERCENT = 0.4e18;
/// @notice The minimum amount of rewards to be added to the vault.
uint128 public constant MIN_MEANINGFUL_REWARDS = 1e18;
/// @notice The registry of addresses.
IProtocolController public immutable PROTOCOL_CONTROLLER;
/// @notice The reward token.
address public immutable REWARD_TOKEN;
/// @notice The protocol ID.
bytes4 public immutable PROTOCOL_ID;
/// @notice The default protocol fee.
/// @dev The validity of this value is not checked. It must always be valid
uint128 internal constant DEFAULT_PROTOCOL_FEE = 0.15e18;
/// @notice The default harvest fee.
/// @dev The validity of this value is not checked. It must always be valid
uint128 internal constant DEFAULT_HARVEST_FEE = 0.005e18;
//////////////////////////////////////////////////////
/// --- STATE VARIABLES
//////////////////////////////////////////////////////
/// @notice The feesParams struct.
FeesParams public feesParams;
/// @notice The balance threshold for harvest fee calculation.
/// @dev If set to 0, maximum harvest fee always applies.
uint256 public HARVEST_URGENCY_THRESHOLD;
/// @notice The total protocol fees collected but not yet claimed.
uint256 public protocolFeesAccrued;
/// @notice Supply of vaults.
/// @dev Vault address -> VaultData.
mapping(address vault => VaultData vaultData) internal vaults;
/// @notice Balances of accounts per vault.
/// @dev Vault address -> Account address -> AccountData.
mapping(address vault => mapping(address account => AccountData accountData)) internal accounts;
//////////////////////////////////////////////////////
/// --- ERRORS
//////////////////////////////////////////////////////
/// @notice Error thrown when the caller is not a vault.
error OnlyVault();
/// @notice Error thrown when the caller is not allowed.
error OnlyAllowed();
/// @notice Error thrown when the strategy is not set.
error NoStrategy();
/// @notice Error thrown when the fee receiver is not set.
error NoFeeReceiver();
/// @notice Error thrown when there are no pending rewards.
error NoPendingRewards();
/// @notice Error thrown when a fee exceeds the maximum allowed
error FeeExceedsMaximum();
/// @notice Error thrown when the vault is invalid
error InvalidVault();
/// @notice Error thrown when harvest data length doesn't match vaults length
error InvalidHarvestDataLength();
/// @notice Error thrown when the protocol controller is invalid
error InvalidProtocolController();
/// @notice Error thrown when the reward token is invalid
error InvalidRewardToken();
/// @notice Error thrown when the protocol ID is invalid
error InvalidProtocolId();
/// @notice Error thrown when the harvester has not transferred the correct amount of tokens to the Accountant contract
error HarvestTokenNotReceived();
//////////////////////////////////////////////////////
/// --- EVENTS
//////////////////////////////////////////////////////
/// @notice Emitted when protocol fees are claimed.
event ProtocolFeesClaimed(uint256 amount);
/// @notice Emitted when a vault harvests rewards.
event Harvest(address indexed vault, uint256 amount);
/// @notice Emitted when the protocol fee percent is updated.
event ProtocolFeePercentSet(uint128 oldProtocolFeePercent, uint128 newProtocolFeePercent);
/// @notice Emitted when the balance threshold is updated.
event HarvestUrgencyThresholdSet(uint256 oldThreshold, uint256 newThreshold);
/// @notice Emitted when the harvest fee percent is updated.
event HarvestFeePercentSet(uint128 oldHarvestFeePercent, uint128 newHarvestFeePercent);
//////////////////////////////////////////////////////
/// --- MODIFIERS
//////////////////////////////////////////////////////
modifier onlyAllowed() {
require(PROTOCOL_CONTROLLER.allowed(address(this), msg.sender, msg.sig), OnlyAllowed());
_;
}
//////////////////////////////////////////////////////
/// --- CONSTRUCTOR
//////////////////////////////////////////////////////
/// @notice Initializes the Accountant contract with owner, registry, and reward token.
/// @param _owner The address of the contract owner.
/// @param _registry The address of the registry contract.
/// @param _rewardToken The address of the reward token.
/// @param _protocolId The bytes4 ID of the protocol
/// @custom:throws OwnableInvalidOwner If the owner is the zero address.
/// @custom:throws InvalidProtocolController If the protocol controller is the zero address.
/// @custom:throws InvalidRewardToken If the reward token is the zero address.
constructor(address _owner, address _registry, address _rewardToken, bytes4 _protocolId) Ownable(_owner) {
require(_registry != address(0), InvalidProtocolController());
require(_rewardToken != address(0), InvalidRewardToken());
require(_protocolId != bytes4(0), InvalidProtocolId());
/// set the immutable variables
PROTOCOL_CONTROLLER = IProtocolController(_registry);
REWARD_TOKEN = _rewardToken;
PROTOCOL_ID = _protocolId;
/// set the initial fees to the default values, and emit the update events
feesParams = FeesParams({protocolFeePercent: DEFAULT_PROTOCOL_FEE, harvestFeePercent: DEFAULT_HARVEST_FEE});
emit HarvestFeePercentSet(0, DEFAULT_HARVEST_FEE);
emit ProtocolFeePercentSet(0, DEFAULT_PROTOCOL_FEE);
}
//////////////////////////////////////////////////////
/// --- CHECKPOINT OPERATIONS
//////////////////////////////////////////////////////
/// @notice Checkpoints the state of the vault on every account action.
/// @dev Handles four types of operations:
/// 1. Minting (from = address(0)): Creates new tokens.
/// 2. Burning (to = address(0)): Destroys tokens.
/// 3. Transfers: Updates balances and rewards for both sender and receiver.
/// 4. Reward Distribution: Processes pending rewards if any exist.
/// @param gauge The underlying gauge address of the vault.
/// @param from The source address (address(0) for minting).
/// @param to The destination address (address(0) for burning).
/// @param amount The amount of tokens being transferred/minted/burned.
/// @param pendingRewards New rewards to be distributed to the vault.
/// @param harvested Whether these rewards were already harvested by the vault and sent to the contract.
/// @custom:throws OnlyVault If caller is not the registered vault for the gauge.
function checkpoint(
address gauge,
address from,
address to,
uint128 amount,
IStrategy.PendingRewards calldata pendingRewards,
bool harvested
) external nonReentrant {
require(PROTOCOL_CONTROLLER.vaults(gauge) == msg.sender, OnlyVault());
VaultData storage _vault = vaults[msg.sender];
uint128 supply = _vault.supply;
uint256 integral = _vault.integral;
// Process any pending rewards if they exist and there is supply
if (pendingRewards.totalAmount > 0 && supply > 0) {
// Calculate the new rewards to be added to the vault.
uint128 newRewards = pendingRewards.totalAmount - _vault.totalAmount;
uint128 newFeeSubjectAmount = pendingRewards.feeSubjectAmount - _vault.feeSubjectAmount;
uint128 totalFees;
if (harvested && newRewards > 0) {
// Calculate total fees in one operation
// We charge only protocol fee on the harvested rewards.
if (newFeeSubjectAmount > 0) {
totalFees = newFeeSubjectAmount.mulDiv(getProtocolFeePercent(), 1e18).toUint128();
// Update protocol fees accrued.
protocolFeesAccrued += totalFees;
}
// Update integral with new rewards per token
integral += (newRewards - totalFees).mulDiv(SCALING_FACTOR, supply);
}
// If the new rewards are above the minimum meaningful rewards,
// we update the integral and pending rewards.
// Otherwise, we don't update the integral to avoid precision loss. It won't be lost, just delayed.
else if (newRewards >= MIN_MEANINGFUL_REWARDS) {
// Calculate total fees in one operation
// We charge protocol and harvest fees on the unclaimed rewards.
if (newFeeSubjectAmount > 0) {
totalFees = newFeeSubjectAmount.mulDiv(getProtocolFeePercent(), 1e18).toUint128();
}
// Get harvest fee for the unclaimed rewards.
totalFees += newRewards.mulDiv(getHarvestFeePercent(), 1e18).toUint128();
// The net rewards we are *actually crediting* now
uint128 netIncrement = newRewards - totalFees;
// Update integral with new rewards per token
integral += netIncrement.mulDiv(SCALING_FACTOR, supply);
// Record how many total net rewards we've credited so far
_vault.netCredited += netIncrement;
// Update the total amount and the fee subject amount of the Vault
_vault.totalAmount = pendingRewards.totalAmount;
_vault.feeSubjectAmount = pendingRewards.feeSubjectAmount;
}
}
// Handle token operations
if (from == address(0)) {
// Minting operation
supply += amount;
} else {
// Update sender's balance and rewards
_updateAccountState({
vault: msg.sender,
account: from,
amount: amount,
currentIntegral: integral,
isDecrease: true
});
}
if (to == address(0)) {
// Burning operation
supply -= amount;
} else {
// Update receiver's balance and rewards
_updateAccountState({
vault: msg.sender,
account: to,
amount: amount,
currentIntegral: integral,
isDecrease: false
});
}
// Update vault data with new supply and integral
_vault.integral = integral;
_vault.supply = supply;
}
/// @dev Updates account state during operations.
/// @param vault The vault address.
/// @param account The account to update.
/// @param amount The amount to add/subtract.
/// @param isDecrease Whether to decrease (true) or increase (false) the balance.
/// @param currentIntegral The current reward integral to checkpoint against.
function _updateAccountState(
address vault,
address account,
uint128 amount,
bool isDecrease,
uint256 currentIntegral
) private {
AccountData storage accountData = accounts[vault][account];
// cache the balance in the stack for gas optimization
uint128 accountBalance = accountData.balance;
// Update pending rewards based on the integral difference.
accountData.pendingRewards +=
(currentIntegral - accountData.integral).mulDiv(uint256(accountBalance), SCALING_FACTOR);
accountData.balance = isDecrease ? accountBalance - amount : accountBalance + amount;
accountData.integral = currentIntegral;
}
/// @notice Returns the total supply of tokens in a vault.
/// @param vault The vault address to query.
/// @return _ The total supply of tokens in the vault.
function totalSupply(address vault) external view returns (uint128) {
return vaults[vault].supply;
}
/// @notice Returns the token balance of an account in a vault.
/// @param vault The vault address to query.
/// @param account The account address to check.
/// @return _ The account's token balance in the vault.
function balanceOf(address vault, address account) external view returns (uint128) {
return accounts[vault][account].balance;
}
/// @notice Returns the pending rewards for an account in a vault.
/// @param vault The vault address to query.
/// @param account The account address to check.
/// @return _ The pending rewards for the account in the vault.
function getPendingRewards(address vault, address account) external view returns (uint256) {
return accounts[vault][account].pendingRewards;
}
/// @notice Returns the pending rewards for a vault.
/// @param vault The vault address to query.
/// @return The pending rewards for the vault.
function getPendingRewards(address vault) external view returns (uint128) {
return vaults[vault].totalAmount;
}
/// @notice Returns the integral for a vault.
/// @param vault The vault address to query.
/// @return The integral for the vault.
function getVaultIntegral(address vault) external view returns (uint256) {
return vaults[vault].integral;
}
//////////////////////////////////////////////////////
/// --- HARVEST OPERATIONS
//////////////////////////////////////////////////////
/// @notice Harvests rewards from multiple gauges.
/// @param _gauges Array of gauges to harvest from.
/// @param _harvestData Array of harvest data for each gauge.
/// @custom:throws NoStrategy If the harvester is not set.
function harvest(address[] calldata _gauges, bytes[] calldata _harvestData) external {
require(_gauges.length == _harvestData.length, InvalidHarvestDataLength());
_harvest(_gauges, _harvestData, msg.sender);
}
/// @dev Internal implementation of batch harvesting.
/// @param _gauges Array of gauges to harvest from.
/// @param harvestData Harvest data for each gauge.
/// @param receiver Address that will receive the harvester fee.
/// @dev This implementation optimizes gas by:
/// 1. Batching all harvests before calling flush() only once at the end
/// 2. Collecting all rewards in a single transfer from the Strategy
function _harvest(address[] memory _gauges, bytes[] memory harvestData, address receiver) internal nonReentrant {
// Cache strategy to avoid multiple SLOADs
address strategy = PROTOCOL_CONTROLLER.strategy(PROTOCOL_ID);
require(strategy != address(0), NoStrategy());
uint256 totalHarvesterFee;
uint256 totalRewardsAmount;
// Fetch the balance of the Accountant contract before harvesting.
uint256 balanceBefore = IERC20(REWARD_TOKEN).balanceOf(address(this));
// Fees should be calculated before the harvest
uint256 currentHarvestFee = getCurrentHarvestFee();
// First pass: harvest all gauges and update vault states
for (uint256 i; i < _gauges.length; i++) {
address gauge = _gauges[i];
address vault = PROTOCOL_CONTROLLER.vaults(gauge);
require(vault != address(0), InvalidVault());
// Harvest the asset (this accumulates rewards in the strategy contract)
IStrategy.PendingRewards memory pendingRewards = IStrategy(strategy).harvest(gauge, harvestData[i]);
if (pendingRewards.totalAmount == 0) continue;
// Track total rewards
totalRewardsAmount += pendingRewards.totalAmount;
// Calculate protocol fee on the feeable amount
uint256 protocolFee = 0;
if (pendingRewards.feeSubjectAmount > 0) {
protocolFee = pendingRewards.feeSubjectAmount.mulDiv(feesParams.protocolFeePercent, 1e18);
// Update protocol fees accrued.
protocolFeesAccrued += protocolFee;
}
// Calculate harvester fee on the total amount
uint256 harvesterFee = pendingRewards.totalAmount.mulDiv(currentHarvestFee, 1e18);
totalHarvesterFee += harvesterFee;
VaultData storage _vault = vaults[vault];
uint256 newNet = pendingRewards.totalAmount - protocolFee - harvesterFee;
uint256 oldNet = _vault.netCredited;
if (newNet > oldNet) {
uint256 netDelta = newNet - oldNet;
// Add only that delta to the integral
_vault.integral += netDelta.mulDiv(SCALING_FACTOR, _vault.supply);
}
// Update the net credited so far
_vault.netCredited = newNet.toUint128();
// Always clear pending rewards after harvesting
_vault.feeSubjectAmount = 0;
_vault.totalAmount = 0;
emit Harvest(vault, pendingRewards.totalAmount);
}
// If no valid harvests, return early
if (totalRewardsAmount == 0) return;
// Flush all accumulated rewards at once
IStrategy(strategy).flush();
// Check that the harvester has transferred the correct amount of reward tokens to this contract
require(
IERC20(REWARD_TOKEN).balanceOf(address(this)) >= balanceBefore + totalRewardsAmount,
HarvestTokenNotReceived()
);
// Transfer total harvester fee if any
if (totalHarvesterFee > 0) {
IERC20(REWARD_TOKEN).safeTransfer(receiver, totalHarvesterFee);
}
}
/// @notice Returns the current harvest fee based on contract balance
/// @return _ The current harvest fee percentage
function getCurrentHarvestFee() public view returns (uint256) {
uint256 harvestTreshold = HARVEST_URGENCY_THRESHOLD;
uint128 currentHarvestFeePercent = feesParams.harvestFeePercent;
// If threshold is 0, always return max harvest fee
if (harvestTreshold == 0) return currentHarvestFeePercent;
// If threshold is not set, return the current harvest fee based on balance
uint256 balance = IERC20(REWARD_TOKEN).balanceOf(address(this));
return balance >= harvestTreshold ? 0 : currentHarvestFeePercent * (harvestTreshold - balance) / harvestTreshold;
}
/// @notice Returns the current harvest fee percentage.
/// @return _ The harvest fee percentage.
function getHarvestFeePercent() public view returns (uint128) {
return feesParams.harvestFeePercent;
}
/// @notice Updates the harvest fee percentage.
/// @param newHarvestFeePercent New harvest fee percentage (scaled by 1e18).
/// @custom:throws FeeExceedsMaximum If fee would exceed maximum.
function setHarvestFeePercent(uint128 newHarvestFeePercent) external onlyOwner {
FeesParams storage currentFees = feesParams;
// check that the new total fee (protocol + harvest) is valid
uint256 totalFee = uint256(currentFees.protocolFeePercent) + uint256(newHarvestFeePercent);
require(totalFee <= MAX_FEE_PERCENT, FeeExceedsMaximum());
// emit the harvest event before updating the storage pointer
emit HarvestFeePercentSet(currentFees.harvestFeePercent, newHarvestFeePercent);
// set the new protocol fee percent
feesParams.harvestFeePercent = newHarvestFeePercent;
}
/// @notice Updates the balance threshold for harvest fee calculation
/// @param _threshold New balance threshold. Set to 0 to always apply maximum harvest fee.
function setHarvestUrgencyThreshold(uint256 _threshold) external onlyOwner {
// emit the update event before updating the stored value
emit HarvestUrgencyThresholdSet(HARVEST_URGENCY_THRESHOLD, _threshold);
HARVEST_URGENCY_THRESHOLD = _threshold;
}
//////////////////////////////////////////////////////
/// --- CLAIM OPERATIONS
//////////////////////////////////////////////////////
/// @notice Claims multiple vault rewards for yourself.
/// @param _gauges Array of gauges to claim rewards from.
/// @param harvestData Optional harvest data for each gauge. Empty bytes for gauges that don't need harvesting.
/// @custom:throws NoPendingRewards If there are no rewards to claim.
function claim(address[] calldata _gauges, bytes[] calldata harvestData) external {
claim(_gauges, harvestData, msg.sender);
}
/// @notice Claims multiple vault rewards for yourself and sends them to a specific address.
/// @param _gauges Array of gauges to claim rewards from.
/// @param harvestData Optional harvest data for each gauge. Empty bytes for gauges that don't need harvesting.
/// @param receiver Address that will receive the claimed rewards.
/// @custom:throws NoPendingRewards If there are no rewards to claim.
function claim(address[] calldata _gauges, bytes[] calldata harvestData, address receiver) public {
require(harvestData.length == 0 || harvestData.length == _gauges.length, InvalidHarvestDataLength());
if (harvestData.length != 0) {
_harvest(_gauges, harvestData, receiver);
}
_claim({_gauges: _gauges, accountAddress: msg.sender, receiver: receiver});
}
/// @notice Claims multiple vault rewards on behalf of an account.
/// @param _gauges Array of gauges to claim rewards from.
/// @param account Address to claim rewards for.
/// @param harvestData Optional harvest data for each gauge. Empty bytes for gauges that don't need harvesting.
/// @dev expected to be called by authorized accounts only
/// @custom:throws OnlyAllowed If caller is not allowed to claim on behalf of others.
/// @custom:throws NoPendingRewards If there are no rewards to claim.
function claim(address[] calldata _gauges, address account, bytes[] calldata harvestData) external {
claim(_gauges, account, harvestData, account);
}
/// @notice Claims multiple vault rewards on behalf of an account and sends them to a specific address.
/// @param _gauges Array of gauges to claim rewards from.
/// @param account Address to claim rewards for.
/// @param harvestData Optional harvest data for each gauge. Empty bytes for gauges that don't need harvesting.
/// @param receiver Address that will receive the claimed rewards.
/// @dev expected to be called by authorized accounts only
/// @custom:throws OnlyAllowed If caller is not allowed to claim on behalf of others.
/// @custom:throws NoPendingRewards If there are no rewards to claim.
function claim(address[] calldata _gauges, address account, bytes[] calldata harvestData, address receiver)
public
onlyAllowed
{
require(harvestData.length == 0 || harvestData.length == _gauges.length, InvalidHarvestDataLength());
if (harvestData.length != 0) {
_harvest(_gauges, harvestData, receiver);
}
_claim({_gauges: _gauges, accountAddress: account, receiver: receiver});
}
/// @dev Internal implementation of claim functionality.
/// @param _gauges Array of gauges to claim rewards from.
/// @param accountAddress Address to claim rewards for.
/// @param receiver Address that will receive the claimed rewards.
/// @custom:throws NoPendingRewards If the total claimed amount is zero.
function _claim(address[] calldata _gauges, address accountAddress, address receiver) internal nonReentrant {
uint256 totalAmount;
address vault;
// For each gauge, check if the account has any rewards to claim
for (uint256 i; i < _gauges.length; i++) {
vault = PROTOCOL_CONTROLLER.vaults(_gauges[i]);
require(vault != address(0), InvalidVault());
// Get the account data for this gauge
AccountData storage account = accounts[vault][accountAddress];
// Get the current balance for this vault
uint128 balance = account.balance;
// If account has any rewards to claim for this vault, calculate the amount. Otherwise, skip.
if (balance != 0 || account.pendingRewards != 0) {
// Get vault's and account's integral
uint256 accountIntegral = account.integral;
uint256 vaultIntegral = vaults[vault].integral;
// If vault's integral is higher than account's integral, calculate the rewards and update the total.
// TODO: muldiv
if (vaultIntegral > accountIntegral) {
totalAmount += (vaultIntegral - accountIntegral) * balance / SCALING_FACTOR;
}
// In any case, add the pending rewards to the total amount
totalAmount += account.pendingRewards;
// Update account's integral with the current value of Vault's integral
account.integral = vaultIntegral;
// reset the stored pending rewards for this vault
account.pendingRewards = 0;
}
}
// If there is no amount to claim for any vault, revert.
require(totalAmount != 0, NoPendingRewards());
// Transfer accumulated rewards to the receiver
IERC20(REWARD_TOKEN).safeTransfer(receiver, totalAmount);
}
//////////////////////////////////////////////////////
/// --- FEE MANAGEMENT
//////////////////////////////////////////////////////
/// @notice Returns the current protocol fee percentage.
/// @return _ The protocol fee percentage.
function getProtocolFeePercent() public view returns (uint128) {
return feesParams.protocolFeePercent;
}
/// @notice Updates the protocol fee percentage.
/// @param newProtocolFeePercent New protocol fee percentage (scaled by 1e18).
/// @custom:throws FeeExceedsMaximum If fee would exceed maximum.
function setProtocolFeePercent(uint128 newProtocolFeePercent) external onlyOwner {
// check that the provided protocol fee is valid
require(newProtocolFeePercent <= MAX_FEE_PERCENT, FeeExceedsMaximum());
FeesParams storage currentFees = feesParams;
// check that the total fee (protocol + harvest) is valid
uint128 totalFee = newProtocolFeePercent + currentFees.harvestFeePercent;
require(totalFee <= MAX_FEE_PERCENT, FeeExceedsMaximum());
// emit the update event
emit ProtocolFeePercentSet(currentFees.protocolFeePercent, newProtocolFeePercent);
// set the new protocol fee percent
currentFees.protocolFeePercent = newProtocolFeePercent;
}
/// @notice Claims accumulated protocol fees.
/// @dev Transfers fees to the configured fee receiver.
/// @custom:throws NoFeeReceiver If the fee receiver is not set.
function claimProtocolFees() external nonReentrant {
// get the fee receiver from the protocol controller and check that it is valid
address feeReceiver = PROTOCOL_CONTROLLER.feeReceiver(PROTOCOL_ID);
require(feeReceiver != address(0), NoFeeReceiver());
// get the protocol fees accrued until now and reset the stored value
uint256 currentAccruedProtocolFees = protocolFeesAccrued;
protocolFeesAccrued = 0;
// transfer the accrued protocol fees to the fee receiver and emit the claim event
IERC20(REWARD_TOKEN).transfer(feeReceiver, currentAccruedProtocolFees);
emit ProtocolFeesClaimed(currentAccruedProtocolFees);
}
/// @notice Returns the total fee percentage (protocol + harvest).
/// @return _ The total fee percentage.
function getTotalFeePercent() external view returns (uint128) {
return feesParams.protocolFeePercent + feesParams.harvestFeePercent;
}
}// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.28;
import "src/interfaces/IAllocator.sol";
interface IStrategy {
struct PendingRewards {
uint128 feeSubjectAmount;
uint128 totalAmount;
}
function deposit(IAllocator.Allocation calldata allocation, bool harvest)
external
returns (PendingRewards memory pendingRewards);
function withdraw(IAllocator.Allocation calldata allocation, bool harvest, address receiver)
external
returns (PendingRewards memory pendingRewards);
function balanceOf(address gauge) external view returns (uint256 balance);
function harvest(address gauge, bytes calldata extraData) external returns (PendingRewards memory pendingRewards);
function flush() external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import {IStrategy} from "src/interfaces/IStrategy.sol";
interface IAccountant {
function checkpoint(
address gauge,
address from,
address to,
uint128 amount,
IStrategy.PendingRewards calldata pendingRewards,
bool claimed
) external;
function totalSupply(address asset) external view returns (uint128);
function balanceOf(address asset, address account) external view returns (uint128);
function claim(address[] calldata _vaults, bytes[] calldata harvestData) external;
function claim(address[] calldata _vaults, bytes[] calldata harvestData, address receiver) external;
function claim(address[] calldata _vaults, address account, bytes[] calldata harvestData) external;
function claim(address[] calldata _vaults, address account, bytes[] calldata harvestData, address receiver)
external;
function claimProtocolFees() external;
function harvest(address[] calldata _vaults, bytes[] calldata _harvestData) external;
function REWARD_TOKEN() external view returns (address);
}/// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.28;
interface IProtocolController {
function vaults(address) external view returns (address);
function asset(address) external view returns (address);
function rewardReceiver(address) external view returns (address);
function allowed(address, address, bytes4 selector) external view returns (bool);
function permissionSetters(address) external view returns (bool);
function isRegistrar(address) external view returns (bool);
function strategy(bytes4 protocolId) external view returns (address);
function allocator(bytes4 protocolId) external view returns (address);
function accountant(bytes4 protocolId) external view returns (address);
function feeReceiver(bytes4 protocolId) external view returns (address);
function isShutdown(address) external view returns (bool);
function registerVault(address _gauge, address _vault, address _asset, address _rewardReceiver, bytes4 _protocolId)
external;
function setValidAllocationTarget(address _gauge, address _target) external;
function removeValidAllocationTarget(address _gauge, address _target) external;
function isValidAllocationTarget(address _gauge, address _target) external view returns (bool);
function setPermissionSetter(address _setter, bool _allowed) external;
function setPermission(address _contract, address _caller, bytes4 _selector, bool _allowed) external;
}// 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
// 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) (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) (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
// 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
// OpenZeppelin Contracts (last updated v5.1.0) (access/Ownable2Step.sol)
pragma solidity ^0.8.20;
import {Ownable} from "./Ownable.sol";
/**
* @dev Contract module which provides access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This extension of the {Ownable} contract includes a two-step mechanism to transfer
* ownership, where the new owner must call {acceptOwnership} in order to replace the
* old one. This can help prevent common mistakes, such as transfers of ownership to
* incorrect accounts, or to contracts that are unable to interact with the
* permission system.
*
* The initial owner is specified at deployment time in the constructor for `Ownable`. This
* can later be changed with {transferOwnership} and {acceptOwnership}.
*
* This module is used through inheritance. It will make available all functions
* from parent (Ownable).
*/
abstract contract Ownable2Step is Ownable {
address private _pendingOwner;
event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);
/**
* @dev Returns the address of the pending owner.
*/
function pendingOwner() public view virtual returns (address) {
return _pendingOwner;
}
/**
* @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
* Can only be called by the current owner.
*
* Setting `newOwner` to the zero address is allowed; this can be used to cancel an initiated ownership transfer.
*/
function transferOwnership(address newOwner) public virtual override onlyOwner {
_pendingOwner = newOwner;
emit OwnershipTransferStarted(owner(), newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual override {
delete _pendingOwner;
super._transferOwnership(newOwner);
}
/**
* @dev The new owner accepts the ownership transfer.
*/
function acceptOwnership() public virtual {
address sender = _msgSender();
if (pendingOwner() != sender) {
revert OwnableUnauthorizedAccount(sender);
}
_transferOwnership(sender);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuardTransient.sol)
pragma solidity ^0.8.24;
import {TransientSlot} from "./TransientSlot.sol";
/**
* @dev Variant of {ReentrancyGuard} that uses transient storage.
*
* NOTE: This variant only works on networks where EIP-1153 is available.
*
* _Available since v5.1._
*/
abstract contract ReentrancyGuardTransient {
using TransientSlot for *;
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant REENTRANCY_GUARD_STORAGE =
0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00;
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
/**
* @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 (_reentrancyGuardEntered()) {
revert ReentrancyGuardReentrantCall();
}
// Any calls to nonReentrant after this point will fail
REENTRANCY_GUARD_STORAGE.asBoolean().tstore(true);
}
function _nonReentrantAfter() private {
REENTRANCY_GUARD_STORAGE.asBoolean().tstore(false);
}
/**
* @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 REENTRANCY_GUARD_STORAGE.asBoolean().tload();
}
}// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.28;
interface IAllocator {
struct Allocation {
address asset;
address gauge;
address[] targets;
uint256[] amounts;
}
function getDepositAllocation(address asset, address gauge, uint256 amount)
external
view
returns (Allocation memory);
function getWithdrawalAllocation(address asset, address gauge, uint256 amount)
external
view
returns (Allocation memory);
function getRebalancedAllocation(address asset, address gauge, uint256 amount)
external
view
returns (Allocation memory);
function getAllocationTargets(address gauge) external view returns (address[] memory);
}// 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.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) (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.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. This can
* later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/TransientSlot.sol)
// This file was procedurally generated from scripts/generate/templates/TransientSlot.js.
pragma solidity ^0.8.24;
/**
* @dev Library for reading and writing value-types to specific transient storage slots.
*
* Transient slots are often used to store temporary values that are removed after the current transaction.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* * Example reading and writing values using transient storage:
* ```solidity
* contract Lock {
* using TransientSlot for *;
*
* // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.
* bytes32 internal constant _LOCK_SLOT = 0xf4678858b2b588224636b8522b729e7722d32fc491da849ed75b3fdf3c84f542;
*
* modifier locked() {
* require(!_LOCK_SLOT.asBoolean().tload());
*
* _LOCK_SLOT.asBoolean().tstore(true);
* _;
* _LOCK_SLOT.asBoolean().tstore(false);
* }
* }
* ```
*
* TIP: Consider using this library along with {SlotDerivation}.
*/
library TransientSlot {
/**
* @dev UDVT that represent a slot holding a address.
*/
type AddressSlot is bytes32;
/**
* @dev Cast an arbitrary slot to a AddressSlot.
*/
function asAddress(bytes32 slot) internal pure returns (AddressSlot) {
return AddressSlot.wrap(slot);
}
/**
* @dev UDVT that represent a slot holding a bool.
*/
type BooleanSlot is bytes32;
/**
* @dev Cast an arbitrary slot to a BooleanSlot.
*/
function asBoolean(bytes32 slot) internal pure returns (BooleanSlot) {
return BooleanSlot.wrap(slot);
}
/**
* @dev UDVT that represent a slot holding a bytes32.
*/
type Bytes32Slot is bytes32;
/**
* @dev Cast an arbitrary slot to a Bytes32Slot.
*/
function asBytes32(bytes32 slot) internal pure returns (Bytes32Slot) {
return Bytes32Slot.wrap(slot);
}
/**
* @dev UDVT that represent a slot holding a uint256.
*/
type Uint256Slot is bytes32;
/**
* @dev Cast an arbitrary slot to a Uint256Slot.
*/
function asUint256(bytes32 slot) internal pure returns (Uint256Slot) {
return Uint256Slot.wrap(slot);
}
/**
* @dev UDVT that represent a slot holding a int256.
*/
type Int256Slot is bytes32;
/**
* @dev Cast an arbitrary slot to a Int256Slot.
*/
function asInt256(bytes32 slot) internal pure returns (Int256Slot) {
return Int256Slot.wrap(slot);
}
/**
* @dev Load the value held at location `slot` in transient storage.
*/
function tload(AddressSlot slot) internal view returns (address value) {
assembly ("memory-safe") {
value := tload(slot)
}
}
/**
* @dev Store `value` at location `slot` in transient storage.
*/
function tstore(AddressSlot slot, address value) internal {
assembly ("memory-safe") {
tstore(slot, value)
}
}
/**
* @dev Load the value held at location `slot` in transient storage.
*/
function tload(BooleanSlot slot) internal view returns (bool value) {
assembly ("memory-safe") {
value := tload(slot)
}
}
/**
* @dev Store `value` at location `slot` in transient storage.
*/
function tstore(BooleanSlot slot, bool value) internal {
assembly ("memory-safe") {
tstore(slot, value)
}
}
/**
* @dev Load the value held at location `slot` in transient storage.
*/
function tload(Bytes32Slot slot) internal view returns (bytes32 value) {
assembly ("memory-safe") {
value := tload(slot)
}
}
/**
* @dev Store `value` at location `slot` in transient storage.
*/
function tstore(Bytes32Slot slot, bytes32 value) internal {
assembly ("memory-safe") {
tstore(slot, value)
}
}
/**
* @dev Load the value held at location `slot` in transient storage.
*/
function tload(Uint256Slot slot) internal view returns (uint256 value) {
assembly ("memory-safe") {
value := tload(slot)
}
}
/**
* @dev Store `value` at location `slot` in transient storage.
*/
function tstore(Uint256Slot slot, uint256 value) internal {
assembly ("memory-safe") {
tstore(slot, value)
}
}
/**
* @dev Load the value held at location `slot` in transient storage.
*/
function tload(Int256Slot slot) internal view returns (int256 value) {
assembly ("memory-safe") {
value := tload(slot)
}
}
/**
* @dev Store `value` at location `slot` in transient storage.
*/
function tstore(Int256Slot slot, int256 value) internal {
assembly ("memory-safe") {
tstore(slot, value)
}
}
}// 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
// 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.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.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);
}{
"remappings": [
"forge-std/=node_modules/forge-std/",
"@safe/=node_modules/@safe-global/safe-smart-account/",
"address-book/=node_modules/@stake-dao/address-book/",
"@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/",
"@interfaces/=node_modules/@stake-dao/interfaces/src/interfaces/",
"@safe-global/=node_modules/@safe-global/",
"@solady/=node_modules/@solady/"
],
"optimizer": {
"enabled": false,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "cancun",
"viaIR": false,
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_registry","type":"address"},{"internalType":"address","name":"_rewardToken","type":"address"},{"internalType":"bytes4","name":"_protocolId","type":"bytes4"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"FeeExceedsMaximum","type":"error"},{"inputs":[],"name":"HarvestTokenNotReceived","type":"error"},{"inputs":[],"name":"InvalidHarvestDataLength","type":"error"},{"inputs":[],"name":"InvalidProtocolController","type":"error"},{"inputs":[],"name":"InvalidProtocolId","type":"error"},{"inputs":[],"name":"InvalidRewardToken","type":"error"},{"inputs":[],"name":"InvalidVault","type":"error"},{"inputs":[],"name":"NoFeeReceiver","type":"error"},{"inputs":[],"name":"NoPendingRewards","type":"error"},{"inputs":[],"name":"NoStrategy","type":"error"},{"inputs":[],"name":"OnlyAllowed","type":"error"},{"inputs":[],"name":"OnlyVault","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"uint8","name":"bits","type":"uint8"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"SafeCastOverflowedUintDowncast","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"vault","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Harvest","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint128","name":"oldHarvestFeePercent","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"newHarvestFeePercent","type":"uint128"}],"name":"HarvestFeePercentSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldThreshold","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newThreshold","type":"uint256"}],"name":"HarvestUrgencyThresholdSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","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":false,"internalType":"uint128","name":"oldProtocolFeePercent","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"newProtocolFeePercent","type":"uint128"}],"name":"ProtocolFeePercentSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ProtocolFeesClaimed","type":"event"},{"inputs":[],"name":"HARVEST_URGENCY_THRESHOLD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_FEE_PERCENT","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_MEANINGFUL_REWARDS","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PROTOCOL_CONTROLLER","outputs":[{"internalType":"contract IProtocolController","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PROTOCOL_ID","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REWARD_TOKEN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SCALING_FACTOR","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"gauge","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint128","name":"amount","type":"uint128"},{"components":[{"internalType":"uint128","name":"feeSubjectAmount","type":"uint128"},{"internalType":"uint128","name":"totalAmount","type":"uint128"}],"internalType":"struct IStrategy.PendingRewards","name":"pendingRewards","type":"tuple"},{"internalType":"bool","name":"harvested","type":"bool"}],"name":"checkpoint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"},{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes[]","name":"harvestData","type":"bytes[]"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"},{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes[]","name":"harvestData","type":"bytes[]"},{"internalType":"address","name":"receiver","type":"address"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"},{"internalType":"bytes[]","name":"harvestData","type":"bytes[]"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"},{"internalType":"bytes[]","name":"harvestData","type":"bytes[]"},{"internalType":"address","name":"receiver","type":"address"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimProtocolFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feesParams","outputs":[{"internalType":"uint128","name":"protocolFeePercent","type":"uint128"},{"internalType":"uint128","name":"harvestFeePercent","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentHarvestFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getHarvestFeePercent","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"getPendingRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"}],"name":"getPendingRewards","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getProtocolFeePercent","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalFeePercent","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"}],"name":"getVaultIntegral","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"},{"internalType":"bytes[]","name":"_harvestData","type":"bytes[]"}],"name":"harvest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolFeesAccrued","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint128","name":"newHarvestFeePercent","type":"uint128"}],"name":"setHarvestFeePercent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_threshold","type":"uint256"}],"name":"setHarvestUrgencyThreshold","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint128","name":"newProtocolFeePercent","type":"uint128"}],"name":"setProtocolFeePercent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"}],"name":"totalSupply","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60e060405234801561000f575f5ffd5b506040516144073803806144078339818101604052810190610031919061059f565b835f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036100a2575f6040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081526004016100999190610612565b60405180910390fd5b6100b1816103f560201b60201c565b505f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610117576040517ff8724b8800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361017c576040517fdfde867100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f60e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036101f6576040517fabcf87b200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff16815250508173ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff1681525050807bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191660c0817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815250506040518060400160405280670214e8348c4f00006fffffffffffffffffffffffffffffffff1681526020016611c37937e080006fffffffffffffffffffffffffffffffff1681525060025f820151815f015f6101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055506020820151815f0160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055509050507f9eff170752bff88fe482ef6885f2ea7d13c27a72a64aa0968e4e40e2092e2ffb5f6611c37937e080006040516103a3929190610697565b60405180910390a17f23c1335b4285bea37ccdc6223b0269c10c388464aad09ed312747fa9c3a8d8e35f670214e8348c4f00006040516103e4929190610697565b60405180910390a1505050506106be565b60015f6101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556104288161042b60201b60201c565b50565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610519826104f0565b9050919050565b6105298161050f565b8114610533575f5ffd5b50565b5f8151905061054481610520565b92915050565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b61057e8161054a565b8114610588575f5ffd5b50565b5f8151905061059981610575565b92915050565b5f5f5f5f608085870312156105b7576105b66104ec565b5b5f6105c487828801610536565b94505060206105d587828801610536565b93505060406105e687828801610536565b92505060606105f78782880161058b565b91505092959194509250565b61060c8161050f565b82525050565b5f6020820190506106255f830184610603565b92915050565b5f819050919050565b5f6fffffffffffffffffffffffffffffffff82169050919050565b5f819050919050565b5f61067261066d6106688461062b565b61064f565b610634565b9050919050565b61068281610658565b82525050565b61069181610634565b82525050565b5f6040820190506106aa5f830185610679565b6106b76020830184610688565b9392505050565b60805160a05160c051613cbd61074a5f395f8181610cc001528181610d86015261204d01525f8181610e76015281816110f90152818161120e0152818161213301528181612798015281816128750152612bfb01525f818161060701528181610d4a01528181611087015281816116ee015281816120110152818161220201526128e60152613cbd5ff3fe608060405234801561000f575f5ffd5b50600436106101f9575f3560e01c8063af5db8c511610118578063e84f9836116100ab578063f2fde38b1161007a578063f2fde38b1461051e578063f6ed20171461053a578063f7888aec1461056a578063fc0e7be41461059a578063fe5966c5146105ca576101f9565b8063e84f9836146104ac578063ef4cadc5146104c8578063ef933df0146104e6578063f0a2351114610502576101f9565b8063d6e22a43116100e7578063d6e22a4314610426578063e0b735d514610442578063e30c39781461045e578063e4dc2aa41461047c576101f9565b8063af5db8c5146103af578063b621e75a146103cb578063bc7e75ba146103e9578063cd3f29e914610408576101f9565b80637a27db571161019057806399248ea71161015f57806399248ea7146103395780639a06d976146103575780639fe95cd914610373578063af2bf4cd14610391576101f9565b80637a27db57146102af5780637aaf53e6146102df57806389acf147146102fd5780638da5cb5b1461031b576101f9565b80634a7d0369116101cc5780634a7d03691461027357806367d817401461027d578063715018a61461029b57806379ba5097146102a5576101f9565b8063064428dc146101fd5780630db41f3114610219578063235d20351461023757806337e08bcd14610255575b5f5ffd5b61021760048036038101906102129190612fb9565b6105e6565b005b610221610cbe565b60405161022e919061307c565b60405180910390f35b61023f610ce2565b60405161024c91906130a4565b60405180910390f35b61025d610d33565b60405161026a91906130a4565b60405180910390f35b61027b610d3f565b005b610285610f53565b60405161029291906130a4565b60405180910390f35b6102a3610f5f565b005b6102ad610f72565b005b6102c960048036038101906102c491906130bd565b611000565b6040516102d69190613113565b60405180910390f35b6102e7611085565b6040516102f49190613187565b60405180910390f35b6103056110a9565b60405161031291906130a4565b60405180910390f35b6103236110d0565b60405161033091906131af565b60405180910390f35b6103416110f7565b60405161034e91906131af565b60405180910390f35b610371600480360381019061036c919061327e565b61111b565b005b61037b6111b7565b6040516103889190613113565b60405180910390f35b6103996111bd565b6040516103a69190613113565b60405180910390f35b6103c960048036038101906103c491906132fc565b6112f2565b005b6103d3611307565b6040516103e09190613113565b60405180910390f35b6103f161130d565b6040516103ff92919061338d565b60405180910390f35b610410611354565b60405161041d91906130a4565b60405180910390f35b610440600480360381019061043b91906133b4565b61137a565b005b61045c600480360381019061045791906133b4565b611516565b005b610466611660565b60405161047391906131af565b60405180910390f35b610496600480360381019061049191906133df565b611688565b6040516104a391906130a4565b60405180910390f35b6104c660048036038101906104c1919061340a565b6116ec565b005b6104d06118a3565b6040516104dd91906130a4565b60405180910390f35b61050060048036038101906104fb919061327e565b6118b3565b005b61051c600480360381019061051791906134ad565b6118c6565b005b610538600480360381019061053391906133df565b611987565b005b610554600480360381019061054f91906133df565b611a33565b60405161056191906130a4565b60405180910390f35b610584600480360381019061057f91906130bd565b611a97565b60405161059191906130a4565b60405180910390f35b6105b460048036038101906105af91906133df565b611b36565b6040516105c19190613113565b60405180910390f35b6105e460048036038101906105df9190613568565b611b7e565b005b6105ee611bcb565b3373ffffffffffffffffffffffffffffffffffffffff167f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663a622ee7c886040518263ffffffff1660e01b815260040161065e91906131af565b602060405180830381865afa158015610679573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061069d91906135a7565b73ffffffffffffffffffffffffffffffffffffffff16146106ea576040517f8d1af8bd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f60055f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2090505f816001015f9054906101000a90046fffffffffffffffffffffffffffffffff1690505f825f015490505f85602001602081019061076891906133b4565b6fffffffffffffffffffffffffffffffff1611801561079857505f826fffffffffffffffffffffffffffffffff16115b15610bc0575f836002015f9054906101000a90046fffffffffffffffffffffffffffffffff168660200160208101906107d191906133b4565b6107db91906135ff565b90505f8460010160109054906101000a90046fffffffffffffffffffffffffffffffff16875f01602081019061081191906133b4565b61081b91906135ff565b90505f86801561083c57505f836fffffffffffffffffffffffffffffffff16115b1561094c575f826fffffffffffffffffffffffffffffffff1611156108d8576108ab6108a6610869611354565b6fffffffffffffffffffffffffffffffff16670de0b6b3a7640000856fffffffffffffffffffffffffffffffff16611c4a9092919063ffffffff16565b611d2f565b9050806fffffffffffffffffffffffffffffffff1660045f8282546108d09190613642565b925050819055505b61093a6b033b2e3c9fd0803ce80000006fffffffffffffffffffffffffffffffff16866fffffffffffffffffffffffffffffffff16838661091991906135ff565b6fffffffffffffffffffffffffffffffff16611c4a9092919063ffffffff16565b846109459190613642565b9350610bbc565b670de0b6b3a76400006fffffffffffffffffffffffffffffffff16836fffffffffffffffffffffffffffffffff1610610bbb575f826fffffffffffffffffffffffffffffffff1611156109ec576109e96109e46109a7611354565b6fffffffffffffffffffffffffffffffff16670de0b6b3a7640000856fffffffffffffffffffffffffffffffff16611c4a9092919063ffffffff16565b611d2f565b90505b610a3c610a376109fa6110a9565b6fffffffffffffffffffffffffffffffff16670de0b6b3a7640000866fffffffffffffffffffffffffffffffff16611c4a9092919063ffffffff16565b611d2f565b81610a479190613675565b90505f8184610a5691906135ff565b9050610aaf6b033b2e3c9fd0803ce80000006fffffffffffffffffffffffffffffffff16876fffffffffffffffffffffffffffffffff16836fffffffffffffffffffffffffffffffff16611c4a9092919063ffffffff16565b85610aba9190613642565b9450808760020160108282829054906101000a90046fffffffffffffffffffffffffffffffff16610aeb9190613675565b92506101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550886020016020810190610b3491906133b4565b876002015f6101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550885f016020810190610b7f91906133b4565b8760010160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550505b5b5050505b5f73ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff1603610c06578582610bff9190613675565b9150610c15565b610c14338988600185611d92565b5b5f73ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff1603610c5b578582610c5491906135ff565b9150610c69565b610c683388885f85611d92565b5b80835f018190555081836001015f6101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550505050610cb6611f09565b505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b5f60025f0160109054906101000a90046fffffffffffffffffffffffffffffffff1660025f015f9054906101000a90046fffffffffffffffffffffffffffffffff16610d2e9190613675565b905090565b670de0b6b3a764000081565b610d47611bcb565b5f7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166309f142727f00000000000000000000000000000000000000000000000000000000000000006040518263ffffffff1660e01b8152600401610dc1919061307c565b602060405180830381865afa158015610ddc573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e0091906135a7565b90505f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610e67576040517f756abb9a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f60045490505f6004819055507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401610ecf9291906136b8565b6020604051808303815f875af1158015610eeb573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f0f91906136f3565b507f2322a767e1914d2df0d776d643d2bfa5b7752ea9a452f75878d7bca357cb55ff81604051610f3f9190613113565b60405180910390a15050610f51611f09565b565b67058d15e17628000081565b610f67611f48565b610f705f611fcf565b565b5f610f7b611fff565b90508073ffffffffffffffffffffffffffffffffffffffff16610f9c611660565b73ffffffffffffffffffffffffffffffffffffffff1614610ff457806040517f118cdaa7000000000000000000000000000000000000000000000000000000008152600401610feb91906131af565b60405180910390fd5b610ffd81611fcf565b50565b5f60065f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2060020154905092915050565b7f000000000000000000000000000000000000000000000000000000000000000081565b5f60025f0160109054906101000a90046fffffffffffffffffffffffffffffffff16905090565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b81819050848490501461115a576040517f3aa788ff00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6111b18484808060200260200160405190810160405280939291908181526020018383602002808284375f81840152601f19601f820116905080830192505050505050508383906111ab9190613907565b33612006565b50505050565b60035481565b5f5f60035490505f60025f0160109054906101000a90046fffffffffffffffffffffffffffffffff1690505f820361120b57806fffffffffffffffffffffffffffffffff16925050506112ef565b5f7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161126591906131af565b602060405180830381865afa158015611280573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112a4919061392f565b9050828110156112e7578281846112bb919061395a565b836fffffffffffffffffffffffffffffffff166112d8919061398d565b6112e291906139fb565b6112e9565b5f5b93505050505b90565b6113008585858585886116ec565b5050505050565b60045481565b6002805f015f9054906101000a90046fffffffffffffffffffffffffffffffff1690805f0160109054906101000a90046fffffffffffffffffffffffffffffffff16905082565b5f60025f015f9054906101000a90046fffffffffffffffffffffffffffffffff16905090565b611382611f48565b67058d15e1762800006fffffffffffffffffffffffffffffffff16816fffffffffffffffffffffffffffffffff1611156113e8576040517faf9c21dc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f600290505f815f0160109054906101000a90046fffffffffffffffffffffffffffffffff16836114199190613675565b905067058d15e1762800006fffffffffffffffffffffffffffffffff16816fffffffffffffffffffffffffffffffff161115611481576040517faf9c21dc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f23c1335b4285bea37ccdc6223b0269c10c388464aad09ed312747fa9c3a8d8e3825f015f9054906101000a90046fffffffffffffffffffffffffffffffff16846040516114d092919061338d565b60405180910390a182825f015f6101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550505050565b61151e611f48565b5f600290505f826fffffffffffffffffffffffffffffffff16825f015f9054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff166115729190613642565b905067058d15e1762800006fffffffffffffffffffffffffffffffff168111156115c8576040517faf9c21dc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f9eff170752bff88fe482ef6885f2ea7d13c27a72a64aa0968e4e40e2092e2ffb825f0160109054906101000a90046fffffffffffffffffffffffffffffffff168460405161161892919061338d565b60405180910390a18260025f0160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550505050565b5f60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b5f60055f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f206001015f9054906101000a90046fffffffffffffffffffffffffffffffff169050919050565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166305de62c030335f357fffffffff00000000000000000000000000000000000000000000000000000000166040518463ffffffff1660e01b815260040161176c93929190613a2b565b602060405180830381865afa158015611787573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906117ab91906136f3565b6117e1576040517f9d5f36ba00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8383905014806117f757508585905083839050145b61182d576040517f3aa788ff00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f838390501461188f5761188e8686808060200260200160405190810160405280939291908181526020018383602002808284375f81840152601f19601f820116905080830192505050505050508484906118889190613907565b83612006565b5b61189b868686846128cd565b505050505050565b6b033b2e3c9fd0803ce800000081565b6118c084848484336118c6565b50505050565b5f8383905014806118dc57508484905083839050145b611912576040517f3aa788ff00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8383905014611974576119738585808060200260200160405190810160405280939291908181526020018383602002808284375f81840152601f19601f8201169050808301925050505050505084849061196d9190613907565b83612006565b5b611980858533846128cd565b5050505050565b61198f611f48565b8060015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff166119ee6110d0565b73ffffffffffffffffffffffffffffffffffffffff167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b5f60055f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f206002015f9054906101000a90046fffffffffffffffffffffffffffffffff169050919050565b5f60065f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f015f9054906101000a90046fffffffffffffffffffffffffffffffff16905092915050565b5f60055f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f01549050919050565b611b86611f48565b7fe0c1bb0346d4331d79481c0aa76684cafbd6cfbcf274379b35dd45c471fe8d0c60035482604051611bb9929190613a60565b60405180910390a18060038190555050565b611bd3612c4f565b15611c0a576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611c486001611c3a7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f005f1b612c88565b612c9190919063ffffffff16565b565b5f5f83850290505f5f19858709828110838203039150505f8103611c8257838281611c7857611c776139ce565b5b0492505050611d28565b808411611ca157611ca0611c9b5f861460126011612c98565b612cb1565b5b5f8486880990508281118203915080830392505f855f038616905080860495508084049350600181825f0304019050808302841793505f600287600302189050808702600203810290508087026002038102905080870260020381029050808702600203810290508087026002038102905080870260020381029050808502955050505050505b9392505050565b5f6fffffffffffffffffffffffffffffffff8016821115611d8a576080826040517f6dfcc650000000000000000000000000000000000000000000000000000000008152600401611d81929190613acc565b60405180910390fd5b819050919050565b5f60065f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2090505f815f015f9054906101000a90046fffffffffffffffffffffffffffffffff169050611e83816fffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce80000006fffffffffffffffffffffffffffffffff16846001015486611e74919061395a565b611c4a9092919063ffffffff16565b826002015f828254611e959190613642565b9250508190555083611eb2578481611ead9190613675565b611ebf565b8481611ebe91906135ff565b5b825f015f6101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555082826001018190555050505050505050565b611f465f611f387f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f005f1b612c88565b612c9190919063ffffffff16565b565b611f50611fff565b73ffffffffffffffffffffffffffffffffffffffff16611f6e6110d0565b73ffffffffffffffffffffffffffffffffffffffff1614611fcd57611f91611fff565b6040517f118cdaa7000000000000000000000000000000000000000000000000000000008152600401611fc491906131af565b60405180910390fd5b565b60015f6101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055611ffc81612cc2565b50565b5f33905090565b61200e611bcb565b5f7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16630595a6547f00000000000000000000000000000000000000000000000000000000000000006040518263ffffffff1660e01b8152600401612088919061307c565b602060405180830381865afa1580156120a3573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906120c791906135a7565b90505f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361212e576040517fb8fe968e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5f5f7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161218a91906131af565b602060405180830381865afa1580156121a5573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906121c9919061392f565b90505f6121d46111bd565b90505f5b885181101561271d575f8982815181106121f5576121f4613af3565b5b602002602001015190505f7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663a622ee7c836040518263ffffffff1660e01b815260040161225991906131af565b602060405180830381865afa158015612274573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061229891906135a7565b90505f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036122ff576040517fd03a632000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8873ffffffffffffffffffffffffffffffffffffffff16637399bfe8848d87815181106123305761232f613af3565b5b60200260200101516040518363ffffffff1660e01b8152600401612355929190613b80565b60408051808303815f875af1158015612370573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906123949190613c13565b90505f81602001516fffffffffffffffffffffffffffffffff16036123bb57505050612710565b80602001516fffffffffffffffffffffffffffffffff16876123dd9190613642565b96505f5f90505f825f01516fffffffffffffffffffffffffffffffff16111561247e5761246360025f015f9054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16670de0b6b3a7640000845f01516fffffffffffffffffffffffffffffffff16611c4a9092919063ffffffff16565b90508060045f8282546124769190613642565b925050819055505b5f6124b287670de0b6b3a764000085602001516fffffffffffffffffffffffffffffffff16611c4a9092919063ffffffff16565b9050808a6124c09190613642565b99505f60055f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2090505f828486602001516fffffffffffffffffffffffffffffffff16612526919061395a565b612530919061395a565b90505f8260020160109054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff169050808211156125fd575f818361257d919061395a565b90506125e36b033b2e3c9fd0803ce80000006fffffffffffffffffffffffffffffffff16856001015f9054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1683611c4a9092919063ffffffff16565b845f015f8282546125f49190613642565b92505081905550505b61260682611d2f565b8360020160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055505f8360010160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055505f836002015f6101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055508673ffffffffffffffffffffffffffffffffffffffff167fc9695243a805adb74c91f28311176c65b417e842d5699893cef56d18bfa48cba87602001516040516126ff9190613c6e565b60405180910390a250505050505050505b80806001019150506121d8565b505f830361272f5750505050506128c0565b8473ffffffffffffffffffffffffffffffffffffffff16636b9f96ea6040518163ffffffff1660e01b81526004015f604051808303815f87803b158015612774575f5ffd5b505af1158015612786573d5f5f3e3d5ffd5b5050505082826127969190613642565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016127ef91906131af565b602060405180830381865afa15801561280a573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061282e919061392f565b1015612866576040517fd053ec6000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8411156128ba576128b986857f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16612d839092919063ffffffff16565b5b50505050505b6128c8611f09565b505050565b6128d5611bcb565b5f5f5f5b86869050811015612bba577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663a622ee7c88888481811061293357612932613af3565b5b905060200201602081019061294891906133df565b6040518263ffffffff1660e01b815260040161296491906131af565b602060405180830381865afa15801561297f573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906129a391906135a7565b91505f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603612a0a576040517fd03a632000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f60065f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2090505f815f015f9054906101000a90046fffffffffffffffffffffffffffffffff1690505f816fffffffffffffffffffffffffffffffff16141580612acc57505f826002015414155b15612bab575f826001015490505f60055f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f0154905081811115612b84576b033b2e3c9fd0803ce80000006fffffffffffffffffffffffffffffffff16836fffffffffffffffffffffffffffffffff168383612b62919061395a565b612b6c919061398d565b612b7691906139fb565b87612b819190613642565b96505b836002015487612b949190613642565b96508084600101819055505f846002018190555050505b505080806001019150506128d9565b505f8203612bf4576040517fb71ea17e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612c3f83837f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16612d839092919063ffffffff16565b5050612c49611f09565b50505050565b5f612c83612c7e7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f005f1b612c88565b612e02565b905090565b5f819050919050565b80825d5050565b5f612ca284612e0c565b82841802821890509392505050565b634e487b715f52806020526024601cfd5b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b612dfd838473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8585604051602401612db69291906136b8565b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612e17565b505050565b5f815c9050919050565b5f8115159050919050565b5f5f60205f8451602086015f885af180612e36576040513d5f823e3d81fd5b3d92505f519150505f8214612e4f576001811415612e6a565b5f8473ffffffffffffffffffffffffffffffffffffffff163b145b15612eac57836040517f5274afe7000000000000000000000000000000000000000000000000000000008152600401612ea391906131af565b60405180910390fd5b50505050565b5f604051905090565b5f5ffd5b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f612eec82612ec3565b9050919050565b612efc81612ee2565b8114612f06575f5ffd5b50565b5f81359050612f1781612ef3565b92915050565b5f6fffffffffffffffffffffffffffffffff82169050919050565b612f4181612f1d565b8114612f4b575f5ffd5b50565b5f81359050612f5c81612f38565b92915050565b5f5ffd5b5f60408284031215612f7b57612f7a612f62565b5b81905092915050565b5f8115159050919050565b612f9881612f84565b8114612fa2575f5ffd5b50565b5f81359050612fb381612f8f565b92915050565b5f5f5f5f5f5f60e08789031215612fd357612fd2612ebb565b5b5f612fe089828a01612f09565b9650506020612ff189828a01612f09565b955050604061300289828a01612f09565b945050606061301389828a01612f4e565b935050608061302489828a01612f66565b92505060c061303589828a01612fa5565b9150509295509295509295565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b61307681613042565b82525050565b5f60208201905061308f5f83018461306d565b92915050565b61309e81612f1d565b82525050565b5f6020820190506130b75f830184613095565b92915050565b5f5f604083850312156130d3576130d2612ebb565b5b5f6130e085828601612f09565b92505060206130f185828601612f09565b9150509250929050565b5f819050919050565b61310d816130fb565b82525050565b5f6020820190506131265f830184613104565b92915050565b5f819050919050565b5f61314f61314a61314584612ec3565b61312c565b612ec3565b9050919050565b5f61316082613135565b9050919050565b5f61317182613156565b9050919050565b61318181613167565b82525050565b5f60208201905061319a5f830184613178565b92915050565b6131a981612ee2565b82525050565b5f6020820190506131c25f8301846131a0565b92915050565b5f5ffd5b5f5ffd5b5f5ffd5b5f5f83601f8401126131e9576131e86131c8565b5b8235905067ffffffffffffffff811115613206576132056131cc565b5b602083019150836020820283011115613222576132216131d0565b5b9250929050565b5f5f83601f84011261323e5761323d6131c8565b5b8235905067ffffffffffffffff81111561325b5761325a6131cc565b5b602083019150836020820283011115613277576132766131d0565b5b9250929050565b5f5f5f5f6040858703121561329657613295612ebb565b5b5f85013567ffffffffffffffff8111156132b3576132b2612ebf565b5b6132bf878288016131d4565b9450945050602085013567ffffffffffffffff8111156132e2576132e1612ebf565b5b6132ee87828801613229565b925092505092959194509250565b5f5f5f5f5f6060868803121561331557613314612ebb565b5b5f86013567ffffffffffffffff81111561333257613331612ebf565b5b61333e888289016131d4565b9550955050602061335188828901612f09565b935050604086013567ffffffffffffffff81111561337257613371612ebf565b5b61337e88828901613229565b92509250509295509295909350565b5f6040820190506133a05f830185613095565b6133ad6020830184613095565b9392505050565b5f602082840312156133c9576133c8612ebb565b5b5f6133d684828501612f4e565b91505092915050565b5f602082840312156133f4576133f3612ebb565b5b5f61340184828501612f09565b91505092915050565b5f5f5f5f5f5f6080878903121561342457613423612ebb565b5b5f87013567ffffffffffffffff81111561344157613440612ebf565b5b61344d89828a016131d4565b9650965050602061346089828a01612f09565b945050604087013567ffffffffffffffff81111561348157613480612ebf565b5b61348d89828a01613229565b935093505060606134a089828a01612f09565b9150509295509295509295565b5f5f5f5f5f606086880312156134c6576134c5612ebb565b5b5f86013567ffffffffffffffff8111156134e3576134e2612ebf565b5b6134ef888289016131d4565b9550955050602086013567ffffffffffffffff81111561351257613511612ebf565b5b61351e88828901613229565b9350935050604061353188828901612f09565b9150509295509295909350565b613547816130fb565b8114613551575f5ffd5b50565b5f813590506135628161353e565b92915050565b5f6020828403121561357d5761357c612ebb565b5b5f61358a84828501613554565b91505092915050565b5f815190506135a181612ef3565b92915050565b5f602082840312156135bc576135bb612ebb565b5b5f6135c984828501613593565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61360982612f1d565b915061361483612f1d565b925082820390506fffffffffffffffffffffffffffffffff81111561363c5761363b6135d2565b5b92915050565b5f61364c826130fb565b9150613657836130fb565b925082820190508082111561366f5761366e6135d2565b5b92915050565b5f61367f82612f1d565b915061368a83612f1d565b925082820190506fffffffffffffffffffffffffffffffff8111156136b2576136b16135d2565b5b92915050565b5f6040820190506136cb5f8301856131a0565b6136d86020830184613104565b9392505050565b5f815190506136ed81612f8f565b92915050565b5f6020828403121561370857613707612ebb565b5b5f613715848285016136df565b91505092915050565b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6137648261371e565b810181811067ffffffffffffffff821117156137835761378261372e565b5b80604052505050565b5f613795612eb2565b90506137a1828261375b565b919050565b5f67ffffffffffffffff8211156137c0576137bf61372e565b5b602082029050602081019050919050565b5f5ffd5b5f67ffffffffffffffff8211156137ef576137ee61372e565b5b6137f88261371e565b9050602081019050919050565b828183375f83830152505050565b5f613825613820846137d5565b61378c565b905082815260208101848484011115613841576138406137d1565b5b61384c848285613805565b509392505050565b5f82601f830112613868576138676131c8565b5b8135613878848260208601613813565b91505092915050565b5f61389361388e846137a6565b61378c565b905080838252602082019050602084028301858111156138b6576138b56131d0565b5b835b818110156138fd57803567ffffffffffffffff8111156138db576138da6131c8565b5b8086016138e88982613854565b855260208501945050506020810190506138b8565b5050509392505050565b5f613913368484613881565b905092915050565b5f815190506139298161353e565b92915050565b5f6020828403121561394457613943612ebb565b5b5f6139518482850161391b565b91505092915050565b5f613964826130fb565b915061396f836130fb565b9250828203905081811115613987576139866135d2565b5b92915050565b5f613997826130fb565b91506139a2836130fb565b92508282026139b0816130fb565b915082820484148315176139c7576139c66135d2565b5b5092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f613a05826130fb565b9150613a10836130fb565b925082613a2057613a1f6139ce565b5b828204905092915050565b5f606082019050613a3e5f8301866131a0565b613a4b60208301856131a0565b613a58604083018461306d565b949350505050565b5f604082019050613a735f830185613104565b613a806020830184613104565b9392505050565b5f819050919050565b5f60ff82169050919050565b5f613ab6613ab1613aac84613a87565b61312c565b613a90565b9050919050565b613ac681613a9c565b82525050565b5f604082019050613adf5f830185613abd565b613aec6020830184613104565b9392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f613b5282613b20565b613b5c8185613b2a565b9350613b6c818560208601613b3a565b613b758161371e565b840191505092915050565b5f604082019050613b935f8301856131a0565b8181036020830152613ba58184613b48565b90509392505050565b5f5ffd5b5f81519050613bc081612f38565b92915050565b5f60408284031215613bdb57613bda613bae565b5b613be5604061378c565b90505f613bf484828501613bb2565b5f830152506020613c0784828501613bb2565b60208301525092915050565b5f60408284031215613c2857613c27612ebb565b5b5f613c3584828501613bc6565b91505092915050565b5f613c58613c53613c4e84612f1d565b61312c565b6130fb565b9050919050565b613c6881613c3e565b82525050565b5f602082019050613c815f830184613c5f565b9291505056fea26469706673582212208936843b1ba013a1ee4657766c94f9785828f12c0816b99646662594b9981ee964736f6c634300081c0033000000000000000000000000f1c9775ef36e1f633c362e3011589ac9781ab0ff000000000000000000000000b3723688250caa0413e9c2c47123aa24dd0265d0000000000000000000000000d533a949740bb3306d119cc777fa900ba034cd52c715e37300000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x608060405234801561000f575f5ffd5b50600436106101f9575f3560e01c8063af5db8c511610118578063e84f9836116100ab578063f2fde38b1161007a578063f2fde38b1461051e578063f6ed20171461053a578063f7888aec1461056a578063fc0e7be41461059a578063fe5966c5146105ca576101f9565b8063e84f9836146104ac578063ef4cadc5146104c8578063ef933df0146104e6578063f0a2351114610502576101f9565b8063d6e22a43116100e7578063d6e22a4314610426578063e0b735d514610442578063e30c39781461045e578063e4dc2aa41461047c576101f9565b8063af5db8c5146103af578063b621e75a146103cb578063bc7e75ba146103e9578063cd3f29e914610408576101f9565b80637a27db571161019057806399248ea71161015f57806399248ea7146103395780639a06d976146103575780639fe95cd914610373578063af2bf4cd14610391576101f9565b80637a27db57146102af5780637aaf53e6146102df57806389acf147146102fd5780638da5cb5b1461031b576101f9565b80634a7d0369116101cc5780634a7d03691461027357806367d817401461027d578063715018a61461029b57806379ba5097146102a5576101f9565b8063064428dc146101fd5780630db41f3114610219578063235d20351461023757806337e08bcd14610255575b5f5ffd5b61021760048036038101906102129190612fb9565b6105e6565b005b610221610cbe565b60405161022e919061307c565b60405180910390f35b61023f610ce2565b60405161024c91906130a4565b60405180910390f35b61025d610d33565b60405161026a91906130a4565b60405180910390f35b61027b610d3f565b005b610285610f53565b60405161029291906130a4565b60405180910390f35b6102a3610f5f565b005b6102ad610f72565b005b6102c960048036038101906102c491906130bd565b611000565b6040516102d69190613113565b60405180910390f35b6102e7611085565b6040516102f49190613187565b60405180910390f35b6103056110a9565b60405161031291906130a4565b60405180910390f35b6103236110d0565b60405161033091906131af565b60405180910390f35b6103416110f7565b60405161034e91906131af565b60405180910390f35b610371600480360381019061036c919061327e565b61111b565b005b61037b6111b7565b6040516103889190613113565b60405180910390f35b6103996111bd565b6040516103a69190613113565b60405180910390f35b6103c960048036038101906103c491906132fc565b6112f2565b005b6103d3611307565b6040516103e09190613113565b60405180910390f35b6103f161130d565b6040516103ff92919061338d565b60405180910390f35b610410611354565b60405161041d91906130a4565b60405180910390f35b610440600480360381019061043b91906133b4565b61137a565b005b61045c600480360381019061045791906133b4565b611516565b005b610466611660565b60405161047391906131af565b60405180910390f35b610496600480360381019061049191906133df565b611688565b6040516104a391906130a4565b60405180910390f35b6104c660048036038101906104c1919061340a565b6116ec565b005b6104d06118a3565b6040516104dd91906130a4565b60405180910390f35b61050060048036038101906104fb919061327e565b6118b3565b005b61051c600480360381019061051791906134ad565b6118c6565b005b610538600480360381019061053391906133df565b611987565b005b610554600480360381019061054f91906133df565b611a33565b60405161056191906130a4565b60405180910390f35b610584600480360381019061057f91906130bd565b611a97565b60405161059191906130a4565b60405180910390f35b6105b460048036038101906105af91906133df565b611b36565b6040516105c19190613113565b60405180910390f35b6105e460048036038101906105df9190613568565b611b7e565b005b6105ee611bcb565b3373ffffffffffffffffffffffffffffffffffffffff167f000000000000000000000000b3723688250caa0413e9c2c47123aa24dd0265d073ffffffffffffffffffffffffffffffffffffffff1663a622ee7c886040518263ffffffff1660e01b815260040161065e91906131af565b602060405180830381865afa158015610679573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061069d91906135a7565b73ffffffffffffffffffffffffffffffffffffffff16146106ea576040517f8d1af8bd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f60055f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2090505f816001015f9054906101000a90046fffffffffffffffffffffffffffffffff1690505f825f015490505f85602001602081019061076891906133b4565b6fffffffffffffffffffffffffffffffff1611801561079857505f826fffffffffffffffffffffffffffffffff16115b15610bc0575f836002015f9054906101000a90046fffffffffffffffffffffffffffffffff168660200160208101906107d191906133b4565b6107db91906135ff565b90505f8460010160109054906101000a90046fffffffffffffffffffffffffffffffff16875f01602081019061081191906133b4565b61081b91906135ff565b90505f86801561083c57505f836fffffffffffffffffffffffffffffffff16115b1561094c575f826fffffffffffffffffffffffffffffffff1611156108d8576108ab6108a6610869611354565b6fffffffffffffffffffffffffffffffff16670de0b6b3a7640000856fffffffffffffffffffffffffffffffff16611c4a9092919063ffffffff16565b611d2f565b9050806fffffffffffffffffffffffffffffffff1660045f8282546108d09190613642565b925050819055505b61093a6b033b2e3c9fd0803ce80000006fffffffffffffffffffffffffffffffff16866fffffffffffffffffffffffffffffffff16838661091991906135ff565b6fffffffffffffffffffffffffffffffff16611c4a9092919063ffffffff16565b846109459190613642565b9350610bbc565b670de0b6b3a76400006fffffffffffffffffffffffffffffffff16836fffffffffffffffffffffffffffffffff1610610bbb575f826fffffffffffffffffffffffffffffffff1611156109ec576109e96109e46109a7611354565b6fffffffffffffffffffffffffffffffff16670de0b6b3a7640000856fffffffffffffffffffffffffffffffff16611c4a9092919063ffffffff16565b611d2f565b90505b610a3c610a376109fa6110a9565b6fffffffffffffffffffffffffffffffff16670de0b6b3a7640000866fffffffffffffffffffffffffffffffff16611c4a9092919063ffffffff16565b611d2f565b81610a479190613675565b90505f8184610a5691906135ff565b9050610aaf6b033b2e3c9fd0803ce80000006fffffffffffffffffffffffffffffffff16876fffffffffffffffffffffffffffffffff16836fffffffffffffffffffffffffffffffff16611c4a9092919063ffffffff16565b85610aba9190613642565b9450808760020160108282829054906101000a90046fffffffffffffffffffffffffffffffff16610aeb9190613675565b92506101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550886020016020810190610b3491906133b4565b876002015f6101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550885f016020810190610b7f91906133b4565b8760010160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550505b5b5050505b5f73ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff1603610c06578582610bff9190613675565b9150610c15565b610c14338988600185611d92565b5b5f73ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff1603610c5b578582610c5491906135ff565b9150610c69565b610c683388885f85611d92565b5b80835f018190555081836001015f6101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550505050610cb6611f09565b505050505050565b7fc715e3730000000000000000000000000000000000000000000000000000000081565b5f60025f0160109054906101000a90046fffffffffffffffffffffffffffffffff1660025f015f9054906101000a90046fffffffffffffffffffffffffffffffff16610d2e9190613675565b905090565b670de0b6b3a764000081565b610d47611bcb565b5f7f000000000000000000000000b3723688250caa0413e9c2c47123aa24dd0265d073ffffffffffffffffffffffffffffffffffffffff166309f142727fc715e373000000000000000000000000000000000000000000000000000000006040518263ffffffff1660e01b8152600401610dc1919061307c565b602060405180830381865afa158015610ddc573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e0091906135a7565b90505f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610e67576040517f756abb9a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f60045490505f6004819055507f000000000000000000000000d533a949740bb3306d119cc777fa900ba034cd5273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401610ecf9291906136b8565b6020604051808303815f875af1158015610eeb573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f0f91906136f3565b507f2322a767e1914d2df0d776d643d2bfa5b7752ea9a452f75878d7bca357cb55ff81604051610f3f9190613113565b60405180910390a15050610f51611f09565b565b67058d15e17628000081565b610f67611f48565b610f705f611fcf565b565b5f610f7b611fff565b90508073ffffffffffffffffffffffffffffffffffffffff16610f9c611660565b73ffffffffffffffffffffffffffffffffffffffff1614610ff457806040517f118cdaa7000000000000000000000000000000000000000000000000000000008152600401610feb91906131af565b60405180910390fd5b610ffd81611fcf565b50565b5f60065f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2060020154905092915050565b7f000000000000000000000000b3723688250caa0413e9c2c47123aa24dd0265d081565b5f60025f0160109054906101000a90046fffffffffffffffffffffffffffffffff16905090565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b7f000000000000000000000000d533a949740bb3306d119cc777fa900ba034cd5281565b81819050848490501461115a576040517f3aa788ff00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6111b18484808060200260200160405190810160405280939291908181526020018383602002808284375f81840152601f19601f820116905080830192505050505050508383906111ab9190613907565b33612006565b50505050565b60035481565b5f5f60035490505f60025f0160109054906101000a90046fffffffffffffffffffffffffffffffff1690505f820361120b57806fffffffffffffffffffffffffffffffff16925050506112ef565b5f7f000000000000000000000000d533a949740bb3306d119cc777fa900ba034cd5273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161126591906131af565b602060405180830381865afa158015611280573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112a4919061392f565b9050828110156112e7578281846112bb919061395a565b836fffffffffffffffffffffffffffffffff166112d8919061398d565b6112e291906139fb565b6112e9565b5f5b93505050505b90565b6113008585858585886116ec565b5050505050565b60045481565b6002805f015f9054906101000a90046fffffffffffffffffffffffffffffffff1690805f0160109054906101000a90046fffffffffffffffffffffffffffffffff16905082565b5f60025f015f9054906101000a90046fffffffffffffffffffffffffffffffff16905090565b611382611f48565b67058d15e1762800006fffffffffffffffffffffffffffffffff16816fffffffffffffffffffffffffffffffff1611156113e8576040517faf9c21dc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f600290505f815f0160109054906101000a90046fffffffffffffffffffffffffffffffff16836114199190613675565b905067058d15e1762800006fffffffffffffffffffffffffffffffff16816fffffffffffffffffffffffffffffffff161115611481576040517faf9c21dc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f23c1335b4285bea37ccdc6223b0269c10c388464aad09ed312747fa9c3a8d8e3825f015f9054906101000a90046fffffffffffffffffffffffffffffffff16846040516114d092919061338d565b60405180910390a182825f015f6101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550505050565b61151e611f48565b5f600290505f826fffffffffffffffffffffffffffffffff16825f015f9054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff166115729190613642565b905067058d15e1762800006fffffffffffffffffffffffffffffffff168111156115c8576040517faf9c21dc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f9eff170752bff88fe482ef6885f2ea7d13c27a72a64aa0968e4e40e2092e2ffb825f0160109054906101000a90046fffffffffffffffffffffffffffffffff168460405161161892919061338d565b60405180910390a18260025f0160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550505050565b5f60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b5f60055f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f206001015f9054906101000a90046fffffffffffffffffffffffffffffffff169050919050565b7f000000000000000000000000b3723688250caa0413e9c2c47123aa24dd0265d073ffffffffffffffffffffffffffffffffffffffff166305de62c030335f357fffffffff00000000000000000000000000000000000000000000000000000000166040518463ffffffff1660e01b815260040161176c93929190613a2b565b602060405180830381865afa158015611787573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906117ab91906136f3565b6117e1576040517f9d5f36ba00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8383905014806117f757508585905083839050145b61182d576040517f3aa788ff00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f838390501461188f5761188e8686808060200260200160405190810160405280939291908181526020018383602002808284375f81840152601f19601f820116905080830192505050505050508484906118889190613907565b83612006565b5b61189b868686846128cd565b505050505050565b6b033b2e3c9fd0803ce800000081565b6118c084848484336118c6565b50505050565b5f8383905014806118dc57508484905083839050145b611912576040517f3aa788ff00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8383905014611974576119738585808060200260200160405190810160405280939291908181526020018383602002808284375f81840152601f19601f8201169050808301925050505050505084849061196d9190613907565b83612006565b5b611980858533846128cd565b5050505050565b61198f611f48565b8060015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff166119ee6110d0565b73ffffffffffffffffffffffffffffffffffffffff167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b5f60055f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f206002015f9054906101000a90046fffffffffffffffffffffffffffffffff169050919050565b5f60065f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f015f9054906101000a90046fffffffffffffffffffffffffffffffff16905092915050565b5f60055f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f01549050919050565b611b86611f48565b7fe0c1bb0346d4331d79481c0aa76684cafbd6cfbcf274379b35dd45c471fe8d0c60035482604051611bb9929190613a60565b60405180910390a18060038190555050565b611bd3612c4f565b15611c0a576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611c486001611c3a7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f005f1b612c88565b612c9190919063ffffffff16565b565b5f5f83850290505f5f19858709828110838203039150505f8103611c8257838281611c7857611c776139ce565b5b0492505050611d28565b808411611ca157611ca0611c9b5f861460126011612c98565b612cb1565b5b5f8486880990508281118203915080830392505f855f038616905080860495508084049350600181825f0304019050808302841793505f600287600302189050808702600203810290508087026002038102905080870260020381029050808702600203810290508087026002038102905080870260020381029050808502955050505050505b9392505050565b5f6fffffffffffffffffffffffffffffffff8016821115611d8a576080826040517f6dfcc650000000000000000000000000000000000000000000000000000000008152600401611d81929190613acc565b60405180910390fd5b819050919050565b5f60065f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2090505f815f015f9054906101000a90046fffffffffffffffffffffffffffffffff169050611e83816fffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce80000006fffffffffffffffffffffffffffffffff16846001015486611e74919061395a565b611c4a9092919063ffffffff16565b826002015f828254611e959190613642565b9250508190555083611eb2578481611ead9190613675565b611ebf565b8481611ebe91906135ff565b5b825f015f6101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555082826001018190555050505050505050565b611f465f611f387f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f005f1b612c88565b612c9190919063ffffffff16565b565b611f50611fff565b73ffffffffffffffffffffffffffffffffffffffff16611f6e6110d0565b73ffffffffffffffffffffffffffffffffffffffff1614611fcd57611f91611fff565b6040517f118cdaa7000000000000000000000000000000000000000000000000000000008152600401611fc491906131af565b60405180910390fd5b565b60015f6101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055611ffc81612cc2565b50565b5f33905090565b61200e611bcb565b5f7f000000000000000000000000b3723688250caa0413e9c2c47123aa24dd0265d073ffffffffffffffffffffffffffffffffffffffff16630595a6547fc715e373000000000000000000000000000000000000000000000000000000006040518263ffffffff1660e01b8152600401612088919061307c565b602060405180830381865afa1580156120a3573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906120c791906135a7565b90505f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361212e576040517fb8fe968e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5f5f7f000000000000000000000000d533a949740bb3306d119cc777fa900ba034cd5273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161218a91906131af565b602060405180830381865afa1580156121a5573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906121c9919061392f565b90505f6121d46111bd565b90505f5b885181101561271d575f8982815181106121f5576121f4613af3565b5b602002602001015190505f7f000000000000000000000000b3723688250caa0413e9c2c47123aa24dd0265d073ffffffffffffffffffffffffffffffffffffffff1663a622ee7c836040518263ffffffff1660e01b815260040161225991906131af565b602060405180830381865afa158015612274573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061229891906135a7565b90505f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036122ff576040517fd03a632000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8873ffffffffffffffffffffffffffffffffffffffff16637399bfe8848d87815181106123305761232f613af3565b5b60200260200101516040518363ffffffff1660e01b8152600401612355929190613b80565b60408051808303815f875af1158015612370573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906123949190613c13565b90505f81602001516fffffffffffffffffffffffffffffffff16036123bb57505050612710565b80602001516fffffffffffffffffffffffffffffffff16876123dd9190613642565b96505f5f90505f825f01516fffffffffffffffffffffffffffffffff16111561247e5761246360025f015f9054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16670de0b6b3a7640000845f01516fffffffffffffffffffffffffffffffff16611c4a9092919063ffffffff16565b90508060045f8282546124769190613642565b925050819055505b5f6124b287670de0b6b3a764000085602001516fffffffffffffffffffffffffffffffff16611c4a9092919063ffffffff16565b9050808a6124c09190613642565b99505f60055f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2090505f828486602001516fffffffffffffffffffffffffffffffff16612526919061395a565b612530919061395a565b90505f8260020160109054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff169050808211156125fd575f818361257d919061395a565b90506125e36b033b2e3c9fd0803ce80000006fffffffffffffffffffffffffffffffff16856001015f9054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1683611c4a9092919063ffffffff16565b845f015f8282546125f49190613642565b92505081905550505b61260682611d2f565b8360020160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055505f8360010160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055505f836002015f6101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055508673ffffffffffffffffffffffffffffffffffffffff167fc9695243a805adb74c91f28311176c65b417e842d5699893cef56d18bfa48cba87602001516040516126ff9190613c6e565b60405180910390a250505050505050505b80806001019150506121d8565b505f830361272f5750505050506128c0565b8473ffffffffffffffffffffffffffffffffffffffff16636b9f96ea6040518163ffffffff1660e01b81526004015f604051808303815f87803b158015612774575f5ffd5b505af1158015612786573d5f5f3e3d5ffd5b5050505082826127969190613642565b7f000000000000000000000000d533a949740bb3306d119cc777fa900ba034cd5273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016127ef91906131af565b602060405180830381865afa15801561280a573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061282e919061392f565b1015612866576040517fd053ec6000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8411156128ba576128b986857f000000000000000000000000d533a949740bb3306d119cc777fa900ba034cd5273ffffffffffffffffffffffffffffffffffffffff16612d839092919063ffffffff16565b5b50505050505b6128c8611f09565b505050565b6128d5611bcb565b5f5f5f5b86869050811015612bba577f000000000000000000000000b3723688250caa0413e9c2c47123aa24dd0265d073ffffffffffffffffffffffffffffffffffffffff1663a622ee7c88888481811061293357612932613af3565b5b905060200201602081019061294891906133df565b6040518263ffffffff1660e01b815260040161296491906131af565b602060405180830381865afa15801561297f573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906129a391906135a7565b91505f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603612a0a576040517fd03a632000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f60065f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2090505f815f015f9054906101000a90046fffffffffffffffffffffffffffffffff1690505f816fffffffffffffffffffffffffffffffff16141580612acc57505f826002015414155b15612bab575f826001015490505f60055f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f0154905081811115612b84576b033b2e3c9fd0803ce80000006fffffffffffffffffffffffffffffffff16836fffffffffffffffffffffffffffffffff168383612b62919061395a565b612b6c919061398d565b612b7691906139fb565b87612b819190613642565b96505b836002015487612b949190613642565b96508084600101819055505f846002018190555050505b505080806001019150506128d9565b505f8203612bf4576040517fb71ea17e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612c3f83837f000000000000000000000000d533a949740bb3306d119cc777fa900ba034cd5273ffffffffffffffffffffffffffffffffffffffff16612d839092919063ffffffff16565b5050612c49611f09565b50505050565b5f612c83612c7e7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f005f1b612c88565b612e02565b905090565b5f819050919050565b80825d5050565b5f612ca284612e0c565b82841802821890509392505050565b634e487b715f52806020526024601cfd5b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b612dfd838473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8585604051602401612db69291906136b8565b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612e17565b505050565b5f815c9050919050565b5f8115159050919050565b5f5f60205f8451602086015f885af180612e36576040513d5f823e3d81fd5b3d92505f519150505f8214612e4f576001811415612e6a565b5f8473ffffffffffffffffffffffffffffffffffffffff163b145b15612eac57836040517f5274afe7000000000000000000000000000000000000000000000000000000008152600401612ea391906131af565b60405180910390fd5b50505050565b5f604051905090565b5f5ffd5b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f612eec82612ec3565b9050919050565b612efc81612ee2565b8114612f06575f5ffd5b50565b5f81359050612f1781612ef3565b92915050565b5f6fffffffffffffffffffffffffffffffff82169050919050565b612f4181612f1d565b8114612f4b575f5ffd5b50565b5f81359050612f5c81612f38565b92915050565b5f5ffd5b5f60408284031215612f7b57612f7a612f62565b5b81905092915050565b5f8115159050919050565b612f9881612f84565b8114612fa2575f5ffd5b50565b5f81359050612fb381612f8f565b92915050565b5f5f5f5f5f5f60e08789031215612fd357612fd2612ebb565b5b5f612fe089828a01612f09565b9650506020612ff189828a01612f09565b955050604061300289828a01612f09565b945050606061301389828a01612f4e565b935050608061302489828a01612f66565b92505060c061303589828a01612fa5565b9150509295509295509295565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b61307681613042565b82525050565b5f60208201905061308f5f83018461306d565b92915050565b61309e81612f1d565b82525050565b5f6020820190506130b75f830184613095565b92915050565b5f5f604083850312156130d3576130d2612ebb565b5b5f6130e085828601612f09565b92505060206130f185828601612f09565b9150509250929050565b5f819050919050565b61310d816130fb565b82525050565b5f6020820190506131265f830184613104565b92915050565b5f819050919050565b5f61314f61314a61314584612ec3565b61312c565b612ec3565b9050919050565b5f61316082613135565b9050919050565b5f61317182613156565b9050919050565b61318181613167565b82525050565b5f60208201905061319a5f830184613178565b92915050565b6131a981612ee2565b82525050565b5f6020820190506131c25f8301846131a0565b92915050565b5f5ffd5b5f5ffd5b5f5ffd5b5f5f83601f8401126131e9576131e86131c8565b5b8235905067ffffffffffffffff811115613206576132056131cc565b5b602083019150836020820283011115613222576132216131d0565b5b9250929050565b5f5f83601f84011261323e5761323d6131c8565b5b8235905067ffffffffffffffff81111561325b5761325a6131cc565b5b602083019150836020820283011115613277576132766131d0565b5b9250929050565b5f5f5f5f6040858703121561329657613295612ebb565b5b5f85013567ffffffffffffffff8111156132b3576132b2612ebf565b5b6132bf878288016131d4565b9450945050602085013567ffffffffffffffff8111156132e2576132e1612ebf565b5b6132ee87828801613229565b925092505092959194509250565b5f5f5f5f5f6060868803121561331557613314612ebb565b5b5f86013567ffffffffffffffff81111561333257613331612ebf565b5b61333e888289016131d4565b9550955050602061335188828901612f09565b935050604086013567ffffffffffffffff81111561337257613371612ebf565b5b61337e88828901613229565b92509250509295509295909350565b5f6040820190506133a05f830185613095565b6133ad6020830184613095565b9392505050565b5f602082840312156133c9576133c8612ebb565b5b5f6133d684828501612f4e565b91505092915050565b5f602082840312156133f4576133f3612ebb565b5b5f61340184828501612f09565b91505092915050565b5f5f5f5f5f5f6080878903121561342457613423612ebb565b5b5f87013567ffffffffffffffff81111561344157613440612ebf565b5b61344d89828a016131d4565b9650965050602061346089828a01612f09565b945050604087013567ffffffffffffffff81111561348157613480612ebf565b5b61348d89828a01613229565b935093505060606134a089828a01612f09565b9150509295509295509295565b5f5f5f5f5f606086880312156134c6576134c5612ebb565b5b5f86013567ffffffffffffffff8111156134e3576134e2612ebf565b5b6134ef888289016131d4565b9550955050602086013567ffffffffffffffff81111561351257613511612ebf565b5b61351e88828901613229565b9350935050604061353188828901612f09565b9150509295509295909350565b613547816130fb565b8114613551575f5ffd5b50565b5f813590506135628161353e565b92915050565b5f6020828403121561357d5761357c612ebb565b5b5f61358a84828501613554565b91505092915050565b5f815190506135a181612ef3565b92915050565b5f602082840312156135bc576135bb612ebb565b5b5f6135c984828501613593565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61360982612f1d565b915061361483612f1d565b925082820390506fffffffffffffffffffffffffffffffff81111561363c5761363b6135d2565b5b92915050565b5f61364c826130fb565b9150613657836130fb565b925082820190508082111561366f5761366e6135d2565b5b92915050565b5f61367f82612f1d565b915061368a83612f1d565b925082820190506fffffffffffffffffffffffffffffffff8111156136b2576136b16135d2565b5b92915050565b5f6040820190506136cb5f8301856131a0565b6136d86020830184613104565b9392505050565b5f815190506136ed81612f8f565b92915050565b5f6020828403121561370857613707612ebb565b5b5f613715848285016136df565b91505092915050565b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6137648261371e565b810181811067ffffffffffffffff821117156137835761378261372e565b5b80604052505050565b5f613795612eb2565b90506137a1828261375b565b919050565b5f67ffffffffffffffff8211156137c0576137bf61372e565b5b602082029050602081019050919050565b5f5ffd5b5f67ffffffffffffffff8211156137ef576137ee61372e565b5b6137f88261371e565b9050602081019050919050565b828183375f83830152505050565b5f613825613820846137d5565b61378c565b905082815260208101848484011115613841576138406137d1565b5b61384c848285613805565b509392505050565b5f82601f830112613868576138676131c8565b5b8135613878848260208601613813565b91505092915050565b5f61389361388e846137a6565b61378c565b905080838252602082019050602084028301858111156138b6576138b56131d0565b5b835b818110156138fd57803567ffffffffffffffff8111156138db576138da6131c8565b5b8086016138e88982613854565b855260208501945050506020810190506138b8565b5050509392505050565b5f613913368484613881565b905092915050565b5f815190506139298161353e565b92915050565b5f6020828403121561394457613943612ebb565b5b5f6139518482850161391b565b91505092915050565b5f613964826130fb565b915061396f836130fb565b9250828203905081811115613987576139866135d2565b5b92915050565b5f613997826130fb565b91506139a2836130fb565b92508282026139b0816130fb565b915082820484148315176139c7576139c66135d2565b5b5092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f613a05826130fb565b9150613a10836130fb565b925082613a2057613a1f6139ce565b5b828204905092915050565b5f606082019050613a3e5f8301866131a0565b613a4b60208301856131a0565b613a58604083018461306d565b949350505050565b5f604082019050613a735f830185613104565b613a806020830184613104565b9392505050565b5f819050919050565b5f60ff82169050919050565b5f613ab6613ab1613aac84613a87565b61312c565b613a90565b9050919050565b613ac681613a9c565b82525050565b5f604082019050613adf5f830185613abd565b613aec6020830184613104565b9392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f613b5282613b20565b613b5c8185613b2a565b9350613b6c818560208601613b3a565b613b758161371e565b840191505092915050565b5f604082019050613b935f8301856131a0565b8181036020830152613ba58184613b48565b90509392505050565b5f5ffd5b5f81519050613bc081612f38565b92915050565b5f60408284031215613bdb57613bda613bae565b5b613be5604061378c565b90505f613bf484828501613bb2565b5f830152506020613c0784828501613bb2565b60208301525092915050565b5f60408284031215613c2857613c27612ebb565b5b5f613c3584828501613bc6565b91505092915050565b5f613c58613c53613c4e84612f1d565b61312c565b6130fb565b9050919050565b613c6881613c3e565b82525050565b5f602082019050613c815f830184613c5f565b9291505056fea26469706673582212208936843b1ba013a1ee4657766c94f9785828f12c0816b99646662594b9981ee964736f6c634300081c0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000f1c9775ef36e1f633c362e3011589ac9781ab0ff000000000000000000000000b3723688250caa0413e9c2c47123aa24dd0265d0000000000000000000000000d533a949740bb3306d119cc777fa900ba034cd52c715e37300000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _owner (address): 0xf1C9775ef36e1F633c362e3011589AC9781AB0ff
Arg [1] : _registry (address): 0xb3723688250cAa0413e9C2c47123aA24Dd0265d0
Arg [2] : _rewardToken (address): 0xD533a949740bb3306d119CC777fa900bA034cd52
Arg [3] : _protocolId (bytes4): 0xc715e373
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000f1c9775ef36e1f633c362e3011589ac9781ab0ff
Arg [1] : 000000000000000000000000b3723688250caa0413e9c2c47123aa24dd0265d0
Arg [2] : 000000000000000000000000d533a949740bb3306d119cc777fa900ba034cd52
Arg [3] : c715e37300000000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.