@agoric/inter-protocol 0.13.2-dev-2e33306.0 → 0.13.2-dev-9e33502.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/inter-protocol",
3
- "version": "0.13.2-dev-2e33306.0+2e33306",
3
+ "version": "0.13.2-dev-9e33502.0+9e33502",
4
4
  "description": "Core cryptoeconomy contracts",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -29,16 +29,16 @@
29
29
  },
30
30
  "homepage": "https://github.com/Agoric/agoric-sdk#readme",
31
31
  "dependencies": {
32
- "@agoric/assert": "0.5.2-dev-2e33306.0+2e33306",
33
- "@agoric/ertp": "0.15.4-dev-2e33306.0+2e33306",
34
- "@agoric/governance": "0.9.2-dev-2e33306.0+2e33306",
35
- "@agoric/internal": "0.2.2-dev-2e33306.0+2e33306",
36
- "@agoric/notifier": "0.5.2-dev-2e33306.0+2e33306",
37
- "@agoric/store": "0.8.4-dev-2e33306.0+2e33306",
38
- "@agoric/time": "0.2.2-dev-2e33306.0+2e33306",
39
- "@agoric/vat-data": "0.4.4-dev-2e33306.0+2e33306",
40
- "@agoric/vats": "0.13.1-dev-2e33306.0+2e33306",
41
- "@agoric/zoe": "0.25.4-dev-2e33306.0+2e33306",
32
+ "@agoric/assert": "0.5.2-dev-9e33502.0+9e33502",
33
+ "@agoric/ertp": "0.15.4-dev-9e33502.0+9e33502",
34
+ "@agoric/governance": "0.9.2-dev-9e33502.0+9e33502",
35
+ "@agoric/internal": "0.2.2-dev-9e33502.0+9e33502",
36
+ "@agoric/notifier": "0.5.2-dev-9e33502.0+9e33502",
37
+ "@agoric/store": "0.8.4-dev-9e33502.0+9e33502",
38
+ "@agoric/time": "0.2.2-dev-9e33502.0+9e33502",
39
+ "@agoric/vat-data": "0.4.4-dev-9e33502.0+9e33502",
40
+ "@agoric/vats": "0.13.1-dev-9e33502.0+9e33502",
41
+ "@agoric/zoe": "0.25.4-dev-9e33502.0+9e33502",
42
42
  "@endo/captp": "^2.0.18",
43
43
  "@endo/eventual-send": "^0.16.8",
44
44
  "@endo/far": "^0.2.14",
@@ -46,10 +46,10 @@
46
46
  "@endo/nat": "^4.1.23"
47
47
  },
48
48
  "devDependencies": {
49
- "@agoric/deploy-script-support": "0.9.5-dev-2e33306.0+2e33306",
50
- "@agoric/smart-wallet": "0.4.3-dev-2e33306.0+2e33306",
51
- "@agoric/swingset-liveslots": "0.9.1-dev-2e33306.0+2e33306",
52
- "@agoric/swingset-vat": "0.30.3-dev-2e33306.0+2e33306",
49
+ "@agoric/deploy-script-support": "0.9.5-dev-9e33502.0+9e33502",
50
+ "@agoric/smart-wallet": "0.4.3-dev-9e33502.0+9e33502",
51
+ "@agoric/swingset-liveslots": "0.9.1-dev-9e33502.0+9e33502",
52
+ "@agoric/swingset-vat": "0.30.3-dev-9e33502.0+9e33502",
53
53
  "@endo/bundle-source": "^2.4.2",
54
54
  "@endo/init": "^0.5.52",
55
55
  "@endo/promise-kit": "^0.2.52",
@@ -78,5 +78,5 @@
78
78
  "publishConfig": {
79
79
  "access": "public"
80
80
  },
81
- "gitHead": "2e333069005f63468bfca25b8ee1281ce2aeabbe"
81
+ "gitHead": "9e33502cbd414eb093761423c347bac086035daa"
82
82
  }
@@ -49,28 +49,6 @@ export const allEmpty = amounts => {
49
49
  return amounts.every(a => AmountMath.isEmpty(a));
50
50
  };
