napier-v1: Core contracts for Yield stripping and non-upgradable adaptersnapier-uups-adapters: Upgradable adaptersv1-pool: NapierPool contractmetapool-router : Periphery for Curve twocrypto Principal Token Metapool| Term | Description |
|---|---|
| Underlying | Base asset (e.g., DAI, USDC, ETH, RAI...) |
| Target | Yield-bearing token of a yield source |
| Principal Token (PT) | Token that represents the principal amount of the Target. In traditional finance, it is equivalent to zero-coupon bond. |
| Yield Token (YT) | Token that represents accrued yield and future yield. |
| Adapter | Module for Tranche to interact with external protocols. (e.g. Lido, Swell, Renzo, etc.) |
Protocol overview
https://github.com/sherlock-audit/2024-05-napier-update/blob/main/napier-v1/docs/SPECIFICATION.md
Why Principal Tokens should be traded on Twocrypto metapool?
TwoCrypto Metapool would prevent liquidity fragmentation without ETH liquidity. Technically, it’s possible to create a NapierPool with RenzoETH-PT , PufETH-PT and EETH-PT instead of TwoCrypto Metapool but NapierPool requires ETH as an pool asset. Twocrypto Metapool doesn’t need ETH, instead it uses 3LST-PT TriCrypto LP tokento create AMM.SC overview
stETH-PT (maturity-3 November 2024), which will be traded with discount against WETH and as the maturity date approaches, the discount will decrease and the price will converge to 1 WETH.stETH-PT, rETH-PT and sfrxETH-PT, which is used as base pool for a Napier pool and TwoCrypto pools.3LST-PT TriCrypto LP Token and WETH. Technically, it's a lot like Pendle AMM, but it's more like a Metapool because it contains LP token as an asset.Twocrypto) : Curve TwoCrypto contract that allows users to deposit and withdraw principal tokens. Technically, it is a just a regular TwoCrypto but this pool assets are Napier Principal Token and TriCrypto LP Token.3LST-PT TriCrypto, 3LST NapierPool and Principal Token. MetapoolRouter supports native ETH only as a underlying asset.owner to create new TwoCrypto contracts. It's just a wrapper around the permissionless TwoCryptoFactory contract but with some additional restrictions; assets must be Principal Token and TriCrypto LP Token, where these Underlying Tokens are WETH.UpgradeableAdapter
RsETHAdapter, PufETHAdapter, RenzoAdapter, RswETHAdapter are inherited from BaseLSTAdapterUpgradeable which added the UUPS-upgrdeable features in it and it's originally from BaseLSTAdapter contract.namespace feature for its storage layout and the below is storage layout./// @custom:storage-location erc7201:napier.adapter.lst
struct LSTAdapterStorage {
/// @notice Rebalancer of the ETH buffer, can be set by the owner
/// @notice The account can request a withdrawal
address rebalancer;
/// @notice Desired buffer percentage in WAD
uint256 targetBufferPercentage;
/// @notice Tranche contract for restricting access to prefundedDeposit and prefundedRedeem
address tranche;
/// @notice Total of ETH pending withdrawal request
uint128 totalQueueEth;
/// @notice Amount of ETH available (Buffer), does not include pending withdrawal. Internal accounting of ETH
uint128 bufferEth;
/// @notice Mapping of the withdrawal request ID to the amount of ETH
mapping(uint256 requestId => uint256 queueEth) queueWithdrawal;
/// @notice Packed data for the stake limit state
StakeLimitTypes.Uint256Data packedStakeLimitData;
}


FAQ
docs/**.md on napier-v1 repogit clone --recurse-submodules [email protected]:sherlock-audit/2024-05-napier-update.gitAnd then run forge build on each dir. Please add --skip=test if you got an error because of too big contract. For testing, you have to set up python venv. For more details, please read README.LSTAdapter?
The reason why MetapoolRouter doesn’t have method to swap YT for ETH.
- We found it’s impossible to implement on the current version. Users can exit position after the maturity. These kinds of findings would be not valid.
Adapter doesn’t allow users to redeem assets for ETH. It can be a valid finding?
Why Balancer if flashloan is used for swapping ETH for YT?
swapETHForYT function is not efficient: Ideally users should swap 0.1 (small amount) ETH for 1 YT because YT is just a yield portion. But if router doesn’t use flashloan, users have to swap ETH more than it should. e.g. in theory 1 YT is worth 0.1 ETH but users have to swap 1 ETH and get 0.9 ETH refund at the end of txn. This is because NapierPool and Twocrypto don’t support flash swap.Adapter is NOT ERC4626 compliant.