-
Notifications
You must be signed in to change notification settings - Fork 225
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
Bootstrap core: AMM, VaultFactory bootstrap with governance committee #4437
Conversation
d99c7e3
to
a23ce62
Compare
@michaelfig this is another chunk of work on #4165 . It might be a little unwieldy, but... what do you think? |
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.
LGTM! Wowza! Let's get this in!
(Just a few minor style questions, not necessarily blockers.)
@@ -53,16 +53,21 @@ | |||
* @property {() => Allocation} getRewardAllocation, | |||
* @property {() => ERef<Payment>} getBootstrapPayment | |||
* @property {() => Instance} getContractGovernor | |||
* @property {() => Invitation} makeCollectFeesInvitation | |||
* @property {() => ERef<Invitation>} makeCollectFeesInvitation |
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.
I generally avoid using ERef
in a return value, preferring instead Promise<Invitation>
. Just curious why you chose this way.
@@ -173,6 +173,7 @@ test('amm with valid offers', async t => { | |||
const bobSwapInvitation1 = await E(amm.ammPublicFacet).makeSwapInInvitation(); | |||
|
|||
const { value } = await E(invitationIssuer).getAmountOf(bobSwapInvitation1); | |||
assert(Array.isArray(value)); // non-fungible |
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.
Why not a t.assert(...)
?
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.
as discussed, t.assert
doesn't convince tsc that value is an array
const contractFilename = `${dirname}/../src/contractFacet/vatRoot.js`; | ||
const outputPath = `${dirname}/../bundles/bundle-contractFacet.js`; | ||
await writeSourceBundle(contractFilename, outputPath); | ||
for await (const { src, bundle } of [ |
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.
Why is this a for await...of
when the iterable is not an AsyncIterable?
This reverts commit 42b96fa.
- feat: export bundled attestion contract - style: types tweak in tools - docs: fix optional arg decl in registerPriceAuthority - chore: prune attestation install-on-chain
- test: first steps toward borrowing RUN against BLD - test: prepare real attestation - docs: types for FP utilities - feat: terms are controlled by governance - fix: prevent forged attestation - test: forging an attestion should fail
- replace getInvitation with makeLoanInvitation patterned after vault.js - HIGH_FEE, LONG_EXP - return uiNotifier, invitationMakers, vault - factor out makeLineOfCreditKit - add close OfferHandler - track debtAmount, vaultState - keep attestation in vaultSeat - stub adjustBalances - factor out makeCreditPolicy - document close() - refactor: push more down into startAttestation test(runLoC): run tests from spreadsheet - ava tests have to be created synchronously, so turn the CSV data into a string constant - fix parsing of empty leading fields in CSV - add types to CSV parsing test(runLoC): test close 10 tests passed 15 tests skipped hush some logging
10 tests passed 15 tests skipped - adjust offer need not have want: Attestation - provide limited runMint access to makeLineOfCreditKit (WIP) - provide type for notifier (RunLoCUIState) - factor out creditPolicy.checkBorrow() - refactor test bootstrap - each part installs its own bundles - bootstrapAttestation caller provides bld brand, issuer, reporter - one reporter for many accounts / balances - add the reporter in bootstrap - factor out home.attMaker - bootstrapRunLoC caller provides timer - add testAdjust
12 tests passed 13 tests skipped - clarify close() offer handler a bit - test: clarify todo filter - never mind attenuating runMint - never mind burnSeat feat(getRUN): vault-compatible naming - match invitationMakers labels - disregard address; attMaker handles it test(getRUN): refactor stake reporter as mockBridge feat(getRUN): only RUN balance can be adjusted, for now - clean up test logging a bit - style: organize imports test(getRUN): misc refactor / clean-up - move contractRoots near imports; move test.before() bundle loading up - subordinate collection utilities in Collect - factor out theBundles type handling - move contract start types near usage - break lines in long type annotations - mockBridge: rename uBrand (underlying?) to stakingBrand feat(getRUN): align types with vaults - makeLineOfCreditKit: move creditPolicy check inside in order to make documentation / design simpler. - document connection between debtAmount and minted RUN - use return value from creditPolicy.checkBorrow to clarify adjustBalances (up) - burn before updating debtAmount - never mind zeroRun - factor BaseUIState out of UIState; liened -> locked - vaultState doesn't seem to be part of UIState, so reduce it to a boolean - never mind assertVaultIsOpen; didn't carry its weight - makeAdjustBalancesInvitation on vault wasn't exposed; skip it - document CreditTerms - annotate types for minAmt()
- extract from test-runLoC.js - declare StakingAuthority type
caller provides installations rather than bundles
- shareEconomyBundles - EconomyBootstrapPowers type tweaks
- govIssuer / govBrand are unused. prune
// @ts-expect-error bounded polymorphism doesn't fit well in JSDoc | ||
const wrapPublicFacet = (originalPublicFacet = {}) => { |
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.
I actually used an inline cast for fixing these, but I know we frown upon them
// @ts-expect-error bounded polymorphism doesn't fit well in JSDoc | |
const wrapPublicFacet = (originalPublicFacet = {}) => { | |
const wrapPublicFacet = (originalPublicFacet = /** @type {T} */ ({})) => { |
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 the suggestion. In looking at the context, @michaelfig and I discovered a good type that's a bit more involved.
* @returns {GovernedCreatorFacet} | ||
* @template T | ||
*/ | ||
// @ts-expect-error bounded polymorphism doesn't fit well in JSDoc |
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.
I a little worried this may overrule different errors
…#4437) * feat(agoric-cli): start with 1B BLD * chore(wallet): prune feePurse * docs(governance): try to thread types for wrapped governed facets * chore(governance): include README in package files * chore(vats): Revert postpone getRUN bootstrap to later PR" This reverts commit 42b96fa. * chore(zoe): prune expiring / voting attestation usage - feat: export bundled attestion contract - style: types tweak in tools - docs: fix optional arg decl in registerPriceAuthority - chore: prune attestation install-on-chain * feat(getRUN): borrow RUN with collateral price, ratio - test: first steps toward borrowing RUN against BLD - test: prepare real attestation - docs: types for FP utilities - feat: terms are controlled by governance - fix: prevent forged attestation - test: forging an attestion should fail * test(getRUN): Test Cases spreadsheet, driver * feat(getRUN): close, uiNotifier, invitation fee + expiry - replace getInvitation with makeLoanInvitation patterned after vault.js - HIGH_FEE, LONG_EXP - return uiNotifier, invitationMakers, vault - factor out makeLineOfCreditKit - add close OfferHandler - track debtAmount, vaultState - keep attestation in vaultSeat - stub adjustBalances - factor out makeCreditPolicy - document close() - refactor: push more down into startAttestation test(runLoC): run tests from spreadsheet - ava tests have to be created synchronously, so turn the CSV data into a string constant - fix parsing of empty leading fields in CSV - add types to CSV parsing test(runLoC): test close 10 tests passed 15 tests skipped hush some logging * feat(getRUN): borrow more against the same lien 10 tests passed 15 tests skipped - adjust offer need not have want: Attestation - provide limited runMint access to makeLineOfCreditKit (WIP) - provide type for notifier (RunLoCUIState) - factor out creditPolicy.checkBorrow() - refactor test bootstrap - each part installs its own bundles - bootstrapAttestation caller provides bld brand, issuer, reporter - one reporter for many accounts / balances - add the reporter in bootstrap - factor out home.attMaker - bootstrapRunLoC caller provides timer - add testAdjust * feat(getRUN): partial payoff 12 tests passed 13 tests skipped - clarify close() offer handler a bit - test: clarify todo filter - never mind attenuating runMint - never mind burnSeat feat(getRUN): vault-compatible naming - match invitationMakers labels - disregard address; attMaker handles it test(getRUN): refactor stake reporter as mockBridge feat(getRUN): only RUN balance can be adjusted, for now - clean up test logging a bit - style: organize imports test(getRUN): misc refactor / clean-up - move contractRoots near imports; move test.before() bundle loading up - subordinate collection utilities in Collect - factor out theBundles type handling - move contract start types near usage - break lines in long type annotations - mockBridge: rename uBrand (underlying?) to stakingBrand feat(getRUN): align types with vaults - makeLineOfCreditKit: move creditPolicy check inside in order to make documentation / design simpler. - document connection between debtAmount and minted RUN - use return value from creditPolicy.checkBorrow to clarify adjustBalances (up) - burn before updating debtAmount - never mind zeroRun - factor BaseUIState out of UIState; liened -> locked - vaultState doesn't seem to be part of UIState, so reduce it to a boolean - never mind assertVaultIsOpen; didn't carry its weight - makeAdjustBalancesInvitation on vault wasn't exposed; skip it - document CreditTerms - annotate types for minAmt() * feat(zoe): bootstrapAttestation - extract from test-runLoC.js - declare StakingAuthority type * refactor(treasury): factor bootstrapRunLoC out of test-runLoC * chore: move runLoC (getRUN) from treasury/ to run-protocol/ * docs(treasury): arg types for makeMakeCollectFeesInvitation * chore: rename runLoC -> getRUN * chore(run-protocol): build getRUN bundle; tweak bootstrap caller provides installations rather than bundles * chore(getRUN): subsume attestation in getRUN contract vat * chore(getRUN): update governance API; more renaming * chore(zoe): prune bootstrapAttestation.js * refactor(vats): factor BoostrapPowers out of startGetRun * chore(vat): sort deps * build(vats): add dependency on @agoric/governance * feat(vats): startEconomicCommittee * refactor(vats): start vault factory without install-on-chain * refactor(vats): move extract, makePromiseSpace from boot to utils * chore(run-protocol): move econ-behaviors from vats ... to facilitate unit testing * chore(vats): export types * refactor(vats): factor out makeNameAdmins - spell binaryVoteCounter consistently * refactor(vats): push more down into EconomyBootstrapPowers * feat(run-protocol): startEconomicCommittee using bootstrap style * feat(vats): support behavior config via boostrap vatParameters * feat(vats): reserve necessary governor instances * chore(run-protocol): fix, test AMM bootstrap * chore(vats): VaultFactory is capitalized in agoricNames - move board out of EconomyBootstrapPowers (postpone uiConfig) * test(run-protocol): `voteOnParamChange` type requires `key` * feat(run-protocol): export static contract bundles * test(run-protcol): unit test startVaultFactory - test-vaultFactory.js: subsume makePriceAuthority(), setupVaultFactory(), bundleInstalls() using produce / consume space - manage bundles, installations as records with Collect.allValues - provide param types for setupServices() etc. - add config.loanParams to startVaultFactory - split consume.economyBundles into consume.ammBundle, consume.vaultBundles - factor out configureVaultFactoryUI so that board is not needed for unit testing - get centralIssuer from agoricNames so it doesn't have to be created by zoe. - spell VaultFactory, liquidate consistently - use export const x = () => { ... }; harden(X) * refactor(run-protocol): move Collect out of bootstrapRunLoc.js * refactor(run-protocol): move getRUN bootstrap into econ-behaviors - prune bootstrapRunLoC.js * docs(run-protocol): deprecate install-on-chain * docs(run-protocol): econ-behaviors TODOs * chore(vats): update GOVERNANCE_ACTIONS_MANIFEST - shareEconomyBundles - EconomyBootstrapPowers type tweaks * chore(vats): clean up bankManager ERef / optional * docs(run-protocol): timer await is for legibility of terms - govIssuer / govBrand are unused. prune * docs(run-protocol): optional args in AMM test setup * chore(vats): postpone startGetRun * chore(run-protocol): postpone startGetRun * test(run-protocol): postpone test-getRUN * chore(run-protocol): postpone bundle-getRUN * chore(run-protocol): postpone getRUN contract * chore(run-protocol): merge fix * chore(zoe): prune more attestation/expiringNFT tests * chore(run-protocol): postpone bundle-getRUN.js * docs(vats): type of consume.ammCreatorFacet * docs(governance): tidy up types a bit * chore(run-protocol): postpone getRUN some more * docs(run-protocol): polish off AMM types * style: types, async style in run-protocol, zoe * chore: sort out governance vs. vault types * style(governance): fix types of wrapper functions Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
refs: #4165