Trade Assets do not allow RUNE swaps, but should they?
Currently with Trade Assets you cannot for instance take a single-asset arbitrage opportunity to balance a pool by buying RUNE.
I wonder then whether
https://gitlab.com/thorchain/thornode/-/blob/v1.128.0/x/thorchain/swap_current.go#L34-39
if tx.Coins[0].Asset.IsTradeAsset() && !target.IsTradeAsset() {
return errors.New("swaps from trade asset to L1 incur slip, use trade-")
}
if (!tx.Coins[0].Asset.IsSyntheticAsset() && !tx.Coins[0].Asset.IsTradeAsset()) && target.IsTradeAsset() {
return errors.New("swaps from L1 to trade asset incur slip, use trade+")
}
could be changed to
if tx.Coins[0].Asset.IsTradeAsset() && !target.IsNative() {
return errors.New("swaps from trade asset to L1 incur slip, use trade-")
}
if !tx.Coins[0].Asset.IsNative() && target.IsTradeAsset() {
return errors.New("swaps from L1 to trade asset incur slip, use trade+")
}
.
A regression test illustrating that swapping to RUNE is not possible is here:
947b8689
The job is here:
https://gitlab.com/thorchain/thornode/-/jobs/6332518891
.
My specific code proposal: !3465 (merged)
'Allow swaps between Trade Assets and other Native Assets (including RUNE)'.
Edited by Multipartite