GP 14: Migrate BOB pool to USDC on Polygon
The proposal was confirmed and executed.
Proposal objective
This proposal is to replaces the underlying token from BOB to USDC for the zkBob pool on Polygon as discussed with the community.
The migration will replace the zkBob pool implementation to the new contract 0x5e93FA8819Bc074C717a92240a1689D1B81aAFcd
and the Direct Deposit Queue implementation to 0x22299414E9e0E7663f8977a7EA6c1908F2167181
. To allow further swaps of USDC to MATIC as part of the withdrawal process the Token Seller contract will be replaced by 0xDb53D01947252A5bEb488991971D8436AA2828A5
.
All BOB owned by the zkBob pool contract will be swapped to USDC using BobSwap. The amount of BOB tokens paid as fees on BobSwap 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() method of the pool.
Proposal breakdown
To avoid undesirable interactions with the zkBob pool before the migration the proposal consists of two steps:
Step 1: Disable direct deposits
Transaction #32 in the Safe on Polygon contains two three setLimits
calls to disallow users from transfering tokens directly to the pool by setting limits for tier 0, 1 and 254 to zero for direct deposits. Interim limits are set to the following values:
Tier | Single deposit | Daily user deposit | Daily deposit | Daily withdrawal | Pool size | Single DD |
---|---|---|---|---|---|---|
Default, id 0 | 10,000 BOB | 10,000 BOB | 300,000 BOB | 300,000 BOB | 2,000,000 BOB | 0 BOB |
KYC, id 254 | 20,000 BOB | 20,000 BOB | 300,000 BOB | 300,000 BOB | 2,000,000 BOB | 0 BOB |
Partners, id 1 | 100,000 BOB | 100,000 BOB | 300,000 BOB | 300,000 BOB | 2,000,000 BOB | 0 BOB |
Step 1 is executed 15 minutes prior to step 2.
Step 2: Migrate the pool from BOB to USDC
Transaction #33 in the Safe executes the following calls:
increase allowance of the pool contract
0x72e6B59D4a90ab232e55D4BB7ed2dD17494D62fB
to transfer USDC from the Governance Safe via theapprove
call to the USDC token contract0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174
.upgrade the pool implementation with
upgradeToAndCall
. The methodmigrationToUSDC()
(selectorc4a688b8
) is invoked after the upgrade.remove allowance of the pool contract to transfer USDC from Governance Safe via the
approve
call made to the USDC token contract0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174
.upgrade the implementation of the direct deposit queue
0x668c5286eAD26fAC5fa944887F9D2F20f7DDF289
using theupgradeTo
call.configure new Token Seller contract on the pool using
setTokenSeller
.the remaining three calls invoke
setLimits
corresponding to tiers 0, 1 and 254. The recovered limits are:
Tier | Single deposit | Daily user deposit | Daily deposit | Daily withdrawal | Pool size | Single DD | Daily user DD |
---|---|---|---|---|---|---|---|
Default, id 0 | 10,000 USDC | 10,000 USDC | 300,000 USDC | 300,000 USDC | 2,000,000 USDC | 1,000 USDC | 10,000 USDC |
KYC, id 254 | 20,000 USDC | 20,000 USDC | 300,000 USDC | 300,000 USDC | 2,000,000 USDC | 1,000 USDC | 10,000 USDC |
Partners, id 1 | 100,000 USDC | 100,000 USDC | 300,000 USDC | 300,000 USDC | 2,000,000 USDC | 1,000 USDC | 10,000 USDC |
Additional verification
The migration procedure was verified using the following Foundry-script.
Another script verifies the correctness of the Safe transactions execution. The script could be placed to script/scripts
directory of the zkBob contracts repo. The command to run the script is forge script -vvv -rpc-url <https://rpc.ankr.com/polygon> script/scripts/BOBPoolMigrationVerification.s.sol
Last updated