BOB
  • πŸ‘‹BOB Stablecoin
  • BOB Info
    • πŸ—ΊοΈBOB Ecosystem
      • Mellow Protocol Vaults
    • 🦊MetaMask
      • Swap BOB with Metamask Swap
    • πŸ”BOB Swap
    • πŸ¦„Uniswap v3
    • πŸ™‹β€β™€οΈBOB FAQ
  • BOB CDP
    • ℹ️About
    • πŸ’‘Use Cases
    • πŸ‘¨β€πŸŽ€System actors
    • πŸ“šSystem configurations
    • 🏦Vault health
    • 🏘️User flow examples
    • πŸ‘¨β€πŸ’»Technical docs
      • Position valuation (technical)
      • Liquidations
      • Deployment addresses
      • Smart Contracts
        • NFTVaultRegistry
        • NFTVault
        • UniV3Oracle
        • ChainlinkOracle
        • DebtMinter
        • SurplusMinter
    • πŸ™‹β€β™‚οΈCDP FAQ
  • BOB DAO
    • πŸ§‘β€πŸ€β€πŸ§‘Governance
      • BOB DAO
      • Protocol Governance
        • GP 0: Increase SAFE membership
        • GP 1: Bob Swap beta testing infrastructure
        • GP 2: Upgrade Contracts to v1.0.0
        • GP 3: Enable Bob Swap for Public Use
        • GP 4: Increase Multisig & Upgrade BOB contract on all networks
        • GP 5: Enable Bob Swap on Ethereum Mainnet
        • GP 6: Upgrade zkBob to support direct deposits
        • GP 7: Increase Multi-chain Inventory and Update Bob Swap
        • GP 8: Extend pool limits for KYC'd users
        • GP 9: Deactivate Kyberswap inventory pairs [Emergency Measure]
        • GP 10: Reallocate previous Kyberswap inventory
        • GP 11: Add 24 hour timelock to BOB contract on Optimism
        • GP 12: Raise Polygon limits
        • GP 13: Launch BOB CDP
        • GP 14: Migrate BOB pool to USDC on Polygon
        • GP 15: KYB tiers on Optimism
        • GP 16: Remove excess inventory on Arbitrum and BNB Smart Chain
        • GP 17: Remove excess inventory on Optimism and Ethereum
        • GP 18: Remove excess inventory on Polygon
        • GP 19: Accrued Revenue Allocation
        • GP 20: Migrate BOB pool to USDC on Optimism
        • GP 21: BOB inventory reduction
    • πŸ“‹Inventory
      • Inventory Actions
  • BOB Resources
    • 🧩Visual Assets
    • ⛓️Links
Powered by GitBook
On this page
  • Proposal Objective
  • Mainnet
  • BNB Smart Chain
  • Moving Funds
  • Proposal and Transaction Breakdown
  • Ethereum Mainnet
  • BNB Smart Chain
  • Additional verification
  1. BOB DAO
  2. Governance
  3. Protocol Governance

GP 10: Reallocate previous Kyberswap inventory

PreviousGP 9: Deactivate Kyberswap inventory pairs [Emergency Measure]NextGP 11: Add 24 hour timelock to BOB contract on Optimism

Last updated 1 year ago

Proposal confirmed and executed in the following transactions:

  • Ethereum

    • Safe transaction

    • Ethereum tx:

  • BNB Smart Chain

    • Safe transaction

    • BNB tx:

Proposal Objective

Following GP 9, an emergency proposal to remove inventory from Kyberswap pairs on Mainnet and BNB chain, adjustments and reallocation of funds are proposed in this GP. The result will be a redistribution to several Uniswap pools and removal of some BOB from inventory. The overall decrease of total supply after this proposal is -3m BOB (52.5m β†’ 49.5m).

Mainnet

  1. Move Kyberswap USDT/BOB 0.008% inventory funds into Uniswap V3 USDT/BOB 0.01% inventory (2,000,000 BOB).

  2. Remove 2,000,000 BOB from Kyberswap USDC/BOB 0.008% inventory as the Uniswap V3 USDC/BOB inventory already holds a sufficient amount of funds.

BNB Smart Chain

  1. Move Kyberswap USDT/BOB 0.008% inventory funds into Uniswap V3 USDT/BOB 0.01% inventory (2,000,000 BOB)

  2. Move Kyberswap USDC/BOB 0.008% inventory funds into Uniswap V3 USDC/BOB 0.01% inventory (2,000,000 BOB)

  3. Remove 1,000,000 BOB from Kyberswap BUSD/BOB 0.008% inventory, as BUSD is being gradually deprecated.

Moving Funds

Moving funds between inventory pairs requires several system swap transactions throughout the execution, since the funds are stored and allocated in different proportions (this is a limitation of existing AMM protocols like Uniswap or Kyberswap).

To facilitate the swaps in this proposal, customized 1inch limit orders using a separate one-time helper contract are constructed. Following successful proposal execution, 1inch resolvers or other BOB counterparties will asynchronously fill the orders.

Proposal and Transaction Breakdown

Since the proposal consists of changes on 2 different networks, there are 2 different transactions explained below.

Ethereum Mainnet

Action 1

Action 2

Action 3

During simulations, this action results in 1,999,985 BOB + 0 USDT allocated into the inventory position. However exact amounts might change with Uniswap pool state changes. The helper contract will make sure to create two 1-to-1 limit orders for the remaining funds. During the initial simulations, this action resulted in 15 USDT β†’ 15 BOB limit order being created.

