GP 6: Upgrade zkBob to support direct deposits

Direct deposits are subject to the newly introduced limits at the time of submission

  • dailyUserDirectDepositCap - limit on the amount for daily direct deposits submitted by a single user

  • directDepositCap - limit on the amount of a single direct deposit

Each direct deposit is subject to a submission fee at the time of its submission:

  • directDepositFee - direct deposit fee

Each direct deposit left unprocessed by the relayer for a certain amount of time can be refunded in full by the user:

  • directDepositTimeout - configured direct deposit refund timeout

circle-info

Learn more about Direct Deposit functionality and how to use in our hackathon instructions.

Proposal objective

Upgrade existing zkBob pool with the support for direct deposits using the following configuration:

  1. dailyUserDirectDepositCap - 10,000 BOB (18 decimals)

  2. directDepositCap - 1,000 BOB (18 decimals)

  3. directDepositFee - 0.1 BOB (18 decimals)

  4. directDepositTimeout - 24 hours ↔ 86,400 seconds

The module for direct deposits is deployed in a separate contract 0x668c5286eAD26fAC5fa944887F9D2F20f7DDF289arrow-up-right. It owner is configured to the governance multisig (0xd4a3D9Ca00fa1fD8833D560F9217458E61c446d8arrow-up-right). See Additional verificationarrow-up-right for verification. The direct deposits module address is hardcoded into the new zkBob pool implementation contract proposed for upgrade.

The upgrade also adds a new snark verifier for direct deposit batch verification - 0x9a7B4198065efE631a962e737bDfE1f44f2CB3EEarrow-up-right

The snark verifier for transfers is redeployed to reflect changes in the transfer verification snark - 0xA86C511832eAd78d30ad49711874a9F3a1dfb840arrow-up-right

The snark verifier for tree updates is left unchanged and is reused from the previous deployment - 0x82907eAeB25D248dC82033E45b00A3E012Ba2d0Darrow-up-right

Proposal breakdown

The corresponding transaction in the governance safe is transaction #26arrow-up-right. The transaction contains 3 actions:

Action 1

zkBobPool contract upgrade 0x72e6B59D4a90ab232e55D4BB7ed2dD17494D62fBarrow-up-right. The new implementation 0x0eDcE5CAf830c6b845503001D8378b0d4F3b89bBarrow-up-right is applied through the upgradeTo call (the selector is 0x3659cfe6).

Action 2

setLimits call (the selector is 0xe8fd02e4) from the zkBobPool contract 0x72e6B59D4a90ab232e55D4BB7ed2dD17494D62fBarrow-up-right. The method is called to update limits related to direct deposits in tier 0. The current limits for the tier 0 set in the pool contract are:

The event is emitted with the same value.

Action 3

setLimits call (the selector is 0xe8fd02e4) from the zkBobPool contract 0x72e6B59D4a90ab232e55D4BB7ed2dD17494D62fBarrow-up-right. The method is called to update limits related to direct deposits in tier 1. The current limits for the tier 1 set in the pool contract are:

The event is emitted with the same value.

Additional verification

Diff between previous and new implementations of ZkBobPool -https://diffy.org/diff/e74278e64eab5arrow-up-right (auto-generated by https://github.com/zkBob/zkbob-contracts/actions/runs/4250762810arrow-up-right)

Configuration of proposed contracts can be checked using the following commands:

Last updated