Skip to content

Commit 225e91a

Browse files
docs: drop all references to reallocate() and its helpers (#1266)
* docs: drop all references to reallocate() and its helpers * chore: generate svg, and clean up a URL --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 63ca7a2 commit 225e91a

File tree

7 files changed

+9
-199
lines changed

7 files changed

+9
-199
lines changed

.wordlist.txt

+4
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ daveSwapProposal
226226
daveSwapSeat
227227
declaratively
228228
declineOffer
229+
decrementBy
229230
defaultAcceptanceMsg
230231
DeFi
231232
delaySecs
@@ -319,6 +320,7 @@ getPurse
319320
getPurseIssuer
320321
getPurses
321322
getRefund
323+
getStagedAllocation
322324
getTerms
323325
getUpdateSince
324326
getUse
@@ -331,6 +333,7 @@ grabSharedMap
331333
HandledPromise
332334
HandledPromises
333335
hasExited
336+
hasStagedAllocation
334337
heroImage
335338
hookArgs
336339
hookMethod
@@ -347,6 +350,7 @@ idToOfferHandle
347350
iframe
348351
implementating
349352
importBundleSource
353+
incrementBy
350354
init
351355
inspectable
352356
inspectCode

main/guides/getting-started/assets/zoe-simp.mmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ end
99
agent->>+zoe: offer(invitation, {give, want}, pmts)
1010
zoe-->>agent: userSeat
1111
zoe->>+contract: {give, want}
12-
contract-->>-zoe: reallocate()
12+
contract-->>-zoe: atomicRearrange()
1313
agent->>zoe: E(userSeat).getPayouts()
1414
zoe-->>-agent: payout payments

main/guides/getting-started/assets/zoe-simp.svg

+3-1
Loading

main/guides/zoe/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Trading with a contract using Zoe typically goes through these steps:
2121
1. Parties call [E(zoe).offer(invitation, proposal, assets)](/reference/zoe-api/zoe#e-zoe-offer-invitation-proposal-paymentpkeywordrecord-offerargs). Zoe escrows the assets.
2222
2. Zoe relays the proposal to the contract identified in the invitation.
2323
3. The contract handles proposals using its custom business logic.
24-
4. The contract instructs Zoe to [reallocate](/reference/zoe-api/zoe-contract-facet#zcf-reallocate-seats) assets among the parties.
24+
4. The contract instructs Zoe to [reallocate](/reference/zoe-api/zoe-contract-facet#zcf-atomicrearrange-transfers) assets among the parties.
2525
5. The contract completes (aka [exits](/reference/zoe-api/zcfseat#azcfseat-exit-completion)) the offers.
2626
6. Zoe pays out assets to the parties.
2727

main/reference/zoe-api/zcfseat.md

-123
Original file line numberDiff line numberDiff line change
@@ -130,126 +130,3 @@ It checks whether **newAllocation** fully satisfies
130130
**proposal.give** (giving a refund) or whether it fully satisfies
131131
**proposal.want**. Both can be fully satisfied. See the ZoeHelper
132132
[**satisfies()**](./zoe-helpers#satisfies-zcf-seat-update) method for more details.
133-
134-
::: warning DEPRECATED
135-
136-
## aZCFSeat.getStagedAllocation()
137-
138-
- Returns: **[Allocation](./zoe-data-types#allocation)**
139-
140-
Gets and returns the **stagedAllocation**, which is the **Allocation** committed if the seat is
141-
reallocated over, if offer safety holds, and rights are conserved.
142-
143-
**Note**: This method has been deprecated. Use **[atomicRearrange()](./zoe-helpers#atomicrearrange-zcf-transfers)** instead.
144-
:::
145-
146-
::: warning DEPRECATED
147-
148-
## aZCFSeat.hasStagedAllocation()
149-
150-
- Returns: **Boolean**
151-
152-
Returns **true** if there is a staged allocation, i.e., whether **ZCFSeat.incrementBy()** or
153-
**ZCFSeat.decrementBy()** has been called and **ZCFSeat.clear()**
154-
and **reallocate()** have not. Otherwise returns **false**.
155-
156-
**Note**: This method has been deprecated. Use **[atomicRearrange()](./zoe-helpers#atomicrearrange-zcf-transfers)** instead.
157-
:::
158-
159-
::: warning DEPRECATED
160-
161-
## aZCFSeat.incrementBy(amountKeywordRecord)
162-
163-
- **amountKeywordRecord**: **[AmountKeywordRecord](./zoe-data-types#keywordrecord)**
164-
- Returns: **AmountKeyRecord**
165-
166-
Adds the **amountKeywordRecord** argument to the **ZCFseat**'s staged allocation and returns the
167-
same **amountKeywordRecord** so it can be reused in another call. Note that this lets
168-
**zcfSeat1.incrementBy(zcfSeat2.decrementBy(amountKeywordRecord))** work as a usage pattern.
169-
170-
Note that you can add amounts to original or staged allocations which do not have the
171-
specified **[Keyword](./zoe-data-types#keyword)** for the amount. The result is for the **Keyword** and amount to become part
172-
of the allocation. For example, if we start with a new, empty, allocation:
173-
174-
```js
175-
// Make an empty seat.
176-
const { zcfSeat: zcfSeat1 } = zcf.makeEmptySeatKit();
177-
// The allocation is currently empty, i.e. `{}`
178-
const stagedAllocation = zcfSeat1.getStagedAllocation();
179-
const empty = AmountMath.makeEmpty(brand, AssetKind.NAT);
180-
// Try to incrementBy empty. This succeeds, and the keyword is added
181-
// with an empty amount.
182-
zcfSeat1.incrementBy({ IST: empty });
183-
t.deepEqual(zcfSeat1.getStagedAllocation(), { IST: empty });
184-
```
185-
186-
While this incremented the allocation by an empty amount, any amount would have been added to the
187-
allocation in the same way.
188-
189-
**Note**: This method has been deprecated. Use **[atomicRearrange()](./zoe-helpers#atomicrearrange-zcf-transfers)** instead.
190-
:::
191-
192-
::: warning DEPRECATED
193-
194-
## aZCFSeat.decrementBy(amountKeywordRecord)
195-
196-
- **amountKeywordRecord**: **[AmountKeywordRecord](./zoe-data-types#keywordrecord)**
197-
- Returns: **AmountKeywordRecord**
198-
199-
Subtracts the **amountKeywordRecord** argument from the **ZCFseat**'s staged allocation and returns the
200-
same **amountKeywordRecord** so it can be used in another call. Note that this lets
201-
**zcfSeat1.incrementBy(zcfSeat2.decrementBy(amountKeywordRecord))** work as a usage pattern.
202-
203-
The amounts to subtract cannot be greater than the staged allocation (i.e., negative
204-
results are not allowed).
205-
206-
**decrementBy()** has different behavior from **incrementBy()** if the original or staged allocation
207-
does not have the **[Keyword](./zoe-data-types#keyword)** specified for an amount in the **amountKeywordRecord** argument. There are two
208-
cases to look at; when the corresponding amount to subtract is empty and when it isn't.
209-
210-
```js
211-
// Make an empty seat.
212-
const { zcfSeat: zcfSeat1 } = zcf.makeEmptySeatKit();
213-
// The allocation is currently {}
214-
const stagedAllocation = zcfSeat1.getStagedAllocation();
215-
const empty = AmountMath.makeEmpty(brand, AssetKind.NAT);
216-
// decrementBy empty does not throw, and does not add a keyword
217-
zcfSeat1.decrementBy({ IST: empty });
218-
t.deepEqual(zcfSeat1.getStagedAllocation(), {});
219-
```
220-
221-
The result here is **not** to add the **Keyword** to the allocation. It wasn't there to begin with, and
222-
the operation was to try to subtract it from the allocation. Subtracting something that's not there
223-
does not add it to the original value. For example, if I tell you I'm taking away the Mona Lisa from
224-
you and you are not the Louvre and don't have it, you still don't have it after I try to take it away.
225-
In the above example, trying to take away an empty amount from an empty allocation is effectively a
226-
null operation; the allocation is still empty, didn't add the new **Keyword**, and no error is thrown.
227-
228-
However, decrementing a non-empty amount from an empty allocation has a different result. For example:
229-
230-
```js
231-
// Make an empty seat.
232-
const { zcfSeat: zcfSeat1 } = zcf.makeEmptySeatKit();
233-
// The allocation is currently {}
234-
const stagedAllocation = zcfSeat1.getStagedAllocation();
235-
// decrementBy throws for a keyword that does not exist on the stagedAllocation and a non-empty amount
236-
zcfSeat1.decrementBy({ IST: runFee });
237-
```
238-
239-
It throws an error because you cannot subtract something from nothing. So trying to decrement an empty
240-
allocation by a non-empty amount is an error, while decrementing an empty allocation by an empty amount
241-
is effectively a null operation with no effects.
242-
243-
**Note**: This method has been deprecated. Use **[atomicRearrange()](./zoe-helpers#atomicrearrange-zcf-transfers)** instead.
244-
:::
245-
246-
::: warning DEPRECATED
247-
248-
## aZCFSeat.clear()
249-
250-
- Returns: None.
251-
252-
Deletes the **ZCFSeat**'s current staged allocation, if any,
253-
254-
**Note**: This method has been deprecated. Use **[atomicRearrange()](./zoe-helpers#atomicrearrange-zcf-transfers)** instead.
255-
:::

main/reference/zoe-api/zoe-contract-facet.md

-59
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,6 @@ constraints. If these constraints are all met, then the reallocation happens ato
2121
error is thrown and none of the proposed changes has any effect. The constraints are as follows.
2222

2323
- All the mentioned seats are still live.
24-
- There aren't any outstanding stagings for any of the mentioned seats.
25-
26-
Stagings are a reallocation mechanism that has been
27-
deprecated in favor of this **atomicRearrange()** function.
28-
To prevent confusion, each reallocation can only be
29-
expressed in the old way or the new way, but not a mixture.
30-
3124
- Overall conservation must be maintained. In other words, the reallocated
3225
**[Amounts](/reference/ertp-api/ertp-data-types#amount)** must balance out.
3326
- Offer Safety is preserved for each seat. That means reallocations can only take assets from a seat
@@ -392,55 +385,3 @@ Returns all the strings that have been disabled for use in invitations, if any.
392385
A contract's invitations may be disabled using the
393386
**[zcf.setOfferFilter()](#zcf-setofferfilter-strings)** method when governance determines
394387
that they provide a vulnerability.
395-
396-
::: warning DEPRECATED
397-
398-
## zcf.reallocate(seats)
399-
400-
- **seats**: **[ZCFSeats](./zcfseat)[]** (at least two)
401-
- Returns: None.
402-
403-
**zcf.reallocate()** commits the staged allocations for each of its seat arguments,
404-
making their staged allocations their current allocations. **zcf.reallocate()** then
405-
transfers the assets escrowed in Zoe from one seat to another. Importantly, the assets
406-
stay escrowed, with only the internal Zoe accounting of each seat's allocation changed.
407-
408-
There must be at least two **ZCFSeats** in the array argument. Every **ZCFSeat**
409-
with a staged allocation must be included in the argument array or an error
410-
is thrown. If any seat in the argument array does not have a staged allocation,
411-
an error is thrown.
412-
413-
On commit, the staged allocations become the seats' current allocations and
414-
the staged allocations are deleted.
415-
416-
Note: **reallocate()** is an _atomic operation_. To enforce offer safety,
417-
it will never abort part way through. It will completely succeed or it will
418-
fail before any seats have their current allocation changed.
419-
420-
The reallocation only succeeds if it:
421-
422-
1. Conserves rights (the specified **[Amounts](/reference/ertp-api/ertp-data-types#amount)** have the same total value as the
423-
current total amount)
424-
2. Is 'offer-safe' for all parties involved.
425-
426-
The reallocation is partial, only applying to the **seats** in the
427-
argument array. By induction, if rights conservation and
428-
offer safety hold before, they hold after a safe reallocation.
429-
430-
This is true even though we only re-validate for **seats** whose
431-
allocations change. A reallocation can only effect offer safety for
432-
those **seats**, and since rights are conserved for the change, overall
433-
rights are unchanged.
434-
435-
**zcf.reallocate()** throws this error:
436-
437-
- **reallocating must be done over two or more seats**
438-
439-
```js
440-
sellerSeat.incrementBy(buyerSeat.decrementBy({ Money: providedMoney }));
441-
buyerSeat.incrementBy(sellerSeat.decrementBy({ Items: wantedItems }));
442-
zcf.reallocate(buyerSeat, sellerSeat);
443-
```
444-
445-
**Note**: This method has been deprecated. Use **[atomicRearrange()](./#atomicrearrange-transfers)** instead.
446-
:::

main/reference/zoe-api/zoe-helpers.md

-14
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,6 @@ constraints. If these constraints are all met, then the reallocation happens ato
2727
error is thrown and none of the proposed changes has any effect. The constraints are as follows.
2828

2929
- All the mentioned seats are still live.
30-
- There aren't any outstanding stagings for any of the mentioned seats.
31-
32-
Stagings are a reallocation mechanism that has been
33-
deprecated in favor of this **atomicRearrange()** function.
34-
To prevent confusion, each reallocation can only be
35-
expressed in the old way or the new way, but not a mixture.
36-
3730
- Overall conservation must be maintained. In other words, the reallocated
3831
**[Amounts](/reference/ertp-api/ertp-data-types#amount)** must balance out.
3932
- Offer Safety is preserved for each seat. That means reallocations can only take assets from a seat
@@ -80,13 +73,6 @@ met, then the reallocation happens atomically. Otherwise an error is thrown and
8073
changes has any effect. The constraints are as follows.
8174

8275
- All the mentioned seats are still live.
83-
- There aren't any outstanding stagings for any of the mentioned seats.
84-
85-
Stagings are a reallocation mechanism that has been
86-
deprecated in favor of this **atomicRearrange()** function.
87-
To prevent confusion, each reallocation can only be
88-
expressed in the old way or the new way, but not a mixture.
89-
9076
- Overall conservation must be maintained. In other words, the reallocated
9177
**[Amounts](/reference/ertp-api/ertp-data-types#amount)** must balance out.
9278
- Offer Safety is preserved for each seat. That means reallocations can only take assets from a seat

0 commit comments

Comments
 (0)