Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Layer2 Pool Token Mechanics and Bonding Logic #675

Open
14 tasks
kmlbgn opened this issue Jun 5, 2024 · 0 comments
Open
14 tasks

Refactor Layer2 Pool Token Mechanics and Bonding Logic #675

kmlbgn opened this issue Jun 5, 2024 · 0 comments
Assignees
Labels
invalid This doesn't seem right Priority: Critical refactor Codebase cleaning & improvement x/layer2

Comments

@kmlbgn
Copy link
Collaborator

kmlbgn commented Jun 5, 2024

Description

The current pool logic for dApp is wrong: the dp tokens (dApp tokens) do not exist, are never minted, and are not paired against the KEX tokens (similar to Uniswap v2 pools).

Expected Behaviour

A big refactor is needed for Layer2

  • total_bond parameters should be renamed to pooled_kiratoken
  • ratio should be renamed to supply_init, which corresponds to the initial supply of dp/token to be minted when RollApp proposal passes.
  • supply_cap parameter should be added (since token minting will use the minting module Migrate Minting module from Layer 2 module to Token Module and Refactor Token Module Structure #664). It can accept 0 value. It cannot be set below supply or transaction fails.
  • pooled_dapptoken parameters must be added to contain minted dp/denom
  • pooled_kiratoken, pooled_dapptoken and supply_init should be integrated into a LiquidityPool param of dApp object.
  • Missing dapp_pool_fee Network Property  #674 should be resolved ,pool_fee parameter must be deleted from dApp object
  • LpPoolConfig object should be deleted, only IssuanceConfig is relevant.
  • IssuanceConfig must contain drip, deposit, postmint, premint, premint_time, postmint_time parameters (ratio belongs to LiquidityPool object).
  • Refactor Layer2 Issuance and Vesting Logic  #676 should be resolved
  • Appropriate amount of dp/<denom> should be minted using supply_init at the same time as lp/<denom>, and put into LiquidityPool.pooled_dptoken against the bonded KEX.
  • Redeeming LP tokens should give back the pooled KEX and dpTokens in amounts at a 50/50 ratio, calculated with the bonding curve formula similar to how Uniswap v2 works X x Y = K.
  • A redeem-dapp-pool CLI command should be implemented to lock dp tokens/KEX tokens, according to the bonding curve similarly to Uniswap v2.
  • All redeem-dapp-pool, swap-dapp-pool, and convert-dapp-pool must be refactored since they should transact with dp/token. Refactor convert-dapp-pool and add CLI for Cross-App LP Token Swapping #678
  • bin: version parameter is missing #677 must be resolved

Proto Example

Dapp

PARAMETER TYPE
name string
version string
denom string
description string
website string
logo string
social string
docs string
controllers Controllers
bin BinaryInfo[]
pool LiquidityPool
issuance IssuanceConfig
update_time_max uint64
executors_min uint64
executors_max uint64
verifiers_min uint64
vote_quorum float
vote_period uint64
vote_enactment uint64
...

LiquidityPool

PARAMETER TYPE
pooled_kiratoken types.Coin
pooled_dptoken types.Coin
supply_init uint64

IssuanceConfig

PARAMETER TYPE
drip uint64
deposit string
postmint types.Int
premint types.Int
premint_time uint64
postmint_time uint64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right Priority: Critical refactor Codebase cleaning & improvement x/layer2
Projects
None yet
Development

No branches or pull requests

2 participants