Repository navigation
feat(sprl): add sPRL2V3 on FrontierFi and the sPRL2V2 sunset batches - #16
Open
FabienCoutant wants to merge 17 commits into
Open
FabienCoutant wants to merge 17 commits into
FabienCoutant wants to merge 17 commits into
Conversation
- 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
force-pushed
the
feat/sprl2v3-frontier-migration
branch
from
November 27, 2026 11:39
1f4aac4 to
c1a3b13
Compare
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 ofsPRL2V2with 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 theirbalancerRouter/balancerBPTnames since Frontier exposes the same Router interface.IBalancerV3Vault.sol: read and swap interfaces (vaultgetPoolTokenInfo, poolgetVault, routerswapSingleTokenExactIn) used by the script and the tests. No contract imports it.Opening the migration
scripts/AlignFrontierAndSunset.s.solbuilds one atomic DAO Safe batch:updateStartPenaltyPercentage(0)on sPRL2V2: the timelock cannot go below 1 day, but it only acts through the penalty and_withdrawnever checks the release time, so every request, pending or new, can be withdrawn at once without fee;pause()on sPRL2V2: blocks new deposits.requestWithdrawand 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 withSwapLimitand the sunset with it, so the sunset cannot happen on a mispriced pool. Before writingbatches/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
sPRL2V2.requestWithdraw(amount), thensPRL2V2.withdrawPRLAndWeth(ids, minPrl, minWeth, 0)right after: the user receives PRL and WETH.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 withAmountInAboveMaxif the price moved), and prefers a private RPC on mainnet.Deployment
sprl2v3config section for mainnet and Base (Frontier router0xB3C4…557B, pools0xbF59…a1A6on mainnet and0x4D81…ee4con Base, same penalty and timelock as sPRL2V2) anddeploy/scripts/sprl/sPRL2V3.ts.sprl2v3-roles.{mainnet,base}.safe.json: GUARDIAN (20) getspauseandunpause, GOVERNOR (10) getsupdateFeeReceiver,updateStartPenaltyPercentage,updateTimeLockDurationandrecoverERC20, same as sPRL2V2. The sPRL2V3 addresses are predicted from the deployer nonce (269 on mainnet, 209 on Base). Check them againstdeployments/<network>/sPRL2V3.jsonbefore signing.This branch also carries the five Base deployment commits from
deploy/tokenomics-v2that are not ondevyet (Base network support, sPRL2Migrator deploy script, SetSPRL2V2Role script, deployment docs), with fixes found while reviewing #16 and #17:SetSPRL2Role.s.soltargeted0x9033…8545, an empty sPRL2, while its calls are now live. It points to the canonical sPRL20xE8A2…2135.docs/Deployment.mdlisted that empty sPRL2 and the migrator wired to it (0xd0D8…d069). It lists the live sPRL2 and sPRL2Migrator0x2fE6…BbEF(same lines as in chore(deploy): add Avalanche and HyperEVM fee collector networks #17).sPRL2Migrator.tsreads its inputs through rockethgetinstead ofreadFileSync. Nodependencieson purpose: the legacy sPRL2 record comes from hardhat-deploy v1 withoutargsData, so rerunning its script would redeploy sPRL2. Dry run on a mainnet fork: reuses the deployed migrator, fails withno deployment named "sPRL2"when the record is missing.sprl2.timeLockDurationis back to 60, the value it was deployed with.sPRL2.tsskips chains without ansprl2section (Base) instead of crashing an untagged deploy.Tests
test/forks/sPRL2V3/manualMigration.t.solon mainnet and Base, against the real sPRL2V2 deployments, holders and Frontier pools.setUpruns the batch built by the script from the DAO Safe:SwapLimitwhen the Frontier price moves before execution, and sPRL2V2 stays unpaused with its penalty;AmountInAboveMaxwhen the Frontier price moves after the quote.12/12 pass, full suite 202/202.
AlignFrontierAndSunsetrun 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