# GP 14: Migrate BOB pool to USDC on Polygon

{% hint style="success" %}
The proposal was confirmed and executed.&#x20;

* Polygon Safe Transactions [#32](https://app.safe.global/transactions/tx?safe=matic:0xd4a3D9Ca00fa1fD8833D560F9217458E61c446d8\&id=multisig_0xd4a3D9Ca00fa1fD8833D560F9217458E61c446d8_0xfc5cc2bf16390616d104198a54110cab73d34494d1e77b68b625274a149f4a8f) and [#33](https://app.safe.global/transactions/tx?safe=matic:0xd4a3D9Ca00fa1fD8833D560F9217458E61c446d8\&id=multisig_0xd4a3D9Ca00fa1fD8833D560F9217458E61c446d8_0x22e3f1cf073ac056b967e05fafaa16d09a07b6578c4ba44e3c53a5e5d364b1c9)
* Polygon txs:&#x20;
  * 32: <https://polygonscan.com/tx/0xfc792b0693fb6d5951085310d1aa0e1edb6932ceedbeb7a15434f89416778002>
  * 33: <https://polygonscan.com/tx/0x7cf8f47d95b7e38eea8c9b2b1110d3ce4602f2936f70cdc44a5fa670923e7d58>
    {% endhint %}

## Proposal objective

This proposal is to replaces the underlying token from BOB to [USDC](https://polygonscan.com/address/0x2791bca1f2de4661ed88a30c99a7a9449aa84174) for the zkBob pool on Polygon as [discussed with the community](https://forum.zkbob.com/t/proposal-to-migrate-zkbob-polygon-pool-from-bob-to-usdc/24).

The migration will replace the zkBob pool implementation to the new contract [`0x5e93FA8819Bc074C717a92240a1689D1B81aAFcd`](https://polygonscan.com/address/0x5e93FA8819Bc074C717a92240a1689D1B81aAFcd#code) and the Direct Deposit Queue implementation to [`0x22299414E9e0E7663f8977a7EA6c1908F2167181`](https://polygonscan.com/address/0x22299414E9e0E7663f8977a7EA6c1908F2167181#code). To allow further swaps of USDC to MATIC as part of the withdrawal process the Token Seller contract will be replaced by [`0xDb53D01947252A5bEb488991971D8436AA2828A5`](https://polygonscan.com/address/0xDb53D01947252A5bEb488991971D8436AA2828A5#code).

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()](https://github.com/zkBob/zkbob-contracts/blob/6a004c154efb4fc18503033647ce0768c5ff2a8c/src/zkbob/ZkBobPoolUSDCMigrated.sol#L34-L54) 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](https://app.safe.global/transactions/tx?safe=matic:0xd4a3D9Ca00fa1fD8833D560F9217458E61c446d8\&id=multisig_0xd4a3D9Ca00fa1fD8833D560F9217458E61c446d8_0xfc5cc2bf16390616d104198a54110cab73d34494d1e77b68b625274a149f4a8f) 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](https://app.safe.global/transactions/tx?safe=matic:0xd4a3D9Ca00fa1fD8833D560F9217458E61c446d8\&id=multisig_0xd4a3D9Ca00fa1fD8833D560F9217458E61c446d8_0x22e3f1cf073ac056b967e05fafaa16d09a07b6578c4ba44e3c53a5e5d364b1c9) in the Safe executes the following calls:

* increase allowance of the pool contract [`0x72e6B59D4a90ab232e55D4BB7ed2dD17494D62fB`](https://polygonscan.com/address/0x72e6b59d4a90ab232e55d4bb7ed2dd17494d62fb) to transfer USDC from the Governance Safe via the`approve` call to the USDC token contract [`0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174`](https://polygonscan.com/address/0x2791bca1f2de4661ed88a30c99a7a9449aa84174).
* upgrade the pool implementation with `upgradeToAndCall` . The method `migrationToUSDC()` (selector `c4a688b8`) 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 contract [`0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174`](https://polygonscan.com/address/0x2791bca1f2de4661ed88a30c99a7a9449aa84174).
* upgrade the implementation of the direct deposit queue [`0x668c5286eAD26fAC5fa944887F9D2F20f7DDF289`](https://polygonscan.com/address/0x668c5286ead26fac5fa944887f9d2f20f7ddf289) using the `upgradeTo` 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

[T](https://gist.github.com/akolotov/faffde298b0fb678ac2d045587fcf257)he migration procedure was verified using [the following Foundry-script](https://github.com/zkBob/zkbob-contracts/blob/6a004c154efb4fc18503033647ce0768c5ff2a8c/script/scripts/BOBPoolMigration.s.sol).

[Another script](https://gist.github.com/akolotov/028bbd6a0cc09683586557e11ca167d2) 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`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bob-docs.zkbob.com/bob-dao/governance/protocol-governance/gp-14-migrate-bob-pool-to-usdc-on-polygon.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
