@@ -10,6 +10,39 @@ The contract instance is launched by **E(Zoe).startInstance()**, and is given ac
10
10
the ** zcf** object during that launch (see [ Contract Requirements] ( /guides/zoe/contract-requirements ) ).
11
11
In the operations below, ** instance** is the handle for the running contract instance.
12
12
13
+
14
+ ## zcf.atomicRearrange(transfers)
15
+
16
+ - ** transfers** : ** Array< ; [ TransferPart] ( ./zoe-data-types#transferpart ) >**
17
+ - Returns: None.
18
+
19
+ Asks Zoe to rearrange the ** [ Allocations] ( ./zoe-data-types#allocation ) ** among the seats mentioned in
20
+ _ transfers_ . _ transfers_ are a set of changes to ** Allocations** that must satisfy several
21
+ constraints. If these constraints are all met, then the reallocation happens atomically. Otherwise an
22
+ error is thrown and none of the proposed changes has any effect. The constraints are as follows.
23
+
24
+ - All the mentioned seats are still live.
25
+ - There aren't any outstanding stagings for any of the mentioned seats.
26
+
27
+ Stagings are a reallocation mechanism that has been
28
+ deprecated in favor of this ** atomicRearrange()** function.
29
+ To prevent confusion, each reallocation can only be
30
+ expressed in the old way or the new way, but not a mixture.
31
+
32
+ - Overall conservation must be maintained. In other words, the reallocated
33
+ ** [ Amounts] ( /reference/ertp-api/ertp-data-types#amount ) ** must balance out.
34
+ - Offer Safety is preserved for each seat. That means reallocations can only take assets from a seat
35
+ as long as either it gets the assets described in the want section of its proposal, or it retains
36
+ all of the assets specified in the give section of the proposal. This constraint applies to each
37
+ seat across the entire atomicRearrangement, not to the individual ** TransferParts** .
38
+
39
+ Note that you can construct the ** TransferParts** that make up the _ transfers_ array manually, or for
40
+ transfers that only include one seat, you can use the helper functions
41
+ ** [ fromOnly()] ( ./zoe-helpers#fromonly-fromseat-fromamounts ) ** and
42
+ ** [ toOnly()] ( ./zoe-helpers#toonly-toseat-toamounts ) ** to create
43
+ ** TransferParts** that only use a subset of the fields.
44
+
45
+
13
46
## zcf.makeZCFMint(keyword, assetKind?, displayInfo?)
14
47
15
48
- ** keyword** : ** [ Keyword] ( ./zoe-data-types#keyword ) **
@@ -411,5 +444,5 @@ buyerSeat.incrementBy(sellerSeat.decrementBy({ Items: wantedItems }));
411
444
zcf .reallocate (buyerSeat, sellerSeat);
412
445
` ` `
413
446
414
- **Note**: This method has been deprecated. Use **[atomicRearrange()](./zoe-helpers #atomicrearrange-zcf -transfers)** instead.
447
+ **Note**: This method has been deprecated. Use **[atomicRearrange()](./#atomicrearrange-transfers)** instead.
415
448
:::
0 commit comments