@agoric/fast-usdc 0.1.1-dev-adb17dd.0 → 0.1.1-dev-9418efc.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 +15 -15
- package/src/exos/settler.js +1 -1
- package/src/exos/status-manager.js +34 -30
- package/src/fast-usdc.contract.js +1 -0
- package/src/types.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/fast-usdc",
|
|
3
|
-
"version": "0.1.1-dev-
|
|
3
|
+
"version": "0.1.1-dev-9418efc.0+9418efc",
|
|
4
4
|
"description": "CLI and library for Fast USDC product",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"lint:eslint": "eslint ."
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@agoric/swingset-liveslots": "0.10.3-dev-
|
|
26
|
-
"@agoric/vats": "0.15.2-dev-
|
|
27
|
-
"@agoric/zone": "0.2.3-dev-
|
|
25
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-9418efc.0+9418efc",
|
|
26
|
+
"@agoric/vats": "0.15.2-dev-9418efc.0+9418efc",
|
|
27
|
+
"@agoric/zone": "0.2.3-dev-9418efc.0+9418efc",
|
|
28
28
|
"@fast-check/ava": "^2.0.1",
|
|
29
29
|
"ava": "^5.3.0",
|
|
30
30
|
"c8": "^10.1.2",
|
|
@@ -32,16 +32,16 @@
|
|
|
32
32
|
"ts-blank-space": "^0.4.4"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@agoric/client-utils": "0.1.1-dev-
|
|
36
|
-
"@agoric/cosmic-proto": "0.4.1-dev-
|
|
37
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
38
|
-
"@agoric/internal": "0.3.3-dev-
|
|
39
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
40
|
-
"@agoric/orchestration": "0.1.1-dev-
|
|
41
|
-
"@agoric/store": "0.9.3-dev-
|
|
42
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
43
|
-
"@agoric/vow": "0.1.1-dev-
|
|
44
|
-
"@agoric/zoe": "0.26.3-dev-
|
|
35
|
+
"@agoric/client-utils": "0.1.1-dev-9418efc.0+9418efc",
|
|
36
|
+
"@agoric/cosmic-proto": "0.4.1-dev-9418efc.0+9418efc",
|
|
37
|
+
"@agoric/ertp": "0.16.3-dev-9418efc.0+9418efc",
|
|
38
|
+
"@agoric/internal": "0.3.3-dev-9418efc.0+9418efc",
|
|
39
|
+
"@agoric/notifier": "0.6.3-dev-9418efc.0+9418efc",
|
|
40
|
+
"@agoric/orchestration": "0.1.1-dev-9418efc.0+9418efc",
|
|
41
|
+
"@agoric/store": "0.9.3-dev-9418efc.0+9418efc",
|
|
42
|
+
"@agoric/vat-data": "0.5.3-dev-9418efc.0+9418efc",
|
|
43
|
+
"@agoric/vow": "0.1.1-dev-9418efc.0+9418efc",
|
|
44
|
+
"@agoric/zoe": "0.26.3-dev-9418efc.0+9418efc",
|
|
45
45
|
"@cosmjs/proto-signing": "^0.32.4",
|
|
46
46
|
"@cosmjs/stargate": "^0.32.4",
|
|
47
47
|
"@endo/base64": "^1.0.9",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"publishConfig": {
|
|
82
82
|
"access": "public"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "9418efc6d8ba27f3361754ea2a55b47a367e06b3"
|
|
85
85
|
}
|
package/src/exos/settler.js
CHANGED
|
@@ -260,7 +260,7 @@ export const prepareSettler = (
|
|
|
260
260
|
repayer.repay(settlingSeat, split);
|
|
261
261
|
|
|
262
262
|
// update status manager, marking tx `SETTLED`
|
|
263
|
-
statusManager.disbursed(txHash);
|
|
263
|
+
statusManager.disbursed(txHash, split);
|
|
264
264
|
},
|
|
265
265
|
/**
|
|
266
266
|
* @param {EvmHash} txHash
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Fail, makeError, q } from '@endo/errors';
|
|
1
|
+
import { makeTracer } from '@agoric/internal';
|
|
3
2
|
import { appendToStoredArray } from '@agoric/store/src/stores/store-utils.js';
|
|
3
|
+
import { AmountKeywordRecordShape } from '@agoric/zoe/src/typeGuards.js';
|
|
4
|
+
import { Fail, makeError, q } from '@endo/errors';
|
|
4
5
|
import { E } from '@endo/eventual-send';
|
|
5
|
-
import {
|
|
6
|
+
import { M } from '@endo/patterns';
|
|
7
|
+
import { PendingTxStatus, TerminalTxStatus, TxStatus } from '../constants.js';
|
|
6
8
|
import {
|
|
7
9
|
CctpTxEvidenceShape,
|
|
8
10
|
EvmHashShape,
|
|
9
11
|
PendingTxShape,
|
|
10
12
|
} from '../type-guards.js';
|
|
11
|
-
import { PendingTxStatus, TerminalTxStatus, TxStatus } from '../constants.js';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* @import {MapStore, SetStore} from '@agoric/store';
|
|
@@ -48,6 +49,7 @@ const pendingTxKeyOf = evidence => {
|
|
|
48
49
|
/**
|
|
49
50
|
* @typedef {{
|
|
50
51
|
* log?: LogFn;
|
|
52
|
+
* marshaller: ERef<Marshaller>;
|
|
51
53
|
* }} StatusManagerPowers
|
|
52
54
|
*/
|
|
53
55
|
|
|
@@ -66,6 +68,7 @@ export const prepareStatusManager = (
|
|
|
66
68
|
zone,
|
|
67
69
|
txnsNode,
|
|
68
70
|
{
|
|
71
|
+
marshaller,
|
|
69
72
|
log = makeTracer('Advancer', true),
|
|
70
73
|
} = /** @type {StatusManagerPowers} */ ({}),
|
|
71
74
|
) => {
|
|
@@ -102,14 +105,25 @@ export const prepareStatusManager = (
|
|
|
102
105
|
/**
|
|
103
106
|
* @param {EvmHash} txId
|
|
104
107
|
* @param {TransactionRecord} record
|
|
108
|
+
* @returns {Promise<void>}
|
|
105
109
|
*/
|
|
106
|
-
const publishTxnRecord = (txId, record) => {
|
|
110
|
+
const publishTxnRecord = async (txId, record) => {
|
|
107
111
|
const txNode = E(txnsNode).makeChildNode(txId, {
|
|
108
112
|
sequence: true, // avoid overwriting other output in the block
|
|
109
113
|
});
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
)
|
|
114
|
+
|
|
115
|
+
// XXX awkward for publish* to update a store, but it's temporary
|
|
116
|
+
if (record.status && TerminalTxStatus[record.status]) {
|
|
117
|
+
// UNTIL https://github.com/Agoric/agoric-sdk/issues/7405
|
|
118
|
+
// Queue it for deletion later because if we deleted it now the earlier
|
|
119
|
+
// writes in this block would be wiped. For now we keep track of what to
|
|
120
|
+
// delete when we know it'll be another block.
|
|
121
|
+
storedCompletedTxs.add(txId);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const capData = await E(marshaller).toCapData(record);
|
|
125
|
+
|
|
126
|
+
await E(txNode).setValue(JSON.stringify(capData));
|
|
113
127
|
};
|
|
114
128
|
|
|
115
129
|
/**
|
|
@@ -124,22 +138,6 @@ export const prepareStatusManager = (
|
|
|
124
138
|
);
|
|
125
139
|
};
|
|
126
140
|
|
|
127
|
-
/**
|
|
128
|
-
* @param {CctpTxEvidence['txHash']} hash
|
|
129
|
-
* @param {TxStatus} status
|
|
130
|
-
*/
|
|
131
|
-
const publishStatus = (hash, status) => {
|
|
132
|
-
// Don't await, just writing to vstorage.
|
|
133
|
-
void publishTxnRecord(hash, harden({ status }));
|
|
134
|
-
if (TerminalTxStatus[status]) {
|
|
135
|
-
// UNTIL https://github.com/Agoric/agoric-sdk/issues/7405
|
|
136
|
-
// Queue it for deletion later because if we deleted it now the earlier
|
|
137
|
-
// writes in this block would be wiped. For now we keep track of what to
|
|
138
|
-
// delete when we know it'll be another block.
|
|
139
|
-
storedCompletedTxs.add(hash);
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
|
|
143
141
|
/**
|
|
144
142
|
* Ensures that `txHash+chainId` has not been processed
|
|
145
143
|
* and adds entry to `seenTxs` set.
|
|
@@ -164,7 +162,7 @@ export const prepareStatusManager = (
|
|
|
164
162
|
publishEvidence(txHash, evidence);
|
|
165
163
|
if (status !== PendingTxStatus.Observed) {
|
|
166
164
|
// publishEvidence publishes Observed
|
|
167
|
-
|
|
165
|
+
void publishTxnRecord(txHash, harden({ status }));
|
|
168
166
|
}
|
|
169
167
|
};
|
|
170
168
|
|
|
@@ -187,7 +185,7 @@ export const prepareStatusManager = (
|
|
|
187
185
|
];
|
|
188
186
|
const txpost = { ...tx, status };
|
|
189
187
|
pendingTxs.set(key, harden([...prefix, txpost, ...suffix]));
|
|
190
|
-
|
|
188
|
+
void publishTxnRecord(tx.txHash, harden({ status }));
|
|
191
189
|
}
|
|
192
190
|
|
|
193
191
|
return zone.exo(
|
|
@@ -212,7 +210,9 @@ export const prepareStatusManager = (
|
|
|
212
210
|
M.undefined(),
|
|
213
211
|
),
|
|
214
212
|
),
|
|
215
|
-
disbursed: M.call(EvmHashShape).returns(
|
|
213
|
+
disbursed: M.call(EvmHashShape, AmountKeywordRecordShape).returns(
|
|
214
|
+
M.undefined(),
|
|
215
|
+
),
|
|
216
216
|
forwarded: M.call(M.opt(EvmHashShape), M.string(), M.nat()).returns(
|
|
217
217
|
M.undefined(),
|
|
218
218
|
),
|
|
@@ -313,9 +313,13 @@ export const prepareStatusManager = (
|
|
|
313
313
|
* Mark a transaction as `DISBURSED`
|
|
314
314
|
*
|
|
315
315
|
* @param {EvmHash} txHash
|
|
316
|
+
* @param {import('./liquidity-pool.js').RepayAmountKWR} split
|
|
316
317
|
*/
|
|
317
|
-
disbursed(txHash) {
|
|
318
|
-
|
|
318
|
+
disbursed(txHash, split) {
|
|
319
|
+
void publishTxnRecord(
|
|
320
|
+
txHash,
|
|
321
|
+
harden({ split, status: TxStatus.Disbursed }),
|
|
322
|
+
);
|
|
319
323
|
},
|
|
320
324
|
|
|
321
325
|
/**
|
|
@@ -327,7 +331,7 @@ export const prepareStatusManager = (
|
|
|
327
331
|
*/
|
|
328
332
|
forwarded(txHash, nfa, amount) {
|
|
329
333
|
if (txHash) {
|
|
330
|
-
|
|
334
|
+
void publishTxnRecord(txHash, harden({ status: TxStatus.Forwarded }));
|
|
331
335
|
} else {
|
|
332
336
|
// TODO store (early) `Minted` transactions to check against incoming evidence
|
|
333
337
|
log(
|
package/src/types.ts
CHANGED
|
@@ -9,6 +9,7 @@ import type { Amount } from '@agoric/ertp';
|
|
|
9
9
|
import type { CopyRecord, Passable } from '@endo/pass-style';
|
|
10
10
|
import type { PendingTxStatus, TxStatus } from './constants.js';
|
|
11
11
|
import type { FastUsdcTerms } from './fast-usdc.contract.js';
|
|
12
|
+
import type { RepayAmountKWR } from './exos/liquidity-pool.js';
|
|
12
13
|
|
|
13
14
|
export type EvmHash = `0x${string}`;
|
|
14
15
|
export type EvmAddress = `0x${string & { length: 40 }}`;
|
|
@@ -40,6 +41,7 @@ export interface CctpTxEvidence {
|
|
|
40
41
|
*/
|
|
41
42
|
export interface TransactionRecord extends CopyRecord {
|
|
42
43
|
evidence?: CctpTxEvidence;
|
|
44
|
+
split?: RepayAmountKWR;
|
|
43
45
|
status: TxStatus;
|
|
44
46
|
}
|
|
45
47
|
|