GP 20: Migrate BOB pool to USDC on Optimism
Last updated
Last updated
The proposal was confirmed and executed.
Following the successful transition from BOB to USDC on Polygon, this proposal replaces the underlying token from BOB to USDC for the zkBob pool on Optimism.
The migration replaces the zkBob pool implementation to the new contract 0x8f4127D3131789a9e2f7380AF903F643d0ae721C
and the Direct Deposit Queue implementation to 0x9bf586ceB3F3C1bebBE8b0262c2AE7D0952ce3B1
. To allow further swaps of USDC to ETH as part of withdrawals, the Token Seller contract is replaced by 0x48CE9dAb591d737F2fa8955c6283CbcA84A86544
.
During proposal execution all BOB owned by the zkBob pool contract is swapped to USDC using UniswapV3. The amount of BOB tokens paid as fees on Uniswap will be reimbursed with the corresponding amount of USDC from the Governance Safe account. The logic of the tokens swap is defined in the migrationToUSDC() pool method.
To avoid undesirable interactions with the zkBob pool prior to the migration the proposal consists of two steps:
Step 1: Disable direct deposits
Transaction #16 in the Safe on Optimism contains two setLimits
calls to disallow users to transfer tokens directly to the pool by setting limits for tier 0 and 1 to zero for direct deposits. New interim limits are:
Tier | Single deposit | Daily user deposit | Daily deposit | Daily withdrawal | Pool size | Single DD | Daily user DD |
---|---|---|---|---|---|---|---|
This step is executed 20 minutes prior to step 2.
Step 2: Migrate the pool from BOB to USDC
Transaction #17 in the Safe executes the following calls:
Increase allowance of the pool contract 0x1CA8C2B9B20E18e86d5b9a72370fC6c91814c97C
to transfer USDC from Governance Safe by approve
made to the USDC token contract 0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85
.
Upgrade the pool implementation with the upgradeToAndCall
method. The method migrationToUSDC()
(selector c4a688b8
) is invoked after the upgrade.
Remove allowance of the pool contract to transfer USDC from the Governance Safe by approve
made to the USDC token contract 0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85
.
Upgrade the implementation of the direct deposit queue 0x15B8C75c024acba8c114C21F42eb515A762c0014
by upgradeTo
.
Configure new Token Seller contract on the pool by setTokenSeller
.
The remaining two calls invoke setLimits
for tier 0 and 1 users. The reinstated limits are:
The migration procedure has been verified by using the following Foundry-script.
To check the safe contract execution run the following script: https://gist.github.com/akolotov/9e70b43a75426c8276c061d9176b0968
forge test --match-path ./script/scripts/VerifySafeTx_Gov44.t.sol --ffi -vvvv
Make sure jq
CLI is installed
Tier | Single deposit | Daily user deposit | Daily deposit | Daily withdrawal | Pool size | Single DD | Daily user DD |
---|---|---|---|---|---|---|---|
Default, id 0
10,000 BOB
10,000 BOB
300,000 BOB
300,000 BOB
10,000,000 BOB
0 BOB
0 BOB
Partners, id 1
100,000 BOB
100,000 BOB
300,000 BOB
300,000 BOB
10,000,000 BOB
0 BOB
0 BOB
Default, id 0
10,000 USDC
10,000 USDC
300,000 USDC
300,000 USDC
10,000,000 USDC
1,000 USDC
10,000 USDC
Partners, id 1
100,000 USDC
100,000 USDC
300,000 USDC
300,000 USDC
10,000,000 USDC
1,000 USDC
10,000 USDC