ETH Price: $4,002.99 (-0.48%)

Contract

0x1Ea622fa030e4a78F4CC2f305dd3c08DA3F08573
 

More Info

Private Name Tags

TokenTracker

Multichain Info

No addresses found
Transaction Hash
Method
Block
Age
From
To
Collect Rewards209665692024-10-14 21:44:35348 days ago1728942275IN
0x1Ea622fa...DA3F08573
0 ETH0.0047629515.4957387
Collect Rewards209593352024-10-13 21:27:59349 days ago1728854879IN
0x1Ea622fa...DA3F08573
0 ETH0.005425717.65191824

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Method Block
Age
From
To
Deposit230551672025-08-02 18:28:2356 days ago1754159303
0x1Ea622fa...DA3F08573
8.13494009 ETH
Transfer230551672025-08-02 18:28:2356 days ago1754159303
0x1Ea622fa...DA3F08573
8.13494009 ETH
Deposit230478972025-08-01 18:03:1157 days ago1754071391
0x1Ea622fa...DA3F08573
7.14329927 ETH
Transfer230478972025-08-01 18:03:1157 days ago1754071391
0x1Ea622fa...DA3F08573
7.14329927 ETH
Deposit229962042025-07-25 12:37:2365 days ago1753447043
0x1Ea622fa...DA3F08573
3.49687215 ETH
Transfer229962042025-07-25 12:37:2365 days ago1753447043
0x1Ea622fa...DA3F08573
3.49687215 ETH
Deposit229657012025-07-21 6:12:5969 days ago1753078379
0x1Ea622fa...DA3F08573
58.68916918 ETH
Transfer229657012025-07-21 6:12:5969 days ago1753078379
0x1Ea622fa...DA3F08573
58.68916918 ETH
Deposit229476202025-07-18 17:36:1171 days ago1752860171
0x1Ea622fa...DA3F08573
4.38274694 ETH
Transfer229476202025-07-18 17:36:1171 days ago1752860171
0x1Ea622fa...DA3F08573
4.38274694 ETH
Deposit229456012025-07-18 10:51:1172 days ago1752835871
0x1Ea622fa...DA3F08573
3.38522685 ETH
Transfer229456012025-07-18 10:51:1172 days ago1752835871
0x1Ea622fa...DA3F08573
3.38522685 ETH
Deposit229276662025-07-15 22:47:4774 days ago1752619667
0x1Ea622fa...DA3F08573
31.792136 ETH
Transfer229276662025-07-15 22:47:4774 days ago1752619667
0x1Ea622fa...DA3F08573
31.792136 ETH
Deposit225817752025-05-28 14:12:35122 days ago1748441555
0x1Ea622fa...DA3F08573
37.32024343 ETH
Transfer225817752025-05-28 14:12:35122 days ago1748441555
0x1Ea622fa...DA3F08573
37.32024343 ETH
Deposit221964202025-04-04 15:22:11176 days ago1743780131
0x1Ea622fa...DA3F08573
44.97296254 ETH
Transfer221964202025-04-04 15:22:11176 days ago1743780131
0x1Ea622fa...DA3F08573
44.97296254 ETH
Deposit221925472025-04-04 2:24:23177 days ago1743733463
0x1Ea622fa...DA3F08573
88.53077089 ETH
Transfer221925472025-04-04 2:24:23177 days ago1743733463
0x1Ea622fa...DA3F08573
88.53077089 ETH
Deposit221444402025-03-28 9:12:59184 days ago1743153179
0x1Ea622fa...DA3F08573
4.61849165 ETH
Transfer221444402025-03-28 9:12:59184 days ago1743153179
0x1Ea622fa...DA3F08573
4.61849165 ETH
Deposit219039652025-02-22 19:29:35217 days ago1740252575
0x1Ea622fa...DA3F08573
71.6055777 ETH
Transfer219039652025-02-22 19:29:35217 days ago1740252575
0x1Ea622fa...DA3F08573
71.6055777 ETH
Deposit218456192025-02-14 15:33:35225 days ago1739547215
0x1Ea622fa...DA3F08573
17.36232836 ETH
View All Internal Transactions

Block Age Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Age Amount
View All Withdrawals

Transaction Hash Block Age Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Minimal Proxy Contract for 0xd78860acc0621d87aeea94f7d36eb7bb7cbe3631

Contract Name:
CurveConvexDestinationVault

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 200 runs

Other Settings:
london EvmVersion

