Skip to content

Commit

Permalink
chore(fast-usdc): beta oracle addresses (#10996)
Browse files Browse the repository at this point in the history
refs: #10978

## Description

Update OCW addrs

assetInfo need not vary across configurations, so no more "default".

### Security Considerations

Production key management considerations apply.

### Scaling Considerations

n/a

### Documentation Considerations

The addresses of the operators are perhaps worth sharing in the [community governance thread](https://community.agoric.com/t/fast-usdc-accelerating-cross-chain-usdc-transfers-on-agoric/754).

### Testing Considerations

DRY out referenced to old oracle addrs in a test.

### Upgrade Considerations

not yet deployed
  • Loading branch information
mergify[bot] authored Feb 13, 2025
2 parents eb8538b + 07c49fd commit 0303d15
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 56 deletions.
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
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

0 comments on commit 0303d15

Please sign in to comment.