@agoric/builders 0.1.1-dev-9f46b37.0 → 0.1.1-dev-fdc566c.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-fdc566c.0+fdc566c",
|
|
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-fdc566c.0+fdc566c",
|
|
27
|
+
"@agoric/fast-usdc": "0.1.1-dev-fdc566c.0+fdc566c",
|
|
28
|
+
"@agoric/internal": "0.3.3-dev-fdc566c.0+fdc566c",
|
|
29
|
+
"@agoric/notifier": "0.6.3-dev-fdc566c.0+fdc566c",
|
|
30
|
+
"@agoric/smart-wallet": "0.5.4-dev-fdc566c.0+fdc566c",
|
|
31
|
+
"@agoric/vat-data": "0.5.3-dev-fdc566c.0+fdc566c",
|
|
32
|
+
"@agoric/vats": "0.15.2-dev-fdc566c.0+fdc566c",
|
|
33
|
+
"@agoric/zoe": "0.26.3-dev-fdc566c.0+fdc566c",
|
|
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-fdc566c.0+fdc566c",
|
|
47
|
+
"@agoric/governance": "0.10.4-dev-fdc566c.0+fdc566c",
|
|
48
|
+
"@agoric/inter-protocol": "0.16.2-dev-fdc566c.0+fdc566c",
|
|
49
|
+
"@agoric/orchestration": "0.1.1-dev-fdc566c.0+fdc566c",
|
|
50
|
+
"@agoric/store": "0.9.3-dev-fdc566c.0+fdc566c",
|
|
51
|
+
"@agoric/swing-store": "0.9.2-dev-fdc566c.0+fdc566c",
|
|
52
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-fdc566c.0+fdc566c",
|
|
53
|
+
"@agoric/time": "0.3.3-dev-fdc566c.0+fdc566c",
|
|
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": 90.93
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "fdc566ceba2386ac9cccd2e095741dcd316b575b"
|
|
87
87
|
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { makeHelpers } from '@agoric/deploy-script-support';
|
|
2
|
+
import { AmountMath } from '@agoric/ertp';
|
|
3
|
+
import { getManifestForDistributeFees } from '@agoric/fast-usdc/src/distribute-fees.core.js';
|
|
4
|
+
import { toExternalConfig } from '@agoric/fast-usdc/src/utils/config-marshal.js';
|
|
5
|
+
import {
|
|
6
|
+
multiplyBy,
|
|
7
|
+
parseRatio,
|
|
8
|
+
} from '@agoric/zoe/src/contractSupport/ratio.js';
|
|
9
|
+
import { Far } from '@endo/far';
|
|
10
|
+
import { parseArgs } from 'node:util';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @import {CoreEvalBuilder, DeployScriptFunction} from '@agoric/deploy-script-support/src/externalTypes.js'
|
|
14
|
+
* @import {FeeDistributionTerms} from '@agoric/fast-usdc/src/distribute-fees.core.js'
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const usage =
|
|
18
|
+
'Use: [--fixedFees <number> | --feePortion <percent>] --destinationAddress <address> ...';
|
|
19
|
+
|
|
20
|
+
const xVatCtx = /** @type {const} */ ({
|
|
21
|
+
/** @type {Brand<'nat'>} */
|
|
22
|
+
USDC: Far('USDC Brand'),
|
|
23
|
+
});
|
|
24
|
+
const { USDC } = xVatCtx;
|
|
25
|
+
const USDC_DECIMALS = 6n;
|
|
26
|
+
const unit = AmountMath.make(USDC, 10n ** USDC_DECIMALS);
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @param {unknown} _utils
|
|
30
|
+
* @param {FeeDistributionTerms} feeTerms
|
|
31
|
+
* @satisfies {CoreEvalBuilder}
|
|
32
|
+
*/
|
|
33
|
+
export const feeProposalBuilder = async (_utils, feeTerms) => {
|
|
34
|
+
return harden({
|
|
35
|
+
sourceSpec: '@agoric/fast-usdc/src/distribute-fees.core.js',
|
|
36
|
+
/** @type {[string, Parameters<typeof getManifestForDistributeFees>[1]]} */
|
|
37
|
+
getManifestCall: [
|
|
38
|
+
getManifestForDistributeFees.name,
|
|
39
|
+
{ options: toExternalConfig(harden({ feeTerms }), xVatCtx) },
|
|
40
|
+
],
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/** @type {DeployScriptFunction} */
|
|
45
|
+
export default async (homeP, endowments) => {
|
|
46
|
+
const { writeCoreEval } = await makeHelpers(homeP, endowments);
|
|
47
|
+
/** @type {{ values: Record<string, string | undefined> }} */
|
|
48
|
+
const {
|
|
49
|
+
values: { destinationAddress, ...opt },
|
|
50
|
+
} = parseArgs({
|
|
51
|
+
args: endowments.scriptArgs,
|
|
52
|
+
options: {
|
|
53
|
+
destinationAddress: { type: 'string' },
|
|
54
|
+
fixedFees: { type: 'string' },
|
|
55
|
+
feePortion: { type: 'string' },
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
if (!destinationAddress) assert.fail(usage);
|
|
59
|
+
if (opt.fixedFees && opt.feePortion) assert.fail(usage);
|
|
60
|
+
|
|
61
|
+
/** @type {FeeDistributionTerms} */
|
|
62
|
+
const feeTerms = {
|
|
63
|
+
destinationAddress,
|
|
64
|
+
...((opt.fixedFees && {
|
|
65
|
+
fixedFees: multiplyBy(unit, parseRatio(opt.fixedFees, USDC)),
|
|
66
|
+
}) ||
|
|
67
|
+
(opt.feePortion && {
|
|
68
|
+
feePortion: parseRatio(opt.feePortion, USDC),
|
|
69
|
+
}) ||
|
|
70
|
+
assert.fail(usage)),
|
|
71
|
+
};
|
|
72
|
+
await writeCoreEval('eval-fast-usdc-fees', utils =>
|
|
73
|
+
feeProposalBuilder(utils, feeTerms),
|
|
74
|
+
);
|
|
75
|
+
};
|