Once the limit order is filled, swapped tokens will be automatically and atomically added into the existing inventory position. This will happen asynchronously following proposal execution.

Action 4

Action 5

Action 6

Remove 2,000,000 BOB (18 decimals) from prior Kyberswap BOB/USDC 0.008% inventory (send to null address).

Part of the removed funds effectively come from Action 5.

Note: The inventory position use tick range: [-276325, -276323], as BOB has 18 decimals and USDT has 6 decimals

BNB Smart Chain

Action 1

Remove 1,000,000 BOB (18 decimals) from prior Kyberswap BOB/BUSD 0.008% inventory (send to Null address).

Action 2

Action 3

Action 4

Action 5

During the initial proposal simulations, this action results in all 2,000,000 BOB + 0 USDT being allocated into inventory position. However exact amounts might change with Uniswap pool state changes. Helper contract will make sure to create two 1-to-1 limit orders for the remaining funds.

Action 6

During the initial proposal simulations, this action results in all 1,891,800 BOB + 7,435 USDC being allocated into inventory position. However exact amounts might change with Uniswap pool state changes. The helper contract will make sure to create two 1-to-1 limit orders for the remaining funds. During the initial proposal simulations, this action resulted in 100,765 USDC β†’ 100,765 BOB limit order being created.

Once the limit order is filled, swapped tokens will be automatically and atomically added into the existing inventory position. This will happen asynchronously after the proposal execution.

Note: Both inventory positions use tick range: [-1, 1], as both tokens have 18 decimals

Additional verification

Verify logic of helper contracts facilitating inventory minting and limit orders execution:

Transaction in the Safe on Mainnet contains 6 actions:

Approve 1,999,985 BOB (18 decimals) for inventory allocation into Uniswap V3 BOB/USDT 0.01% inventory pair through the helper contract counterparty.

Approve 15 USDT (6 decimals) for inventory allocation into Uniswap V3 BOB/USDT 0.01% inventory pair through the helper contract counterparty

Mint part of the inventory BOB/USDT position through the helper contract counterparty. The action is executed by calling mint on the helper contract

See for simulation examples.

Approve 38,190.381903 USDC (6 decimals) to the BobSwap contract for conversion to BOB.

Convert 38,190.381903 USDC (6 decimals) into 38,190 BOB (18 decimals) through BobSwap . A commission of 0.381903 USDC is paid for this swap to BobSwap.

The action is executed by calling buy on the BobSwap contract.

Transaction in the Safe on BNB Chain contains 6 actions:

Approve 2,000,000 BOB (18 decimals) for inventory allocation into Uniswap V3 BOB/USDT 0.01% inventory pair through the helper contract counterparty

Approve 108,200 USDC (6 decimals) for inventory allocation into Uniswap V3 BOB/USDC 0.01% inventory pair through the helper contract counterparty.

Approve 1,891,800 BOB (18 decimals) for inventory allocation into Uniswap V3 BOB/USDC 0.01% inventory pair through the helper contract counterparty

Mint part of the inventory BOB/USDT position through the helper contract counterparty. The action is executed by calling mint on the helper contract

Once the limit order is filled, swapped tokens will be automatically and atomically added into the existing inventory position. This will happen asynchronously after the proposal execution. See for simulation example.

Mint part of the inventory BOB/USDC position through the helper contract counterparty. The action is executed by calling mint on the helper contract

See for the simulation example.

Inventory LPs validity can be verified using the following simulation test -

Mainnet BOB/USDT inventory minter

BNB BOB/USDT inventory minter -

BNB BOB/USDC inventory minter -

Extra notes on Uniswap-related math:

πŸ§‘β€πŸ€β€πŸ§‘
#13
https://etherscan.io/tx/0xdcf96c97c5340f0023d2cd378b0d1e89b3433cb24817260103a4c7fff84446df
#9
https://bscscan.com/tx/0x337deca24b6bcd018b785edd4e6efe788dd4125ebf110d83495d649a2d9bc0ab
#13
0xCDAD0ad4DD1F614a6502043Ef546e447b25Ffb99
0xCDAD0ad4DD1F614a6502043Ef546e447b25Ffb99
0xCDAD0ad4DD1F614a6502043Ef546e447b25Ffb99
0x15729Ac1795Fa02448a55D206005dC1914144a9F
0x15729Ac1795Fa02448a55D206005dC1914144a9F
0x15729Ac1795Fa02448a55D206005dC1914144a9F
#9
0x0eF655F7Cee3D430302BC7D3d491aF295CB40401
0x525b4E120dDC602fF055Aa86803acD7D71F0c753
0x525b4E120dDC602fF055Aa86803acD7D71F0c753
0x0eF655F7Cee3D430302BC7D3d491aF295CB40401
Additional verification
0x525b4E120dDC602fF055Aa86803acD7D71F0c753
https://gist.github.com/k1rill-fedoseev/8537cc9a3f1753b0d579e1af662834bb
0xCDAD0ad4DD1F614a6502043Ef546e447b25Ffb99
0x0eF655F7Cee3D430302BC7D3d491aF295CB40401
0x525b4E120dDC602fF055Aa86803acD7D71F0c753
Uniswap V3 Math Nuances
additional verification
additional verification