@@ -130,126 +130,3 @@ It checks whether **newAllocation** fully satisfies
130
130
** proposal.give** (giving a refund) or whether it fully satisfies
131
131
** proposal.want** . Both can be fully satisfied. See the ZoeHelper
132
132
[ ** 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
- :::
0 commit comments