Skip to content

Commit

Permalink
test(boot): core-eval to change fastUsdc.feedPolicy
Browse files Browse the repository at this point in the history
  • Loading branch information
dckc committed Dec 3, 2024
1 parent 043a7fd commit ae18411
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions packages/boot/test/fast-usdc/fast-usdc.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { test as anyTest } from '@agoric/zoe/tools/prepare-test-env-ava.js';

import type { CctpTxEvidence } from '@agoric/fast-usdc/src/types.js';
import { configurations } from '@agoric/fast-usdc/src/utils/deploy-config.js';

Check failure on line 4 in packages/boot/test/fast-usdc/fast-usdc.test.ts

View workflow job for this annotation

GitHub Actions / lint-primary

'@agoric/fast-usdc' should be listed in the project's dependencies. Run 'npm i -S @agoric/fast-usdc' to add it
import { MockCctpTxEvidences } from '@agoric/fast-usdc/test/fixtures.js';
import { documentStorageSchema } from '@agoric/governance/tools/storageDoc.js';
import { unmarshalFromVstorage } from '@agoric/internal/src/marshal.js';
Expand Down Expand Up @@ -156,6 +157,33 @@ test.serial('writes status updates to vstorage', async t => {
await documentStorageSchema(t, storage, doc);
});

test.serial('core-eval to change feedPolicy', async t => {
const { buildProposal, evalProposal, storage } = t.context;

const { feedPolicy } = configurations.MAINNET;
const arbitrum3 = harden({
// @ts-expect-error FeedPolicy & Passable is not recognized as an object type?!
...feedPolicy,
chainPolicies: {
...feedPolicy.chainPolicies,
Arbitrum: { ...feedPolicy.chainPolicies.Arbitrum, confirmations: 3 },
},
});
const materials = buildProposal(
'@agoric/builders/scripts/fast-usdc/init-fast-usdc.js',
['--update', '--feedPolicy', JSON.stringify(arbitrum3)],
);
await evalProposal(materials);

const raw = storage.data.get('published.fastUsdc.feedPolicy');

const getLast = (/** @type {string} */ cell) =>
JSON.parse(cell).values.at(-1) || assert.fail();
const actual = JSON.parse(getLast(raw));
t.log('updated', actual.chainPolicies);
t.like(actual, { chainPolicies: { Arbitrum: { confirmations: 3 } } });
});

test.serial('restart contract', async t => {
const { EV } = t.context.runUtils;
await null;
Expand Down

0 comments on commit ae18411

Please sign in to comment.