Skip to content

Commit

Permalink
test: fastUsdc vstorage coverage
Browse files Browse the repository at this point in the history
- include `poolMetrics` and account addresses
  • Loading branch information
0xpatrickdev committed Dec 10, 2024
1 parent 85bd610 commit a60028f
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 1 deletion.
29 changes: 28 additions & 1 deletion packages/boot/test/fast-usdc/fast-usdc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,34 @@ test.serial('writes fee config to vstorage', async t => {
await documentStorageSchema(t, storage, doc);
});

test.serial('makes usdc advance', async t => {
test.serial('writes pool metrics to vstorage', async t => {
const { storage } = t.context;
const doc = {
node: 'fastUsdc.poolMetrics',
owner: 'FastUSC LiquidityPool exo',
showValue: v => defaultMarshaller.fromCapData(JSON.parse(v)),
};
await documentStorageSchema(t, storage, doc);
});

test.serial('writes account addresses to vstorage', async t => {
const { storage } = t.context;
const doc = {
node: 'fastUsdc',
showValue: JSON.parse,
pattern: /published\.fastUsdc\.(feeConfig|feedPolicy|poolMetrics)/,
replacement: '',
note: `Under "published", the "fastUsdc" node is delegated to FastUSDC contract.
Note: published.fastUsdc.[settleAcctAddr], published.fastUsdc.[poolAcctAddr],
and published.fastUsdc.[intermediateAcctAddr] are published by @agoric/orchestration
via 'withOrchestration' and (local|cosmos)-orch-account-kit.js.
`,
};

await documentStorageSchema(t, storage, doc);
});

test.skip('makes usdc advance', async t => {
const {
walletFactoryDriver: wd,
storage,
Expand Down
87 changes: 87 additions & 0 deletions packages/boot/test/fast-usdc/snapshots/fast-usdc.test.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,93 @@ Generated by [AVA](https://avajs.dev).
],
]

## writes pool metrics to vstorage

> Under "published", the "fastUsdc.poolMetrics" node is delegated to FastUSC LiquidityPool exo.
> The example below illustrates the schema of the data published there.
>
> See also board marshalling conventions (_to appear_).
[
[
'published.fastUsdc.poolMetrics',
{
encumberedBalance: {
brand: Object @Alleged: USDC brand {},
value: 0n,
},
shareWorth: {
denominator: {
brand: Object @Alleged: PoolShares brand {},
value: 1n,
},
numerator: {
brand: Object @Alleged: USDC brand {},
value: 1n,
},
},
totalBorrows: {
brand: Object @Alleged: USDC brand {},
value: 0n,
},
totalContractFees: {
brand: Object @Alleged: USDC brand {},
value: 0n,
},
totalPoolFees: {
brand: Object @Alleged: USDC brand {},
value: 0n,
},
totalRepays: {
brand: Object @Alleged: USDC brand {},
value: 0n,
},
},
],
]

## writes account addresses to vstorage

> Under "published", the "fastUsdc" node is delegated to FastUSDC contract.
> Note: published.fastUsdc.[settleAcctAddr], published.fastUsdc.[poolAcctAddr],
> and published.fastUsdc.[intermediateAcctAddr] are published by @agoric/orchestration
> via 'withOrchestration' and (local|cosmos)-orch-account-kit.js.
>
> The example below illustrates the schema of the data published there.
>
> See also board marshalling conventions (_to appear_).
[
[
'published.fastUsdc',
{
poolAccount: 'agoric1fakeLCAAddress',
settlementAccount: 'agoric1fakeLCAAddress1',
},
],
[
'published.fastUsdc.agoric1fakeLCAAddress',
{
body: '#""',
slots: [],
},
],
[
'published.fastUsdc.agoric1fakeLCAAddress1',
{
body: '#""',
slots: [],
},
],
[
'published.fastUsdc.noble1test',
{
body: '#{"localAddress":"/ibc-port/icacontroller-1/ordered/{\\"version\\":\\"ics27-1\\",\\"controllerConnectionId\\":\\"connection-72\\",\\"hostConnectionId\\":\\"connection-40\\",\\"address\\":\\"noble1test\\",\\"encoding\\":\\"proto3\\",\\"txType\\":\\"sdk_multi_msg\\"}/ibc-channel/channel-1","remoteAddress":"/ibc-hop/connection-72/ibc-port/icahost/ordered/{\\"version\\":\\"ics27-1\\",\\"controllerConnectionId\\":\\"connection-72\\",\\"hostConnectionId\\":\\"connection-40\\",\\"address\\":\\"noble1test\\",\\"encoding\\":\\"proto3\\",\\"txType\\":\\"sdk_multi_msg\\"}/ibc-channel/channel-1"}',
slots: [],
},
],
]

## makes usdc advance

> Under "published", the "fastUsdc.status" node is delegated to the statuses of fast USDC transfers identified by their tx hashes.
Expand Down
Binary file modified packages/boot/test/fast-usdc/snapshots/fast-usdc.test.ts.snap
Binary file not shown.

0 comments on commit a60028f

Please sign in to comment.