Skip to content

Commit

Permalink
fix dust deposits
Browse files Browse the repository at this point in the history
  • Loading branch information
0xodia committed Jan 6, 2025
1 parent 0819392 commit 723d82a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion solend-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@solendprotocol/solend-sdk",
"version": "0.13.33",
"version": "0.13.35",
"private": true,
"main": "src/index.ts",
"module": "src/index.ts",
Expand Down
10 changes: 10 additions & 0 deletions solend-sdk/src/core/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1403,6 +1403,16 @@ export class SolendActionCore {
this.borrowReserves,
this.programId
);

this.depositReserves = this.depositReserves.filter((reserve) => {
const deposit = this.obligationAccountInfo?.deposits.find((d) => d.depositReserve.toBase58() === reserve.toBase58());
return deposit?.depositedAmount.gt(new BN(0));
});
this.borrowReserves = this.borrowReserves.filter((reserve) => {
const borrow = this.obligationAccountInfo?.borrows.find((b) => b.borrowReserve.toBase58() === reserve.toBase58());
return borrow?.borrowedAmountWads.gt(new BN(0));
});

if (this.debug) console.log("adding refresh obligation ix to setup txn");
this.setupIxs.push(refreshObligationIx);
}
Expand Down

0 comments on commit 723d82a

Please sign in to comment.