Skip to content

Commit

Permalink
refactor: reuse agoricNamesQ, fastLQP
Browse files Browse the repository at this point in the history
  • Loading branch information
dckc committed Jan 22, 2025
1 parent 7917e05 commit 2c79e74
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions multichain-testing/scripts/fast-usdc-tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import type { ExecutionContext } from 'ava';
import { encodeAddressHook } from '@agoric/cosmic-proto/address-hooks.js';
import { AmountMath, type Brand } from '@agoric/ertp';
import type { USDCProposalShapes } from '@agoric/fast-usdc/src/pool-share-math.js';
import type { PoolMetrics } from '@agoric/fast-usdc/src/types.js';
import { divideBy } from '@agoric/zoe/src/contractSupport/ratio.js';
import { makeDenomTools } from '../tools/asset-info.js';
import { makeDoOffer } from '../tools/e2e-tools.js';
Expand All @@ -17,6 +16,7 @@ import {
makeFeedPolicyPartial,
oracleMnemonics,
} from '../test/fast-usdc/config.js';
import { agoricNamesQ, fastLPQ } from '../test/fast-usdc/fu-actors.js';

const USAGE = `
Usage:
Expand Down Expand Up @@ -55,27 +55,6 @@ const runT = {
},
} as ExecutionContext;

// from ../test/fast-usdc/fast-usdc.test.ts
type VStorageClient = Awaited<ReturnType<typeof commonSetup>>['vstorageClient'];
const agoricNamesQ = (vsc: VStorageClient) =>
harden({
brands: <K extends AssetKind>(_assetKind: K) =>
vsc
.queryData('published.agoricNames.brand')
.then(pairs => Object.fromEntries(pairs) as Record<string, Brand<K>>),
});

const fastLPQ = (vsc: VStorageClient) =>
harden({
metrics: () =>
vsc.queryData(`published.fastUsdc.poolMetrics`) as Promise<PoolMetrics>,
info: () =>
vsc.queryData(`published.${contractName}`) as Promise<{
poolAccount: string;
settlementAccount: string;
}>,
});

const parseCommandLine = () => {
const { values, positionals } = parseArgs({
options: {
Expand Down

0 comments on commit 2c79e74

Please sign in to comment.