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

feat: Improve Order check reliability #170

Merged
merged 2 commits into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading