SwapAsset: new coin property
This commit is contained in:
parent
7cfa87ba6a
commit
040b32704e
3 changed files with 7 additions and 3 deletions
|
|
@ -72,9 +72,13 @@ class SwapAsset:
|
|||
def chain(self):
|
||||
return self.data.full_name.split('.', 1)[0] if self.data.full_name else self.name
|
||||
|
||||
@property
|
||||
def coin(self):
|
||||
return self.data.name or self.data.full_name.split('.', 1)[0]
|
||||
|
||||
@property
|
||||
def asset(self):
|
||||
return self.data.full_name.split('.', 1)[1] if self.data.full_name else None
|
||||
return None if self.data.name else self.data.full_name.split('.', 1)[1]
|
||||
|
||||
@property
|
||||
def full_name(self):
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ class THORChainMemo:
|
|||
assert trade_limit is None or isinstance(trade_limit, UniAmt), f'{type(trade_limit)} != {UniAmt}'
|
||||
assert is_coin_addr(proto, addr)
|
||||
|
||||
assert asset.chain == proto.coin, f'{asset.chain} != {proto.coin}'
|
||||
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.direction == 'recv', f'{asset.direction} != ‘recv’'
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ def init_swap_proto(cfg, asset):
|
|||
from ..protocol import init_proto
|
||||
return init_proto(
|
||||
cfg,
|
||||
asset.chain,
|
||||
asset.coin,
|
||||
network = cfg._proto.network,
|
||||
tokensym = asset.asset,
|
||||
need_amt = True)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue