Browse Source

CoinProtocol.Base: new `is_vm` attribute

The MMGen Project 5 months ago
parent
commit
7c18833435

+ 1 - 0
mmgen/proto/eth/params.py

@@ -38,6 +38,7 @@ class mainnet(CoinProtocol.DummyWIF, CoinProtocol.Secp256k1):
 	avg_bdi       = 15
 	decimal_prec  = 36
 	address_reuse_ok = True
+	is_vm = True
 	is_evm = True
 
 	# https://www.chainid.dev

+ 1 - 0
mmgen/proto/rune/params.py

@@ -38,6 +38,7 @@ class mainnet(CoinProtocol.Secp256k1):
 	rpc_type        = 'remote'
 	avg_bdi         = 6 # TODO
 	has_usr_fee     = False
+	is_vm           = True
 	address_reuse_ok = False
 
 	wif_ver_num = btc_mainnet.wif_ver_num

+ 1 - 0
mmgen/protocol.py

@@ -56,6 +56,7 @@ class CoinProtocol(MMGenObject):
 		base_coin  = None
 		is_fork_of = None
 		chain_names = None
+		is_vm = False
 		is_evm = False
 		has_usr_fee = True
 		rpc_type = 'local'

+ 1 - 1
mmgen/swap/proto/thorchain/thornode.py

@@ -114,7 +114,7 @@ class Thornode:
 		def get_estimated_fee():
 			return tx.feespec2abs(
 				fee_arg = d['recommended_gas_rate'] + gas_unit_data[gas_unit].code,
-				tx_size = None if tx.proto.is_evm else tx.estimate_size() + tx_size_adj)
+				tx_size = None if tx.proto.is_vm else tx.estimate_size() + tx_size_adj)
 
 		_amount_in_label = 'Amount in:'
 		if deduct_est_fee:

+ 1 - 1
mmgen/tx/info.py

@@ -74,7 +74,7 @@ class TxInfo:
 
 			if tx.is_swap:
 				from ..swap.proto.thorchain import Memo, name
-				data = tx.swap_memo.encode() if tx.proto.is_evm else tx.data_output.data
+				data = tx.swap_memo.encode() if tx.proto.is_vm else tx.data_output.data
 				if Memo.is_partial_memo(data):
 					recv_mmid = getattr(tx, 'swap_recv_addr_mmid', None)
 					p = Memo.parse(data.decode('ascii'))

+ 3 - 3
mmgen/tx/new_swap.py

@@ -108,7 +108,7 @@ class NewSwap(New):
 				arg = get_arg()
 
 			# arg 3: chg_spec (change address spec)
-			if args.send_amt and not (self.proto.is_evm or arg in sa.recv): # is change arg
+			if args.send_amt and not (self.proto.is_vm or arg in sa.recv): # is change arg
 				nonlocal chg_output
 				chg_output = await self.get_chg_output(arg, addrfiles)
 				arg = get_arg()
@@ -140,7 +140,7 @@ class NewSwap(New):
 				get_char('Press any key to continue: ')
 				msg('')
 
-		if args.send_amt and not (chg_output or self.proto.is_evm):
+		if args.send_amt and not (chg_output or self.proto.is_vm):
 			chg_output = await self.get_chg_output(None, addrfiles)
 
 		recv_output = await self.get_swap_output(
@@ -170,7 +170,7 @@ class NewSwap(New):
 		self.swap_recv_addr_mmid = recv_output.mmid
 
 		return (
-			[f'vault,{args.send_amt}', f'data:{memo}'] if args.send_amt and self.proto.is_evm else
+			[f'vault,{args.send_amt}', f'data:{memo}'] if args.send_amt and self.proto.is_vm else
 			[f'vault,{args.send_amt}', chg_output.mmid, f'data:{memo}'] if args.send_amt else
 			['vault', f'data:{memo}'])
 

+ 2 - 2
test/cmdtest_d/swap.py

@@ -225,12 +225,12 @@ class CmdTestSwapMethods:
 			file_desc       = None,
 			new_outputs     = False):
 		if new_outputs:
-			if not self.proto.is_evm:
+			if not self.proto.is_vm:
 				t.expect(f'{self.fee_desc}: ', interactive_fee + '\n')
 			t.expect('(Y/n): ', 'y')        # fee ok?
 			t.expect('(Y/n): ', 'y')        # change ok?
 		else:
-			if not self.proto.is_evm:
+			if not self.proto.is_vm:
 				t.expect('ENTER for the change output): ', '\n')
 				t.expect('(Y/n): ', 'y')    # confirm deduct from chg output
 			t.expect('to continue: ', '\n') # exit swap quote