autosign defaults to True; missing order lookup bugfix

This commit is contained in:
Tim
2024-07-03 16:11:19 -04:00
parent 2267c40ef6
commit 7bae6342eb
4 changed files with 8 additions and 9 deletions

View File

@@ -121,7 +121,7 @@ async def main():
delay = max(0.010, config.polling)
update_once = config.polling <= 0
global source_w3
source_w3 = await create_w3(config.mirror_source_rpc_url, name='source')
source_w3 = await create_w3(config.mirror_source_rpc_url, name='source', autosign=False)
pools = (config.mirror_pools or [])
if not pools:
log.error('must configure mirror_pools')
@@ -129,7 +129,7 @@ async def main():
if config.account is None:
# Dev Account #5
config.account = '0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba'
await blockchain.connect(autosign=True, name='target') # autosign on the target chain
await blockchain.connect(name='target')
mirror_addr = config.mirror_env
if mirror_addr is None:
@@ -160,7 +160,7 @@ async def main():
if any(result['status'] != 1 for result in results):
log.error('Mirroring a token reverted.')
exit(1)
log.info(f'Tokens deployed {results}')
log.info(f'Tokens deployed')
log.debug(f'Mirroring pools {", ".join(pools)}')
txs = []

View File

@@ -18,7 +18,7 @@ from ..configuration.resolve import resolve_ws_url
from ..contract import get_contract_data
async def connect(rpc_url=None, account=NARG, autosign=False, name='default'):
async def connect(rpc_url=None, account=NARG, autosign=True, name='default'):
"""
connects to the rpc_url and configures context vars
"""
@@ -28,7 +28,7 @@ async def connect(rpc_url=None, account=NARG, autosign=False, name='default'):
return w3
async def create_w3(rpc_url=None, account=NARG, autosign=False, name='default'):
async def create_w3(rpc_url=None, account=NARG, autosign=True, name='default'):
# todo create a proxy w3 that rotates among rpc urls
# self.w3s = tuple(await create_w3(url) for url in rpc_url_or_tag)
# chain_id = self.w3s[0].eth.chain_id

View File

@@ -75,6 +75,8 @@ def build_wrapper(addr, name, func):
try:
account = current_account.get()
except LookupError:
account = None
if account is None:
raise RuntimeError(f'Cannot invoke transaction {addr}.{name}() without setting an Account.')
tx = await func(*args).build_transaction(kwargs)
tx['from'] = account.address

View File

@@ -67,10 +67,7 @@ class Order:
@staticmethod
def of(a, b=None) -> 'Order':
key = (OrderKey(a.vault, a.order_index) if type(a) is TrancheKey else a) if b is None else OrderKey(a, b)
try:
return Order.instances[key]
except KeyError:
return Order(key)
return Order.instances[key]
@staticmethod