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:
xtransfer.transfer
the PHA to sibling acct: (this works)omnipool.addLiquidity(13, 46875 CFG)
: (doesn't work)0x790003010100c91f0314000400010200bd1f060200010000000000000000000000000000000000000000000000000000000000000013000064a7b3b6e00d1300010200bd1f060200010000000000000000000000000000000000000000000000000000000000000013000064a7b3b6e00d00060013000064a7b3b6e00d6566583b020d00000000008c239bb14d19ed09000000000000140d0100010200c91f01007369626cef070000000000000000000000000000000000000000000000000000
Two recent Polkadot forums discussions about improving XCM implementation and documentation:
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.
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:
0x030208030300016d6f646c70792f747273727900000000000000000000000000000000000000005200000000001300407db892249f38010200c91f01007369626cf30700000000000000000000000000000000000000000000000000000007040100000001010000005500000001210003010100c91f0314000400010100cd1f00070010a5d4e81300010100cd1f00070010a5d4e80006010700f2052a0102000400583b0208000000000038e5be87aa000000000000000000140d0100000101007369626cf3070000000000000000000000000000000000000000000000000000
This has been submitted for official review (and governance voting) as preimage0x5b6c86a58be24a3efbf701359f79dfb0fe92aa7f3e8a0082f306dfb495375308
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