diff --git a/package-lock.json b/package-lock.json index 48c1b79..567120b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@debridge-finance/dln-taker", - "version": "3.0.0-rc.1", + "version": "3.0.0-rc.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@debridge-finance/dln-taker", - "version": "3.0.0-rc.1", + "version": "3.0.0-rc.2", "license": "GPL-3.0-only", "dependencies": { "@debridge-finance/dln-client": "8.2.1", diff --git a/package.json b/package.json index 545f1f5..31f7078 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/chain-common/order-validator.ts b/src/chain-common/order-validator.ts index 9723eab..b9e1712 100644 --- a/src/chain-common/order-validator.ts +++ b/src/chain-common/order-validator.ts @@ -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(); diff --git a/src/processor.ts b/src/processor.ts index c6d449a..6e37f36 100644 --- a/src/processor.ts +++ b/src/processor.ts @@ -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); diff --git a/src/processors/BatchUnlocker.ts b/src/processors/BatchUnlocker.ts index 572b2ad..b41f986 100644 --- a/src/processors/BatchUnlocker.ts +++ b/src/processors/BatchUnlocker.ts @@ -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 { // validate current order state: const orderState = await this.executor.client.getTakeOrderState(