@agoric/inter-protocol 0.16.2-dev-35e67be.0 → 0.16.2-dev-9de97ab.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.16.2-dev-35e67be.0+35e67be",
3
+ "version": "0.16.2-dev-9de97ab.0+9de97ab",
4
4
  "description": "Core cryptoeconomy contracts",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -10,7 +10,7 @@
10
10
  "scripts": {
11
11
  "build": "yarn build:bundles",
12
12
  "build:bundles": "node ./scripts/build-bundles.js",
13
- "prepack": "tsc --build jsconfig.build.json",
13
+ "prepack": "tsc --build tsconfig.build.json",
14
14
  "postpack": "git clean -f '*.d.ts*' src/types.js",
15
15
  "test": "ava",
16
16
  "test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
@@ -18,7 +18,7 @@
18
18
  "lint-fix": "yarn lint:eslint --fix",
19
19
  "lint": "run-s --continue-on-error lint:*",
20
20
  "lint:eslint": "eslint .",
21
- "lint:types": "tsc -p jsconfig.json"
21
+ "lint:types": "tsc"
22
22
  },
23
23
  "repository": {
24
24
  "type": "git",
@@ -31,15 +31,16 @@
31
31
  },
32
32
  "homepage": "https://github.com/Agoric/agoric-sdk#readme",
33
33
  "dependencies": {
34
- "@agoric/assert": "0.6.1-dev-35e67be.0+35e67be",
35
- "@agoric/ertp": "0.16.3-dev-35e67be.0+35e67be",
36
- "@agoric/governance": "0.10.4-dev-35e67be.0+35e67be",
37
- "@agoric/internal": "0.3.3-dev-35e67be.0+35e67be",
38
- "@agoric/notifier": "0.6.3-dev-35e67be.0+35e67be",
39
- "@agoric/store": "0.9.3-dev-35e67be.0+35e67be",
40
- "@agoric/time": "0.3.3-dev-35e67be.0+35e67be",
41
- "@agoric/vat-data": "0.5.3-dev-35e67be.0+35e67be",
42
- "@agoric/zoe": "0.26.3-dev-35e67be.0+35e67be",
34
+ "@agoric/assert": "0.6.1-dev-9de97ab.0+9de97ab",
35
+ "@agoric/ertp": "0.16.3-dev-9de97ab.0+9de97ab",
36
+ "@agoric/governance": "0.10.4-dev-9de97ab.0+9de97ab",
37
+ "@agoric/internal": "0.3.3-dev-9de97ab.0+9de97ab",
38
+ "@agoric/notifier": "0.6.3-dev-9de97ab.0+9de97ab",
39
+ "@agoric/store": "0.9.3-dev-9de97ab.0+9de97ab",
40
+ "@agoric/time": "0.3.3-dev-9de97ab.0+9de97ab",
41
+ "@agoric/vat-data": "0.5.3-dev-9de97ab.0+9de97ab",
42
+ "@agoric/vats": "0.15.2-dev-9de97ab.0+9de97ab",
43
+ "@agoric/zoe": "0.26.3-dev-9de97ab.0+9de97ab",
43
44
  "@endo/captp": "^3.1.2",
44
45
  "@endo/eventual-send": "^0.17.3",
45
46
  "@endo/far": "^0.2.19",
@@ -48,11 +49,10 @@
48
49
  "jessie.js": "^0.3.2"
49
50
  },
50
51
  "devDependencies": {
51
- "@agoric/smart-wallet": "0.5.4-dev-35e67be.0+35e67be",
52
- "@agoric/swingset-liveslots": "0.10.3-dev-35e67be.0+35e67be",
53
- "@agoric/swingset-vat": "0.32.3-dev-35e67be.0+35e67be",
54
- "@agoric/vats": "0.15.2-dev-35e67be.0+35e67be",
55
- "@agoric/zone": "0.2.3-dev-35e67be.0+35e67be",
52
+ "@agoric/smart-wallet": "0.5.4-dev-9de97ab.0+9de97ab",
53
+ "@agoric/swingset-liveslots": "0.10.3-dev-9de97ab.0+9de97ab",
54
+ "@agoric/swingset-vat": "0.32.3-dev-9de97ab.0+9de97ab",
55
+ "@agoric/zone": "0.2.3-dev-9de97ab.0+9de97ab",
56
56
  "@endo/bundle-source": "^2.5.2",
57
57
  "@endo/init": "^0.5.57",
58
58
  "@endo/promise-kit": "^0.2.57",
@@ -79,5 +79,5 @@
79
79
  "publishConfig": {
80
80
  "access": "public"
81
81
  },
82
- "gitHead": "35e67bed9eae0896e32b549ad0d1fd02fb83a905"
82
+ "gitHead": "9de97aba9b46e464021f9970abdc0c957e49e3f5"
83
83
  }
