Agoric / agoric-sdk

monorepo for the Agoric Javascript smart contract platform
Apache License 2.0
328 stars 206 forks source link

PoolAccount management with LP tokens #10386

Open turadg opened 4 days ago

turadg commented 4 days ago

What is the Problem Being Solved?

Fast USDC needs a PoolAccount, funded by multiple Liquidity Providers.

Description of the Design

FUC holds a PoolAccount. (For now an LCA but should work for any ICA)

Public invitations to:

Exchange rate between USDC and LP shares is calculated by current size of the pool

Security Considerations

Scaling Considerations

Test Plan

Unit test of a PoolShare math module.

Contract unit test of deposits and withdrawals.

Upgrade Considerations

not yet deployed

dckc commented 17 hours ago

In my current draft (#10400, 9c389e2), the pool is a ZCF Seat.

Should the pool be an orchestration account, visible at the cosmos level?

? Where to put the pool assets? ZCFSeat or Orc Account?
  : in a ZCFSeat
    + follows the usual Zoe API
    + avoids async flow in deposit / withdraw methods
    ? (How) do clients look up the balance?
      : they don't
        . because they don't need to
      : contract publishes balance to vstorage
  : in an orchestration account
    + cosmos bank module publishes balance
    - goes against "contracts don't handle assets directly" best practice
      . contract has to withdraw from vbank into seat in offer handler

codecider