HydraDX-node
HydraDX-node copied to clipboard
Setting on chain route when asset_in is stable share asset
When we want to store a route on-chain where the first trade asset_in, or last trade asset_out is share asset, then the first validation phase fails because we retrieve the reference amount in a wrong way for share asset
https://github.com/galacticcouncil/HydraDX-node/blob/e3821e078bdb72a0416f8aebca21ba4a7a599f64/pallets/stableswap/src/trade_execution.rs#L201
Namely, free_balance
returns 0 for share assets.
The fix would be to use total_issuance
in case of share assets.
But when a validation fails with an amount, then we try to revalidate with amount out from the sell validation coming from opposite direction. Since it solves the issue, we park it for now, low prio.