@agoric/inter-protocol 0.16.2-other-dev-8f8782b.0 → 0.16.2-other-dev-fbe72e7.0.fbe72e7

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.
Files changed (166) hide show
  1. package/README.md +6 -6
  2. package/package.json +46 -39
  3. package/scripts/build-bundles.js +5 -21
  4. package/src/auction/auctionBook.d.ts +147 -0
  5. package/src/auction/auctionBook.d.ts.map +1 -0
  6. package/src/auction/auctionBook.js +182 -151
  7. package/src/auction/auctionMath.d.ts +17 -0
  8. package/src/auction/auctionMath.d.ts.map +1 -0
  9. package/src/auction/auctionMath.js +81 -0
  10. package/src/auction/auctioneer.d.ts +70 -0
  11. package/src/auction/auctioneer.d.ts.map +1 -0
  12. package/src/auction/auctioneer.js +72 -59
  13. package/src/auction/offerBook.d.ts +46 -0
  14. package/src/auction/offerBook.d.ts.map +1 -0
  15. package/src/auction/offerBook.js +17 -12
  16. package/src/auction/params.d.ts +145 -0
  17. package/src/auction/params.d.ts.map +1 -0
  18. package/src/auction/params.js +11 -9
  19. package/src/auction/scheduleMath.d.ts +5 -0
  20. package/src/auction/scheduleMath.d.ts.map +1 -0
  21. package/src/auction/scheduleMath.js +18 -16
  22. package/src/auction/scheduler.d.ts +50 -0
  23. package/src/auction/scheduler.d.ts.map +1 -0
  24. package/src/auction/scheduler.js +53 -47
  25. package/src/auction/sortedOffers.d.ts +8 -0
  26. package/src/auction/sortedOffers.d.ts.map +1 -0
  27. package/src/auction/sortedOffers.js +10 -9
  28. package/src/auction/util.d.ts +31 -0
  29. package/src/auction/util.d.ts.map +1 -0
  30. package/src/auction/util.js +12 -6
  31. package/src/clientSupport.d.ts +168 -0
  32. package/src/clientSupport.d.ts.map +1 -0
  33. package/src/clientSupport.js +161 -98
  34. package/src/collectFees.d.ts +2 -0
  35. package/src/collectFees.d.ts.map +1 -0
  36. package/src/contractSupport.d.ts +28 -0
  37. package/src/contractSupport.d.ts.map +1 -0
  38. package/src/contractSupport.js +19 -13
  39. package/src/econCommitteeCharter.d.ts +43 -0
  40. package/src/econCommitteeCharter.d.ts.map +1 -0
  41. package/src/econCommitteeCharter.js +25 -20
  42. package/src/feeDistributor.d.ts +224 -0
  43. package/src/feeDistributor.d.ts.map +1 -0
  44. package/src/feeDistributor.js +41 -33
  45. package/src/index.d.ts +2 -0
  46. package/src/index.d.ts.map +1 -0
  47. package/src/index.js +1 -0
  48. package/src/interest-math.d.ts +4 -0
  49. package/src/interest-math.d.ts.map +1 -0
  50. package/src/interest-math.js +5 -1
  51. package/src/interest.d.ts +30 -0
  52. package/src/interest.d.ts.map +1 -0
  53. package/src/interest.js +25 -23
  54. package/src/price/README.md +14 -1
  55. package/src/price/fluxAggregatorContract.d.ts +71 -0
  56. package/src/price/fluxAggregatorContract.d.ts.map +1 -0
  57. package/src/price/fluxAggregatorContract.js +64 -55
  58. package/src/price/fluxAggregatorKit.d.ts +104 -0
  59. package/src/price/fluxAggregatorKit.d.ts.map +1 -0
  60. package/src/price/fluxAggregatorKit.js +55 -42
  61. package/src/price/priceOracleKit.d.ts +39 -0
  62. package/src/price/priceOracleKit.d.ts.map +1 -0
  63. package/src/price/priceOracleKit.js +17 -15
  64. package/src/price/roundsManager.d.ts +204 -0
  65. package/src/price/roundsManager.d.ts.map +1 -0
  66. package/src/price/roundsManager.js +132 -85
  67. package/src/proposals/README.md +2 -3
  68. package/src/proposals/add-auction.js +285 -0
  69. package/src/proposals/addAssetToVault.js +192 -40
  70. package/src/proposals/committee-proposal.js +25 -31
  71. package/src/proposals/core-proposal.js +9 -11
  72. package/src/proposals/deploy-price-feeds.js +341 -0
  73. package/src/proposals/econ-behaviors.js +84 -49
  74. package/src/proposals/price-feed-proposal.js +109 -51
  75. package/src/proposals/replace-fee-distributor.js +198 -0
  76. package/src/proposals/replace-scaledPriceAuthorities.js +124 -0
  77. package/src/proposals/replaceElectorate.js +610 -0
  78. package/src/proposals/startEconCommittee.js +2 -2
  79. package/src/proposals/startPSM.js +44 -29
  80. package/src/proposals/upgrade-scaledPriceAuthorities.js +78 -0
  81. package/src/proposals/upgrade-vaults.js +207 -0
  82. package/src/proposals/utils.d.ts +21 -0
  83. package/src/proposals/utils.d.ts.map +1 -0
  84. package/src/proposals/utils.js +66 -9
  85. package/src/proposals/withdraw-reserve-proposal.js +63 -0
  86. package/src/provisionPool.d.ts +69 -0
  87. package/src/provisionPool.d.ts.map +1 -0
  88. package/src/provisionPool.js +138 -0
  89. package/src/provisionPoolKit.d.ts +129 -0
  90. package/src/provisionPoolKit.d.ts.map +1 -0
  91. package/src/provisionPoolKit.js +608 -0
  92. package/src/psm/psm.d.ts +133 -0
  93. package/src/psm/psm.d.ts.map +1 -0
  94. package/src/psm/psm.js +85 -79
  95. package/src/psm/types-ambient.d.ts +2 -0
  96. package/src/psm/types-ambient.d.ts.map +1 -0
  97. package/src/psm/types-ambient.js +3 -0
  98. package/src/reserve/assetReserve.d.ts +58 -0
  99. package/src/reserve/assetReserve.d.ts.map +1 -0
  100. package/src/reserve/assetReserve.js +42 -34
  101. package/src/reserve/assetReserveKit.d.ts +103 -0
  102. package/src/reserve/assetReserveKit.d.ts.map +1 -0
  103. package/src/reserve/assetReserveKit.js +134 -32
  104. package/src/reserve/params.d.ts +16 -0
  105. package/src/reserve/params.d.ts.map +1 -0
  106. package/src/reserve/params.js +8 -2
  107. package/src/tokens.d.ts +3 -0
  108. package/src/tokens.d.ts.map +1 -0
  109. package/src/tokens.js +5 -0
  110. package/src/vaultFactory/burn.d.ts +2 -0
  111. package/src/vaultFactory/burn.d.ts.map +1 -0
  112. package/src/vaultFactory/burn.js +1 -1
  113. package/src/vaultFactory/liquidation.d.ts +25 -0
  114. package/src/vaultFactory/liquidation.d.ts.map +1 -0
  115. package/src/vaultFactory/liquidation.js +37 -24
  116. package/src/vaultFactory/math.d.ts +11 -0
  117. package/src/vaultFactory/math.d.ts.map +1 -0
  118. package/src/vaultFactory/math.js +11 -10
  119. package/src/vaultFactory/orderedVaultStore.d.ts +94 -0
  120. package/src/vaultFactory/orderedVaultStore.d.ts.map +1 -0
  121. package/src/vaultFactory/orderedVaultStore.js +9 -10
  122. package/src/vaultFactory/params.d.ts +143 -0
  123. package/src/vaultFactory/params.d.ts.map +1 -0
  124. package/src/vaultFactory/params.js +56 -25
  125. package/src/vaultFactory/prioritizedVaults.d.ts +280 -0
  126. package/src/vaultFactory/prioritizedVaults.d.ts.map +1 -0
  127. package/src/vaultFactory/prioritizedVaults.js +7 -4
  128. package/src/vaultFactory/proceeds.d.ts +35 -0
  129. package/src/vaultFactory/proceeds.d.ts.map +1 -0
  130. package/src/vaultFactory/proceeds.js +26 -18
  131. package/src/vaultFactory/storeUtils.d.ts +25 -0
  132. package/src/vaultFactory/storeUtils.d.ts.map +1 -0
  133. package/src/vaultFactory/storeUtils.js +10 -12
  134. package/src/vaultFactory/types-ambient.d.ts +137 -0
  135. package/src/vaultFactory/types-ambient.d.ts.map +1 -0
  136. package/src/vaultFactory/{types.js → types-ambient.js} +47 -44
  137. package/src/vaultFactory/vault.d.ts +344 -0
  138. package/src/vaultFactory/vault.d.ts.map +1 -0
  139. package/src/vaultFactory/vault.js +107 -100
  140. package/src/vaultFactory/vaultDirector.d.ts +347 -0
  141. package/src/vaultFactory/vaultDirector.d.ts.map +1 -0
  142. package/src/vaultFactory/vaultDirector.js +94 -64
  143. package/src/vaultFactory/vaultFactory.d.ts +250 -0
  144. package/src/vaultFactory/vaultFactory.d.ts.map +1 -0
  145. package/src/vaultFactory/vaultFactory.js +56 -33
  146. package/src/vaultFactory/vaultHolder.d.ts +170 -0
  147. package/src/vaultFactory/vaultHolder.d.ts.map +1 -0
  148. package/src/vaultFactory/vaultHolder.js +14 -15
  149. package/src/vaultFactory/vaultKit.d.ts +33 -0
  150. package/src/vaultFactory/vaultKit.d.ts.map +1 -0
  151. package/src/vaultFactory/vaultKit.js +9 -4
  152. package/src/vaultFactory/vaultManager.d.ts +676 -0
  153. package/src/vaultFactory/vaultManager.d.ts.map +1 -0
  154. package/src/vaultFactory/vaultManager.js +286 -167
  155. package/CHANGELOG.md +0 -1041
  156. package/exported.js +0 -2
  157. package/scripts/add-collateral-core.js +0 -112
  158. package/scripts/deploy-contracts.js +0 -100
  159. package/scripts/init-core.js +0 -198
  160. package/scripts/invite-committee-core.js +0 -42
  161. package/scripts/manual-price-feed.js +0 -117
  162. package/scripts/price-feed-core.js +0 -104
  163. package/scripts/start-local-chain.sh +0 -84
  164. package/src/psm/types.js +0 -3
  165. package/src/typeGuards.js +0 -13
  166. package/src/vaultFactory/type-imports.js +0 -4
