From c83c37d8ddc717c92babc16da8a914c3a66184c8 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Sun, 15 Jun 2025 09:17:02 +0000 Subject: [PATCH] SwapAsset: remove `asset` property --- mmgen/swap/asset.py | 4 ---- mmgen/swap/proto/thorchain/memo.py | 4 ++-- mmgen/swap/proto/thorchain/thornode.py | 2 +- mmgen/tx/new_swap.py | 2 +- test/modtest_d/swap.py | 4 ++-- 5 files changed, 6 insertions(+), 10 deletions(-) diff --git a/mmgen/swap/asset.py b/mmgen/swap/asset.py index 14e3260e..80335460 100644 --- a/mmgen/swap/asset.py +++ b/mmgen/swap/asset.py @@ -76,10 +76,6 @@ class SwapAsset: def coin(self): return self.data.name or self.data.full_name.split('.', 1)[0] - @property - def asset(self): - return None if self.data.name else self.data.full_name.split('.', 1)[1] - @property def full_name(self): return self.data.full_name or f'{self.data.name}.{self.data.name}' diff --git a/mmgen/swap/proto/thorchain/memo.py b/mmgen/swap/proto/thorchain/memo.py index 9517d439..aaf170f1 100755 --- a/mmgen/swap/proto/thorchain/memo.py +++ b/mmgen/swap/proto/thorchain/memo.py @@ -117,8 +117,8 @@ class THORChainMemo: assert is_coin_addr(proto, addr) assert asset.coin == proto.coin, f'{asset.coin} != {proto.coin}' - assert asset.asset == getattr(proto, 'tokensym', None), ( - f'{asset.asset} != {getattr(proto, "tokensym", None)}') + assert asset.tokensym == getattr(proto, 'tokensym', None), ( + f'{asset.tokensym} != {getattr(proto, "tokensym", None)}') assert asset.direction == 'recv', f'{asset.direction} != ‘recv’' self.addr = addr.views[addr.view_pref] diff --git a/mmgen/swap/proto/thorchain/thornode.py b/mmgen/swap/proto/thorchain/thornode.py index 1dcf4241..bd2ede9b 100755 --- a/mmgen/swap/proto/thorchain/thornode.py +++ b/mmgen/swap/proto/thorchain/thornode.py @@ -55,7 +55,7 @@ class Thornode: die(2, pp_fmt(data)) return data - if self.tx.proto.tokensym or self.tx.recv_asset.asset: # token swap + if self.tx.proto.tokensym or self.tx.recv_asset.tokensym: # token swap in_data = get_data( self.tx.send_asset.full_name, 'THOR.RUNE', diff --git a/mmgen/tx/new_swap.py b/mmgen/tx/new_swap.py index a2fbd9a1..9b66e448 100755 --- a/mmgen/tx/new_swap.py +++ b/mmgen/tx/new_swap.py @@ -27,7 +27,7 @@ def init_swap_proto(cfg, asset): cfg, asset.coin, network = cfg._proto.network, - tokensym = asset.asset, + tokensym = asset.tokensym, need_amt = True) def get_send_proto(cfg): diff --git a/test/modtest_d/swap.py b/test/modtest_d/swap.py index 269f684b..3b059842 100755 --- a/test/modtest_d/swap.py +++ b/test/modtest_d/swap.py @@ -63,7 +63,7 @@ class unit_tests: return True def asset(self, name, ut, desc='SwapAsset class'): - for name, full_name, memo_name, chain, asset, direction in ( + for name, full_name, memo_name, chain, tokensym, direction in ( ('BTC', 'BTC.BTC', 'b', 'BTC', None, 'recv'), ('LTC', 'LTC.LTC', 'l', 'LTC', None, 'recv'), ('BCH', 'BCH.BCH', 'c', 'BCH', None, 'recv'), @@ -74,7 +74,7 @@ class unit_tests: assert a.name == name assert a.full_name == full_name assert a.direction == direction - assert a.asset == asset + assert a.tokensym == tokensym assert a.chain == chain assert a.memo_asset_name == memo_name return True