Skip to content

Commit

Permalink
fixup! chore: move sim stuff out of inter-protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
dckc committed Mar 6, 2023
1 parent dc48834 commit f7169a0
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 18 deletions.
4 changes: 2 additions & 2 deletions packages/vats/src/core/boot-sim.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
import { SIM_CHAIN_BOOTSTRAP_PERMITS } from '@agoric/inter-protocol/src/proposals/sim-behaviors.js';
import * as simBehaviorsPlus from '@agoric/inter-protocol/src/proposals/sim-behaviors.js';
import { SIM_CHAIN_BOOTSTRAP_PERMITS } from './sim-behaviors.js';
import * as simBehaviorsPlus from './sim-behaviors.js';
import * as basicBehaviorsPlus from './basic-behaviors.js';
import { SHARED_CHAIN_BOOTSTRAP_MANIFEST } from './chain-behaviors.js';
import * as chainBehaviorsPlus from './chain-behaviors.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import {
natSafeMath,
} from '@agoric/zoe/src/contractSupport/index.js';
import { E, Far } from '@endo/far';
import { Stake, Stable } from '@agoric/vats/src/tokens.js';
import { Nat } from '@endo/nat';
import { notForProductionUse } from '@agoric/internal/src/magic-cookie-test-only.js';
import { Stake, Stable } from '../tokens.js';

const { Fail, quote: q } = assert;
const { multiply, floorDivide } = natSafeMath;
Expand Down Expand Up @@ -459,7 +459,7 @@ export const poolRates = (issuerName, record, kits, central) => {
};

/**
* @param { import('./econ-behaviors.js').EconomyBootstrapPowers & {
* @param { import('@agoric/inter-protocol/src/proposals/econ-behaviors.js').EconomyBootstrapPowers & {
* consume: { mints }
* }} powers
*/
5 changes: 2 additions & 3 deletions packages/vats/src/core/sim-behaviors.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { E, Far } from '@endo/far';
import { addRemote } from '@agoric/vats/src/core/utils.js';

import { connectFaucet } from '@agoric/inter-protocol/src/proposals/demoIssuers.js';
import { connectFaucet } from './demoIssuers.js';
import { addRemote } from './utils.js';

export { connectFaucet };

Expand Down
4 changes: 0 additions & 4 deletions packages/vats/src/core/sim-proposal.js

This file was deleted.

7 changes: 2 additions & 5 deletions packages/vats/test/test-clientBundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ import { E, Far } from '@endo/far';
import { makeZoeKit } from '@agoric/zoe';

import { makeIssuerKit } from '@agoric/ertp';
import {
connectFaucet,
showAmount,
} from '@agoric/inter-protocol/src/proposals/demoIssuers.js';
import { makeScalarBigMapStore } from '@agoric/vat-data';
import { connectFaucet, showAmount } from '../src/core/demoIssuers.js';
import { setupClientManager } from '../src/core/chain-behaviors.js';
import { makeAgoricNamesAccess } from '../src/core/utils.js';
import { makePromiseSpace } from '../src/core/promise-space.js';
Expand Down Expand Up @@ -146,7 +143,7 @@ test('connectFaucet produces payments', async t => {

// t.deepEqual(Object.keys(userBundle), '@@todo');

/** @type { import('@agoric/inter-protocol/src/proposals/demoIssuers.js').UserPaymentRecord[] } */
/** @type { import('../src/core/demoIssuers.js').UserPaymentRecord[] } */
const pmts = await E(userBundle.faucet).tapFaucet();

const detail = await Promise.all(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js';
import { AmountMath, makeIssuerKit } from '@agoric/ertp';
import { Stable } from '@agoric/vats/src/tokens.js';
import { Stable } from '../src/tokens.js';

import {
AMMDemoState,
Expand All @@ -12,17 +12,19 @@ import {
showAmount,
showBrand,
splitAllCentralPayments,
} from '../src/proposals/demoIssuers.js';
} from '../src/core/demoIssuers.js';

/** @param { bigint } n */
const showIST = n => `${decimal(n, 6)} IST`;

// TODO: prune showIST formatting utility
test('uist -> IST formatting test utility', t => {
t.is(showIST(123456789n), '123.456789 IST', 'IST decimal point');
t.is(showIST(1234567890n), '1_234.56789 IST', 'thousands separators');
t.is(showIST(3286010000000000n), '3_286_010_000 IST', 'regression 1');
});

// TODO: prune splitAllCentralPayments AMM utility?
test('splitAllCentralPayments: count entries, spot check', async t => {
const central = makeIssuerKit(
Stable.symbol,
Expand Down

0 comments on commit f7169a0

Please sign in to comment.