@@ -10,7 +10,7 @@ import {
10
10
  import { E } from '@endo/eventual-send';
11
11
  import { Far } from '@endo/marshal';
12
12
  import { isNat, Nat } from '@endo/nat';
13
- import { UnguardedHelperI } from '../typeGuards.js';
13
+ import { UnguardedHelperI } from '@agoric/internal/src/typeGuards.js';
14
14
 
15
15
  const { add, subtract, multiply, floorDivide, ceilDivide, isGTE } = natSafeMath;
16
16
 
@@ -0,0 +1,165 @@
1
+ /** @type {ContractMeta} */
2
+ export const meta: ContractMeta;
3
+ export function start(zcf: ZCF<ProvisionTerms>, privateArgs: {
4
+ poolBank: import('@endo/far').ERef<import('@agoric/vats/src/vat-bank.js').Bank>;
5
+ initialPoserInvitation: Invitation;
6
+ storageNode: StorageNode;
7
+ marshaller: Marshaller;
8
+ metricsOverride?: import("./provisionPoolKit.js").MetricsNotification | undefined;
9
+ }, baggage: import('@agoric/vat-data').Baggage): Promise<{
10
+ creatorFacet: {
11
+ getParamMgrRetriever: () => {
12
+ get: () => import("@agoric/governance/src/contractGovernance/typedParamManager.js").TypedParamManager<{
13
+ PerAccountInitialAmount: "amount";
14
+ } & {
15
+ Electorate: "invitation";
16
+ }>;
17
+ } & import("@endo/eventual-send").RemotableBrand<{}, {
18
+ get: () => import("@agoric/governance/src/contractGovernance/typedParamManager.js").TypedParamManager<{
19
+ PerAccountInitialAmount: "amount";
20
+ } & {
21
+ Electorate: "invitation";
22
+ }>;
23
+ }>;
24
+ getInvitation: (name: any) => Promise<Invitation<R, A>>;
25
+ getLimitedCreatorFacet: () => {
26
+ addRevivableAddresses(oldAddresses: string[]): void;
27
+ getWalletReviver(): {
28
+ reviveWallet(address: string): Promise<{
29
+ handleBridgeAction(actionCapData: import("@endo/marshal").CapData<string>, canSpend?: boolean | undefined): Promise<void>;
30
+ getDepositFacet(): {
31
+ receive(payment: Payment<AssetKind>): Promise<Amount<AssetKind>>;
32
+ };
33
+ getOffersFacet(): {
34
+ executeOffer(offerSpec: import("@agoric/smart-wallet/src/offers.js").OfferSpec): Promise<void>;
35
+ tryExitOffer(offerId: import("@agoric/smart-wallet/src/offers.js").OfferId): Promise<void>;
36
+ };
37
+ getCurrentSubscriber(): Subscriber<import("@agoric/smart-wallet/src/smartWallet.js").CurrentWalletRecord>;
38
+ getUpdatesSubscriber(): Subscriber<import("@agoric/smart-wallet/src/smartWallet.js").UpdateRecord>;
39
+ getPublicTopics(): {
40
+ current: {
41
+ description: string;
42
+ subscriber: Subscriber<import("@agoric/smart-wallet/src/smartWallet.js").CurrentWalletRecord>;
43
+ storagePath: Promise<string>;
44
+ };
45
+ updates: {
46
+ description: string;
47
+ subscriber: Subscriber<import("@agoric/smart-wallet/src/smartWallet.js").UpdateRecord>;
48
+ storagePath: Promise<string>;
49
+ };
50
+ };
51
+ }>;
52
+ ackWallet(address: string): boolean;
53
+ };
54
+ setReferences(erefs: import("./provisionPoolKit.js").ProvisionPoolKitReferences): Promise<void>;
55
+ makeHandler(): {
56
+ fromBridge: (obj: any) => Promise<void>;
57
+ } & import("@endo/eventual-send").RemotableBrand<{}, {
58
+ fromBridge: (obj: any) => Promise<void>;
59
+ }>;
60
+ initPSM(brand: Brand<AssetKind>, instance: import("./provisionPoolKit.js").PsmInstance): void;
61
+ };
62
+ getGovernedApis: () => GovernedApis;
63
+ getGovernedApiNames: () => string[];
64
+ setOfferFilter: (strings: any) => Promise<void>;
65
+ } & import("@endo/eventual-send").RemotableBrand<{}, {
66
+ getParamMgrRetriever: () => {
67
+ get: () => import("@agoric/governance/src/contractGovernance/typedParamManager.js").TypedParamManager<{
68
+ PerAccountInitialAmount: "amount";
69
+ } & {
70
+ Electorate: "invitation";
71
+ }>;
72
+ } & import("@endo/eventual-send").RemotableBrand<{}, {
73
+ get: () => import("@agoric/governance/src/contractGovernance/typedParamManager.js").TypedParamManager<{
74
+ PerAccountInitialAmount: "amount";
75
+ } & {
76
+ Electorate: "invitation";
77
+ }>;
78
+ }>;
79
+ getInvitation: (name: any) => Promise<Invitation<R, A>>;
80
+ getLimitedCreatorFacet: () => {
81
+ addRevivableAddresses(oldAddresses: string[]): void;
82
+ getWalletReviver(): {
83
+ reviveWallet(address: string): Promise<{
84
+ handleBridgeAction(actionCapData: import("@endo/marshal").CapData<string>, canSpend?: boolean | undefined): Promise<void>;
85
+ getDepositFacet(): {
86
+ receive(payment: Payment<AssetKind>): Promise<Amount<AssetKind>>;
87
+ };
88
+ getOffersFacet(): {
89
+ executeOffer(offerSpec: import("@agoric/smart-wallet/src/offers.js").OfferSpec): Promise<void>;
90
+ tryExitOffer(offerId: import("@agoric/smart-wallet/src/offers.js").OfferId): Promise<void>;
91
+ };
92
+ getCurrentSubscriber(): Subscriber<import("@agoric/smart-wallet/src/smartWallet.js").CurrentWalletRecord>;
93
+ getUpdatesSubscriber(): Subscriber<import("@agoric/smart-wallet/src/smartWallet.js").UpdateRecord>;
94
+ getPublicTopics(): {
95
+ current: {
96
+ description: string;
97
+ subscriber: Subscriber<import("@agoric/smart-wallet/src/smartWallet.js").CurrentWalletRecord>;
98
+ storagePath: Promise<string>;
99
+ };
100
+ updates: {
101
+ description: string;
102
+ subscriber: Subscriber<import("@agoric/smart-wallet/src/smartWallet.js").UpdateRecord>;
103
+ storagePath: Promise<string>;
104
+ };
105
+ };
106
+ }>;
107
+ ackWallet(address: string): boolean;
108
+ };
109
+ setReferences(erefs: import("./provisionPoolKit.js").ProvisionPoolKitReferences): Promise<void>;
110
+ makeHandler(): {
111
+ fromBridge: (obj: any) => Promise<void>;
112
+ } & import("@endo/eventual-send").RemotableBrand<{}, {
113
+ fromBridge: (obj: any) => Promise<void>;
114
+ }>;
115
+ initPSM(brand: Brand<AssetKind>, instance: import("./provisionPoolKit.js").PsmInstance): void;
116
+ };
117
+ getGovernedApis: () => GovernedApis;
118
+ getGovernedApiNames: () => string[];
119
+ setOfferFilter: (strings: any) => Promise<void>;
120
+ }>;
121
+ publicFacet: {
122
+ getAmount: (name: string) => Amount<AssetKind>;
123
+ getBrand: (name: string) => Brand<AssetKind>;
124
+ getInstance: (name: string) => Instance;
125
+ getInstallation: (name: string) => Installation<any>;
126
+ getInvitationAmount: (name: string) => Amount<"set">;
127
+ getNat: (name: string) => bigint;
128
+ getRatio: (name: string) => Ratio;
129
+ getString: (name: string) => string;
130
+ getTimestamp: (name: string) => import("@agoric/time/src/types.js").TimestampRecord;
131
+ getRelativeTime: (name: string) => import("@agoric/time/src/types.js").RelativeTimeRecord;
132
+ getUnknown: (name: string) => any;
133
+ getSubscription: () => StoredSubscription<GovernanceSubscriptionState>;
134
+ getGovernedParams: () => ERef<ParamStateRecord>;
135
+ getMetrics(): Subscriber<import("./provisionPoolKit.js").MetricsNotification>;
136
+ getPublicTopics(): {
137
+ metrics: import("@agoric/zoe/src/contractSupport/topics.js").PublicTopic<import("./provisionPoolKit.js").MetricsNotification>;
138
+ };
139
+ } & import("@endo/eventual-send").RemotableBrand<{}, {
140
+ getAmount: (name: string) => Amount<AssetKind>;
141
+ getBrand: (name: string) => Brand<AssetKind>;
142
+ getInstance: (name: string) => Instance;
143
+ getInstallation: (name: string) => Installation<any>;
144
+ getInvitationAmount: (name: string) => Amount<"set">;
145
+ getNat: (name: string) => bigint;
146
+ getRatio: (name: string) => Ratio;
147
+ getString: (name: string) => string;
148
+ getTimestamp: (name: string) => import("@agoric/time/src/types.js").TimestampRecord;
149
+ getRelativeTime: (name: string) => import("@agoric/time/src/types.js").RelativeTimeRecord;
150
+ getUnknown: (name: string) => any;
151
+ getSubscription: () => StoredSubscription<GovernanceSubscriptionState>;
152
+ getGovernedParams: () => ERef<ParamStateRecord>;
153
+ getMetrics(): Subscriber<import("./provisionPoolKit.js").MetricsNotification>;
154
+ getPublicTopics(): {
155
+ metrics: import("@agoric/zoe/src/contractSupport/topics.js").PublicTopic<import("./provisionPoolKit.js").MetricsNotification>;
156
+ };
157
+ }>;
158
+ }>;
159
+ /**
160
+ * TODO: ERef<GovernedCreatorFacet<ProvisionCreator>>
161
+ */
162
+ export type ProvisionTerms = StandardTerms & GovernanceTerms<{
163
+ PerAccountInitialAmount: 'amount';
164
+ }>;
165
+ //# sourceMappingURL=provisionPool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provisionPool.d.ts","sourceRoot":"","sources":["provisionPool.js"],"names":[],"mappings":"AAgBA,2BAA2B;AAC3B,mBADW,YAAY,CAerB;AAqBK,2BAZI,IAAI,cAAc,CAAC;cAEf,OAAO,WAAW,EAAE,IAAI,CACtC,OAAa,8BAA8B,EAAE,IAAI,CAC5C;4BACuB,UAAU;iBACrB,WAAW;gBACZ,UAAU;;YAGhB,OAAO,kBAAkB,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkE5C;;;;6BAjFY,aAAa,GACzB,gBAAoB;IACpB,uBAA6B,EAAE,QAAQ,CAAC;CACnC,CAAC"}
@@ -0,0 +1,119 @@
1
+ // @jessie-check
2
+ // @ts-check
3
+
4
+ import {
5
+ handleParamGovernance,
6
+ ParamTypes,
7
+ publicMixinAPI,
8
+ } from '@agoric/governance';
9
+ import { InvitationShape } from '@agoric/governance/src/typeGuards.js';
10
+ import { M } from '@agoric/store';
11
+ import { prepareExo } from '@agoric/vat-data';
12
+ import { provideSingleton } from '@agoric/zoe/src/contractSupport/durability.js';
13
+ import { prepareRecorderKitMakers } from '@agoric/zoe/src/contractSupport/recorder.js';
14
+ import { TopicsRecordShape } from '@agoric/zoe/src/contractSupport/topics.js';
15
+ import { prepareProvisionPoolKit } from './provisionPoolKit.js';
16
+
17
+ /** @type {ContractMeta} */
18
+ export const meta = {
19
+ privateArgsShape: M.splitRecord(
20
+ {
21
+ poolBank: M.eref(M.remotable('bank')),
22
+ storageNode: M.eref(M.remotable('storageNode')),
23
+ marshaller: M.eref(M.remotable('marshaller')),
24
+ },
25
+ {
26
+ // only necessary on first invocation, not subsequent
27
+ initialPoserInvitation: InvitationShape,
28
+ metricsOverride: M.recordOf(M.string()),
29
+ },
30
+ ),
31
+ upgradability: 'canUpgrade',
32
+ };
33
+ harden(meta);
34
+
35
+ /**
36
+ * @typedef {StandardTerms &
37
+ * GovernanceTerms<{
38
+ * PerAccountInitialAmount: 'amount';
39
+ * }>} ProvisionTerms
40
+ * TODO: ERef<GovernedCreatorFacet<ProvisionCreator>>
41
+ * @param {ZCF<ProvisionTerms>} zcf
42
+ * @param {{
43
+ * poolBank: import('@endo/far').ERef<
44
+ * import('@agoric/vats/src/vat-bank.js').Bank
45
+ * >;
46
+ * initialPoserInvitation: Invitation;
47
+ * storageNode: StorageNode;
48
+ * marshaller: Marshaller;
49
+ * metricsOverride?: import('./provisionPoolKit').MetricsNotification;
50
+ * }} privateArgs
51
+ * @param {import('@agoric/vat-data').Baggage} baggage
52
+ */
53
+ export const start = async (zcf, privateArgs, baggage) => {
54
+ const { poolBank, metricsOverride } = privateArgs;
55
+
56
+ const { makeRecorderKit } = prepareRecorderKitMakers(
57
+ baggage,
58
+ privateArgs.marshaller,
59
+ );
60
+
61
+ // Governance
62
+ const { publicMixin, makeDurableGovernorFacet, params } =
63
+ await handleParamGovernance(
64
+ zcf,
65
+ privateArgs.initialPoserInvitation,
66
+ {
67
+ PerAccountInitialAmount: ParamTypes.AMOUNT,
68
+ },
69
+ privateArgs.storageNode,
70
+ privateArgs.marshaller,
71
+ );
72
+
73
+ const makeProvisionPoolKit = prepareProvisionPoolKit(baggage, {
74
+ makeRecorderKit,
75
+ params,
76
+ poolBank,
77
+ zcf,
78
+ });
79
+
80
+ const provisionPoolKit = await provideSingleton(
81
+ baggage,
82
+ 'provisionPoolKit',
83
+ () =>
84
+ makeProvisionPoolKit({
85
+ // XXX governance can change the brand of the amount but should only be able to change the value
86
+ // NB: changing the brand will break this pool
87
+ poolBrand: params.getPerAccountInitialAmount().brand,
88
+ storageNode: privateArgs.storageNode,
89
+ }),
90
+ kit => kit.helper.start({ metrics: metricsOverride }),
91
+ );
92
+
93
+ const publicFacet = prepareExo(
94
+ baggage,
95
+ 'Provisioning Pool public',
96
+ M.interface('ProvisionPool', {
97
+ getMetrics: M.call().returns(M.remotable('MetricsSubscriber')),
98
+ getPublicTopics: M.call().returns(TopicsRecordShape),
99
+ ...publicMixinAPI,
100
+ }),
101
+ {
102
+ getMetrics() {
103
+ return provisionPoolKit.public.getPublicTopics().metrics.subscriber;
104
+ },
105
+ getPublicTopics() {
106
+ return provisionPoolKit.public.getPublicTopics();
107
+ },
108
+ ...publicMixin,
109
+ },
110
+ );
111
+
112
+ return harden({
113
+ creatorFacet: makeDurableGovernorFacet(baggage, provisionPoolKit.machine)
114
+ .governorFacet,
115
+ publicFacet,
116
+ });
117
+ };
118
+
119
+ harden(start);