-
Notifications
You must be signed in to change notification settings - Fork 228
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
6701 ec oracles list #6963
6701 ec oracles list #6963
Changes from 4 commits
b13f85f
e2207ff
727f40c
cd4b947
fbe5136
2add695
9e65ecf
acd263b
d4ac24e
8010fb2
a9c03a5
b255ca3
dbc0159
dfd334a
dcafc14
9931e4f
50b38a8
8bc4870
ae3d5d2
96a7589
d2fc0ef
5b137a9
e8c9eb0
f6377d9
8ec7e31
7410bb7
be64930
b0f4e4a
6c7a922
edc7d2c
49ec3ee
cd8211a
d9204e4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,6 +1,8 @@ | ||||||
import { BridgeId, deeplyFulfilledObject } from '@agoric/internal'; | ||||||
import { unsafeMakeBundleCache } from '@agoric/swingset-vat/tools/bundleTool.js'; | ||||||
import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js'; | ||||||
// eslint-disable-next-line no-unused-vars -- used by TS | ||||||
import { coalesceUpdates } from '@agoric/smart-wallet/src/utils.js'; | ||||||
Comment on lines
+3
to
+4
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. something like |
||||||
import { unsafeMakeBundleCache } from '@agoric/swingset-vat/tools/bundleTool.js'; | ||||||
import { E } from '@endo/far'; | ||||||
import path from 'path'; | ||||||
import { createPriceFeed } from '../../src/proposals/price-feed-proposal.js'; | ||||||
|
@@ -125,3 +127,30 @@ export const makeDefaultTestContext = async (t, makeSpace) => { | |||||
simpleCreatePriceFeed, | ||||||
}; | ||||||
}; | ||||||
|
||||||
/** | ||||||
* @param {Awaited<ReturnType<typeof coalesceUpdates>>} state | ||||||
* @param {Brand<'nat'>} brand | ||||||
*/ | ||||||
export const purseBalance = (state, brand) => { | ||||||
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. Call this |
||||||
const balances = Array.from(state.balances.values()); | ||||||
const match = balances.find(b => b.brand === brand); | ||||||
if (!match) { | ||||||
console.debug('balances', ...balances); | ||||||
assert.fail(`${brand} not found in record`); | ||||||
} | ||||||
return match.value; | ||||||
}; | ||||||
/** | ||||||
* @param {import('@agoric/smart-wallet/src/smartWallet.js').CurrentWalletRecord} record | ||||||
* @param {Brand<'nat'>} brand | ||||||
*/ | ||||||
export const currentPurseBalance = (record, brand) => { | ||||||
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. likewise 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. If you really do need the balance of some other brand, use the relevant bank directly, as in: agoric-sdk/packages/inter-protocol/test/smartWallet/contexts.js Lines 69 to 70 in adc0836
|
||||||
const purses = Array.from(record.purses.values()); | ||||||
const match = purses.find(b => b.brand === brand); | ||||||
if (!match) { | ||||||
console.debug('purses', ...purses); | ||||||
assert.fail(`${brand} not found in record`); | ||||||
} | ||||||
return match.balance.value; | ||||||
}; |
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.
The inconsistency between
addOracle
andinitOracle
(and likewiseremoveOracle
anddeleteOracle
) seems like a little sand in the gears.Tolerable, though, I suppose.