Deposit additional PHA into HydraDX Omnipool

6mos ago
5 Comments
  • Content
  • AI Summary
Reply
Up 1
Share
Comments

Incentivising liquidity on DEX is also a practice accepted by the Polkadot community with referendums 560, 561 and 580, which provided for the distribution of 2 million DOT to HydraDX and 1 million DOT to StellaSwap. Although PHA is already available on major centralised exchanges I think this initiative should be considered but my biggest concern, due to my lack of experience, is the systemic risks of rebuilding traditional finance systems in a decentralised environment. DeFi has been hit hard with the return of the bear market and many protocols have suffered liquidity crises, what are the most negative aspects that could happen to HydraDX and how would it impact PHA tokens? thanks

Reply
Up

Update: I’ve been delaying moving forward with this Omnipool deposit proposal because I’ve been trying to do this “the right way” by crafting a preimage of extrinsics that could be approved by Phala governance and entirely control the transfer of assets and deposit of the tokens into the Omnipool from the Phala sibling account on the Hydra chain. I wanted to demonstrate that XCM could allow the Phala chain complete control over operations on another chain without assistance. However, even using Chopsticks to test transactions, I’ve found the XCM documentation lacking and debug nearly impossible. From some Polkadot forum posts I see that perhaps this use case isn’t fully supported yet.

Therefore I’m going to fall back to pressing the “easy button” so we can move forward. I’ll propose an on-chain PHA governance proposal to transfer the funds to the Phala sibling acct on HydraDX. If approved and transferred, I’ll propose a HydraDX governance proposal to deposit those tokens into the Omnipool on behalf of the Phala sibling acct.

Technical details:

  • call to xtransfer.transfer the PHA to sibling acct: (this works)
    0x030300016d6f646c70792f74727372790000000000000000000000000000000000000000520000000000130000981b62129f38010200c91f01007369626cf307000000000000000000000000000000000000000000000000000000
  • similar draft CFG XCM call to omnipool.addLiquidity(13, 46875 CFG): (doesn't work)
    0x790003010100c91f0314000400010200bd1f060200010000000000000000000000000000000000000000000000000000000000000013000064a7b3b6e00d1300010200bd1f060200010000000000000000000000000000000000000000000000000000000000000013000064a7b3b6e00d00060013000064a7b3b6e00d6566583b020d00000000008c239bb14d19ed09000000000000140d0100010200c91f01007369626cef070000000000000000000000000000000000000000000000000000
  • Astar and Bifrost both transferred more tokens into their sibling accts. Here’s the Hydra governance proposal to deposit ASTR tokens into the Omnipool: https://hydradx.subsquare.io/council/motions/176
  • There’s one example of successful parachain-to-parachain funds control - Hydra’s DOT->vDOT minting on Bifrost: Send 1M DOT to Bifrost and mint vDOT

Two recent Polkadot forums discussions about improving XCM implementation and documentation:

  1. https://forum.polkadot.network/t/xcm-user-and-developer-experience-improvements/4511/21
  2. https://forum.polkadot.network/t/asset-hub-brainstorming-session-call-notes-and-discussion-continuation/7260/5
  3. If any Phala/substrate devs knows how to correctly craft and execute the XCM calls, I’m all ears. Otherwise, I’d ask the Phala community to trust that this XCM implementation is being improved and in the future governance calls alone should be able to be used to remove liquidity and transfer it back to the Phala treasury if needed.
Reply
Up

The proposal is to move 4.08M PHA to Omnipool. So first step would be to move funds from Khala -> Phala treasury acct. There's currently 60.3M PHA on Khala and 4.4M PHA on Phala. I'm not sure how you want to keep those balanced, but if keeping them ~equal afterwards we could move 30M PHA from Khala to Phala using balances.setBalance like https://phala.subsquare.io/democracy/referenda/10. After transferring 4.08M PHA to Omnipool there would be 30.3M PHA left on Khala and 30.4M PHA on Phala.

Reply
Up

Since the Phala chain part of the treasury currently holds 4.7M PHA, we can proceed with this Omnipool deposit proposal and funds can be moved from KHA -> PHA as a separate set of referenda.

I also received help from Chopsticks and Centrifuge devs to figure out the right XCM calls to make and have now tested a single call that can achieve everything that I've proposed above. It will:

  1. Transfer 4.08M PHA to the Phala sibling acct on HydraDX (plus 20 PHA for fees buffer)
  2. schedule once every 1 block repeating 85 times to deposit 48k PHA into the Omnipool.
    0x030208030300016d6f646c70792f747273727900000000000000000000000000000000000000005200000000001300407db892249f38010200c91f01007369626cf30700000000000000000000000000000000000000000000000000000007040100000001010000005500000001210003010100c91f0314000400010100cd1f00070010a5d4e81300010100cd1f00070010a5d4e80006010700f2052a0102000400583b0208000000000038e5be87aa000000000000000000140d0100000101007369626cf3070000000000000000000000000000000000000000000000000000
    Results: Execution costs about 7 PHA and results in 13.1 PHA and 85 LP NFTs left in the Phala sibling acct on Hydra (for future XCM calls).

This has been submitted for official review (and governance voting) as preimage
0x5b6c86a58be24a3efbf701359f79dfb0fe92aa7f3e8a0082f306dfb495375308

Reply
Up