Compare commits
2 Commits
4492d23c47
...
4740687167
| Author | SHA1 | Date | |
|---|---|---|---|
| 4740687167 | |||
| a06eeeb10d |
@@ -190,6 +190,7 @@ async def main():
|
|||||||
while True:
|
while True:
|
||||||
wake_up = now() + delay
|
wake_up = now() + delay
|
||||||
# log.debug(f'querying {pool}')
|
# log.debug(f'querying {pool}')
|
||||||
|
tx = None
|
||||||
try:
|
try:
|
||||||
price = await get_pool_price(pool)
|
price = await get_pool_price(pool)
|
||||||
if price != last_prices.get(pool):
|
if price != last_prices.get(pool):
|
||||||
@@ -200,7 +201,10 @@ async def main():
|
|||||||
addr, inverted = mirror_pools[pool]
|
addr, inverted = mirror_pools[pool]
|
||||||
log.debug(f'Mirrored {addr} {price}')
|
log.debug(f'Mirrored {addr} {price}')
|
||||||
except Exception as x:
|
except Exception as x:
|
||||||
log.debug(f'Could not update {pool}: {x}')
|
log.debug(f'Could not update {pool}: {x} {tx}')
|
||||||
|
if tx is not None:
|
||||||
|
tx.account.reset_nonce()
|
||||||
|
tx.account.release()
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
pool = next(pool_iter)
|
pool = next(pool_iter)
|
||||||
|
|||||||
@@ -81,14 +81,17 @@ def transact_wrapper(addr, name, func):
|
|||||||
account = await Account.acquire()
|
account = await Account.acquire()
|
||||||
if account is None:
|
if account is None:
|
||||||
raise ValueError(f'No account to sign transaction {addr}.{name}()')
|
raise ValueError(f'No account to sign transaction {addr}.{name}()')
|
||||||
await ct.sign(account)
|
|
||||||
try:
|
try:
|
||||||
tx_id = await current_w3.get().eth.send_raw_transaction(ct.data)
|
await ct.sign(account)
|
||||||
assert tx_id == ct.id_bytes
|
try:
|
||||||
return ct
|
tx_id = await current_w3.get().eth.send_raw_transaction(ct.data)
|
||||||
except Web3Exception as e:
|
assert tx_id == ct.id_bytes
|
||||||
e.args += addr, name
|
return ct
|
||||||
raise e
|
except Web3Exception as e:
|
||||||
|
e.args += addr, name
|
||||||
|
raise e
|
||||||
|
finally:
|
||||||
|
account.release()
|
||||||
return f
|
return f
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -614,11 +614,11 @@ class TrancheTrigger:
|
|||||||
self.order_trigger.expire_tranche(self.tk.tranche_index)
|
self.order_trigger.expire_tranche(self.tk.tranche_index)
|
||||||
|
|
||||||
def expire(self):
|
def expire(self):
|
||||||
|
self.disable()
|
||||||
if self.closed:
|
if self.closed:
|
||||||
return
|
return
|
||||||
order_log.debug(f'tranche expired {self.tk}')
|
order_log.debug(f'tranche expired {self.tk}')
|
||||||
self.status = TrancheState.Expired
|
self.status = TrancheState.Expired
|
||||||
self.disable()
|
|
||||||
|
|
||||||
def kill(self):
|
def kill(self):
|
||||||
order_log.warning(f'tranche KILLED {self.tk}')
|
order_log.warning(f'tranche KILLED {self.tk}')
|
||||||
|
|||||||
Reference in New Issue
Block a user