Contract Source Code (Solidity Standard Json-Input format)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
import { Errors } from "src/utils/Errors.sol";
import { LibAdapter } from "src/libs/LibAdapter.sol";
import { IWETH9 } from "src/interfaces/utils/IWETH9.sol";
import { IPool } from "src/interfaces/external/curve/IPool.sol";
import { DestinationVault, IDestinationVault } from "src/vault/DestinationVault.sol";
import { ISystemRegistry } from "src/interfaces/ISystemRegistry.sol";
import { ICurveResolver } from "src/interfaces/utils/ICurveResolver.sol";
import { IMainRewarder } from "src/interfaces/rewarders/IMainRewarder.sol";
import { IConvexBooster } from "src/interfaces/external/convex/IConvexBooster.sol";
import { ConvexStaking } from "src/destinations/adapters/staking/ConvexAdapter.sol";
import { IBaseRewardPool } from "src/interfaces/external/convex/IBaseRewardPool.sol";
import { ConvexRewards } from "src/destinations/adapters/rewards/ConvexRewardsAdapter.sol";
import { CurveV2FactoryCryptoAdapter } from "src/destinations/adapters/CurveV2FactoryCryptoAdapter.sol";
import { IERC20Metadata as IERC20 } from "openzeppelin-contracts/token/ERC20/extensions/IERC20Metadata.sol";
import { IncentiveCalculatorBase } from "src/stats/calculators/base/IncentiveCalculatorBase.sol";
/// @notice Destination Vault to proxy a Curve Pool that goes into Convex
/// @dev Supports Curve V1 StableSwap, Curve V2 CryptoSwap, and Curve stETH/ETH-ng Pool
contract CurveConvexDestinationVault is DestinationVault {
/// @notice Only used to initialize the vault
struct InitParams {
/// @notice Pool this vault proxies
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
import { Address } from "openzeppelin-contracts/utils/Address.sol";
import { ISystemComponent } from "src/interfaces/ISystemComponent.sol";
// solhint-disable max-line-length
library Errors {
using Address for address;
///////////////////////////////////////////////////////////////////
// Set errors
///////////////////////////////////////////////////////////////////
error AccessDenied();
error ZeroAddress(string paramName);
error ZeroAmount();
error InsufficientBalance(address token);
error AssetNotAllowed(address token);
error NotImplemented();
error InvalidAddress(address addr);
error InvalidParam(string paramName);
error InvalidParams();
error UnsafePrice(address token, uint256 spotPrice, uint256 safePrice);
error AlreadySet(string param);
error AlreadyRegistered(address param);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
import { IERC20 } from "openzeppelin-contracts/token/ERC20/IERC20.sol";
import { SafeERC20 } from "openzeppelin-contracts/token/ERC20/utils/SafeERC20.sol";
library LibAdapter {
using SafeERC20 for IERC20;
address public constant CURVE_REGISTRY_ETH_ADDRESS_POINTER = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
error MinLpAmountNotReached();
error LpTokenAmountMismatch();
error NoNonZeroAmountProvided();
error InvalidBalanceChange();
// Utils
function _approve(IERC20 token, address spender, uint256 amount) internal {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance > 0) {
token.safeDecreaseAllowance(spender, currentAllowance);
}
token.safeIncreaseAllowance(spender, amount);
}
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import { IERC20 } from "openzeppelin-contracts/token/ERC20/IERC20.sol";
interface IWETH9 is IERC20 {
function symbol() external view returns (string memory);
function deposit() external payable;
function withdraw(uint256 amount) external;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
//slither-disable-next-line name-reused
interface IPool {
function coins(uint256 i) external view returns (address);
function balances(uint256 i) external view returns (uint256);
// These method used for cases when Pool is a LP token at the same time
function balanceOf(address account) external returns (uint256);
// These method used for cases when Pool is a LP token at the same time
function totalSupply() external returns (uint256);
// solhint-disable func-name-mixedcase
function lp_token() external returns (address);
function token() external returns (address);
function gamma() external;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

File 6 of 77 : DestinationVault.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
import { Roles } from "src/libs/Roles.sol";
import { Errors } from "src/utils/Errors.sol";
import { LibAdapter } from "src/libs/LibAdapter.sol";
import { SecurityBase } from "src/security/SecurityBase.sol";
import { ERC20 } from "openzeppelin-contracts/token/ERC20/ERC20.sol";
import { ISystemRegistry } from "src/interfaces/ISystemRegistry.sol";
import { ISwapRouter } from "src/interfaces/swapper/ISwapRouter.sol";
import { IMainRewarder } from "src/interfaces/rewarders/IMainRewarder.sol";
import { IDestinationVault } from "src/interfaces/vault/IDestinationVault.sol";
import { IDestinationVaultExtension } from "src/interfaces/vault/IDestinationVaultExtension.sol";
import { SafeERC20 } from "openzeppelin-contracts/token/ERC20/utils/SafeERC20.sol";
import { Initializable } from "openzeppelin-contracts/proxy/utils/Initializable.sol";
import { EnumerableSet } from "openzeppelin-contracts/utils/structs/EnumerableSet.sol";
import { IERC20Metadata as IERC20 } from "openzeppelin-contracts/token/ERC20/extensions/IERC20Metadata.sol";
import { IDexLSTStats } from "src/interfaces/stats/IDexLSTStats.sol";
import { SystemComponent } from "src/SystemComponent.sol";
import { IERC1271 } from "openzeppelin-contracts/interfaces/IERC1271.sol";
import { Address } from "openzeppelin-contracts/utils/Address.sol";
abstract contract DestinationVault is
SecurityBase,
SystemComponent,
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
import { IWETH9 } from "src/interfaces/utils/IWETH9.sol";
import { IAccToke } from "src/interfaces/staking/IAccToke.sol";
import { IAutopoolRegistry } from "src/interfaces/vault/IAutopoolRegistry.sol";
import { IAccessController } from "src/interfaces/security/IAccessController.sol";
import { ISwapRouter } from "src/interfaces/swapper/ISwapRouter.sol";
import { ICurveResolver } from "src/interfaces/utils/ICurveResolver.sol";
import { IAutopilotRouter } from "src/interfaces/vault/IAutopilotRouter.sol";
import { IAutopoolFactory } from "src/interfaces/vault/IAutopoolFactory.sol";
import { ISystemSecurity } from "src/interfaces/security/ISystemSecurity.sol";
import { IDestinationRegistry } from "src/interfaces/destinations/IDestinationRegistry.sol";
import { IRootPriceOracle } from "src/interfaces/oracles/IRootPriceOracle.sol";
import { IDestinationVaultRegistry } from "src/interfaces/vault/IDestinationVaultRegistry.sol";
import { IAccessController } from "src/interfaces/security/IAccessController.sol";
import { IStatsCalculatorRegistry } from "src/interfaces/stats/IStatsCalculatorRegistry.sol";
import { IAsyncSwapperRegistry } from "src/interfaces/liquidation/IAsyncSwapperRegistry.sol";
import { IERC20Metadata } from "openzeppelin-contracts/token/ERC20/extensions/IERC20Metadata.sol";
import { IIncentivesPricingStats } from "src/interfaces/stats/IIncentivesPricingStats.sol";
import { IMessageProxy } from "src/interfaces/messageProxy/IMessageProxy.sol";
/// @notice Root most registry contract for the system
interface ISystemRegistry {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
interface ICurveResolver {
/// @notice Resolve details of a Curve pool regardless of type or version
/// @dev This resolves tokens without unwrapping to underlying in the case of meta pools.
/// @param poolAddress pool address to lookup
/// @return tokens tokens that make up the pool
/// @return numTokens the number of tokens. tokens are not unwrapped.
/// @return isStableSwap is this a StableSwap pool. false = CryptoSwap
function resolve(address poolAddress)
external
view
returns (address[8] memory tokens, uint256 numTokens, bool isStableSwap);
/// @notice Resolve details of a Curve pool regardless of type or version
/// @dev This resolves tokens without unwrapping to underlying in the case of meta pools.
/// @dev Use the isStableSwap value to differentiate between StableSwap (V1) and CryptoSwap (V2) pools.
/// @param poolAddress pool address to lookup
/// @return tokens tokens that make up the pool
/// @return numTokens the number of tokens. tokens are not unwrapped
/// @return lpToken lp token of the pool
/// @return isStableSwap is this a StableSwap pool. false = CryptoSwap
function resolveWithLpToken(address poolAddress)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
import { IBaseRewarder } from "src/interfaces/rewarders/IBaseRewarder.sol";
import { IExtraRewarder } from "src/interfaces/rewarders/IExtraRewarder.sol";
interface IMainRewarder is IBaseRewarder {
error ExtraRewardsNotAllowed();
error MaxExtraRewardsReached();
/// @notice Extra rewards can be added, but not removed, ref: https://github.com/Tokemak/v2-core/issues/659
event ExtraRewardAdded(address reward);
/**
* @notice Adds an ExtraRewarder contract address to the extraRewards array.
* @param reward The address of the ExtraRewarder contract.
*/
function addExtraReward(address reward) external;
/**
* @notice Withdraws the specified amount of tokens from the vault for the specified account, and transfers all
* rewards for the account from this contract and any linked extra reward contracts.
* @param account The address of the account to withdraw tokens and claim rewards for.
* @param amount The amount of tokens to withdraw.
* @param claim If true, claims all rewards for the account from this contract and any linked extra reward
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
/// @notice main Convex contract(booster.sol) basic interface
interface IConvexBooster {
/// @notice deposit into convex, receive a tokenized deposit. parameter to stake immediately
function deposit(uint256 _pid, uint256 _amount, bool _stake) external returns (bool);
/// @notice get poolInfo for a poolId
function poolInfo(uint256 _pid)
external
view
returns (address lptoken, address token, address gauge, address crvRewards, address stash, bool shutdown);
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
import { IERC20 } from "openzeppelin-contracts/token/ERC20/IERC20.sol";
import { IBaseRewardPool } from "src/interfaces/external/convex/IBaseRewardPool.sol";
import { IConvexBooster } from "src/interfaces/external/convex/IConvexBooster.sol";
import { LibAdapter } from "src/libs/LibAdapter.sol";
library ConvexStaking {
event DeployLiquidity(address lpToken, address staking, uint256 poolId, uint256 amount);
event WithdrawLiquidity(address lpToken, address staking, uint256 amount);
error withdrawStakeFailed();
error DepositAndStakeFailed();
error PoolIdLpTokenMismatch();
error PoolIdStakingMismatch();
error PoolShutdown();
error MustBeMoreThanZero();
error ArraysLengthMismatch();
error BalanceMustIncrease();
error MinLpAmountNotReached();
error LpTokenAmountMismatch();
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
import { IERC20 } from "openzeppelin-contracts/token/ERC20/IERC20.sol";
interface IBaseRewardPool {
/// @notice The address of the staking token
function stakingToken() external view returns (address);
/// @notice The address of the reward token
function rewardToken() external view returns (IERC20);
/// @notice The length of the extra rewards array
function extraRewardsLength() external view returns (uint256);
/// @notice The pool PID
function pid() external view returns (uint256);
/// @notice The address of the extra rewards token at a given index
function extraRewards(uint256 i) external view returns (address);
/// @notice Called by a staker to get their allocated rewards
function getReward() external returns (bool);
/// @notice Gives a staker their rewards, with the option of claiming extra rewards
function getReward(address _account, bool _claimExtras) external returns (bool);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
import { Errors } from "src/utils/Errors.sol";
import { IERC20 } from "openzeppelin-contracts/token/ERC20/IERC20.sol";
import { SafeERC20 } from "openzeppelin-contracts/token/ERC20/utils/SafeERC20.sol";
import { RewardAdapter } from "src/destinations/adapters/rewards/RewardAdapter.sol";
import { IBaseRewardPool } from "src/interfaces/external/convex/IBaseRewardPool.sol";
import { EnumerableSet } from "openzeppelin-contracts/utils/structs/EnumerableSet.sol";
import { IConvexStashToken } from "src/interfaces/external/convex/IConvexStashToken.sol";
//slither-disable-start missing-inheritance,low-level-calls
library ConvexRewards {
using SafeERC20 for IERC20;
using EnumerableSet for EnumerableSet.AddressSet;
/// @notice Claim rewards for Convex staked LP tokens
/// @dev tokens can be returned in any order. uint256(0)/address(0) can be returned
/// @param gauge the reward contract in Convex
/// @param defaultToken the reward token always provided. CVX for Convex
/// @param sendTo the destination of the rewarded tokens
/// @param trackedTokens tokens that should not be sent off to the 'sendTo'
/// @return amounts the amount of each token that was claimed (includes balance already held by caller)
/// @return tokens the tokens that were claimed
function claimRewards(
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
import { IERC20 } from "openzeppelin-contracts/token/ERC20/IERC20.sol";
import { ICurveStableSwapNG } from "src/interfaces/external/curve/ICurveStableSwapNG.sol";
import { ICryptoSwapPool, IPool } from "src/interfaces/external/curve/ICryptoSwapPool.sol";
import { IWETH9 } from "src/interfaces/utils/IWETH9.sol";
import { LibAdapter } from "src/libs/LibAdapter.sol";
import { Errors } from "src/utils/Errors.sol";
//slither-disable-start similar-names
library CurveV2FactoryCryptoAdapter {
event WithdrawLiquidity(
uint256[] amountsWithdrawn,
address[] tokens,
// 0 - lpBurnAmount
// 1 - lpShare
// 2 - lpTotalSupply
uint256[3] lpAmounts,
address poolAddress
);
function removeLiquidity(
uint256[] memory amounts,
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
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.
*/
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
import { Math } from "openzeppelin-contracts/utils/math/Math.sol";
import { IBaseRewardPool } from "src/interfaces/external/convex/IBaseRewardPool.sol";
import { IERC20Metadata } from "openzeppelin-contracts/token/ERC20/extensions/IERC20Metadata.sol";
import { IDexLSTStats } from "src/interfaces/stats/IDexLSTStats.sol";
import { ISystemRegistry } from "src/interfaces/ISystemRegistry.sol";
import { IStatsCalculator } from "src/interfaces/stats/IStatsCalculator.sol";
import { IIncentivesPricingStats } from "src/interfaces/stats/IIncentivesPricingStats.sol";
import { Errors } from "src/utils/Errors.sol";
import { Stats } from "src/stats/Stats.sol";
import { BaseStatsCalculator } from "src/stats/calculators/base/BaseStatsCalculator.sol";
abstract contract IncentiveCalculatorBase is BaseStatsCalculator, IDexLSTStats {
/// @dev Interval between two consecutive snapshot steps during the snapshot process.
uint256 public constant SNAPSHOT_INTERVAL = 1 hours;
/// @dev Non-trivial annual rate set at 0.5% (in fixed point format 1e18 = 1).
uint256 public constant NON_TRIVIAL_ANNUAL_RATE = 5e15;
/// @dev Duration after which a price/data becomes stale.
uint40 public constant PRICE_STALE_CHECK = 12 hours;
/// @dev Cap on allowable credits in the system.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

File 18 of 77 : ISystemComponent.sol
1
2
3
4
5
6
7
8
9
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
/// @notice Stores a reference to the registry for this system
interface ISystemComponent {
/// @notice The system instance this contract is tied to
function getSystemRegistry() external view returns (address registry);
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @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 amount of tokens in existence.
*/
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../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;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

File 21 of 77 : Roles.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
library Roles {
// Naming Conventions:
// - Use MANAGER, CREATOR, UPDATER, ..., for roles primarily managing on-chain activities.
// - Use EXECUTOR for roles that trigger off-chain initiated actions.
// - Group roles by functional area for clarity.
// Destination Vault Management
bytes32 public constant DESTINATION_VAULT_FACTORY_MANAGER = keccak256("CREATE_DESTINATION_VAULT_ROLE");
bytes32 public constant DESTINATION_VAULT_REGISTRY_MANAGER = keccak256("DESTINATION_VAULT_REGISTRY_MANAGER");
bytes32 public constant DESTINATION_VAULT_MANAGER = keccak256("DESTINATION_VAULT_MANAGER");
// Auto Pool Factory and Registry Management
bytes32 public constant AUTO_POOL_REGISTRY_UPDATER = keccak256("REGISTRY_UPDATER");
bytes32 public constant AUTO_POOL_FACTORY_MANAGER = keccak256("AUTO_POOL_FACTORY_MANAGER");
bytes32 public constant AUTO_POOL_FACTORY_VAULT_CREATOR = keccak256("CREATE_POOL_ROLE");
// Auto Pool Management
bytes32 public constant AUTO_POOL_DESTINATION_UPDATER = keccak256("DESTINATION_VAULTS_UPDATER");
bytes32 public constant AUTO_POOL_FEE_UPDATER = keccak256("AUTO_POOL_FEE_SETTER_ROLE");
bytes32 public constant AUTO_POOL_PERIODIC_FEE_UPDATER = keccak256("AUTO_POOL_PERIODIC_FEE_SETTER_ROLE");
bytes32 public constant AUTO_POOL_REWARD_MANAGER = keccak256("AUTO_POOL_REWARD_MANAGER_ROLE");
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
import { IAccessController } from "src/interfaces/security/IAccessController.sol";
import { Errors } from "src/utils/Errors.sol";
contract SecurityBase {
IAccessController public immutable accessController;
error UndefinedAddress();
constructor(address _accessController) {
if (_accessController == address(0)) revert UndefinedAddress();
accessController = IAccessController(_accessController);
}
modifier onlyOwner() {
accessController.verifyOwner(msg.sender);
_;
}
modifier hasRole(bytes32 role) {
if (!accessController.hasRole(role, msg.sender)) revert Errors.AccessDenied();
_;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.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}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* 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].
*
* 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}.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
import { ISyncSwapper } from "src/interfaces/swapper/ISyncSwapper.sol";
interface ISwapRouter {
struct SwapData {
address token;
address pool;
ISyncSwapper swapper;
bytes data;
}
error MaxSlippageExceeded();
error SwapRouteLookupFailed(address from, address to);
error SwapFailed();
event SwapRouteSet(address indexed token, SwapData[] routes);
event SwapForQuoteSuccessful(
address indexed assetToken,
uint256 sellAmount,
address indexed quoteToken,
uint256 minBuyAmount,
uint256 buyAmount
);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

File 25 of 77 : IDestinationVault.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
import { IERC20Metadata as IERC20 } from "openzeppelin-contracts/token/ERC20/extensions/IERC20Metadata.sol";
import { IBaseAssetVault } from "src/interfaces/vault/IBaseAssetVault.sol";
import { IMainRewarder } from "src/interfaces/rewarders/IMainRewarder.sol";
import { IDexLSTStats } from "src/interfaces/stats/IDexLSTStats.sol";
import { ISystemComponent } from "src/interfaces/ISystemComponent.sol";
interface IDestinationVault is ISystemComponent, IBaseAssetVault, IERC20 {
enum VaultShutdownStatus {
Active,
Deprecated,
Exploit
}
error LogicDefect();
error BaseAmountReceived(uint256 amount);
/* ******************************** */
/* View */
/* ******************************** */
/// @notice A full unit of this vault
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
interface IDestinationVaultExtension {
function execute(bytes calldata data) external;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/Address.sol";
/**
* @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]
* ```
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.
pragma solidity ^0.8.0;
/**
* @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.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

File 29 of 77 : IDexLSTStats.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
import { ILSTStats } from "src/interfaces/stats/ILSTStats.sol";
/// @title Return stats DEXs with LSTs
interface IDexLSTStats {
event DexSnapshotTaken(uint256 snapshotTimestamp, uint256 priorFeeApr, uint256 newFeeApr, uint256 unfilteredFeeApr);
struct StakingIncentiveStats {
// time-weighted average total supply to prevent spikes/attacks from impacting rebalancing
uint256 safeTotalSupply;
// rewardTokens, annualizedRewardAmounts, and periodFinishForRewards will match indexes
// they are split to workaround an issue with forge having nested structs
// address of the reward tokens
address[] rewardTokens;
// the annualized reward rate for the reward token
uint256[] annualizedRewardAmounts;
// the timestamp for when the rewards are set to terminate
uint40[] periodFinishForRewards;
// incentive rewards score. max 48, min 0
uint8 incentiveCredits;
}
struct DexLSTStatsData {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
import { ISystemComponent } from "src/interfaces/ISystemComponent.sol";
import { ISystemRegistry } from "src/interfaces/ISystemRegistry.sol";
import { Errors } from "src/utils/Errors.sol";
contract SystemComponent is ISystemComponent {
ISystemRegistry internal immutable systemRegistry;
constructor(ISystemRegistry _systemRegistry) {
Errors.verifyNotZero(address(_systemRegistry), "_systemRegistry");
systemRegistry = _systemRegistry;
}
/// @inheritdoc ISystemComponent
function getSystemRegistry() external view returns (address) {
return address(systemRegistry);
}
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC1271 standard signature validation method for
* contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].
*
* _Available since v4.1._
*/
interface IERC1271 {
/**
* @dev Should return whether the signature provided is valid for the provided data
* @param hash Hash of the data to be signed
* @param signature Signature byte array associated with _data
*/
function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
import { IERC20Metadata } from "openzeppelin-contracts/token/ERC20/extensions/IERC20Metadata.sol";
interface IAccToke {
///////////////////////////////////////////////////////////////////
// Variables
///////////////////////////////////////////////////////////////////
function startEpoch() external view returns (uint256);
function minStakeDuration() external view returns (uint256);
struct Lockup {
uint128 amount;
uint128 end;
uint256 points;
}
function getLockups(address user) external view returns (Lockup[] memory);
function toke() external view returns (IERC20Metadata);
///////////////////////////////////////////////////////////////////
// Errors
///////////////////////////////////////////////////////////////////
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
/// @title Keep track of Vaults created through the Vault Factory
interface IAutopoolRegistry {
///////////////////////////////////////////////////////////////////
// Errors
///////////////////////////////////////////////////////////////////
error VaultNotFound(address vaultAddress);
error VaultAlreadyExists(address vaultAddress);
///////////////////////////////////////////////////////////////////
// Events
///////////////////////////////////////////////////////////////////
event VaultAdded(address indexed asset, address indexed vault);
event VaultRemoved(address indexed asset, address indexed vault);
///////////////////////////////////////////////////////////////////
// Functions
///////////////////////////////////////////////////////////////////
/// @notice Checks if an address is a valid vault
/// @param vaultAddress Vault address to be added
function isVault(address vaultAddress) external view returns (bool);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
import { IAccessControlEnumerable } from "openzeppelin-contracts/access/IAccessControlEnumerable.sol";
interface IAccessController is IAccessControlEnumerable {
error AccessDenied();
/**
* @notice Setup a role for an account
* @param role The role to setup
* @param account The account to setup the role for
*/
function setupRole(bytes32 role, address account) external;
/**
* @notice Verify if an account is an owner. Reverts if not
* @param account The account to verify
*/
function verifyOwner(address account) external view;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
import { IAutopool } from "src/interfaces/vault/IAutopool.sol";
import { IAutopilotRouterBase } from "src/interfaces/vault/IAutopilotRouterBase.sol";
import { IRewards } from "src/interfaces/rewarders/IRewards.sol";
import { SwapParams } from "src/interfaces/liquidation/IAsyncSwapper.sol";
/**
* @title IAutopilotRouter Interface
* @notice Extends the IAutopilotRouterBase with specific flows to save gas
*/
interface IAutopilotRouter is IAutopilotRouterBase {
/**
* *************************** Deposit ********************************
*/
/**
* @notice deposit available asset balance to a AutopoolETH.
* @param vault The AutopoolETH to deposit assets to.
* @param to The destination of ownership shares.
* @param minSharesOut The min amount of `vault` shares received by `to`.
* @return sharesOut the amount of shares received by `to`.
* @dev throws MinSharesError
*/
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
interface IAutopoolFactory {
///////////////////////////////////////////////////////////////////
// Vault Creation
///////////////////////////////////////////////////////////////////
/**
* @notice Spin up a new AutopoolETH
* @param strategy Strategy template address
* @param symbolSuffix Symbol suffix of the new token
* @param descPrefix Description prefix of the new token
* @param salt Vault creation salt
* @param extraParams Any extra data needed for the vault
*/
function createVault(
address strategy,
string memory symbolSuffix,
string memory descPrefix,
bytes32 salt,
bytes calldata extraParams
) external payable returns (address newVaultAddress);
function addStrategyTemplate(address strategyTemplate) external;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
interface ISystemSecurity {
/// @notice Get the number of NAV/share operations currently in progress
/// @return Number of operations
function navOpsInProgress() external view returns (uint256);
/// @notice Called at the start of any NAV/share changing operation
function enterNavOperation() external;
/// @notice Called at the end of any NAV/share changing operation
function exitNavOperation() external;
/// @notice Whether or not the system as a whole is paused
function isSystemPaused() external returns (bool);
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
import { IDestinationAdapter } from "src/interfaces/destinations/IDestinationAdapter.sol";
interface IDestinationRegistry {
event Register(bytes32[] indexed destinationTypes, address[] indexed targets);
event Replace(bytes32[] indexed destinationTypes, address[] indexed targets);
event Unregister(bytes32[] indexed destinationTypes);
event Whitelist(bytes32[] indexed destinationTypes);
event RemoveFromWhitelist(bytes32[] indexed destinationTypes);
error InvalidAddress(address addr);
error NotAllowedDestination();
error DestinationAlreadySet();
/**
* @notice Adds a new addresses of the given destination types
* @dev Fails if trying to overwrite previous value of the same destination type
* @param destinationTypes Ones from the destination type whitelist
* @param targets addresses of the deployed DestinationAdapters, cannot be 0
*/
function register(bytes32[] calldata destinationTypes, address[] calldata targets) external;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
/// @notice Retrieve a price for any token used in the system
interface IRootPriceOracle {
/// @notice Returns a fair price for the provided token in ETH
/// @param token token to get the price of
/// @return price the price of the token in ETH
function getPriceInEth(address token) external returns (uint256 price);
/// @notice Returns a spot price for the provided token in ETH, utilizing specified liquidity pool
/// @param token token to get the spot price of
/// @param pool liquidity pool to be used for price determination
/// @return price the spot price of the token in ETH based on the provided pool
function getSpotPriceInEth(address token, address pool) external returns (uint256);
/// @notice Returns a price for base token in quote token.
/// @dev Requires both tokens to be registered.
/// @param base Address of base token.
/// @param quote Address of quote token.
/// @return price Price of the base token in quote token.
function getPriceInQuote(address base, address quote) external returns (uint256 price);
/// @notice Retrieve the price of LP token based on the reserves
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
import { IDestinationVaultFactory } from "src/interfaces/vault/IDestinationVaultFactory.sol";
/// @notice Tracks valid Destination Vaults for the system
interface IDestinationVaultRegistry {
/// @notice Determines if a given address is a valid Destination Vault in the system
/// @param destinationVault address to check
/// @return True if vault is registered
function isRegistered(address destinationVault) external view returns (bool);
/// @notice Registers a new Destination Vault
/// @dev Should be locked down to only a factory
/// @param newDestinationVault Address of the new vault
function register(address newDestinationVault) external;
/// @notice Checks if an address is a valid Destination Vault and reverts if not
/// @param destinationVault Destination Vault address to checked
function verifyIsRegistered(address destinationVault) external view;
/// @notice Returns a list of all registered vaults
function listVaults() external view returns (address[] memory);
/// @notice Factory that is allowed to create and registry Destination Vaults
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
import { IStatsCalculator } from "src/interfaces/stats/IStatsCalculator.sol";
/// @notice Track stat calculators for this instance of the system
interface IStatsCalculatorRegistry {
/// @notice Get a registered calculator
/// @dev Should revert if missing
/// @param aprId key of the calculator to get
/// @return calculator instance of the calculator
function getCalculator(bytes32 aprId) external view returns (IStatsCalculator calculator);
/// @notice List all calculator addresses registered
function listCalculators() external view returns (bytes32[] memory, address[] memory);
/// @notice Register a new stats calculator
/// @param calculator address of the calculator
function register(address calculator) external;
/// @notice Remove a stats calculator
/// @param aprId key of the calculator to remove
function removeCalculator(bytes32 aprId) external;
/// @notice Set the factory that can register calculators
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
interface IAsyncSwapperRegistry {
event SwapperAdded(address indexed item);
event SwapperRemoved(address indexed item);
/// @notice Registers an item
/// @param item Item address to be added
function register(address item) external;
/// @notice Removes item registration
/// @param item Item address to be removed
function unregister(address item) external;
/// @notice Returns a list of all registered items
function list() external view returns (address[] memory);
/// @notice Checks if an address is a valid item
/// @param item Item address to be checked
function isRegistered(address item) external view returns (bool);
/// @notice Checks if an address is a valid swapper and reverts if not
/// @param item Swapper address to be checked
function verifyIsRegistered(address item) external view;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
/// @title EWMA pricing for incentive tokens
interface IIncentivesPricingStats {
event TokenAdded(address indexed token);
event TokenRemoved(address indexed token);
event TokenSnapshot(
address indexed token,
uint40 lastSnapshot,
uint256 fastFilterPrice,
uint256 slowFilterPrice,
uint256 initCount,
bool initComplete
);
error TokenAlreadyRegistered(address token);
error TokenNotFound(address token);
error IncentiveTokenPriceStale(address token);
error TokenSnapshotNotReady(address token);
struct TokenSnapshotInfo {
uint40 lastSnapshot;
bool _initComplete;
uint8 _initCount;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
/// @title Send messages to our systems on other chains
interface IMessageProxy {
function sendMessage(bytes32 messageType, bytes memory message) external;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
interface IBaseRewarder {
error RecoverDurationPending();
event RewardAdded(
uint256 reward,
uint256 rewardRate,
uint256 lastUpdateBlock,
uint256 periodInBlockFinish,
uint256 historicalRewards
);
event UserRewardUpdated(
address indexed user, uint256 amount, uint256 rewardPerTokenStored, uint256 lastUpdateBlock
);
event Staked(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
event RewardPaid(address indexed user, address indexed recipient, uint256 reward);
event QueuedRewardsUpdated(uint256 startingQueuedRewards, uint256 startingNewRewards, uint256 queuedRewards);
event AddedToWhitelist(address indexed wallet);
event RemovedFromWhitelist(address indexed wallet);
event TokeLockDurationUpdated(uint256 newDuration);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
import { IBaseRewarder } from "src/interfaces/rewarders/IBaseRewarder.sol";
interface IExtraRewarder is IBaseRewarder {
/**
* @notice Withdraws the specified amount of tokens from the vault for the specified account.
* @param account The address of the account to withdraw tokens for.
* @param amount The amount of tokens to withdraw.
*/
function withdraw(address account, uint256 amount) external;
/**
* @notice Claims and transfers all rewards for the specified account from this contract.
* @param account The address of the account to claim rewards for.
* @param recipient The address to send the rewards to.
*/
function getReward(address account, address recipient) external;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
/// @title Common functionality for reward adapter libraries
library RewardAdapter {
error ClaimRewardsFailed();
event RewardsClaimed(address[] tokens, uint256[] amounts);
/// @notice Emit RewardsClaimed(address[],uint256[]) event common to all reward claim libraries
/// @param tokens reward token addresses claimed
/// @param amounts amounts of each token claimed
function emitRewardsClaimed(address[] memory tokens, uint256[] memory amounts) internal {
emit RewardsClaimed(tokens, amounts);
}
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
interface IConvexStashToken {
/// @notice Returns actual reward token
function token() external view returns (address);
/// @notice Returns whether the current stash token is invalid
function isInvalid() external view returns (bool);
/// @notice Returns current balance of the given wallet
/// @param wallet address to balance for
function balanceOf(address wallet) external view returns (uint256);
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
// solhint-disable var-name-mixedcase,func-name-mixedcase
/// @notice Interface for next generation Curve pool oracle functionality.
interface ICurveStableSwapNG {
/// @notice Returns current price in pool.
function price_oracle() external view returns (uint256);
function add_liquidity(uint256[] memory amounts, uint256 min_mint_amount) external payable returns (uint256);
function remove_liquidity(uint256 amount, uint256[] memory min_amounts) external returns (uint256[] memory);
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
import { IPool } from "src/interfaces/external/curve/IPool.sol";
/* solhint-disable func-name-mixedcase, var-name-mixedcase */
interface ICryptoSwapPool is IPool {
function token() external returns (address);
// slither-disable-start naming-convention
function add_liquidity(uint256[2] memory amounts, uint256 min_mint_amount) external payable returns (uint256);
function add_liquidity(uint256[3] memory amounts, uint256 min_mint_amount) external payable returns (uint256);
function add_liquidity(uint256[4] memory amounts, uint256 min_mint_amount) external payable returns (uint256);
function remove_liquidity(uint256 amount, uint256[2] memory min_amounts) external;
function remove_liquidity(uint256 amount, uint256[3] memory min_amounts) external;
function remove_liquidity(uint256 amount, uint256[4] memory min_amounts) external;
function remove_liquidity_one_coin(uint256 token_amount, uint256 i, uint256 min_amount) external;
// slither-disable-end naming-convention
function get_virtual_price() external returns (uint256);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @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) {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
/// @title Capture information about a pool or destination
interface IStatsCalculator {
/// @notice thrown when no snapshot is taken
error NoSnapshotTaken();
/// @notice The id for this instance of a calculator
function getAprId() external view returns (bytes32);
/// @notice The id of the underlying asset/pool/destination this calculator represents
/// @dev This may be a generated address
function getAddressId() external view returns (address);
/// @notice Setup the calculator after it has been copied
/// @dev Should only be executed one time
/// @param dependentAprIds apr ids that cover the dependencies of this calculator
/// @param initData setup data specific to this type of calculator
function initialize(bytes32[] calldata dependentAprIds, bytes calldata initData) external;
/// @notice Capture stat data about this setup
function snapshot() external;
/// @notice Indicates if a snapshot should be taken
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
import { Errors } from "src/utils/Errors.sol";
library Stats {
uint256 public constant SECONDS_IN_YEAR = 365 * 24 * 60 * 60;
uint256 public constant DEX_FEE_APR_SNAPSHOT_INTERVAL = 24 * 60 * 60; // daily
uint256 public constant DEX_FEE_APR_FILTER_INIT_INTERVAL = 9 * 24 * 60 * 60; // 9 days
uint256 public constant DEX_FEE_ALPHA = 1e17; // 0.1; must be less than 1e18
uint256 public constant INCENTIVE_INFO_SNAPSHOT_INTERVAL = 24 * 60 * 60; // daily
address public constant CURVE_ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
/// @notice thrown if end timestamp is before start timestamp
error IncorrectTimestamps();
/// @notice thrown if a divisor is zero
error ZeroDivisor();
/// @notice thrown if expecting a negative change but get a positive change
error NonNegativeChange();
/// @dev When registering dependent calculators, use this value for tokens/pools/etc that should be ignored
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
import { Roles } from "src/libs/Roles.sol";
import { Errors } from "src/utils/Errors.sol";
import { SecurityBase } from "src/security/SecurityBase.sol";
import { SystemComponent } from "src/SystemComponent.sol";
import { ISystemRegistry } from "src/interfaces/ISystemRegistry.sol";
import { IStatsCalculator } from "src/interfaces/stats/IStatsCalculator.sol";
import { Initializable } from "openzeppelin-contracts/proxy/utils/Initializable.sol";
/// @title Base Stats Calculator
/// @notice Captures common behavior across all calculators
/// @dev Performs security checks and general roll-up behavior
abstract contract BaseStatsCalculator is IStatsCalculator, SecurityBase, SystemComponent, Initializable {
modifier onlyStatsSnapshot() {
if (!_hasRole(Roles.STATS_SNAPSHOT_EXECUTOR, msg.sender)) {
revert Errors.MissingRole(Roles.STATS_SNAPSHOT_EXECUTOR, msg.sender);
}
_;
}
constructor(ISystemRegistry _systemRegistry)
SystemComponent(_systemRegistry)
SecurityBase(address(_systemRegistry.accessController()))
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @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.
*/
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.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
import { ISwapRouter } from "src/interfaces/swapper/ISwapRouter.sol";
interface ISyncSwapper {
error DataMismatch(string element);
error InvalidIndex();
/**
* @notice Returns address of swap router that can access SyncSwapper contract
*/
function router() external view returns (ISwapRouter);
/**
* @notice Swaps sellToken for buyToken
* @param pool The address of the pool for the swapper
* @param sellTokenAddress The address of the token to sell
* @param sellAmount The amount of sellToken to sell
* @param buyTokenAddress The address of the token to buy
* @param minBuyAmount The minimum amount of buyToken expected
* @param data Additional data used differently by the different swappers
* @return actualBuyAmount The actual amount received from the swap
*/
function swap(
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

File 58 of 77 : IBaseAssetVault.sol
1
2
3
4
5
6
7
8
9
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
interface IBaseAssetVault {
/// @notice Asset that this Vault primarily manages
/// @dev Vault decimals should be the same as the baseAsset
function baseAsset() external view returns (address);
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
/// @title Return stats on base LSTs
interface ILSTStats {
struct LSTStatsData {
uint256 lastSnapshotTimestamp;
uint256 baseApr;
int256 discount; // positive number is a discount, negative is a premium
uint24[10] discountHistory; // 7 decimal precision
uint40 discountTimestampByPercent; // timestamp that the token reached 1pct discount
}
/// @notice Get the current stats for the LST
/// @dev Returned data is a combination of current data and filtered snapshots
/// @return lstStatsData current data on the LST
function current() external returns (LSTStatsData memory lstStatsData);
/// @notice Get the EthPerToken (or Share) for the LST
/// @return ethPerShare the backing eth for the LST
function calculateEthPerToken() external view returns (uint256 ethPerShare);
/// @notice Returns whether to use the market price when calculating discount
/// @dev Will be true for rebasing tokens and other non-standard tokens
function usePriceAsDiscount() external view returns (bool useAsDiscount);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)
pragma solidity ^0.8.0;
import "./IAccessControl.sol";
/**
* @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
*/
interface IAccessControlEnumerable is IAccessControl {
/**
* @dev Returns one of the accounts that have `role`. `index` must be a
* value between 0 and {getRoleMemberCount}, non-inclusive.
*
* Role bearers are not sorted in any particular way, and their ordering may
* change at any point.
*
* WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
* you perform all queries on the same block. See the following
* https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
* for more information.
*/
function getRoleMember(bytes32 role, uint256 index) external view returns (address);
/**
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
import { AutopoolDebt } from "src/vault/libs/AutopoolDebt.sol";
import { IERC4626 } from "src/interfaces/vault/IERC4626.sol";
import { Math } from "openzeppelin-contracts/utils/math/Math.sol";
import { IAutopoolStrategy } from "src/interfaces/strategy/IAutopoolStrategy.sol";
import { IMainRewarder } from "src/interfaces/rewarders/IMainRewarder.sol";
import { IERC20Permit } from "openzeppelin-contracts/token/ERC20/extensions/draft-IERC20Permit.sol";
interface IAutopool is IERC4626, IERC20Permit {
enum VaultShutdownStatus {
Active,
Deprecated,
Exploit
}
/// @param unlockPeriodInSeconds Time it takes for profit to unlock in seconds
/// @param fullProfitUnlockTime Time at which all profit will have been unlocked
/// @param lastProfitUnlockTime Last time profits were unlocked
/// @param profitUnlockRate Per second rate at which profit shares unlocks. Rate when calculated is denominated in
/// MAX_BPS_PROFIT. TODO: Get into uint112
struct ProfitUnlockSettings {
uint48 unlockPeriodInSeconds;
uint48 fullProfitUnlockTime;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity >=0.8.7;
import { IAutopool } from "src/interfaces/vault/IAutopool.sol";
import { IMainRewarder } from "src/interfaces/rewarders/IMainRewarder.sol";
import { IERC20 } from "openzeppelin-contracts/token/ERC20/IERC20.sol";
/**
* @title AutopoolETH Router Base Interface
* @notice A canonical router between AutopoolETHs
*
* The base router is a multicall style router inspired by Uniswap v3 with built-in features for permit,
* WETH9 wrap/unwrap, and ERC20 token pulling/sweeping/approving. It includes methods for the four mutable
* ERC4626 functions deposit/mint/withdraw/redeem as well.
*
* These can all be arbitrarily composed using the multicall functionality of the router.
*
* NOTE the router is capable of pulling any approved token from your wallet. This is only possible when
* your address is msg.sender, but regardless be careful when interacting with the router or ERC4626 Vaults.
* The router makes no special considerations for unique ERC20 implementations such as fee on transfer.
* There are no built in protections for unexpected behavior beyond enforcing the minSharesOut is received.
*/
interface IAutopilotRouterBase {
/// @notice thrown when amount of assets received is below the min set by caller
error MinAmountError();
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2024 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
import { IERC20 } from "openzeppelin-contracts/token/ERC20/IERC20.sol";
/**
* @title Validates and distributes Vault token rewards based on the
* the signed and submitted payloads
*/
interface IRewards {
struct Recipient {
uint256 chainId;
uint256 cycle;
address wallet;
uint256 amount;
}
event SignerSet(address newSigner);
event Claimed(uint256 cycle, address recipient, uint256 amount);
/// @notice Get the underlying token rewards are paid in
/// @return Token address
function vaultToken() external view returns (IERC20);
/// @notice Get the current payload signer;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
struct SwapParams {
/// @dev The address of the token to be sold.
address sellTokenAddress;
/// @dev The amount of tokens to be sold.
uint256 sellAmount;
/// @dev The address of the token to be bought.
address buyTokenAddress;
/// @dev The expected minimum amount of tokens to be bought.
uint256 buyAmount;
/// @dev Data payload to be used for complex swap operations.
bytes data;
/// @dev Extra data payload reserved for future development. This field allows for additional information
/// or functionality to be added without changing the struct and interface.
bytes extraData;
/// @dev Execution deadline in timestamp format
uint256 deadline;
}
interface IAsyncSwapper {
error TokenAddressZero();
error SwapFailed();
error InsufficientBuyAmountReceived(uint256 buyTokenAmountReceived, uint256 buyAmount);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

File 65 of 77 : IDestinationAdapter.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
/**
* @title IDestinationAdapter
* @dev This is a super-interface to unify different types of adapters to be registered in Destination Registry.
* Specific interface type is defined by extending from this interface.
*/
interface IDestinationAdapter {
error MustBeMoreThanZero();
error ArraysLengthMismatch();
error BalanceMustIncrease();
error MinLpAmountNotReached();
error LpTokenAmountMismatch();
error NoNonZeroAmountProvided();
error InvalidBalanceChange();
error InvalidAddress(address);
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
import { ISystemComponent } from "src/interfaces/ISystemComponent.sol";
/// @notice Creates and registers Destination Vaults for the system
interface IDestinationVaultFactory is ISystemComponent {
/// @notice Creates a vault of the specified type
/// @dev vaultType will be bytes32 encoded and checked that a template is registered
/// @param vaultType human readable key of the vault template
/// @param baseAsset Base asset of the system. WETH/USDC/etc
/// @param underlyer Underlying asset the vault will wrap
/// @param incentiveCalculator Incentive calculator of the vault
/// @param additionalTrackedTokens Any tokens in addition to base and underlyer that should be tracked
/// @param salt Contracts are created via CREATE2 with this value
/// @param params params to be passed to vaults initialize function
/// @return vault address of the newly created destination vault
function create(
string memory vaultType,
address baseAsset,
address underlyer,
address incentiveCalculator,
address[] memory additionalTrackedTokens,
bytes32 salt,
bytes memory params
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
import { Errors } from "src/utils/Errors.sol";
import { LibAdapter } from "src/libs/LibAdapter.sol";
import { IDestinationVault } from "src/interfaces/vault/IDestinationVault.sol";
import { Math } from "openzeppelin-contracts/utils/math/Math.sol";
import { EnumerableSet } from "openzeppelin-contracts/utils/structs/EnumerableSet.sol";
import { IStrategy } from "src/interfaces/strategy/IStrategy.sol";
import { SafeERC20 } from "openzeppelin-contracts/token/ERC20/utils/SafeERC20.sol";
import { IERC20Metadata as IERC20 } from "openzeppelin-contracts/token/ERC20/extensions/IERC20Metadata.sol";
import { IERC3156FlashBorrower } from "openzeppelin-contracts/interfaces/IERC3156FlashBorrower.sol";
import { IAutopoolStrategy } from "src/interfaces/strategy/IAutopoolStrategy.sol";
import { StructuredLinkedList } from "src/strategy/StructuredLinkedList.sol";
import { WithdrawalQueue } from "src/strategy/WithdrawalQueue.sol";
import { IAutopool } from "src/interfaces/vault/IAutopool.sol";
import { IMainRewarder } from "src/interfaces/rewarders/IMainRewarder.sol";
import { AutopoolToken } from "src/vault/libs/AutopoolToken.sol";
import { IRootPriceOracle } from "src/interfaces/oracles/IRootPriceOracle.sol";
import { ISystemRegistry } from "src/interfaces/ISystemRegistry.sol";
library AutopoolDebt {
using Math for uint256;
using SafeERC20 for IERC20;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
import { IERC20Metadata } from "openzeppelin-contracts/token/ERC20/extensions/IERC20Metadata.sol";
/// @dev Interface of the ERC4626 "Tokenized Vault Standard", as defined in https://eips.ethereum.org/EIPS/eip-4626
/// @dev Due to the nature of obtaining estimates for previewing withdraws and redeems, a few functions are not
/// view and therefore do not conform to eip 4626. These functions use state changing operations
/// to get accurate estimates, reverting after the preview amounts have been obtained.
interface IERC4626 is IERC20Metadata {
event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);
event Withdraw(
address indexed sender, address indexed receiver, address indexed owner, uint256 assets, uint256 shares
);
/// @notice Returns the address of the underlying token used for the Vault for accounting, depositing, and
/// withdrawing.
/// @dev
/// - MUST be an ERC-20 token contract.
/// - MUST NOT revert.
function asset() external view returns (address assetTokenAddress);
/// @notice Returns the total amount of the underlying asset that is “managed” by Vault.
/// @dev
/// - SHOULD include any compounding that occurs from yield.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

File 70 of 77 : IAutopoolStrategy.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
import { IStrategy } from "src/interfaces/strategy/IStrategy.sol";
interface IAutopoolStrategy {
enum RebalanceDirection {
In,
Out
}
/// @notice verify that a rebalance (swap between destinations) meets all the strategy constraints
/// @dev Signature identical to IStrategy.verifyRebalance
function verifyRebalance(
IStrategy.RebalanceParams memory,
IStrategy.SummaryStats memory
) external returns (bool, string memory message);
/// @notice called by the Autopool when NAV is updated
/// @dev can only be called by the strategy's registered Autopool
/// @param navPerShare The navPerShare to record
function navUpdate(uint256 navPerShare) external;
/// @notice called by the Autopool when a rebalance is completed
/// @dev can only be called by the strategy's registered Autopool
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
import { IERC3156FlashBorrower } from "openzeppelin-contracts/interfaces/IERC3156FlashBorrower.sol";
interface IStrategy {
/* ******************************** */
/* Events */
/* ******************************** */
event DestinationVaultAdded(address destination);
event DestinationVaultRemoved(address destination);
event WithdrawalQueueSet(address[] destinations);
event AddedToRemovalQueue(address destination);
event RemovedFromRemovalQueue(address destination);
error InvalidDestinationVault();
error RebalanceFailed(string message);
/// @notice gets the list of supported destination vaults for the Autopool/Strategy
/// @return _destinations List of supported destination vaults
function getDestinations() external view returns (address[] memory _destinations);
/// @notice add supported destination vaults for the Autopool/Strategy
/// @param _destinations The list of destination vaults to add
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

File 72 of 77 : IERC3156FlashBorrower.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC3156FlashBorrower.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC3156 FlashBorrower, as defined in
* https://eips.ethereum.org/EIPS/eip-3156[ERC-3156].
*
* _Available since v4.1._
*/
interface IERC3156FlashBorrower {
/**
* @dev Receive a flash loan.
* @param initiator The initiator of the loan.
* @param token The loan currency.
* @param amount The amount of tokens lent.
* @param fee The additional amount of tokens to repay.
* @param data Arbitrary data structure, intended to contain user-defined parameters.
* @return The keccak256 hash of "IERC3156FlashBorrower.onFlashLoan"
*/
function onFlashLoan(
address initiator,
address token,
uint256 amount,
uint256 fee,
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: MIT
pragma solidity =0.8.17;
/**
* @title StructuredLinkedList
* @author Vittorio Minacori (https://github.com/vittominacori)
* @dev An utility library for using sorted linked list data structures in your Solidity project.
* @notice Adapted from
* https://github.com/Layr-Labs/eigenlayer-contracts/blob/master/src/contracts/libraries/StructuredLinkedList.sol
*/
library StructuredLinkedList {
uint256 private constant _NULL = 0;
uint256 private constant _HEAD = 0;
bool private constant _PREV = false;
bool private constant _NEXT = true;
struct List {
uint256 size;
mapping(uint256 => mapping(bool => uint256)) list;
}
/**
* @dev Checks if the list exists
* @param self stored linked list from contract
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17; // their version was using 8.12?
import { StructuredLinkedList } from "src/strategy/StructuredLinkedList.sol";
// https://github.com/Layr-Labs/eigenlayer-contracts/blob/master/src/contracts/libraries/StructuredLinkedList.sol
library WithdrawalQueue {
using StructuredLinkedList for StructuredLinkedList.List;
error CannotInsertZeroAddress();
error UnexpectedNodeRemoved();
error AddToHeadFailed();
error AddToTailFailed();
error NodeDoesNotExist();
/// @notice Returns true if the address is in the queue.
function addressExists(StructuredLinkedList.List storage queue, address addr) public view returns (bool) {
return StructuredLinkedList.nodeExists(queue, _addressToUint(addr));
}
/// @notice Returns the current head.
function peekHead(StructuredLinkedList.List storage queue) public view returns (address) {
return _uintToAddress(StructuredLinkedList.getHead(queue));
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2023 Tokemak Foundation. All rights reserved.
pragma solidity 0.8.17;
import { ECDSA } from "openzeppelin-contracts/utils/cryptography/ECDSA.sol";
import { IERC20Permit } from "openzeppelin-contracts/token/ERC20/extensions/draft-IERC20Permit.sol";
/// @notice ERC20 token functionality converted into a library. Based on OZ's v5
/// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/token/ERC20/ERC20.sol
library AutopoolToken {
struct TokenData {
/// @notice Token balances
/// @dev account => balance
mapping(address => uint256) balances;
/// @notice Account spender allowances
/// @dev account => spender => allowance
mapping(address => mapping(address => uint256)) allowances;
/// @notice Total supply of the pool. Be careful when using this directly from the struct. The pool itself
/// modifies this number based on unlocked profited shares
uint256 totalSupply;
/// @notice ERC20 Permit nonces
/// @dev account -> nonce. Exposed via `nonces(owner)`
mapping(address => uint256) nonces;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.0;
import "../Strings.sol";
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV // Deprecated in v4.8
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/Math.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @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))
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Settings
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{
"remappings": [
"forge-std/=lib/forge-std/src/",
"ds-test/=lib/forge-std/lib/ds-test/src/",
"src/=src/",
"test/=test/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/",
"erc4626-tests/=lib/erc4626-tests/",
"prb-math/=lib/prb-math/",
"crytic/properties/=lib/properties/",
"ERC4626/=lib/properties/lib/ERC4626/contracts/",
"properties/=lib/properties/contracts/",
"solmate/=lib/properties/lib/solmate/src/",
"usingtellor/=lib/usingtellor/contracts/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs"
},
"outputSelection": {
"*": {
"*": [
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Contract ABI

API
[{"inputs":[{"internalType":"contract ISystemRegistry","name":"sysRegistry","type":"address"},{"internalType":"address","name":"_defaultStakingRewardToken","type":"address"},{"internalType":"address","name":"_convexBooster","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessDenied","type":"error"},{"inputs":[{"internalType":"uint256","name":"length1","type":"uint256"},{"internalType":"uint256","name":"length2","type":"uint256"},{"internalType":"string","name":"details","type":"string"}],"name":"ArrayLengthMismatch","type":"error"},{"inputs":[],"name":"ArrayLengthMismatch","type":"error"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BaseAmountReceived","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"DuplicateToken","type":"error"},{"inputs":[],"name":"ExtensionAmountMismatch","type":"error"},{"inputs":[],"name":"ExtensionNotActive","type":"error"},{"inputs":[{"internalType":"uint256","name":"provided","type":"uint256"},{"internalType":"uint256","name":"numTokens","type":"uint256"}],"name":"InvalidBaseTokenBurnIndex","type":"error"},{"inputs":[{"internalType":"address","name":"calc","type":"address"},{"internalType":"address","name":"local","type":"address"},{"internalType":"string","name":"param","type":"string"}],"name":"InvalidIncentiveCalculator","type":"error"},{"inputs":[{"internalType":"string","name":"paramName","type":"string"}],"name":"InvalidParam","type":"error"},{"inputs":[{"internalType":"enum IDestinationVault.VaultShutdownStatus","name":"status","type":"uint8"}],"name":"InvalidShutdownStatus","type":"error"},{"inputs":[],"name":"LogicDefect","type":"error"},{"inputs":[],"name":"NothingToRecover","type":"error"},{"inputs":[],"name":"PoolShutdown","type":"error"},{"inputs":[{"internalType":"uint256","name":"spot","type":"uint256"},{"internalType":"uint256","name":"safe","type":"uint256"}],"name":"PricesOutOfRange","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"PullingNonTrackedToken","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"availableAmount","type":"uint256"}],"name":"RecoveringMoreThanAvailable","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"RecoveringTrackedToken","type":"error"},{"inputs":[],"name":"UndefinedAddress","type":"error"},{"inputs":[],"name":"VaultNotShutdown","type":"error"},{"inputs":[],"name":"VaultShutdown","type":"error"},{"inputs":[{"internalType":"string","name":"paramName","type":"string"}],"name":"ZeroAddress","type":"error"},{"inputs":[{"internalType":"string","name":"paramName","type":"string"}],"name":"ZeroAddress","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":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"}],"name":"BaseAssetWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Donated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"extension","type":"address"}],"name":"ExtensionSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"calculator","type":"address"}],"name":"IncentiveCalculatorUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newCredit","type":"uint256"}],"name":"MaxRecoupCreditSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"tokens","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"indexed":false,"internalType":"address[]","name":"destinations","type":"address[]"}],"name":"Recovered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"enum IDestinationVault.VaultShutdownStatus","name":"reason","type":"uint8"}],"name":"Shutdown","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":"address","name":"destination","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"UnderlyerRecovered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"UnderlyingDeposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"}],"name":"UnderlyingWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"hash","type":"bytes32"},{"indexed":false,"internalType":"bool","name":"flag","type":"bool"}],"name":"UpdateSignedMessage","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"target","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"actual","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"debtLoss","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"claimLoss","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fromIdle","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fromDebt","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"ONE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"accessController","outputs":[{"internalType":"contract IAccessController","name":"","type":"address"}],"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":"amount","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":"balanceOfUnderlyingDebt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseAsset","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collectRewards","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"address[]","name":"tokens","type":"address[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"convexBooster","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"convexPoolId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"convexStaking","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"curveLpToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"curvePool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"debtValue","outputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"defaultStakingRewardToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"depositUnderlying","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"exchangeName","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"name":"executeExtension","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"extension","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"extensionSetTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"externalDebtBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"externalQueriedBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMarketplaceRewards","outputs":[{"internalType":"uint256[]","name":"rewardTokens","type":"uint256[]"},{"internalType":"uint256[]","name":"rewardRates","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getPool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRangePricesLP","outputs":[{"internalType":"uint256","name":"spotPrice","type":"uint256"},{"internalType":"uint256","name":"safePrice","type":"uint256"},{"internalType":"bool","name":"isSpotSafe","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getStats","outputs":[{"internalType":"contract IDexLSTStats","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSystemRegistry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getUnderlyerCeilingPrice","outputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getUnderlyerFloorPrice","outputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getValidatedSafePrice","outputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getValidatedSpotPrice","outputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20Metadata","name":"baseAsset_","type":"address"},{"internalType":"contract IERC20Metadata","name":"underlyer_","type":"address"},{"internalType":"contract IMainRewarder","name":"rewarder_","type":"address"},{"internalType":"address","name":"incentiveCalculator_","type":"address"},{"internalType":"address[]","name":"additionalTrackedTokens_","type":"address[]"},{"internalType":"bytes","name":"params_","type":"bytes"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"internalDebtBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"internalQueriedBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isShutdown","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isStableSwap","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"isTrackedToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"hash","type":"bytes32"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"isValidSignature","outputs":[{"internalType":"bytes4","name":"magicValue","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolDealInEth","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolType","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"recoupMaxCredit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"address[]","name":"destinations","type":"address[]"}],"name":"recover","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"destination","type":"address"}],"name":"recoverUnderlying","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewarder","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"extension_","type":"address"}],"name":"setExtension","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"incentiveCalculator_","type":"address"}],"name":"setIncentiveCalculator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"hash","type":"bytes32"},{"internalType":"bool","name":"flag","type":"bool"}],"name":"setMessage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newCredit","type":"uint256"}],"name":"setRecoupMaxCredit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum IDestinationVault.VaultShutdownStatus","name":"reason","type":"uint8"}],"name":"shutdown","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"shutdownStatus","outputs":[{"internalType":"enum IDestinationVault.VaultShutdownStatus","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"signedMessages","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":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"trackedTokens","outputs":[{"internalType":"address[]","name":"trackedTokensArr","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","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":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"underlying","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"underlyingReserves","outputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"underlyingTokens","outputs":[{"internalType":"address[]","name":"result","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"underlyingTotalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"withdrawBaseAsset","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"tokenAmounts","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"withdrawUnderlying","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

Block Age Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.