SIP-306: Collateral Migration (V3)
Author | |
---|---|
Status | Draft |
Type | Governance |
Network | Ethereum & Optimism |
Implementor | Daniel Beal (@dbeal-eth), Leonardo Massazza (@leomassazza), Alejandro Santander (@ajsantander) |
Release | TBD |
Created | 2022-07-04 |
Simple Summary
This SIP proposes an initial migration plan for Version 3 of the Synthetix protocol. Collateral will be migrated to V3 and account tokens will be minted to existing stakers’ addresses with the appropriate configuration. This collateral will be assigned to staking positions that back the current network’s debt.
Abstract
The migration will create accounts with staking positions that are delegated to the preferred fund which will initially provide liquidity to the existing synths via a “legacy” market contract. Escrowed SNX will be converted into SNX with polynomial vesting curves applied to accounts. Collateral will be transferred from V2X contracts to the V3 main proxy address. All tokens will remain the same. A subsequent proposal will outline a plan to break out the existing network debt into individual markets on V3.
Motivation
The primary goal of this plan is to minimise friction for stakers and to avoid disrupting the current usage of synths while still allowing the system to benefit from the upgrade to Version 3. Existing synths will retain their backing and stakers will not need to participate in a cumbersome or expensive migration process.
Specification
Overview
The plan proposed here involves three main components: upgrades to the current protocol, the creation of a “legacy” market contract, and a migration script.
Rationale
We’ve considered multiple other migration plans in relation to the one proposed here. The main alternative would involve a “clean break” from V2X, where all stakers and synth holders would need to voluntarily exit the existing system and opt into V3. There any many downsides to this approach: all users and ecosystem partners would be required to actively migrate; there would be an indefinite maintenance period for V2X; we would have multiple versions of the protocol’s tokens in circulation at once; there would be a risk of the synths issued by V2X losing their backing; there could become a higher risk of liquidation for stakers on V2X; and, there would be a higher risk of lost TVL and revenue.
Another plan we considered would entail rebuilding all aspects of the protocol for V3, updating all of the existing tokens—including synths—such that V3 can mint and burn them, and then running a migration script to generate V3 accounts and staking positions. While this would be non-disruptive to users, it would require us to determine how the market contracts and all of the auxiliary features of V2X (wrappers, loans, cross-chain synthesis, etc.) will be handled by V3 prior to initiating the migration.
Instead, the plan proposed here is similar to the second one above, but allows us to execute it in multiple steps. The “legacy” market contract will allow V3 to back the existing synths and support the auxilary features of the system. This way, we can start by providing the benefits of V3 to stakers (improved systems for collateral management, liquidations, staking incentives, etc.) prior to upgrading how synths are implemented and auxiliary features. (Notably, this plan is agnostic to when the Debt Migration is implemented, or whether it’s implemented at all. In V2X, the debt pool is synthesized, while in V3 we plan for the synthesis to occur across the credit provided by funds.)
Technical Specification
This migration will involve making some upgrades to V2X, deploying a “Legacy” Market Contract on V3, and running a migration script.
V2X Upgrades
We will make upgrades that effectively allows the V2X system to treat V3 as a single staker.
- SNX Token - This contract will be upgraded to allow the Synthetix V3 main proxy address to mint it (to be used by the eSNX module specified in the Staking Incentives SIP) and the Legacy market contract to transfer SNX. The inflation rate can be set to match that of v2x at the time of migration. All SNX in the escrow contract will be burned.
- Issuer - We will prevent the issuer from triggering a liquidation of the legacy market.
- SynthetixDebtShare - The legacy market will be made an authorized broker with the
addAuthorizedBroker
function.
“Legacy” Market Contract
The following pseudo-code outlines the necessary functions in this contract:
contract LegacyMarket is IMarket {
function balance() external returns (int) {
return synthetixV2.totalIssuedSynths()
}
function transferStakingPosition(address staker) external {
uint accountId = synthetixV3.createAccount();
synthetixDebtShares.transferFrom(staker, address(this), synthetixDebtShares.balanceOf(staker));
snxToken.transferFrom(address(synthetixV2), address(synthetixV3), snxToken.balanceOf( staker));
synthetixV3.delegateCollatera(/* preferred fund, leverage 1, etc. */)
_applyApproximateCurveFromEscrowEntry(accountId, staker); // Note that this contract temporarily needs elevated permissions to execute this function.
snxAccount.transfer(accountId, staker);
}
}
Migration Script
The migration will involve calling transferStakingPosition
for every address which is currently staking on the V2X protocol, after making the upgrades specified above.
Once the migration script has been executed, all staking positions will be migrated to V3, and all positions will providing liquidity to the legacy markets by default. (This means existing integrations of Synths, such as Curve, will not be disrupted.) Once this migration has occurred it will be possible to deprecate individual synths and features over time as specific migration plans are developed. This will likely require a new USD stablecoin (potentially named snxUSD) such that new debt minted by the V2X and V3 systems are distiguishable.
Test Cases
Relevant tests will be developed during implementation.
Configurable Values (Via SCCP)
N/A
Copyright
Copyright and related rights waived via CC0.