Skip to content

Commit

Permalink
add BigNumber comment; reduce scale of negative comet base balance test
Browse files Browse the repository at this point in the history
  • Loading branch information
scott-silver committed Apr 22, 2022
1 parent dbc3021 commit 209e42c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion scenario/ConstraintScenario.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ scenario(
expectApproximately(
await albert.getCometBaseBalance(),
-100n * scale,
(scale / 1000n) // .001 units of asset
(scale / 1000000n) // .000001 units of asset
);
}
);
Expand Down
2 changes: 2 additions & 0 deletions scenario/constraints/CometBalanceConstraint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ export class CometBalanceConstraint<T extends CometContext, R extends Requiremen
const amount = parseAmount(rawAmount);
const decimals = await asset.token.decimals();
const baseToken = await comet.baseToken();
// Chai matchers (like `.to.be.at.most()`) only work for numbers and
// BigNumbers, so we convert from BigInt to BigNumber
let actualBalance: BigNumber;
let expectedBalance: BigNumber;
if (asset.address === baseToken) {
Expand Down

0 comments on commit 209e42c

Please sign in to comment.