@agoric/fast-usdc 0.1.1-dev-ad4e83e.0 → 0.1.1-dev-1645d7e.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/fast-usdc-policy.core.js +75 -0
- package/src/fast-usdc.start.js +2 -14
- package/src/types.ts +17 -1
- package/src/utils/deploy-config.js +141 -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-1645d7e.0+1645d7e",
|
|
4
4
|
"description": "CLI and library for Fast USDC product",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -22,25 +22,25 @@
|
|
|
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-1645d7e.0+1645d7e",
|
|
26
|
+
"@agoric/vats": "0.15.2-dev-1645d7e.0+1645d7e",
|
|
27
|
+
"@agoric/zone": "0.2.3-dev-1645d7e.0+1645d7e",
|
|
28
28
|
"@fast-check/ava": "^2.0.1",
|
|
29
29
|
"ava": "^5.3.0",
|
|
30
30
|
"c8": "^10.1.2",
|
|
31
31
|
"execa": "9.1.0",
|
|
32
|
-
"ts-blank-space": "^0.4.
|
|
32
|
+
"ts-blank-space": "^0.4.4"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@agoric/client-utils": "0.1.1-dev-
|
|
36
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
37
|
-
"@agoric/internal": "0.3.3-dev-
|
|
38
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
39
|
-
"@agoric/orchestration": "0.1.1-dev-
|
|
40
|
-
"@agoric/store": "0.9.3-dev-
|
|
41
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
42
|
-
"@agoric/vow": "0.1.1-dev-
|
|
43
|
-
"@agoric/zoe": "0.26.3-dev-
|
|
35
|
+
"@agoric/client-utils": "0.1.1-dev-1645d7e.0+1645d7e",
|
|
36
|
+
"@agoric/ertp": "0.16.3-dev-1645d7e.0+1645d7e",
|
|
37
|
+
"@agoric/internal": "0.3.3-dev-1645d7e.0+1645d7e",
|
|
38
|
+
"@agoric/notifier": "0.6.3-dev-1645d7e.0+1645d7e",
|
|
39
|
+
"@agoric/orchestration": "0.1.1-dev-1645d7e.0+1645d7e",
|
|
40
|
+
"@agoric/store": "0.9.3-dev-1645d7e.0+1645d7e",
|
|
41
|
+
"@agoric/vat-data": "0.5.3-dev-1645d7e.0+1645d7e",
|
|
42
|
+
"@agoric/vow": "0.1.1-dev-1645d7e.0+1645d7e",
|
|
43
|
+
"@agoric/zoe": "0.26.3-dev-1645d7e.0+1645d7e",
|
|
44
44
|
"@cosmjs/proto-signing": "^0.32.4",
|
|
45
45
|
"@cosmjs/stargate": "^0.32.4",
|
|
46
46
|
"@endo/base64": "^1.0.9",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"publishConfig": {
|
|
81
81
|
"access": "public"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "1645d7e8a3194f56889e91df38a31c1a900905bb"
|
|
84
84
|
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/** @file core-eval to publish update to Fast USDC feedPolicy */
|
|
2
|
+
|
|
3
|
+
import { E } from '@endo/far';
|
|
4
|
+
import { fromExternalConfig } from './utils/config-marshal.js';
|
|
5
|
+
import { FeedPolicyShape } from './type-guards.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @import {Passable} from '@endo/pass-style'
|
|
9
|
+
* @import {BootstrapManifest} from '@agoric/vats/src/core/lib-boot.js'
|
|
10
|
+
* @import {LegibleCapData} from './utils/config-marshal.js'
|
|
11
|
+
* @import {FeedPolicy} from './types.js'
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const contractName = 'fastUsdc';
|
|
15
|
+
const FEED_POLICY = 'feedPolicy';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* XXX copied from fast-usdc.start.js
|
|
19
|
+
*
|
|
20
|
+
* @param {ERef<StorageNode>} node
|
|
21
|
+
* @param {FeedPolicy} policy
|
|
22
|
+
*/
|
|
23
|
+
const publishFeedPolicy = async (node, policy) => {
|
|
24
|
+
const feedPolicy = E(node).makeChildNode(FEED_POLICY);
|
|
25
|
+
await E(feedPolicy).setValue(JSON.stringify(policy));
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @param {BootstrapPowers &
|
|
30
|
+
* { consume: { chainStorage: Promise<StorageNode> }}
|
|
31
|
+
* } powers
|
|
32
|
+
* @param {{ options: LegibleCapData<{feedPolicy: FeedPolicy & Passable}> }} config
|
|
33
|
+
*/
|
|
34
|
+
export const updateFastUsdcPolicy = async (
|
|
35
|
+
{ consume: { agoricNames, chainStorage } },
|
|
36
|
+
config,
|
|
37
|
+
) => {
|
|
38
|
+
/** @type {Issuer<'nat'>} */
|
|
39
|
+
const USDCissuer = await E(agoricNames).lookup('issuer', 'USDC');
|
|
40
|
+
const brands = harden({
|
|
41
|
+
USDC: await E(USDCissuer).getBrand(),
|
|
42
|
+
});
|
|
43
|
+
const { feedPolicy } = fromExternalConfig(
|
|
44
|
+
config.options,
|
|
45
|
+
brands,
|
|
46
|
+
harden({ feedPolicy: FeedPolicyShape }),
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const storageNode = await E(chainStorage).makeChildNode(contractName);
|
|
50
|
+
|
|
51
|
+
await publishFeedPolicy(storageNode, feedPolicy);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @param {unknown} _utils
|
|
56
|
+
* @param {{
|
|
57
|
+
* options: LegibleCapData<{feedPolicy: FeedPolicy & Passable}>;
|
|
58
|
+
* }} param1
|
|
59
|
+
*/
|
|
60
|
+
export const getManifestForUpdateFastUsdcPolicy = (_utils, { options }) => {
|
|
61
|
+
return {
|
|
62
|
+
/** @type {BootstrapManifest} */
|
|
63
|
+
manifest: {
|
|
64
|
+
[updateFastUsdcPolicy.name]: {
|
|
65
|
+
consume: {
|
|
66
|
+
chainStorage: true,
|
|
67
|
+
|
|
68
|
+
// widely shared: name services
|
|
69
|
+
agoricNames: true,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
options,
|
|
74
|
+
};
|
|
75
|
+
};
|
package/src/fast-usdc.start.js
CHANGED
|
@@ -18,31 +18,19 @@ import { fromExternalConfig } from './utils/config-marshal.js';
|
|
|
18
18
|
/**
|
|
19
19
|
* @import {DepositFacet} from '@agoric/ertp/src/types.js'
|
|
20
20
|
* @import {TypedPattern} from '@agoric/internal'
|
|
21
|
-
* @import {CosmosChainInfo, Denom, DenomDetail} from '@agoric/orchestration';
|
|
22
21
|
* @import {Instance, StartParams} from '@agoric/zoe/src/zoeService/utils'
|
|
23
22
|
* @import {Board} from '@agoric/vats'
|
|
24
23
|
* @import {ManifestBundleRef} from '@agoric/deploy-script-support/src/externalTypes.js'
|
|
25
24
|
* @import {BootstrapManifest} from '@agoric/vats/src/core/lib-boot.js'
|
|
26
|
-
* @import {Passable} from '@endo/marshal';
|
|
27
25
|
* @import {LegibleCapData} from './utils/config-marshal.js'
|
|
28
|
-
* @import {FastUsdcSF
|
|
29
|
-
* @import {
|
|
26
|
+
* @import {FastUsdcSF} from './fast-usdc.contract.js'
|
|
27
|
+
* @import {FeedPolicy, FastUSDCConfig} from './types.js'
|
|
30
28
|
*/
|
|
31
29
|
|
|
32
30
|
const trace = makeTracer('FUSD-Start', true);
|
|
33
31
|
|
|
34
32
|
const contractName = 'fastUsdc';
|
|
35
33
|
|
|
36
|
-
/**
|
|
37
|
-
* @typedef {{
|
|
38
|
-
* terms: FastUsdcTerms;
|
|
39
|
-
* oracles: Record<string, string>;
|
|
40
|
-
* feeConfig: FeeConfig;
|
|
41
|
-
* feedPolicy: FeedPolicy & Passable;
|
|
42
|
-
* chainInfo: Record<string, CosmosChainInfo & Passable>;
|
|
43
|
-
* assetInfo: [Denom, DenomDetail & {brandKey?: string}][];
|
|
44
|
-
* }} FastUSDCConfig
|
|
45
|
-
*/
|
|
46
34
|
/** @type {TypedPattern<FastUSDCConfig>} */
|
|
47
35
|
export const FastUSDCConfigShape = M.splitRecord({
|
|
48
36
|
terms: FastUSDCTermsShape,
|
package/src/types.ts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
ChainAddress,
|
|
3
|
+
CosmosChainInfo,
|
|
4
|
+
Denom,
|
|
5
|
+
DenomDetail,
|
|
6
|
+
} from '@agoric/orchestration';
|
|
2
7
|
import type { IBCChannelID } from '@agoric/vats';
|
|
3
8
|
import type { Amount } from '@agoric/ertp';
|
|
9
|
+
import type { Passable } from '@endo/pass-style';
|
|
4
10
|
import type { PendingTxStatus } from './constants.js';
|
|
11
|
+
import type { FastUsdcTerms } from './fast-usdc.contract.js';
|
|
5
12
|
|
|
6
13
|
export type EvmHash = `0x${string}`;
|
|
7
14
|
export type NobleAddress = `noble1${string}`;
|
|
@@ -71,5 +78,14 @@ export interface FeedPolicy {
|
|
|
71
78
|
eventFilter?: string;
|
|
72
79
|
}
|
|
73
80
|
|
|
81
|
+
export type FastUSDCConfig = Passable & {
|
|
82
|
+
terms: FastUsdcTerms;
|
|
83
|
+
oracles: Record<string, string>;
|
|
84
|
+
feeConfig: FeeConfig;
|
|
85
|
+
feedPolicy: FeedPolicy & Passable;
|
|
86
|
+
chainInfo: Record<string, CosmosChainInfo & Passable>;
|
|
87
|
+
assetInfo: [Denom, DenomDetail & { brandKey?: string }][];
|
|
88
|
+
};
|
|
89
|
+
|
|
74
90
|
export type * from './constants.js';
|
|
75
91
|
export type { LiquidityPoolKit } from './exos/liquidity-pool.js';
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { denomHash, withChainCapabilities } from '@agoric/orchestration';
|
|
2
|
+
import fetchedChainInfo from '@agoric/orchestration/src/fetched-chain-info.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @import {FastUSDCConfig} from '@agoric/fast-usdc/src/types.js'
|
|
6
|
+
* @import {Passable} from '@endo/marshal';
|
|
7
|
+
* @import {CosmosChainInfo, Denom, DenomDetail} from '@agoric/orchestration';
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** @type {[Denom, DenomDetail & { brandKey?: string}][]} */
|
|
11
|
+
export const defaultAssetInfo = [
|
|
12
|
+
[
|
|
13
|
+
'uusdc',
|
|
14
|
+
{
|
|
15
|
+
baseName: 'noble',
|
|
16
|
+
chainName: 'noble',
|
|
17
|
+
baseDenom: 'uusdc',
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
[
|
|
21
|
+
`ibc/${denomHash({ denom: 'uusdc', channelId: fetchedChainInfo.agoric.connections['noble-1'].transferChannel.channelId })}`,
|
|
22
|
+
{
|
|
23
|
+
baseName: 'noble',
|
|
24
|
+
chainName: 'agoric',
|
|
25
|
+
baseDenom: 'uusdc',
|
|
26
|
+
brandKey: 'USDC',
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
[
|
|
30
|
+
`ibc/${denomHash({ denom: 'uusdc', channelId: fetchedChainInfo.osmosis.connections['noble-1'].transferChannel.channelId })}`,
|
|
31
|
+
{
|
|
32
|
+
baseName: 'noble',
|
|
33
|
+
chainName: 'osmosis',
|
|
34
|
+
baseDenom: 'uusdc',
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @type {Record<string, Pick<FastUSDCConfig, 'oracles' | 'feedPolicy' | 'chainInfo' | 'assetInfo' >>}
|
|
41
|
+
*
|
|
42
|
+
* TODO: determine OCW operator addresses
|
|
43
|
+
* meanwhile, use price oracle addresses (from updatePriceFeeds.js).
|
|
44
|
+
*/
|
|
45
|
+
export const configurations = {
|
|
46
|
+
A3P_INTEGRATION: {
|
|
47
|
+
oracles: {
|
|
48
|
+
gov1: 'agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q',
|
|
49
|
+
gov2: 'agoric1wrfh296eu2z34p6pah7q04jjuyj3mxu9v98277',
|
|
50
|
+
gov3: 'agoric1ydzxwh6f893jvpaslmaz6l8j2ulup9a7x8qvvq',
|
|
51
|
+
},
|
|
52
|
+
feedPolicy: {
|
|
53
|
+
nobleAgoricChannelId: 'TODO',
|
|
54
|
+
nobleDomainId: 4,
|
|
55
|
+
chainPolicies: {
|
|
56
|
+
Arbitrum: {
|
|
57
|
+
cctpTokenMessengerAddress:
|
|
58
|
+
'0x19330d10D9Cc8751218eaf51E8885D058642E08A',
|
|
59
|
+
chainId: 42161,
|
|
60
|
+
confirmations: 2,
|
|
61
|
+
nobleContractAddress: '0x19330d10D9Cc8751218eaf51E8885D058642E08A',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
chainInfo: /** @type {Record<string, CosmosChainInfo & Passable>} */ (
|
|
66
|
+
withChainCapabilities(fetchedChainInfo)
|
|
67
|
+
),
|
|
68
|
+
assetInfo: defaultAssetInfo,
|
|
69
|
+
},
|
|
70
|
+
MAINNET: {
|
|
71
|
+
oracles: {
|
|
72
|
+
'01node': 'agoric19uscwxdac6cf6z7d5e26e0jm0lgwstc47cpll8',
|
|
73
|
+
'Simply Staking': 'agoric1krunjcqfrf7la48zrvdfeeqtls5r00ep68mzkr',
|
|
74
|
+
P2P: 'agoric1n4fcxsnkxe4gj6e24naec99hzmc4pjfdccy5nj',
|
|
75
|
+
},
|
|
76
|
+
feedPolicy: {
|
|
77
|
+
nobleAgoricChannelId: 'channel-21',
|
|
78
|
+
nobleDomainId: 4,
|
|
79
|
+
chainPolicies: {
|
|
80
|
+
Arbitrum: {
|
|
81
|
+
cctpTokenMessengerAddress:
|
|
82
|
+
'0x19330d10D9Cc8751218eaf51E8885D058642E08A',
|
|
83
|
+
chainId: 42161,
|
|
84
|
+
confirmations: 2,
|
|
85
|
+
nobleContractAddress: '0x19330d10D9Cc8751218eaf51E8885D058642E08A',
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
chainInfo: /** @type {Record<string, CosmosChainInfo & Passable>} */ (
|
|
90
|
+
withChainCapabilities(fetchedChainInfo)
|
|
91
|
+
),
|
|
92
|
+
assetInfo: defaultAssetInfo,
|
|
93
|
+
},
|
|
94
|
+
DEVNET: {
|
|
95
|
+
oracles: {
|
|
96
|
+
DSRV: 'agoric1lw4e4aas9q84tq0q92j85rwjjjapf8dmnllnft',
|
|
97
|
+
Stakin: 'agoric1zj6vrrrjq4gsyr9lw7dplv4vyejg3p8j2urm82',
|
|
98
|
+
'01node': 'agoric1ra0g6crtsy6r3qnpu7ruvm7qd4wjnznyzg5nu4',
|
|
99
|
+
'Simply Staking': 'agoric1qj07c7vfk3knqdral0sej7fa6eavkdn8vd8etf',
|
|
100
|
+
P2P: 'agoric10vjkvkmpp9e356xeh6qqlhrny2htyzp8hf88fk',
|
|
101
|
+
},
|
|
102
|
+
feedPolicy: {
|
|
103
|
+
nobleAgoricChannelId: 'TODO',
|
|
104
|
+
nobleDomainId: 4,
|
|
105
|
+
chainPolicies: {
|
|
106
|
+
Arbitrum: {
|
|
107
|
+
cctpTokenMessengerAddress: '0xTODO',
|
|
108
|
+
chainId: 421614,
|
|
109
|
+
confirmations: 2,
|
|
110
|
+
nobleContractAddress: '0xTODO',
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
chainInfo: /** @type {Record<string, CosmosChainInfo & Passable>} */ (
|
|
115
|
+
withChainCapabilities(fetchedChainInfo) // TODO: use devnet values
|
|
116
|
+
),
|
|
117
|
+
assetInfo: defaultAssetInfo, // TODO: use emerynet values
|
|
118
|
+
},
|
|
119
|
+
EMERYNET: {
|
|
120
|
+
oracles: {
|
|
121
|
+
gov1: 'agoric1ldmtatp24qlllgxmrsjzcpe20fvlkp448zcuce',
|
|
122
|
+
gov2: 'agoric140dmkrz2e42ergjj7gyvejhzmjzurvqeq82ang',
|
|
123
|
+
},
|
|
124
|
+
feedPolicy: {
|
|
125
|
+
nobleAgoricChannelId: 'TODO',
|
|
126
|
+
nobleDomainId: 4,
|
|
127
|
+
chainPolicies: {
|
|
128
|
+
Arbitrum: {
|
|
129
|
+
cctpTokenMessengerAddress: '0xTODO',
|
|
130
|
+
chainId: 421614,
|
|
131
|
+
confirmations: 2,
|
|
132
|
+
nobleContractAddress: '0xTODO',
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
chainInfo: /** @type {Record<string, CosmosChainInfo & Passable>} */ (
|
|
137
|
+
withChainCapabilities(fetchedChainInfo) // TODO: use emerynet values
|
|
138
|
+
),
|
|
139
|
+
assetInfo: defaultAssetInfo, // TODO: use emerynet values
|
|
140
|
+
},
|
|
141
|
+
};
|