Napier Finance / napier-v2

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

Documentation

Scope

FileLinesnLinesnSLOCComment Lines
src/interfaces/IRewardProxy.sol12741
src/interfaces/IPoolDeployer.sol10632
src/interfaces/IHook.sol12641
src/interfaces/IWETH.sol7531
src/interfaces/EIP5095.sol7012445
src/tokens/PrincipalToken.sol11111010600218
src/tokens/YieldToken.sol6767468
src/Types.sol1041045538
src/modules/RewardProxyModule.sol62572324
src/modules/FeeModule.sol94906513
src/modules/resolvers/ERC4626InfoResolver.sol5050365
src/modules/resolvers/SharePriceResolver.sol5353405
src/modules/resolvers/ExternalPriceResolver.sol64644312
src/modules/resolvers/CustomConversionResolver.sol5454415
src/modules/resolvers/VaultInfoResolver.sol13733
src/modules/aggregator/AggregationRouter.sol1081047015
src/modules/BaseModule.sol3836254
src/modules/VerifierModule.sol89845221
src/modules/AccessManager.sol1351086342
src/modules/deployers/TwoCryptoDeployer.sol5846308
src/modules/connectors/DefaultConnectorFactory.sol3535251
src/modules/connectors/VaultConnectorRegistry.sol3232231
src/modules/connectors/VaultConnector.sol4320157
src/modules/connectors/ERC4626Connector.sol10885671
src/Constants.sol2020124
src/utils/LibBlueprint.sol1671599644
src/utils/HookValidation.sol2626164
src/utils/TwoCryptoNGPreviewLib.sol95875026
src/utils/YieldMathLib.sol23621675121
src/utils/ZapHookEncoder.sol6347356
src/utils/ModuleAccessor.sol5353409
src/utils/RewardMathLib.sol106974251
src/utils/Casting.sol101071
src/utils/FeePctsLib.sol6953402
src/utils/LibTwoCryptoNG.sol34130123264
src/utils/CustomRevert.sol2626168
src/utils/LibApproval.sol47472715
src/utils/ContractValidation.sol1818131
src/utils/ZapMathLib.sol44402310
src/utils/LibExpiry.sol1818131
src/utils/TokenNameLib.sol4848362
src/zap/TwoCryptoZap.sol14911291846278
src/zap/ZapBase.sol1515101
src/Events.sol42736428038
src/Errors.sol94946711
src/Factory.sol30527816568
src/types/TwoCrypto.sol8851
src/types/ApproxValue.sol8851
src/types/ModuleIndex.sol1818113
src/types/FeePcts.sol8851
src/types/Token.sol3535224
Totals6225552735291256

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

  1. Install Foundry
  2. Install pnpm
  3. 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

  • 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.

Contact Us

For any issues or concerns regarding this competition, please reach out to the Cantina core team through the Cantina Discord.

Summary

Status

Completed

Total reward:

$72,000

Findings submitted:

151

Start date:

20 Jan 2025 8:00pm (local time)

End date:

10 Feb 2025 8:00pm (local time)