IBC Dex Aggregation: Bifrost Signing
Related to #1848
Implement signing/broadcasting of IBCTransfers to execute a cross-chain swap in Bifrost.
XCS contracts to support:
- Osmosis: https://github.com/osmosis-labs/osmosis/tree/main/cosmwasm/contracts/crosschain-swaps#via-ibc
- Astroport: https://github.com/astroport-fi/astroport-core/tree/main/contracts/router#astroport-router
In cosmos_client.go
the SignTx
function will need to be updated to build/sign an IBCTransfer Msg if all required properties are present, and if not build/sign a MsgSend (current implementation).
Implementation: In the gaia client, use the following properties to build an IBCTransfer (if all required properties are present).
-
TxOutItem.Aggregator
(string) - XCS contract to invoke -
TxOutItem.AggregatorTargetAsset
(string) - Final output channel/denom (e.g.channel-42/ujuno). From this the denom hash can be derived (i.e.ibc/${sha256(transfer/channel-42/ujuno)}
) -
TxOutItem.AggregatorTargetLimit
(uint) - Limit of final output denom -
TxOutItem.Memo
- Format (OUT:|/ (The should be passed to theon_failed_delivery
property of the Osmosis XCS memo. The is the user's address on final destination chain.
Additional details:
- For cross-chain swaps the tx will also need to include the "interim channel/denom" - used for the intermediate hop from ATOM -> XCS chain (Osmosis, etc). These can be hardcoded in a map indexed by the contract address (TxOutItem.Aggregator) in the gaia chain client