Compare commits

...

2 Commits

Author SHA1 Message Date
tim
aed6c36746 arb1 accounting config 2025-02-26 13:39:08 -04:00
tim
31a2edd0c6 job cleanup fix 2025-02-26 13:39:00 -04:00
3 changed files with 23 additions and 2 deletions

View File

@@ -4,3 +4,17 @@ archive_url = 'arbitrum_alchemy'
concurrent_rpc_connections=8
metrics_port=9090
metadata = '' # this setting approves no tokens
stablecoins = [
# in order of preference
'0xaf88d065e77c8cC2239327C5EDb3A432268e5831', # USDC
'0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9', # USDT
'0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8', # USDC.e
]
quotecoins = [
# in order of preference
'0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f', # WBTC
'0x82aF49447D8a07e3bd95BD0d56f35241523fBab1', # WETH
]
nativecoin = ['0x82aF49447D8a07e3bd95BD0d56f35241523fBab1'] # WETH

View File

@@ -114,6 +114,7 @@ async def _initialize_mark_to_market():
impl_addr = await factory.implementation()
wrapper = await ContractProxy(impl_addr, 'Vault').wrapper()
if wrapper != ADDRESS_0:
log.info(f'Detected native coin wrapper {wrapper}')
config.nativecoin = wrapper
quotes.clear()
quotes.extend(config.stablecoins)

View File

@@ -172,20 +172,26 @@ async def handle_transaction_receipts():
log.warning(f'ignoring transaction request with bad type "{job.request.type}"')
else:
await handler.complete_transaction(job, receipt)
end_job(job)
try:
await handler.release_account(accounts_in_flight.pop(job.tx_id))
except KeyError:
pass
end_job(job)
def end_job(job):
ended_jobs.append(job)
def cleanup_jobs():
async def cleanup_jobs():
for job in ended_jobs:
log.debug(f'ending job {job.id}')
if job.tx_id in accounts_in_flight:
try:
handler = TransactionHandler.of(job.request.type)
await handler.release_account(accounts_in_flight.pop(job.tx_id))
except KeyError:
log.warning(f'ignoring transaction request with bad type "{job.request.type}"')
in_flight.discard((job.request.type, job.request.key))
db.session.delete(job)
ended_jobs.clear()