Skip to content

feat(sprl): add sPRL2V3 on FrontierFi and the sPRL2V2 sunset batches - #16

Open
FabienCoutant wants to merge 17 commits into
devfrom
feat/sprl2v3-frontier-migration
Open

FabienCoutant wants to merge 17 commits into
devfrom
feat/sprl2v3-frontier-migration

Conversation

@FabienCoutant

@FabienCoutant FabienCoutant commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Balancer has been sunset, so the sPRL2V2 staking positions need to move to FrontierFi, a Balancer V3 fork. This PR adds the destination vault sPRL2V3, its deploy script and roles batch, and the script that builds the DAO batch opening the migration, for mainnet and Base only.

There is no migration contract. Users move by hand through the frontend: they exit sPRL2V2 and deposit into sPRL2V3. The only new contract is a copy of sPRL2V2, so no audit is needed. The full runbook is in docs/sPRL2V3-Migration.md.

Contracts

  • sPRL2V3: a copy of sPRL2V2 with only the contract name, the symbol (sPRL2V3), the token name ("Stake 20WETH-80PRL Frontier Deposit Vault", so wallets and permit prompts tell the two vaults apart) and the NatSpec changed. It is deployed against the Frontier 80PRL/20WETH pool. The constructor fields keep their balancerRouter / balancerBPT names since Frontier exposes the same Router interface.
  • IBalancerV3Vault.sol: read and swap interfaces (vault getPoolTokenInfo, pool getVault, router swapSingleTokenExactIn) used by the script and the tests. No contract imports it.

Opening the migration

scripts/AlignFrontierAndSunset.s.sol builds one atomic DAO Safe batch:

  1. approve Permit2, approve the Frontier router on Permit2, swap to align the Frontier PRL price with Balancer. The amount is found by simulation; the swap is left out when the gap is already under 0.1%;
  2. updateStartPenaltyPercentage(0) on sPRL2V2: the timelock cannot go below 1 day, but it only acts through the penalty and _withdraw never checks the release time, so every request, pending or new, can be withdrawn at once without fee;
  3. pause() on sPRL2V2: blocks new deposits. requestWithdraw and the withdraw functions have no pause modifier and keep working.

The swap carries a minAmountOut (1% by default): if the Frontier price moved before the Safe executes, the swap reverts with SwapLimit and the sunset with it, so the sunset cannot happen on a mispriced pool. Before writing batches/sprl2v2-align-and-sunset.<network>.safe.json, the script runs the batch from the DAO Safe on the fork and checks the gap (under 2%), the pause and the penalty. Calls already done are left out, so the same script realigns the pool during the migration.

On the current state: mainnet sells 42.7 PRL to close a 25.1% gap; Base sells 15.7 PRL to close 1.75%, and the Base Safe holds no PRL yet (the script warns).

This replaces the standalone sunset batches of the previous version, which allowed a sunset without alignment.

Migration flow and frontend

  1. sPRL2V2.requestWithdraw(amount), then sPRL2V2.withdrawPRLAndWeth(ids, minPrl, minWeth, 0) right after: the user receives PRL and WETH.
  2. Approve, then sPRL2V3.depositPRLAndWeth(maxPrl, maxWeth, exactBpt, ...). Leftovers are refunded.

The frontend compares the Frontier and Balancer prices before the deposit and blocks above 2%, quotes exactBpt = min(prl * supply / toPrl, weth * supply / toWeth) minus the slippage with the withdrawn amounts as max in (the vault reverts with AmountInAboveMax if the price moved), and prefers a private RPC on mainnet.

Deployment

  • sprl2v3 config section for mainnet and Base (Frontier router 0xB3C4…557B, pools 0xbF59…a1A6 on mainnet and 0x4D81…ee4c on Base, same penalty and timelock as sPRL2V2) and deploy/scripts/sprl/sPRL2V3.ts.
  • sprl2v3-roles.{mainnet,base}.safe.json: GUARDIAN (20) gets pause and unpause, GOVERNOR (10) gets updateFeeReceiver, updateStartPenaltyPercentage, updateTimeLockDuration and recoverERC20, same as sPRL2V2. The sPRL2V3 addresses are predicted from the deployer nonce (269 on mainnet, 209 on Base). Check them against deployments/<network>/sPRL2V3.json before signing.

