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

Commit

Permalink
feat: Improve Order check reliability (#170)
Browse files Browse the repository at this point in the history
* feat: make order check more reliable

* chore: version bump
  • Loading branch information
alexeychr authored Dec 28, 2023
1 parent ef5524f commit 34e2f1e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 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.2.3",
"version": "3.2.4",
"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
10 changes: 8 additions & 2 deletions src/chain-common/order-validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export class OrderValidator extends OrderEvaluationContextual {
await this.checkPrefulfillSwapAbility();

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

await this.checkFilters();
await this.checkAccountBalance();
Expand All @@ -63,6 +62,12 @@ export class OrderValidator extends OrderEvaluationContextual {
await this.checkRoughProfitability();
await this.runChecks();

// check again in case order has been already fulfilled
await this.checkTakeStatus();

// security check: does the order exists?
await this.checkGiveStatus();

return this.getOrderEstimator();
}

Expand Down Expand Up @@ -268,7 +273,8 @@ export class OrderValidator extends OrderEvaluationContextual {
orderId: this.order.orderId,
giveChain: giveChainId,
},
{ confirmationsCount: this.order.blockConfirmations },
// solana-specific: we want to accept orders even in the "processed" commitment level
{ confirmationsCount: 0 },
);

if (giveOrderStatus?.status === undefined) {
Expand Down

0 comments on commit 34e2f1e

Please sign in to comment.