51
51
 
52
- /**
53
- * Stage a transfer between `fromSeat` and `toSeat`, specified as the delta between
54
- * the gain and a loss on the `fromSeat`. The gain/loss are typically from the
55
- * give/want respectively of a proposal. The `key` is the allocation keyword.
56
- *
57
- * @deprecated Use atomicRearrange instead
58
- * @param {ZCFSeat} fromSeat
59
- * @param {ZCFSeat} toSeat
60
- * @param {Amount} fromLoses
61
- * @param {Amount} fromGains
62
- * @param {Keyword} key
63
- */
64
- export const stageDelta = (fromSeat, toSeat, fromLoses, fromGains, key) => {
65
- // Must check `isEmpty`; can't subtract `empty` from a missing allocation.
66
- if (!AmountMath.isEmpty(fromLoses)) {
67
- toSeat.incrementBy(fromSeat.decrementBy(harden({ [key]: fromLoses })));
68
- }
69
- if (!AmountMath.isEmpty(fromGains)) {
70
- fromSeat.incrementBy(toSeat.decrementBy(harden({ [key]: fromGains })));
71
- }
72
- };
73
-
74
52
  /**
75
53
  * @param {Amount<'nat'>} debtLimit
76
54
  * @param {Amount<'nat'>} totalDebt
@@ -77,9 +77,7 @@ zoe ->> addCollateralHook: call addCollateralHook
77
77
  addCollateralHook ->> seat: get proposal
78
78
 
79
79
  addCollateralHook ->> addCollateralHook: get Keyword for amountIn brand
80
- addCollateralHook ->> seat: decrementBy amountIn
81
- addCollateralHook ->> collateralSeat: incrementBy collateralKeyword: amountIn
82
- addCollateralHook ->> zcf: reallocate collateralSeat, seat
80
+ addCollateralHook ->> zcf: atomicTransfer amountIn from seat to collateralSeat
83
81
  addCollateralHook ->> seat: seat.exit()
84
82
  seat ->> zoe: added collateral to the reserve
85
83
  zoe ->> caller: return status
@@ -4,7 +4,10 @@ import { bindAllMethods, makeTracer } from '@agoric/internal';
4
4
  import { makePublishKit } from '@agoric/notifier';
5
5
  import { M, matches } from '@agoric/store';
6
6
  import { defineKindMulti } from '@agoric/vat-data';
7
- import { assertProposalShape } from '@agoric/zoe/src/contractSupport/index.js';
7
+ import {
8
+ assertProposalShape,
9
+ atomicRearrange,
10
+ } from '@agoric/zoe/src/contractSupport/index.js';
8
11
  import { ceilMultiplyBy } from '@agoric/zoe/src/contractSupport/ratio.js';
9
12
  import { addSubtract, assertOnlyKeys } from '../contractSupport.js';
10
13
  import { calculateCurrentDebt, reverseInterest } from '../interest-math.js';
@@ -342,15 +345,18 @@ const helperBehavior = {
342
345
  } = seat.getProposal();
343
346
  AmountMath.isGTE(runOffered, currentDebt) ||
344
347
  Fail`Offer ${runOffered} is not sufficient to pay off debt ${currentDebt}`;
345
- vaultSeat.incrementBy(seat.decrementBy(harden({ [KW.Debt]: currentDebt })));
346
- seat.incrementBy(
347
- vaultSeat.decrementBy(
348
- harden({ Attestation: vaultSeat.getAmountAllocated('Attestation') }),
349
- ),
348
+ atomicRearrange(
349
+ zcf,
350
+ harden([
351
+ [seat, vaultSeat, { [KW.Debt]: currentDebt }],
352
+ [
353
+ vaultSeat,
354
+ seat,
355
+ { Attestation: vaultSeat.getAmountAllocated('Attestation') },
356
+ ],
357
+ ]),
350
358
  );
351
359
 
352
- zcf.reallocate(seat, vaultSeat);
353
-
354
360
  manager.burnDebt(currentDebt, vaultSeat);
355
361
  state.open = false;
356
362
  helper.updateDebtSnapshot(AmountMath.makeEmpty(debtBrand));