@@ -1,8 +1,8 @@
1
1
  // @jessie-check
2
2
 
3
3
  /**
4
- * @file calculations specific to the Vault Factory contract
5
- * See also ../interest-math.js
4
+ * @file calculations specific to the Vault Factory contract See also
5
+ * ../interest-math.js
6
6
  */
7
7
 
8
8
  import { AmountMath } from '@agoric/ertp';
@@ -12,13 +12,15 @@ import {
12
12
  ceilMultiplyBy,
13
13
  floorDivideBy,
14
14
  ratioGTE,
15
- } from '@agoric/zoe/src/contractSupport/ratio.js';
15
+ } from '@agoric/ertp/src/ratio.js';
16
16
  import { priceFrom } from '../auction/util.js';
17
17
  import { addSubtract } from '../contractSupport.js';
18
18
 
19
+ /** @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js'; */
20
+
19
21
  /**
20
- * Calculate the minimum collateralization given the liquidation margin and the "padding"
21
- * from that liquidation threshold.
22
+ * Calculate the minimum collateralization given the liquidation margin and the
23
+ * "padding" from that liquidation threshold.
22
24
  *
23
25
  * @param {Ratio} liquidationMargin
24
26
  * @param {Ratio} liquidationPadding
@@ -74,11 +76,10 @@ export const maxDebtForVault = (
74
76
  };
75
77
 
76
78
  /**
77
- * Calculate the fee, the amount to mint and the resulting debt.
78
- * The give and the want together reflect a delta, where typically
79
- * one is zero because they come from the gave/want of an offer
80
- * proposal. If the `want` is zero, the `fee` will also be zero,
81
- * so the simple math works.
79
+ * Calculate the fee, the amount to mint and the resulting debt. The give and
80
+ * the want together reflect a delta, where typically one is zero because they
81
+ * come from the gave/want of an offer proposal. If the `want` is zero, the
82
+ * `fee` will also be zero, so the simple math works.
82
83
  *
83
84
  * @param {Amount<'nat'>} currentDebt
84
85
  * @param {Amount<'nat'>} give excess of currentDebt is returned in 'surplus'
@@ -0,0 +1,94 @@
1
+ export function makeOrderedVaultStore(store: MapStore<string, Vault>): {
2
+ addVault: (vaultId: string, vault: Vault) => string;
3
+ removeByKey: (key: string) => Vault;
4
+ has: (key: string) => boolean;
5
+ keys: (keyPatt?: Pattern, valuePatt?: Pattern) => Iterable<string>;
6
+ entries: (keyPatt?: Pattern, valuePatt?: Pattern) => Iterable<[string, import("@endo/exo").Guarded<{
7
+ getVaultSeat(): globalThis.ZCFSeat;
8
+ initVaultKit(seat: ZCFSeat, storageNode: StorageNode): Promise<{
9
+ publicSubscribers: {
10
+ vault: {
11
+ description: string;
12
+ subscriber: globalThis.Subscriber<VaultNotification>;
13
+ storagePath: Promise<string>;
14
+ };
15
+ };
16
+ invitationMakers: import("@endo/exo").Guarded<{
17
+ AdjustBalances(): Promise<globalThis.Invitation<string, undefined>>;
18
+ CloseVault(): Promise<globalThis.Invitation<string, undefined>>;
19
+ TransferVault(): Promise<globalThis.Invitation</*elided*/ any>>;
20
+ }>;
21
+ vault: import("@endo/exo").Guarded<{
22
+ getPublicTopics(): {
23
+ vault: {
24
+ description: string;
25
+ subscriber: globalThis.Subscriber<VaultNotification>;
26
+ storagePath: Promise<string>;
27
+ };
28
+ };
29
+ makeAdjustBalancesInvitation(): Promise<globalThis.Invitation<string, undefined>>;
30
+ makeCloseInvitation(): Promise<globalThis.Invitation<string, undefined>>;
31
+ makeTransferInvitation(): Promise<globalThis.Invitation</*elided*/ any>>;
32
+ getCollateralAmount(): import("@agoric/ertp").NatAmount;
33
+ getCurrentDebt(): import("@agoric/ertp").NatAmount;
34
+ getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
35
+ }>;
36
+ vaultUpdater: import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<VaultNotification>;
37
+ }>;
38
+ liquidating(): void;
39
+ liquidated(): void;
40
+ abortLiquidation(): string;
41
+ makeAdjustBalancesInvitation(): Promise<globalThis.Invitation<string, undefined>>;
42
+ makeCloseInvitation(): Promise<globalThis.Invitation<string, undefined>>;
43
+ makeTransferInvitation(): Promise<Invitation<VaultKit>>;
44
+ getCollateralAmount(): Amount<"nat">;
45
+ getCurrentDebt(): Amount<"nat">;
46
+ getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
47
+ }>]>;
48
+ getSize: (keyPatt?: Pattern, valuePatt?: Pattern) => number;
49
+ values: (keyPatt?: Pattern, valuePatt?: Pattern) => Iterable<import("@endo/exo").Guarded<{
50
+ getVaultSeat(): globalThis.ZCFSeat;
51
+ initVaultKit(seat: ZCFSeat, storageNode: StorageNode): Promise<{
52
+ publicSubscribers: {
53
+ vault: {
54
+ description: string;
55
+ subscriber: globalThis.Subscriber<VaultNotification>;
56
+ storagePath: Promise<string>;
57
+ };
58
+ };
59
+ invitationMakers: import("@endo/exo").Guarded<{
60
+ AdjustBalances(): Promise<globalThis.Invitation<string, undefined>>;
61
+ CloseVault(): Promise<globalThis.Invitation<string, undefined>>;
62
+ TransferVault(): Promise<globalThis.Invitation</*elided*/ any>>;
63
+ }>;
64
+ vault: import("@endo/exo").Guarded<{
65
+ getPublicTopics(): {
66
+ vault: {
67
+ description: string;
68
+ subscriber: globalThis.Subscriber<VaultNotification>;
69
+ storagePath: Promise<string>;
70
+ };
71
+ };
72
+ makeAdjustBalancesInvitation(): Promise<globalThis.Invitation<string, undefined>>;
73
+ makeCloseInvitation(): Promise<globalThis.Invitation<string, undefined>>;
74
+ makeTransferInvitation(): Promise<globalThis.Invitation</*elided*/ any>>;
75
+ getCollateralAmount(): import("@agoric/ertp").NatAmount;
76
+ getCurrentDebt(): import("@agoric/ertp").NatAmount;
77
+ getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
78
+ }>;
79
+ vaultUpdater: import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<VaultNotification>;
80
+ }>;
81
+ liquidating(): void;
82
+ liquidated(): void;
83
+ abortLiquidation(): string;
84
+ makeAdjustBalancesInvitation(): Promise<globalThis.Invitation<string, undefined>>;
85
+ makeCloseInvitation(): Promise<globalThis.Invitation<string, undefined>>;
86
+ makeTransferInvitation(): Promise<Invitation<VaultKit>>;
87
+ getCollateralAmount(): Amount<"nat">;
88
+ getCurrentDebt(): Amount<"nat">;
89
+ getNormalizedDebt(): import("./storeUtils.js").NormalizedDebt;
90
+ }>>;
91
+ };
92
+ import type { Vault } from './vault.js';
93
+ import type { MapStore } from '@agoric/store';
94
+ //# sourceMappingURL=orderedVaultStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orderedVaultStore.d.ts","sourceRoot":"","sources":["orderedVaultStore.js"],"names":[],"mappings":"AAmBO,6CADK,SAAS,MAAM,EAAE,KAAK,CAAC;wBAGtB,MAAM,SACN,KAAK;uBAWL,MAAM,KACJ,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCnB;2BApDuB,YAAY;8BADT,eAAe"}
@@ -3,22 +3,22 @@ import { fromVaultKey, toVaultKey } from './storeUtils.js';
3
3
  /**
4
4
  * Used by prioritizedVaults to wrap the Collections API for this use case.
5
5
  *
6
- * Designed to be replaceable by naked Collections API when composite keys are available.
6
+ * Designed to be replaceable by naked Collections API when composite keys are
7
+ * available.
7
8
  *
8
- * In this module debts are encoded as the inverse quotient (collateral over debt) so that
9
- * greater collateralization sorts after lower. (Higher debt-to-collateral come
10
- * first.)
9
+ * In this module debts are encoded as the inverse quotient (collateral over
10
+ * debt) so that greater collateralization sorts after lower. (Higher
11
+ * debt-to-collateral come first.)
11
12
  */
