Skip to content

Commit bf7b154

Browse files
committed
test: fastUsdc vstorage coverage
- include `poolMetrics` and account addresses
1 parent a5f0d4b commit bf7b154

File tree

3 files changed

+115
-1
lines changed

3 files changed

+115
-1
lines changed

packages/boot/test/fast-usdc/fast-usdc.test.ts

+28-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,34 @@ test.serial('writes fee config to vstorage', async t => {
160160
await documentStorageSchema(t, storage, doc);
161161
});
162162

163-
test.serial('makes usdc advance', async t => {
163+
test.serial('writes pool metrics to vstorage', async t => {
164+
const { storage } = t.context;
165+
const doc = {
166+
node: 'fastUsdc.poolMetrics',
167+
owner: 'FastUSC LiquidityPool exo',
168+
showValue: v => defaultMarshaller.fromCapData(JSON.parse(v)),
169+
};
170+
await documentStorageSchema(t, storage, doc);
171+
});
172+
173+
test.serial('writes account addresses to vstorage', async t => {
174+
const { storage } = t.context;
175+
const doc = {
176+
node: 'fastUsdc',
177+
showValue: JSON.parse,
178+
pattern: /published\.fastUsdc\.(feeConfig|feedPolicy|poolMetrics)/,
179+
replacement: '',
180+
note: `Under "published", the "fastUsdc" node is delegated to FastUSDC contract.
181+
Note: published.fastUsdc.[settleAcctAddr], published.fastUsdc.[poolAcctAddr],
182+
and published.fastUsdc.[intermediateAcctAddr] are published by @agoric/orchestration
183+
via 'withOrchestration' and (local|cosmos)-orch-account-kit.js.
184+
`,
185+
};
186+
187+
await documentStorageSchema(t, storage, doc);
188+
});
189+
190+
test.skip('makes usdc advance', async t => {
164191
const {
165192
walletFactoryDriver: wd,
166193
storage,

packages/boot/test/fast-usdc/snapshots/fast-usdc.test.ts.md

+87
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,93 @@ Generated by [AVA](https://avajs.dev).
7272
],
7373
]
7474

75+
## writes pool metrics to vstorage
76+
77+
> Under "published", the "fastUsdc.poolMetrics" node is delegated to FastUSC LiquidityPool exo.
78+
> The example below illustrates the schema of the data published there.
79+
>
80+
> See also board marshalling conventions (_to appear_).
81+
82+
[
83+
[
84+
'published.fastUsdc.poolMetrics',
85+
{
86+
encumberedBalance: {
87+
brand: Object @Alleged: USDC brand {},
88+
value: 0n,
89+
},
90+
shareWorth: {
91+
denominator: {
92+
brand: Object @Alleged: PoolShares brand {},
93+
value: 1n,
94+
},
95+
numerator: {
96+
brand: Object @Alleged: USDC brand {},
97+
value: 1n,
98+
},
99+
},
100+
totalBorrows: {
101+
brand: Object @Alleged: USDC brand {},
102+
value: 0n,
103+
},
104+
totalContractFees: {
105+
brand: Object @Alleged: USDC brand {},
106+
value: 0n,
107+
},
108+
totalPoolFees: {
109+
brand: Object @Alleged: USDC brand {},
110+
value: 0n,
111+
},
112+
totalRepays: {
113+
brand: Object @Alleged: USDC brand {},
114+
value: 0n,
115+
},
116+
},
117+
],
118+
]
119+
120+
## writes account addresses to vstorage
121+
122+
> Under "published", the "fastUsdc" node is delegated to FastUSDC contract.
123+
> Note: published.fastUsdc.[settleAcctAddr], published.fastUsdc.[poolAcctAddr],
124+
> and published.fastUsdc.[intermediateAcctAddr] are published by @agoric/orchestration
125+
> via 'withOrchestration' and (local|cosmos)-orch-account-kit.js.
126+
>
127+
> The example below illustrates the schema of the data published there.
128+
>
129+
> See also board marshalling conventions (_to appear_).
130+
131+
[
132+
[
133+
'published.fastUsdc',
134+
{
135+
poolAccount: 'agoric1fakeLCAAddress',
136+
settlementAccount: 'agoric1fakeLCAAddress1',
137+
},
138+
],
139+
[
140+
'published.fastUsdc.agoric1fakeLCAAddress',
141+
{
142+
body: '#""',
143+
slots: [],
144+
},
145+
],
146+
[
147+
'published.fastUsdc.agoric1fakeLCAAddress1',
148+
{
149+
body: '#""',
150+
slots: [],
151+
},
152+
],
153+
[
154+
'published.fastUsdc.noble1test',
155+
{
156+
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"}',
157+
slots: [],
158+
},
159+
],
160+
]
161+
75162
## makes usdc advance
76163

77164
> Under "published", the "fastUsdc.status" node is delegated to the statuses of fast USDC transfers identified by their tx hashes.
Binary file not shown.

0 commit comments

Comments
 (0)