Skip to content

Commit

Permalink
Merge pull request #7169 from Agoric/dc-token-slim
Browse files Browse the repository at this point in the history
chore: avoid some unnecessary bundling in vaultFactory etc.
  • Loading branch information
mergify[bot] authored Mar 15, 2023
2 parents 278a284 + 6e9cf19 commit efcd1c3
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 13 deletions.
2 changes: 0 additions & 2 deletions packages/governance/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,3 @@ export {
} from './validators.js';

export { ParamTypes } from './constants.js';

export { makeBinaryVoteCounter } from './binaryVoteCounter.js';
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import {

import { makeMockChainStorageRoot } from '@agoric/internal/src/storage-test-utils.js';
import {
makeBinaryVoteCounter,
ChoiceMethod,
ElectionType,
QuorumRule,
coerceQuestionSpec,
makeParamChangePositions,
} from '../../src/index.js';
import { makeBinaryVoteCounter } from '../../src/binaryVoteCounter.js';

const SIMPLE_ISSUE = harden({ text: 'Fish or cut bait?' });
const FISH = harden({ text: 'Fish' });
Expand Down
22 changes: 12 additions & 10 deletions packages/vats/src/tokens.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
// @ts-check

import { AssetKind } from '@agoric/ertp';
import { assertKeywordName } from '@agoric/zoe/src/cleanProposal.js';

/** @typedef { 'IST' | 'BLD' } TokenKeyword */

/**
* Use static type check and unit tests rather than runtime import
* to avoid bundling all of ERTP just to get Stable.symbol.
*
* @type {typeof import('@agoric/ertp').AssetKind.NAT}
*/
const NAT = 'nat';

export const Stable = harden(
/** @type {const } */ ({
symbol: 'IST',
denom: 'uist',
proposedName: 'Agoric stable local currency',
assetKind: AssetKind.NAT,
assetKind: NAT,
displayInfo: {
decimalPlaces: 6,
assetKind: AssetKind.NAT,
assetKind: NAT,
},
}),
);
Expand All @@ -23,13 +28,10 @@ export const Stake = harden(
symbol: 'BLD',
denom: 'ubld',
proposedName: 'Agoric staking token',
assetKind: AssetKind.NAT,
assetKind: NAT,
displayInfo: {
decimalPlaces: 6,
assetKind: AssetKind.NAT,
assetKind: NAT,
},
}),
);

assertKeywordName(Stable.symbol);
assertKeywordName(Stake.symbol);
18 changes: 18 additions & 0 deletions packages/vats/test/test-tokens.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// @ts-check
import '@endo/init';
import test from 'ava';

import { assertKeywordName } from '@agoric/zoe/src/cleanProposal.js';

import { AssetKind } from '@agoric/ertp';
import { Stable, Stake } from '../src/tokens.js';

test('token symbols are keywords', t => {
t.notThrows(() => assertKeywordName(Stable.symbol));
t.notThrows(() => assertKeywordName(Stake.symbol));
});

test('token assetKind matches ERTP', t => {
t.is(Stable.assetKind, AssetKind.NAT);
t.is(Stake.assetKind, AssetKind.NAT);
});

0 comments on commit efcd1c3

Please sign in to comment.