@mixerx/config 0.5.2 → 1.0.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/README.md +35 -19
- package/dist/assertions.d.ts +2 -34
- package/dist/assertions.js +196 -195
- package/dist/assertions.js.map +1 -1
- package/dist/check-shape.d.ts +0 -1
- package/dist/check-shape.js +2 -5
- package/dist/check-shape.js.map +1 -1
- package/dist/config.d.ts +5 -70
- package/dist/config.js +85 -342
- package/dist/config.js.map +1 -1
- package/dist/guards.d.ts +1 -2
- package/dist/guards.js +1 -1
- package/dist/guards.js.map +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.js +12 -41
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +55 -146
- package/dist/types.js +3 -2
- package/dist/types.js.map +1 -1
- package/package.json +27 -12
- package/dist/assertions.d.ts.map +0 -1
- package/dist/check-shape.d.ts.map +0 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/guards.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,27 +1,43 @@
|
|
|
1
1
|
# @mixerx/config
|
|
2
2
|
|
|
3
|
-
MixerX protocol config
|
|
3
|
+
Validated, immutable MixerX protocol config for Sepolia only.
|
|
4
4
|
|
|
5
|
-
Supported network ids are exported from `SUPPORTED_NET_IDS`.
|
|
6
|
-
|
|
7
|
-
`networkConfigByNetId
|
|
5
|
+
Supported network ids are exported from `SUPPORTED_NET_IDS`. Resolve data through
|
|
6
|
+
`getNetworkConfig(chainId)` and `getInstancesForNetId(chainId)` so unsupported
|
|
7
|
+
or prototype-derived keys fail closed. `instances` and `networkConfigByNetId`
|
|
8
|
+
remain exported for current consumers, but every exported object is frozen.
|
|
9
|
+
|
|
10
|
+
This branch deliberately contains no Ethereum mainnet or Tornado Cash catalogue.
|
|
11
|
+
Mainnet must not be enabled until MixerX deployment addresses, blocks and a legal
|
|
12
|
+
review are supplied and tested as a separate network configuration.
|
|
8
13
|
|
|
9
14
|
## Sepolia status
|
|
10
15
|
|
|
11
|
-
Sepolia (`11155111`)
|
|
12
|
-
|
|
13
|
-
token (`DSToken`).
|
|
16
|
+
The `sepolia_v5.4` catalogue generation configures Sepolia (`11155111`) with its
|
|
17
|
+
deployed pools, router, registries, pool factories, relayer
|
|
18
|
+
aggregator, offchain oracle, and FDS token (`DSToken`).
|
|
19
|
+
|
|
20
|
+
The Sepolia ENS registry address is a MixerX deployment rather than the canonical
|
|
21
|
+
Ethereum ENS registry. It is retained because it is the registry used by the
|
|
22
|
+
deployed Phase 5 contracts.
|
|
23
|
+
|
|
24
|
+
The current Phase 5 deployment intentionally uses the FDS contract for both the
|
|
25
|
+
protocol token and wrapped stablecoin roles. Consumers must treat these as roles,
|
|
26
|
+
not as proof that two independent assets exist. A future deployment that separates
|
|
27
|
+
the assets must update both addresses and the contract tests together.
|
|
28
|
+
|
|
29
|
+
The catalogue exposes only the eight fixed-denomination pools currently enabled
|
|
30
|
+
in the Sepolia `InstanceRegistry`. Disabled custom-pool deployments are omitted
|
|
31
|
+
until their on-chain registry metadata and state are valid.
|
|
14
32
|
|
|
15
|
-
Custom pools that do not map to a fixed denomination use the string key
|
|
16
|
-
`custom` in `instanceAddress`, producing pool ids like `eth-custom` or
|
|
17
|
-
`fds-custom`.
|
|
18
|
-
|
|
19
33
|
Each currency declares `assetType` as `native` or `erc20`. ERC20 currencies also
|
|
20
|
-
declare `tokenAddress`.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
- `yarn
|
|
27
|
-
- `yarn
|
|
34
|
+
declare `tokenAddress`.
|
|
35
|
+
Use each currency's `denominations` array when order matters; JavaScript object-key
|
|
36
|
+
ordering is not a protocol ordering guarantee.
|
|
37
|
+
|
|
38
|
+
## Scripts
|
|
39
|
+
|
|
40
|
+
- `yarn typecheck`
|
|
41
|
+
- `yarn build`
|
|
42
|
+
- `yarn check:shape`
|
|
43
|
+
- `yarn test` (build, shape validation and contract/regression tests)
|
package/dist/assertions.d.ts
CHANGED
|
@@ -1,34 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare function assertValidConfigShape(input:
|
|
3
|
-
torn: Torn;
|
|
4
|
-
miningV2: Mining;
|
|
5
|
-
vesting: Vesting;
|
|
6
|
-
instances: Instances;
|
|
7
|
-
voucher: Voucher;
|
|
8
|
-
rewardSwap: RewardSwap;
|
|
9
|
-
tornadoTrees: TornadoTrees;
|
|
10
|
-
governance: Address;
|
|
11
|
-
governanceImpl: Address;
|
|
12
|
-
tornadoProxy: Address;
|
|
13
|
-
tornadoProxyLight: Address;
|
|
14
|
-
rewardVerifier: Address;
|
|
15
|
-
treeUpdateVerifier: Address;
|
|
16
|
-
withdrawVerifier: Address;
|
|
17
|
-
poseidonHasher2: Address;
|
|
18
|
-
poseidonHasher3: Address;
|
|
19
|
-
feeManager: Address;
|
|
20
|
-
tornadoStakingRewards: Address;
|
|
21
|
-
relayerRegistry: Address;
|
|
22
|
-
tornadoRouter: Address;
|
|
23
|
-
instanceRegistry: Address;
|
|
24
|
-
deployer: Address;
|
|
25
|
-
relayerRegistryProxy: Address;
|
|
26
|
-
aggregator: Address;
|
|
27
|
-
offchainOracle: Address;
|
|
28
|
-
governanceProxy: Address;
|
|
29
|
-
tornadoProxyMainnet: Address;
|
|
30
|
-
mixerxToken: TokenConfig;
|
|
31
|
-
wrappedStablecoin: Address;
|
|
32
|
-
networkConfigByNetId: Partial<Record<number, NetworkConfig>>;
|
|
33
|
-
}): void;
|
|
34
|
-
//# sourceMappingURL=assertions.d.ts.map
|
|
1
|
+
import { type MixerXConfig } from './types.js';
|
|
2
|
+
export declare function assertValidConfigShape(input: unknown): asserts input is MixerXConfig;
|
package/dist/assertions.js
CHANGED
|
@@ -1,231 +1,232 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.assertValidConfigShape = assertValidConfigShape;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
const types_js_1 = require("./types.js");
|
|
5
|
+
const EVM_ADDRESS_PATTERN = /^0x[0-9a-fA-F]{40}$/u;
|
|
6
|
+
const ZERO_EVM_ADDRESS = '0x0000000000000000000000000000000000000000';
|
|
7
|
+
const DECIMAL_DENOMINATION_PATTERN = /^(?:0|[1-9]\d*)(?:\.\d+)?$/u;
|
|
8
|
+
const TOKEN_SYMBOL_PATTERN = /^[A-Za-z0-9._-]{1,16}$/u;
|
|
9
|
+
const MAX_TOKEN_DECIMALS = 36;
|
|
10
|
+
const CONTRACT_KEYS = [
|
|
11
11
|
'aggregator',
|
|
12
|
-
'offchainOracleAddress',
|
|
13
|
-
'tornadoRouter',
|
|
14
|
-
'deployer',
|
|
15
|
-
'feeManager',
|
|
16
|
-
'governance',
|
|
17
|
-
'governanceImpl',
|
|
18
|
-
'governanceAddress',
|
|
19
|
-
'instanceRegistry',
|
|
20
|
-
'oldMixerXProxy',
|
|
21
|
-
'poseidonHasher2',
|
|
22
|
-
'poseidonHasher3',
|
|
23
|
-
'rewardSwap',
|
|
24
|
-
'rewardVerifier',
|
|
25
|
-
'tornadoProxy',
|
|
26
|
-
'tornadoProxyLight',
|
|
27
|
-
'tornadoStakingRewards',
|
|
28
|
-
'tornadoTrees',
|
|
29
|
-
'treeUpdateVerifier',
|
|
30
|
-
'voucher',
|
|
31
|
-
'withdrawVerifier',
|
|
32
|
-
];
|
|
33
|
-
const sepoliaRequiredContracts = [
|
|
34
|
-
'fds',
|
|
35
|
-
'roles',
|
|
36
12
|
'config',
|
|
37
|
-
'
|
|
13
|
+
'erc20PoolFactory',
|
|
14
|
+
'ensRegistryAddress',
|
|
15
|
+
'ethPoolFactory',
|
|
16
|
+
'fds',
|
|
38
17
|
'feeManager',
|
|
39
|
-
'instanceRegistry',
|
|
40
|
-
'relayerRegistryAddress',
|
|
41
|
-
'relayerRegistry',
|
|
42
|
-
'mixerXRouter',
|
|
43
|
-
'verifier',
|
|
44
18
|
'hasher',
|
|
45
19
|
'huffVerifier',
|
|
46
|
-
'
|
|
20
|
+
'instanceRegistry',
|
|
21
|
+
'mixerXRouter',
|
|
47
22
|
'noteBackup',
|
|
48
|
-
'ensRegistryAddress',
|
|
49
23
|
'offchainOracleAddress',
|
|
24
|
+
'pauser',
|
|
25
|
+
'relayerRegistry',
|
|
26
|
+
'relayerRegistryAddress',
|
|
27
|
+
'roles',
|
|
28
|
+
'verifier',
|
|
50
29
|
];
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
assertString(value.address, `${key}.address`);
|
|
66
|
-
assertString(value.symbol, `${key}.symbol`);
|
|
67
|
-
if (!Number.isFinite(value.decimals) || !Number.isInteger(value.decimals) || value.decimals < 0) {
|
|
68
|
-
throw new Error(`Invalid ${key}.decimals`);
|
|
30
|
+
const CONTRACT_DEPLOYMENT_BLOCK_KEYS = [
|
|
31
|
+
'erc20PoolFactoryDeploymentBlock',
|
|
32
|
+
'ensRegistryDeploymentBlock',
|
|
33
|
+
'ethPoolFactoryDeploymentBlock',
|
|
34
|
+
'instanceRegistryDeploymentBlock',
|
|
35
|
+
'relayerRegistryDeploymentBlock',
|
|
36
|
+
];
|
|
37
|
+
const SUPPORTED_CONTRACT_KEYS = new Set([
|
|
38
|
+
...CONTRACT_KEYS,
|
|
39
|
+
...CONTRACT_DEPLOYMENT_BLOCK_KEYS,
|
|
40
|
+
]);
|
|
41
|
+
function assertRecord(value, label) {
|
|
42
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
43
|
+
throw new Error(`${label} must be an object`);
|
|
69
44
|
}
|
|
70
45
|
}
|
|
71
|
-
function
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
if (!Number.isFinite(value.pausePeriod) || value.pausePeriod <= 0) {
|
|
75
|
-
throw new Error('Invalid torn.pausePeriod');
|
|
46
|
+
function assertEvmAddress(value, label) {
|
|
47
|
+
if (typeof value !== 'string' || !EVM_ADDRESS_PATTERN.test(value)) {
|
|
48
|
+
throw new Error(`${label} must be a 20-byte EVM address`);
|
|
76
49
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
assertString(value.distribution[key].amount, `torn.distribution.${key}.amount`);
|
|
50
|
+
if (value.toLowerCase() === ZERO_EVM_ADDRESS) {
|
|
51
|
+
throw new Error(`${label} must not be the zero address`);
|
|
80
52
|
}
|
|
81
53
|
}
|
|
82
|
-
function
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (!Array.isArray(value.rates) || value.rates.length === 0) {
|
|
86
|
-
throw new Error('Invalid miningV2.rates');
|
|
87
|
-
}
|
|
88
|
-
for (const [index, rate] of value.rates.entries()) {
|
|
89
|
-
assertString(rate.instance, `miningV2.rates.${index}.instance`);
|
|
90
|
-
assertString(rate.value, `miningV2.rates.${index}.value`);
|
|
54
|
+
function assertPositiveInteger(value, label) {
|
|
55
|
+
if (!Number.isSafeInteger(value) || value <= 0) {
|
|
56
|
+
throw new Error(`${label} must be a positive integer`);
|
|
91
57
|
}
|
|
92
58
|
}
|
|
93
|
-
function
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
assertString(vestingInfo.address, `vesting.${key}.address`);
|
|
97
|
-
if (!Number.isFinite(vestingInfo.cliff) || !Number.isFinite(vestingInfo.duration)) {
|
|
98
|
-
throw new Error(`Invalid vesting.${key} schedule`);
|
|
99
|
-
}
|
|
59
|
+
function assertDecimals(value, label) {
|
|
60
|
+
if (!Number.isInteger(value) || value < 0 || value > MAX_TOKEN_DECIMALS) {
|
|
61
|
+
throw new Error(`${label} must be an integer from 0 to ${MAX_TOKEN_DECIMALS}`);
|
|
100
62
|
}
|
|
101
63
|
}
|
|
102
|
-
function
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
throw new Error('Invalid voucher.duration');
|
|
64
|
+
function assertTokenSymbol(value, label) {
|
|
65
|
+
if (typeof value !== 'string' || !TOKEN_SYMBOL_PATTERN.test(value)) {
|
|
66
|
+
throw new Error(`${label} must be a 1 to 16 character token symbol`);
|
|
106
67
|
}
|
|
107
68
|
}
|
|
108
|
-
function
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
69
|
+
function compareDecimalDenominations(left, right) {
|
|
70
|
+
const [leftInteger = '', leftFraction = ''] = left.split('.');
|
|
71
|
+
const [rightInteger = '', rightFraction = ''] = right.split('.');
|
|
72
|
+
if (leftInteger.length !== rightInteger.length) {
|
|
73
|
+
return leftInteger.length - rightInteger.length;
|
|
74
|
+
}
|
|
75
|
+
if (leftInteger !== rightInteger) {
|
|
76
|
+
return leftInteger < rightInteger ? -1 : 1;
|
|
77
|
+
}
|
|
78
|
+
const fractionLength = Math.max(leftFraction.length, rightFraction.length);
|
|
79
|
+
const normalizedLeftFraction = leftFraction.padEnd(fractionLength, '0');
|
|
80
|
+
const normalizedRightFraction = rightFraction.padEnd(fractionLength, '0');
|
|
81
|
+
if (normalizedLeftFraction === normalizedRightFraction) {
|
|
82
|
+
return 0;
|
|
83
|
+
}
|
|
84
|
+
return normalizedLeftFraction < normalizedRightFraction ? -1 : 1;
|
|
113
85
|
}
|
|
114
|
-
function
|
|
115
|
-
|
|
116
|
-
if (
|
|
117
|
-
throw new Error(
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
if (!
|
|
122
|
-
throw new Error(
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
if (
|
|
128
|
-
throw new Error(
|
|
129
|
-
}
|
|
130
|
-
if (
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
if (
|
|
134
|
-
throw new Error(
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
86
|
+
function assertCurrency(currency, label, poolAddresses) {
|
|
87
|
+
assertRecord(currency, label);
|
|
88
|
+
if (currency.assetType !== 'native' && currency.assetType !== 'erc20') {
|
|
89
|
+
throw new Error(`${label}.assetType must be native or erc20`);
|
|
90
|
+
}
|
|
91
|
+
assertTokenSymbol(currency.symbol, `${label}.symbol`);
|
|
92
|
+
assertDecimals(currency.decimals, `${label}.decimals`);
|
|
93
|
+
if (!Array.isArray(currency.denominations) || currency.denominations.length === 0) {
|
|
94
|
+
throw new Error(`${label}.denominations must be a non-empty array`);
|
|
95
|
+
}
|
|
96
|
+
assertRecord(currency.instanceAddress, `${label}.instanceAddress`);
|
|
97
|
+
assertRecord(currency.deploymentBlock, `${label}.deploymentBlock`);
|
|
98
|
+
const pools = Object.entries(currency.instanceAddress);
|
|
99
|
+
if (pools.length === 0) {
|
|
100
|
+
throw new Error(`${label} must define at least one pool`);
|
|
101
|
+
}
|
|
102
|
+
if (currency.assetType === 'erc20') {
|
|
103
|
+
assertEvmAddress(currency.tokenAddress, `${label}.tokenAddress`);
|
|
104
|
+
}
|
|
105
|
+
else if ('tokenAddress' in currency) {
|
|
106
|
+
throw new Error(`${label} native currency cannot define tokenAddress`);
|
|
107
|
+
}
|
|
108
|
+
const denominationKeys = new Set(pools.map(([denomination]) => denomination));
|
|
109
|
+
if (new Set(currency.denominations).size !== currency.denominations.length ||
|
|
110
|
+
currency.denominations.some((denomination) => !denominationKeys.has(denomination)) ||
|
|
111
|
+
currency.denominations.length !== denominationKeys.size) {
|
|
112
|
+
throw new Error(`${label}.denominations must list each configured pool exactly once`);
|
|
113
|
+
}
|
|
114
|
+
for (const [denomination, address] of pools) {
|
|
141
115
|
if (denomination !== 'custom' && !DECIMAL_DENOMINATION_PATTERN.test(denomination)) {
|
|
142
|
-
throw new Error(
|
|
116
|
+
throw new Error(`${label}.${denomination} is not a valid denomination`);
|
|
143
117
|
}
|
|
118
|
+
assertEvmAddress(address, `${label}.instanceAddress.${denomination}`);
|
|
119
|
+
const normalized = address.toLowerCase();
|
|
120
|
+
if (poolAddresses.has(normalized)) {
|
|
121
|
+
throw new Error(`Duplicate pool address ${address}`);
|
|
122
|
+
}
|
|
123
|
+
poolAddresses.add(normalized);
|
|
124
|
+
assertPositiveInteger(currency.deploymentBlock[denomination], `${label}.deploymentBlock.${denomination}`);
|
|
144
125
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
if (networks.length === 0) {
|
|
149
|
-
throw new Error('Instances config is empty');
|
|
150
|
-
}
|
|
151
|
-
for (const [network, currencies] of networks) {
|
|
152
|
-
const entries = Object.entries(currencies ?? {});
|
|
153
|
-
if (entries.length === 0) {
|
|
154
|
-
throw new Error(`Network ${network} has no currencies`);
|
|
126
|
+
const expectedOrder = [...denominationKeys].sort((left, right) => {
|
|
127
|
+
if (left === 'custom') {
|
|
128
|
+
return 1;
|
|
155
129
|
}
|
|
156
|
-
|
|
157
|
-
|
|
130
|
+
if (right === 'custom') {
|
|
131
|
+
return -1;
|
|
158
132
|
}
|
|
133
|
+
return compareDecimalDenominations(left, right);
|
|
134
|
+
});
|
|
135
|
+
if (currency.denominations.some((denomination, index) => denomination !== expectedOrder[index])) {
|
|
136
|
+
throw new Error(`${label}.denominations must be in ascending numeric order with custom last`);
|
|
159
137
|
}
|
|
160
138
|
}
|
|
161
|
-
function
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
for (const
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
139
|
+
function assertNetwork(network, poolAddresses) {
|
|
140
|
+
assertRecord(network, `networkConfigByNetId.${types_js_1.SEPOLIA_NET_ID}`);
|
|
141
|
+
assertRecord(network.contracts, `networkConfigByNetId.${types_js_1.SEPOLIA_NET_ID}.contracts`);
|
|
142
|
+
assertRecord(network.tokens, `networkConfigByNetId.${types_js_1.SEPOLIA_NET_ID}.tokens`);
|
|
143
|
+
const unknownContractKey = Object.keys(network.contracts).find((key) => !SUPPORTED_CONTRACT_KEYS.has(key));
|
|
144
|
+
if (unknownContractKey) {
|
|
145
|
+
throw new Error(`sepolia.contracts contains unsupported key ${unknownContractKey}`);
|
|
146
|
+
}
|
|
147
|
+
for (const key of CONTRACT_KEYS) {
|
|
148
|
+
assertEvmAddress(network.contracts[key], `sepolia.contracts.${key}`);
|
|
149
|
+
}
|
|
150
|
+
const contractAddressRoles = new Map();
|
|
151
|
+
for (const key of CONTRACT_KEYS) {
|
|
152
|
+
if (key === 'relayerRegistryAddress') {
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
const contractAddress = network.contracts[key];
|
|
156
|
+
assertEvmAddress(contractAddress, `sepolia.contracts.${key}`);
|
|
157
|
+
const normalizedAddress = contractAddress.toLowerCase();
|
|
158
|
+
const existingRole = contractAddressRoles.get(normalizedAddress);
|
|
159
|
+
if (existingRole) {
|
|
160
|
+
throw new Error(`Sepolia contract roles ${key} and ${existingRole} must not share an address`);
|
|
161
|
+
}
|
|
162
|
+
if (poolAddresses.has(normalizedAddress)) {
|
|
163
|
+
if (key === 'mixerXRouter') {
|
|
164
|
+
throw new Error('Sepolia router address must not equal a pool address');
|
|
165
|
+
}
|
|
166
|
+
throw new Error(`Sepolia contract ${key} address must not equal a pool address`);
|
|
167
|
+
}
|
|
168
|
+
contractAddressRoles.set(normalizedAddress, key);
|
|
169
|
+
}
|
|
170
|
+
assertPositiveInteger(network.contracts.relayerRegistryDeploymentBlock, 'sepolia.contracts.relayerRegistryDeploymentBlock');
|
|
171
|
+
assertPositiveInteger(network.contracts.ensRegistryDeploymentBlock, 'sepolia.contracts.ensRegistryDeploymentBlock');
|
|
172
|
+
assertPositiveInteger(network.contracts.instanceRegistryDeploymentBlock, 'sepolia.contracts.instanceRegistryDeploymentBlock');
|
|
173
|
+
assertPositiveInteger(network.contracts.ethPoolFactoryDeploymentBlock, 'sepolia.contracts.ethPoolFactoryDeploymentBlock');
|
|
174
|
+
assertPositiveInteger(network.contracts.erc20PoolFactoryDeploymentBlock, 'sepolia.contracts.erc20PoolFactoryDeploymentBlock');
|
|
175
|
+
if (String(network.contracts.relayerRegistry).toLowerCase() !==
|
|
176
|
+
String(network.contracts.relayerRegistryAddress).toLowerCase()) {
|
|
177
|
+
throw new Error('Sepolia relayer registry aliases must resolve to the same address');
|
|
178
|
+
}
|
|
179
|
+
const routerAddress = network.contracts.mixerXRouter;
|
|
180
|
+
assertEvmAddress(routerAddress, 'sepolia.contracts.mixerXRouter');
|
|
181
|
+
assertEvmAddress(network.tokens.mixerXTokenAddress, 'sepolia.tokens.mixerXTokenAddress');
|
|
182
|
+
assertEvmAddress(network.tokens.wrappedStablecoinAddress, 'sepolia.tokens.wrappedStablecoinAddress');
|
|
183
|
+
assertTokenSymbol(network.tokens.mixerXTokenSymbol, 'sepolia.tokens.mixerXTokenSymbol');
|
|
184
|
+
assertDecimals(network.tokens.mixerXTokenDecimals, 'sepolia.tokens.mixerXTokenDecimals');
|
|
182
185
|
}
|
|
183
|
-
function
|
|
184
|
-
const
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
186
|
+
function assertFdsTokenAliases(network, currencies) {
|
|
187
|
+
const fdsCurrency = currencies.fds;
|
|
188
|
+
assertRecord(fdsCurrency, `instances.${types_js_1.SEPOLIA_NET_ID}.fds`);
|
|
189
|
+
assertEvmAddress(fdsCurrency.tokenAddress, `instances.${types_js_1.SEPOLIA_NET_ID}.fds.tokenAddress`);
|
|
190
|
+
const addresses = [
|
|
191
|
+
network.contracts.fds,
|
|
192
|
+
network.tokens.mixerXTokenAddress,
|
|
193
|
+
network.tokens.wrappedStablecoinAddress,
|
|
194
|
+
fdsCurrency.tokenAddress,
|
|
195
|
+
];
|
|
196
|
+
if (new Set(addresses.map((address) => address.toLowerCase())).size !== 1) {
|
|
197
|
+
throw new Error('Sepolia FDS address aliases must resolve to the same address');
|
|
198
|
+
}
|
|
199
|
+
if (fdsCurrency.symbol !== network.tokens.mixerXTokenSymbol ||
|
|
200
|
+
fdsCurrency.decimals !== network.tokens.mixerXTokenDecimals) {
|
|
201
|
+
throw new Error('Sepolia FDS symbol and decimals aliases must match');
|
|
191
202
|
}
|
|
192
|
-
assertCompleteNetworkConfig('mainnet', mainnetConfig, mainnetRequiredContracts);
|
|
193
|
-
assertCompleteNetworkConfig('sepolia', sepoliaConfig, sepoliaRequiredContracts);
|
|
194
203
|
}
|
|
195
204
|
function assertValidConfigShape(input) {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
[
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
['governanceProxy', input.governanceProxy],
|
|
223
|
-
['tornadoProxyMainnet', input.tornadoProxyMainnet],
|
|
224
|
-
['wrappedStablecoin', input.wrappedStablecoin],
|
|
225
|
-
]) {
|
|
226
|
-
assertAddressLike(value, key);
|
|
227
|
-
}
|
|
228
|
-
assertToken(input.mixerxToken, 'mixerxToken');
|
|
229
|
-
assertNetworkConfig(input.networkConfigByNetId);
|
|
205
|
+
assertRecord(input, 'config');
|
|
206
|
+
assertRecord(input.instances, 'instances');
|
|
207
|
+
assertRecord(input.networkConfigByNetId, 'networkConfigByNetId');
|
|
208
|
+
const configuredNetIds = Object.keys(input.networkConfigByNetId);
|
|
209
|
+
if (configuredNetIds.length !== types_js_1.SUPPORTED_NET_IDS.length ||
|
|
210
|
+
configuredNetIds[0] !== String(types_js_1.SEPOLIA_NET_ID)) {
|
|
211
|
+
throw new Error(`Only Sepolia network ${types_js_1.SEPOLIA_NET_ID} may be configured`);
|
|
212
|
+
}
|
|
213
|
+
const instanceNetIds = Object.keys(input.instances);
|
|
214
|
+
if (instanceNetIds.length !== types_js_1.SUPPORTED_NET_IDS.length ||
|
|
215
|
+
instanceNetIds[0] !== String(types_js_1.SEPOLIA_NET_ID)) {
|
|
216
|
+
throw new Error(`Only Sepolia network ${types_js_1.SEPOLIA_NET_ID} may define instances`);
|
|
217
|
+
}
|
|
218
|
+
const currencies = input.instances[types_js_1.SEPOLIA_NET_ID];
|
|
219
|
+
assertRecord(currencies, `instances.${types_js_1.SEPOLIA_NET_ID}`);
|
|
220
|
+
const currencyEntries = Object.entries(currencies);
|
|
221
|
+
if (currencyEntries.length === 0) {
|
|
222
|
+
throw new Error(`instances.${types_js_1.SEPOLIA_NET_ID} must define at least one currency`);
|
|
223
|
+
}
|
|
224
|
+
const poolAddresses = new Set();
|
|
225
|
+
for (const [currencyName, currency] of currencyEntries) {
|
|
226
|
+
assertCurrency(currency, `instances.${types_js_1.SEPOLIA_NET_ID}.${currencyName}`, poolAddresses);
|
|
227
|
+
}
|
|
228
|
+
const network = input.networkConfigByNetId[types_js_1.SEPOLIA_NET_ID];
|
|
229
|
+
assertNetwork(network, poolAddresses);
|
|
230
|
+
assertFdsTokenAliases(network, currencies);
|
|
230
231
|
}
|
|
231
232
|
//# sourceMappingURL=assertions.js.map
|
package/dist/assertions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assertions.js","sourceRoot":"","sources":["../src/assertions.ts"],"names":[],"mappings":";;AA8OA,wDAoEC;AAnSD,MAAM,4BAA4B,GAAG,iBAAiB,CAAC;AAEvD,MAAM,gBAAgB,GAAG,CAAC,K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,oBAAoB,CAAC,yBAAc,CAAC,CAAC;IAC3D,aAAa,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IACtC,qBAAqB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["import {\r\n SEPOLIA_NET_ID,\r\n SUPPORTED_NET_IDS,\r\n type InstanceCurrency,\r\n type MixerXConfig,\r\n type NetworkConfig,\r\n type NetworkContractsConfig,\r\n} from './types.js';\r\n\r\nconst EVM_ADDRESS_PATTERN = /^0x[0-9a-fA-F]{40}$/u;\nconst ZERO_EVM_ADDRESS = '0x0000000000000000000000000000000000000000';\nconst DECIMAL_DENOMINATION_PATTERN = /^(?:0|[1-9]\\d*)(?:\\.\\d+)?$/u;\r\nconst TOKEN_SYMBOL_PATTERN = /^[A-Za-z0-9._-]{1,16}$/u;\nconst MAX_TOKEN_DECIMALS = 36;\nconst CONTRACT_KEYS = [\n 'aggregator',\r\n 'config',\r\n 'erc20PoolFactory',\r\n 'ensRegistryAddress',\r\n 'ethPoolFactory',\r\n 'fds',\r\n 'feeManager',\r\n 'hasher',\r\n 'huffVerifier',\r\n 'instanceRegistry',\r\n 'mixerXRouter',\r\n 'noteBackup',\r\n 'offchainOracleAddress',\r\n 'pauser',\r\n 'relayerRegistry',\r\n 'relayerRegistryAddress',\r\n 'roles',\r\n 'verifier',\r\n] as const satisfies readonly (keyof NetworkContractsConfig)[];\nconst CONTRACT_DEPLOYMENT_BLOCK_KEYS = [\n 'erc20PoolFactoryDeploymentBlock',\n 'ensRegistryDeploymentBlock',\n 'ethPoolFactoryDeploymentBlock',\n 'instanceRegistryDeploymentBlock',\n 'relayerRegistryDeploymentBlock',\n] as const satisfies readonly (keyof NetworkContractsConfig)[];\nconst SUPPORTED_CONTRACT_KEYS = new Set<string>([\n ...CONTRACT_KEYS,\n ...CONTRACT_DEPLOYMENT_BLOCK_KEYS,\n]);\n\r\nfunction assertRecord(value: unknown, label: string): asserts value is Record<string, unknown> {\r\n if (typeof value !== 'object' || value === null || Array.isArray(value)) {\r\n throw new Error(`${label} must be an object`);\r\n }\r\n}\r\n\r\nfunction assertEvmAddress(value: unknown, label: string): asserts value is `0x${string}` {\n if (typeof value !== 'string' || !EVM_ADDRESS_PATTERN.test(value)) {\n throw new Error(`${label} must be a 20-byte EVM address`);\n }\n if (value.toLowerCase() === ZERO_EVM_ADDRESS) {\n throw new Error(`${label} must not be the zero address`);\n }\n}\n\r\nfunction assertPositiveInteger(value: unknown, label: string): asserts value is number {\r\n if (!Number.isSafeInteger(value) || (value as number) <= 0) {\r\n throw new Error(`${label} must be a positive integer`);\r\n }\r\n}\r\n\r\nfunction assertDecimals(value: unknown, label: string): asserts value is number {\n if (!Number.isInteger(value) || (value as number) < 0 || (value as number) > MAX_TOKEN_DECIMALS) {\n throw new Error(`${label} must be an integer from 0 to ${MAX_TOKEN_DECIMALS}`);\n }\n}\n\nfunction assertTokenSymbol(value: unknown, label: string): asserts value is string {\n if (typeof value !== 'string' || !TOKEN_SYMBOL_PATTERN.test(value)) {\n throw new Error(`${label} must be a 1 to 16 character token symbol`);\n }\n}\n\nfunction compareDecimalDenominations(left: string, right: string): number {\n const [leftInteger = '', leftFraction = ''] = left.split('.');\n const [rightInteger = '', rightFraction = ''] = right.split('.');\n if (leftInteger.length !== rightInteger.length) {\n return leftInteger.length - rightInteger.length;\n }\n if (leftInteger !== rightInteger) {\n return leftInteger < rightInteger ? -1 : 1;\n }\n\n const fractionLength = Math.max(leftFraction.length, rightFraction.length);\n const normalizedLeftFraction = leftFraction.padEnd(fractionLength, '0');\n const normalizedRightFraction = rightFraction.padEnd(fractionLength, '0');\n if (normalizedLeftFraction === normalizedRightFraction) {\n return 0;\n }\n return normalizedLeftFraction < normalizedRightFraction ? -1 : 1;\n}\n\r\nfunction assertCurrency(\r\n currency: unknown,\r\n label: string,\r\n poolAddresses: Set<string>,\r\n): asserts currency is InstanceCurrency {\r\n assertRecord(currency, label);\r\n if (currency.assetType !== 'native' && currency.assetType !== 'erc20') {\r\n throw new Error(`${label}.assetType must be native or erc20`);\r\n }\r\n assertTokenSymbol(currency.symbol, `${label}.symbol`);\n assertDecimals(currency.decimals, `${label}.decimals`);\r\n if (!Array.isArray(currency.denominations) || currency.denominations.length === 0) {\r\n throw new Error(`${label}.denominations must be a non-empty array`);\r\n }\r\n assertRecord(currency.instanceAddress, `${label}.instanceAddress`);\r\n assertRecord(currency.deploymentBlock, `${label}.deploymentBlock`);\r\n const pools = Object.entries(currency.instanceAddress);\r\n if (pools.length === 0) {\r\n throw new Error(`${label} must define at least one pool`);\r\n }\r\n if (currency.assetType === 'erc20') {\r\n assertEvmAddress(currency.tokenAddress, `${label}.tokenAddress`);\r\n } else if ('tokenAddress' in currency) {\r\n throw new Error(`${label} native currency cannot define tokenAddress`);\r\n }\r\n\r\n const denominationKeys = new Set(pools.map(([denomination]) => denomination));\r\n if (\r\n new Set(currency.denominations).size !== currency.denominations.length ||\r\n currency.denominations.some((denomination) => !denominationKeys.has(denomination)) ||\r\n currency.denominations.length !== denominationKeys.size\r\n ) {\r\n throw new Error(`${label}.denominations must list each configured pool exactly once`);\r\n }\r\n\r\n for (const [denomination, address] of pools) {\n if (denomination !== 'custom' && !DECIMAL_DENOMINATION_PATTERN.test(denomination)) {\r\n throw new Error(`${label}.${denomination} is not a valid denomination`);\r\n }\r\n assertEvmAddress(address, `${label}.instanceAddress.${denomination}`);\r\n const normalized = address.toLowerCase();\r\n if (poolAddresses.has(normalized)) {\r\n throw new Error(`Duplicate pool address ${address}`);\r\n }\r\n poolAddresses.add(normalized);\r\n assertPositiveInteger(\n currency.deploymentBlock[denomination],\n `${label}.deploymentBlock.${denomination}`,\n );\n }\n\n const expectedOrder = [...denominationKeys].sort((left, right) => {\n if (left === 'custom') {\n return 1;\n }\n if (right === 'custom') {\n return -1;\n }\n return compareDecimalDenominations(left, right);\n });\n if (currency.denominations.some((denomination, index) => denomination !== expectedOrder[index])) {\n throw new Error(`${label}.denominations must be in ascending numeric order with custom last`);\n }\n}\n\r\nfunction assertNetwork(\n network: unknown,\r\n poolAddresses: Set<string>,\r\n): asserts network is NetworkConfig {\r\n assertRecord(network, `networkConfigByNetId.${SEPOLIA_NET_ID}`);\n assertRecord(network.contracts, `networkConfigByNetId.${SEPOLIA_NET_ID}.contracts`);\n assertRecord(network.tokens, `networkConfigByNetId.${SEPOLIA_NET_ID}.tokens`);\n const unknownContractKey = Object.keys(network.contracts).find(\n (key) => !SUPPORTED_CONTRACT_KEYS.has(key),\n );\n if (unknownContractKey) {\n throw new Error(`sepolia.contracts contains unsupported key ${unknownContractKey}`);\n }\n for (const key of CONTRACT_KEYS) {\n assertEvmAddress(network.contracts[key], `sepolia.contracts.${key}`);\n }\n const contractAddressRoles = new Map<string, string>();\n for (const key of CONTRACT_KEYS) {\n if (key === 'relayerRegistryAddress') {\n continue;\n }\n const contractAddress = network.contracts[key];\n assertEvmAddress(contractAddress, `sepolia.contracts.${key}`);\n const normalizedAddress = contractAddress.toLowerCase();\n const existingRole = contractAddressRoles.get(normalizedAddress);\n if (existingRole) {\n throw new Error(`Sepolia contract roles ${key} and ${existingRole} must not share an address`);\n }\n if (poolAddresses.has(normalizedAddress)) {\n if (key === 'mixerXRouter') {\n throw new Error('Sepolia router address must not equal a pool address');\n }\n throw new Error(`Sepolia contract ${key} address must not equal a pool address`);\n }\n contractAddressRoles.set(normalizedAddress, key);\n }\n assertPositiveInteger(\r\n network.contracts.relayerRegistryDeploymentBlock,\r\n 'sepolia.contracts.relayerRegistryDeploymentBlock',\r\n );\r\n assertPositiveInteger(\r\n network.contracts.ensRegistryDeploymentBlock,\r\n 'sepolia.contracts.ensRegistryDeploymentBlock',\r\n );\r\n assertPositiveInteger(\r\n network.contracts.instanceRegistryDeploymentBlock,\r\n 'sepolia.contracts.instanceRegistryDeploymentBlock',\r\n );\r\n assertPositiveInteger(\r\n network.contracts.ethPoolFactoryDeploymentBlock,\r\n 'sepolia.contracts.ethPoolFactoryDeploymentBlock',\r\n );\r\n assertPositiveInteger(\r\n network.contracts.erc20PoolFactoryDeploymentBlock,\r\n 'sepolia.contracts.erc20PoolFactoryDeploymentBlock',\r\n );\r\n if (\r\n String(network.contracts.relayerRegistry).toLowerCase() !==\r\n String(network.contracts.relayerRegistryAddress).toLowerCase()\r\n ) {\r\n throw new Error('Sepolia relayer registry aliases must resolve to the same address');\r\n }\r\n const routerAddress = network.contracts.mixerXRouter;\r\n assertEvmAddress(routerAddress, 'sepolia.contracts.mixerXRouter');\r\n assertEvmAddress(network.tokens.mixerXTokenAddress, 'sepolia.tokens.mixerXTokenAddress');\r\n assertEvmAddress(\r\n network.tokens.wrappedStablecoinAddress,\r\n 'sepolia.tokens.wrappedStablecoinAddress',\r\n );\r\n assertTokenSymbol(network.tokens.mixerXTokenSymbol, 'sepolia.tokens.mixerXTokenSymbol');\n assertDecimals(network.tokens.mixerXTokenDecimals, 'sepolia.tokens.mixerXTokenDecimals');\n}\n\nfunction assertFdsTokenAliases(\n network: NetworkConfig,\n currencies: Record<string, unknown>,\n): void {\n const fdsCurrency = currencies.fds;\n assertRecord(fdsCurrency, `instances.${SEPOLIA_NET_ID}.fds`);\n assertEvmAddress(fdsCurrency.tokenAddress, `instances.${SEPOLIA_NET_ID}.fds.tokenAddress`);\n\n const addresses = [\n network.contracts.fds,\n network.tokens.mixerXTokenAddress,\n network.tokens.wrappedStablecoinAddress,\n fdsCurrency.tokenAddress,\n ];\n if (new Set(addresses.map((address) => address.toLowerCase())).size !== 1) {\n throw new Error('Sepolia FDS address aliases must resolve to the same address');\n }\n if (\n fdsCurrency.symbol !== network.tokens.mixerXTokenSymbol ||\n fdsCurrency.decimals !== network.tokens.mixerXTokenDecimals\n ) {\n throw new Error('Sepolia FDS symbol and decimals aliases must match');\n }\n}\n\r\nexport function assertValidConfigShape(input: unknown): asserts input is MixerXConfig {\r\n assertRecord(input, 'config');\r\n assertRecord(input.instances, 'instances');\r\n assertRecord(input.networkConfigByNetId, 'networkConfigByNetId');\r\n\r\n const configuredNetIds = Object.keys(input.networkConfigByNetId);\r\n if (\r\n configuredNetIds.length !== SUPPORTED_NET_IDS.length ||\r\n configuredNetIds[0] !== String(SEPOLIA_NET_ID)\r\n ) {\r\n throw new Error(`Only Sepolia network ${SEPOLIA_NET_ID} may be configured`);\r\n }\r\n const instanceNetIds = Object.keys(input.instances);\r\n if (\r\n instanceNetIds.length !== SUPPORTED_NET_IDS.length ||\r\n instanceNetIds[0] !== String(SEPOLIA_NET_ID)\r\n ) {\r\n throw new Error(`Only Sepolia network ${SEPOLIA_NET_ID} may define instances`);\r\n }\r\n const currencies = input.instances[SEPOLIA_NET_ID];\r\n assertRecord(currencies, `instances.${SEPOLIA_NET_ID}`);\r\n const currencyEntries = Object.entries(currencies);\r\n if (currencyEntries.length === 0) {\r\n throw new Error(`instances.${SEPOLIA_NET_ID} must define at least one currency`);\r\n }\r\n const poolAddresses = new Set<string>();\r\n for (const [currencyName, currency] of currencyEntries) {\r\n assertCurrency(currency, `instances.${SEPOLIA_NET_ID}.${currencyName}`, poolAddresses);\r\n }\r\n const network = input.networkConfigByNetId[SEPOLIA_NET_ID];\n assertNetwork(network, poolAddresses);\n assertFdsTokenAliases(network, currencies);\n}\n"]}
|
package/dist/check-shape.d.ts
CHANGED
package/dist/check-shape.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
const assertions_js_1 = require("./assertions.js");
|
|
7
|
-
const config_js_1 =
|
|
4
|
+
const config_js_1 = require("./config.js");
|
|
8
5
|
try {
|
|
9
|
-
(0, assertions_js_1.assertValidConfigShape)(config_js_1.
|
|
6
|
+
(0, assertions_js_1.assertValidConfigShape)(config_js_1.config);
|
|
10
7
|
}
|
|
11
8
|
catch (error) {
|
|
12
9
|
const message = error instanceof Error ? error.message : String(error);
|
package/dist/check-shape.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-shape.js","sourceRoot":"","sources":["../src/check-shape.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"check-shape.js","sourceRoot":"","sources":["../src/check-shape.ts"],"names":[],"mappings":";;AAAA,mDAAyD;AACzD,2CAAqC;AAErC,IAAI,CAAC;IACH,IAAA,sCAAsB,EAAC,kBAAM,CAAC,CAAC;AACjC,CAAC;AAAC,OAAO,KAAK,EAAE,CAAC;IACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,OAAO,CAAC,KAAK,CAAC,4CAA4C,OAAO,EAAE,CAAC,CAAC;IACrE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC","sourcesContent":["import { assertValidConfigShape } from './assertions.js';\r\nimport { config } from './config.js';\r\n\r\ntry {\r\n assertValidConfigShape(config);\r\n} catch (error) {\r\n const message = error instanceof Error ? error.message : String(error);\r\n console.error(`[mixerx-config] shape validation failed: ${message}`);\r\n process.exit(1);\r\n}\r\n"]}
|