Browse Source

SwapAsset: remove `asset` property

The MMGen Project 5 months ago
parent
commit
c83c37d8dd

+ 0 - 4
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}'

+ 2 - 2
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]

+ 1 - 1
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',

+ 1 - 1
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):

+ 2 - 2
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