diff --git a/main/guides/zoe/contract-details.md b/main/guides/zoe/contract-details.md index 3f3dfa25d..9be5c3d2a 100644 --- a/main/guides/zoe/contract-details.md +++ b/main/guides/zoe/contract-details.md @@ -17,7 +17,7 @@ need. This means putting relevant state in that will be accessible to users have an identity that can be maintained as the behavior changes with contract upgrades. -We use zone.exo(), zone.exoClass(), and zone.exoClassKit() to define durable objects. +We use zone.exo(), zone.exoClass(), and zone.exoClassKit() to define durable objects. [Zone](http://localhost:5173/glossary/#zone) provides an interface for defining objects and classes that supports both ephemeral objects (allocated on the heap), and durable objects that can persist and that @@ -50,7 +50,7 @@ object. Notice that `exo()` doesn't take `init` as a parameter; this limits the referencing values defined in the enclosing scope. Classes can also refer to variables in their defining scope, but any values inherited from the scope will be accessible to all instances of that type. The `init` function's parameters become the parameters of the maker function returned by `exoClass()` and -`exoClassKit()`. `init`'s return value is the state that will be preserved by SwingSet for each +`exoClassKit()`. `init`'s return value is the state that will be preserved by SwingSet for each object. `exo()` doesn't have an init parameter, so it creates and returns the singleton immediately rather than returning a maker. @@ -98,7 +98,7 @@ M.interface('name', { `M.call()` verifies that all parameters match the guard before passing them through to the method. `M.callWhen(M.await(paramsBGuard))` awaits the resolution of the parameter, and then verifies that the result matches before invoking the method. When a guard is written this latter way, the method doesn't have to -be `async`. In both cases, the method doesn't have to check for compliance with the guard. +be `async`. In both cases, the method doesn't have to check for compliance with the guard. [Shapes can specify](https://endojs.github.io/endo/interfaces/_endo_patterns.PatternMatchers.html) simple types like `M.string()`, `M.remotable()`, and `M.number()`, as well as complex structures of records and @@ -119,4 +119,3 @@ the state values. `finish()`, if provided, is called after instances have been created but before they are returned to the caller. They can be used to send an initial state update, or to complete initialization which couldn't be done in `init`. `finish` has access to state and facets if needed. - diff --git a/main/guides/zoe/contract-upgrade.md b/main/guides/zoe/contract-upgrade.md index d0b930a4a..aecc5d8cb 100644 --- a/main/guides/zoe/contract-upgrade.md +++ b/main/guides/zoe/contract-upgrade.md @@ -4,7 +4,7 @@ The return value when starting a contract includes a capability that conveys the the contract instance. A call to [E(zoe).startInstance(...)](/reference/zoe-api/zoe.md#e-zoe-startinstance-installation-issuerkeywordrecord-terms-privateargs) returns a record of several objects that carry different powers. The `publicFacet` and -`creatorFacet` are defined by the contract. The +`creatorFacet` are defined by the contract. The [`adminFacet`](/reference/zoe-api/zoe.html#adminFacet) is defined by Zoe and includes methods to upgrade the contract. @@ -85,7 +85,6 @@ The 3rd argument, `baggage`, of the `start` function is a `MapStore` that is sav across restarts of the contract. It provides a way to preserve state and behavior of objects between incarnations in a way that also maintains the identity of objects as seen from other [vats](/glossary/#vat). - ```js let rooms; if (!baggage.has('rooms')) { @@ -104,7 +103,7 @@ The `provide` function supports a concise idiom for this get-or-create pattern: import { provide } from '@agoric/vat-data'; const rooms = provide(baggage, 'rooms', () => - makeScalarBigMapStore('rooms', { durable: true }) + makeScalarBigMapStore('rooms', { durable: true }), ); ``` @@ -153,18 +152,18 @@ const makeRoom = zone.exoClass('Room', RoomI, id => ({ id, value: 0 }), { // ... clear(delta) { this.state.value = 0; - } + }, }); ``` -The interface guard also needs updating. _[The Durable +The interface guard also needs updating. _[The Durable objects](./contract-details.md#guards-defensive-methods) section has more on interface guards._ ```js const RoomI = M.interface('Room', { // ... - clear: M.call().returns() + clear: M.call().returns(), }); ``` @@ -206,7 +205,7 @@ const publicFacet = zone.exo( 'StakeAtom', M.interface('StakeAtomI', { makeAccount: M.callWhen().returns(M.remotable('ChainAccount')), - makeAccountInvitationMaker: M.callWhen().returns(InvitationShape) + makeAccountInvitationMaker: M.callWhen().returns(InvitationShape), }), { async makeAccount() { @@ -221,8 +220,8 @@ const publicFacet = zone.exo( const holder = await makeAccountKit(); return holder.asContinuingOffer(); }, 'wantStakingAccount'); - } - } + }, + }, ); ``` @@ -259,13 +258,13 @@ const makeLocalOrchestrationAccountKit = prepareLocalChainAccountKit( zcf, privateArgs.timerService, vowTools, - makeChainHub(privateArgs.agoricNames) + makeChainHub(privateArgs.agoricNames), ); // ... const makeCosmosOrchestrationAccount = prepareCosmosOrchestrationAccount( zone, makeRecorderKit, vowTools, - zcf + zcf, ); ``` diff --git a/main/reference/zoe-api/zoe.md b/main/reference/zoe-api/zoe.md index 0f913c7f2..e8b6a7763 100644 --- a/main/reference/zoe-api/zoe.md +++ b/main/reference/zoe-api/zoe.md @@ -34,7 +34,7 @@ and the values are the **Brands** for particular **[Issuers](/reference/ertp-api // Record example const brandKeywordRecord = { FirstCurrency: quatloosBrand, - SecondCurrency: moolaBrand + SecondCurrency: moolaBrand, // etc. }; ``` @@ -58,7 +58,7 @@ and the values are **Issuers**. // Record example const issuerKeywordRecord = { FirstCurrency: quatloosIssuer, - SecondCurrency: moolaIssuer + SecondCurrency: moolaIssuer, }; ``` @@ -274,16 +274,19 @@ It returns a **Promise** for a **StartInstanceResult** object. The object consis The **adminFacet** has four methods: - **getVatShutdownPromise()** + - Returns a promise that resolves to reason (the value passed to **fail(reason)**) or completion (the value passed to **exit(completion)**) when this newly started instance terminates. - **restartContract(newPrivateArgs?)** + - **newPrivateArgs**: **any** - Optional - returns VatUpgradeResults (a record with one field: incarnationNumber) Restarts the contract without changing the contract bundle - **upgradeContract(contractBundleId, newPrivateArgs)** + - **contractBundleId**: **string** - **newPrivateArgs**: **any** - Optional @@ -295,6 +298,7 @@ The **adminFacet** has four methods: process of upgrading contracts. - **terminateContract(reason)** + - **reason**: **Error** terminates the contract. `reason` will be provided as the failure reason. @@ -326,11 +330,11 @@ represented as a **Payment**. ```js const issuerKeywordRecord = { Asset: moolaIssuer, - Price: quatlooIssuer + Price: quatlooIssuer, }; const terms = { numBids: 3 }; const { creatorFacet, publicFacet, creatorInvitation } = await E( - Zoe + Zoe, ).startInstance(installation, issuerKeywordRecord, terms); ``` @@ -362,7 +366,7 @@ it may inspect it and reject it for any reason const myProposal = harden({ give: { Asset: AmountMath.make(quatloosBrand, 4n) }, want: { Price: AmountMath.make(moolaBrand, 15n) }, - exit: { onDemand: null } + exit: { onDemand: null }, }); ```