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

feat: Allow investing/redeeming from Asset Hub #2440

Open
mustermeiszer opened this issue Sep 9, 2024 · 2 comments
Open

feat: Allow investing/redeeming from Asset Hub #2440

mustermeiszer opened this issue Sep 9, 2024 · 2 comments
Labels
P3 lowest priority

Comments

@mustermeiszer
Copy link
Contributor

mustermeiszer commented Sep 9, 2024

To ease the lives of investors from Asset Hub (AH) we can provide a way to invest/redeem from these chains without the need to switch to Centrifuge Chain.

NOTE - The investor ALWAYS needs to be connected to AH to control the tranche tokens on Centrifuge Chain. In the UI the Portfolio will be confusing then, the USDC is held on AH whereas the tranche tokens are held on Centrifuge.

Monitoring the success of the calls on Centrifuge can be done by linking from the XCM Hash to the associated subscan page here. Note that we need one link per XCM message sent.

Investing

Connected and executed call from AH

Invest

This assumes that either PoolCurrency or a currency that can be swapped via pallet-token-mux is held on AH by the user.

utility.batchAll
* polkadotXcm.limitedReserveTransferAsset(..)
* polkadotXcm.send(INVEST_TRANSACT)

Example:

  • Encoded polkadotXcm.limitedReserveTransferAsset for transferring 1 USDC from AH to Centrifuge: 0x1f0803010100bd1f03000101008e450add99cf9e298985188545fb317153aa44cbf3fed49c9a5fa786689700080304000002043205e5140002093d000000000000
    NOTE: Decodable on AH
  • Encoded INVEST_TRANSACT for investing
    • Internal encoded transact data: ``
      NOTE: Decodable on Centrifuge

Cancel Invest

utility.batchAll
* polkadotXcm.send()

Collecting Investments

utility.batchAll
* polkadotXcm.send()

Redeeming

Connected and executed call from AH

Redeem

utility.batchAll
* polkadotXcm.send()

Cancel Redeem

utility.batchAll
* polkadotXcm.send()

Collecting Redemptions

utility.batchAll
* polkadotXcm.send()

Portfolio

It is mandatory, that the UI checks for the holdings of the derived account on Centrifuge chain and displays them too in the portfolio overview.

Derived Account

  • query runtimeApi.AccountConversionApi.conversion_of(..) to retrieve the DerivedACcount
    • for a user with AccountId-X on asset hub the input is: Location {parents: 1, junction: [Parachain(1,000), AccountId32(AccountId-X)]}
@mustermeiszer
Copy link
Contributor Author

Best would be to bring in this full ticket so that users see where their funds lie that they can control.

@mustermeiszer
Copy link
Contributor Author

Testing

Testing this will be very hard, as all test networks do not have an actual AH atm... Easiest should be to start a new AH parachain in our dev cluster and use that one.

@mustermeiszer mustermeiszer added the P3 lowest priority label Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 lowest priority
Projects
None yet
Development

No branches or pull requests

1 participant