@agoric/fast-usdc 0.1.1-dev-3cbd11f.0 → 0.1.1-dev-4b5dff2.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.
@@ -1,123 +0,0 @@
1
- import { denomHash, withChainCapabilities } from '@agoric/orchestration';
2
- import fetchedChainInfo from '@agoric/orchestration/src/fetched-chain-info.js';
3
- import { ChainPolicies, DepositForBurnEvent } from './chain-policies.js';
4
-
5
- /**
6
- * @import {FastUSDCConfig} from '@agoric/fast-usdc';
7
- * @import {Passable} from '@endo/marshal';
8
- * @import {CosmosChainInfo, Denom, DenomDetail} from '@agoric/orchestration';
9
- */
10
-
11
- /** @type {[Denom, DenomDetail & { brandKey?: string}]} */
12
- const usdcOnAgoric = [
13
- `ibc/${denomHash({ denom: 'uusdc', channelId: fetchedChainInfo.agoric.connections['noble-1'].transferChannel.channelId })}`,
14
- {
15
- baseName: 'noble',
16
- chainName: 'agoric',
17
- baseDenom: 'uusdc',
18
- brandKey: 'USDC',
19
- },
20
- ];
21
-
22
- /** @type {[Denom, DenomDetail & { brandKey?: string}][]} */
23
- export const transferAssetInfo = [
24
- ['uusdc', { baseName: 'noble', chainName: 'noble', baseDenom: 'uusdc' }],
25
- usdcOnAgoric,
26
- ];
27
- harden(transferAssetInfo);
28
-
29
- /**
30
- * @type {Record<string, Pick<FastUSDCConfig, 'oracles' | 'feedPolicy' | 'chainInfo' | 'assetInfo' >>}
31
- *
32
- * meanwhile, use price oracle addresses (from updatePriceFeeds.js).
33
- */
34
- export const configurations = {
35
- /**
36
- * NOTE: The a3p-integration runtime does _not_ include
37
- * a noble chain; this limits functionality to advancing
38
- * to the Agoric chain.
39
- */
40
- A3P_INTEGRATION: {
41
- oracles: {
42
- gov1: 'agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q',
43
- gov2: 'agoric1wrfh296eu2z34p6pah7q04jjuyj3mxu9v98277',
44
- gov3: 'agoric1ydzxwh6f893jvpaslmaz6l8j2ulup9a7x8qvvq',
45
- },
46
- feedPolicy: {
47
- nobleAgoricChannelId: 'channel-does-not-exist',
48
- nobleDomainId: 4,
49
- chainPolicies: ChainPolicies.TESTNET,
50
- eventFilter: DepositForBurnEvent,
51
- },
52
- chainInfo: /** @type {Record<string, CosmosChainInfo & Passable>} */ (
53
- withChainCapabilities({
54
- agoric: fetchedChainInfo.agoric,
55
- // registering USDC-on-agoric requires registering the noble chain
56
- noble: fetchedChainInfo.noble,
57
- })
58
- ),
59
- assetInfo: [usdcOnAgoric],
60
- },
61
- MAINNET: {
62
- // per JVC 12 Feb 2025
63
- oracles: {
64
- '01node': 'agoric1ym488t6j24x3ys3va3452ftx44lhs64rz8pu7h',
65
- SimplyStaking: 'agoric1s5yawjgj6xcw4ea5r2x4cjrnkprmd0fcun2tyk',
66
- DSRV: 'agoric17crpkfxarq658e9ddru2petrfr0fhjzvjfccq9',
67
- },
68
- feedPolicy: {
69
- nobleAgoricChannelId: 'channel-21',
70
- nobleDomainId: 4,
71
- chainPolicies: ChainPolicies.MAINNET,
72
- eventFilter: DepositForBurnEvent,
73
- },
74
- chainInfo: /** @type {Record<string, CosmosChainInfo & Passable>} */ (
75
- withChainCapabilities(fetchedChainInfo)
76
- ),
77
- assetInfo: transferAssetInfo,
78
- },
79
- DEVNET: {
80
- oracles: {
81
- DSRV: 'agoric1lw4e4aas9q84tq0q92j85rwjjjapf8dmnllnft',
82
- Stakin: 'agoric1zj6vrrrjq4gsyr9lw7dplv4vyejg3p8j2urm82',
83
- '01node': 'agoric1ra0g6crtsy6r3qnpu7ruvm7qd4wjnznyzg5nu4',
84
- 'Simply Staking': 'agoric1qj07c7vfk3knqdral0sej7fa6eavkdn8vd8etf',
85
- P2P: 'agoric10vjkvkmpp9e356xeh6qqlhrny2htyzp8hf88fk',
86
- },
87
- feedPolicy: {
88
- nobleAgoricChannelId: 'TODO',
89
- nobleDomainId: 4,
90
- chainPolicies: ChainPolicies.TESTNET,
91
- eventFilter: DepositForBurnEvent,
92
- },
93
- chainInfo: /** @type {Record<string, CosmosChainInfo & Passable>} */ (
94
- withChainCapabilities(fetchedChainInfo) // TODO: use devnet values
95
- ),
96
- assetInfo: transferAssetInfo,
97
- },
98
- EMERYNET: {
99
- oracles: {
100
- gov1: 'agoric1ldmtatp24qlllgxmrsjzcpe20fvlkp448zcuce',
101
- gov2: 'agoric140dmkrz2e42ergjj7gyvejhzmjzurvqeq82ang',
102
- },
103
- feedPolicy: {
104
- nobleAgoricChannelId: 'TODO',
105
- nobleDomainId: 4,
106
- chainPolicies: ChainPolicies.TESTNET,
107
- eventFilter: DepositForBurnEvent,
108
- },
109
- chainInfo: /** @type {Record<string, CosmosChainInfo & Passable>} */ (
110
- withChainCapabilities(fetchedChainInfo) // TODO: use emerynet values
111
- ),
112
- assetInfo: transferAssetInfo,
113
- },
114
- };
115
- harden(configurations);
116
-
117
- // Constraints on the configurations
118
- const MAINNET_EXPECTED_ORACLES = 3;
119
- assert(
120
- new Set(Object.values(configurations.MAINNET.oracles)).size ===
121
- MAINNET_EXPECTED_ORACLES,
122
- `Mainnet must have exactly ${MAINNET_EXPECTED_ORACLES} oracles`,
123
- );
@@ -1,117 +0,0 @@
1
- import { Fail } from '@endo/errors';
2
-
3
- /**
4
- * @import {Key} from '@endo/patterns';
5
- */
6
-
7
- // TODO provide something like this in a more common place, perhaps as a BagStore
8
- /**
9
- * Creates a bag (multi-set) API that wraps a MapStore where values are counts.
10
- *
11
- * @template {Key} K
12
- * @param {MapStore<K, number>} mapStore
13
- */
14
- export const asMultiset = mapStore =>
15
- harden({
16
- /**
17
- * Add an item to the bag, incrementing its count.
18
- *
19
- * @param {K} item The item to add
20
- * @param {number} [count] How many to add (defaults to 1)
21
- */
22
- add: (item, count = 1) => {
23
- (count > 0 && Number.isInteger(count)) ||
24
- Fail`Cannot add a non-positive integer count ${count} to bag`;
25
-
26
- if (mapStore.has(item)) {
27
- const currentCount = mapStore.get(item);
28
- mapStore.set(item, currentCount + count);
29
- } else {
30
- mapStore.init(item, count);
31
- }
32
- },
33
-
34
- /**
35
- * Remove an item from the bag, decrementing its count. If count reaches
36
- * zero, the item is removed completely.
37
- *
38
- * @param {K} item The item to remove
39
- * @param {number} [count] How many to remove (defaults to 1)
40
- * @returns {boolean} Whether the removal was successful
41
- * @throws {Error} If trying to remove more items than exist
42
- */
43
- remove: (item, count = 1) => {
44
- (count > 0 && Number.isInteger(count)) ||
45
- Fail`Cannot remove a non-positive integer count ${count} from bag`;
46
-
47
- if (!mapStore.has(item)) {
48
- return false;
49
- }
50
-
51
- const currentCount = mapStore.get(item);
52
- if (currentCount < count) {
53
- return false;
54
- }
55
-
56
- if (currentCount === count) {
57
- mapStore.delete(item);
58
- } else {
59
- mapStore.set(item, currentCount - count);
60
- }
61
- return true;
62
- },
63
-
64
- /**
65
- * Get the count of an item in the bag.
66
- *
67
- * @param {K} item The item to check
68
- * @returns {number} The count (0 if not present)
69
- */
70
- count: item => {
71
- return mapStore.has(item) ? mapStore.get(item) : 0;
72
- },
73
-
74
- /**
75
- * Check if the bag contains at least one of the item.
76
- *
77
- * @param {K} item The item to check
78
- * @returns {boolean} Whether the item is in the bag
79
- */
80
- has: item => {
81
- return mapStore.has(item);
82
- },
83
-
84
- /**
85
- * Get all unique items in the bag.
86
- *
87
- * @returns {Iterable<K>} Iterable of unique items
88
- */
89
- keys: () => {
90
- return mapStore.keys();
91
- },
92
-
93
- /**
94
- * Get all entries (item, count) in the bag.
95
- *
96
- * @returns {Iterable<[K, number]>} Iterable of [item, count] pairs
97
- */
98
- entries: () => {
99
- return mapStore.entries();
100
- },
101
-
102
- /**
103
- * Get the total number of unique items in the bag.
104
- *
105
- * @returns {number} Number of unique items
106
- */
107
- size: () => {
108
- return mapStore.getSize();
109
- },
110
-
111
- /**
112
- * Remove all items from the bag.
113
- */
114
- clear: () => {
115
- mapStore.clear();
116
- },
117
- });
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
- };