Skip to content

Commit

Permalink
fix: set defaults for backstop data
Browse files Browse the repository at this point in the history
  • Loading branch information
mootz12 committed Oct 28, 2024
1 parent a7d55e2 commit 8cb8e11
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 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": "@blend-capital/blend-sdk",
"version": "2.1.0",
"version": "2.1.1",
"description": "Javascript SDK for the Blend Protocol",
"type": "module",
"scripts": {
Expand Down
5 changes: 1 addition & 4 deletions src/backstop/backstop_pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class BackstopPool {

let emission_config: EmissionConfig | undefined;
let emission_data: EmissionData | undefined;
let poolBalance: PoolBalance | undefined;
let poolBalance = new PoolBalance(BigInt(0), BigInt(0), BigInt(0));
let toGulpEmissions = BigInt(0);
for (const entry of backstopPoolDataEntries.entries) {
const ledgerData = entry.val;
Expand All @@ -62,9 +62,6 @@ export class BackstopPool {
}
}

if (poolBalance == undefined) {
throw new Error('Error: Unable to load backstop pool data');
}
let emissions: Emissions | undefined;
if (emission_config != undefined && emission_data != undefined) {
emissions = new Emissions(
Expand Down
6 changes: 2 additions & 4 deletions src/backstop/backstop_user_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class UserBalance {
throw Error('UserBalance contract data value is not a map');
}

let shares: bigint | undefined;
let shares = BigInt(0);
const q4w: Q4W[] = [];
let unlockedQ4W = BigInt(0);
let totalQ4W = BigInt(0);
Expand Down Expand Up @@ -93,9 +93,7 @@ export class UserBalance {
throw Error(`Invalid backstop UserBalance key: should not contain ${key}`);
}
}
if (shares == undefined) {
throw Error("Invalid UserBalance: should contain 'shares'");
}

return new UserBalance(shares, q4w, unlockedQ4W, totalQ4W);
}
}
Expand Down

0 comments on commit 8cb8e11

Please sign in to comment.