Skip to content

Commit

Permalink
chore: prettier's suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris-Hibbert committed Dec 4, 2024
1 parent f47fd29 commit 5a72a8c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 20 deletions.
7 changes: 3 additions & 4 deletions main/guides/zoe/contract-details.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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
Expand All @@ -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.

21 changes: 10 additions & 11 deletions main/guides/zoe/contract-upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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')) {
Expand All @@ -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 }),
);
```
Expand Down Expand Up @@ -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. <small>_[The Durable
The interface guard also needs updating. <small>_[The Durable
objects](./contract-details.md#guards-defensive-methods) section has more on interface
guards._</small>

```js
const RoomI = M.interface('Room', {
// ...
clear: M.call().returns()
clear: M.call().returns(),
});
```

Expand Down Expand Up @@ -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() {
Expand All @@ -221,8 +220,8 @@ const publicFacet = zone.exo(
const holder = await makeAccountKit();
return holder.asContinuingOffer();
}, 'wantStakingAccount');
}
}
},
},
);
```

Expand Down Expand Up @@ -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,
);
```
14 changes: 9 additions & 5 deletions main/reference/zoe-api/zoe.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
};
```
Expand All @@ -58,7 +58,7 @@ and the values are **Issuers**.
// Record example
const issuerKeywordRecord = {
FirstCurrency: quatloosIssuer,
SecondCurrency: moolaIssuer
SecondCurrency: moolaIssuer,
};
```

Expand Down Expand Up @@ -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

Expand All @@ -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.
Expand Down Expand Up @@ -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);
```

Expand Down Expand Up @@ -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 },
});
```

Expand Down

0 comments on commit 5a72a8c

Please sign in to comment.