@agoric/fast-usdc 0.1.1-other-dev-3eb1a1d.0 → 0.1.1-other-dev-d15096d.0.d15096d
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/README.md +162 -36
- package/package.json +39 -38
- package/src/cli/bridge-action.js +41 -0
- package/src/cli/cli.js +47 -154
- package/src/cli/config-commands.js +108 -0
- package/src/cli/config.js +15 -9
- package/src/cli/lp-commands.js +161 -0
- package/src/cli/operator-commands.js +143 -0
- package/src/cli/transfer.js +84 -23
- package/src/cli/util/agoric.js +11 -0
- package/src/cli/util/bank.js +12 -0
- package/src/{util → cli/util}/cctp.js +1 -1
- package/src/{util → cli/util}/file.js +1 -1
- package/src/clientSupport.js +101 -0
- package/src/constants.js +29 -6
- package/src/main.js +1 -0
- package/src/operator-kit-interface.js +29 -0
- package/src/pool-share-math.js +72 -34
- package/src/type-guards.js +122 -34
- package/src/types.ts +136 -15
- package/src/utils/fees.js +105 -20
- package/tools/cli-tools.ts +9 -0
- package/tools/mock-evidence.ts +205 -0
- package/tools/mock-io.ts +14 -0
- package/src/exos/README.md +0 -26
- package/src/exos/advancer.js +0 -255
- package/src/exos/liquidity-pool.js +0 -365
- package/src/exos/operator-kit.js +0 -120
- package/src/exos/settler.js +0 -97
- package/src/exos/status-manager.js +0 -176
- package/src/exos/transaction-feed.js +0 -180
- package/src/fast-usdc.contract.js +0 -235
- package/src/fast-usdc.flows.js +0 -13
- package/src/fast-usdc.start.js +0 -284
- package/src/util/agoric.js +0 -12
- package/src/utils/address.js +0 -71
- package/src/utils/config-marshal.js +0 -130
- package/src/utils/zoe.js +0 -28
- /package/src/{util → cli/util}/noble.js +0 -0
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { Fail } from '@endo/errors';
|
|
2
|
-
import { makeMarshal } from '@endo/marshal';
|
|
3
|
-
import { mustMatch } from '@endo/patterns';
|
|
4
|
-
|
|
5
|
-
// TODO(#7309): move to make available beyond fast-usdc.
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @import {Marshal, CapData, Passable} from '@endo/marshal';
|
|
9
|
-
* @import { RemotableBrand } from '@endo/eventual-send';
|
|
10
|
-
* @import {TypedPattern} from '@agoric/internal'
|
|
11
|
-
*/
|
|
12
|
-
const { entries } = Object;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* To configure amounts such as terms or ratios,
|
|
16
|
-
* we need to refer to objects such as brands.
|
|
17
|
-
*
|
|
18
|
-
* If parties agree on names, any party that doesn't have
|
|
19
|
-
* an actual presence for an object can make one up:
|
|
20
|
-
*
|
|
21
|
-
* const remotes = { USDC: Far('USDC Brand') };
|
|
22
|
-
*
|
|
23
|
-
* and use it in local computation:
|
|
24
|
-
*
|
|
25
|
-
* const terms = { fee1: AmountMath.make(remotes.USDC, 1234n) }
|
|
26
|
-
*
|
|
27
|
-
* Then we can pass references across using marshal conventions, using
|
|
28
|
-
* the names as slots.
|
|
29
|
-
*
|
|
30
|
-
* @param {Record<string, Passable>} slotToVal a record that gives names to stand-ins for objects in another vat
|
|
31
|
-
* @returns {Marshal<string>}
|
|
32
|
-
*/
|
|
33
|
-
export const makeMarshalFromRecord = slotToVal => {
|
|
34
|
-
const convertSlotToVal = slot => {
|
|
35
|
-
slot in slotToVal || Fail`unknown slot ${slot}`;
|
|
36
|
-
return slotToVal[slot];
|
|
37
|
-
};
|
|
38
|
-
const valToSlot = new Map(entries(slotToVal).map(([k, v]) => [v, k]));
|
|
39
|
-
const convertValToSlot = v => {
|
|
40
|
-
valToSlot.has(v) || Fail`unknown value: ${v}`;
|
|
41
|
-
return valToSlot.get(v);
|
|
42
|
-
};
|
|
43
|
-
return makeMarshal(convertValToSlot, convertSlotToVal, {
|
|
44
|
-
serializeBodyFormat: 'smallcaps',
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* @typedef {`\$${number}${string}`} SmallCapsSlotRef
|
|
50
|
-
*/
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* @template T
|
|
54
|
-
* @typedef {{ [KeyType in keyof T]: T[KeyType] } & {}} Simplify flatten the
|
|
55
|
-
* type output to improve type hints shown in editors
|
|
56
|
-
* https://github.com/sindresorhus/type-fest/blob/main/source/simplify.d.ts
|
|
57
|
-
*/
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* @template T
|
|
61
|
-
* @template R
|
|
62
|
-
* @typedef {T extends R
|
|
63
|
-
* ? SmallCapsSlotRef
|
|
64
|
-
* : T extends {}
|
|
65
|
-
* ? Simplify<SmallCapsStructureOf<T, R>>
|
|
66
|
-
* : Awaited<T>} SmallCapsStructureOf
|
|
67
|
-
*/
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* The smallCaps body is a string, which simplifies some usage.
|
|
71
|
-
* But it's hard to read and write.
|
|
72
|
-
*
|
|
73
|
-
* The parsed structure makes a convenient notation for configuration etc.
|
|
74
|
-
*
|
|
75
|
-
* @template {Passable} [T=Passable]
|
|
76
|
-
* @template [R=RemotableBrand]
|
|
77
|
-
* @typedef {{
|
|
78
|
-
* structure: SmallCapsStructureOf<T, R>;
|
|
79
|
-
* slots: string[];
|
|
80
|
-
* }} LegibleCapData
|
|
81
|
-
*/
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* @template {Passable} [T=Passable]
|
|
85
|
-
* @template [R=RemotableBrand]
|
|
86
|
-
* @param {CapData<string>} capData
|
|
87
|
-
* @returns {LegibleCapData<T, R>}
|
|
88
|
-
*/
|
|
89
|
-
export const toLegible = ({ body, slots }) =>
|
|
90
|
-
harden({ structure: JSON.parse(body.replace(/^#/, '')), slots });
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* @template {Passable} [T=Passable]
|
|
94
|
-
* @template [R=RemotableBrand]
|
|
95
|
-
* @param {LegibleCapData<T,R>} legible
|
|
96
|
-
* @returns {CapData<string>}
|
|
97
|
-
*/
|
|
98
|
-
export const fromLegible = ({ structure, slots }) =>
|
|
99
|
-
harden({ body: `#${JSON.stringify(structure)}`, slots });
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* @template {Passable} [T=Passable]
|
|
103
|
-
* @template [R=RemotableBrand]
|
|
104
|
-
* @param {T} config
|
|
105
|
-
* @param {Record<string, Passable>} context
|
|
106
|
-
* @param {TypedPattern<T>} [shape]
|
|
107
|
-
* @returns {LegibleCapData<T,R>}
|
|
108
|
-
*/
|
|
109
|
-
export const toExternalConfig = (config, context, shape) => {
|
|
110
|
-
if (shape) {
|
|
111
|
-
mustMatch(config, shape);
|
|
112
|
-
}
|
|
113
|
-
return toLegible(makeMarshalFromRecord(context).toCapData(config));
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* @template {Passable} [T=Passable]
|
|
118
|
-
* @template [R=RemotableBrand]
|
|
119
|
-
* @param {LegibleCapData<T,R>} repr
|
|
120
|
-
* @param {Record<string, Passable>} context
|
|
121
|
-
* @param {TypedPattern<T>} [shape]
|
|
122
|
-
* @returns {T}
|
|
123
|
-
*/
|
|
124
|
-
export const fromExternalConfig = (repr, context, shape) => {
|
|
125
|
-
const config = makeMarshalFromRecord(context).fromCapData(fromLegible(repr));
|
|
126
|
-
if (shape) {
|
|
127
|
-
mustMatch(config, shape);
|
|
128
|
-
}
|
|
129
|
-
return config;
|
|
130
|
-
};
|
package/src/utils/zoe.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { makeTracer } from '@agoric/internal';
|
|
2
|
-
|
|
3
|
-
const trace = makeTracer('ZoeUtils');
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Used for "continuing offer" invitations in which the caller does not need
|
|
7
|
-
* anything in return. In those cases there is no Zoe offer safety and the
|
|
8
|
-
* invitation making function can perform the request itself.
|
|
9
|
-
*
|
|
10
|
-
* But smart-wallet expects an invitation maker to make an invitation, so this
|
|
11
|
-
* function abstracts making such an inert invitation and logs consistently when
|
|
12
|
-
* it is used.
|
|
13
|
-
*
|
|
14
|
-
* When this is used by an invitation maker that performs the operation, receiving
|
|
15
|
-
* one of these invitations is evidence that the operation took place.
|
|
16
|
-
*
|
|
17
|
-
* @param {ZCF} zcf
|
|
18
|
-
* @param {string} description @see {@link ZCF.makeInvitation}
|
|
19
|
-
* @returns {() => Promise<Invitation>} an arg-less invitation maker
|
|
20
|
-
*/
|
|
21
|
-
export const defineInertInvitation = (zcf, description) => {
|
|
22
|
-
return () =>
|
|
23
|
-
zcf.makeInvitation(seat => {
|
|
24
|
-
trace(`ℹ️ An offer was made on an inert invitation for ${description}`);
|
|
25
|
-
seat.exit();
|
|
26
|
-
return 'inert; nothing should be expected from this offer';
|
|
27
|
-
}, description);
|
|
28
|
-
};
|
|
File without changes
|