GAIA.ATOM short code "g" is reported by ShortCode and not by NewAssetWithShortCodes
Reported by Sinan.RangoExchange in this Discord message.
Found a bug on thornode api
ShortCode for Atom was defined in ShortCode(), but was missing from NewAssetWithShortCodes function.
Therefore, memo_parser was unable to fetch this asset in case short_code ("g") was used for GAIA.ATOM
Any swap using "g" instead of GAIA.ATOM was refunded and shortcode was not working for this asset
https://gitlab.com/thorchain/thornode/-/blob/v1.121.0/common/asset.go#L86-101
func NewAssetWithShortCodes(version semver.Version, input string) (Asset, error) {
shorts := make(map[string]string)
switch {
case version.GTE(semver.MustParse("1.115.0")):
shorts[AVAXAsset.ShortCode()] = AVAXAsset.String()
shorts[BCHAsset.ShortCode()] = BCHAsset.String()
shorts[BNBAsset.ShortCode()] = BNBAsset.String()
shorts[BNBBEP20Asset.ShortCode()] = BNBBEP20Asset.String()
shorts[BTCAsset.ShortCode()] = BTCAsset.String()
shorts[DOGEAsset.ShortCode()] = DOGEAsset.String()
shorts[ETHAsset.ShortCode()] = ETHAsset.String()
shorts[LTCAsset.ShortCode()] = LTCAsset.String()
shorts[RuneNative.ShortCode()] = RuneNative.String()
default:
// do nothing
}
Nine 'shorts' lines. https://gitlab.com/thorchain/thornode/-/blob/v1.121.0/common/asset.go#L197-223
// ShortCode returns the short code for the asset.
func (a Asset) ShortCode() string {
switch a.String() {
case "THOR.RUNE":
return "r"
case "BTC.BTC":
return "b"
case "ETH.ETH":
return "e"
case "BNB.BNB":
return "n"
case "GAIA.ATOM":
return "g"
case "DOGE.DOGE":
return "d"
case "LTC.LTC":
return "l"
case "BCH.BCH":
return "c"
case "AVAX.AVAX":
return "a"
case "BSC.BNB":
return "s"
default:
return ""
}
}
Ten non-default cases.
https://thornode.ninerealms.com/thorchain/pool/GAIA.ATOM
"asset": "GAIA.ATOM",
"short_code": "g",
As an immediate resolution, I propose adding ATOMAsset to the list of .ShortCode()
assets for the next network version.
Specifically, !3170 (merged)
'ATOMAsset line in NewAssetWithShortCodesV122 to match ShortCode'.
Further thoughts:
In the long run, preferable to have a single versioned list of short codes which both ShortCode
and NewAssetWithShortCodes
would refer to?
(Thus not needing to keep the two in sync like this.)