Skip to content

Commit

Permalink
chore: more non-bigInts caught by typescript enforcement
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris-Hibbert committed Aug 20, 2021
1 parent 4903bff commit 5a72361
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
12 changes: 6 additions & 6 deletions packages/treasury/test/swingsetTests/vat-owner.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { AmountMath } from '@agoric/ertp';

const SECONDS_PER_HOUR = 60n * 60n;
const SECONDS_PER_DAY = 24n * SECONDS_PER_HOUR;
const BASIS_POINTS = 10000;
const BASIS_POINTS = 10000n;

// Treasury owner

Expand Down Expand Up @@ -55,11 +55,11 @@ const build = async (
} = await E(zoe).getTerms(instance);

const rates = {
initialPrice: makeRatio(10000, runBrand, 5, moolaBrand),
initialMargin: makeRatio(120, runBrand),
liquidationMargin: makeRatio(105, runBrand),
interestRate: makeRatio(250, runBrand, BASIS_POINTS),
loanFee: makeRatio(200, runBrand, BASIS_POINTS),
initialPrice: makeRatio(10000n, runBrand, 5n, moolaBrand),
initialMargin: makeRatio(120n, runBrand),
liquidationMargin: makeRatio(105n, runBrand),
interestRate: makeRatio(250n, runBrand, BASIS_POINTS),
loanFee: makeRatio(200n, runBrand, BASIS_POINTS),
};

const addTypeInvitation = await E(creatorFacet).makeAddTypeInvitation(
Expand Down
24 changes: 12 additions & 12 deletions packages/treasury/test/test-interest.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ test('too soon', async t => {

test('basic charge 1 period', async t => {
const { brand } = makeIssuerKit('ducats');
const annualRate = makeRatio(250, brand, BASIS_POINTS);
const annualRate = makeRatio(250n, brand, BASIS_POINTS);
const calculator = makeInterestCalculator(
brand,
annualRate,
Expand All @@ -59,7 +59,7 @@ test('basic charge 1 period', async t => {

test('basic 2 charge periods', async t => {
const { brand } = makeIssuerKit('ducats');
const annualRate = makeRatio(250, brand, BASIS_POINTS);
const annualRate = makeRatio(250n, brand, BASIS_POINTS);
const calculator = makeInterestCalculator(
brand,
annualRate,
Expand All @@ -82,7 +82,7 @@ test('basic 2 charge periods', async t => {

test('partial periods', async t => {
const { brand } = makeIssuerKit('ducats');
const annualRate = makeRatio(250, brand, BASIS_POINTS);
const annualRate = makeRatio(250n, brand, BASIS_POINTS);
const calculator = makeInterestCalculator(
brand,
annualRate,
Expand All @@ -104,7 +104,7 @@ test('partial periods', async t => {

test('reportingPeriod: partial', async t => {
const { brand } = makeIssuerKit('ducats');
const annualRate = makeRatio(250, brand, BASIS_POINTS);
const annualRate = makeRatio(250n, brand, BASIS_POINTS);
const calculator = makeInterestCalculator(
brand,
annualRate,
Expand Down Expand Up @@ -136,7 +136,7 @@ test('reportingPeriod: partial', async t => {

test('reportingPeriod: longer', async t => {
const { brand } = makeIssuerKit('ducats');
const annualRate = makeRatio(250, brand, BASIS_POINTS);
const annualRate = makeRatio(250n, brand, BASIS_POINTS);
const calculator = makeInterestCalculator(
brand,
annualRate,
Expand All @@ -162,7 +162,7 @@ test('reportingPeriod: longer', async t => {

test('start charging later', async t => {
const { brand } = makeIssuerKit('ducats');
const annualRate = makeRatio(250, brand, BASIS_POINTS);
const annualRate = makeRatio(250n, brand, BASIS_POINTS);
const calculator = makeInterestCalculator(
brand,
annualRate,
Expand Down Expand Up @@ -190,7 +190,7 @@ test('start charging later', async t => {

test('simple compounding', async t => {
const { brand } = makeIssuerKit('ducats');
const annualRate = makeRatio(250, brand, BASIS_POINTS);
const annualRate = makeRatio(250n, brand, BASIS_POINTS);
const calculator = makeInterestCalculator(
brand,
annualRate,
Expand All @@ -216,7 +216,7 @@ test('simple compounding', async t => {

test('reportingPeriod shorter than charging', async t => {
const { brand } = makeIssuerKit('ducats');
const annualRate = makeRatio(250, brand, BASIS_POINTS);
const annualRate = makeRatio(250n, brand, BASIS_POINTS);
const calculator = makeInterestCalculator(
brand,
annualRate,
Expand Down Expand Up @@ -269,7 +269,7 @@ test('reportingPeriod shorter than charging', async t => {

test('reportingPeriod shorter than charging; start day boundary', async t => {
const { brand } = makeIssuerKit('ducats');
const annualRate = makeRatio(250, brand, BASIS_POINTS);
const annualRate = makeRatio(250n, brand, BASIS_POINTS);
const calculator = makeInterestCalculator(
brand,
annualRate,
Expand Down Expand Up @@ -307,7 +307,7 @@ test('reportingPeriod shorter than charging; start day boundary', async t => {

test('reportingPeriod shorter than charging; start not even days', async t => {
const { brand } = makeIssuerKit('ducats');
const annualRate = makeRatio(250, brand, BASIS_POINTS);
const annualRate = makeRatio(250n, brand, BASIS_POINTS);
const calculator = makeInterestCalculator(
brand,
annualRate,
Expand Down Expand Up @@ -340,7 +340,7 @@ test('reportingPeriod shorter than charging; start not even days', async t => {
// 2.5 % APR charged daily, large enough loan to display compounding
test.only('basic charge large numbers, compounding', async t => {
const { brand } = makeIssuerKit('ducats');
const annualRate = makeRatio(250, brand, BASIS_POINTS);
const annualRate = makeRatio(250n, brand, BASIS_POINTS);
// Unix epoch time: Tuesday April 6th 2021 at 11:45am PT
const START_TIME = 1617734746n;
const calculator = makeInterestCalculator(
Expand Down Expand Up @@ -392,7 +392,7 @@ test.only('basic charge large numbers, compounding', async t => {
// charge at reporting period intervals
test('basic charge reasonable numbers monthly', async t => {
const { brand } = makeIssuerKit('ducats');
const annualRate = makeRatio(250, brand, BASIS_POINTS);
const annualRate = makeRatio(250n, brand, BASIS_POINTS);
// Unix epoch time: Tuesday April 6th 2021 at 11:45am PT
const START_TIME = 1617734746n;
const calculator = makeInterestCalculator(
Expand Down
2 changes: 1 addition & 1 deletion packages/treasury/test/test-vault-interest.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ test('interest', async t => {
);
const { value: v2, updateCount: c2 } = await E(notifier).getUpdateSince(c1);
t.deepEqual(v2.debt, AmountMath.make(73500n + 63n, runBrand));
t.deepEqual(v2.interestRate, makeRatio(5, runBrand, 100n));
t.deepEqual(v2.interestRate, makeRatio(5n, runBrand, 100n));
t.deepEqual(v2.liquidationRatio, makeRatio(105n, runBrand));
const collateralization = v2.collateralizationRatio;
t.truthy(
Expand Down

0 comments on commit 5a72361

Please sign in to comment.