This branch also carries the five Base deployment commits from deploy/tokenomics-v2 that are not on dev yet (Base network support, sPRL2Migrator deploy script, SetSPRL2V2Role script, deployment docs), with fixes found while reviewing #16 and #17:

  • SetSPRL2Role.s.sol targeted 0x9033…8545, an empty sPRL2, while its calls are now live. It points to the canonical sPRL2 0xE8A2…2135.
  • docs/Deployment.md listed that empty sPRL2 and the migrator wired to it (0xd0D8…d069). It lists the live sPRL2 and sPRL2Migrator 0x2fE6…BbEF (same lines as in chore(deploy): add Avalanche and HyperEVM fee collector networks #17).
  • sPRL2Migrator.ts reads its inputs through rocketh get instead of readFileSync. No dependencies on purpose: the legacy sPRL2 record comes from hardhat-deploy v1 without argsData, so rerunning its script would redeploy sPRL2. Dry run on a mainnet fork: reuses the deployed migrator, fails with no deployment named "sPRL2" when the record is missing.
  • The mainnet legacy sprl2.timeLockDuration is back to 60, the value it was deployed with.
  • sPRL2.ts skips chains without an sprl2 section (Base) instead of crashing an untagged deploy.

Tests

  • test/forks/sPRL2V3/manualMigration.t.sol on mainnet and Base, against the real sPRL2V2 deployments, holders and Frontier pools. setUp runs the batch built by the script from the DAO Safe:

    • every holder exits in the same block with no fee, deposits into sPRL2V3 and keeps their value at the Balancer price (within 0.01%);
    • the whole batch reverts with SwapLimit when the Frontier price moves before execution, and sPRL2V2 stays unpaused with its penalty;
    • after the sunset, the script builds an alignment-only batch that realigns a drifted pool;
    • a request made before the sunset is withdrawn without fee;
    • withdrawing with a max penalty of 0 reverts while the penalty is still set;
    • deposits into sPRL2V2 revert once paused;
    • the deposit reverts with AmountInAboveMax when the Frontier price moves after the quote.

    12/12 pass, full suite 202/202.

  • AlignFrontierAndSunset run against mainnet and Base: batches built, simulated from the DAO Safes, calldata decoded.

  • sPRL2V3 deploy script and roles batch: dry run on anvil forks and batch simulation.

Before opening the migration

  • Fund the Base Safe with PRL for the alignment swap.
  • Between the two user steps, holders have PRL and WETH in their wallet. Some may not restake.

- getLzEidReceiver: map "base" to EndpointId.BASE_V2_MAINNET (30184)
- ConfigData.tokens: add "usdp" key (kept "par" for history)
- base config: PRL/WETH pool, USDp + lz-USDp, isMainChainFeeDistributor
- mainnet config: repoint side-chain fee routing to base/USDp
- move arbiSepolia config out of base/
Wires the migrator to the canonical sPRL2 (legacy) and sPRL2V2
deployments read from the deployment records (format-agnostic).
Mirrors SetSPRL2Role for sPRL2V2: GUARDIAN (pause/unpause) and
GOVERNOR (updateFeeReceiver/updateStartPenaltyPercentage/
updateTimeLockDuration/recoverERC20) selector groups.
Add Mainnet (Ethereum + Base) deployed addresses; drop token and
shared-infra addresses (documented in their own repositories).
sPRL1 was already deployed on Base (0x01fA35fDE0E813e2D6687660a74A313d8D922E48);
the run that also deployed sPRL2V2/fees redeployed a redundant one. Reference
the existing pre-audit sPRL1 instead.
FabienCoutant added a commit that referenced this pull request Nov 27, 2026
* previewMigrate reverts with EmptyDestinationPool instead of a division by
  zero when the Frontier pool has no PRL, no WETH or no BPT supply.
* The destination price test expects the vault AmountInAboveMax error rather
  than any revert.
* The migrator deploy script depends on sPRL2V3 and reads both addresses
  through rocketh get instead of the deployment files.
Exact copy of sPRL2V2 with only the contract name and symbol changed.
It is deployed against the FrontierFi 80PRL/20WETH pool, a Balancer V3
fork exposing the same Router interface. Also adds the Base RPC alias
to foundry.toml for the fork tests.
Adds the sprl2v3 config section for mainnet and Base (Frontier router
and 80PRL/20WETH pools, same penalty and timelock as sPRL2V2) and the
rocketh script deploying sPRL2V3 against it.
Safe Transaction Builder batches for the DAO Safe on mainnet and Base:
GUARDIAN (20) gets pause and unpause, GOVERNOR (10) gets
updateFeeReceiver, updateStartPenaltyPercentage, updateTimeLockDuration
and recoverERC20, same as sPRL2V2.
Safe Transaction Builder batches for the DAO Safe on mainnet and Base,
calling sPRL2V2 directly (the DAO holds GOVERNOR and GUARDIAN with no
delay):
* updateStartPenaltyPercentage(0): the fee of every withdrawal request,
  pending or new, drops to 0, so users can request and withdraw in the
  same block. The timelock itself cannot go below 1 day.
* pause(): blocks new deposits. requestWithdraw and the withdraw
  functions have no pause modifier and keep working.
On mainnet and Base, against the real sPRL2V2 deployments, holders and
Frontier pools: after the sunset batch every holder exits with
requestWithdraw and withdrawPRLAndWeth in the same block with no fee,
then deposits into sPRL2V3 and keeps their value at the Balancer price.
Also covers a pending request withdrawn without fee, the revert while
the penalty is still set, deposits blocked by the pause, and the
AmountInAboveMax revert when the Frontier price moves after the quote.
@FabienCoutant
FabienCoutant force-pushed the feat/sprl2v3-frontier-migration branch from 1f4aac4 to c1a3b13 Compare November 27, 2026 11:39
@FabienCoutant FabienCoutant changed the title feat(sprl): migrate sPRL2V2 to FrontierFi with sPRL2V3 feat(sprl): add sPRL2V3 on FrontierFi and the sPRL2V2 sunset batches Nov 27, 2026
The script targeted 0x9033...8545, an empty sPRL2 (supply 0, timelock
60) used for tests, while its setTargetFunctionRole calls are now live.
Point it to the canonical sPRL2 0xE8A2...2135 from
deployments/mainnet/sPRL2.json.
Replace the readFileSync of the deployment records with rocketh get, so
the script sees deployments made in the same run and fails clearly when
one is missing. No dependencies entry on purpose: the legacy sPRL2
record comes from hardhat-deploy v1 without argsData, so rerunning its
script would redeploy sPRL2.
The mainnet sprl2 section is the constructor input of the already
deployed legacy sPRL2, which was deployed with a 60 second timelock
(deployments/mainnet/sPRL2.json). It had been changed to 2419200 by
mistake.
The Ethereum table pointed to 0x9033...8545, an empty sPRL2, and to the
migrator wired to it (0xd0D8...d069). The live ones are sPRL2
0xE8A2...2135 and sPRL2Migrator 0x2fE6...BbEF, whose SPRL2() returns
0xE8A2...2135 (deployments/mainnet).
The Base config no longer has an sprl2 section, so an untagged deploy on
Base crashed reading sprl2Data.permit2. The legacy sPRL2 only exists on
mainnet: make the config section optional and skip the script when it
is missing.
sPRL2V3 kept the sPRL2V2 name, so during the migration wallets and
permit prompts would show two tokens with the same name. Rename it to
"Stake 20WETH-80PRL Frontier Deposit Vault" and say in the NatSpec that
the pool is FrontierFi. The contract is not deployed yet.
The Frontier pools still trade away from Balancer (25% on mainnet), and
nothing tied the sunset to fixing it. AlignFrontierAndSunset builds one
atomic DAO Safe batch instead: a swap that aligns the Frontier PRL price
with Balancer (found by simulation), then updateStartPenaltyPercentage(0)
and pause() on sPRL2V2. The swap minAmountOut reverts the whole batch if
the Frontier price moved before execution. The script runs the batch
from the DAO Safe on the fork and checks the gap, the penalty and the
pause before writing batches/sprl2v2-align-and-sunset.<network>.safe.json.
Sunset calls already done are left out, so it also realigns the pool
during the migration.

* Replaces the standalone sprl2v2-sunset batches, which allowed a sunset
  without alignment.
* The fork tests now run this batch in setUp, and cover the SwapLimit
  revert of the whole batch and a realignment after the sunset.
* docs/sPRL2V3-Migration.md: the runbook, from deployment to the
  frontend checks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant