Skip to content

Commit

Permalink
fix: /deposits, exclude pending deposits with amount 0 (#212)
Browse files Browse the repository at this point in the history
* fix: /deposits, exclude pending deposits with amount 0

* Fix

* Fix tests

* Update service.ts
  • Loading branch information
amateima authored Jan 30, 2023
1 parent 683d72d commit 582eacf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/modules/deposit/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export class DepositService {
[deposits, total] = await this.depositRepository
.createQueryBuilder("d")
.where("d.status = :status", { status })
.andWhere("d.amount > 0")
.andWhere("d.depositDate > NOW() - INTERVAL '1 days'")
.andWhere(`d.depositRelayerFeePct * :multiplier >= d.suggestedRelayerFeePct`, {
multiplier: this.appConfig.values.suggestedFees.deviationBufferMultiplier,
Expand Down
4 changes: 2 additions & 2 deletions test/deposit.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ describe("GET /deposits", () => {
// filled deposits with depositIds 10 - 19 and ascending depositDate
const FILLED_DEPOSITS = mockManyDepositEntities(10, {
depositIdStartIndex: 10,
overrides: { status: "filled", depositorAddr: depositorAddress },
overrides: { status: "filled", depositorAddr: depositorAddress, amount: "10", filled: "10" },
});
// pending deposits with depositIds 20 - 29 and ascending depositDate
const PENDING_DEPOSITS = mockManyDepositEntities(10, {
depositIdStartIndex: 20,
overrides: { status: "pending", depositorAddr: depositorAddress },
overrides: { status: "pending", depositorAddr: depositorAddress, amount: "10" },
});

beforeAll(async () => {
Expand Down

0 comments on commit 582eacf

Please sign in to comment.