Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
fix inifity order evaluation after it has been unlocked
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeychr committed Nov 6, 2023
1 parent ee68d0e commit b819193
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@debridge-finance/dln-taker",
"version": "3.0.0-rc.1",
"version": "3.0.0-rc.2",
"description": "DLN executor is the rule-based daemon service developed to automatically execute orders placed on the deSwap Liquidity Network (DLN) across supported blockchains",
"license": "GPL-3.0-only",
"author": "deBridge",
Expand Down
8 changes: 5 additions & 3 deletions src/chain-common/order-validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,16 @@ export class OrderValidator extends OrderEvaluationContextual {
await this.checkAllowedTaker();
await this.checkRouting();
await this.checkPrefulfillSwapAbility();
await this.checkAccountBalance();

await this.checkTakeStatus();
await this.checkGiveStatus();

await this.checkFilters();
await this.checkAccountBalance();
await this.checkTVLBudget();
await this.checkFinalization();
await this.checkFulfillmentDelay();
await this.checkThroughput();
await this.checkTakeStatus();
await this.checkGiveStatus();
await this.checkRoughProfitability();
await this.runChecks();

Expand Down
10 changes: 10 additions & 0 deletions src/processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,16 @@ export class OrderProcessor {

break;
}
case OrderInfoStatus.UnlockSent:
case OrderInfoStatus.UnlockClaim: {
this.clearInternalQueues(orderId);
this.clearOrderStore(orderId);
context.giveChain.TVLBudgetController.flushCache();
context.takeChain.TVLBudgetController.flushCache();
this.#batchUnlocker.remove(context.takeChain.chain, orderId);

break;
}
case OrderInfoStatus.Fulfilled: {
this.clearInternalQueues(orderId);
this.clearOrderStore(orderId);
Expand Down
7 changes: 7 additions & 0 deletions src/processors/BatchUnlocker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ export class BatchUnlocker {
});
}

remove(takeChain: ChainId, orderId: string) {
if (this.unlockBatchesOrderIdMap.has(takeChain)) {
this.unlockBatchesOrderIdMap.get(takeChain)!.delete(orderId);
this.ordersDataMap.delete(orderId);
}
}

async unlockOrder(orderId: string, order: OrderData): Promise<void> {
// validate current order state:
const orderState = await this.executor.client.getTakeOrderState(
Expand Down

0 comments on commit b819193

Please sign in to comment.