Skip to content

Upgrades and Migration

I. Key Improvements in V2

Wrapped M (wM) fundamentally operates as a non-rebasing token where yield is realized through manual claiming, a characteristic distinct from the native M token's automatic rebasing. The V2 implementation builds upon this established model with several important enhancements:

  1. Re-enabling Earning: V2 allows earning to be re-enabled after being disabled
  2. Admin-Managed Earners: Introduction of EarnerManager for delegated administration
  3. Fee Mechanism: Ability for admins to take fees from yield
  4. Principal-Based Accounting: Changed from lastIndex tracking to principal amount tracking
  5. Explicit Claim Recipients: Added ability for users to explicitly set yield recipients
  6. Gas Efficiency: Optimized storage layout and operations

II. Migration from V1

The migration from V1 to V2 involved several key transformations:

Account Model Change

  • V1: Used last interaction index for earning accounts
  • V2: Uses principal amount for earning accounts
  • Migration formula: principal = balance ÷ lastIndex

Index Handling

  • V1: Used an array for enable/disable indices
  • V2: Uses enableMIndex and disableIndex slots
  • Migration preserved earning state and index values

Migration Process

The migration was handled through a specialized migrator contract that:

  1. Identified all earning accounts in V1
  2. Converted their account structure to the V2 format
  3. Preserved their earning status and equivalent yield position