@agoric/builders 0.1.1-dev-3314b25.0 → 0.1.1-dev-cf1d435.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/builders",
|
|
3
|
-
"version": "0.1.1-dev-
|
|
3
|
+
"version": "0.1.1-dev-cf1d435.0+cf1d435",
|
|
4
4
|
"description": "Build scripts for proposals to an Agoric chain",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"author": "Agoric",
|
|
24
24
|
"license": "Apache-2.0",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
27
|
-
"@agoric/fast-usdc": "0.1.1-dev-
|
|
28
|
-
"@agoric/internal": "0.3.3-dev-
|
|
29
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
30
|
-
"@agoric/smart-wallet": "0.5.4-dev-
|
|
31
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
32
|
-
"@agoric/vats": "0.15.2-dev-
|
|
33
|
-
"@agoric/zoe": "0.26.3-dev-
|
|
26
|
+
"@agoric/ertp": "0.16.3-dev-cf1d435.0+cf1d435",
|
|
27
|
+
"@agoric/fast-usdc": "0.1.1-dev-cf1d435.0+cf1d435",
|
|
28
|
+
"@agoric/internal": "0.3.3-dev-cf1d435.0+cf1d435",
|
|
29
|
+
"@agoric/notifier": "0.6.3-dev-cf1d435.0+cf1d435",
|
|
30
|
+
"@agoric/smart-wallet": "0.5.4-dev-cf1d435.0+cf1d435",
|
|
31
|
+
"@agoric/vat-data": "0.5.3-dev-cf1d435.0+cf1d435",
|
|
32
|
+
"@agoric/vats": "0.15.2-dev-cf1d435.0+cf1d435",
|
|
33
|
+
"@agoric/zoe": "0.26.3-dev-cf1d435.0+cf1d435",
|
|
34
34
|
"@endo/bundle-source": "^3.5.0",
|
|
35
35
|
"@endo/captp": "^4.4.3",
|
|
36
36
|
"@endo/eventual-send": "^1.2.8",
|
|
@@ -43,14 +43,14 @@
|
|
|
43
43
|
"import-meta-resolve": "^2.2.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@agoric/deploy-script-support": "0.10.4-dev-
|
|
47
|
-
"@agoric/governance": "0.10.4-dev-
|
|
48
|
-
"@agoric/inter-protocol": "0.16.2-dev-
|
|
49
|
-
"@agoric/orchestration": "0.1.1-dev-
|
|
50
|
-
"@agoric/store": "0.9.3-dev-
|
|
51
|
-
"@agoric/swing-store": "0.9.2-dev-
|
|
52
|
-
"@agoric/swingset-liveslots": "0.10.3-dev-
|
|
53
|
-
"@agoric/time": "0.3.3-dev-
|
|
46
|
+
"@agoric/deploy-script-support": "0.10.4-dev-cf1d435.0+cf1d435",
|
|
47
|
+
"@agoric/governance": "0.10.4-dev-cf1d435.0+cf1d435",
|
|
48
|
+
"@agoric/inter-protocol": "0.16.2-dev-cf1d435.0+cf1d435",
|
|
49
|
+
"@agoric/orchestration": "0.1.1-dev-cf1d435.0+cf1d435",
|
|
50
|
+
"@agoric/store": "0.9.3-dev-cf1d435.0+cf1d435",
|
|
51
|
+
"@agoric/swing-store": "0.9.2-dev-cf1d435.0+cf1d435",
|
|
52
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-cf1d435.0+cf1d435",
|
|
53
|
+
"@agoric/time": "0.3.3-dev-cf1d435.0+cf1d435",
|
|
54
54
|
"@endo/errors": "^1.2.8",
|
|
55
55
|
"ava": "^5.3.0",
|
|
56
56
|
"c8": "^10.1.2"
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"typeCoverage": {
|
|
84
84
|
"atLeast": 89.69
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "cf1d43515a2a014b0b53cf18935eea5136ae73e2"
|
|
87
87
|
}
|
|
@@ -87,8 +87,6 @@ const configurations = {
|
|
|
87
87
|
},
|
|
88
88
|
MAINNET: {
|
|
89
89
|
oracles: {
|
|
90
|
-
DSRV: 'agoric144rrhh4m09mh7aaffhm6xy223ym76gve2x7y78',
|
|
91
|
-
Stakin: 'agoric19d6gnr9fyp6hev4tlrg87zjrzsd5gzr5qlfq2p',
|
|
92
90
|
'01node': 'agoric19uscwxdac6cf6z7d5e26e0jm0lgwstc47cpll8',
|
|
93
91
|
'Simply Staking': 'agoric1krunjcqfrf7la48zrvdfeeqtls5r00ep68mzkr',
|
|
94
92
|
P2P: 'agoric1n4fcxsnkxe4gj6e24naec99hzmc4pjfdccy5nj',
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file register-interchain-bank-assets.js Core Eval
|
|
3
|
+
*
|
|
4
|
+
* Used to populate vbank in testing environments.
|
|
5
|
+
*/
|
|
6
|
+
import { AssetKind } from '@agoric/ertp';
|
|
7
|
+
import { makeTracer } from '@agoric/internal';
|
|
8
|
+
import { E } from '@endo/far';
|
|
9
|
+
import { makeMarshal } from '@endo/marshal';
|
|
10
|
+
|
|
11
|
+
const { Fail } = assert;
|
|
12
|
+
|
|
13
|
+
const trace = makeTracer('RegisterInterchainBankAssets', true);
|
|
14
|
+
|
|
15
|
+
/** @import {Board} from '@agoric/vats'; */
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @typedef {object} InterchainAssetOptions
|
|
19
|
+
* @property {string} denom
|
|
20
|
+
* @property {number} decimalPlaces
|
|
21
|
+
* @property {string} issuerName
|
|
22
|
+
* @property {string} keyword - defaults to `issuerName` if not provided
|
|
23
|
+
* @property {string} [proposedName] - defaults to `issuerName` if not provided
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
// vstorage paths under published.*
|
|
27
|
+
const BOARD_AUX = 'boardAux';
|
|
28
|
+
|
|
29
|
+
const marshalData = makeMarshal(_val => Fail`data only`);
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Make a storage node for auxiliary data for a value on the board.
|
|
33
|
+
*
|
|
34
|
+
* @param {ERef<StorageNode>} chainStorage
|
|
35
|
+
* @param {string} boardId
|
|
36
|
+
*/
|
|
37
|
+
const makeBoardAuxNode = async (chainStorage, boardId) => {
|
|
38
|
+
const boardAux = E(chainStorage).makeChildNode(BOARD_AUX);
|
|
39
|
+
return E(boardAux).makeChildNode(boardId);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* see `publishAgoricBrandsDisplayInfo` {@link @agoric/smart-wallet/proposals/upgrade-walletFactory-proposal.js}
|
|
44
|
+
*
|
|
45
|
+
* @param {ERef<StorageNode>} chainStorage
|
|
46
|
+
* @param {ERef<Board>} board
|
|
47
|
+
* @param {Brand<'nat'>} brand
|
|
48
|
+
*/
|
|
49
|
+
const publishBrandInfo = async (chainStorage, board, brand) => {
|
|
50
|
+
const [boardId, displayInfo, allegedName] = await Promise.all([
|
|
51
|
+
E(board).getId(brand),
|
|
52
|
+
E(brand).getDisplayInfo(),
|
|
53
|
+
E(brand).getAllegedName(),
|
|
54
|
+
]);
|
|
55
|
+
const node = makeBoardAuxNode(chainStorage, boardId);
|
|
56
|
+
const aux = marshalData.toCapData(harden({ allegedName, displayInfo }));
|
|
57
|
+
await E(node).setValue(JSON.stringify(aux));
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @param {BootstrapPowers} powers
|
|
62
|
+
* @param {object} config
|
|
63
|
+
* @param {object} config.options
|
|
64
|
+
* @param {InterchainAssetOptions[]} config.options.assets
|
|
65
|
+
*/
|
|
66
|
+
export const publishInterchainAssets = async (
|
|
67
|
+
{
|
|
68
|
+
consume: {
|
|
69
|
+
agoricNamesAdmin,
|
|
70
|
+
bankManager,
|
|
71
|
+
board,
|
|
72
|
+
chainStorage,
|
|
73
|
+
startUpgradable,
|
|
74
|
+
},
|
|
75
|
+
brand: { produce: produceBrands },
|
|
76
|
+
issuer: { produce: produceIssuers },
|
|
77
|
+
installation: {
|
|
78
|
+
consume: { mintHolder },
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
{ options: { assets } },
|
|
82
|
+
) => {
|
|
83
|
+
trace(`${publishInterchainAssets.name} starting...`);
|
|
84
|
+
trace(assets);
|
|
85
|
+
await null;
|
|
86
|
+
for (const interchainAssetOptions of assets) {
|
|
87
|
+
const {
|
|
88
|
+
denom,
|
|
89
|
+
decimalPlaces,
|
|
90
|
+
issuerName,
|
|
91
|
+
keyword = issuerName,
|
|
92
|
+
proposedName = issuerName,
|
|
93
|
+
} = interchainAssetOptions;
|
|
94
|
+
|
|
95
|
+
trace('interchainAssetOptions', {
|
|
96
|
+
denom,
|
|
97
|
+
decimalPlaces,
|
|
98
|
+
issuerName,
|
|
99
|
+
keyword,
|
|
100
|
+
proposedName,
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
assert.typeof(denom, 'string');
|
|
104
|
+
assert.typeof(decimalPlaces, 'number');
|
|
105
|
+
assert.typeof(keyword, 'string');
|
|
106
|
+
assert.typeof(issuerName, 'string');
|
|
107
|
+
assert.typeof(proposedName, 'string');
|
|
108
|
+
|
|
109
|
+
const terms = {
|
|
110
|
+
keyword: issuerName, // "keyword" is a misnomer in mintHolder terms
|
|
111
|
+
assetKind: AssetKind.NAT,
|
|
112
|
+
displayInfo: {
|
|
113
|
+
decimalPlaces,
|
|
114
|
+
assetKind: AssetKind.NAT,
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
const { creatorFacet: mint, publicFacet: issuer } = await E(
|
|
118
|
+
startUpgradable,
|
|
119
|
+
)({
|
|
120
|
+
installation: mintHolder,
|
|
121
|
+
label: issuerName,
|
|
122
|
+
privateArgs: undefined,
|
|
123
|
+
terms,
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
const brand = await E(issuer).getBrand();
|
|
127
|
+
const kit = /** @type {IssuerKit<'nat'>} */ ({ mint, issuer, brand });
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* `addAssetToVault.js` will register the issuer with the `reserveKit`,
|
|
131
|
+
* but we don't need to do that here.
|
|
132
|
+
*/
|
|
133
|
+
|
|
134
|
+
await Promise.all([
|
|
135
|
+
E(E(agoricNamesAdmin).lookupAdmin('issuer')).update(issuerName, issuer),
|
|
136
|
+
E(E(agoricNamesAdmin).lookupAdmin('brand')).update(issuerName, brand),
|
|
137
|
+
// triggers benign UnhandledPromiseRejection 'Error: keyword "ATOM" must
|
|
138
|
+
// be unique' in provisionPool in testing environments
|
|
139
|
+
E(bankManager).addAsset(denom, issuerName, proposedName, kit),
|
|
140
|
+
]);
|
|
141
|
+
|
|
142
|
+
// publish brands and issuers to Bootstrap space for use in proposals
|
|
143
|
+
produceBrands[keyword].reset();
|
|
144
|
+
produceIssuers[keyword].reset();
|
|
145
|
+
produceBrands[keyword].resolve(brand);
|
|
146
|
+
produceIssuers[keyword].resolve(issuer);
|
|
147
|
+
|
|
148
|
+
// publish brand info / boardAux for offer legibility
|
|
149
|
+
await publishBrandInfo(
|
|
150
|
+
// @ts-expect-error 'Promise<StorageNode | null>' is not assignable to
|
|
151
|
+
// parameter of type 'ERef<StorageNode>'
|
|
152
|
+
chainStorage,
|
|
153
|
+
board,
|
|
154
|
+
brand,
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
trace(`${publishInterchainAssets.name} complete`);
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* @param {unknown} _powers
|
|
162
|
+
* @param {{ assets: InterchainAssetOptions[] }} options
|
|
163
|
+
*/
|
|
164
|
+
export const getManifestCall = (_powers, options) => {
|
|
165
|
+
/** @type {Record<string, true>} */
|
|
166
|
+
const IssuerKws = options.assets.reduce(
|
|
167
|
+
/**
|
|
168
|
+
* @param {Record<string, true>} acc
|
|
169
|
+
* @param {InterchainAssetOptions} assetOptions
|
|
170
|
+
*/
|
|
171
|
+
(acc, { issuerName }) => Object.assign(acc, { [issuerName]: true }),
|
|
172
|
+
{},
|
|
173
|
+
);
|
|
174
|
+
harden(IssuerKws);
|
|
175
|
+
|
|
176
|
+
return {
|
|
177
|
+
manifest: {
|
|
178
|
+
[publishInterchainAssets.name]: {
|
|
179
|
+
consume: {
|
|
180
|
+
agoricNamesAdmin: true,
|
|
181
|
+
bankManager: true,
|
|
182
|
+
board: true,
|
|
183
|
+
chainStorage: true,
|
|
184
|
+
startUpgradable: true,
|
|
185
|
+
},
|
|
186
|
+
brand: {
|
|
187
|
+
produce: IssuerKws,
|
|
188
|
+
},
|
|
189
|
+
issuer: {
|
|
190
|
+
produce: IssuerKws,
|
|
191
|
+
},
|
|
192
|
+
installation: {
|
|
193
|
+
consume: { mintHolder: true },
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
options,
|
|
198
|
+
};
|
|
199
|
+
};
|