GetAssetOutboundFee ignores inRune argument for Synth/Derived/Trade Assets
Discord context:
https://discord.com/channels/838986635756044328/1242601024796233749/1242816903903182899
The prompting issue will be separately resolved by V133, but it still appears worth fixing GetAssetOutboundFee
behaviour.
https://gitlab.com/thorchain/thornode/-/blob/v1.132.0/x/thorchain/manager_gas_current.go#L102-112
func (gm *GasMgrVCUR) GetAssetOutboundFee(ctx cosmos.Context, asset common.Asset, inRune bool) (cosmos.Uint, error) {
thorchainOutboundFee := gm.keeper.GetOutboundTxFee(ctx)
// If the asset is native RUNE, return the default native outbound fee.
if asset.IsNativeRune() {
return thorchainOutboundFee, nil
}
// Asset is on THORChain, but not RUNE, convert the fee to asset value.
if asset.IsSyntheticAsset() || asset.IsDerivedAsset() || asset.IsTradeAsset() {
return gm.getRuneInAssetValue(ctx, thorchainOutboundFee, asset), nil
The issue is that if for instance the Asset is THOR.TOR and inRune is true
,
getRuneInAssetValue
will return the outbound fee in units of THOR.TOR rather than THOR.RUNE .
(For instance, returning (in 1e8 format)
0.13 instead of 0.02 .)
At present I propose that this last part instead be
// Asset is on THORChain, but not RUNE, convert the fee to asset value.
if asset.IsSyntheticAsset() || asset.IsDerivedAsset() || asset.IsTradeAsset() {
if inRune {
return thorChainOutboundFee, nil
}
return gm.getRuneInAssetValue(ctx, thorchainOutboundFee, asset), nil
.
Specifically: !3573 (merged)
'inRune respected by GetAssetOutboundFee
for Synth/Derived/Trade Assets'.
GetAssetOutboundFee
is currently called in three-to-four places
(other than the to-be-resolved handler_swap)
with inRune true
.
https://gitlab.com/search?search=.GetAssetOutboundFee%28&nav_source=navbar&project_id=13422983&group_id=5545144&search_code=true&repository_ref=v1.132.0
thorname.PreferredAsset, true
(two places, PreferredAsset swaps)
willSwapOutputExceedLimitAndFees
querier_quotes calculateMinSwapAmount