@agoric/fast-usdc 0.1.1-dev-b5d1abe.0 → 0.1.1-dev-537ffd0.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/advancer.js +17 -15
- package/src/utils/chain-policies.js +75 -0
- package/src/utils/deploy-config.js +13 -36
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-537ffd0.0+537ffd0",
|
|
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-537ffd0.0+537ffd0",
|
|
26
|
+
"@agoric/vats": "0.15.2-dev-537ffd0.0+537ffd0",
|
|
27
|
+
"@agoric/zone": "0.2.3-dev-537ffd0.0+537ffd0",
|
|
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-537ffd0.0+537ffd0",
|
|
36
|
+
"@agoric/cosmic-proto": "0.4.1-dev-537ffd0.0+537ffd0",
|
|
37
|
+
"@agoric/ertp": "0.16.3-dev-537ffd0.0+537ffd0",
|
|
38
|
+
"@agoric/internal": "0.3.3-dev-537ffd0.0+537ffd0",
|
|
39
|
+
"@agoric/notifier": "0.6.3-dev-537ffd0.0+537ffd0",
|
|
40
|
+
"@agoric/orchestration": "0.1.1-dev-537ffd0.0+537ffd0",
|
|
41
|
+
"@agoric/store": "0.9.3-dev-537ffd0.0+537ffd0",
|
|
42
|
+
"@agoric/vat-data": "0.5.3-dev-537ffd0.0+537ffd0",
|
|
43
|
+
"@agoric/vow": "0.1.1-dev-537ffd0.0+537ffd0",
|
|
44
|
+
"@agoric/zoe": "0.26.3-dev-537ffd0.0+537ffd0",
|
|
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": "537ffd077b75c175412e54f116c885cbb64d80fc"
|
|
85
85
|
}
|
package/src/exos/advancer.js
CHANGED
|
@@ -23,7 +23,7 @@ import { makeFeeTools } from '../utils/fees.js';
|
|
|
23
23
|
* @import {ZoeTools} from '@agoric/orchestration/src/utils/zoe-tools.js';
|
|
24
24
|
* @import {VowTools} from '@agoric/vow';
|
|
25
25
|
* @import {Zone} from '@agoric/zone';
|
|
26
|
-
* @import {
|
|
26
|
+
* @import {AddressHook, EvmHash, FeeConfig, LogFn, NobleAddress, EvidenceWithRisk} from '../types.js';
|
|
27
27
|
* @import {StatusManager} from './status-manager.js';
|
|
28
28
|
* @import {LiquidityPoolKit} from './liquidity-pool.js';
|
|
29
29
|
*/
|
|
@@ -213,14 +213,20 @@ export const prepareAdvancerKit = (
|
|
|
213
213
|
* @param {AdvancerVowCtx & { tmpSeat: ZCFSeat }} ctx
|
|
214
214
|
*/
|
|
215
215
|
onFulfilled(result, ctx) {
|
|
216
|
-
const { poolAccount, intermediateRecipient } =
|
|
216
|
+
const { poolAccount, intermediateRecipient, settlementAddress } =
|
|
217
|
+
this.state;
|
|
217
218
|
const { destination, advanceAmount, tmpSeat: _, ...detail } = ctx;
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
219
|
+
const amount = harden({
|
|
220
|
+
denom: usdc.denom,
|
|
221
|
+
value: advanceAmount.value,
|
|
222
|
+
});
|
|
223
|
+
const transferOrSendV =
|
|
224
|
+
destination.chainId === settlementAddress.chainId
|
|
225
|
+
? E(poolAccount).send(destination, amount)
|
|
226
|
+
: E(poolAccount).transfer(destination, amount, {
|
|
227
|
+
forwardOpts: { intermediateRecipient },
|
|
228
|
+
});
|
|
229
|
+
return watch(transferOrSendV, this.facets.transferHandler, {
|
|
224
230
|
destination,
|
|
225
231
|
advanceAmount,
|
|
226
232
|
...detail,
|
|
@@ -253,17 +259,13 @@ export const prepareAdvancerKit = (
|
|
|
253
259
|
},
|
|
254
260
|
transferHandler: {
|
|
255
261
|
/**
|
|
256
|
-
* @param {
|
|
262
|
+
* @param {undefined} result
|
|
257
263
|
* @param {AdvancerVowCtx} ctx
|
|
258
264
|
*/
|
|
259
265
|
onFulfilled(result, ctx) {
|
|
260
266
|
const { notifyFacet } = this.state;
|
|
261
267
|
const { advanceAmount, destination, ...detail } = ctx;
|
|
262
|
-
log('Advance
|
|
263
|
-
advanceAmount,
|
|
264
|
-
destination,
|
|
265
|
-
result,
|
|
266
|
-
});
|
|
268
|
+
log('Advance succeeded', { advanceAmount, destination });
|
|
267
269
|
// During development, due to a bug, this call threw.
|
|
268
270
|
// The failure was silent (no diagnostics) due to:
|
|
269
271
|
// - #10576 Vows do not report unhandled rejections
|
|
@@ -278,7 +280,7 @@ export const prepareAdvancerKit = (
|
|
|
278
280
|
*/
|
|
279
281
|
onRejected(error, ctx) {
|
|
280
282
|
const { notifyFacet } = this.state;
|
|
281
|
-
log('Advance
|
|
283
|
+
log('Advance failed', error);
|
|
282
284
|
const { advanceAmount: _, ...restCtx } = ctx;
|
|
283
285
|
notifyFacet.notifyAdvancingResult(restCtx, false);
|
|
284
286
|
},
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/** @import {ChainPolicy} from '../types.js'; */
|
|
2
|
+
|
|
3
|
+
/** @satisfies {Record<'MAINNET'| 'TESTNET', Record<string, ChainPolicy>>} */
|
|
4
|
+
export const ChainPolicies = /** @type {const} */ ({
|
|
5
|
+
MAINNET: {
|
|
6
|
+
Arbitrum: {
|
|
7
|
+
attenuatedCttpBridgeAddress: '0xe298b93ffB5eA1FB628e0C0D55A43aeaC268e347',
|
|
8
|
+
cctpTokenMessengerAddress: '0x19330d10D9Cc8751218eaf51E8885D058642E08A',
|
|
9
|
+
chainId: 42161,
|
|
10
|
+
confirmations: 2, // TODO placeholder
|
|
11
|
+
},
|
|
12
|
+
Base: {
|
|
13
|
+
attenuatedCttpBridgeAddress: '0xB6615B2662b35fc3533F8479002e62D0523341De',
|
|
14
|
+
cctpTokenMessengerAddress: '0x1682Ae6375C4E4A97e4B583BC394c861A46D8962',
|
|
15
|
+
chainId: 8453,
|
|
16
|
+
confirmations: 2, // TODO placeholder
|
|
17
|
+
},
|
|
18
|
+
Ethereum: {
|
|
19
|
+
attenuatedCttpBridgeAddress: '0xBC8552339dA68EB65C8b88B414B5854E0E366cFc',
|
|
20
|
+
cctpTokenMessengerAddress: '0xBd3fa81B58Ba92a82136038B25aDec7066af3155',
|
|
21
|
+
chainId: 1,
|
|
22
|
+
confirmations: 2, // TODO placeholder
|
|
23
|
+
},
|
|
24
|
+
Optimism: {
|
|
25
|
+
attenuatedCttpBridgeAddress: '0x48C5417ED570928eC85D5e3AD4e7E0EeD7dB1E2A',
|
|
26
|
+
cctpTokenMessengerAddress: '0x2B4069517957735bE00ceE0fadAE88a26365528f',
|
|
27
|
+
chainId: 10,
|
|
28
|
+
confirmations: 2, // TODO placeholder
|
|
29
|
+
},
|
|
30
|
+
Polygon: {
|
|
31
|
+
attenuatedCttpBridgeAddress: '0x32cb9574650AFF312c80edc4B4343Ff5500767cA',
|
|
32
|
+
cctpTokenMessengerAddress: '0x9daF8c91AEFAE50b9c0E69629D3F6Ca40cA3B3FE',
|
|
33
|
+
chainId: 137,
|
|
34
|
+
confirmations: 2, // TODO placeholder
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
TESTNET: {
|
|
38
|
+
// Arbitrum Sepolia
|
|
39
|
+
Arbitrum: {
|
|
40
|
+
attenuatedCttpBridgeAddress: '0xTODO',
|
|
41
|
+
cctpTokenMessengerAddress: '0x9f3B8679c73C2Fef8b59B4f3444d4e156fb70AA5',
|
|
42
|
+
chainId: 421614,
|
|
43
|
+
confirmations: 2, // TODO placeholder
|
|
44
|
+
},
|
|
45
|
+
// Base Sepolia
|
|
46
|
+
Base: {
|
|
47
|
+
attenuatedCttpBridgeAddress: '0xTODO',
|
|
48
|
+
cctpTokenMessengerAddress: '0x9f3B8679c73C2Fef8b59B4f3444d4e156fb70AA5',
|
|
49
|
+
chainId: 84532,
|
|
50
|
+
confirmations: 2, // TODO placeholder
|
|
51
|
+
},
|
|
52
|
+
// Ethereum Sepolia
|
|
53
|
+
Ethereum: {
|
|
54
|
+
attenuatedCttpBridgeAddress: '0xTODO',
|
|
55
|
+
cctpTokenMessengerAddress: '0x9f3B8679c73C2Fef8b59B4f3444d4e156fb70AA5',
|
|
56
|
+
chainId: 11155111,
|
|
57
|
+
confirmations: 2, // TODO placeholder
|
|
58
|
+
},
|
|
59
|
+
// OP Sepolia
|
|
60
|
+
Optimism: {
|
|
61
|
+
attenuatedCttpBridgeAddress: '0xTODO',
|
|
62
|
+
cctpTokenMessengerAddress: '0x9f3B8679c73C2Fef8b59B4f3444d4e156fb70AA5',
|
|
63
|
+
chainId: 11155420,
|
|
64
|
+
confirmations: 2, // TODO placeholder
|
|
65
|
+
},
|
|
66
|
+
// Polygon PoS Amoy
|
|
67
|
+
Polygon: {
|
|
68
|
+
attenuatedCttpBridgeAddress: '0xTODO',
|
|
69
|
+
cctpTokenMessengerAddress: '0x9f3B8679c73C2Fef8b59B4f3444d4e156fb70AA5',
|
|
70
|
+
chainId: 80002,
|
|
71
|
+
confirmations: 2, // TODO placeholder
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
harden(ChainPolicies);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { denomHash, withChainCapabilities } from '@agoric/orchestration';
|
|
2
2
|
import fetchedChainInfo from '@agoric/orchestration/src/fetched-chain-info.js';
|
|
3
|
+
import { ChainPolicies } from './chain-policies.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* @import {FastUSDCConfig} from '@agoric/fast-usdc/src/types.js'
|
|
@@ -41,6 +42,10 @@ const agoricAssetInfo = defaultAssetInfo.filter(
|
|
|
41
42
|
([_d, i]) => i.chainName === 'agoric',
|
|
42
43
|
);
|
|
43
44
|
|
|
45
|
+
/** ABI for DepositForBurn event in TokenMessenger contract */
|
|
46
|
+
const DepositForBurnEvent =
|
|
47
|
+
'DepositForBurn(uint64,address,uint256,address,bytes32,uint32,bytes32,bytes32)';
|
|
48
|
+
|
|
44
49
|
/**
|
|
45
50
|
* @type {Record<string, Pick<FastUSDCConfig, 'oracles' | 'feedPolicy' | 'chainInfo' | 'assetInfo' >>}
|
|
46
51
|
*
|
|
@@ -62,16 +67,8 @@ export const configurations = {
|
|
|
62
67
|
feedPolicy: {
|
|
63
68
|
nobleAgoricChannelId: 'channel-does-not-exist',
|
|
64
69
|
nobleDomainId: 4,
|
|
65
|
-
chainPolicies:
|
|
66
|
-
|
|
67
|
-
attenuatedCttpBridgeAddress:
|
|
68
|
-
'0xe298b93ffB5eA1FB628e0C0D55A43aeaC268e347',
|
|
69
|
-
cctpTokenMessengerAddress:
|
|
70
|
-
'0x19330d10D9Cc8751218eaf51E8885D058642E08A',
|
|
71
|
-
chainId: 42161,
|
|
72
|
-
confirmations: 2,
|
|
73
|
-
},
|
|
74
|
-
},
|
|
70
|
+
chainPolicies: ChainPolicies.TESTNET,
|
|
71
|
+
eventFilter: DepositForBurnEvent,
|
|
75
72
|
},
|
|
76
73
|
chainInfo: /** @type {Record<string, CosmosChainInfo & Passable>} */ (
|
|
77
74
|
withChainCapabilities({
|
|
@@ -91,16 +88,8 @@ export const configurations = {
|
|
|
91
88
|
feedPolicy: {
|
|
92
89
|
nobleAgoricChannelId: 'channel-21',
|
|
93
90
|
nobleDomainId: 4,
|
|
94
|
-
chainPolicies:
|
|
95
|
-
|
|
96
|
-
attenuatedCttpBridgeAddress:
|
|
97
|
-
'0xe298b93ffB5eA1FB628e0C0D55A43aeaC268e347',
|
|
98
|
-
cctpTokenMessengerAddress:
|
|
99
|
-
'0x19330d10D9Cc8751218eaf51E8885D058642E08A',
|
|
100
|
-
chainId: 42161,
|
|
101
|
-
confirmations: 2,
|
|
102
|
-
},
|
|
103
|
-
},
|
|
91
|
+
chainPolicies: ChainPolicies.MAINNET,
|
|
92
|
+
eventFilter: DepositForBurnEvent,
|
|
104
93
|
},
|
|
105
94
|
chainInfo: /** @type {Record<string, CosmosChainInfo & Passable>} */ (
|
|
106
95
|
withChainCapabilities(fetchedChainInfo)
|
|
@@ -118,14 +107,8 @@ export const configurations = {
|
|
|
118
107
|
feedPolicy: {
|
|
119
108
|
nobleAgoricChannelId: 'TODO',
|
|
120
109
|
nobleDomainId: 4,
|
|
121
|
-
chainPolicies:
|
|
122
|
-
|
|
123
|
-
attenuatedCttpBridgeAddress: '0xTODO',
|
|
124
|
-
cctpTokenMessengerAddress: '0xTODO',
|
|
125
|
-
chainId: 421614,
|
|
126
|
-
confirmations: 2,
|
|
127
|
-
},
|
|
128
|
-
},
|
|
110
|
+
chainPolicies: ChainPolicies.TESTNET,
|
|
111
|
+
eventFilter: DepositForBurnEvent,
|
|
129
112
|
},
|
|
130
113
|
chainInfo: /** @type {Record<string, CosmosChainInfo & Passable>} */ (
|
|
131
114
|
withChainCapabilities(fetchedChainInfo) // TODO: use devnet values
|
|
@@ -140,14 +123,8 @@ export const configurations = {
|
|
|
140
123
|
feedPolicy: {
|
|
141
124
|
nobleAgoricChannelId: 'TODO',
|
|
142
125
|
nobleDomainId: 4,
|
|
143
|
-
chainPolicies:
|
|
144
|
-
|
|
145
|
-
attenuatedCttpBridgeAddress: '0xTODO',
|
|
146
|
-
cctpTokenMessengerAddress: '0xTODO',
|
|
147
|
-
chainId: 421614,
|
|
148
|
-
confirmations: 2,
|
|
149
|
-
},
|
|
150
|
-
},
|
|
126
|
+
chainPolicies: ChainPolicies.TESTNET,
|
|
127
|
+
eventFilter: DepositForBurnEvent,
|
|
151
128
|
},
|
|
152
129
|
chainInfo: /** @type {Record<string, CosmosChainInfo & Passable>} */ (
|
|
153
130
|
withChainCapabilities(fetchedChainInfo) // TODO: use emerynet values
|