12
13
 
13
- /** @typedef {import('./vault').Vault} Vault */
14
- /** @typedef {import('./storeUtils').CompositeKey} CompositeKey */
15
-
16
14
  /**
17
- * @param {MapStore<string, Vault>} store
15
+ * @import {MapStore} from '@agoric/store';
16
+ * @import {Vault} from './vault.js';
18
17
  */
18
+
19
+ /** @param {MapStore<string, Vault>} store */
19
20
  export const makeOrderedVaultStore = store => {
20
21
  /**
21
- *
22
22
  * @param {string} vaultId
23
23
  * @param {Vault} vault
24
24
  */
@@ -31,7 +31,6 @@ export const makeOrderedVaultStore = store => {
31
31
  };
32
32
 
33
33
  /**
34
- *
35
34
  * @param {string} key
36
35
  * @returns {Vault}
37
36
  */
@@ -0,0 +1,143 @@
1
+ /**
2
+ * @import {MapStore} from '@agoric/store';
3
+ * @import {PriceAuthority} from '@agoric/zoe/tools/types.js';
4
+ */
5
+ export const CHARGING_PERIOD_KEY: "ChargingPeriod";
6
+ export const RECORDING_PERIOD_KEY: "RecordingPeriod";
7
+ export const DEBT_LIMIT_KEY: "DebtLimit";
8
+ export const LIQUIDATION_MARGIN_KEY: "LiquidationMargin";
9
+ export const LIQUIDATION_PADDING_KEY: "LiquidationPadding";
10
+ export const LIQUIDATION_PENALTY_KEY: "LiquidationPenalty";
11
+ export const INTEREST_RATE_KEY: "InterestRate";
12
+ export const MINT_FEE_KEY: "MintFee";
13
+ export const MIN_INITIAL_DEBT_KEY: "MinInitialDebt";
14
+ export const SHORTFALL_INVITATION_KEY: "ShortfallInvitation";
15
+ export const REFERENCED_UI_KEY: "ReferencedUI";
16
+ export namespace vaultDirectorParamTypes {
17
+ let MinInitialDebt: "amount";
18
+ let ChargingPeriod: "nat";
19
+ let RecordingPeriod: "nat";
20
+ let ReferencedUI: "string";
21
+ }
22
+ export function makeVaultParamManager(publisherKit: import("@agoric/notifier").StoredPublisherKit<GovernanceSubscriptionState>, { debtLimit, interestRate, liquidationMargin, liquidationPadding, liquidationPenalty, mintFee, }: VaultManagerParamValues): import("@agoric/governance/src/contractGovernance/typedParamManager.js").TypedParamManager<{
23
+ DebtLimit: "amount";
24
+ InterestRate: "ratio";
25
+ LiquidationPadding: "ratio";
26
+ LiquidationMargin: "ratio";
27
+ LiquidationPenalty: "ratio";
28
+ MintFee: "ratio";
29
+ }>;
30
+ /** @typedef {ReturnType<typeof makeVaultParamManager>} VaultParamManager */
31
+ export const vaultParamPattern: import("@endo/patterns").Matcher;
32
+ export function makeGovernedTerms({ bootstrapPaymentValue, electorateInvitationAmount, interestTiming, minInitialDebt, priceAuthority, reservePublicFacet, timer, shortfallInvitationAmount, referencedUi, }: {
33
+ electorateInvitationAmount: Amount<"set">;
34
+ minInitialDebt: Amount<"nat">;
35
+ bootstrapPaymentValue: bigint;
36
+ priceAuthority: ERef<PriceAuthority>;
37
+ timer: ERef<import("@agoric/time").TimerService>;
38
+ reservePublicFacet: AssetReservePublicFacet;
39
+ interestTiming: InterestTiming;
40
+ shortfallInvitationAmount: Amount<"set">;
41
+ referencedUi?: string;
42
+ }): {
43
+ priceAuthority: globalThis.ERef<PriceAuthority>;
44
+ reservePublicFacet: globalThis.GovernedPublicFacet<import("@endo/exo").Guarded<{
45
+ makeAddCollateralInvitation(): Promise<globalThis.Invitation<string, never>>;
46
+ getPublicTopics(): {
47
+ metrics: import("@agoric/zoe/src/contractSupport/topics.js").PublicTopic<import("../reserve/assetReserveKit.js").MetricsNotification>;
48
+ };
49
+ }>>;
50
+ timerService: globalThis.ERef<import("@agoric/time").TimerService>;
51
+ governedParams: {
52
+ Electorate: {
53
+ type: "invitation";
54
+ value: import("@agoric/ertp").SetAmount<import("@endo/patterns").Key>;
55
+ };
56
+ MinInitialDebt: {
57
+ type: "amount";
58
+ value: import("@agoric/ertp").NatAmount;
59
+ };
60
+ ShortfallInvitation: {
61
+ type: "invitation";
62
+ value: import("@agoric/ertp").SetAmount<import("@endo/patterns").Key>;
63
+ };
64
+ ReferencedUI: {
65
+ type: "string";
66
+ value: string;
67
+ };
68
+ ChargingPeriod: {
69
+ type: "nat";
70
+ value: bigint;
71
+ };
72
+ RecordingPeriod: {
73
+ type: "nat";
74
+ value: bigint;
75
+ };
76
+ };
77
+ bootstrapPaymentValue: bigint;
78
+ };
79
+ export function provideVaultParamManagers(baggage: import("@agoric/vat-data").Baggage, marshaller: ERef<Marshaller>, managerParamOverrides: Record<string, VaultManagerParamOverrides>): {
80
+ /**
81
+ * @param {Brand} brand
82
+ * @param {StorageNode} storageNode
83
+ * @param {VaultManagerParamValues} initialParamValues
84
+ */
85
+ addParamManager(brand: Brand, storageNode: StorageNode, initialParamValues: VaultManagerParamValues): import("@agoric/governance/src/contractGovernance/typedParamManager.js").TypedParamManager<{
86
+ DebtLimit: "amount";
87
+ InterestRate: "ratio";
88
+ LiquidationPadding: "ratio";
89
+ LiquidationMargin: "ratio";
90
+ LiquidationPenalty: "ratio";
91
+ MintFee: "ratio";
92
+ }>;
93
+ /** @param {Brand} brand */
94
+ get(brand: Brand): import("@agoric/governance/src/contractGovernance/typedParamManager.js").TypedParamManager<{
95
+ DebtLimit: "amount";
96
+ InterestRate: "ratio";
97
+ LiquidationPadding: "ratio";
98
+ LiquidationMargin: "ratio";
99
+ LiquidationPenalty: "ratio";
100
+ MintFee: "ratio";
101
+ }>;
102
+ };
103
+ export type VaultDirectorParams = import("@agoric/governance/src/contractGovernance/typedParamManager.js").ParamTypesMapFromRecord<ReturnType<typeof makeVaultDirectorParams>>;
104
+ export type VaultParamManager = ReturnType<typeof makeVaultParamManager>;
105
+ export type VaultManagerParamOverrides = VaultManagerParamValues & {
106
+ brand: Brand;
107
+ };
108
+ import type { PriceAuthority } from '@agoric/zoe/tools/types.js';
109
+ /**
110
+ * @param {Amount<'set'>} electorateInvitationAmount
111
+ * @param {Amount<'nat'>} minInitialDebt
112
+ * @param {Amount<'set'>} shortfallInvitationAmount
113
+ * @param {string} referencedUi
114
+ * @param {InterestTiming} interestTiming
115
+ */
116
+ declare function makeVaultDirectorParams(electorateInvitationAmount: Amount<"set">, minInitialDebt: Amount<"nat">, shortfallInvitationAmount: Amount<"set">, referencedUi: string, interestTiming: InterestTiming): {
117
+ Electorate: {
118
+ type: "invitation";
119
+ value: import("@agoric/ertp").SetAmount<import("@endo/patterns").Key>;
120
+ };
121
+ MinInitialDebt: {
122
+ type: "amount";
123
+ value: import("@agoric/ertp").NatAmount;
124
+ };
125
+ ShortfallInvitation: {
126
+ type: "invitation";
127
+ value: import("@agoric/ertp").SetAmount<import("@endo/patterns").Key>;
128
+ };
129
+ ReferencedUI: {
130
+ type: "string";
131
+ value: string;
132
+ };
133
+ ChargingPeriod: {
134
+ type: "nat";
135
+ value: bigint;
136
+ };
137
+ RecordingPeriod: {
138
+ type: "nat";
139
+ value: bigint;
140
+ };
141
+ };
142
+ export {};
143
+ //# sourceMappingURL=params.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"params.d.ts","sourceRoot":"","sources":["params.js"],"names":[],"mappings":"AAiBA;;;GAGG;AAEH,kCAAmC,gBAAgB,CAAC;AACpD,mCAAoC,iBAAiB,CAAC;AAEtD,6BAA8B,WAAW,CAAC;AAC1C,qCAAsC,mBAAmB,CAAC;AAC1D,sCAAuC,oBAAoB,CAAC;AAC5D,sCAAuC,oBAAoB,CAAC;AAC5D,gCAAiC,cAAc,CAAC;AAChD,2BAA4B,SAAS,CAAC;AACtC,mCAAoC,gBAAgB,CAAC;AACrD,uCAAwC,qBAAqB,CAAC;AAC9D,gCAAiC,cAAc,CAAC;;;;;;;AAkEzC,oDAHI,OAAO,kBAAkB,EAAE,kBAAkB,CAAC,2BAA2B,CAAC,oGAC1E,uBAAuB;;;;;;;GAoB9B;AACJ,4EAA4E;AAE5E,iEAYE;AAeK,8MAZI;IACN,0BAA0B,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC1C,cAAc,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IACrC,KAAK,EAAE,IAAI,CAAC,OAAO,cAAc,EAAE,YAAY,CAAC,CAAC;IACjD,kBAAkB,EAAE,uBAAuB,CAAC;IAC5C,cAAc,EAAE,cAAc,CAAC;IAC/B,yBAAyB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACzC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BH;AAeM,mDAJI,OAAO,kBAAkB,EAAE,OAAO,cAClC,IAAI,CAAC,UAAU,CAAC,yBAChB,MAAM,CAAC,MAAM,EAAE,0BAA0B,CAAC;IA+CjD;;;;OAIG;2BAHQ,KAAK,eACL,WAAW,sBACX,uBAAuB;;;;;;;;IAOlC,2BAA2B;eAAf,KAAK;;;;;;;;EAKpB;kCAhKY,OAAO,gEAAgE,EAAE,uBAAuB,CACtG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAC3C;gCA8BQ,UAAU,CAAC,OAAO,qBAAqB,CAAC;yCAwDxC,uBAAuB,GAAG;IAAE,KAAK,EAAE,KAAK,CAAA;CAAE;oCA3JvB,4BAA4B;AA0B7D;;;;;;GAMG;AACH,qEANW,MAAM,CAAC,KAAK,CAAC,kBACb,MAAM,CAAC,KAAK,CAAC,6BACb,MAAM,CAAC,KAAK,CAAC,gBACb,MAAM,kBACN,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;EAgCxB"}
@@ -1,6 +1,6 @@
1
1
  // @jessie-check
2
2
 
3
- import './types.js';
3
+ /// <reference path="./types-ambient.js" />
4
4
 
5
5
  import {
6
6
  CONTRACT_ELECTORATE,
@@ -11,9 +11,15 @@ import { makeStoredPublisherKit } from '@agoric/notifier';
11
11
  import { M, makeScalarMapStore } from '@agoric/store';
12
12
  import { TimeMath } from '@agoric/time';
13
13
  import { provideDurableMapStore } from '@agoric/vat-data';
14
- import { subtractRatios } from '@agoric/zoe/src/contractSupport/ratio.js';
14
+ import { subtractRatios } from '@agoric/ertp/src/ratio.js';
15
+ import { makeTracer } from '@agoric/internal/src/index.js';
15
16
  import { amountPattern, ratioPattern } from '../contractSupport.js';
16
17
 
18
+ /**
19
+ * @import {MapStore} from '@agoric/store';
20
+ * @import {PriceAuthority} from '@agoric/zoe/tools/types.js';
21
+ */
22
+
17
23
  export const CHARGING_PERIOD_KEY = 'ChargingPeriod';
18
24
  export const RECORDING_PERIOD_KEY = 'RecordingPeriod';
19
25
 
@@ -35,6 +41,8 @@ export const vaultDirectorParamTypes = {
35
41
  };
36
42
  harden(vaultDirectorParamTypes);
37
43
 
44
+ const trace = makeTracer('Vault Params');
45
+
38
46
  /**
39
47
  * @param {Amount<'set'>} electorateInvitationAmount
40
48
  * @param {Amount<'nat'>} minInitialDebt
@@ -75,7 +83,11 @@ const makeVaultDirectorParams = (
75
83
  };
76
84
  harden(makeVaultDirectorParams);
77
85
 
78
- /** @typedef {import('@agoric/governance/src/contractGovernance/typedParamManager').ParamTypesMapFromRecord<ReturnType<typeof makeVaultDirectorParams>>} VaultDirectorParams */
86
+ /**
87
+ * @typedef {import('@agoric/governance/src/contractGovernance/typedParamManager.js').ParamTypesMapFromRecord<
88
+ * ReturnType<typeof makeVaultDirectorParams>
89
+ * >} VaultDirectorParams
90
+ */
79
91
 
80
92
  /** @type {(liquidationMargin: Ratio) => Ratio} */
81
93
  const zeroRatio = liquidationMargin =>
@@ -122,20 +134,18 @@ export const vaultParamPattern = M.splitRecord(
122
134
 
123
135
  /**
124
136
  * @param {{
125
- * auctioneerPublicFacet: ERef<AuctioneerPublicFacet>,
126
- * electorateInvitationAmount: Amount<'set'>,
127
- * minInitialDebt: Amount<'nat'>,
128
- * bootstrapPaymentValue: bigint,
129
- * priceAuthority: ERef<PriceAuthority>,
130
- * timer: ERef<import('@agoric/time/src/types').TimerService>,
131
- * reservePublicFacet: AssetReservePublicFacet,
132
- * interestTiming: InterestTiming,
133
- * shortfallInvitationAmount: Amount<'set'>,
134
- * referencedUi?: string,
137
+ * electorateInvitationAmount: Amount<'set'>;
138
+ * minInitialDebt: Amount<'nat'>;
139
+ * bootstrapPaymentValue: bigint;
140
+ * priceAuthority: ERef<PriceAuthority>;
141
+ * timer: ERef<import('@agoric/time').TimerService>;
142
+ * reservePublicFacet: AssetReservePublicFacet;
143
+ * interestTiming: InterestTiming;
144
+ * shortfallInvitationAmount: Amount<'set'>;
145
+ * referencedUi?: string;
135
146
  * }} opts
136
147
  */
137
148
  export const makeGovernedTerms = ({
138
- auctioneerPublicFacet,
139
149
  bootstrapPaymentValue,
140
150
  electorateInvitationAmount,
141
151
  interestTiming,
@@ -147,7 +157,6 @@ export const makeGovernedTerms = ({
147
157
  referencedUi = 'NO REFERENCE',
148
158
  }) => {
149
159
  return harden({
150
- auctioneerPublicFacet,
151
160
  priceAuthority,
152
161
  reservePublicFacet,
153
162
  timerService: timer,
@@ -162,21 +171,34 @@ export const makeGovernedTerms = ({
162
171
  });
163
172
  };
164
173
  harden(makeGovernedTerms);
174
+
175
+ /** @typedef {VaultManagerParamValues & { brand: Brand }} VaultManagerParamOverrides */
176
+
165
177
  /**
166
- * Stop-gap which restores initial param values
167
- * UNTIL https://github.com/Agoric/agoric-sdk/issues/5200
178
+ * Stop-gap which restores initial param values UNTIL
179
+ * https://github.com/Agoric/agoric-sdk/issues/5200
168
180
  *
169
181
  * NB: changes from initial values will be lost upon restart
170
182
  *
171
183
  * @param {import('@agoric/vat-data').Baggage} baggage
172
184
  * @param {ERef<Marshaller>} marshaller
185
+ * @param {Record<string, VaultManagerParamOverrides>} managerParamOverrides
173
186
  */
174
- export const provideVaultParamManagers = (baggage, marshaller) => {
187
+ export const provideVaultParamManagers = (
188
+ baggage,
189
+ marshaller,
190
+ managerParamOverrides,
191
+ ) => {
175
192
  /** @type {MapStore<Brand, VaultParamManager>} */
176
193
  const managers = makeScalarMapStore();
177
194
 
178
195
  // the managers aren't durable but their arguments are
179
- /** @type {MapStore<Brand, {storageNode: StorageNode, initialParamValues: VaultManagerParamValues}>} */
196
+ /**
197
+ * @type {MapStore<
198
+ * Brand,
199
+ * { storageNode: StorageNode; initialParamValues: VaultManagerParamValues }
200
+ * >}
201
+ */
180
202
  const managerArgs = provideDurableMapStore(
181
203
  baggage,
182
204
  'vault param manager parts',
@@ -191,12 +213,23 @@ export const provideVaultParamManagers = (baggage, marshaller) => {
191
213
  return manager;
192
214
  };
193
215
 
194
- // restore from baggage
195
- [...managerArgs.entries()].map(([brand, args]) => makeManager(brand, args));
216
+ // restore from baggage, unless `managerParamOverrides` overrides.
217
+ for (const [brand, args] of managerArgs.entries()) {
218
+ const newInitial = managerParamOverrides
219
+ ? Object.values(managerParamOverrides).find(e => e.brand === brand)
220
+ : undefined;
221
+
222
+ if (newInitial) {
223
+ trace(`reviving params, override`, brand, newInitial);
224
+ makeManager(brand, { ...args, initialParamValues: newInitial });
225
+ } else {
226
+ trace(`reviving params, keeping`, brand, args.initialParamValues);
227
+ makeManager(brand, args);
228
+ }
229
+ }
196
230
 
197
231
  return {
198
232
  /**
199
- *
200
233
  * @param {Brand} brand
201
234
  * @param {StorageNode} storageNode
202
235
  * @param {VaultManagerParamValues} initialParamValues
@@ -206,9 +239,7 @@ export const provideVaultParamManagers = (baggage, marshaller) => {
206
239
  managerArgs.init(brand, args);
207
240
  return makeManager(brand, args);
208
241
  },
209
- /**
210
- * @param {Brand} brand
211
- */
242
+ /** @param {Brand} brand */
212
243
  get(brand) {
213
244
  return managers.get(brand);
214
245
  },