Rename price, limit args
This commit is contained in:
parent
a7017e16fe
commit
113b90e5e3
@ -65,17 +65,19 @@ class RPCGasOracle:
|
||||
|
||||
|
||||
def get_gas(self, code=None):
|
||||
gas_price = 0
|
||||
if self.conn != None:
|
||||
o = price()
|
||||
r = self.conn.do(o)
|
||||
n = strip_0x(r)
|
||||
gas_price = int(n, 16)
|
||||
fee_units = MINIMUM_FEE_UNITS
|
||||
if self.code_callback != None:
|
||||
fee_units = self.code_callback(code)
|
||||
price = int(n, 16)
|
||||
if price < self.min_price:
|
||||
logg.debug('adjusting price {} to set minimum {}'.format(price, self.min_price))
|
||||
price = self.min_price
|
||||
return (price, fee_units)
|
||||
if gas_price < self.min_price:
|
||||
logg.debug('adjusting price {} to set minimum {}'.format(gas_price, self.min_price))
|
||||
gas_price = self.min_price
|
||||
return (gas_price, fee_units)
|
||||
|
||||
|
||||
class RPCPureGasOracle(RPCGasOracle):
|
||||
@ -93,9 +95,11 @@ class OverrideGasOracle(RPCGasOracle):
|
||||
self.price = price
|
||||
|
||||
if self.limit == None or self.price == None:
|
||||
if conn != None:
|
||||
logg.debug('override gas oracle with rpc fallback')
|
||||
super(OverrideGasOracle, self).__init__(conn, code_callback)
|
||||
price_conn = None
|
||||
if self.price == None:
|
||||
price_conn = conn
|
||||
logg.debug('override gas oracle with rpc fallback; price {} limit {}'.format(self.price, self.limit))
|
||||
super(OverrideGasOracle, self).__init__(price_conn, code_callback)
|
||||
|
||||
|
||||
def get_gas(self, code=None):
|
||||
@ -103,8 +107,6 @@ class OverrideGasOracle(RPCGasOracle):
|
||||
fee_units = None
|
||||
fee_price = None
|
||||
|
||||
rpc_results = None
|
||||
if self.conn != None:
|
||||
rpc_results = super(OverrideGasOracle, self).get_gas(code)
|
||||
|
||||
if self.limit != None:
|
||||
@ -122,10 +124,10 @@ class OverrideGasOracle(RPCGasOracle):
|
||||
if fee_units == None:
|
||||
if rpc_results != None:
|
||||
fee_units = rpc_results[1]
|
||||
logg.debug('override gas oracle without explicit limit, setting from rpc {}'.format(fee_limit))
|
||||
logg.debug('override gas oracle without explicit limit, setting from rpc {}'.format(fee_units))
|
||||
else:
|
||||
fee_units = MINIMUM_FEE_UNITS
|
||||
logg.debug('override gas oracle without explicit limit, setting default {}'.format(fee_limit))
|
||||
logg.debug('override gas oracle without explicit limit, setting default {}'.format(fee_units))
|
||||
|
||||
return (fee_price, fee_units)
|
||||
|
||||
|
@ -57,8 +57,8 @@ argparser.add_argument('-i', '--chain-spec', dest='i', type=str, default='evm:et
|
||||
argparser.add_argument('-y', '--key-file', dest='y', type=str, help='Ethereum keystore file to use for signing')
|
||||
argparser.add_argument('--env-prefix', default=os.environ.get('CONFINI_ENV_PREFIX'), dest='env_prefix', type=str, help='environment prefix for variables to overwrite configuration')
|
||||
argparser.add_argument('--nonce', type=int, help='override nonce')
|
||||
argparser.add_argument('--price', type=int, help='override gas price')
|
||||
argparser.add_argument('--limit', type=int, help='override gas limit')
|
||||
argparser.add_argument('--gas-price', dest='gas_price', type=int, help='override gas price')
|
||||
argparser.add_argument('--gas-limit', dest='gas_limit', type=int, help='override gas limit')
|
||||
argparser.add_argument('-u', '--unsafe', dest='u', action='store_true', help='Auto-convert address to checksum adddress')
|
||||
argparser.add_argument('-v', action='store_true', help='Be verbose')
|
||||
argparser.add_argument('-vv', action='store_true', help='Be more verbose')
|
||||
@ -101,8 +101,8 @@ else:
|
||||
nonce_oracle = RPCNonceOracle(signer_address, conn)
|
||||
|
||||
gas_oracle = None
|
||||
if args.price or args.limit != None:
|
||||
gas_oracle = OverrideGasOracle(price=args.price, limit=args.limit, conn=conn)
|
||||
if args.gas_price or args.gas_limit != None:
|
||||
gas_oracle = OverrideGasOracle(price=args.gas_price, limit=args.gas_limit, conn=conn)
|
||||
else:
|
||||
gas_oracle = RPCGasOracle(conn)
|
||||
|
||||
|
@ -58,8 +58,8 @@ argparser.add_argument('--env-prefix', default=os.environ.get('CONFINI_ENV_PREFI
|
||||
argparser.add_argument('-u', '--unsafe', dest='u', action='store_true', help='Auto-convert address to checksum adddress')
|
||||
argparser.add_argument('-s', '--send', dest='s', action='store_true', help='Send to network')
|
||||
argparser.add_argument('--nonce', type=int, help='Override nonce')
|
||||
argparser.add_argument('--price', type=int, help='Override gas price')
|
||||
argparser.add_argument('--limit', type=int, help='Override gas limit')
|
||||
argparser.add_argument('--gas-price', dest='gas_price', type=int, help='Override gas price')
|
||||
argparser.add_argument('--gas-limit', dest='gas_limit', type=int, help='Override gas limit')
|
||||
argparser.add_argument('-v', action='store_true', help='Be verbose')
|
||||
argparser.add_argument('-vv', action='store_true', help='Be more verbose')
|
||||
argparser.add_argument('recipient', type=str, help='Recipient account address')
|
||||
@ -105,7 +105,7 @@ def _max_gas(code=None):
|
||||
|
||||
gas_oracle = None
|
||||
if args.price != None:
|
||||
gas_oracle = OverrideGasOracle(args.price, args.limit)
|
||||
gas_oracle = OverrideGasOracle(price=args.gas_price, limit=args.gas_limit)
|
||||
else:
|
||||
gas_oracle = RPCGasOracle(conn, code_callback=_max_gas)
|
||||
|
||||
|
@ -416,7 +416,7 @@ input {}
|
||||
self.gas_used,
|
||||
)
|
||||
|
||||
s += 'status ' + self.status.name
|
||||
s += 'status ' + self.status.name + '\n'
|
||||
|
||||
if self.contract != None:
|
||||
s += """contract {}
|
||||
|
@ -1,16 +1,15 @@
|
||||
[metadata]
|
||||
name = chainlib
|
||||
version = 0.0.2a7
|
||||
version = 0.0.2a8
|
||||
description = Generic blockchain access library and tooling
|
||||
author = Louis Holbrook
|
||||
author_email = dev@holbrook.no
|
||||
url = https://gitlab.com/nolash/chainlib
|
||||
keywords =
|
||||
cic
|
||||
dlt
|
||||
blockchain
|
||||
cryptocurrency
|
||||
ethereum
|
||||
solidarity
|
||||
mutual_credit
|
||||
classifiers =
|
||||
Programming Language :: Python :: 3
|
||||
Operating System :: OS Independent
|
||||
|
Loading…
Reference in New Issue
Block a user