Napier Finance / napier-v2
Napier v2 is a modular yield tokenization platform, allowing anyone to fix yields and trade yield-bearing tokens. It is similar to Pendle but with more flexibility and permissionless by design, built on the Curve Finance AMM.
Anyone called curator, can deploy a yield tokenization instance literally owned by the curator. Napier doesn’t have any privilege permissions by default.
Codebase consists of four main components; Factory, AMM, Zap and PrincipalToken.
Factory
Factory creates new instances of AMM and PrincipalToken(PT), which supports multiple AMM types and modules.
- Managing registering module implementations
AMM
2-token AMM for trading yield-bearing token against PT, which determines how much fixed yield users can get. On launch we support Curve finance TwoCryptoNG pool suitable for trading 2 volatile assets.
PrincipalToken
The core primitive that splits yield-bearing tokens into Principal Tokens(PT) and Yield Tokens(YT).
PT represents the principal of yield-bearing assets. YT represents variable interests that the yield-bearing token accumulates.
-
Modular architecture with separate modules for access control, fees, rewards, and verification
-
Access control system completely controlled by curators
-
Implements EIP5095 standard for fixed-rate tokens
-
Handles deposits, redemptions, and yield collection
-
Includes fee mechanisms for issuance, performance, and redemption
-
Yield accrual mechanism that tracks and distributes yields to YT holders
-
Fee system with splits between curators and Napier protocol
-
Support for additional reward tokens through reward proxy module
Zap
A Periphery contract for main entrypoint for user interactions.
- Allows users to perform complex interactions in a single transaction.
- Integrates with swap aggregators like 1inch.
Prize distribution and scoring
-
Total Prize Pool: $72000
-
Scoring described in the competition scoring page.
-
Findings Severities described in detail on our docs page.
Documentation
- Documents for Cantina competition
- Docs for Frontend Integration
- Overview on PrincipalToken.sol
- Overview on how interest accumulation works
- Napier Math whitepaper
- Known issues listed on README
Scope
- Repository: https://cantina.xyz/code/58cd719b-9004-4eca-a113-41d1691c0711/README.md
- Total LOC: 3529 nSLOC
File | Lines | nLines | nSLOC | Comment Lines |
---|---|---|---|---|
src/interfaces/IRewardProxy.sol | 12 | 7 | 4 | 1 |
src/interfaces/IPoolDeployer.sol | 10 | 6 | 3 | 2 |
src/interfaces/IHook.sol | 12 | 6 | 4 | 1 |
src/interfaces/IWETH.sol | 7 | 5 | 3 | 1 |
src/interfaces/EIP5095.sol | 70 | 12 | 4 | 45 |
src/tokens/PrincipalToken.sol | 1111 | 1010 | 600 | 218 |
src/tokens/YieldToken.sol | 67 | 67 | 46 | 8 |
src/Types.sol | 104 | 104 | 55 | 38 |
src/modules/RewardProxyModule.sol | 62 | 57 | 23 | 24 |
src/modules/FeeModule.sol | 94 | 90 | 65 | 13 |
src/modules/resolvers/ERC4626InfoResolver.sol | 50 | 50 | 36 | 5 |
src/modules/resolvers/SharePriceResolver.sol | 53 | 53 | 40 | 5 |
src/modules/resolvers/ExternalPriceResolver.sol | 64 | 64 | 43 | 12 |
src/modules/resolvers/CustomConversionResolver.sol | 54 | 54 | 41 | 5 |
src/modules/resolvers/VaultInfoResolver.sol | 13 | 7 | 3 | 3 |
src/modules/aggregator/AggregationRouter.sol | 108 | 104 | 70 | 15 |
src/modules/BaseModule.sol | 38 | 36 | 25 | 4 |
src/modules/VerifierModule.sol | 89 | 84 | 52 | 21 |
src/modules/AccessManager.sol | 135 | 108 | 63 | 42 |
src/modules/deployers/TwoCryptoDeployer.sol | 58 | 46 | 30 | 8 |
src/modules/connectors/DefaultConnectorFactory.sol | 35 | 35 | 25 | 1 |
src/modules/connectors/VaultConnectorRegistry.sol | 32 | 32 | 23 | 1 |
src/modules/connectors/VaultConnector.sol | 43 | 20 | 15 | 7 |
src/modules/connectors/ERC4626Connector.sol | 108 | 85 | 67 | 1 |
src/Constants.sol | 20 | 20 | 12 | 4 |
src/utils/LibBlueprint.sol | 167 | 159 | 96 | 44 |
src/utils/HookValidation.sol | 26 | 26 | 16 | 4 |
src/utils/TwoCryptoNGPreviewLib.sol | 95 | 87 | 50 | 26 |
src/utils/YieldMathLib.sol | 236 | 216 | 75 | 121 |
src/utils/ZapHookEncoder.sol | 63 | 47 | 35 | 6 |
src/utils/ModuleAccessor.sol | 53 | 53 | 40 | 9 |
src/utils/RewardMathLib.sol | 106 | 97 | 42 | 51 |
src/utils/Casting.sol | 10 | 10 | 7 | 1 |
src/utils/FeePctsLib.sol | 69 | 53 | 40 | 2 |
src/utils/LibTwoCryptoNG.sol | 341 | 301 | 232 | 64 |
src/utils/CustomRevert.sol | 26 | 26 | 16 | 8 |
src/utils/LibApproval.sol | 47 | 47 | 27 | 15 |
src/utils/ContractValidation.sol | 18 | 18 | 13 | 1 |
src/utils/ZapMathLib.sol | 44 | 40 | 23 | 10 |
src/utils/LibExpiry.sol | 18 | 18 | 13 | 1 |
src/utils/TokenNameLib.sol | 48 | 48 | 36 | 2 |
src/zap/TwoCryptoZap.sol | 1491 | 1291 | 846 | 278 |
src/zap/ZapBase.sol | 15 | 15 | 10 | 1 |
src/Events.sol | 427 | 364 | 280 | 38 |
src/Errors.sol | 94 | 94 | 67 | 11 |
src/Factory.sol | 305 | 278 | 165 | 68 |
src/types/TwoCrypto.sol | 8 | 8 | 5 | 1 |
src/types/ApproxValue.sol | 8 | 8 | 5 | 1 |
src/types/ModuleIndex.sol | 18 | 18 | 11 | 3 |
src/types/FeePcts.sol | 8 | 8 | 5 | 1 |
src/types/Token.sol | 35 | 35 | 22 | 4 |
Totals | 6225 | 5527 | 3529 | 1256 |
Target networks
- Optimism and OP stack
- Ethereum Mainnet
- Arbitrum
- EVM networks supporting PUSH0 opcode
System Roles and Privileges
- Napier DAO: Trusted
- Napier multisig: This entity manages the upgrade role in the Factory until Napier DAO is activated. Trusted
- Curator(PT creator): Trusted for their PrincipalTokens only. Cannot affect other PrincipalTokens
- Roles granted by curator: Trusted within the granted access control.
- Regular users:
- Any other user is considered untrusted.
- Users are responsible for interactions with any PrincipalToken. A curator may be evil because of Napier v2 permissionless nature.
Build Instructions
- Install Foundry
- Install pnpm
- Follow README instructions on repo
Basic POC Test
Please note that mandatory POC rule applies for this competition We have a simple PoC setup here. In order to further configure the principal token or Zap, refer to:
test/shared/PrincipalToken.t.sol
test/shared/Zap.t.sol
test/shared/Fork.t.sol
Out of scope
- yAudit Napier V2 Review.pdf
- napier-v2-report-xuwinnie-202501.pdf (Preliminary report)
- Finding related to contracts in `src/lens/**`
- Issues described in our documentation: in-code comments, in the README and in the whitepapers.
- Issues found in previous security reviews.
- Issues related to deploy scripts or tests
- Third party integrations not functioning as advertised
- Incompatibilities with ERC-4626 and ERC-20 unless they pose a direct security risk
- Issues related to non-standard tokens and their behaviors
- Issue related to Non Standard ERC4626 Resolver where user provide malicious how share calculated
- Issue with faulty configured access control
- Issue with faulty configured parameters by curator
- Malicious share calculation in non-standard ERC4626 resolvers
- Issues with custom VaultConnector implementations provided by users
- Incorrect hardcoded addresses would be considered low, unless there is a direct loss of funds on deployment from using them.
- Automated findings by Lightchaser https://gist.github.com/ChaseTheLight01/dfc4603fb77fa42b0f7546bd09a4a4e9
Contact Us
For any issues or concerns regarding this competition, please reach out to the Cantina core team through the Cantina Discord.
Summary
Status
CompletedTotal reward:
$72,000
Findings submitted:
151
Start date:
20 Jan 2025 8:00pm (local time)
End date:
10 Feb 2025 8:00pm (local time)