Skip to content

Commit

Permalink
feat(fast-usdc): update FeedPolicy along with Noble ICA
Browse files Browse the repository at this point in the history
  • Loading branch information
dckc committed Feb 28, 2025
1 parent 7036cb8 commit 0743ad4
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions packages/fast-usdc/src/update-noble-ica.core.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/** @file core-eval to 1) update ChainInfo 2) re-request the Noble ICA `intermediateRecipient` */

import { E } from '@endo/far';
import { makeTracer } from '@agoric/internal';
import { E } from '@endo/far';
import { publishFeedPolicy } from './utils/core-eval.js';
import { feedPolicies } from './utils/chain-policies.js';

const trace = makeTracer('FUSD-2', true);

Expand All @@ -11,7 +13,7 @@ const trace = makeTracer('FUSD-2', true);
* @import {ManifestBundleRef} from '@agoric/deploy-script-support/src/externalTypes.js'
* @import {BootstrapManifest} from '@agoric/vats/src/core/lib-boot.js'
* @import {FastUSDCCorePowers} from './start-fast-usdc.core.js'
* @import {ContractRecord} from './types.js'
* @import {ContractRecord, FeedPolicy} from './types.js'
*/

/**
Expand Down Expand Up @@ -85,6 +87,13 @@ export const updateNobleICA = async (
void E(contractNode)?.setValue(JSON.stringify(addrs));
};

const contractName = 'fastUsdc';

export const updateFeedPolicy = async ({ consume: { chainStorage } }) => {
const storageNode = await E(chainStorage).makeChildNode(contractName);
await publishFeedPolicy(storageNode, feedPolicies.MAINNET);
};

/**
* @param {unknown} _utils
* @param {{
Expand All @@ -102,6 +111,9 @@ export const getManifestForUpdateNobleICA = (
[updateNobleICA.name]: {
consume: { chainStorage: true, fastUsdcKit: true },
},
[updateFeedPolicy.name]: {
consume: { chainStorage: true },
},
},
options: { ...options, fastUsdcCode: installKeys.fastUsdc },
};
Expand Down

0 comments on commit 0743ad4

Please sign in to comment.