Upgradeability

The contract uses UUPS proxy pattern for safe upgrades.


What is UUPS?

Universal Upgradeable Proxy Standard. The upgrade logic lives in the implementation contract, not the proxy.

Benefits:

  • Cheaper deployment

  • Upgrade logic can be removed permanently

  • More gas efficient


How It Works

User → Proxy → Implementation

       State
  • Proxy holds all state (balances, markets, positions)

  • Implementation holds all logic

  • Upgrades replace implementation, keep state


Current Implementation


Upgrade Process

  1. New implementation deployed

  2. Multisig proposes upgrade

  3. Timelock period (48 hours)

  4. Multisig executes upgrade

  5. Proxy points to new implementation


Governance

Upgrades controlled by multisig:

  • 3-of-5 threshold

  • 48-hour timelock

  • Public signers

No single person can upgrade unilaterally.


Safety Measures

Storage Layout

New implementations must maintain storage layout:

Changing layout = corrupted state.

Initializers

Can only be called once. Prevents re-initialization attacks.

Authorization

Only owner (multisig) can authorize upgrades.


Renouncing Upgradeability

Future option: renounce upgrade capability permanently.

Once deployed, no more upgrades ever. Full immutability.

Last updated