mockenv staking/liquidity fix

This commit is contained in:
Tim Olson
2023-11-06 16:27:53 -04:00
parent 6a5bba1078
commit 0e49ebdcc5

View File

@@ -146,6 +146,7 @@ def handle_order_error(event: EventData):
def handle_transfer(transfer: EventData): def handle_transfer(transfer: EventData):
# todo handle native transfers incl gas for token transfers # todo handle native transfers incl gas for token transfers
log.debug(f'Transfer {transfer}')
from_address = transfer['args']['from'] from_address = transfer['args']['from']
to_address = transfer['args']['to'] to_address = transfer['args']['to']
amount = int(transfer['args']['value']) amount = int(transfer['args']['value'])
@@ -300,6 +301,10 @@ def finish_execution_request(req: TrancheExecutionRequest, error: str):
tranche_trigger = triggers.triggers[tk.tranche_index] tranche_trigger = triggers.triggers[tk.tranche_index]
tranche_trigger.status = TrancheStatus.Filled tranche_trigger.status = TrancheStatus.Filled
tranche_trigger.disable() tranche_trigger.disable()
elif error == 'Too little received':
# from UniswapV3 SwapRouter when not even 1 satoshi of output was gained
log.debug('warning: de minimis liquidity in pool')
# todo dont keep trying
else: else:
log.error(f'Unhandled execution error for transaction request {req} ERROR: "{error}"') log.error(f'Unhandled execution error for transaction request {req} ERROR: "{error}"')
er = execution_requests[tk] er = execution_requests[tk]