Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(fast-usdc): beta oracle addresses #10996

Merged
merged 4 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions multichain-testing/test/fast-usdc/fast-usdc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { commonSetup } from '../support.js';
import { makeFeedPolicyPartial, oracleMnemonics } from './config.js';
import { agoricNamesQ, fastLPQ, makeTxOracle } from './fu-actors.js';
import { sleep } from '@agoric/client-utils';
import type { Denom, DenomDetail } from '@agoric/orchestration';

const { RELAYER_TYPE } = process.env;

Expand All @@ -39,6 +40,16 @@ const LP_DEPOSIT_AMOUNT = 8_000n * 10n ** 6n;

type QueryClient = ReturnType<typeof makeQueryClient>;

const fuAssetInfo = (assetInfo: string): string => {
const denomPairs: [Denom, DenomDetail][] = JSON.parse(assetInfo);
const matchingPair = denomPairs.find(
([_, detail]) =>
detail.chainName === 'agoric' && detail.baseDenom === 'uusdc',
);
if (!matchingPair) throw Error('no uusdc on agoric in common assetInfo');
return JSON.stringify([matchingPair]);
};

const makeTestContext = async (t: ExecutionContext) => {
const { setupTestKeys, ...common } = await commonSetup(t, {
config: `../config.fusdc${RELAYER_TYPE ? '.' + RELAYER_TYPE : ''}.yaml`,
Expand Down Expand Up @@ -79,6 +90,7 @@ const makeTestContext = async (t: ExecutionContext) => {
usdcDenom,
feedPolicy: JSON.stringify(makeFeedPolicyPartial(nobleAgoricChannelId)),
...commonBuilderOpts,
assetInfo: fuAssetInfo(commonBuilderOpts.assetInfo),
});

// provide faucet funds for LPs
Expand Down
31 changes: 14 additions & 17 deletions packages/boot/test/fast-usdc/fast-usdc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ const test: TestFn<
}
> = anyTest;

// oracles, which were started with MAINNET config
const theConfig = configurations.MAINNET;
const { oracles: oracleRecord } = theConfig;
const oracleAddrs = Object.values(oracleRecord);

const {
SLOGFILE: slogFile,
SWINGSET_WORKER_TYPE: defaultManagerType = 'local',
Expand Down Expand Up @@ -70,9 +75,8 @@ test.serial(
walletFactoryDriver: wfd,
} = t.context;

const { oracles } = configurations.MAINNET;
const [watcherWallet] = await Promise.all(
Object.values(oracles).map(addr => wfd.provideSmartWallet(addr)),
oracleAddrs.map(addr => wfd.provideSmartWallet(addr)),
);

// inbound `startChannelOpenInit` responses immediately.
Expand Down Expand Up @@ -254,11 +258,9 @@ test.serial('makes usdc advance', async t => {
harness,
runUtils: { EV },
} = t.context;
const oracles = await Promise.all([
wfd.provideSmartWallet('agoric19uscwxdac6cf6z7d5e26e0jm0lgwstc47cpll8'),
wfd.provideSmartWallet('agoric1krunjcqfrf7la48zrvdfeeqtls5r00ep68mzkr'),
wfd.provideSmartWallet('agoric1n4fcxsnkxe4gj6e24naec99hzmc4pjfdccy5nj'),
]);
const oracles = await Promise.all(
oracleAddrs.map(addr => wfd.provideSmartWallet(addr)),
);
await Promise.all(
oracles.map(wallet =>
wallet.sendOffer({
Expand Down Expand Up @@ -405,11 +407,9 @@ test.serial('distributes fees per BLD staker decision', async t => {

test.serial('skips usdc advance when risks identified', async t => {
const { walletFactoryDriver: wfd, storage } = t.context;
const oracles = await Promise.all([
wfd.provideSmartWallet('agoric19uscwxdac6cf6z7d5e26e0jm0lgwstc47cpll8'),
wfd.provideSmartWallet('agoric1krunjcqfrf7la48zrvdfeeqtls5r00ep68mzkr'),
wfd.provideSmartWallet('agoric1n4fcxsnkxe4gj6e24naec99hzmc4pjfdccy5nj'),
]);
const oracles = await Promise.all(
oracleAddrs.map(addr => wfd.provideSmartWallet(addr)),
);

const EUD = 'dydx1riskyeud';
const lastNodeValue = storage.getValues('published.fastUsdc').at(-1);
Expand Down Expand Up @@ -570,16 +570,13 @@ test.serial('replace operators', async t => {

// Remove old oracle operators (nested in block to isolate bindings)
{
// old oracles, which were started with MAINNET config
const { oracles } = configurations.MAINNET;

for (const [name, address] of Object.entries(oracles)) {
for (const [name, address] of Object.entries(oracleRecord)) {
t.log('Removing operator', name, 'at', address);
await EV(creatorFacet).removeOperator(address);
}

const wallets = await Promise.all(
Object.values(oracles).map(addr => wfd.provideSmartWallet(addr)),
oracleAddrs.map(addr => wfd.provideSmartWallet(addr)),
);

await Promise.all(
Expand Down
62 changes: 23 additions & 39 deletions packages/fast-usdc/src/utils/deploy-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,23 @@ import { ChainPolicies } from './chain-policies.js';
* @import {CosmosChainInfo, Denom, DenomDetail} from '@agoric/orchestration';
*/

/** @type {[Denom, DenomDetail & { brandKey?: string}][]} */
export const defaultAssetInfo = [
[
'uusdc',
{
baseName: 'noble',
chainName: 'noble',
baseDenom: 'uusdc',
},
],
[
`ibc/${denomHash({ denom: 'uusdc', channelId: fetchedChainInfo.agoric.connections['noble-1'].transferChannel.channelId })}`,
{
baseName: 'noble',
chainName: 'agoric',
baseDenom: 'uusdc',
brandKey: 'USDC',
},
],
[
`ibc/${denomHash({ denom: 'uusdc', channelId: fetchedChainInfo.osmosis.connections['noble-1'].transferChannel.channelId })}`,
{
baseName: 'noble',
chainName: 'osmosis',
baseDenom: 'uusdc',
},
],
/** @type {[Denom, DenomDetail & { brandKey?: string}]} */
const usdcOnAgoric = [
`ibc/${denomHash({ denom: 'uusdc', channelId: fetchedChainInfo.agoric.connections['noble-1'].transferChannel.channelId })}`,
{
baseName: 'noble',
chainName: 'agoric',
baseDenom: 'uusdc',
brandKey: 'USDC',
},
];
harden(defaultAssetInfo);

const agoricAssetInfo = defaultAssetInfo.filter(
([_d, i]) => i.chainName === 'agoric',
);
/** @type {[Denom, DenomDetail & { brandKey?: string}][]} */
export const transferAssetInfo = [
['uusdc', { baseName: 'noble', chainName: 'noble', baseDenom: 'uusdc' }],
usdcOnAgoric,
];
harden(transferAssetInfo);

/** ABI for DepositForBurn event in TokenMessenger contract */
const DepositForBurnEvent =
Expand All @@ -49,7 +33,6 @@ const DepositForBurnEvent =
/**
* @type {Record<string, Pick<FastUSDCConfig, 'oracles' | 'feedPolicy' | 'chainInfo' | 'assetInfo' >>}
*
* TODO: determine OCW operator addresses
* meanwhile, use price oracle addresses (from updatePriceFeeds.js).
*/
export const configurations = {
Expand Down Expand Up @@ -77,13 +60,14 @@ export const configurations = {
noble: fetchedChainInfo.noble,
})
),
assetInfo: agoricAssetInfo,
assetInfo: [usdcOnAgoric],
},
MAINNET: {
// per JVC 12 Feb 2025
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confirmed

oracles: {
'01node': 'agoric19uscwxdac6cf6z7d5e26e0jm0lgwstc47cpll8',
'Simply Staking': 'agoric1krunjcqfrf7la48zrvdfeeqtls5r00ep68mzkr',
P2P: 'agoric1n4fcxsnkxe4gj6e24naec99hzmc4pjfdccy5nj',
'01node': 'agoric1ym488t6j24x3ys3va3452ftx44lhs64rz8pu7h',
SimplyStaking: 'agoric1s5yawjgj6xcw4ea5r2x4cjrnkprmd0fcun2tyk',
DSRV: 'agoric17crpkfxarq658e9ddru2petrfr0fhjzvjfccq9',
},
feedPolicy: {
nobleAgoricChannelId: 'channel-21',
Expand All @@ -94,7 +78,7 @@ export const configurations = {
chainInfo: /** @type {Record<string, CosmosChainInfo & Passable>} */ (
withChainCapabilities(fetchedChainInfo)
),
assetInfo: defaultAssetInfo,
assetInfo: transferAssetInfo,
},
DEVNET: {
oracles: {
Expand All @@ -113,7 +97,7 @@ export const configurations = {
chainInfo: /** @type {Record<string, CosmosChainInfo & Passable>} */ (
withChainCapabilities(fetchedChainInfo) // TODO: use devnet values
),
assetInfo: defaultAssetInfo, // TODO: use emerynet values
assetInfo: transferAssetInfo,
},
EMERYNET: {
oracles: {
Expand All @@ -129,7 +113,7 @@ export const configurations = {
chainInfo: /** @type {Record<string, CosmosChainInfo & Passable>} */ (
withChainCapabilities(fetchedChainInfo) // TODO: use emerynet values
),
assetInfo: defaultAssetInfo, // TODO: use emerynet values
assetInfo: transferAssetInfo,
},
};
harden(configurations);
Expand Down
Loading