Source Code
Overview
S Balance
S Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
CVault
Compiler Version
v0.8.28+commit.7893614a
Optimization Enabled:
Yes with 200 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
import {VaultBase, IVault} from "../base/VaultBase.sol";
import {VaultTypeLib} from "../libs/VaultTypeLib.sol";
import {CommonLib} from "../libs/CommonLib.sol";
import {IControllable} from "../../interfaces/IControllable.sol";
/// @notice Tokenized 100% auto compounding vault with a single underlying liquidity mining position.
/// @dev This vault implementation contract is used by VaultProxy instances deployed by the Factory.
/// @author Alien Deployer (https://github.com/a17)
/// @author Jude (https://github.com/iammrjude)
/// @author JodsMigel (https://github.com/JodsMigel)
contract CVault is VaultBase {
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CONSTANTS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @inheritdoc IControllable
string public constant VERSION = "1.5.0";
uint internal constant _UNIQUE_INIT_ADDRESSES = 1;
uint internal constant _UNIQUE_INIT_NUMS = 0;
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* INITIALIZATION */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @inheritdoc IVault
function initialize(VaultInitializationData memory vaultInitializationData) public initializer {
__VaultBase_init(
vaultInitializationData.platform,
VaultTypeLib.COMPOUNDING,
vaultInitializationData.strategy,
vaultInitializationData.name,
vaultInitializationData.symbol,
vaultInitializationData.tokenId
);
if (vaultInitializationData.vaultInitAddresses.length != 0 || vaultInitializationData.vaultInitNums.length != 0)
{
revert IControllable.IncorrectInitParams();
}
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* VIEW FUNCTIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @inheritdoc IVault
function extra() external pure returns (bytes32) {
return CommonLib.bytesToBytes32(abi.encodePacked(bytes3(0x00bb99), bytes3(0x00110a)));
}
/// @inheritdoc IVault
function getUniqueInitParamLength() public pure override returns (uint uniqueInitAddresses, uint uniqueInitNums) {
return (_UNIQUE_INIT_ADDRESSES, _UNIQUE_INIT_NUMS);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
import {ERC20Upgradeable, IERC20} from "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";
import {Controllable, IControllable} from "./Controllable.sol";
import {ConstantsLib} from "../libs/ConstantsLib.sol";
import {VaultStatusLib} from "../libs/VaultStatusLib.sol";
import {VaultBaseLib} from "../libs/VaultBaseLib.sol";
import {IVault} from "../../interfaces/IVault.sol";
import {IStrategy} from "../../interfaces/IStrategy.sol";
import {IPriceReader} from "../../interfaces/IPriceReader.sol";
import {IPlatform} from "../../interfaces/IPlatform.sol";
import {IAprOracle} from "../../interfaces/IAprOracle.sol";
import {IPlatform} from "../../interfaces/IPlatform.sol";
import {IFactory} from "../../interfaces/IFactory.sol";
import {IRevenueRouter} from "../../interfaces/IRevenueRouter.sol";
/// @notice Base vault implementation.
/// User can deposit and withdraw a changing set of assets managed by the strategy.
/// Start price of vault share is $1.
/// @dev Used by all vault implementations (CVault, RVault, etc)
/// Changelog:
/// 2.2.0: hardWorkMintFeeCallback use revenueRouter
/// 2.1.0: previewDepositAssetsWrite
/// 2.0.0: use strategy.previewDepositAssetsWrite; hardWorkMintFeeCallback use platform.getCustomVaultFee
/// 1.3.0: hardWorkMintFeeCallback
/// 1.2.0: isHardWorkOnDepositAllowed
/// 1.1.0: setName, setSymbol, gas optimization
/// 1.0.1: add receiver and owner args to withdrawAssets method
/// @author Alien Deployer (https://github.com/a17)
/// @author JodsMigel (https://github.com/JodsMigel)
abstract contract VaultBase is Controllable, ERC20Upgradeable, ReentrancyGuardUpgradeable, IVault {
using SafeERC20 for IERC20;
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CONSTANTS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Version of VaultBase implementation
string public constant VERSION_VAULT_BASE = "2.2.0";
/// @dev Delay between deposits/transfers and withdrawals
uint internal constant _WITHDRAW_REQUEST_BLOCKS = 5;
/// @dev Initial shares of the vault minted at the first deposit and sent to the dead address.
uint internal constant _INITIAL_SHARES = 1e15;
/// @dev Delay for calling strategy.doHardWork() on user deposits
uint internal constant _MIN_HARDWORK_DELAY = 3600;
// keccak256(abi.encode(uint256(keccak256("erc7201:stability.VaultBase")) - 1)) & ~bytes32(uint256(0xff));
bytes32 private constant _VAULTBASE_STORAGE_LOCATION =
0xd602ae9af1fed726d4890dcf3c81a074ed87a6343646550e5de293c5a9330a00;
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* DATA TYPES */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @notice Data structure containing local variables for function depositAssets() to avoid stack too deep.
struct DepositAssetsVars {
uint _totalSupply;
uint totalValue;
uint len;
address[] assets;
IStrategy strategy;
address underlying;
uint[] amountsConsumed;
uint value;
uint mintAmount;
}
/// @notice Data structure containing local variables for function getApr() to avoid stack too deep.
struct GetAprVars {
address[] strategyAssets;
uint[] proportions;
address underlying;
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* INITIALIZATION */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
//slither-disable-next-line naming-convention
function __VaultBase_init(
address platform_,
string memory type_,
address strategy_,
string memory name_,
string memory symbol_,
uint tokenId_
) internal onlyInitializing {
__Controllable_init(platform_);
__ERC20_init(name_, symbol_);
VaultBaseStorage storage $ = _getVaultBaseStorage();
$._type = type_;
$.strategy = IStrategy(strategy_);
$.tokenId = tokenId_;
__ReentrancyGuard_init();
$.doHardWorkOnDeposit = IStrategy(strategy_).isHardWorkOnDepositAllowed();
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CALLBACKS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Need to receive ETH for HardWork and re-balance gas compensation
receive() external payable {}
/// @inheritdoc IVault
function hardWorkMintFeeCallback(address[] memory revenueAssets, uint[] memory revenueAmounts) external virtual {
IPlatform _platform = IPlatform(platform());
uint feeShares =
VaultBaseLib.hardWorkMintFeeCallback(_platform, revenueAssets, revenueAmounts, _getVaultBaseStorage());
if (feeShares != 0) {
address revenueRouter = _platform.revenueRouter();
_approve(address(this), revenueRouter, feeShares);
_mint(address(this), feeShares);
IRevenueRouter(revenueRouter).processFeeVault(address(this), feeShares);
}
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* RESTRICTED ACTIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @inheritdoc IVault
//slither-disable-next-line reentrancy-events
function doHardWork() external {
IPlatform _platform = IPlatform(platform());
// nosemgrep
if (msg.sender != _platform.hardWorker() && !_platform.isOperator(msg.sender)) {
revert IncorrectMsgSender();
}
uint startGas = gasleft();
VaultBaseStorage storage $ = _getVaultBaseStorage();
$.strategy.doHardWork();
uint gasUsed = startGas - gasleft();
uint gasCost = gasUsed * tx.gasprice;
//slither-disable-next-line uninitialized-local
bool compensated;
if (gasCost > 0) {
bool canCompensate = payable(address(this)).balance >= gasCost;
//slither-disable-next-line unused-return
if (canCompensate) {
//slither-disable-next-line low-level-calls
(bool success,) = msg.sender.call{value: gasCost}("");
if (!success) {
revert IControllable.ETHTransferFailed();
}
compensated = true;
} else {
//slither-disable-next-line unused-return
(uint _tvl,) = tvl();
if (_tvl < IPlatform(platform()).minTvlForFreeHardWork()) {
revert NotEnoughBalanceToPay();
}
}
}
emit HardWorkGas(gasUsed, gasCost, compensated);
}
/// @inheritdoc IVault
function setDoHardWorkOnDeposit(bool value) external onlyGovernanceOrMultisig {
VaultBaseStorage storage $ = _getVaultBaseStorage();
$.doHardWorkOnDeposit = value;
emit DoHardWorkOnDepositChanged($.doHardWorkOnDeposit, value);
}
/// @inheritdoc IVault
function setMaxSupply(uint maxShares) public virtual onlyGovernanceOrMultisig {
VaultBaseStorage storage $ = _getVaultBaseStorage();
$.maxSupply = maxShares;
emit MaxSupply(maxShares);
}
/// @inheritdoc IVault
function setName(string calldata newName) external onlyOperator {
VaultBaseStorage storage $ = _getVaultBaseStorage();
$.changedName = newName;
emit VaultName(newName);
}
/// @inheritdoc IVault
function setSymbol(string calldata newSymbol) external onlyOperator {
VaultBaseStorage storage $ = _getVaultBaseStorage();
$.changedSymbol = newSymbol;
emit VaultSymbol(newSymbol);
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* USER ACTIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @inheritdoc IVault
function depositAssets(
address[] memory assets_,
uint[] memory amountsMax,
uint minSharesOut,
address receiver
) external virtual nonReentrant {
VaultBaseStorage storage $ = _getVaultBaseStorage();
if (IFactory(IPlatform(platform()).factory()).vaultStatus(address(this)) != VaultStatusLib.ACTIVE) {
revert IFactory.NotActiveVault();
}
//slither-disable-next-line uninitialized-local
DepositAssetsVars memory v;
v.strategy = $.strategy;
// slither-disable-start timestamp
// nosemgrep
if (
$.doHardWorkOnDeposit && block.timestamp > v.strategy.lastHardWork() + _MIN_HARDWORK_DELAY
&& v.strategy.isReadyForHardWork()
) {
// slither-disable-end timestamp
v.strategy.doHardWork();
}
v._totalSupply = totalSupply();
v.totalValue = v.strategy.total();
// nosemgrep
if (v._totalSupply != 0 && v.totalValue == 0) {
revert FuseTrigger();
}
v.len = amountsMax.length;
if (v.len != assets_.length) {
revert IControllable.IncorrectArrayLength();
}
v.assets = v.strategy.assets();
v.underlying = v.strategy.underlying();
// nosemgrep
if (v.len == 1 && v.underlying != address(0) && v.underlying == assets_[0]) {
v.value = amountsMax[0];
IERC20(v.underlying).safeTransferFrom(msg.sender, address(v.strategy), v.value);
(v.amountsConsumed) = v.strategy.depositUnderlying(v.value);
} else {
(v.amountsConsumed, v.value) = v.strategy.previewDepositAssetsWrite(assets_, amountsMax);
// nosemgrep
for (uint i; i < v.len; ++i) {
IERC20(v.assets[i]).safeTransferFrom(msg.sender, address(v.strategy), v.amountsConsumed[i]);
}
v.value = v.strategy.depositAssets(v.amountsConsumed);
}
if (v.value == 0) {
revert StrategyZeroDeposit();
}
v.mintAmount =
_mintShares($, v._totalSupply, v.value, v.totalValue, v.amountsConsumed, minSharesOut, v.assets, receiver);
$.withdrawRequests[receiver] = block.number;
emit DepositAssets(receiver, assets_, v.amountsConsumed, v.mintAmount);
}
/// @inheritdoc IVault
function withdrawAssets(
address[] memory assets_,
uint amountShares,
uint[] memory minAssetAmountsOut
) external virtual nonReentrant returns (uint[] memory) {
return _withdrawAssets(assets_, amountShares, minAssetAmountsOut, msg.sender, msg.sender);
}
/// @inheritdoc IVault
function withdrawAssets(
address[] memory assets_,
uint amountShares,
uint[] memory minAssetAmountsOut,
address receiver,
address owner
) external virtual nonReentrant returns (uint[] memory) {
return _withdrawAssets(assets_, amountShares, minAssetAmountsOut, receiver, owner);
}
/// @inheritdoc IVault
function previewDepositAssetsWrite(
address[] memory assets_,
uint[] memory amountsMax
) external returns (uint[] memory amountsConsumed, uint sharesOut, uint valueOut) {
VaultBaseStorage storage $ = _getVaultBaseStorage();
IStrategy _strategy = $.strategy;
(amountsConsumed, valueOut) = _strategy.previewDepositAssetsWrite(assets_, amountsMax);
//slither-disable-next-line unused-return
(sharesOut,) = _calcMintShares(totalSupply(), valueOut, _strategy.total(), amountsConsumed, _strategy.assets());
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* VIEW FUNCTIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
function name() public view override returns (string memory) {
VaultBaseStorage storage $ = _getVaultBaseStorage();
string memory changedName = $.changedName;
if (bytes(changedName).length > 0) {
return changedName;
}
return super.name();
}
function symbol() public view override returns (string memory) {
VaultBaseStorage storage $ = _getVaultBaseStorage();
string memory changedSymbol = $.changedSymbol;
if (bytes(changedSymbol).length > 0) {
return changedSymbol;
}
return super.symbol();
}
/// @inheritdoc IERC165
function supportsInterface(bytes4 interfaceId) public view virtual override(Controllable, IERC165) returns (bool) {
return interfaceId == type(IVault).interfaceId || super.supportsInterface(interfaceId);
}
/// @inheritdoc IVault
function vaultType() external view returns (string memory) {
return _getVaultBaseStorage()._type;
}
/// @inheritdoc IVault
function price() external view returns (uint price_, bool trusted_) {
VaultBaseStorage storage $ = _getVaultBaseStorage();
(address[] memory _assets, uint[] memory _amounts) = $.strategy.assetsAmounts();
IPriceReader priceReader = IPriceReader(IPlatform(platform()).priceReader());
uint _tvl;
//slither-disable-next-line unused-return
(_tvl,,, trusted_) = priceReader.getAssetsPrice(_assets, _amounts);
uint __totalSupply = totalSupply();
if (__totalSupply > 0) {
price_ = _tvl * 1e18 / __totalSupply;
}
}
/// @inheritdoc IVault
function tvl() public view returns (uint tvl_, bool trusted_) {
VaultBaseStorage storage $ = _getVaultBaseStorage();
(address[] memory _assets, uint[] memory _amounts) = $.strategy.assetsAmounts();
IPriceReader priceReader = IPriceReader(IPlatform(platform()).priceReader());
//slither-disable-next-line unused-return
(tvl_,,, trusted_) = priceReader.getAssetsPrice(_assets, _amounts);
}
/// @inheritdoc IVault
function previewDepositAssets(
address[] memory assets_,
uint[] memory amountsMax
) external view returns (uint[] memory amountsConsumed, uint sharesOut, uint valueOut) {
VaultBaseStorage storage $ = _getVaultBaseStorage();
IStrategy _strategy = $.strategy;
(amountsConsumed, valueOut) = _strategy.previewDepositAssets(assets_, amountsMax);
//slither-disable-next-line unused-return
(sharesOut,) = _calcMintShares(totalSupply(), valueOut, _strategy.total(), amountsConsumed, _strategy.assets());
}
/// @inheritdoc IVault
function getApr()
external
view
returns (uint totalApr, uint strategyApr, address[] memory assetsWithApr, uint[] memory assetsAprs)
{
VaultBaseStorage storage $ = _getVaultBaseStorage();
//slither-disable-next-line uninitialized-local
GetAprVars memory v;
IStrategy _strategy = $.strategy;
strategyApr = _strategy.lastApr();
totalApr = strategyApr;
v.strategyAssets = _strategy.assets();
v.proportions = _strategy.getAssetsProportions();
v.underlying = _strategy.underlying();
uint assetsLengthTmp = v.strategyAssets.length;
if (v.underlying != address(0)) {
++assetsLengthTmp;
}
uint strategyAssetsLength = v.strategyAssets.length;
address[] memory queryAprAssets = new address[](assetsLengthTmp);
// nosemgrep
for (uint i; i < strategyAssetsLength; ++i) {
queryAprAssets[i] = v.strategyAssets[i];
}
if (v.underlying != address(0)) {
queryAprAssets[assetsLengthTmp - 1] = v.underlying;
}
uint[] memory queryAprs = IAprOracle(IPlatform(platform()).aprOracle()).getAprs(queryAprAssets);
assetsLengthTmp = 0;
uint queryAprsLength = queryAprs.length;
// nosemgrep
for (uint i; i < queryAprsLength; ++i) {
if (queryAprs[i] > 0) {
++assetsLengthTmp;
}
}
assetsWithApr = new address[](assetsLengthTmp);
assetsAprs = new uint[](assetsLengthTmp);
//slither-disable-next-line uninitialized-local
uint k;
// nosemgrep
for (uint i; i < queryAprsLength; ++i) {
if (queryAprs[i] > 0) {
assetsWithApr[k] = queryAprAssets[i];
assetsAprs[k] = queryAprs[i];
if (i < strategyAssetsLength) {
totalApr += assetsAprs[k] * v.proportions[i] / 1e18;
} else {
totalApr += assetsAprs[k];
}
++k;
}
}
}
/// @inheritdoc IVault
function getUniqueInitParamLength() public view virtual returns (uint uniqueInitAddresses, uint uniqueInitNums);
/// @inheritdoc IVault
function strategy() public view returns (IStrategy) {
VaultBaseStorage storage $ = _getVaultBaseStorage();
return $.strategy;
}
/// @inheritdoc IVault
function maxSupply() external view returns (uint) {
VaultBaseStorage storage $ = _getVaultBaseStorage();
return $.maxSupply;
}
/// @inheritdoc IVault
function tokenId() external view returns (uint) {
VaultBaseStorage storage $ = _getVaultBaseStorage();
return $.tokenId;
}
/// @inheritdoc IVault
function doHardWorkOnDeposit() external view returns (bool) {
VaultBaseStorage storage $ = _getVaultBaseStorage();
return $.doHardWorkOnDeposit;
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* INTERNAL LOGIC */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
function _getVaultBaseStorage() internal pure returns (VaultBaseStorage storage $) {
//slither-disable-next-line assembly
assembly {
$.slot := _VAULTBASE_STORAGE_LOCATION
}
}
/// @dev Minting shares of the vault to the user's address when he deposits funds into the vault.
///
/// During the first deposit, initial shares are also minted and sent to the dead address.
/// Initial shares save proportion of value to total supply and share price when all users withdraw all their funds from vault.
/// It prevent flash loan attacks on users' funds.
/// Also their presence allows the strategy to work without user funds, providing APR for the logic and the farm, if available.
/// @param totalSupply_ Total supply of shares before deposit
/// @param value_ Liquidity value or underlying token amount received after deposit
/// @param amountsConsumed Amounts of strategy assets consumed during the execution of the deposit.
/// Consumed amounts used by calculation of minted amount during the first deposit for setting the first share price to 1 USD.
/// @param minSharesOut Slippage tolerance. Minimal shares amount which must be received by user after deposit
/// @return mintAmount Amount of minted shares for the user
function _mintShares(
VaultBaseStorage storage $,
uint totalSupply_,
uint value_,
uint totalValue_,
uint[] memory amountsConsumed,
uint minSharesOut,
address[] memory assets,
address receiver
) internal returns (uint mintAmount) {
uint initialShares;
(mintAmount, initialShares) = _calcMintShares(totalSupply_, value_, totalValue_, amountsConsumed, assets);
uint _maxSupply = $.maxSupply;
// nosemgrep
if (_maxSupply != 0 && mintAmount + totalSupply_ > _maxSupply) {
revert ExceedMaxSupply(_maxSupply);
}
if (mintAmount < minSharesOut) {
revert ExceedSlippage(mintAmount, minSharesOut);
}
if (initialShares > 0) {
_mint(ConstantsLib.DEAD_ADDRESS, initialShares);
}
if (receiver == address(0)) {
receiver = msg.sender;
}
_mint(receiver, mintAmount);
}
/// @dev Calculating amount of new shares for given deposited value and totals
function _calcMintShares(
uint totalSupply_,
uint value_,
uint totalValue_,
uint[] memory amountsConsumed,
address[] memory assets
) internal view returns (uint mintAmount, uint initialShares) {
if (totalSupply_ > 0) {
mintAmount = value_ * totalSupply_ / totalValue_;
initialShares = 0; // hide warning
} else {
// calc mintAmount for USD amount of value
// its setting sharePrice to 1e18
IPriceReader priceReader = IPriceReader(IPlatform(platform()).priceReader());
//slither-disable-next-line unused-return
(mintAmount,,,) = priceReader.getAssetsPrice(assets, amountsConsumed);
// initialShares for saving share price after full withdraw
initialShares = _INITIAL_SHARES;
if (mintAmount < initialShares * 1000) {
revert NotEnoughAmountToInitSupply(mintAmount, initialShares * 1000);
}
mintAmount -= initialShares;
}
}
function _withdrawAssets(
address[] memory assets_,
uint amountShares,
uint[] memory minAssetAmountsOut,
address receiver,
address owner
) internal virtual returns (uint[] memory) {
if (msg.sender != owner) {
_spendAllowance(owner, msg.sender, amountShares);
}
if (amountShares == 0) {
revert IControllable.IncorrectZeroArgument();
}
if (amountShares > balanceOf(owner)) {
revert NotEnoughBalanceToPay();
}
if (assets_.length != minAssetAmountsOut.length) {
revert IControllable.IncorrectArrayLength();
}
VaultBaseStorage storage $ = _getVaultBaseStorage();
_beforeWithdraw($, owner);
IStrategy _strategy = $.strategy;
uint localTotalSupply = totalSupply();
uint totalValue = _strategy.total();
uint[] memory amountsOut;
{
address underlying = _strategy.underlying();
// nosemgrep
bool isUnderlyingWithdrawal = assets_.length == 1 && underlying != address(0) && underlying == assets_[0];
// fuse is not triggered
if (totalValue > 0) {
uint value = amountShares * totalValue / localTotalSupply;
if (isUnderlyingWithdrawal) {
amountsOut = new uint[](1);
amountsOut[0] = value;
_strategy.withdrawUnderlying(amountsOut[0], receiver);
} else {
amountsOut = _strategy.withdrawAssets(assets_, value, receiver);
}
} else {
if (isUnderlyingWithdrawal) {
amountsOut = new uint[](1);
amountsOut[0] = amountShares * IERC20(underlying).balanceOf(address(_strategy)) / localTotalSupply;
_strategy.withdrawUnderlying(amountsOut[0], receiver);
} else {
amountsOut = _strategy.transferAssets(amountShares, localTotalSupply, receiver);
}
}
uint len = amountsOut.length;
// nosemgrep
for (uint i; i < len; ++i) {
if (amountsOut[i] < minAssetAmountsOut[i]) {
revert ExceedSlippageExactAsset(assets_[i], amountsOut[i], minAssetAmountsOut[i]);
}
}
}
_burn(owner, amountShares);
emit WithdrawAssets(msg.sender, owner, assets_, amountShares, amountsOut);
return amountsOut;
}
function _beforeWithdraw(VaultBaseStorage storage $, address owner) internal {
if ($.withdrawRequests[owner] + _WITHDRAW_REQUEST_BLOCKS >= block.number) {
revert WaitAFewBlocks();
}
$.withdrawRequests[owner] = block.number;
}
function _update(address from, address to, uint value) internal virtual override {
super._update(from, to, value);
VaultBaseStorage storage $ = _getVaultBaseStorage();
$.withdrawRequests[from] = block.number;
$.withdrawRequests[to] = block.number;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;
library VaultTypeLib {
string internal constant COMPOUNDING = "Compounding";
string internal constant REWARDING = "Rewarding";
string internal constant REWARDING_MANAGED = "Rewarding Managed";
string internal constant SPLITTER_MANAGED = "Splitter Managed";
string internal constant SPLITTER_AUTO = "Splitter Automatic";
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "./ConstantsLib.sol";
library CommonLib {
function filterAddresses(
address[] memory addresses,
address addressToRemove
) external pure returns (address[] memory filteredAddresses) {
uint len = addresses.length;
uint newLen;
// nosemgrep
for (uint i; i < len; ++i) {
if (addresses[i] != addressToRemove) {
++newLen;
}
}
filteredAddresses = new address[](newLen);
uint k;
// nosemgrep
for (uint i; i < len; ++i) {
if (addresses[i] != addressToRemove) {
filteredAddresses[k] = addresses[i];
++k;
}
}
}
function formatUsdAmount(uint amount) external pure returns (string memory formattedPrice) {
uint dollars = amount / 10 ** 18;
string memory priceStr;
if (dollars >= 1000) {
uint kDollars = dollars / 1000;
uint kDollarsFraction = (dollars - kDollars * 1000) / 10;
string memory delimiter = ".";
if (kDollarsFraction < 10) {
delimiter = ".0";
}
priceStr = string.concat(Strings.toString(kDollars), delimiter, Strings.toString(kDollarsFraction), "k");
} else if (dollars >= 100) {
priceStr = Strings.toString(dollars);
} else {
uint dollarsFraction = (amount - dollars * 10 ** 18) / 10 ** 14;
if (dollarsFraction > 0) {
string memory dollarsFractionDelimiter = ".";
if (dollarsFraction < 10) {
dollarsFractionDelimiter = ".000";
} else if (dollarsFraction < 100) {
dollarsFractionDelimiter = ".00";
} else if (dollarsFraction < 1000) {
dollarsFractionDelimiter = ".0";
}
priceStr = string.concat(
Strings.toString(dollars), dollarsFractionDelimiter, Strings.toString(dollarsFraction)
);
} else {
priceStr = Strings.toString(dollars);
}
}
formattedPrice = string.concat("$", priceStr);
}
function formatApr(uint apr) external pure returns (string memory formattedApr) {
uint aprInt = apr * 100 / ConstantsLib.DENOMINATOR;
uint aprFraction = (apr - aprInt * ConstantsLib.DENOMINATOR / 100) / 10;
string memory delimiter = ".";
if (aprFraction < 10) {
delimiter = ".0";
}
formattedApr = string.concat(Strings.toString(aprInt), delimiter, Strings.toString(aprFraction), "%");
}
function formatAprInt(int apr) external pure returns (string memory formattedApr) {
int aprInt = apr * 100 / int(ConstantsLib.DENOMINATOR);
int aprFraction = (apr - aprInt * int(ConstantsLib.DENOMINATOR) / 100) / 10;
string memory delimiter = ".";
if (aprFraction < 10 || aprFraction > -10) {
delimiter = ".0";
}
formattedApr = string.concat(i2s2(aprInt), delimiter, i2s(aprFraction), "%");
}
function implodeSymbols(
address[] memory assets,
string memory delimiter
) external view returns (string memory outString) {
return implode(getSymbols(assets), delimiter);
}
function implode(string[] memory strings, string memory delimiter) public pure returns (string memory outString) {
uint len = strings.length;
if (len == 0) {
return "";
}
outString = strings[0];
// nosemgrep
for (uint i = 1; i < len; ++i) {
outString = string.concat(outString, delimiter, strings[i]);
}
return outString;
}
function getSymbols(address[] memory assets) public view returns (string[] memory symbols) {
uint len = assets.length;
symbols = new string[](len);
// nosemgrep
for (uint i; i < len; ++i) {
symbols[i] = IERC20Metadata(assets[i]).symbol();
}
}
function bytesToBytes32(bytes memory b) external pure returns (bytes32 out) {
// nosemgrep
for (uint i; i < b.length; ++i) {
out |= bytes32(b[i] & 0xFF) >> (i * 8);
}
// return out;
}
function bToHex(bytes memory buffer) external pure returns (string memory) {
// Fixed buffer size for hexadecimal convertion
bytes memory converted = new bytes(buffer.length * 2);
bytes memory _base = "0123456789abcdef";
uint baseLength = _base.length;
// nosemgrep
for (uint i; i < buffer.length; ++i) {
converted[i * 2] = _base[uint8(buffer[i]) / baseLength];
converted[i * 2 + 1] = _base[uint8(buffer[i]) % baseLength];
}
return string(abi.encodePacked(converted));
}
function shortId(string memory id) external pure returns (string memory) {
uint words = 1;
bytes memory idBytes = bytes(id);
uint idBytesLength = idBytes.length;
// nosemgrep
for (uint i; i < idBytesLength; ++i) {
if (keccak256(bytes(abi.encodePacked(idBytes[i]))) == keccak256(bytes(" "))) {
++words;
}
}
bytes memory _shortId = new bytes(words);
uint k = 1;
_shortId[0] = idBytes[0];
// nosemgrep
for (uint i = 1; i < idBytesLength; ++i) {
if (keccak256(bytes(abi.encodePacked(idBytes[i]))) == keccak256(bytes(" "))) {
if (keccak256(bytes(abi.encodePacked(idBytes[i + 1]))) == keccak256(bytes("0"))) {
_shortId[k] = idBytes[i + 3];
} else {
_shortId[k] = idBytes[i + 1];
}
++k;
}
}
return string(abi.encodePacked(_shortId));
}
function eq(string memory a, string memory b) external pure returns (bool) {
return keccak256(bytes(a)) == keccak256(bytes(b));
}
function u2s(uint num) external pure returns (string memory) {
return Strings.toString(num);
}
function i2s(int num) public pure returns (string memory) {
return Strings.toString(num > 0 ? uint(num) : uint(-num));
}
function i2s2(int num) public pure returns (string memory) {
if (num >= 0) {
return Strings.toString(uint(num));
}
return string.concat("-", Strings.toString(uint(-num)));
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
/// @dev Base core interface implemented by most platform contracts.
/// Inherited contracts store an immutable Platform proxy address in the storage,
/// which provides authorization capabilities and infrastructure contract addresses.
/// @author Alien Deployer (https://github.com/a17)
/// @author JodsMigel (https://github.com/JodsMigel)
interface IControllable {
//region ----- Custom Errors -----
error IncorrectZeroArgument();
error IncorrectMsgSender();
error NotGovernance();
error NotMultisig();
error NotGovernanceAndNotMultisig();
error NotOperator();
error NotFactory();
error NotPlatform();
error NotVault();
error IncorrectArrayLength();
error AlreadyExist();
error NotExist();
error NotTheOwner();
error ETHTransferFailed();
error IncorrectInitParams();
//endregion -- Custom Errors -----
event ContractInitialized(address platform, uint ts, uint block);
/// @notice Stability Platform main contract address
function platform() external view returns (address);
/// @notice Version of contract implementation
/// @dev SemVer scheme MAJOR.MINOR.PATCH
//slither-disable-next-line naming-convention
function VERSION() external view returns (string memory);
/// @notice Block number when contract was initialized
function createdBlock() external view returns (uint);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import {ContextUpgradeable} from "../../utils/ContextUpgradeable.sol";
import {IERC20Errors} from "@openzeppelin/contracts/interfaces/draft-IERC6093.sol";
import {Initializable} from "../../proxy/utils/Initializable.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
*
* TIP: For a detailed writeup see our guide
* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* The default value of {decimals} is 18. To change this, you should override
* this function so it returns a different value.
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*/
abstract contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20, IERC20Metadata, IERC20Errors {
/// @custom:storage-location erc7201:openzeppelin.storage.ERC20
struct ERC20Storage {
mapping(address account => uint256) _balances;
mapping(address account => mapping(address spender => uint256)) _allowances;
uint256 _totalSupply;
string _name;
string _symbol;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ERC20")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant ERC20StorageLocation = 0x52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace00;
function _getERC20Storage() private pure returns (ERC20Storage storage $) {
assembly {
$.slot := ERC20StorageLocation
}
}
/**
* @dev Sets the values for {name} and {symbol}.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {
__ERC20_init_unchained(name_, symbol_);
}
function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
ERC20Storage storage $ = _getERC20Storage();
$._name = name_;
$._symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual returns (string memory) {
ERC20Storage storage $ = _getERC20Storage();
return $._name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual returns (string memory) {
ERC20Storage storage $ = _getERC20Storage();
return $._symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the default value returned by this function, unless
* it's overridden.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual returns (uint256) {
ERC20Storage storage $ = _getERC20Storage();
return $._totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual returns (uint256) {
ERC20Storage storage $ = _getERC20Storage();
return $._balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `value`.
*/
function transfer(address to, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_transfer(owner, to, value);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual returns (uint256) {
ERC20Storage storage $ = _getERC20Storage();
return $._allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `value` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, value);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `value`.
* - the caller must have allowance for ``from``'s tokens of at least
* `value`.
*/
function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, value);
_transfer(from, to, value);
return true;
}
/**
* @dev Moves a `value` amount of tokens from `from` to `to`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _transfer(address from, address to, uint256 value) internal {
if (from == address(0)) {
revert ERC20InvalidSender(address(0));
}
if (to == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(from, to, value);
}
/**
* @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
* (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
* this function.
*
* Emits a {Transfer} event.
*/
function _update(address from, address to, uint256 value) internal virtual {
ERC20Storage storage $ = _getERC20Storage();
if (from == address(0)) {
// Overflow check required: The rest of the code assumes that totalSupply never overflows
$._totalSupply += value;
} else {
uint256 fromBalance = $._balances[from];
if (fromBalance < value) {
revert ERC20InsufficientBalance(from, fromBalance, value);
}
unchecked {
// Overflow not possible: value <= fromBalance <= totalSupply.
$._balances[from] = fromBalance - value;
}
}
if (to == address(0)) {
unchecked {
// Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
$._totalSupply -= value;
}
} else {
unchecked {
// Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
$._balances[to] += value;
}
}
emit Transfer(from, to, value);
}
/**
* @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
* Relies on the `_update` mechanism
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _mint(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(address(0), account, value);
}
/**
* @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
* Relies on the `_update` mechanism.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead
*/
function _burn(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidSender(address(0));
}
_update(account, address(0), value);
}
/**
* @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*
* Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
*/
function _approve(address owner, address spender, uint256 value) internal {
_approve(owner, spender, value, true);
}
/**
* @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
*
* By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
* `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
* `Approval` event during `transferFrom` operations.
*
* Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
* true using the following override:
* ```
* function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
* super._approve(owner, spender, value, true);
* }
* ```
*
* Requirements are the same as {_approve}.
*/
function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
ERC20Storage storage $ = _getERC20Storage();
if (owner == address(0)) {
revert ERC20InvalidApprover(address(0));
}
if (spender == address(0)) {
revert ERC20InvalidSpender(address(0));
}
$._allowances[owner][spender] = value;
if (emitEvent) {
emit Approval(owner, spender, value);
}
}
/**
* @dev Updates `owner` s allowance for `spender` based on spent `value`.
*
* Does not update the allowance value in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Does not emit an {Approval} event.
*/
function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
if (currentAllowance < value) {
revert ERC20InsufficientAllowance(spender, currentAllowance, value);
}
unchecked {
_approve(owner, spender, currentAllowance - value, false);
}
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev An operation with an ERC20 token failed.
*/
error SafeERC20FailedOperation(address token);
/**
* @dev Indicates a failed `decreaseAllowance` request.
*/
error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
forceApprove(token, spender, oldAllowance + value);
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
* value, non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
unchecked {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < requestedDecrease) {
revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
}
forceApprove(token, spender, currentAllowance - requestedDecrease);
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data);
if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)
pragma solidity ^0.8.20;
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuardUpgradeable is Initializable {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant NOT_ENTERED = 1;
uint256 private constant ENTERED = 2;
/// @custom:storage-location erc7201:openzeppelin.storage.ReentrancyGuard
struct ReentrancyGuardStorage {
uint256 _status;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant ReentrancyGuardStorageLocation = 0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00;
function _getReentrancyGuardStorage() private pure returns (ReentrancyGuardStorage storage $) {
assembly {
$.slot := ReentrancyGuardStorageLocation
}
}
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
function __ReentrancyGuard_init() internal onlyInitializing {
__ReentrancyGuard_init_unchained();
}
function __ReentrancyGuard_init_unchained() internal onlyInitializing {
ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
$._status = NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
// On the first call to nonReentrant, _status will be NOT_ENTERED
if ($._status == ENTERED) {
revert ReentrancyGuardReentrantCall();
}
// Any calls to nonReentrant after this point will fail
$._status = ENTERED;
}
function _nonReentrantAfter() private {
ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
$._status = NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
return $._status == ENTERED;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {SlotsLib} from "../libs/SlotsLib.sol";
import {IControllable} from "../../interfaces/IControllable.sol";
import {IPlatform} from "../../interfaces/IPlatform.sol";
/// @dev Base core contract.
/// It store an immutable platform proxy address in the storage and provides access control to inherited contracts.
/// @author Alien Deployer (https://github.com/a17)
/// @author 0xhokugava (https://github.com/0xhokugava)
abstract contract Controllable is Initializable, IControllable, ERC165 {
using SlotsLib for bytes32;
string public constant CONTROLLABLE_VERSION = "1.0.1";
bytes32 internal constant _PLATFORM_SLOT = bytes32(uint(keccak256("eip1967.controllable.platform")) - 1);
bytes32 internal constant _CREATED_BLOCK_SLOT = bytes32(uint(keccak256("eip1967.controllable.created_block")) - 1);
/// @dev Prevent implementation init
constructor() {
_disableInitializers();
}
/// @notice Initialize contract after setup it as proxy implementation
/// Save block.timestamp in the "created" variable
/// @dev Use it only once after first logic setup
/// @param platform_ Platform address
//slither-disable-next-line naming-convention
function __Controllable_init(address platform_) internal onlyInitializing {
require(platform_ != address(0) && IPlatform(platform_).multisig() != address(0), IncorrectZeroArgument());
SlotsLib.set(_PLATFORM_SLOT, platform_); // syntax for forge coverage
_CREATED_BLOCK_SLOT.set(block.number);
emit ContractInitialized(platform_, block.timestamp, block.number);
}
modifier onlyGovernance() {
_requireGovernance();
_;
}
modifier onlyMultisig() {
_requireMultisig();
_;
}
modifier onlyGovernanceOrMultisig() {
_requireGovernanceOrMultisig();
_;
}
modifier onlyOperator() {
_requireOperator();
_;
}
modifier onlyFactory() {
_requireFactory();
_;
}
// ************* SETTERS/GETTERS *******************
/// @inheritdoc IControllable
function platform() public view override returns (address) {
return _PLATFORM_SLOT.getAddress();
}
/// @inheritdoc IControllable
function createdBlock() external view override returns (uint) {
return _CREATED_BLOCK_SLOT.getUint();
}
/// @inheritdoc IERC165
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IControllable).interfaceId || super.supportsInterface(interfaceId);
}
function _requireGovernance() internal view {
require(IPlatform(platform()).governance() == msg.sender, NotGovernance());
}
function _requireMultisig() internal view {
require(IPlatform(platform()).multisig() == msg.sender, NotMultisig());
}
function _requireGovernanceOrMultisig() internal view {
IPlatform _platform = IPlatform(platform());
require(
_platform.governance() == msg.sender || _platform.multisig() == msg.sender, NotGovernanceAndNotMultisig()
);
}
function _requireOperator() internal view {
require(IPlatform(platform()).isOperator(msg.sender), NotOperator());
}
function _requireFactory() internal view {
require(IPlatform(platform()).factory() == msg.sender, NotFactory());
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;
library ConstantsLib {
uint internal constant DENOMINATOR = 100_000;
address internal constant DEAD_ADDRESS = 0xdEad000000000000000000000000000000000000;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;
library VaultStatusLib {
uint internal constant NOT_EXIST = 0;
uint internal constant ACTIVE = 1;
uint internal constant DEPRECATED = 2;
uint internal constant EMERGENCY_EXIT = 3;
uint internal constant DISABLED = 4;
uint internal constant DEPOSITS_UNAVAILABLE = 5;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
import {SafeERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {ConstantsLib} from "../../core/libs/ConstantsLib.sol";
import {IVault} from "../../interfaces/IVault.sol";
import {IControllable} from "../../interfaces/IControllable.sol";
import {IPlatform} from "../../interfaces/IPlatform.sol";
import {IStrategy} from "../../interfaces/IStrategy.sol";
library VaultBaseLib {
using SafeERC20 for IERC20;
struct MintFeesVars {
uint feePlatform;
uint feeShareVaultManager;
uint feeShareStrategyLogic;
uint feeShareEcosystem;
uint vaultSharesForPlatform;
uint vaultSharesForVaultManager;
uint vaultSharesForStrategyLogic;
uint vaultSharesForEcosystem;
}
function hardWorkMintFeeCallback(
IPlatform platform,
address[] memory revenueAssets,
uint[] memory revenueAmounts,
IVault.VaultBaseStorage storage $
) external view returns (uint feeShares) {
MintFeesVars memory v;
IStrategy s = $.strategy;
if (address(s) != msg.sender) {
revert IControllable.IncorrectMsgSender();
}
(, uint revenueSharesOut,) = IVault(address(this)).previewDepositAssets(revenueAssets, revenueAmounts);
(v.feePlatform,,,) = platform.getFees();
try platform.getCustomVaultFee(address(this)) returns (uint vaultCustomFee) {
if (vaultCustomFee != 0) {
v.feePlatform = vaultCustomFee;
}
} catch {}
feeShares = revenueSharesOut * v.feePlatform / ConstantsLib.DENOMINATOR;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {IStrategy} from "./IStrategy.sol";
/// @notice Vault core interface.
/// Derived implementations can be effective for building tokenized vaults with single or multiple underlying liquidity mining position.
/// Fungible, static non-fungible and actively re-balancing liquidity is supported, as well as single token liquidity provided to lending protocols.
/// Vaults can be used for active concentrated liquidity management and market making.
/// @author Jude (https://github.com/iammrjude)
/// @author JodsMigel (https://github.com/JodsMigel)
interface IVault is IERC165 {
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CUSTOM ERRORS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
error NotEnoughBalanceToPay();
error FuseTrigger();
error ExceedSlippage(uint mintToUser, uint minToMint);
error ExceedSlippageExactAsset(address asset, uint mintToUser, uint minToMint);
error ExceedMaxSupply(uint maxSupply);
error NotEnoughAmountToInitSupply(uint mintAmount, uint initialShares);
error WaitAFewBlocks();
error StrategyZeroDeposit();
error NotSupported();
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* EVENTS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
event DepositAssets(address indexed account, address[] assets, uint[] amounts, uint mintAmount);
event WithdrawAssets(
address indexed sender, address indexed owner, address[] assets, uint sharesAmount, uint[] amountsOut
);
event HardWorkGas(uint gasUsed, uint gasCost, bool compensated);
event DoHardWorkOnDepositChanged(bool oldValue, bool newValue);
event MaxSupply(uint maxShares);
event VaultName(string newName);
event VaultSymbol(string newSymbol);
event MintFees(
uint vaultManagerReceiverFee,
uint strategyLogicReceiverFee,
uint ecosystemRevenueReceiverFee,
uint multisigReceiverFee
);
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* DATA TYPES */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @custom:storage-location erc7201:stability.VaultBase
struct VaultBaseStorage {
/// @dev Prevents manipulations with deposit and withdraw in short time.
/// For simplification we are setup new withdraw request on each deposit/transfer.
mapping(address msgSender => uint blockNumber) withdrawRequests;
/// @inheritdoc IVault
IStrategy strategy;
/// @inheritdoc IVault
uint maxSupply;
/// @inheritdoc IVault
uint tokenId;
/// @inheritdoc IVault
bool doHardWorkOnDeposit;
/// @dev Immutable vault type ID
string _type;
/// @dev Changed ERC20 name
string changedName;
/// @dev Changed ERC20 symbol
string changedSymbol;
}
/// @title Vault Initialization Data
/// @notice Data structure containing parameters for initializing a new vault.
/// @dev This struct is commonly used as a parameter for the `initialize` function in vault contracts.
/// @param platform Platform address providing access control, infrastructure addresses, fee settings, and upgrade capability.
/// @param strategy Immutable strategy proxy used by the vault.
/// @param name ERC20 name for the vault token.
/// @param symbol ERC20 symbol for the vault token.
/// @param tokenId NFT ID associated with the VaultManager.
/// @param vaultInitAddresses Array of addresses used during vault initialization.
/// @param vaultInitNums Array of uint values corresponding to initialization parameters.
struct VaultInitializationData {
address platform;
address strategy;
string name;
string symbol;
uint tokenId;
address[] vaultInitAddresses;
uint[] vaultInitNums;
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* VIEW FUNCTIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @notice Immutable vault type ID
function vaultType() external view returns (string memory);
/// @return uniqueInitAddresses Return required unique init addresses
/// @return uniqueInitNums Return required unique init nums
function getUniqueInitParamLength() external view returns (uint uniqueInitAddresses, uint uniqueInitNums);
/// @notice Vault type extra data
/// @return Vault type color, background color and other extra data
function extra() external view returns (bytes32);
/// @notice Immutable strategy proxy used by the vault
/// @return Linked strategy
function strategy() external view returns (IStrategy);
/// @notice Max supply of shares in the vault.
/// Since the starting share price is $1, this ceiling can be considered as an approximate TVL limit.
/// @return Max total supply of vault
function maxSupply() external view returns (uint);
/// @dev VaultManager token ID. This tokenId earn feeVaultManager provided by Platform.
function tokenId() external view returns (uint);
/// @dev Trigger doHardwork on invest action. Enabled by default.
function doHardWorkOnDeposit() external view returns (bool);
/// @dev USD price of share with 18 decimals.
/// ONLY FOR OFF-CHAIN USE.
/// Not trusted vault share price can be manipulated.
/// @return price_ Price of 1e18 shares with 18 decimals precision
/// @return trusted True means oracle price, false means AMM spot price
function price() external view returns (uint price_, bool trusted);
/// @dev USD price of assets managed by strategy with 18 decimals
/// ONLY FOR OFF-CHAIN USE.
/// Not trusted TVL can be manipulated.
/// @return tvl_ Total USD value of final assets in vault
/// @return trusted True means TVL calculated based only on oracle prices, false means AMM spot price was used.
function tvl() external view returns (uint tvl_, bool trusted);
/// @dev Calculation of consumed amounts, shares amount and liquidity/underlying value for provided available amounts of strategy assets
/// @param assets_ Assets suitable for vault strategy. Can be strategy assets, underlying asset or specific set of assets depending on strategy logic.
/// @param amountsMax Available amounts of assets_ that user wants to invest in vault
/// @return amountsConsumed Amounts of strategy assets that can be deposited by providing amountsMax
/// @return sharesOut Amount of vault shares that will be minted
/// @return valueOut Liquidity value or underlying token amount that will be received by the strategy
function previewDepositAssets(
address[] memory assets_,
uint[] memory amountsMax
) external view returns (uint[] memory amountsConsumed, uint sharesOut, uint valueOut);
/// @notice All available data on the latest declared APR (annual percentage rate)
/// @return totalApr Total APR of investing money to vault. 18 decimals: 1e18 - +100% per year.
/// @return strategyApr Strategy investmnt APR declared on last HardWork.
/// @return assetsWithApr Assets with underlying APR
/// @return assetsAprs Underlying APR of asset
function getApr()
external
view
returns (uint totalApr, uint strategyApr, address[] memory assetsWithApr, uint[] memory assetsAprs);
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* WRITE FUNCTIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @notice Write version of previewDepositAssets
/// @param assets_ Assets suitable for vault strategy. Can be strategy assets, underlying asset or specific set of assets depending on strategy logic.
/// @param amountsMax Available amounts of assets_ that user wants to invest in vault
/// @return amountsConsumed Amounts of strategy assets that can be deposited by providing amountsMax
/// @return sharesOut Amount of vault shares that will be minted
/// @return valueOut Liquidity value or underlying token amount that will be received by the strategy
function previewDepositAssetsWrite(
address[] memory assets_,
uint[] memory amountsMax
) external returns (uint[] memory amountsConsumed, uint sharesOut, uint valueOut);
/// @dev Mint fee shares callback
/// @param revenueAssets Assets returned by _claimRevenue function that was earned during HardWork
/// @param revenueAmounts Assets amounts returned from _claimRevenue function that was earned during HardWork
/// Only strategy can call this
function hardWorkMintFeeCallback(address[] memory revenueAssets, uint[] memory revenueAmounts) external;
/// @dev Deposit final assets (pool assets) to the strategy and minting of vault shares.
/// If the strategy interacts with a pool or farms through an underlying token, then it will be minted.
/// Emits a {DepositAssets} event with consumed amounts.
/// @param assets_ Assets suitable for the strategy. Can be strategy assets, underlying asset or specific set of assets depending on strategy logic.
/// @param amountsMax Available amounts of assets_ that user wants to invest in vault
/// @param minSharesOut Slippage tolerance. Minimal shares amount which must be received by user.
/// @param receiver Receiver of deposit. If receiver is zero address, receiver is msg.sender.
function depositAssets(
address[] memory assets_,
uint[] memory amountsMax,
uint minSharesOut,
address receiver
) external;
/// @dev Burning shares of vault and obtaining strategy assets.
/// @param assets_ Assets suitable for the strategy. Can be strategy assets, underlying asset or specific set of assets depending on strategy logic.
/// @param amountShares Shares amount for burning
/// @param minAssetAmountsOut Slippage tolerance. Minimal amounts of strategy assets that user must receive.
/// @return Amount of assets for withdraw. It's related to assets_ one-by-one.
function withdrawAssets(
address[] memory assets_,
uint amountShares,
uint[] memory minAssetAmountsOut
) external returns (uint[] memory);
/// @dev Burning shares of vault and obtaining strategy assets.
/// @param assets_ Assets suitable for the strategy. Can be strategy assets, underlying asset or specific set of assets depending on strategy logic.
/// @param amountShares Shares amount for burning
/// @param minAssetAmountsOut Slippage tolerance. Minimal amounts of strategy assets that user must receive.
/// @param receiver Receiver of assets
/// @param owner Owner of vault shares
/// @return Amount of assets for withdraw. It's related to assets_ one-by-one.
function withdrawAssets(
address[] memory assets_,
uint amountShares,
uint[] memory minAssetAmountsOut,
address receiver,
address owner
) external returns (uint[] memory);
/// @dev Setting of vault capacity
/// @param maxShares If totalSupply() exceeds this value, deposits will not be possible
function setMaxSupply(uint maxShares) external;
/// @dev If activated will call doHardWork on strategy on some deposit actions
/// @param value HardWork on deposit is enabled
function setDoHardWorkOnDeposit(bool value) external;
/// @notice Initialization function for the vault.
/// @dev This function is usually called by the Factory during the creation of a new vault.
/// @param vaultInitializationData Data structure containing parameters for vault initialization.
function initialize(VaultInitializationData memory vaultInitializationData) external;
/// @dev Calling the strategy HardWork by operator with optional compensation for spent gas from the vault balance
function doHardWork() external;
/// @dev Changing ERC20 name of vault
function setName(string calldata newName) external;
/// @dev Changing ERC20 symbol of vault
function setSymbol(string calldata newSymbol) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
/// @dev Core interface of strategy logic
interface IStrategy is IERC165 {
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* EVENTS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
event HardWork(
uint apr, uint compoundApr, uint earned, uint tvl, uint duration, uint sharePrice, uint[] assetPrices
);
event ExtractFees(
uint vaultManagerReceiverFee,
uint strategyLogicReceiverFee,
uint ecosystemRevenueReceiverFee,
uint multisigReceiverFee
);
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CUSTOM ERRORS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
error NotReadyForHardWork();
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* DATA TYPES */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @custom:storage-location erc7201:stability.StrategyBase
struct StrategyBaseStorage {
/// @inheritdoc IStrategy
address vault;
/// @inheritdoc IStrategy
uint total;
/// @inheritdoc IStrategy
uint lastHardWork;
/// @inheritdoc IStrategy
uint lastApr;
/// @inheritdoc IStrategy
uint lastAprCompound;
/// @inheritdoc IStrategy
address[] _assets;
/// @inheritdoc IStrategy
address _underlying;
string _id;
uint _exchangeAssetIndex;
uint customPriceImpactTolerance;
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* VIEW FUNCTIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Strategy logic string ID
function strategyLogicId() external view returns (string memory);
/// @dev Extra data
/// @return 0-2 bytes - strategy color
/// 3-5 bytes - strategy background color
/// 6-31 bytes - free
function extra() external view returns (bytes32);
/// @dev Types of vault that supported by strategy implementation
/// @return types Vault type ID strings
function supportedVaultTypes() external view returns (string[] memory types);
/// @dev Linked vault address
function vault() external view returns (address);
/// @dev Final assets that strategy invests
function assets() external view returns (address[] memory);
/// @notice Final assets and amounts that strategy manages
function assetsAmounts() external view returns (address[] memory assets_, uint[] memory amounts_);
/// @notice Priced invested assets proportions
/// @return proportions Proportions of assets with 18 decimals. Min is 0, max is 1e18.
function getAssetsProportions() external view returns (uint[] memory proportions);
/// @notice Underlying token address
/// @dev Can be used for liquidity farming strategies where AMM has fungible liquidity token (Solidly forks, etc),
/// for concentrated liquidity tokenized vaults (Gamma, G-UNI etc) and for other needs.
/// @return Address of underlying token or zero address if no underlying in strategy
function underlying() external view returns (address);
/// @dev Balance of liquidity token or liquidity value
function total() external view returns (uint);
/// @dev Last HardWork time
/// @return Timestamp
function lastHardWork() external view returns (uint);
/// @dev Last APR of earned USD amount registered by HardWork
/// ONLY FOR OFF-CHAIN USE.
/// Not trusted asset price can be manipulated.
/// @return APR with 18 decimals. 1e18 - 100%.
function lastApr() external view returns (uint);
/// @dev Last APR of compounded assets registered by HardWork.
/// Can be used on-chain.
/// @return APR with 18 decimals. 1e18 - 100%.
function lastAprCompound() external view returns (uint);
/// @notice Calculation of consumed amounts and liquidity/underlying value for provided strategy assets and amounts.
/// @param assets_ Strategy assets or part of them, if necessary
/// @param amountsMax Amounts of specified assets available for investing
/// @return amountsConsumed Cosumed amounts of assets when investing
/// @return value Liquidity value or underlying token amount minted when investing
function previewDepositAssets(
address[] memory assets_,
uint[] memory amountsMax
) external view returns (uint[] memory amountsConsumed, uint value);
/// @notice Write version of previewDepositAssets
/// @param assets_ Strategy assets or part of them, if necessary
/// @param amountsMax Amounts of specified assets available for investing
/// @return amountsConsumed Cosumed amounts of assets when investing
/// @return value Liquidity value or underlying token amount minted when investing
function previewDepositAssetsWrite(
address[] memory assets_,
uint[] memory amountsMax
) external returns (uint[] memory amountsConsumed, uint value);
/// @notice All strategy revenue (pool fees, farm rewards etc) that not claimed by strategy yet
/// @return assets_ Revenue assets
/// @return amounts Amounts. Index of asset same as in previous array.
function getRevenue() external view returns (address[] memory assets_, uint[] memory amounts);
/// @notice Optional specific name of investing strategy, underyling type, setup variation etc
/// @return name Empty string or specific name
/// @return showInVaultSymbol Show specific in linked vault symbol
function getSpecificName() external view returns (string memory name, bool showInVaultSymbol);
/// @notice Variants pf strategy initializations with description of money making mechanic.
/// As example, if strategy need farm, then number of variations is number of available farms.
/// If CAMM strategy have set of available widths (tick ranges), then number of variations is number of available farms.
/// If both example conditions are met then total number or variations = total farms * total widths.
/// @param platform_ Need this param because method called when strategy implementation is not initialized
/// @return variants Descriptions of the strategy for making money
/// @return addresses Init strategy addresses. Indexes for each variants depends of copmpared arrays lengths.
/// @return nums Init strategy numbers. Indexes for each variants depends of copmpared arrays lengths.
/// @return ticks Init strategy ticks. Indexes for each variants depends of copmpared arrays lengths.
function initVariants(address platform_)
external
view
returns (string[] memory variants, address[] memory addresses, uint[] memory nums, int24[] memory ticks);
/// @notice How does the strategy make money?
/// @return Description in free form
function description() external view returns (string memory);
/// @notice Is HardWork on vault deposits can be enabled
function isHardWorkOnDepositAllowed() external view returns (bool);
/// @notice Is HardWork can be executed
function isReadyForHardWork() external view returns (bool);
/// @notice Strategy not need to process revenue on HardWorks
function autoCompoundingByUnderlyingProtocol() external view returns (bool);
/// @notice Custom price impact tolerance instead default need for specific cases where liquidity in pools is low
function customPriceImpactTolerance() external view returns (uint);
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* WRITE FUNCTIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev A single universal initializer for all strategy implementations.
/// @param addresses All addresses that strategy requires for initialization. Min array length is 2.
/// addresses[0]: platform (required)
/// addresses[1]: vault (required)
/// addresses[2]: initStrategyAddresses[0] (optional)
/// addresses[3]: initStrategyAddresses[1] (optional)
/// addresses[n]: initStrategyAddresses[n - 2] (optional)
/// @param nums All uint values that strategy requires for initialization. Min array length is 0.
/// @param ticks All int24 values that strategy requires for initialization. Min array length is 0.
function initialize(address[] memory addresses, uint[] memory nums, int24[] memory ticks) external;
/// @notice Invest strategy assets. Amounts of assets must be already on strategy contract balance.
/// Only vault can call this.
/// @param amounts Anounts of strategy assets
/// @return value Liquidity value or underlying token amount
function depositAssets(uint[] memory amounts) external returns (uint value);
/// @notice Invest underlying asset. Asset must be already on strategy contract balance.
/// Only vault can call this.
/// @param amount Amount of underlying asset to invest
/// @return amountsConsumed Cosumed amounts of invested assets
function depositUnderlying(uint amount) external returns (uint[] memory amountsConsumed);
/// @dev For specified amount of shares and assets_, withdraw strategy assets from farm/pool/staking and send to receiver if possible
/// Only vault can call this.
/// @param assets_ Here we give the user a choice of assets to withdraw if strategy support it
/// @param value Part of strategy total value to withdraw
/// @param receiver User address
/// @return amountsOut Amounts of assets sent to user
function withdrawAssets(
address[] memory assets_,
uint value,
address receiver
) external returns (uint[] memory amountsOut);
/// @notice Wothdraw underlying invested and send to receiver
/// Only vault can call this.
/// @param amount Ampunt of underlying asset to withdraw
/// @param receiver User of vault which withdraw underlying from the vault
function withdrawUnderlying(uint amount, address receiver) external;
/// @dev For specified amount of shares, transfer strategy assets from contract balance and send to receiver if possible
/// This method is called by vault w/o underlying on triggered fuse mode.
/// Only vault can call this.
/// @param amount Ampunt of liquidity value that user withdraw
/// @param totalAmount Total amount of strategy liquidity
/// @param receiver User of vault which withdraw assets
/// @return amountsOut Amounts of strategy assets sent to user
function transferAssets(
uint amount,
uint totalAmount,
address receiver
) external returns (uint[] memory amountsOut);
/// @notice Execute HardWork
/// During HardWork strategy claiming revenue and processing it.
/// Only vault can call this.
function doHardWork() external;
/// @notice Emergency stop investing by strategy, withdraw liquidity without rewards.
/// This action triggers FUSE mode.
/// Only governance or multisig can call this.
function emergencyStopInvesting() external;
/// @notice Custom price impact tolerance instead default need for specific cases where low liquidity in pools
/// @param priceImpactTolerance Tolerance percent with 100_000 DENOMINATOR. 4_000 == 4%
function setCustomPriceImpactTolerance(uint priceImpactTolerance) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;
/// @dev Combining oracle and DeX spot prices
/// @author Alien Deployer (https://github.com/a17)
/// @author Jude (https://github.com/iammrjude)
/// @author JodsMigel (https://github.com/JodsMigel)
interface IPriceReader {
//region ----- Events -----
event AdapterAdded(address adapter);
event AdapterRemoved(address adapter);
//endregion -- Events -----
/// @notice Price of asset
/// @dev Price of 1.0 amount of asset in USD
/// @param asset Address of asset
/// @return price USD price with 18 decimals
/// @return trusted Price from oracle
function getPrice(address asset) external view returns (uint price, bool trusted);
/// @notice Get USD price of specified assets and amounts
/// @param assets_ Addresses of assets
/// @param amounts_ Amount of asset. Index of asset same as in previous parameter.
/// @return total Total USD value with 18 decimals
/// @return assetAmountPrice USD price of asset amount. Index of assetAmountPrice same as in assets_ parameters.
/// @return assetPrice USD price of asset. Index of assetAmountPrice same as in assets_ parameters.
/// @return trusted True if only oracle prices was used for calculation.
function getAssetsPrice(
address[] memory assets_,
uint[] memory amounts_
) external view returns (uint total, uint[] memory assetAmountPrice, uint[] memory assetPrice, bool trusted);
/// @notice Add oracle adapter to PriceReader
/// Only operator (multisig is operator too) can add adapter
/// @param adapter_ Address of price oracle proxy
function addAdapter(address adapter_) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
/// @notice Interface of the main contract and entry point to the platform.
/// @author Alien Deployer (https://github.com/a17)
/// @author Jude (https://github.com/iammrjude)
/// @author JodsMigel (https://github.com/JodsMigel)
interface IPlatform {
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CUSTOM ERRORS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
error AlreadyAnnounced();
error SameVersion();
error NoNewVersion();
error UpgradeTimerIsNotOver(uint TimerTimestamp);
error IncorrectFee(uint minFee, uint maxFee);
error NotEnoughAllowedBBToken();
error TokenAlreadyExistsInSet(address token);
error AggregatorNotExists(address dexAggRouter);
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* EVENTS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
event PlatformVersion(string version);
event UpgradeAnnounce(
string oldVersion, string newVersion, address[] proxies, address[] newImplementations, uint timelock
);
event CancelUpgrade(string oldVersion, string newVersion);
event ProxyUpgraded(
address indexed proxy, address implementation, string oldContractVersion, string newContractVersion
);
event Addresses(
address multisig_,
address factory_,
address priceReader_,
address swapper_,
address buildingPermitToken_,
address vaultManager_,
address strategyLogic_,
address aprOracle_,
address hardWorker,
address rebalancer,
address zap,
address bridge
);
event OperatorAdded(address operator);
event OperatorRemoved(address operator);
event FeesChanged(uint fee, uint feeShareVaultManager, uint feeShareStrategyLogic, uint feeShareEcosystem);
event MinInitialBoostChanged(uint minInitialBoostPerDay, uint minInitialBoostDuration);
event NewAmmAdapter(string id, address proxy);
event EcosystemRevenueReceiver(address receiver);
event SetAllowedBBTokenVaults(address bbToken, uint vaultsToBuild, bool firstSet);
event RemoveAllowedBBToken(address bbToken);
event AddAllowedBoostRewardToken(address token);
event RemoveAllowedBoostRewardToken(address token);
event AddDefaultBoostRewardToken(address token);
event RemoveDefaultBoostRewardToken(address token);
event AddBoostTokens(address[] allowedBoostRewardToken, address[] defaultBoostRewardToken);
event AllowedBBTokenVaultUsed(address bbToken, uint vaultToUse);
event AddDexAggregator(address router);
event RemoveDexAggregator(address router);
event MinTvlForFreeHardWorkChanged(uint oldValue, uint newValue);
event CustomVaultFee(address vault, uint platformFee);
event Rebalancer(address rebalancer_);
event Bridge(address bridge_);
event RevenueRouter(address revenueRouter_);
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* DATA TYPES */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
struct PlatformUpgrade {
string newVersion;
address[] proxies;
address[] newImplementations;
}
struct PlatformSettings {
string networkName;
bytes32 networkExtra;
uint fee;
uint feeShareVaultManager;
uint feeShareStrategyLogic;
uint feeShareEcosystem;
uint minInitialBoostPerDay;
uint minInitialBoostDuration;
}
struct AmmAdapter {
string id;
address proxy;
}
struct SetupAddresses {
address factory;
address priceReader;
address swapper;
address buildingPermitToken;
address buildingPayPerVaultToken;
address vaultManager;
address strategyLogic;
address aprOracle;
address targetExchangeAsset;
address hardWorker;
address zap;
address revenueRouter;
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* VIEW FUNCTIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @notice Platform version in CalVer scheme: YY.MM.MINOR-tag. Updates on core contract upgrades.
function platformVersion() external view returns (string memory);
/// @notice Time delay for proxy upgrades of core contracts and changing important platform settings by multisig
//slither-disable-next-line naming-convention
function TIME_LOCK() external view returns (uint);
/// @notice DAO governance
function governance() external view returns (address);
/// @notice Core team multi signature wallet. Development and operations fund
function multisig() external view returns (address);
/// @notice This NFT allow user to build limited number of vaults per week
function buildingPermitToken() external view returns (address);
/// @notice This ERC20 token is used as payment token for vault building
function buildingPayPerVaultToken() external view returns (address);
/// @notice Receiver of ecosystem revenue
function ecosystemRevenueReceiver() external view returns (address);
/// @dev The best asset in a network for swaps between strategy assets and farms rewards assets
/// The target exchange asset is used for finding the best strategy's exchange asset.
/// Rhe fewer routes needed to swap to the target exchange asset, the better.
function targetExchangeAsset() external view returns (address);
/// @notice Platform factory assembling vaults. Stores settings, strategy logic, farms.
/// Provides the opportunity to upgrade vaults and strategies.
/// @return Address of Factory proxy
function factory() external view returns (address);
/// @notice The holders of these NFT receive a share of the vault revenue
/// @return Address of VaultManager proxy
function vaultManager() external view returns (address);
/// @notice The holders of these tokens receive a share of the revenue received in all vaults using this strategy logic.
function strategyLogic() external view returns (address);
/// @notice Combining oracle and DeX spot prices
/// @return Address of PriceReader proxy
function priceReader() external view returns (address);
/// @notice Providing underlying assets APRs on-chain
/// @return Address of AprOracle proxy
function aprOracle() external view returns (address);
/// @notice On-chain price quoter and swapper
/// @return Address of Swapper proxy
function swapper() external view returns (address);
/// @notice HardWork resolver and caller
/// @return Address of HardWorker proxy
function hardWorker() external view returns (address);
/// @notice Rebalance resolver
/// @return Address of Rebalancer proxy
function rebalancer() external view returns (address);
/// @notice ZAP feature
/// @return Address of Zap proxy
function zap() external view returns (address);
/// @notice Platform revenue distributor
/// @return Address of the revenue distributor proxy
function revenueRouter() external view returns (address);
/// @notice Name of current EVM network
function networkName() external view returns (string memory);
/// @notice Minimal initial boost rewards per day USD amount which needs to create rewarding vault
function minInitialBoostPerDay() external view returns (uint);
/// @notice Minimal boost rewards vesting duration for initial boost
function minInitialBoostDuration() external view returns (uint);
/// @notice This function provides the timestamp of the platform upgrade timelock.
/// @dev This function is an external view function, meaning it doesn't modify the state.
/// @return uint representing the timestamp of the platform upgrade timelock.
function platformUpgradeTimelock() external view returns (uint);
/// @dev Extra network data
/// @return 0-2 bytes - color
/// 3-5 bytes - background color
/// 6-31 bytes - free
function networkExtra() external view returns (bytes32);
/// @notice Pending platform upgrade data
function pendingPlatformUpgrade() external view returns (PlatformUpgrade memory);
/// @notice Get platform revenue fee settings
/// @return fee Revenue fee % (between MIN_FEE - MAX_FEE) with DENOMINATOR precision.
/// @return feeShareVaultManager Revenue fee share % of VaultManager tokenId owner
/// @return feeShareStrategyLogic Revenue fee share % of StrategyLogic tokenId owner
/// @return feeShareEcosystem Revenue fee share % of ecosystemFeeReceiver
function getFees()
external
view
returns (uint fee, uint feeShareVaultManager, uint feeShareStrategyLogic, uint feeShareEcosystem);
/// @notice Get custom vault platform fee
/// @return fee revenue fee % with DENOMINATOR precision
function getCustomVaultFee(address vault) external view returns (uint fee);
/// @notice Platform settings
function getPlatformSettings() external view returns (PlatformSettings memory);
/// @notice AMM adapters of the platform
function getAmmAdapters() external view returns (string[] memory id, address[] memory proxy);
/// @notice Get AMM adapter data by hash
/// @param ammAdapterIdHash Keccak256 hash of adapter ID string
/// @return ID string and proxy address of AMM adapter
function ammAdapter(bytes32 ammAdapterIdHash) external view returns (AmmAdapter memory);
/// @notice Allowed buy-back tokens for rewarding vaults
function allowedBBTokens() external view returns (address[] memory);
/// @notice Vaults building limit for buy-back token.
/// This limit decrements when a vault for BB-token is built.
/// @param token Allowed buy-back token
/// @return vaultsLimit Number of vaults that can be built for BB-token
function allowedBBTokenVaults(address token) external view returns (uint vaultsLimit);
/// @notice Vaults building limits for allowed buy-back tokens.
/// @return bbToken Allowed buy-back tokens
/// @return vaultsLimit Number of vaults that can be built for BB-tokens
function allowedBBTokenVaults() external view returns (address[] memory bbToken, uint[] memory vaultsLimit);
/// @notice Non-zero vaults building limits for allowed buy-back tokens.
/// @return bbToken Allowed buy-back tokens
/// @return vaultsLimit Number of vaults that can be built for BB-tokens
function allowedBBTokenVaultsFiltered()
external
view
returns (address[] memory bbToken, uint[] memory vaultsLimit);
/// @notice Check address for existance in operators list
/// @param operator Address
/// @return True if this address is Stability Operator
function isOperator(address operator) external view returns (bool);
/// @notice Tokens that can be used for boost rewards of rewarding vaults
/// @return Addresses of tokens
function allowedBoostRewardTokens() external view returns (address[] memory);
/// @notice Allowed boost reward tokens that used for unmanaged rewarding vaults creation
/// @return Addresses of tokens
function defaultBoostRewardTokens() external view returns (address[] memory);
/// @notice Allowed boost reward tokens that used for unmanaged rewarding vaults creation
/// @param addressToRemove This address will be removed from default boost reward tokens
/// @return Addresses of tokens
function defaultBoostRewardTokensFiltered(address addressToRemove) external view returns (address[] memory);
/// @notice Allowed DeX aggregators
/// @return Addresses of DeX aggregator rounters
function dexAggregators() external view returns (address[] memory);
/// @notice DeX aggregator router address is allowed to be used in the platform
/// @param dexAggRouter Address of DeX aggreagator router
/// @return Can be used
function isAllowedDexAggregatorRouter(address dexAggRouter) external view returns (bool);
/// @notice Show minimum TVL for compensate if vault has not enough ETH
/// @return Minimum TVL for compensate.
function minTvlForFreeHardWork() external view returns (uint);
/// @notice Front-end platform viewer
/// @return platformAddresses Platform core addresses
/// platformAddresses[0] factory
/// platformAddresses[1] vaultManager
/// platformAddresses[2] strategyLogic
/// platformAddresses[3] buildingPermitToken
/// platformAddresses[4] buildingPayPerVaultToken
/// platformAddresses[5] governance
/// platformAddresses[6] multisig
/// platformAddresses[7] zap
/// platformAddresses[8] bridge
/// @return bcAssets Blue chip token addresses
/// @return dexAggregators_ DeX aggregators allowed to be used entire the platform
/// @return vaultType Vault type ID strings
/// @return vaultExtra Vault color, background color and other extra data. Index of vault same as in previous array.
/// @return vaultBulldingPrice Price of creating new vault in buildingPayPerVaultToken. Index of vault same as in previous array.
/// @return strategyId Strategy logic ID strings
/// @return isFarmingStrategy True if strategy is farming strategy. Index of strategy same as in previous array.
/// @return strategyTokenURI StrategyLogic NFT tokenId metadata and on-chain image. Index of strategy same as in previous array.
/// @return strategyExtra Strategy color, background color and other extra data. Index of strategy same as in previous array.
function getData()
external
view
returns (
address[] memory platformAddresses,
address[] memory bcAssets,
address[] memory dexAggregators_,
string[] memory vaultType,
bytes32[] memory vaultExtra,
uint[] memory vaultBulldingPrice,
string[] memory strategyId,
bool[] memory isFarmingStrategy,
string[] memory strategyTokenURI,
bytes32[] memory strategyExtra
);
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* WRITE FUNCTIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @notice Add platform operator.
/// Only governance and multisig can add operator.
/// @param operator Address of new operator
function addOperator(address operator) external;
/// @notice Remove platform operator.
/// Only governance and multisig can remove operator.
/// @param operator Address of operator to remove
function removeOperator(address operator) external;
/// @notice Announce upgrade of platform proxies implementations
/// Only governance and multisig can announce platform upgrades.
/// @param newVersion New platform version. Version must be changed when upgrading.
/// @param proxies Addresses of core contract proxies
/// @param newImplementations New implementation for proxy. Index of proxy same as in previous array.
function announcePlatformUpgrade(
string memory newVersion,
address[] memory proxies,
address[] memory newImplementations
) external;
/// @notice Upgrade platform
/// Only operator (multisig is operator too) can ececute pending platform upgrade
function upgrade() external;
/// @notice Cancel pending platform upgrade
/// Only operator (multisig is operator too) can ececute pending platform upgrade
function cancelUpgrade() external;
/// @notice Register AMM adapter in platform
/// @param id AMM adapter ID string from AmmAdapterIdLib
/// @param proxy Address of AMM adapter proxy
function addAmmAdapter(string memory id, address proxy) external;
// todo Only governance and multisig can set allowed bb-token vaults building limit
/// @notice Set new vaults building limit for buy-back token
/// @param bbToken Address of allowed buy-back token
/// @param vaultsToBuild Number of vaults that can be built for BB-token
function setAllowedBBTokenVaults(address bbToken, uint vaultsToBuild) external;
// todo Only governance and multisig can add allowed boost reward token
/// @notice Add new allowed boost reward token
/// @param token Address of token
function addAllowedBoostRewardToken(address token) external;
// todo Only governance and multisig can remove allowed boost reward token
/// @notice Remove allowed boost reward token
/// @param token Address of allowed boost reward token
function removeAllowedBoostRewardToken(address token) external;
// todo Only governance and multisig can add default boost reward token
/// @notice Add default boost reward token
/// @param token Address of default boost reward token
function addDefaultBoostRewardToken(address token) external;
// todo Only governance and multisig can remove default boost reward token
/// @notice Remove default boost reward token
/// @param token Address of allowed boost reward token
function removeDefaultBoostRewardToken(address token) external;
// todo Only governance and multisig can add allowed boost reward token
// todo Only governance and multisig can add default boost reward token
/// @notice Add new allowed boost reward token
/// @notice Add default boost reward token
/// @param allowedBoostRewardToken Address of allowed boost reward token
/// @param defaultBoostRewardToken Address of default boost reward token
function addBoostTokens(
address[] memory allowedBoostRewardToken,
address[] memory defaultBoostRewardToken
) external;
/// @notice Decrease allowed BB-token vault building limit when vault is built
/// Only Factory can do it.
/// @param bbToken Address of allowed buy-back token
function useAllowedBBTokenVault(address bbToken) external;
/// @notice Allow DeX aggregator routers to be used in the platform
/// @param dexAggRouter Addresses of DeX aggreagator routers
function addDexAggregators(address[] memory dexAggRouter) external;
/// @notice Remove allowed DeX aggregator router from the platform
/// @param dexAggRouter Address of DeX aggreagator router
function removeDexAggregator(address dexAggRouter) external;
/// @notice Change initial boost rewards settings
/// @param minInitialBoostPerDay_ Minimal initial boost rewards per day USD amount which needs to create rewarding vault
/// @param minInitialBoostDuration_ Minimal boost rewards vesting duration for initial boost
function setInitialBoost(uint minInitialBoostPerDay_, uint minInitialBoostDuration_) external;
/// @notice Update new minimum TVL for compensate.
/// @param value New minimum TVL for compensate.
function setMinTvlForFreeHardWork(uint value) external;
/// @notice Set custom platform fee for vault
/// @param vault Vault address
/// @param platformFee Custom platform fee
function setCustomVaultFee(address vault, uint platformFee) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;
/// @dev This oracle is needed to obtain APR of underlying assets in an on-chain environment.
/// These APRs are usually accessible from the protocol APIs.
// Such data is needed on-chain for the operation of automatic vaults,
/// which can themselves select assets to work with, and to show the overall APR of the strategy in VaultManager NFT.
/// @author Alien Deployer (https://github.com/a17)
/// @author Jude (https://github.com/iammrjude)
/// @author JodsMigel (https://github.com/JodsMigel)
interface IAprOracle {
//region ----- Events -----
event SetAprs(address[] assets, uint[] aprs);
//endregion -- Events -----
/// @notice Get stored APR of assets with APR
/// @param assets Underlying assets. Can be liquidity managing vault (Gamma's HyperVisor etc), LST (stETH etc) or other
/// @return aprs APRs stored in oracle with 18 decimals precision
function getAprs(address[] memory assets) external view returns (uint[] memory aprs);
/// @notice Set APRs for asset with APR
/// @param assets Underlying assets. Can be liquidity managing vault (Gamma's HyperVisor etc), LST (stETH etc) or other
/// @param aprs Underlying APRs with 18 decimals precision
function setAprs(address[] memory assets, uint[] memory aprs) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
/// @notice Creating vaults, upgrading vaults and strategies, vault list, farms and strategy logics management
/// @author Alien Deployer (https://github.com/a17)
/// @author Jude (https://github.com/iammrjude)
/// @author JodsMigel (https://github.com/JodsMigel)
/// @author HCrypto7 (https://github.com/hcrypto7)
interface IFactory {
//region ----- Custom Errors -----
error VaultImplementationIsNotAvailable();
error VaultNotAllowedToDeploy();
error StrategyImplementationIsNotAvailable();
error StrategyLogicNotAllowedToDeploy();
error YouDontHaveEnoughTokens(uint userBalance, uint requireBalance, address payToken);
error SuchVaultAlreadyDeployed(bytes32 key);
error NotActiveVault();
error UpgradeDenied(bytes32 _hash);
error AlreadyLastVersion(bytes32 _hash);
error NotStrategy();
error BoostDurationTooLow();
error BoostAmountTooLow();
error BoostAmountIsZero();
//endregion ----- Custom Errors -----
//region ----- Events -----
event VaultAndStrategy(
address indexed deployer,
string vaultType,
string strategyId,
address vault,
address strategy,
string name,
string symbol,
address[] assets,
bytes32 deploymentKey,
uint vaultManagerTokenId
);
event StrategyProxyUpgraded(address proxy, address oldImplementation, address newImplementation);
event VaultProxyUpgraded(address proxy, address oldImplementation, address newImplementation);
event VaultConfigChanged(
string type_, address implementation, bool deployAllowed, bool upgradeAllowed, bool newVaultType
);
event StrategyLogicConfigChanged(
string id, address implementation, bool deployAllowed, bool upgradeAllowed, bool newStrategy
);
event VaultStatus(address indexed vault, uint newStatus);
event NewFarm(Farm[] farms);
event UpdateFarm(uint id, Farm farm);
event SetStrategyAvailableInitParams(string id, address[] initAddresses, uint[] initNums, int24[] initTicks);
event AliasNameChanged(address indexed operator, address indexed tokenAddress, string newAliasName);
//endregion -- Events -----
//region ----- Data types -----
/// @custom:storage-location erc7201:stability.Factory
struct FactoryStorage {
/// @inheritdoc IFactory
mapping(bytes32 typeHash => VaultConfig) vaultConfig;
/// @inheritdoc IFactory
mapping(bytes32 idHash => StrategyLogicConfig) strategyLogicConfig;
/// @inheritdoc IFactory
mapping(bytes32 deploymentKey => address vaultProxy) deploymentKey;
/// @inheritdoc IFactory
mapping(address vault => uint status) vaultStatus;
/// @inheritdoc IFactory
mapping(address address_ => bool isStrategy_) isStrategy;
EnumerableSet.Bytes32Set vaultTypeHashes;
EnumerableSet.Bytes32Set strategyLogicIdHashes;
mapping(uint week => mapping(uint builderPermitTokenId => uint vaultsBuilt)) vaultsBuiltByPermitTokenId;
address[] deployedVaults;
Farm[] farms;
/// @inheritdoc IFactory
mapping(bytes32 idHash => StrategyAvailableInitParams) strategyAvailableInitParams;
mapping(address tokenAddress => string aliasName) aliasNames;
}
struct VaultConfig {
string vaultType;
address implementation;
bool deployAllowed;
bool upgradeAllowed;
uint buildingPrice;
}
struct StrategyLogicConfig {
string id;
address implementation;
bool deployAllowed;
bool upgradeAllowed;
bool farming;
uint tokenId;
}
struct Farm {
uint status;
address pool;
string strategyLogicId;
address[] rewardAssets;
address[] addresses;
uint[] nums;
int24[] ticks;
}
struct StrategyAvailableInitParams {
address[] initAddresses;
uint[] initNums;
int24[] initTicks;
}
//endregion -- Data types -----
//region ----- View functions -----
/// @notice All vaults deployed by the factory
/// @return Vault proxy addresses
function deployedVaults() external view returns (address[] memory);
/// @notice Total vaults deployed
function deployedVaultsLength() external view returns (uint);
/// @notice Get vault by VaultManager tokenId
/// @param id Vault array index. Same as tokenId of VaultManager NFT
/// @return Address of VaultProxy
function deployedVault(uint id) external view returns (address);
/// @notice All farms known by the factory in current network
function farms() external view returns (Farm[] memory);
/// @notice Total farms known by the factory in current network
function farmsLength() external view returns (uint);
/// @notice Farm data by farm index
/// @param id Index of farm
function farm(uint id) external view returns (Farm memory);
/// @notice Strategy logic settings
/// @param idHash keccak256 hash of strategy logic string ID
/// @return config Strategy logic settings
function strategyLogicConfig(bytes32 idHash) external view returns (StrategyLogicConfig memory config);
/// @notice All known strategies
/// @return Array of keccak256 hashes of strategy logic string ID
function strategyLogicIdHashes() external view returns (bytes32[] memory);
// todo remove, use new function without calculating vault symbol on the fly for not initialized vaults
// factory required that special functionally only internally, not for interface
function getStrategyData(
string memory vaultType,
address strategyAddress,
address bbAsset
)
external
view
returns (
string memory strategyId,
address[] memory assets,
string[] memory assetsSymbols,
string memory specificName,
string memory vaultSymbol
);
/// @dev Get best asset of assets to be strategy exchange asset
function getExchangeAssetIndex(address[] memory assets) external view returns (uint);
/// @notice Deployment key of created vault
/// @param deploymentKey_ Hash of concatenated unique vault and strategy initialization parameters
/// @return Address of deployed vault
function deploymentKey(bytes32 deploymentKey_) external view returns (address);
/// @notice Calculating deployment key based on unique vault and strategy initialization parameters
/// @param vaultType Vault type string
/// @param strategyId Strategy logic Id string
/// @param vaultInitAddresses Vault initialization addresses for deployVaultAndStrategy method
/// @param vaultInitNums Vault initialization uint numbers for deployVaultAndStrategy method
/// @param strategyInitAddresses Strategy initialization addresses for deployVaultAndStrategy method
/// @param strategyInitNums Strategy initialization uint numbers for deployVaultAndStrategy method
/// @param strategyInitTicks Strategy initialization int24 ticks for deployVaultAndStrategy method
function getDeploymentKey(
string memory vaultType,
string memory strategyId,
address[] memory vaultInitAddresses,
uint[] memory vaultInitNums,
address[] memory strategyInitAddresses,
uint[] memory strategyInitNums,
int24[] memory strategyInitTicks
) external view returns (bytes32);
/// @notice Available variants of new vault for creating.
/// DEPRECATED: use IFrontend.whatToBuild
/// The structure of the function's output values is complex,
/// but after parsing them, the front end has all the data to generate a list of vaults to create.
/// @return desc Descriptions of the strategy for making money
/// @return vaultType Vault type strings. Output values are matched by index with previous array.
/// @return strategyId Strategy logic ID strings. Output values are matched by index with previous array.
/// @return initIndexes Map of start and end indexes in next 5 arrays. Output values are matched by index with previous array.
/// [0] Start index in vaultInitAddresses
/// [1] End index in vaultInitAddresses
/// [2] Start index in vaultInitNums
/// [3] End index in vaultInitNums
/// [4] Start index in strategyInitAddresses
/// [5] End index in strategyInitAddresses
/// [6] Start index in strategyInitNums
/// [7] End index in strategyInitNums
/// [8] Start index in strategyInitTicks
/// [9] End index in strategyInitTicks
/// @return vaultInitAddresses Vault initialization addresses for deployVaultAndStrategy method for all building variants.
/// @return vaultInitNums Vault initialization uint numbers for deployVaultAndStrategy method for all building variants.
/// @return strategyInitAddresses Strategy initialization addresses for deployVaultAndStrategy method for all building variants.
/// @return strategyInitNums Strategy initialization uint numbers for deployVaultAndStrategy method for all building variants.
/// @return strategyInitTicks Strategy initialization int24 ticks for deployVaultAndStrategy method for all building variants.
function whatToBuild()
external
view
returns (
string[] memory desc,
string[] memory vaultType,
string[] memory strategyId,
uint[10][] memory initIndexes,
address[] memory vaultInitAddresses,
uint[] memory vaultInitNums,
address[] memory strategyInitAddresses,
uint[] memory strategyInitNums,
int24[] memory strategyInitTicks
);
/// @notice Governance and multisig can set a vault status other than Active - the default status.
/// HardWorker only works with active vaults.
/// @return status Constant from VaultStatusLib
function vaultStatus(address vault) external view returns (uint status);
/// @notice Check that strategy proxy deployed by the Factory
/// @param address_ Address of contract
/// @return This address is our strategy proxy
function isStrategy(address address_) external view returns (bool);
/// @notice How much vaults was built by builderPermitToken NFT tokenId in week
/// @param week Week index (timestamp / (86400 * 7))
/// @param builderPermitTokenId Token ID of buildingPermitToken NFT
/// @return vaultsBuilt Vaults built
function vaultsBuiltByPermitTokenId(
uint week,
uint builderPermitTokenId
) external view returns (uint vaultsBuilt);
/// @notice Data on all factory strategies.
/// The output values are matched by index in the arrays.
/// @return id Strategy logic ID strings
/// @return deployAllowed New vaults can be deployed
/// @return upgradeAllowed Strategy can be upgraded
/// @return farming It is farming strategy (earns farming/gauge rewards)
/// @return tokenId Token ID of StrategyLogic NFT
/// @return tokenURI StrategyLogic NFT tokenId metadata and on-chain image
/// @return extra Strategy color, background color and other extra data
function strategies()
external
view
returns (
string[] memory id,
bool[] memory deployAllowed,
bool[] memory upgradeAllowed,
bool[] memory farming,
uint[] memory tokenId,
string[] memory tokenURI,
bytes32[] memory extra
);
/// @notice Get config of vault type
/// @param typeHash Keccak256 hash of vault type string
/// @return vaultType Vault type string
/// @return implementation Vault implementation address
/// @return deployAllowed New vaults can be deployed
/// @return upgradeAllowed Vaults can be upgraded
/// @return buildingPrice Price of building new vault
function vaultConfig(bytes32 typeHash)
external
view
returns (
string memory vaultType,
address implementation,
bool deployAllowed,
bool upgradeAllowed,
uint buildingPrice
);
/// @notice Data on all factory vault types
/// The output values are matched by index in the arrays.
/// @return vaultType Vault type string
/// @return implementation Address of vault implemented logic
/// @return deployAllowed New vaults can be deployed
/// @return upgradeAllowed Vaults can be upgraded
/// @return buildingPrice Price of building new vault
/// @return extra Vault type color, background color and other extra data
function vaultTypes()
external
view
returns (
string[] memory vaultType,
address[] memory implementation,
bool[] memory deployAllowed,
bool[] memory upgradeAllowed,
uint[] memory buildingPrice,
bytes32[] memory extra
);
/// @notice Initialization strategy params store
function strategyAvailableInitParams(bytes32 idHash) external view returns (StrategyAvailableInitParams memory);
/// @notice Retrieves the alias name associated with a given address
/// @param tokenAddress_ The address to query for its alias name
/// @return The alias name associated with the provided address
function getAliasName(address tokenAddress_) external view returns (string memory);
//endregion -- View functions -----
//region ----- Write functions -----
/// @notice Main method of the Factory - new vault creation by user.
/// @param vaultType Vault type ID string
/// @param strategyId Strategy logic ID string
/// Different types of vaults and strategies have different lengths of input arrays.
/// @param vaultInitAddresses Addresses for vault initialization
/// @param vaultInitNums Numbers for vault initialization
/// @param strategyInitAddresses Addresses for strategy initialization
/// @param strategyInitNums Numbers for strategy initialization
/// @param strategyInitTicks Ticks for strategy initialization
/// @return vault Deployed VaultProxy address
/// @return strategy Deployed StrategyProxy address
function deployVaultAndStrategy(
string memory vaultType,
string memory strategyId,
address[] memory vaultInitAddresses,
uint[] memory vaultInitNums,
address[] memory strategyInitAddresses,
uint[] memory strategyInitNums,
int24[] memory strategyInitTicks
) external returns (address vault, address strategy);
/// @notice Upgrade vault proxy. Can be called by any address.
/// @param vault Address of vault proxy for upgrade
function upgradeVaultProxy(address vault) external;
/// @notice Upgrade strategy proxy. Can be called by any address.
/// @param strategy Address of strategy proxy for upgrade
function upgradeStrategyProxy(address strategy) external;
/// @notice Add farm to factory
/// @param farms_ Settings and data required to work with the farm.
function addFarms(Farm[] memory farms_) external;
/// @notice Update farm
/// @param id Farm index
/// @param farm_ Settings and data required to work with the farm.
function updateFarm(uint id, Farm memory farm_) external;
/// @notice Initial addition or change of vault type settings.
/// Operator can add new vault type. Governance or multisig can change existing vault type config.
/// @param vaultConfig_ Vault type settings
function setVaultConfig(VaultConfig memory vaultConfig_) external;
/// @notice Initial addition or change of strategy logic settings.
/// Operator can add new strategy logic. Governance or multisig can change existing logic config.
/// @param config Strategy logic settings
/// @param developer Strategy developer is receiver of minted StrategyLogic NFT on initial addition
function setStrategyLogicConfig(StrategyLogicConfig memory config, address developer) external;
/// @notice Governance and multisig can set a vault status other than Active - the default status.
/// @param vaults Addresses of vault proxy
/// @param statuses New vault statuses. Constant from VaultStatusLib
function setVaultStatus(address[] memory vaults, uint[] memory statuses) external;
/// @notice Initial addition or change of strategy available init params
/// @param id Strategy ID string
/// @param initParams Init params variations that will be parsed by strategy
function setStrategyAvailableInitParams(string memory id, StrategyAvailableInitParams memory initParams) external;
/// @notice Assigns a new alias name to a specific address
/// @dev This function may require certain permissions to be called successfully.
/// @param tokenAddress_ The address to assign an alias name to
/// @param aliasName_ The alias name to assign to the given address
function setAliasName(address tokenAddress_, string memory aliasName_) external;
//endregion -- Write functions -----
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
interface IRevenueRouter {
error WaitForNewPeriod();
/// @notice Update the epoch (period) -- callable once a week at >= Thursday 0 UTC
/// @return newPeriod The new period
function updatePeriod() external returns (uint newPeriod);
/// @notice Process platform fee in form of an asset
function processFeeAsset(address asset, uint amount) external;
/// @notice Process platform fee in form of an vault shares
function processFeeVault(address vault, uint amount) external;
/// @notice The period used for rewarding
/// @return The block.timestamp divided by 1 week in seconds
function getPeriod() external view returns (uint);
/// @notice Current active period
function activePeriod() external view returns (uint);
/// @notice Accumulated STBL amount for next distribution
function pendingRevenue() external view returns (uint);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)
pragma solidity ^0.8.20;
import {Math} from "./math/Math.sol";
import {SignedMath} from "./math/SignedMath.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant HEX_DIGITS = "0123456789abcdef";
uint8 private constant ADDRESS_LENGTH = 20;
/**
* @dev The `value` string doesn't fit in the specified `length`.
*/
error StringsInsufficientHexLength(uint256 value, uint256 length);
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toStringSigned(int256 value) internal pure returns (string memory) {
return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value)));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
uint256 localValue = value;
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = HEX_DIGITS[localValue & 0xf];
localValue >>= 4;
}
if (localValue != 0) {
revert StringsInsufficientHexLength(value, length);
}
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal
* representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Context.sol)
pragma solidity ^0.8.20;
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @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 ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
}
function __Context_init_unchained() internal onlyInitializing {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard ERC20 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.
*/
interface IERC20Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC20InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC20InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
* @param spender Address that may be allowed to operate on tokens without being their owner.
* @param allowance Amount of tokens a `spender` is allowed to operate with.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC20InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `spender` to be approved. Used in approvals.
* @param spender Address that may be allowed to operate on tokens without being their owner.
*/
error ERC20InvalidSpender(address spender);
}
/**
* @dev Standard ERC721 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.
*/
interface IERC721Errors {
/**
* @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.
* Used in balance queries.
* @param owner Address of the current owner of a token.
*/
error ERC721InvalidOwner(address owner);
/**
* @dev Indicates a `tokenId` whose `owner` is the zero address.
* @param tokenId Identifier number of a token.
*/
error ERC721NonexistentToken(uint256 tokenId);
/**
* @dev Indicates an error related to the ownership over a particular token. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param tokenId Identifier number of a token.
* @param owner Address of the current owner of a token.
*/
error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC721InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC721InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param tokenId Identifier number of a token.
*/
error ERC721InsufficientApproval(address operator, uint256 tokenId);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC721InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC721InvalidOperator(address operator);
}
/**
* @dev Standard ERC1155 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.
*/
interface IERC1155Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
* @param tokenId Identifier number of a token.
*/
error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC1155InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC1155InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param owner Address of the current owner of a token.
*/
error ERC1155MissingApprovalForAll(address operator, address owner);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC1155InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC1155InvalidOperator(address operator);
/**
* @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
* Used in batch transfers.
* @param idsLength Length of the array of token identifiers
* @param valuesLength Length of the array of token amounts
*/
error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.20;
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Storage of the initializable contract.
*
* It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
* when using with upgradeable contracts.
*
* @custom:storage-location erc7201:openzeppelin.storage.Initializable
*/
struct InitializableStorage {
/**
* @dev Indicates that the contract has been initialized.
*/
uint64 _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool _initializing;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;
/**
* @dev The contract is already initialized.
*/
error InvalidInitialization();
/**
* @dev The contract is not initializing.
*/
error NotInitializing();
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint64 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
* number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
* production.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
// Cache values to avoid duplicated sloads
bool isTopLevelCall = !$._initializing;
uint64 initialized = $._initialized;
// Allowed calls:
// - initialSetup: the contract is not in the initializing state and no previous version was
// initialized
// - construction: the contract is initialized at version 1 (no reininitialization) and the
// current contract is just being deployed
bool initialSetup = initialized == 0 && isTopLevelCall;
bool construction = initialized == 1 && address(this).code.length == 0;
if (!initialSetup && !construction) {
revert InvalidInitialization();
}
$._initialized = 1;
if (isTopLevelCall) {
$._initializing = true;
}
_;
if (isTopLevelCall) {
$._initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint64 version) {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
if ($._initializing || $._initialized >= version) {
revert InvalidInitialization();
}
$._initialized = version;
$._initializing = true;
_;
$._initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
_checkInitializing();
_;
}
/**
* @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
*/
function _checkInitializing() internal view virtual {
if (!_isInitializing()) {
revert NotInitializing();
}
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
if ($._initializing) {
revert InvalidInitialization();
}
if ($._initialized != type(uint64).max) {
$._initialized = type(uint64).max;
emit Initialized(type(uint64).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint64) {
return _getInitializableStorage()._initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _getInitializableStorage()._initializing;
}
/**
* @dev Returns a pointer to the storage namespace.
*/
// solhint-disable-next-line var-name-mixedcase
function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
assembly {
$.slot := INITIALIZABLE_STORAGE
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*
* CAUTION: See Security Considerations above.
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error AddressInsufficientBalance(address account);
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedInnerCall();
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
if (address(this).balance < amount) {
revert AddressInsufficientBalance(address(this));
}
(bool success, ) = recipient.call{value: amount}("");
if (!success) {
revert FailedInnerCall();
}
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason or custom error, it is bubbled
* up by this function (like regular Solidity function calls). However, if
* the call reverted with no returned reason, this function reverts with a
* {FailedInnerCall} error.
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
if (address(this).balance < value) {
revert AddressInsufficientBalance(address(this));
}
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
* was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
* unsuccessful call.
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
// only check if target is a contract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
if (returndata.length == 0 && target.code.length == 0) {
revert AddressEmptyCode(target);
}
return returndata;
}
}
/**
* @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
* revert reason or with a default {FailedInnerCall} error.
*/
function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
return returndata;
}
}
/**
* @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
*/
function _revert(bytes memory returndata) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert FailedInnerCall();
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;
/// @title Minimal library for setting / getting slot variables (used in upgradable proxy contracts)
library SlotsLib {
/// @dev Gets a slot as an address
function getAddress(bytes32 slot) internal view returns (address result) {
assembly {
result := sload(slot)
}
}
/// @dev Gets a slot as uint256
function getUint(bytes32 slot) internal view returns (uint result) {
assembly {
result := sload(slot)
}
}
/// @dev Sets a slot with address
/// @notice Check address for 0 at the setter
function set(bytes32 slot, address value) internal {
assembly {
sstore(slot, value)
}
}
/// @dev Sets a slot with uint
function set(bytes32 slot, uint value) internal {
assembly {
sstore(slot, value)
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.
pragma solidity ^0.8.20;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```solidity
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*
* [WARNING]
* ====
* Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
* unusable.
* See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
*
* In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
* array of EnumerableSet.
* ====
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position is the index of the value in the `values` array plus 1.
// Position 0 is used to mean a value is not in the set.
mapping(bytes32 value => uint256) _positions;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._positions[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We cache the value's position to prevent multiple reads from the same storage slot
uint256 position = set._positions[value];
if (position != 0) {
// Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 valueIndex = position - 1;
uint256 lastIndex = set._values.length - 1;
if (valueIndex != lastIndex) {
bytes32 lastValue = set._values[lastIndex];
// Move the lastValue to the index where the value to delete is
set._values[valueIndex] = lastValue;
// Update the tracked position of the lastValue (that was just moved)
set._positions[lastValue] = position;
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the tracked position for the deleted slot
delete set._positions[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._positions[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function _values(Set storage set) private view returns (bytes32[] memory) {
return set._values;
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
bytes32[] memory store = _values(set._inner);
bytes32[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(AddressSet storage set) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner);
address[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(UintSet storage set) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner);
uint256[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Muldiv operation overflow.
*/
error MathOverflowedMulDiv();
enum Rounding {
Floor, // Toward negative infinity
Ceil, // Toward positive infinity
Trunc, // Toward zero
Expand // Away from zero
}
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds towards infinity instead
* of rounding towards zero.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
if (b == 0) {
// Guarantee the same behavior as in a regular Solidity division.
return a / b;
}
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
* denominator == 0.
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by
* Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0 = x * y; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
if (denominator <= prod1) {
revert MathOverflowedMulDiv();
}
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator.
// Always >= 1. See https://cs.stackexchange.com/q/138556/92363.
uint256 twos = denominator & (0 - denominator);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also
// works in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
* towards zero.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256 of a positive value rounded towards zero.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
}
}
/**
* @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
*/
function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
return uint8(rounding) % 2 == 1;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMath {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}{
"remappings": [
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
"@solady/=lib/solady/src/",
"ds-test/=lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"forge-std/=lib/forge-std/src/",
"openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
"openzeppelin/=lib/openzeppelin-contracts-upgradeable/contracts/",
"solady/=lib/solady/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "cancun",
"viaIR": false,
"libraries": {
"src/core/libs/CommonLib.sol": {
"CommonLib": "0x72A237Cb9CAAF0716Bb4F717E32E79cE6460e5d3"
},
"src/core/libs/VaultBaseLib.sol": {
"VaultBaseLib": "0x0E0c7f12E57a592980F549d158033979Cf668767"
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"AlreadyExist","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC20InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC20InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC20InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"}],"name":"ERC20InvalidSpender","type":"error"},{"inputs":[],"name":"ETHTransferFailed","type":"error"},{"inputs":[{"internalType":"uint256","name":"maxSupply","type":"uint256"}],"name":"ExceedMaxSupply","type":"error"},{"inputs":[{"internalType":"uint256","name":"mintToUser","type":"uint256"},{"internalType":"uint256","name":"minToMint","type":"uint256"}],"name":"ExceedSlippage","type":"error"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"mintToUser","type":"uint256"},{"internalType":"uint256","name":"minToMint","type":"uint256"}],"name":"ExceedSlippageExactAsset","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"FuseTrigger","type":"error"},{"inputs":[],"name":"IncorrectArrayLength","type":"error"},{"inputs":[],"name":"IncorrectInitParams","type":"error"},{"inputs":[],"name":"IncorrectMsgSender","type":"error"},{"inputs":[],"name":"IncorrectZeroArgument","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"NotActiveVault","type":"error"},{"inputs":[{"internalType":"uint256","name":"mintAmount","type":"uint256"},{"internalType":"uint256","name":"initialShares","type":"uint256"}],"name":"NotEnoughAmountToInitSupply","type":"error"},{"inputs":[],"name":"NotEnoughBalanceToPay","type":"error"},{"inputs":[],"name":"NotExist","type":"error"},{"inputs":[],"name":"NotFactory","type":"error"},{"inputs":[],"name":"NotGovernance","type":"error"},{"inputs":[],"name":"NotGovernanceAndNotMultisig","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[],"name":"NotMultisig","type":"error"},{"inputs":[],"name":"NotOperator","type":"error"},{"inputs":[],"name":"NotPlatform","type":"error"},{"inputs":[],"name":"NotSupported","type":"error"},{"inputs":[],"name":"NotTheOwner","type":"error"},{"inputs":[],"name":"NotVault","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"StrategyZeroDeposit","type":"error"},{"inputs":[],"name":"WaitAFewBlocks","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"platform","type":"address"},{"indexed":false,"internalType":"uint256","name":"ts","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"block","type":"uint256"}],"name":"ContractInitialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"address[]","name":"assets","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"indexed":false,"internalType":"uint256","name":"mintAmount","type":"uint256"}],"name":"DepositAssets","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"oldValue","type":"bool"},{"indexed":false,"internalType":"bool","name":"newValue","type":"bool"}],"name":"DoHardWorkOnDepositChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"gasUsed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"gasCost","type":"uint256"},{"indexed":false,"internalType":"bool","name":"compensated","type":"bool"}],"name":"HardWorkGas","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"maxShares","type":"uint256"}],"name":"MaxSupply","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"vaultManagerReceiverFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"strategyLogicReceiverFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"ecosystemRevenueReceiverFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"multisigReceiverFee","type":"uint256"}],"name":"MintFees","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"newName","type":"string"}],"name":"VaultName","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"newSymbol","type":"string"}],"name":"VaultSymbol","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address[]","name":"assets","type":"address[]"},{"indexed":false,"internalType":"uint256","name":"sharesAmount","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"amountsOut","type":"uint256[]"}],"name":"WithdrawAssets","type":"event"},{"inputs":[],"name":"CONTROLLABLE_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VERSION_VAULT_BASE","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"createdBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"assets_","type":"address[]"},{"internalType":"uint256[]","name":"amountsMax","type":"uint256[]"},{"internalType":"uint256","name":"minSharesOut","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"depositAssets","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"doHardWork","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"doHardWorkOnDeposit","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"extra","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getApr","outputs":[{"internalType":"uint256","name":"totalApr","type":"uint256"},{"internalType":"uint256","name":"strategyApr","type":"uint256"},{"internalType":"address[]","name":"assetsWithApr","type":"address[]"},{"internalType":"uint256[]","name":"assetsAprs","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getUniqueInitParamLength","outputs":[{"internalType":"uint256","name":"uniqueInitAddresses","type":"uint256"},{"internalType":"uint256","name":"uniqueInitNums","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address[]","name":"revenueAssets","type":"address[]"},{"internalType":"uint256[]","name":"revenueAmounts","type":"uint256[]"}],"name":"hardWorkMintFeeCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"platform","type":"address"},{"internalType":"address","name":"strategy","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address[]","name":"vaultInitAddresses","type":"address[]"},{"internalType":"uint256[]","name":"vaultInitNums","type":"uint256[]"}],"internalType":"struct IVault.VaultInitializationData","name":"vaultInitializationData","type":"tuple"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"platform","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"assets_","type":"address[]"},{"internalType":"uint256[]","name":"amountsMax","type":"uint256[]"}],"name":"previewDepositAssets","outputs":[{"internalType":"uint256[]","name":"amountsConsumed","type":"uint256[]"},{"internalType":"uint256","name":"sharesOut","type":"uint256"},{"internalType":"uint256","name":"valueOut","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"assets_","type":"address[]"},{"internalType":"uint256[]","name":"amountsMax","type":"uint256[]"}],"name":"previewDepositAssetsWrite","outputs":[{"internalType":"uint256[]","name":"amountsConsumed","type":"uint256[]"},{"internalType":"uint256","name":"sharesOut","type":"uint256"},{"internalType":"uint256","name":"valueOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"price","outputs":[{"internalType":"uint256","name":"price_","type":"uint256"},{"internalType":"bool","name":"trusted_","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"value","type":"bool"}],"name":"setDoHardWorkOnDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"maxShares","type":"uint256"}],"name":"setMaxSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newName","type":"string"}],"name":"setName","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newSymbol","type":"string"}],"name":"setSymbol","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"strategy","outputs":[{"internalType":"contract IStrategy","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tvl","outputs":[{"internalType":"uint256","name":"tvl_","type":"uint256"},{"internalType":"bool","name":"trusted_","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vaultType","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"assets_","type":"address[]"},{"internalType":"uint256","name":"amountShares","type":"uint256"},{"internalType":"uint256[]","name":"minAssetAmountsOut","type":"uint256[]"}],"name":"withdrawAssets","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"assets_","type":"address[]"},{"internalType":"uint256","name":"amountShares","type":"uint256"},{"internalType":"uint256[]","name":"minAssetAmountsOut","type":"uint256[]"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"withdrawAssets","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
6080604052348015600e575f5ffd5b5060156019565b60c9565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff161560685760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b039081161460c65780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b61485d806100d65f395ff3fe608060405260043610610215575f3560e01c80636d9894391161011e578063a9059cbb116100a8578063c53d611f1161006d578063c53d611f1461060a578063d5abeb011461063a578063dd62ed3e1461064e578063e5328e061461066d578063ffa1ad7414610681575f5ffd5b8063a9059cbb1461056f578063b256cd8b1461058e578063b600585a146105ad578063b84c8246146105cc578063c47f0027146105eb575f5ffd5b8063936725ec116100ee578063936725ec146104cf57806395d89b41146104ff578063a035b1fe14610513578063a50c8dd11461053c578063a8c62e761461055b575f5ffd5b80636d9894391461043f5780636f8b44b01461046d57806370a082311461048c578063845bc804146104ab575f5ffd5b80632cbfd6a31161019f57806349f9cac71161016f57806349f9cac7146103ac5780634ac032be146103cc5780634bde38c8146103e05780634fa5d8541461040c5780636d58e62e14610420575f5ffd5b80632cbfd6a31461034a578063313ce567146103695780634485bc20146103845780634593144c14610398575f5ffd5b806317d70f7c116101e557806317d70f7c146102c057806318160ddd146102e2578063190024e0146102f6578063190729b71461030a57806323b872dd1461032b575f5ffd5b806301ffc9a71461022057806306fdde0314610254578063095ea7b3146102755780630b4881ef14610294575f5ffd5b3661021c57005b5f5ffd5b34801561022b575f5ffd5b5061023f61023a3660046139a4565b6106b1565b60405190151581526020015b60405180910390f35b34801561025f575f5ffd5b506102686106db565b60405161024b91906139f9565b348015610280575f5ffd5b5061023f61028f366004613a2f565b610794565b34801561029f575f5ffd5b506102b36102ae366004613bb5565b6107ab565b60405161024b9190613c5a565b3480156102cb575f5ffd5b506102d46107e1565b60405190815260200161024b565b3480156102ed575f5ffd5b506102d46107f5565b348015610301575f5ffd5b506102d4610810565b348015610315575f5ffd5b50610329610324366004613c79565b6108b5565b005b348015610336575f5ffd5b5061023f610345366004613c94565b610920565b348015610355575f5ffd5b506102b3610364366004613cd2565b610943565b348015610374575f5ffd5b506040516012815260200161024b565b34801561038f575f5ffd5b5061023f61097b565b3480156103a3575f5ffd5b506102d4610992565b3480156103b7575f5ffd5b5060408051600181525f60208201520161024b565b3480156103d7575f5ffd5b506102686109c5565b3480156103eb575f5ffd5b506103f4610a5e565b6040516001600160a01b03909116815260200161024b565b348015610417575f5ffd5b50610329610a8d565b34801561042b575f5ffd5b5061032961043a366004613d64565b610d8f565b34801561044a575f5ffd5b5061045e610459366004613d64565b610f01565b60405161024b93929190613dc7565b348015610478575f5ffd5b50610329610487366004613deb565b61106e565b348015610497575f5ffd5b506102d46104a6366004613e02565b6110b9565b3480156104b6575f5ffd5b506104bf6110df565b60405161024b9493929190613e56565b3480156104da575f5ffd5b5061026860405180604001604052806005815260200164312e302e3160d81b81525081565b34801561050a575f5ffd5b506102686116eb565b34801561051e575f5ffd5b5061052761179d565b6040805192835290151560208301520161024b565b348015610547575f5ffd5b50610329610556366004613efc565b611946565b348015610566575f5ffd5b506103f4611abe565b34801561057a575f5ffd5b5061023f610589366004613a2f565b611adb565b348015610599575f5ffd5b506103296105a8366004614010565b611ae8565b3480156105b8575f5ffd5b5061045e6105c7366004613d64565b6122aa565b3480156105d7575f5ffd5b506103296105e636600461408e565b612308565b3480156105f6575f5ffd5b5061032961060536600461408e565b612369565b348015610615575f5ffd5b50610268604051806040016040528060058152602001640322e322e360dc1b81525081565b348015610645575f5ffd5b506102d46123bd565b348015610659575f5ffd5b506102d46106683660046140fa565b6123c7565b348015610678575f5ffd5b50610527612410565b34801561068c575f5ffd5b50610268604051806040016040528060058152602001640312e352e360dc1b81525081565b5f6001600160e01b0319821663362d572760e01b14806106d557506106d582612585565b92915050565b60605f6106e66125b9565b90505f8160060180546106f890614131565b80601f016020809104026020016040519081016040528092919081815260200182805461072490614131565b801561076f5780601f106107465761010080835404028352916020019161076f565b820191905f5260205f20905b81548152906001019060200180831161075257829003601f168201915b505050505090505f815111156107855792915050565b61078d6125dd565b9250505090565b5f336107a181858561269d565b5060019392505050565b60606107b56126af565b6107c284848433336126e6565b90506107da60015f5160206148085f395f51905f5255565b9392505050565b5f5f6107eb6125b9565b6003015492915050565b5f805f5160206147e85f395f51905f525b6002015492915050565b6040805161bb9960e81b602082015261088560e91b602382015281516006818303018152602682019283905263bfe370d960e01b9092525f917372a237cb9caaf0716bb4f717e32e79ce6460e5d39163bfe370d99161087191602a016139f9565b602060405180830381865af415801561088c573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108b09190614169565b905090565b6108bd612d28565b5f6108c66125b9565b60048101805460ff19168415159081179091556040805160ff83161515815260208101929092529192507f4029f7877c61a6a8748ac498b4e9abed4bec4c25764a009e8700bf4c248e983591015b60405180910390a15050565b5f3361092d858285612e42565b610938858585612e8c565b506001949350505050565b606061094d6126af565b61095a86868686866126e6565b905061097260015f5160206148085f395f51905f5255565b95945050505050565b5f5f6109856125b9565b6004015460ff1692915050565b5f6108b06109c160017f812a673dfca07956350df10f8a654925f561d7a0da09bdbe79e653939a14d9f1614194565b5490565b60606109cf6125b9565b60050180546109dd90614131565b80601f0160208091040260200160405190810160405280929190818152602001828054610a0990614131565b8015610a545780601f10610a2b57610100808354040283529160200191610a54565b820191905f5260205f20905b815481529060010190602001808311610a3757829003601f168201915b5050505050905090565b5f6108b06109c160017faa116a42804728f23983458454b6eb9c6ddf3011db9f9addaf3cd7508d85b0d6614194565b5f610a96610a5e565b9050806001600160a01b031663396656406040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ad4573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610af891906141a7565b6001600160a01b0316336001600160a01b031614158015610b7c57506040516336b87bd760e11b81523360048201526001600160a01b03821690636d70f7ae90602401602060405180830381865afa158015610b56573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b7a91906141c2565b155b15610b9a576040516370a8bfcd60e11b815260040160405180910390fd5b5f5a90505f610ba76125b9565b9050806001015f9054906101000a90046001600160a01b03166001600160a01b0316634fa5d8546040518163ffffffff1660e01b81526004015f604051808303815f87803b158015610bf7575f5ffd5b505af1158015610c09573d5f5f3e3d5ffd5b505050505f5a610c199084614194565b90505f610c263a836141dd565b90505f8115610d415730318211801590610caa576040515f90339085908381818185875af1925050503d805f8114610c79576040519150601f19603f3d011682016040523d82523d5f602084013e610c7e565b606091505b5050905080610ca05760405163b12d13eb60e01b815260040160405180910390fd5b6001925050610d3f565b5f610cb3612410565b509050610cbe610a5e565b6001600160a01b031663bb1afe686040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cf9573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d1d9190614169565b811015610d3d57604051633e665c4b60e11b815260040160405180910390fd5b505b505b6040805184815260208101849052821515918101919091527fdf490aa596c4e185d0e5dea0ae87ace06d18de63e65bcae9365f0013c73e11f0906060015b60405180910390a1505050505050565b5f610d98610a5e565b90505f730e0c7f12e57a592980f549d158033979cf668767637e852bf6838686610dc06125b9565b6040518563ffffffff1660e01b8152600401610ddf94939291906141f4565b602060405180830381865af4158015610dfa573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e1e9190614169565b90508015610efb575f826001600160a01b031663e88558126040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e63573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e8791906141a7565b9050610e9430828461269d565b610e9e3083612ee9565b6040516315fd898760e11b8152306004820152602481018390526001600160a01b03821690632bfb130e906044015f604051808303815f87803b158015610ee3575f5ffd5b505af1158015610ef5573d5f5f3e3d5ffd5b50505050505b50505050565b60605f5f5f610f0e6125b9565b6001810154604051636d98943960e01b81529192506001600160a01b0316908190636d98943990610f45908a908a9060040161426d565b5f604051808303815f875af1158015610f60573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052610f8791908101906142ec565b9095509250611060610f976107f5565b84836001600160a01b0316632ddbd13a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fd4573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ff89190614169565b88856001600160a01b03166371a973056040518163ffffffff1660e01b81526004015f60405180830381865afa158015611034573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261105b9190810190614393565b612f21565b508094505050509250925092565b611076612d28565b5f61107f6125b9565b600281018390556040518381529091507f79bfbe6a96e4e1aa5e9e20131cf39e6f9922cebfde9b2e12e0c60b1d8a6c959f90602001610914565b6001600160a01b03165f9081525f5160206147e85f395f51905f52602052604090205490565b5f5f6060805f6110ed6125b9565b905061111b604051806060016040528060608152602001606081526020015f6001600160a01b031681525090565b60018201546040805163f815c4ff60e01b815290516001600160a01b0390921691829163f815c4ff9160048083019260209291908290030181865afa158015611166573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061118a9190614169565b9550859650806001600160a01b03166371a973056040518163ffffffff1660e01b81526004015f60405180830381865afa1580156111ca573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526111f19190810190614393565b825f0181905250806001600160a01b03166367cf905a6040518163ffffffff1660e01b81526004015f60405180830381865afa158015611233573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261125a91908101906143cc565b8260200181905250806001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561129e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112c291906141a7565b6001600160a01b03166040830181905282515190156112e7576112e4816143fd565b90505b8251515f826001600160401b0381111561130357611303613a59565b60405190808252806020026020018201604052801561132c578160200160208202803683370190505b5090505f5b8281101561138757855180518290811061134d5761134d614415565b602002602001015182828151811061136757611367614415565b6001600160a01b0390921660209283029190910190910152600101611331565b5060408501516001600160a01b0316156113dd576040850151816113ac600186614194565b815181106113bc576113bc614415565b60200260200101906001600160a01b031690816001600160a01b0316815250505b5f6113e6610a5e565b6001600160a01b03166394990bd86040518163ffffffff1660e01b8152600401602060405180830381865afa158015611421573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061144591906141a7565b6001600160a01b0316630b4fe492836040518263ffffffff1660e01b81526004016114709190614429565b5f60405180830381865afa15801561148a573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526114b191908101906143cc565b80515f9550909150845b818110156114f8575f8382815181106114d6576114d6614415565b602002602001015111156114f0576114ed866143fd565b95505b6001016114bb565b50846001600160401b0381111561151157611511613a59565b60405190808252806020026020018201604052801561153a578160200160208202803683370190505b509950846001600160401b0381111561155557611555613a59565b60405190808252806020026020018201604052801561157e578160200160208202803683370190505b5098505f5f5b828110156116db575f84828151811061159f5761159f614415565b602002602001015111156116d3578481815181106115bf576115bf614415565b60200260200101518c83815181106115d9576115d9614415565b60200260200101906001600160a01b031690816001600160a01b03168152505083818151811061160b5761160b614415565b60200260200101518b838151811061162557611625614415565b6020026020010181815250508581101561169f57670de0b6b3a76400008960200151828151811061165857611658614415565b60200260200101518c848151811061167257611672614415565b602002602001015161168491906141dd565b61168e919061443b565b611698908f61445a565b9d506116c7565b8a82815181106116b1576116b1614415565b60200260200101518e6116c4919061445a565b9d505b6116d0826143fd565b91505b600101611584565b5050505050505050505090919293565b60605f6116f66125b9565b90505f81600701805461170890614131565b80601f016020809104026020016040519081016040528092919081815260200182805461173490614131565b801561177f5780601f106117565761010080835404028352916020019161177f565b820191905f5260205f20905b81548152906001019060200180831161176257829003601f168201915b505050505090505f815111156117955792915050565b61078d61308e565b5f5f5f6117a86125b9565b90505f5f826001015f9054906101000a90046001600160a01b03166001600160a01b03166359498ab76040518163ffffffff1660e01b81526004015f60405180830381865afa1580156117fd573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611824919081019061446d565b915091505f611831610a5e565b6001600160a01b03166349b5fdb46040518163ffffffff1660e01b8152600401602060405180830381865afa15801561186c573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061189091906141a7565b90505f816001600160a01b031663a36fba3285856040518363ffffffff1660e01b81526004016118c192919061426d565b5f60405180830381865afa1580156118db573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261190291908101906144c6565b98509192505f915061191490506107f5565b9050801561193c578061192f83670de0b6b3a76400006141dd565b611939919061443b565b97505b5050505050509091565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff1615906001600160401b03165f8115801561198a5750825b90505f826001600160401b031660011480156119a55750303b155b9050811580156119b3575080155b156119d15760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff1916600117855583156119fb57845460ff60401b1916600160401b1785555b611a3f865f01516040518060400160405280600b81526020016a436f6d706f756e64696e6760a81b815250886020015189604001518a606001518b608001516130cc565b60a086015151151580611a56575060c08601515115155b15611a74576040516363cf6b6160e01b815260040160405180910390fd5b8315611ab657845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d290602001610d7f565b505050505050565b5f5f611ac86125b9565b600101546001600160a01b031692915050565b5f336107a1818585612e8c565b611af06126af565b5f611af96125b9565b90506001611b05610a5e565b6001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b40573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611b6491906141a7565b604051633433c01560e21b81523060048201526001600160a01b03919091169063d0cf005490602401602060405180830381865afa158015611ba8573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611bcc9190614169565b14611bea57604051630d7abd6f60e31b815260040160405180910390fd5b611c446040518061012001604052805f81526020015f81526020015f8152602001606081526020015f6001600160a01b031681526020015f6001600160a01b03168152602001606081526020015f81526020015f81525090565b60018201546001600160a01b03166080820152600482015460ff168015611cda5750610e1081608001516001600160a01b03166313e631806040518163ffffffff1660e01b8152600401602060405180830381865afa158015611ca9573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611ccd9190614169565b611cd7919061445a565b42115b8015611d45575080608001516001600160a01b03166374bac4296040518163ffffffff1660e01b8152600401602060405180830381865afa158015611d21573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611d4591906141c2565b15611d9d5780608001516001600160a01b0316634fa5d8546040518163ffffffff1660e01b81526004015f604051808303815f87803b158015611d86575f5ffd5b505af1158015611d98573d5f5f3e3d5ffd5b505050505b611da56107f5565b815f01818152505080608001516001600160a01b0316632ddbd13a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611ded573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611e119190614169565b6020820152805115801590611e2857506020810151155b15611e465760405163c993c2fd60e01b815260040160405180910390fd5b845160408201819052865114611e6f57604051630ef9926760e21b815260040160405180910390fd5b80608001516001600160a01b03166371a973056040518163ffffffff1660e01b81526004015f60405180830381865afa158015611eae573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611ed59190810190614393565b816060018190525080608001516001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f1d573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611f4191906141a7565b6001600160a01b031660a082015260408101516001148015611f6f575060a08101516001600160a01b031615155b8015611fa95750855f81518110611f8857611f88614415565b60200260200101516001600160a01b03168160a001516001600160a01b0316145b1561207857845f81518110611fc057611fc0614415565b602090810291909101015160e08201819052608082015160a0830151611ff3926001600160a01b039091169133916131aa565b608081015160e082015160405163b9f5be4160e01b81526001600160a01b039092169163b9f5be419161202c9160040190815260200190565b5f604051808303815f875af1158015612047573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261206e91908101906143cc565b60c08201526121e6565b80608001516001600160a01b0316636d98943987876040518363ffffffff1660e01b81526004016120aa92919061426d565b5f604051808303815f875af11580156120c5573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526120ec91908101906142ec565b60e083015260c08201525f5b816040015181101561216a576121623383608001518460c00151848151811061212357612123614415565b60200260200101518560600151858151811061214157612141614415565b60200260200101516001600160a01b03166131aa909392919063ffffffff16565b6001016120f8565b50608081015160c08201516040516328addc8b60e21b81526001600160a01b039092169163a2b7722c916121a091600401613c5a565b6020604051808303815f875af11580156121bc573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906121e09190614169565b60e08201525b8060e001515f0361220a57604051636654967560e11b815260040160405180910390fd5b61222d82825f01518360e0015184602001518560c001518987606001518a613204565b61010082019081526001600160a01b0384165f818152602085905260409081902043905560c08401519251905191927f39e231aec7d812a6b5ca9261d41ea0e91726779c6ad9074cb9a68fa7af4525cb9261228a928b929161453a565b60405180910390a25050610efb60015f5160206148085f395f51905f5255565b60605f5f5f6122b76125b9565b6001810154604051635b002c2d60e11b81529192506001600160a01b031690819063b600585a906122ee908a908a9060040161426d565b5f60405180830381865afa158015610f60573d5f5f3e3d5ffd5b6123106132bf565b5f6123196125b9565b90506007810161232a8385836145b3565b507f573252ad6e71066a287fba4a3ca4b6d9fe439b819cb0cd989d7b5bde717ab2f6838360405161235c92919061466c565b60405180910390a1505050565b6123716132bf565b5f61237a6125b9565b90506006810161238b8385836145b3565b507f37ef725074794ceb3e61870fc59c39fcaf72350f7e417059ace97870ea775fc7838360405161235c92919061466c565b5f5f6108066125b9565b6001600160a01b039182165f9081527f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace016020908152604080832093909416825291909152205490565b5f5f5f61241b6125b9565b90505f5f826001015f9054906101000a90046001600160a01b03166001600160a01b03166359498ab76040518163ffffffff1660e01b81526004015f60405180830381865afa158015612470573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052612497919081019061446d565b915091505f6124a4610a5e565b6001600160a01b03166349b5fdb46040518163ffffffff1660e01b8152600401602060405180830381865afa1580156124df573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061250391906141a7565b6040516351b7dd1960e11b81529091506001600160a01b0382169063a36fba3290612534908690869060040161426d565b5f60405180830381865afa15801561254e573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261257591908101906144c6565b9299929850919650505050505050565b5f6001600160e01b03198216630f1ec81f60e41b14806106d557506301ffc9a760e01b6001600160e01b03198316146106d5565b7fd602ae9af1fed726d4890dcf3c81a074ed87a6343646550e5de293c5a9330a0090565b7f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace0380546060915f5160206147e85f395f51905f529161261b90614131565b80601f016020809104026020016040519081016040528092919081815260200182805461264790614131565b80156126925780601f1061266957610100808354040283529160200191612692565b820191905f5260205f20905b81548152906001019060200180831161267557829003601f168201915b505050505091505090565b6126aa838383600161334e565b505050565b5f5160206148085f395f51905f528054600119016126e057604051633ee5aeb560e01b815260040160405180910390fd5b60029055565b6060336001600160a01b0383161461270357612703823387612e42565b845f03612723576040516371c42ac360e01b815260040160405180910390fd5b61272c826110b9565b85111561274c57604051633e665c4b60e11b815260040160405180910390fd5b835186511461276e57604051630ef9926760e21b815260040160405180910390fd5b5f6127776125b9565b90506127838184613432565b60018101546001600160a01b03165f61279a6107f5565b90505f826001600160a01b0316632ddbd13a6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156127d9573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906127fd9190614169565b905060605f846001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561283e573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061286291906141a7565b90505f8c51600114801561287e57506001600160a01b03821615155b80156128b457508c5f8151811061289757612897614415565b60200260200101516001600160a01b0316826001600160a01b0316145b90508315612a1f575f856128c8868f6141dd565b6128d2919061443b565b905081156129a457604080516001808252818301909252906020808301908036833701905050935080845f8151811061290d5761290d614415565b602002602001018181525050866001600160a01b03166399f428cf855f8151811061293a5761293a614415565b60200260200101518d6040518363ffffffff1660e01b81526004016129729291909182526001600160a01b0316602082015260400190565b5f604051808303815f87803b158015612989575f5ffd5b505af115801561299b573d5f5f3e3d5ffd5b50505050612a19565b866001600160a01b03166350f4e4198f838e6040518463ffffffff1660e01b81526004016129d49392919061469a565b5f604051808303815f875af11580156129ef573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052612a1691908101906143cc565b93505b50612be9565b8015612b6d576040805160018082528183019092529060208083019080368337019050506040516370a0823160e01b81526001600160a01b03888116600483015291945086918416906370a0823190602401602060405180830381865afa158015612a8c573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612ab09190614169565b612aba908e6141dd565b612ac4919061443b565b835f81518110612ad657612ad6614415565b602002602001018181525050856001600160a01b03166399f428cf845f81518110612b0357612b03614415565b60200260200101518c6040518363ffffffff1660e01b8152600401612b3b9291909182526001600160a01b0316602082015260400190565b5f604051808303815f87803b158015612b52575f5ffd5b505af1158015612b64573d5f5f3e3d5ffd5b50505050612be9565b604051633e616c2f60e21b8152600481018d9052602481018690526001600160a01b038b8116604483015287169063f985b0bc906064015f604051808303815f875af1158015612bbf573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052612be691908101906143cc565b92505b82515f5b81811015612caa578c8181518110612c0757612c07614415565b6020026020010151858281518110612c2157612c21614415565b60200260200101511015612ca2578e8181518110612c4157612c41614415565b6020026020010151858281518110612c5b57612c5b614415565b60200260200101518e8381518110612c7557612c75614415565b60200260200101516040516330d597ab60e01b8152600401612c99939291906146cc565b60405180910390fd5b600101612bed565b50505050612cb8878b613492565b866001600160a01b0316336001600160a01b03167ff6f76fa9e624451c5234aa077063a68dad722c8790170478f0b28b3dc3722bcc8d8d85604051612cff939291906146ed565b60405180910390a39a9950505050505050505050565b60015f5160206148085f395f51905f5255565b5f612d31610a5e565b9050336001600160a01b0316816001600160a01b0316635aa6e6756040518163ffffffff1660e01b8152600401602060405180830381865afa158015612d79573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612d9d91906141a7565b6001600160a01b03161480612e225750336001600160a01b0316816001600160a01b0316634783c35b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612df3573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612e1791906141a7565b6001600160a01b0316145b612e3f576040516354299b6f60e01b815260040160405180910390fd5b50565b5f612e4d84846123c7565b90505f198114610efb5781811015612e7e57828183604051637dc7a0d960e11b8152600401612c99939291906146cc565b610efb84848484035f61334e565b6001600160a01b038316612eb557604051634b637e8f60e11b81525f6004820152602401612c99565b6001600160a01b038216612ede5760405163ec442f0560e01b81525f6004820152602401612c99565b6126aa8383836134c2565b6001600160a01b038216612f125760405163ec442f0560e01b81525f6004820152602401612c99565b612f1d5f83836134c2565b5050565b5f808615612f485784612f3488886141dd565b612f3e919061443b565b91505f9050613084565b5f612f51610a5e565b6001600160a01b03166349b5fdb46040518163ffffffff1660e01b8152600401602060405180830381865afa158015612f8c573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612fb091906141a7565b6040516351b7dd1960e11b81529091506001600160a01b0382169063a36fba3290612fe1908790899060040161426d565b5f60405180830381865afa158015612ffb573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261302291908101906144c6565b5091945066038d7ea4c68000935061304091508390506103e86141dd565b8310156130765782613054836103e86141dd565b604051637592afef60e01b815260048101929092526024820152604401612c99565b6130808284614194565b9250505b9550959350505050565b7f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace0480546060915f5160206147e85f395f51905f529161261b90614131565b6130d4613507565b6130dd86613550565b6130e783836136a1565b5f6130f06125b9565b9050600581016131008782614717565b506001810180546001600160a01b0319166001600160a01b0387161790556003810182905561312d6136b3565b846001600160a01b0316639736374e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613169573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061318d91906141c2565b600491909101805460ff1916911515919091179055505050505050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610efb9085906136c3565b5f5f6132138989898988612f21565b60028c0154919350915080158015906132345750806132328b8561445a565b115b1561325557604051635dae7a7560e11b815260048101829052602401612c99565b8583101561328057604051637a672cf560e11b81526004810184905260248101879052604401612c99565b81156132955761329561dead60901b83612ee9565b6001600160a01b0384166132a7573393505b6132b18484612ee9565b505098975050505050505050565b6132c7610a5e565b6040516336b87bd760e11b81523360048201526001600160a01b039190911690636d70f7ae90602401602060405180830381865afa15801561330b573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061332f91906141c2565b61334c57604051631f0853c160e21b815260040160405180910390fd5b565b5f5160206147e85f395f51905f526001600160a01b0385166133855760405163e602df0560e01b81525f6004820152602401612c99565b6001600160a01b0384166133ae57604051634a1406b160e11b81525f6004820152602401612c99565b6001600160a01b038086165f9081526001830160209081526040808320938816835292905220839055811561342b57836001600160a01b0316856001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258560405161342291815260200190565b60405180910390a35b5050505050565b6001600160a01b0381165f9081526020839052604090205443906134589060059061445a565b1061347657604051630add1e2b60e21b815260040160405180910390fd5b6001600160a01b03165f90815260209190915260409020439055565b6001600160a01b0382166134bb57604051634b637e8f60e11b81525f6004820152602401612c99565b612f1d825f835b6134cd838383613724565b5f6134d66125b9565b6001600160a01b039485165f9081526020919091526040808220439081905594909516815293909320919091555050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff1661334c57604051631afcd79f60e31b815260040160405180910390fd5b613558613507565b6001600160a01b038116158015906135e157505f6001600160a01b0316816001600160a01b0316634783c35b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156135b1573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906135d591906141a7565b6001600160a01b031614155b6135fe576040516371c42ac360e01b815260040160405180910390fd5b61363161362c60017faa116a42804728f23983458454b6eb9c6ddf3011db9f9addaf3cd7508d85b0d6614194565b829055565b6136634361366060017f812a673dfca07956350df10f8a654925f561d7a0da09bdbe79e653939a14d9f1614194565b55565b7f1a2dd071001ebf6e03174e3df5b305795a4ad5d41d8fdb9ba41dbbe236713426814243604051613696939291906146cc565b60405180910390a150565b6136a9613507565b612f1d828261384a565b6136bb613507565b61334c61389a565b5f6136d76001600160a01b038416836138a2565b905080515f141580156136fb5750808060200190518101906136f991906141c2565b155b156126aa57604051635274afe760e01b81526001600160a01b0384166004820152602401612c99565b5f5160206147e85f395f51905f526001600160a01b03841661375e5781816002015f828254613753919061445a565b909155506137bb9050565b6001600160a01b0384165f908152602082905260409020548281101561379d5784818460405163391434e360e21b8152600401612c99939291906146cc565b6001600160a01b0385165f9081526020839052604090209083900390555b6001600160a01b0383166137d95760028101805483900390556137f7565b6001600160a01b0383165f9081526020829052604090208054830190555b826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161383c91815260200190565b60405180910390a350505050565b613852613507565b5f5160206147e85f395f51905f527f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace0361388b8482614717565b5060048101610efb8382614717565b612d15613507565b60606107da83835f845f5f856001600160a01b031684866040516138c691906147d1565b5f6040518083038185875af1925050503d805f8114613900576040519150601f19603f3d011682016040523d82523d5f602084013e613905565b606091505b509150915061391586838361391f565b9695505050505050565b6060826139345761392f8261397b565b6107da565b815115801561394b57506001600160a01b0384163b155b1561397457604051639996b31560e01b81526001600160a01b0385166004820152602401612c99565b50806107da565b80511561398b5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b5f602082840312156139b4575f5ffd5b81356001600160e01b0319811681146107da575f5ffd5b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f6107da60208301846139cb565b6001600160a01b0381168114612e3f575f5ffd5b8035613a2a81613a0b565b919050565b5f5f60408385031215613a40575f5ffd5b8235613a4b81613a0b565b946020939093013593505050565b634e487b7160e01b5f52604160045260245ffd5b60405160e081016001600160401b0381118282101715613a8f57613a8f613a59565b60405290565b604051601f8201601f191681016001600160401b0381118282101715613abd57613abd613a59565b604052919050565b5f6001600160401b03821115613add57613add613a59565b5060051b60200190565b5f82601f830112613af6575f5ffd5b8135613b09613b0482613ac5565b613a95565b8082825260208201915060208360051b860101925085831115613b2a575f5ffd5b602085015b83811015613b50578035613b4281613a0b565b835260209283019201613b2f565b5095945050505050565b5f82601f830112613b69575f5ffd5b8135613b77613b0482613ac5565b8082825260208201915060208360051b860101925085831115613b98575f5ffd5b602085015b83811015613b50578035835260209283019201613b9d565b5f5f5f60608486031215613bc7575f5ffd5b83356001600160401b03811115613bdc575f5ffd5b613be886828701613ae7565b9350506020840135915060408401356001600160401b03811115613c0a575f5ffd5b613c1686828701613b5a565b9150509250925092565b5f8151808452602084019350602083015f5b82811015613c50578151865260209586019590910190600101613c32565b5093949350505050565b602081525f6107da6020830184613c20565b8015158114612e3f575f5ffd5b5f60208284031215613c89575f5ffd5b81356107da81613c6c565b5f5f5f60608486031215613ca6575f5ffd5b8335613cb181613a0b565b92506020840135613cc181613a0b565b929592945050506040919091013590565b5f5f5f5f5f60a08688031215613ce6575f5ffd5b85356001600160401b03811115613cfb575f5ffd5b613d0788828901613ae7565b9550506020860135935060408601356001600160401b03811115613d29575f5ffd5b613d3588828901613b5a565b9350506060860135613d4681613a0b565b91506080860135613d5681613a0b565b809150509295509295909350565b5f5f60408385031215613d75575f5ffd5b82356001600160401b03811115613d8a575f5ffd5b613d9685828601613ae7565b92505060208301356001600160401b03811115613db1575f5ffd5b613dbd85828601613b5a565b9150509250929050565b606081525f613dd96060830186613c20565b60208301949094525060400152919050565b5f60208284031215613dfb575f5ffd5b5035919050565b5f60208284031215613e12575f5ffd5b81356107da81613a0b565b5f8151808452602084019350602083015f5b82811015613c505781516001600160a01b0316865260209586019590910190600101613e2f565b848152836020820152608060408201525f613e746080830185613e1d565b8281036060840152613e868185613c20565b979650505050505050565b5f82601f830112613ea0575f5ffd5b81356001600160401b03811115613eb957613eb9613a59565b613ecc601f8201601f1916602001613a95565b818152846020838601011115613ee0575f5ffd5b816020850160208301375f918101602001919091529392505050565b5f60208284031215613f0c575f5ffd5b81356001600160401b03811115613f21575f5ffd5b820160e08185031215613f32575f5ffd5b613f3a613a6d565b613f4382613a1f565b8152613f5160208301613a1f565b602082015260408201356001600160401b03811115613f6e575f5ffd5b613f7a86828501613e91565b60408301525060608201356001600160401b03811115613f98575f5ffd5b613fa486828501613e91565b6060830152506080828101359082015260a08201356001600160401b03811115613fcc575f5ffd5b613fd886828501613ae7565b60a08301525060c08201356001600160401b03811115613ff6575f5ffd5b61400286828501613b5a565b60c083015250949350505050565b5f5f5f5f60808587031215614023575f5ffd5b84356001600160401b03811115614038575f5ffd5b61404487828801613ae7565b94505060208501356001600160401b0381111561405f575f5ffd5b61406b87828801613b5a565b93505060408501359150606085013561408381613a0b565b939692955090935050565b5f5f6020838503121561409f575f5ffd5b82356001600160401b038111156140b4575f5ffd5b8301601f810185136140c4575f5ffd5b80356001600160401b038111156140d9575f5ffd5b8560208284010111156140ea575f5ffd5b6020919091019590945092505050565b5f5f6040838503121561410b575f5ffd5b823561411681613a0b565b9150602083013561412681613a0b565b809150509250929050565b600181811c9082168061414557607f821691505b60208210810361416357634e487b7160e01b5f52602260045260245ffd5b50919050565b5f60208284031215614179575f5ffd5b5051919050565b634e487b7160e01b5f52601160045260245ffd5b818103818111156106d5576106d5614180565b5f602082840312156141b7575f5ffd5b81516107da81613a0b565b5f602082840312156141d2575f5ffd5b81516107da81613c6c565b80820281158282048414176106d5576106d5614180565b6001600160a01b03851681526080602080830182905285519183018290525f919086019060a0840190835b818110156142465783516001600160a01b031683526020938401939092019160010161421f565b5050838103604085015261425a8187613c20565b9250505082606083015295945050505050565b604081525f61427f6040830185613e1d565b82810360208401526109728185613c20565b5f82601f8301126142a0575f5ffd5b81516142ae613b0482613ac5565b8082825260208201915060208360051b8601019250858311156142cf575f5ffd5b602085015b83811015613b505780518352602092830192016142d4565b5f5f604083850312156142fd575f5ffd5b82516001600160401b03811115614312575f5ffd5b61431e85828601614291565b602094909401519395939450505050565b5f82601f83011261433e575f5ffd5b815161434c613b0482613ac5565b8082825260208201915060208360051b86010192508583111561436d575f5ffd5b602085015b83811015613b5057805161438581613a0b565b835260209283019201614372565b5f602082840312156143a3575f5ffd5b81516001600160401b038111156143b8575f5ffd5b6143c48482850161432f565b949350505050565b5f602082840312156143dc575f5ffd5b81516001600160401b038111156143f1575f5ffd5b6143c484828501614291565b5f6001820161440e5761440e614180565b5060010190565b634e487b7160e01b5f52603260045260245ffd5b602081525f6107da6020830184613e1d565b5f8261445557634e487b7160e01b5f52601260045260245ffd5b500490565b808201808211156106d5576106d5614180565b5f5f6040838503121561447e575f5ffd5b82516001600160401b03811115614493575f5ffd5b61449f8582860161432f565b92505060208301516001600160401b038111156144ba575f5ffd5b613dbd85828601614291565b5f5f5f5f608085870312156144d9575f5ffd5b845160208601519094506001600160401b038111156144f6575f5ffd5b61450287828801614291565b93505060408501516001600160401b0381111561451d575f5ffd5b61452987828801614291565b925050606085015161408381613c6c565b606081525f61454c6060830186613e1d565b828103602084015261455e8186613c20565b915050826040830152949350505050565b601f8211156126aa57805f5260205f20601f840160051c810160208510156145945750805b601f840160051c820191505b8181101561342b575f81556001016145a0565b6001600160401b038311156145ca576145ca613a59565b6145de836145d88354614131565b8361456f565b5f601f84116001811461460f575f85156145f85750838201355b5f19600387901b1c1916600186901b17835561342b565b5f83815260208120601f198716915b8281101561463e578685013582556020948501946001909201910161461e565b508682101561465a575f1960f88860031b161c19848701351681555b505060018560011b0183555050505050565b60208152816020820152818360408301375f818301604090810191909152601f909201601f19160101919050565b606081525f6146ac6060830186613e1d565b6020830194909452506001600160a01b0391909116604090910152919050565b6001600160a01b039390931683526020830191909152604082015260600190565b606081525f6146ff6060830186613e1d565b84602084015282810360408401526139158185613c20565b81516001600160401b0381111561473057614730613a59565b6147448161473e8454614131565b8461456f565b6020601f821160018114614776575f831561475f5750848201515b5f19600385901b1c1916600184901b17845561342b565b5f84815260208120601f198516915b828110156147a55787850151825560209485019460019092019101614785565b50848210156147c257868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b5f82518060208501845e5f92019182525091905056fe52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace009b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00a2646970667358221220f8713b85de3a91703a66f9611316a5e07fa3faac1644505862355f04064587de64736f6c634300081c0033
Deployed Bytecode
0x608060405260043610610215575f3560e01c80636d9894391161011e578063a9059cbb116100a8578063c53d611f1161006d578063c53d611f1461060a578063d5abeb011461063a578063dd62ed3e1461064e578063e5328e061461066d578063ffa1ad7414610681575f5ffd5b8063a9059cbb1461056f578063b256cd8b1461058e578063b600585a146105ad578063b84c8246146105cc578063c47f0027146105eb575f5ffd5b8063936725ec116100ee578063936725ec146104cf57806395d89b41146104ff578063a035b1fe14610513578063a50c8dd11461053c578063a8c62e761461055b575f5ffd5b80636d9894391461043f5780636f8b44b01461046d57806370a082311461048c578063845bc804146104ab575f5ffd5b80632cbfd6a31161019f57806349f9cac71161016f57806349f9cac7146103ac5780634ac032be146103cc5780634bde38c8146103e05780634fa5d8541461040c5780636d58e62e14610420575f5ffd5b80632cbfd6a31461034a578063313ce567146103695780634485bc20146103845780634593144c14610398575f5ffd5b806317d70f7c116101e557806317d70f7c146102c057806318160ddd146102e2578063190024e0146102f6578063190729b71461030a57806323b872dd1461032b575f5ffd5b806301ffc9a71461022057806306fdde0314610254578063095ea7b3146102755780630b4881ef14610294575f5ffd5b3661021c57005b5f5ffd5b34801561022b575f5ffd5b5061023f61023a3660046139a4565b6106b1565b60405190151581526020015b60405180910390f35b34801561025f575f5ffd5b506102686106db565b60405161024b91906139f9565b348015610280575f5ffd5b5061023f61028f366004613a2f565b610794565b34801561029f575f5ffd5b506102b36102ae366004613bb5565b6107ab565b60405161024b9190613c5a565b3480156102cb575f5ffd5b506102d46107e1565b60405190815260200161024b565b3480156102ed575f5ffd5b506102d46107f5565b348015610301575f5ffd5b506102d4610810565b348015610315575f5ffd5b50610329610324366004613c79565b6108b5565b005b348015610336575f5ffd5b5061023f610345366004613c94565b610920565b348015610355575f5ffd5b506102b3610364366004613cd2565b610943565b348015610374575f5ffd5b506040516012815260200161024b565b34801561038f575f5ffd5b5061023f61097b565b3480156103a3575f5ffd5b506102d4610992565b3480156103b7575f5ffd5b5060408051600181525f60208201520161024b565b3480156103d7575f5ffd5b506102686109c5565b3480156103eb575f5ffd5b506103f4610a5e565b6040516001600160a01b03909116815260200161024b565b348015610417575f5ffd5b50610329610a8d565b34801561042b575f5ffd5b5061032961043a366004613d64565b610d8f565b34801561044a575f5ffd5b5061045e610459366004613d64565b610f01565b60405161024b93929190613dc7565b348015610478575f5ffd5b50610329610487366004613deb565b61106e565b348015610497575f5ffd5b506102d46104a6366004613e02565b6110b9565b3480156104b6575f5ffd5b506104bf6110df565b60405161024b9493929190613e56565b3480156104da575f5ffd5b5061026860405180604001604052806005815260200164312e302e3160d81b81525081565b34801561050a575f5ffd5b506102686116eb565b34801561051e575f5ffd5b5061052761179d565b6040805192835290151560208301520161024b565b348015610547575f5ffd5b50610329610556366004613efc565b611946565b348015610566575f5ffd5b506103f4611abe565b34801561057a575f5ffd5b5061023f610589366004613a2f565b611adb565b348015610599575f5ffd5b506103296105a8366004614010565b611ae8565b3480156105b8575f5ffd5b5061045e6105c7366004613d64565b6122aa565b3480156105d7575f5ffd5b506103296105e636600461408e565b612308565b3480156105f6575f5ffd5b5061032961060536600461408e565b612369565b348015610615575f5ffd5b50610268604051806040016040528060058152602001640322e322e360dc1b81525081565b348015610645575f5ffd5b506102d46123bd565b348015610659575f5ffd5b506102d46106683660046140fa565b6123c7565b348015610678575f5ffd5b50610527612410565b34801561068c575f5ffd5b50610268604051806040016040528060058152602001640312e352e360dc1b81525081565b5f6001600160e01b0319821663362d572760e01b14806106d557506106d582612585565b92915050565b60605f6106e66125b9565b90505f8160060180546106f890614131565b80601f016020809104026020016040519081016040528092919081815260200182805461072490614131565b801561076f5780601f106107465761010080835404028352916020019161076f565b820191905f5260205f20905b81548152906001019060200180831161075257829003601f168201915b505050505090505f815111156107855792915050565b61078d6125dd565b9250505090565b5f336107a181858561269d565b5060019392505050565b60606107b56126af565b6107c284848433336126e6565b90506107da60015f5160206148085f395f51905f5255565b9392505050565b5f5f6107eb6125b9565b6003015492915050565b5f805f5160206147e85f395f51905f525b6002015492915050565b6040805161bb9960e81b602082015261088560e91b602382015281516006818303018152602682019283905263bfe370d960e01b9092525f917372a237cb9caaf0716bb4f717e32e79ce6460e5d39163bfe370d99161087191602a016139f9565b602060405180830381865af415801561088c573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108b09190614169565b905090565b6108bd612d28565b5f6108c66125b9565b60048101805460ff19168415159081179091556040805160ff83161515815260208101929092529192507f4029f7877c61a6a8748ac498b4e9abed4bec4c25764a009e8700bf4c248e983591015b60405180910390a15050565b5f3361092d858285612e42565b610938858585612e8c565b506001949350505050565b606061094d6126af565b61095a86868686866126e6565b905061097260015f5160206148085f395f51905f5255565b95945050505050565b5f5f6109856125b9565b6004015460ff1692915050565b5f6108b06109c160017f812a673dfca07956350df10f8a654925f561d7a0da09bdbe79e653939a14d9f1614194565b5490565b60606109cf6125b9565b60050180546109dd90614131565b80601f0160208091040260200160405190810160405280929190818152602001828054610a0990614131565b8015610a545780601f10610a2b57610100808354040283529160200191610a54565b820191905f5260205f20905b815481529060010190602001808311610a3757829003601f168201915b5050505050905090565b5f6108b06109c160017faa116a42804728f23983458454b6eb9c6ddf3011db9f9addaf3cd7508d85b0d6614194565b5f610a96610a5e565b9050806001600160a01b031663396656406040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ad4573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610af891906141a7565b6001600160a01b0316336001600160a01b031614158015610b7c57506040516336b87bd760e11b81523360048201526001600160a01b03821690636d70f7ae90602401602060405180830381865afa158015610b56573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b7a91906141c2565b155b15610b9a576040516370a8bfcd60e11b815260040160405180910390fd5b5f5a90505f610ba76125b9565b9050806001015f9054906101000a90046001600160a01b03166001600160a01b0316634fa5d8546040518163ffffffff1660e01b81526004015f604051808303815f87803b158015610bf7575f5ffd5b505af1158015610c09573d5f5f3e3d5ffd5b505050505f5a610c199084614194565b90505f610c263a836141dd565b90505f8115610d415730318211801590610caa576040515f90339085908381818185875af1925050503d805f8114610c79576040519150601f19603f3d011682016040523d82523d5f602084013e610c7e565b606091505b5050905080610ca05760405163b12d13eb60e01b815260040160405180910390fd5b6001925050610d3f565b5f610cb3612410565b509050610cbe610a5e565b6001600160a01b031663bb1afe686040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cf9573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d1d9190614169565b811015610d3d57604051633e665c4b60e11b815260040160405180910390fd5b505b505b6040805184815260208101849052821515918101919091527fdf490aa596c4e185d0e5dea0ae87ace06d18de63e65bcae9365f0013c73e11f0906060015b60405180910390a1505050505050565b5f610d98610a5e565b90505f730e0c7f12e57a592980f549d158033979cf668767637e852bf6838686610dc06125b9565b6040518563ffffffff1660e01b8152600401610ddf94939291906141f4565b602060405180830381865af4158015610dfa573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e1e9190614169565b90508015610efb575f826001600160a01b031663e88558126040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e63573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e8791906141a7565b9050610e9430828461269d565b610e9e3083612ee9565b6040516315fd898760e11b8152306004820152602481018390526001600160a01b03821690632bfb130e906044015f604051808303815f87803b158015610ee3575f5ffd5b505af1158015610ef5573d5f5f3e3d5ffd5b50505050505b50505050565b60605f5f5f610f0e6125b9565b6001810154604051636d98943960e01b81529192506001600160a01b0316908190636d98943990610f45908a908a9060040161426d565b5f604051808303815f875af1158015610f60573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052610f8791908101906142ec565b9095509250611060610f976107f5565b84836001600160a01b0316632ddbd13a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fd4573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ff89190614169565b88856001600160a01b03166371a973056040518163ffffffff1660e01b81526004015f60405180830381865afa158015611034573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261105b9190810190614393565b612f21565b508094505050509250925092565b611076612d28565b5f61107f6125b9565b600281018390556040518381529091507f79bfbe6a96e4e1aa5e9e20131cf39e6f9922cebfde9b2e12e0c60b1d8a6c959f90602001610914565b6001600160a01b03165f9081525f5160206147e85f395f51905f52602052604090205490565b5f5f6060805f6110ed6125b9565b905061111b604051806060016040528060608152602001606081526020015f6001600160a01b031681525090565b60018201546040805163f815c4ff60e01b815290516001600160a01b0390921691829163f815c4ff9160048083019260209291908290030181865afa158015611166573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061118a9190614169565b9550859650806001600160a01b03166371a973056040518163ffffffff1660e01b81526004015f60405180830381865afa1580156111ca573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526111f19190810190614393565b825f0181905250806001600160a01b03166367cf905a6040518163ffffffff1660e01b81526004015f60405180830381865afa158015611233573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261125a91908101906143cc565b8260200181905250806001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561129e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112c291906141a7565b6001600160a01b03166040830181905282515190156112e7576112e4816143fd565b90505b8251515f826001600160401b0381111561130357611303613a59565b60405190808252806020026020018201604052801561132c578160200160208202803683370190505b5090505f5b8281101561138757855180518290811061134d5761134d614415565b602002602001015182828151811061136757611367614415565b6001600160a01b0390921660209283029190910190910152600101611331565b5060408501516001600160a01b0316156113dd576040850151816113ac600186614194565b815181106113bc576113bc614415565b60200260200101906001600160a01b031690816001600160a01b0316815250505b5f6113e6610a5e565b6001600160a01b03166394990bd86040518163ffffffff1660e01b8152600401602060405180830381865afa158015611421573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061144591906141a7565b6001600160a01b0316630b4fe492836040518263ffffffff1660e01b81526004016114709190614429565b5f60405180830381865afa15801561148a573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526114b191908101906143cc565b80515f9550909150845b818110156114f8575f8382815181106114d6576114d6614415565b602002602001015111156114f0576114ed866143fd565b95505b6001016114bb565b50846001600160401b0381111561151157611511613a59565b60405190808252806020026020018201604052801561153a578160200160208202803683370190505b509950846001600160401b0381111561155557611555613a59565b60405190808252806020026020018201604052801561157e578160200160208202803683370190505b5098505f5f5b828110156116db575f84828151811061159f5761159f614415565b602002602001015111156116d3578481815181106115bf576115bf614415565b60200260200101518c83815181106115d9576115d9614415565b60200260200101906001600160a01b031690816001600160a01b03168152505083818151811061160b5761160b614415565b60200260200101518b838151811061162557611625614415565b6020026020010181815250508581101561169f57670de0b6b3a76400008960200151828151811061165857611658614415565b60200260200101518c848151811061167257611672614415565b602002602001015161168491906141dd565b61168e919061443b565b611698908f61445a565b9d506116c7565b8a82815181106116b1576116b1614415565b60200260200101518e6116c4919061445a565b9d505b6116d0826143fd565b91505b600101611584565b5050505050505050505090919293565b60605f6116f66125b9565b90505f81600701805461170890614131565b80601f016020809104026020016040519081016040528092919081815260200182805461173490614131565b801561177f5780601f106117565761010080835404028352916020019161177f565b820191905f5260205f20905b81548152906001019060200180831161176257829003601f168201915b505050505090505f815111156117955792915050565b61078d61308e565b5f5f5f6117a86125b9565b90505f5f826001015f9054906101000a90046001600160a01b03166001600160a01b03166359498ab76040518163ffffffff1660e01b81526004015f60405180830381865afa1580156117fd573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611824919081019061446d565b915091505f611831610a5e565b6001600160a01b03166349b5fdb46040518163ffffffff1660e01b8152600401602060405180830381865afa15801561186c573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061189091906141a7565b90505f816001600160a01b031663a36fba3285856040518363ffffffff1660e01b81526004016118c192919061426d565b5f60405180830381865afa1580156118db573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261190291908101906144c6565b98509192505f915061191490506107f5565b9050801561193c578061192f83670de0b6b3a76400006141dd565b611939919061443b565b97505b5050505050509091565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff1615906001600160401b03165f8115801561198a5750825b90505f826001600160401b031660011480156119a55750303b155b9050811580156119b3575080155b156119d15760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff1916600117855583156119fb57845460ff60401b1916600160401b1785555b611a3f865f01516040518060400160405280600b81526020016a436f6d706f756e64696e6760a81b815250886020015189604001518a606001518b608001516130cc565b60a086015151151580611a56575060c08601515115155b15611a74576040516363cf6b6160e01b815260040160405180910390fd5b8315611ab657845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d290602001610d7f565b505050505050565b5f5f611ac86125b9565b600101546001600160a01b031692915050565b5f336107a1818585612e8c565b611af06126af565b5f611af96125b9565b90506001611b05610a5e565b6001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b40573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611b6491906141a7565b604051633433c01560e21b81523060048201526001600160a01b03919091169063d0cf005490602401602060405180830381865afa158015611ba8573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611bcc9190614169565b14611bea57604051630d7abd6f60e31b815260040160405180910390fd5b611c446040518061012001604052805f81526020015f81526020015f8152602001606081526020015f6001600160a01b031681526020015f6001600160a01b03168152602001606081526020015f81526020015f81525090565b60018201546001600160a01b03166080820152600482015460ff168015611cda5750610e1081608001516001600160a01b03166313e631806040518163ffffffff1660e01b8152600401602060405180830381865afa158015611ca9573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611ccd9190614169565b611cd7919061445a565b42115b8015611d45575080608001516001600160a01b03166374bac4296040518163ffffffff1660e01b8152600401602060405180830381865afa158015611d21573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611d4591906141c2565b15611d9d5780608001516001600160a01b0316634fa5d8546040518163ffffffff1660e01b81526004015f604051808303815f87803b158015611d86575f5ffd5b505af1158015611d98573d5f5f3e3d5ffd5b505050505b611da56107f5565b815f01818152505080608001516001600160a01b0316632ddbd13a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611ded573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611e119190614169565b6020820152805115801590611e2857506020810151155b15611e465760405163c993c2fd60e01b815260040160405180910390fd5b845160408201819052865114611e6f57604051630ef9926760e21b815260040160405180910390fd5b80608001516001600160a01b03166371a973056040518163ffffffff1660e01b81526004015f60405180830381865afa158015611eae573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611ed59190810190614393565b816060018190525080608001516001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f1d573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611f4191906141a7565b6001600160a01b031660a082015260408101516001148015611f6f575060a08101516001600160a01b031615155b8015611fa95750855f81518110611f8857611f88614415565b60200260200101516001600160a01b03168160a001516001600160a01b0316145b1561207857845f81518110611fc057611fc0614415565b602090810291909101015160e08201819052608082015160a0830151611ff3926001600160a01b039091169133916131aa565b608081015160e082015160405163b9f5be4160e01b81526001600160a01b039092169163b9f5be419161202c9160040190815260200190565b5f604051808303815f875af1158015612047573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261206e91908101906143cc565b60c08201526121e6565b80608001516001600160a01b0316636d98943987876040518363ffffffff1660e01b81526004016120aa92919061426d565b5f604051808303815f875af11580156120c5573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526120ec91908101906142ec565b60e083015260c08201525f5b816040015181101561216a576121623383608001518460c00151848151811061212357612123614415565b60200260200101518560600151858151811061214157612141614415565b60200260200101516001600160a01b03166131aa909392919063ffffffff16565b6001016120f8565b50608081015160c08201516040516328addc8b60e21b81526001600160a01b039092169163a2b7722c916121a091600401613c5a565b6020604051808303815f875af11580156121bc573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906121e09190614169565b60e08201525b8060e001515f0361220a57604051636654967560e11b815260040160405180910390fd5b61222d82825f01518360e0015184602001518560c001518987606001518a613204565b61010082019081526001600160a01b0384165f818152602085905260409081902043905560c08401519251905191927f39e231aec7d812a6b5ca9261d41ea0e91726779c6ad9074cb9a68fa7af4525cb9261228a928b929161453a565b60405180910390a25050610efb60015f5160206148085f395f51905f5255565b60605f5f5f6122b76125b9565b6001810154604051635b002c2d60e11b81529192506001600160a01b031690819063b600585a906122ee908a908a9060040161426d565b5f60405180830381865afa158015610f60573d5f5f3e3d5ffd5b6123106132bf565b5f6123196125b9565b90506007810161232a8385836145b3565b507f573252ad6e71066a287fba4a3ca4b6d9fe439b819cb0cd989d7b5bde717ab2f6838360405161235c92919061466c565b60405180910390a1505050565b6123716132bf565b5f61237a6125b9565b90506006810161238b8385836145b3565b507f37ef725074794ceb3e61870fc59c39fcaf72350f7e417059ace97870ea775fc7838360405161235c92919061466c565b5f5f6108066125b9565b6001600160a01b039182165f9081527f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace016020908152604080832093909416825291909152205490565b5f5f5f61241b6125b9565b90505f5f826001015f9054906101000a90046001600160a01b03166001600160a01b03166359498ab76040518163ffffffff1660e01b81526004015f60405180830381865afa158015612470573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052612497919081019061446d565b915091505f6124a4610a5e565b6001600160a01b03166349b5fdb46040518163ffffffff1660e01b8152600401602060405180830381865afa1580156124df573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061250391906141a7565b6040516351b7dd1960e11b81529091506001600160a01b0382169063a36fba3290612534908690869060040161426d565b5f60405180830381865afa15801561254e573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261257591908101906144c6565b9299929850919650505050505050565b5f6001600160e01b03198216630f1ec81f60e41b14806106d557506301ffc9a760e01b6001600160e01b03198316146106d5565b7fd602ae9af1fed726d4890dcf3c81a074ed87a6343646550e5de293c5a9330a0090565b7f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace0380546060915f5160206147e85f395f51905f529161261b90614131565b80601f016020809104026020016040519081016040528092919081815260200182805461264790614131565b80156126925780601f1061266957610100808354040283529160200191612692565b820191905f5260205f20905b81548152906001019060200180831161267557829003601f168201915b505050505091505090565b6126aa838383600161334e565b505050565b5f5160206148085f395f51905f528054600119016126e057604051633ee5aeb560e01b815260040160405180910390fd5b60029055565b6060336001600160a01b0383161461270357612703823387612e42565b845f03612723576040516371c42ac360e01b815260040160405180910390fd5b61272c826110b9565b85111561274c57604051633e665c4b60e11b815260040160405180910390fd5b835186511461276e57604051630ef9926760e21b815260040160405180910390fd5b5f6127776125b9565b90506127838184613432565b60018101546001600160a01b03165f61279a6107f5565b90505f826001600160a01b0316632ddbd13a6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156127d9573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906127fd9190614169565b905060605f846001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561283e573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061286291906141a7565b90505f8c51600114801561287e57506001600160a01b03821615155b80156128b457508c5f8151811061289757612897614415565b60200260200101516001600160a01b0316826001600160a01b0316145b90508315612a1f575f856128c8868f6141dd565b6128d2919061443b565b905081156129a457604080516001808252818301909252906020808301908036833701905050935080845f8151811061290d5761290d614415565b602002602001018181525050866001600160a01b03166399f428cf855f8151811061293a5761293a614415565b60200260200101518d6040518363ffffffff1660e01b81526004016129729291909182526001600160a01b0316602082015260400190565b5f604051808303815f87803b158015612989575f5ffd5b505af115801561299b573d5f5f3e3d5ffd5b50505050612a19565b866001600160a01b03166350f4e4198f838e6040518463ffffffff1660e01b81526004016129d49392919061469a565b5f604051808303815f875af11580156129ef573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052612a1691908101906143cc565b93505b50612be9565b8015612b6d576040805160018082528183019092529060208083019080368337019050506040516370a0823160e01b81526001600160a01b03888116600483015291945086918416906370a0823190602401602060405180830381865afa158015612a8c573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612ab09190614169565b612aba908e6141dd565b612ac4919061443b565b835f81518110612ad657612ad6614415565b602002602001018181525050856001600160a01b03166399f428cf845f81518110612b0357612b03614415565b60200260200101518c6040518363ffffffff1660e01b8152600401612b3b9291909182526001600160a01b0316602082015260400190565b5f604051808303815f87803b158015612b52575f5ffd5b505af1158015612b64573d5f5f3e3d5ffd5b50505050612be9565b604051633e616c2f60e21b8152600481018d9052602481018690526001600160a01b038b8116604483015287169063f985b0bc906064015f604051808303815f875af1158015612bbf573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052612be691908101906143cc565b92505b82515f5b81811015612caa578c8181518110612c0757612c07614415565b6020026020010151858281518110612c2157612c21614415565b60200260200101511015612ca2578e8181518110612c4157612c41614415565b6020026020010151858281518110612c5b57612c5b614415565b60200260200101518e8381518110612c7557612c75614415565b60200260200101516040516330d597ab60e01b8152600401612c99939291906146cc565b60405180910390fd5b600101612bed565b50505050612cb8878b613492565b866001600160a01b0316336001600160a01b03167ff6f76fa9e624451c5234aa077063a68dad722c8790170478f0b28b3dc3722bcc8d8d85604051612cff939291906146ed565b60405180910390a39a9950505050505050505050565b60015f5160206148085f395f51905f5255565b5f612d31610a5e565b9050336001600160a01b0316816001600160a01b0316635aa6e6756040518163ffffffff1660e01b8152600401602060405180830381865afa158015612d79573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612d9d91906141a7565b6001600160a01b03161480612e225750336001600160a01b0316816001600160a01b0316634783c35b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612df3573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612e1791906141a7565b6001600160a01b0316145b612e3f576040516354299b6f60e01b815260040160405180910390fd5b50565b5f612e4d84846123c7565b90505f198114610efb5781811015612e7e57828183604051637dc7a0d960e11b8152600401612c99939291906146cc565b610efb84848484035f61334e565b6001600160a01b038316612eb557604051634b637e8f60e11b81525f6004820152602401612c99565b6001600160a01b038216612ede5760405163ec442f0560e01b81525f6004820152602401612c99565b6126aa8383836134c2565b6001600160a01b038216612f125760405163ec442f0560e01b81525f6004820152602401612c99565b612f1d5f83836134c2565b5050565b5f808615612f485784612f3488886141dd565b612f3e919061443b565b91505f9050613084565b5f612f51610a5e565b6001600160a01b03166349b5fdb46040518163ffffffff1660e01b8152600401602060405180830381865afa158015612f8c573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612fb091906141a7565b6040516351b7dd1960e11b81529091506001600160a01b0382169063a36fba3290612fe1908790899060040161426d565b5f60405180830381865afa158015612ffb573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261302291908101906144c6565b5091945066038d7ea4c68000935061304091508390506103e86141dd565b8310156130765782613054836103e86141dd565b604051637592afef60e01b815260048101929092526024820152604401612c99565b6130808284614194565b9250505b9550959350505050565b7f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace0480546060915f5160206147e85f395f51905f529161261b90614131565b6130d4613507565b6130dd86613550565b6130e783836136a1565b5f6130f06125b9565b9050600581016131008782614717565b506001810180546001600160a01b0319166001600160a01b0387161790556003810182905561312d6136b3565b846001600160a01b0316639736374e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613169573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061318d91906141c2565b600491909101805460ff1916911515919091179055505050505050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610efb9085906136c3565b5f5f6132138989898988612f21565b60028c0154919350915080158015906132345750806132328b8561445a565b115b1561325557604051635dae7a7560e11b815260048101829052602401612c99565b8583101561328057604051637a672cf560e11b81526004810184905260248101879052604401612c99565b81156132955761329561dead60901b83612ee9565b6001600160a01b0384166132a7573393505b6132b18484612ee9565b505098975050505050505050565b6132c7610a5e565b6040516336b87bd760e11b81523360048201526001600160a01b039190911690636d70f7ae90602401602060405180830381865afa15801561330b573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061332f91906141c2565b61334c57604051631f0853c160e21b815260040160405180910390fd5b565b5f5160206147e85f395f51905f526001600160a01b0385166133855760405163e602df0560e01b81525f6004820152602401612c99565b6001600160a01b0384166133ae57604051634a1406b160e11b81525f6004820152602401612c99565b6001600160a01b038086165f9081526001830160209081526040808320938816835292905220839055811561342b57836001600160a01b0316856001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258560405161342291815260200190565b60405180910390a35b5050505050565b6001600160a01b0381165f9081526020839052604090205443906134589060059061445a565b1061347657604051630add1e2b60e21b815260040160405180910390fd5b6001600160a01b03165f90815260209190915260409020439055565b6001600160a01b0382166134bb57604051634b637e8f60e11b81525f6004820152602401612c99565b612f1d825f835b6134cd838383613724565b5f6134d66125b9565b6001600160a01b039485165f9081526020919091526040808220439081905594909516815293909320919091555050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff1661334c57604051631afcd79f60e31b815260040160405180910390fd5b613558613507565b6001600160a01b038116158015906135e157505f6001600160a01b0316816001600160a01b0316634783c35b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156135b1573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906135d591906141a7565b6001600160a01b031614155b6135fe576040516371c42ac360e01b815260040160405180910390fd5b61363161362c60017faa116a42804728f23983458454b6eb9c6ddf3011db9f9addaf3cd7508d85b0d6614194565b829055565b6136634361366060017f812a673dfca07956350df10f8a654925f561d7a0da09bdbe79e653939a14d9f1614194565b55565b7f1a2dd071001ebf6e03174e3df5b305795a4ad5d41d8fdb9ba41dbbe236713426814243604051613696939291906146cc565b60405180910390a150565b6136a9613507565b612f1d828261384a565b6136bb613507565b61334c61389a565b5f6136d76001600160a01b038416836138a2565b905080515f141580156136fb5750808060200190518101906136f991906141c2565b155b156126aa57604051635274afe760e01b81526001600160a01b0384166004820152602401612c99565b5f5160206147e85f395f51905f526001600160a01b03841661375e5781816002015f828254613753919061445a565b909155506137bb9050565b6001600160a01b0384165f908152602082905260409020548281101561379d5784818460405163391434e360e21b8152600401612c99939291906146cc565b6001600160a01b0385165f9081526020839052604090209083900390555b6001600160a01b0383166137d95760028101805483900390556137f7565b6001600160a01b0383165f9081526020829052604090208054830190555b826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161383c91815260200190565b60405180910390a350505050565b613852613507565b5f5160206147e85f395f51905f527f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace0361388b8482614717565b5060048101610efb8382614717565b612d15613507565b60606107da83835f845f5f856001600160a01b031684866040516138c691906147d1565b5f6040518083038185875af1925050503d805f8114613900576040519150601f19603f3d011682016040523d82523d5f602084013e613905565b606091505b509150915061391586838361391f565b9695505050505050565b6060826139345761392f8261397b565b6107da565b815115801561394b57506001600160a01b0384163b155b1561397457604051639996b31560e01b81526001600160a01b0385166004820152602401612c99565b50806107da565b80511561398b5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b5f602082840312156139b4575f5ffd5b81356001600160e01b0319811681146107da575f5ffd5b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f6107da60208301846139cb565b6001600160a01b0381168114612e3f575f5ffd5b8035613a2a81613a0b565b919050565b5f5f60408385031215613a40575f5ffd5b8235613a4b81613a0b565b946020939093013593505050565b634e487b7160e01b5f52604160045260245ffd5b60405160e081016001600160401b0381118282101715613a8f57613a8f613a59565b60405290565b604051601f8201601f191681016001600160401b0381118282101715613abd57613abd613a59565b604052919050565b5f6001600160401b03821115613add57613add613a59565b5060051b60200190565b5f82601f830112613af6575f5ffd5b8135613b09613b0482613ac5565b613a95565b8082825260208201915060208360051b860101925085831115613b2a575f5ffd5b602085015b83811015613b50578035613b4281613a0b565b835260209283019201613b2f565b5095945050505050565b5f82601f830112613b69575f5ffd5b8135613b77613b0482613ac5565b8082825260208201915060208360051b860101925085831115613b98575f5ffd5b602085015b83811015613b50578035835260209283019201613b9d565b5f5f5f60608486031215613bc7575f5ffd5b83356001600160401b03811115613bdc575f5ffd5b613be886828701613ae7565b9350506020840135915060408401356001600160401b03811115613c0a575f5ffd5b613c1686828701613b5a565b9150509250925092565b5f8151808452602084019350602083015f5b82811015613c50578151865260209586019590910190600101613c32565b5093949350505050565b602081525f6107da6020830184613c20565b8015158114612e3f575f5ffd5b5f60208284031215613c89575f5ffd5b81356107da81613c6c565b5f5f5f60608486031215613ca6575f5ffd5b8335613cb181613a0b565b92506020840135613cc181613a0b565b929592945050506040919091013590565b5f5f5f5f5f60a08688031215613ce6575f5ffd5b85356001600160401b03811115613cfb575f5ffd5b613d0788828901613ae7565b9550506020860135935060408601356001600160401b03811115613d29575f5ffd5b613d3588828901613b5a565b9350506060860135613d4681613a0b565b91506080860135613d5681613a0b565b809150509295509295909350565b5f5f60408385031215613d75575f5ffd5b82356001600160401b03811115613d8a575f5ffd5b613d9685828601613ae7565b92505060208301356001600160401b03811115613db1575f5ffd5b613dbd85828601613b5a565b9150509250929050565b606081525f613dd96060830186613c20565b60208301949094525060400152919050565b5f60208284031215613dfb575f5ffd5b5035919050565b5f60208284031215613e12575f5ffd5b81356107da81613a0b565b5f8151808452602084019350602083015f5b82811015613c505781516001600160a01b0316865260209586019590910190600101613e2f565b848152836020820152608060408201525f613e746080830185613e1d565b8281036060840152613e868185613c20565b979650505050505050565b5f82601f830112613ea0575f5ffd5b81356001600160401b03811115613eb957613eb9613a59565b613ecc601f8201601f1916602001613a95565b818152846020838601011115613ee0575f5ffd5b816020850160208301375f918101602001919091529392505050565b5f60208284031215613f0c575f5ffd5b81356001600160401b03811115613f21575f5ffd5b820160e08185031215613f32575f5ffd5b613f3a613a6d565b613f4382613a1f565b8152613f5160208301613a1f565b602082015260408201356001600160401b03811115613f6e575f5ffd5b613f7a86828501613e91565b60408301525060608201356001600160401b03811115613f98575f5ffd5b613fa486828501613e91565b6060830152506080828101359082015260a08201356001600160401b03811115613fcc575f5ffd5b613fd886828501613ae7565b60a08301525060c08201356001600160401b03811115613ff6575f5ffd5b61400286828501613b5a565b60c083015250949350505050565b5f5f5f5f60808587031215614023575f5ffd5b84356001600160401b03811115614038575f5ffd5b61404487828801613ae7565b94505060208501356001600160401b0381111561405f575f5ffd5b61406b87828801613b5a565b93505060408501359150606085013561408381613a0b565b939692955090935050565b5f5f6020838503121561409f575f5ffd5b82356001600160401b038111156140b4575f5ffd5b8301601f810185136140c4575f5ffd5b80356001600160401b038111156140d9575f5ffd5b8560208284010111156140ea575f5ffd5b6020919091019590945092505050565b5f5f6040838503121561410b575f5ffd5b823561411681613a0b565b9150602083013561412681613a0b565b809150509250929050565b600181811c9082168061414557607f821691505b60208210810361416357634e487b7160e01b5f52602260045260245ffd5b50919050565b5f60208284031215614179575f5ffd5b5051919050565b634e487b7160e01b5f52601160045260245ffd5b818103818111156106d5576106d5614180565b5f602082840312156141b7575f5ffd5b81516107da81613a0b565b5f602082840312156141d2575f5ffd5b81516107da81613c6c565b80820281158282048414176106d5576106d5614180565b6001600160a01b03851681526080602080830182905285519183018290525f919086019060a0840190835b818110156142465783516001600160a01b031683526020938401939092019160010161421f565b5050838103604085015261425a8187613c20565b9250505082606083015295945050505050565b604081525f61427f6040830185613e1d565b82810360208401526109728185613c20565b5f82601f8301126142a0575f5ffd5b81516142ae613b0482613ac5565b8082825260208201915060208360051b8601019250858311156142cf575f5ffd5b602085015b83811015613b505780518352602092830192016142d4565b5f5f604083850312156142fd575f5ffd5b82516001600160401b03811115614312575f5ffd5b61431e85828601614291565b602094909401519395939450505050565b5f82601f83011261433e575f5ffd5b815161434c613b0482613ac5565b8082825260208201915060208360051b86010192508583111561436d575f5ffd5b602085015b83811015613b5057805161438581613a0b565b835260209283019201614372565b5f602082840312156143a3575f5ffd5b81516001600160401b038111156143b8575f5ffd5b6143c48482850161432f565b949350505050565b5f602082840312156143dc575f5ffd5b81516001600160401b038111156143f1575f5ffd5b6143c484828501614291565b5f6001820161440e5761440e614180565b5060010190565b634e487b7160e01b5f52603260045260245ffd5b602081525f6107da6020830184613e1d565b5f8261445557634e487b7160e01b5f52601260045260245ffd5b500490565b808201808211156106d5576106d5614180565b5f5f6040838503121561447e575f5ffd5b82516001600160401b03811115614493575f5ffd5b61449f8582860161432f565b92505060208301516001600160401b038111156144ba575f5ffd5b613dbd85828601614291565b5f5f5f5f608085870312156144d9575f5ffd5b845160208601519094506001600160401b038111156144f6575f5ffd5b61450287828801614291565b93505060408501516001600160401b0381111561451d575f5ffd5b61452987828801614291565b925050606085015161408381613c6c565b606081525f61454c6060830186613e1d565b828103602084015261455e8186613c20565b915050826040830152949350505050565b601f8211156126aa57805f5260205f20601f840160051c810160208510156145945750805b601f840160051c820191505b8181101561342b575f81556001016145a0565b6001600160401b038311156145ca576145ca613a59565b6145de836145d88354614131565b8361456f565b5f601f84116001811461460f575f85156145f85750838201355b5f19600387901b1c1916600186901b17835561342b565b5f83815260208120601f198716915b8281101561463e578685013582556020948501946001909201910161461e565b508682101561465a575f1960f88860031b161c19848701351681555b505060018560011b0183555050505050565b60208152816020820152818360408301375f818301604090810191909152601f909201601f19160101919050565b606081525f6146ac6060830186613e1d565b6020830194909452506001600160a01b0391909116604090910152919050565b6001600160a01b039390931683526020830191909152604082015260600190565b606081525f6146ff6060830186613e1d565b84602084015282810360408401526139158185613c20565b81516001600160401b0381111561473057614730613a59565b6147448161473e8454614131565b8461456f565b6020601f821160018114614776575f831561475f5750848201515b5f19600385901b1c1916600184901b17845561342b565b5f84815260208120601f198516915b828110156147a55787850151825560209485019460019092019101614785565b50848210156147c257868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b5f82518060208501845e5f92019182525091905056fe52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace009b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00a2646970667358221220f8713b85de3a91703a66f9611316a5e07fa3faac1644505862355f04064587de64736f6c634300081c0033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in S
Multichain Portfolio | 35 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.