-
Notifications
You must be signed in to change notification settings - Fork 214
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
feat: add FastLP to vbank #10709
feat: add FastLP to vbank #10709
Changes from all commits
ae1963e
b7aa5f0
2ba4a95
26d3b0f
3815e4c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,13 +92,22 @@ test.serial( | |
refreshAgoricNamesRemotes(); | ||
t.truthy(agoricNamesRemotes.instance.fastUsdc); | ||
t.truthy(agoricNamesRemotes.brand.FastLP); | ||
const lpAsset = agoricNamesRemotes.vbankAsset.FastLP; | ||
t.like(lpAsset, { | ||
issuerName: 'FastLP', | ||
denom: 'ufastlp', | ||
displayInfo: { assetKind: 'nat', decimalPlaces: 6 }, | ||
}); | ||
const lpId = lpAsset.brand.getBoardId() || assert.fail('impossible'); | ||
t.is(agoricNamesRemotes.brand.FastLP.getBoardId(), lpId); | ||
|
||
const { EV } = t.context.runUtils; | ||
const agoricNames = await EV.vat('bootstrap').consumeItem('agoricNames'); | ||
const board = await EV.vat('bootstrap').consumeItem('board'); | ||
const getBoardAux = async name => { | ||
const brand = await EV(agoricNames).lookup('brand', name); | ||
const id = await EV(board).getId(brand); | ||
t.is(id, lpId); | ||
t.truthy(storage.data.get(`published.boardAux.${id}`)); | ||
return unmarshalFromVstorage( | ||
storage.data, | ||
|
@@ -121,7 +130,7 @@ test.serial( | |
|
||
const current = watcherWallet.getCurrentWalletRecord(); | ||
|
||
// XXX We should be able to compare objects by identity like this: | ||
// XXX #10491 We should be able to compare objects by identity like this: | ||
// | ||
// const invitationPurse = current.purses.find( | ||
// p => p.brand === agoricNamesRemotes.brand.Invitation, | ||
|
@@ -216,9 +225,11 @@ test.serial('makes usdc advance', async t => { | |
), | ||
); | ||
|
||
const lp = oracles[0]; // somewhat arbitrary | ||
|
||
// @ts-expect-error it doesnt recognize usdc as a Brand type | ||
const usdc = agoricNamesRemotes.vbankAsset.USDC.brand as Brand<'nat'>; | ||
await oracles[0].sendOffer({ | ||
await lp.sendOffer({ | ||
id: 'deposit-lp-0', | ||
invitationSpec: { | ||
source: 'agoricContract', | ||
|
@@ -233,6 +244,23 @@ test.serial('makes usdc advance', async t => { | |
}); | ||
await eventLoopIteration(); | ||
|
||
const { getOutboundMessages } = t.context.bridgeUtils; | ||
const lpBankDeposit = getOutboundMessages(BridgeId.BANK).find( | ||
obj => | ||
obj.type === 'VBANK_GIVE' && | ||
obj.denom === 'ufastlp' && | ||
obj.recipient === lp.getAddress(), | ||
); | ||
t.log('LP vbank deposit', lpBankDeposit); | ||
t.true(BigInt(lpBankDeposit.amount) > 1_000_000n, 'vbank GIVEs shares to LP'); | ||
|
||
const { purses } = lp.getCurrentWalletRecord(); | ||
// XXX #10491 should not need to resort to string match on brand | ||
t.falsy( | ||
purses.find(p => `${p.brand}`.match(/FastLP/)), | ||
'FastLP balance not in wallet record', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a way to assert that it is in the wallet's bank in this test context? I might suggest at least saying 'FastLP balance should be in bank, not in wallet record', or maybe put a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good idea... I think I can do that... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Wrote this before reading the code changes, seems you already have this. const queryClient = makeQueryClient(
await useChain('agoric').getRestEndpoint(),
);
const { balance } = await queryClient.queryBalance('$ADDR', 'ufastlp') There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah; there's no rest endpoint in the bootstrap world There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah |
||
); | ||
|
||
const evidence = MockCctpTxEvidences.AGORIC_PLUS_OSMO(); | ||
|
||
harness?.useRunPolicy(true); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a blocker but I find these one-off abstractions a little hard to work with. I hope we can design good general abstractions in
@agoric/client-utils
to invest in. #10713 attempts to replace test calls toVStorageClient
withSmartWalletKit
, getting typed data for query paths.If the client-utils abstractions aren't right, let's work on to improve them, so all consumers benefit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for #10713; I looked it over and made some comments.
The cycle time in multi-chain testing is extremely high, so I'm not eager to go beyond this 1 test file for this feature.
In general, my habit is to experiment until I see a pattern that works well in at least 2 or 3 cases and then DRY it out.