galacticcouncil / galacticcouncil/hydration-node

Dispatch as holding account

Open
#1,107 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
208
Forks
109
Avg merge
6d 3h
Merged PRs (30d)
3

Description

To support usecases like withdrawing USDT from omnipool where you have to partically remove liq. from your NFT position and then remove all shares received from Stableswap we need to implement way to deal with holding account that would simplify operations with non-exact inputs, where simply current balance could be used as input.
This would be effectivelly generic way how router currently operates with its router account to make sure outputs are always consumed.

Related to #1005 and posibly solving it.

XCM does something similar, alternatelly we could leverage that instead if usable.

### Spec
create new extrinsic `dispatcher.dispatchAsHolding(call)`
- Extrinsic would be executed with holding account origin.
- Ideally every origin would have its holding account derived, so even if you miss some outputs, you can recover them later.

### Example usecase
I have omnipool position 11 of 2pool share token, currently valued at 90 2pool shares + 1 h20.
I want to withdraw half of the position as usdt.

- batch
- transfer position 11 to holding
- dispatch as holding
- batch
- withdraw 1/2 shares of 11
- sell all 2pool shares for usdt
- transfer position 11 to origin
- transfer all usdt to origin
- transfer all h20 to origin

This example should work even when position is in farms with appropriate additional calls.
Also we should make sure that we have appropriate methods if the user doesnt want just USDT but wants to withdraw proportionally - like remove_all_liquidity.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.