@gibs/bridge-client 1.29.0 → 1.32.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/block-polling/package.json +6 -0
- package/coinbase-accept-list/package.json +6 -0
- package/dist/block-polling.d.ts +33 -0
- package/dist/block-polling.js +10 -0
- package/dist/cjs/block-polling.d.ts +33 -0
- package/dist/cjs/block-polling.js +15 -0
- package/dist/cjs/client.d.ts +9 -1
- package/dist/cjs/client.js +8 -5
- package/dist/cjs/coinbase-accept-list.d.ts +101 -0
- package/dist/cjs/coinbase-accept-list.js +97 -0
- package/dist/cjs/crossing-decision.d.ts +166 -0
- package/dist/cjs/crossing-decision.js +169 -0
- package/dist/cjs/crossing-vector-guard.d.ts +45 -0
- package/dist/cjs/crossing-vector-guard.js +139 -0
- package/dist/cjs/exchange-deposit-board.d.ts +50 -0
- package/dist/cjs/exchange-deposit-board.js +70 -0
- package/dist/cjs/exchange-deposit-chain.d.ts +146 -0
- package/dist/cjs/exchange-deposit-chain.js +228 -0
- package/dist/cjs/exchange-deposit-constants.d.ts +10 -0
- package/dist/cjs/exchange-deposit-constants.js +6 -0
- package/dist/cjs/exchange-deposit-factory-calls.d.ts +245 -0
- package/dist/cjs/exchange-deposit-factory-calls.js +103 -0
- package/dist/cjs/exchange-deposit-factory.d.ts +87 -0
- package/dist/cjs/exchange-deposit-factory.js +110 -0
- package/dist/cjs/exchange-deposit-fake.d.ts +67 -0
- package/dist/cjs/exchange-deposit-fake.js +179 -0
- package/dist/cjs/exchange-deposit-index.d.ts +77 -0
- package/dist/cjs/exchange-deposit-index.js +40 -0
- package/dist/cjs/exchange-deposit-issuance.d.ts +327 -0
- package/dist/cjs/exchange-deposit-issuance.js +244 -0
- package/dist/cjs/exchange-deposit-path.d.ts +16 -0
- package/dist/cjs/exchange-deposit-path.js +15 -0
- package/dist/cjs/exchange-deposit-pow.d.ts +163 -0
- package/dist/cjs/exchange-deposit-pow.js +101 -0
- package/dist/cjs/exchange-deposit-recipient.d.ts +66 -0
- package/dist/cjs/exchange-deposit-recipient.js +35 -0
- package/dist/cjs/exchange-deposit-self-cross.d.ts +163 -0
- package/dist/cjs/exchange-deposit-self-cross.js +60 -0
- package/dist/cjs/exchange-deposit-signin.d.ts +275 -0
- package/dist/cjs/exchange-deposit-signin.js +166 -0
- package/dist/cjs/exchange-deposit-watch.d.ts +133 -0
- package/dist/cjs/exchange-deposit-watch.js +58 -0
- package/dist/cjs/exchange-deposit.d.ts +440 -0
- package/dist/cjs/exchange-deposit.js +154 -0
- package/dist/cjs/exchange-sender-guides.d.ts +29 -0
- package/dist/cjs/exchange-sender-guides.js +25 -0
- package/dist/cjs/image.d.ts +18 -0
- package/dist/cjs/image.js +11 -9
- package/dist/cjs/index.d.ts +4 -0
- package/dist/cjs/index.js +32 -1
- package/dist/cjs/kraken-accept-list.d.ts +70 -0
- package/dist/cjs/kraken-accept-list.js +24 -0
- package/dist/cjs/unlisted-token.d.ts +26 -0
- package/dist/cjs/unlisted-token.js +34 -0
- package/dist/client.d.ts +9 -1
- package/dist/client.js +8 -5
- package/dist/coinbase-accept-list.d.ts +101 -0
- package/dist/coinbase-accept-list.js +89 -0
- package/dist/crossing-decision.d.ts +166 -0
- package/dist/crossing-decision.js +162 -0
- package/dist/crossing-vector-guard.d.ts +45 -0
- package/dist/crossing-vector-guard.js +134 -0
- package/dist/exchange-deposit-board.d.ts +50 -0
- package/dist/exchange-deposit-board.js +28 -0
- package/dist/exchange-deposit-chain.d.ts +146 -0
- package/dist/exchange-deposit-chain.js +218 -0
- package/dist/exchange-deposit-constants.d.ts +10 -0
- package/dist/exchange-deposit-constants.js +3 -0
- package/dist/exchange-deposit-factory-calls.d.ts +245 -0
- package/dist/exchange-deposit-factory-calls.js +97 -0
- package/dist/exchange-deposit-factory.d.ts +87 -0
- package/dist/exchange-deposit-factory.js +104 -0
- package/dist/exchange-deposit-fake.d.ts +67 -0
- package/dist/exchange-deposit-fake.js +171 -0
- package/dist/exchange-deposit-index.d.ts +77 -0
- package/dist/exchange-deposit-index.js +34 -0
- package/dist/exchange-deposit-issuance.d.ts +327 -0
- package/dist/exchange-deposit-issuance.js +224 -0
- package/dist/exchange-deposit-path.d.ts +16 -0
- package/dist/exchange-deposit-path.js +11 -0
- package/dist/exchange-deposit-pow.d.ts +163 -0
- package/dist/exchange-deposit-pow.js +93 -0
- package/dist/exchange-deposit-recipient.d.ts +66 -0
- package/dist/exchange-deposit-recipient.js +28 -0
- package/dist/exchange-deposit-self-cross.d.ts +163 -0
- package/dist/exchange-deposit-self-cross.js +46 -0
- package/dist/exchange-deposit-signin.d.ts +275 -0
- package/dist/exchange-deposit-signin.js +147 -0
- package/dist/exchange-deposit-watch.d.ts +133 -0
- package/dist/exchange-deposit-watch.js +44 -0
- package/dist/exchange-deposit.d.ts +440 -0
- package/dist/exchange-deposit.js +138 -0
- package/dist/exchange-sender-guides.d.ts +29 -0
- package/dist/exchange-sender-guides.js +21 -0
- package/dist/image.d.ts +18 -0
- package/dist/image.js +8 -8
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/kraken-accept-list.d.ts +70 -0
- package/dist/kraken-accept-list.js +17 -0
- package/dist/unlisted-token.d.ts +26 -0
- package/dist/unlisted-token.js +30 -0
- package/exchange-deposit/package.json +6 -0
- package/exchange-deposit-board/package.json +6 -0
- package/exchange-deposit-chain/package.json +6 -0
- package/exchange-deposit-factory/package.json +6 -0
- package/exchange-deposit-fake/package.json +6 -0
- package/exchange-deposit-issuance/package.json +6 -0
- package/exchange-deposit-path/package.json +6 -0
- package/exchange-deposit-pow/package.json +6 -0
- package/exchange-deposit-recipient/package.json +6 -0
- package/exchange-deposit-self-cross/package.json +6 -0
- package/exchange-deposit-signin/package.json +6 -0
- package/exchange-deposit-watch/package.json +6 -0
- package/exchange-sender-guides/package.json +6 -0
- package/kraken-accept-list/package.json +6 -0
- package/llms.txt +1 -0
- package/package.json +487 -6
- package/unlisted-token/package.json +6 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Crossing decision, spec version 7.0.0. Pure: inputs in, decision out. No input or output, no clock,
|
|
3
|
+
* no floating point. Every integer is a bigint. Every address is lower case 0x hex.
|
|
4
|
+
* One deposit address holds one deposit of one token. The function decides whether to cross it now.
|
|
5
|
+
*/
|
|
6
|
+
/** The spec version this code implements. A vector file with another version must not be run against it. */
|
|
7
|
+
export declare const CROSSING_SPEC_VERSION = "7.0.0";
|
|
8
|
+
/** A lower case 0x hex address, 42 characters. */
|
|
9
|
+
export type Address = string;
|
|
10
|
+
/** The token entry that stands for ether itself. */
|
|
11
|
+
export declare const ETHER_TOKEN: Address;
|
|
12
|
+
/** The gas of one whole flush transaction of one deposit address, 21,000 base gas included. */
|
|
13
|
+
export type GasFigures = {
|
|
14
|
+
/** A flush of a token (USD Coin is the typical one), the first flush of the day, cold: the figure includes the first-flush surcharge (spec, section 3.3). */
|
|
15
|
+
tokenFlushGas: bigint;
|
|
16
|
+
/** A flush of ether, the first flush of the day, cold. It crosses through the wrap router (spec, section 3.3). */
|
|
17
|
+
etherFlushGas: bigint;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* The gas model, in two sets. `paid` is the gas after the refund of the cleared storage: use it for income
|
|
21
|
+
* and profit. `beforeRefund` is the gas before that refund: use it for the gas limit and for any check that
|
|
22
|
+
* the sender can afford the transaction, because the node needs that much available while the transaction runs.
|
|
23
|
+
*/
|
|
24
|
+
export type GasModel = {
|
|
25
|
+
paid: GasFigures;
|
|
26
|
+
beforeRefund: GasFigures;
|
|
27
|
+
};
|
|
28
|
+
/** The names of the gas tables. There is one table for each network under each fork of the rules. */
|
|
29
|
+
export declare const GAS_TABLE_NAMES: readonly ["ethereum-prague", "ethereum-glamsterdam", "sepolia-glamsterdam"];
|
|
30
|
+
/** The name of one gas table. */
|
|
31
|
+
export type GasTableName = (typeof GAS_TABLE_NAMES)[number];
|
|
32
|
+
/** One gas table: the figures of one network under one fork of the rules. */
|
|
33
|
+
export type GasTable = {
|
|
34
|
+
/** The only chain id the table may run on. The Ethereum tables are for chain 1, the Sepolia table for 11155111. */
|
|
35
|
+
chainId: bigint;
|
|
36
|
+
gasModel: GasModel;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* The gas tables, measured on forks of the real chains (spec, section 3.3) with `measure-gas-anvil.sh`.
|
|
40
|
+
* `ethereum-prague` is the table of today's mainnet; the other two ran under the Amsterdam rules.
|
|
41
|
+
* `ethereum-glamsterdam` is a projection: Glamsterdam is not live on Ethereum yet. Every figure is the
|
|
42
|
+
* worst of the warm and the cold measurement, rounded up to a multiple of 1,000, plus the first-flush surcharge
|
|
43
|
+
* of the network (spec, section 3.3). The token figure is the first flush of an address that was never seeded (the
|
|
44
|
+
* account does not exist when the flush runs CREATE2), the worst case of a single-use address.
|
|
45
|
+
*
|
|
46
|
+
* The surcharge is the cost of the first write of the day to the mediator's daily limit slot. It is measured on
|
|
47
|
+
* `sepolia-glamsterdam`: 97,920 gas (the cold minus the warm USD Coin flush). The Sepolia token figure already contains
|
|
48
|
+
* it, because its cold measurement was taken with an empty slot. Its ether figure did not (the slot was already
|
|
49
|
+
* written when measured), so the surcharge is added to it.
|
|
50
|
+
*
|
|
51
|
+
* The mainnet tables have no direct measurement of a token's surcharge. Their ether figures already hold the cold
|
|
52
|
+
* cost, because the mainnet fork's ether slot was empty when measured. Their token figures add a derived surcharge: the
|
|
53
|
+
* ether cold minus warm delta of the same fork run (17,100 under Prague, 97,920 under Glamsterdam). TODO: confirm on a fork.
|
|
54
|
+
*/
|
|
55
|
+
export declare const GAS_TABLES: Record<GasTableName, GasTable>;
|
|
56
|
+
/**
|
|
57
|
+
* Picks a gas table by name for a chain. There is no default: a caller must name its table. It throws when the
|
|
58
|
+
* name is unknown, and when the table is for another chain than `chainId`, so a Sepolia run can never price
|
|
59
|
+
* with a mainnet table, or the other way round.
|
|
60
|
+
*/
|
|
61
|
+
export declare const gasTableOf: (name: string, chainId: bigint) => GasTable;
|
|
62
|
+
/** The conditions of the moment, set by the executor. */
|
|
63
|
+
export type CrossingConditions = {
|
|
64
|
+
baseFeeWei: bigint;
|
|
65
|
+
priorityFeeWei: bigint;
|
|
66
|
+
/** Wait when the base fee is above this. Null for no ceiling. */
|
|
67
|
+
maximumBaseFeeWei: bigint | null;
|
|
68
|
+
/** The safety multiple in thousandths: 2000 is two times. Must be above zero. */
|
|
69
|
+
safetyMultipleThousandths: bigint;
|
|
70
|
+
/** The `gasModel` of the gas table of the network: take it from `GAS_TABLES`, never from a default. */
|
|
71
|
+
gasModel: GasModel;
|
|
72
|
+
};
|
|
73
|
+
/** One deposit address and the one deposit that waits at it, as read from the chain at one moment. */
|
|
74
|
+
export type DepositInput = {
|
|
75
|
+
/** True when the recipient retired the address. */
|
|
76
|
+
retired: boolean;
|
|
77
|
+
/** True when a crossing of this address is sent and not yet confirmed (ours or seen in the pool). */
|
|
78
|
+
crossingInFlight: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* The gibs fee rate the address committed to, on the 1e18 scale (1e18 is all of it). The ledger takes exactly this
|
|
81
|
+
* share from the delivery. The partner fee is not input: it is never the executor's and it does not change the gibs fee.
|
|
82
|
+
*/
|
|
83
|
+
feeRateE18: bigint;
|
|
84
|
+
/** The token of the deposit. Use ETHER_TOKEN for ether. */
|
|
85
|
+
token: Address;
|
|
86
|
+
/** Decimal places of the token. Use 18 for ether. */
|
|
87
|
+
decimals: bigint;
|
|
88
|
+
/** The balance of the token at the address at the balance block, in base units. For ether, the whole ether balance. */
|
|
89
|
+
balance: bigint;
|
|
90
|
+
/** True when the executor may cross this token on its own. Anyone can send a worthless token to an address. */
|
|
91
|
+
autoCrossAllowed: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Wei of ether that one whole token is worth, at the moment of the decision, from the executor's price
|
|
94
|
+
* source. 10^18 for ether and wrapped ether. Null when no price is known. No price is read on chain.
|
|
95
|
+
*/
|
|
96
|
+
weiPerWholeToken: bigint | null;
|
|
97
|
+
/** The mediator's fee on entering PulseChain, on the 1e18 scale (1e18 is all of it). 0 today. */
|
|
98
|
+
entryFeeWad: bigint;
|
|
99
|
+
/** Mediator minimum per transaction. Null when it could not be read. */
|
|
100
|
+
minPerTx: bigint | null;
|
|
101
|
+
/** Mediator maximum per transaction. */
|
|
102
|
+
maxPerTx: bigint;
|
|
103
|
+
/** What is left of the mediator's daily limit for this token. */
|
|
104
|
+
dailyRemaining: bigint;
|
|
105
|
+
};
|
|
106
|
+
/** The whole input. */
|
|
107
|
+
export type CrossingInput = {
|
|
108
|
+
specVersion: string;
|
|
109
|
+
conditions: CrossingConditions;
|
|
110
|
+
deposit: DepositInput;
|
|
111
|
+
};
|
|
112
|
+
export type WaitReason = 'nothing-waiting' | 'crossing-in-flight' | 'below-cost' | 'below-bridge-minimum' | 'daily-limit-reached' | 'price-missing' | 'gas-price-above-ceiling' | 'limits-unavailable';
|
|
113
|
+
export type CannotReason = 'address-retired' | 'zero-fee-rate' | 'above-per-transaction-maximum' | 'token-not-allowed';
|
|
114
|
+
/** What happens to the deposit. */
|
|
115
|
+
export type CrossingDecision = {
|
|
116
|
+
specVersion: string;
|
|
117
|
+
outcome: 'execute' | 'wait' | 'cannot-cross-automatically';
|
|
118
|
+
/** Null when the outcome is `execute`. */
|
|
119
|
+
reason: WaitReason | CannotReason | null;
|
|
120
|
+
/** The amount in base units that a flush would cross: the whole balance, ether included. */
|
|
121
|
+
amount: bigint;
|
|
122
|
+
/** The fee income of the crossing in wei of ether. Null when the deposit did not pass the checks before the cost test. */
|
|
123
|
+
incomeWei: bigint | null;
|
|
124
|
+
/** The flush gas before the refund. Use it as the gas limit. */
|
|
125
|
+
gasLimit: bigint;
|
|
126
|
+
/** The flush gas after the refund. This is what the cost is built from. */
|
|
127
|
+
paidGas: bigint;
|
|
128
|
+
/** The paid gas at the fee per gas (base plus priority), in wei. */
|
|
129
|
+
costWei: bigint;
|
|
130
|
+
/** The highest fee per gas (base plus priority) at which the crossing would still execute. 0 when there is no income. */
|
|
131
|
+
breakEvenFeePerGasWei: bigint;
|
|
132
|
+
/** The amount of the token at which a crossing first pays. Null when none exists. For display only. */
|
|
133
|
+
thresholdAmount: bigint | null;
|
|
134
|
+
/** True when the threshold is above the bridge's per-transaction maximum, so it can never be reached. */
|
|
135
|
+
thresholdAboveMaximum: boolean;
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* The rounding rule in one place. Income rounds down (every fee, every conversion to wei). Cost rounds up:
|
|
139
|
+
* the income that a crossing must earn is `ceil(costWei * multiple / 1000)`. A crossing pays exactly when
|
|
140
|
+
* `incomeWei >= requiredIncomeWei`, which is the same test as `incomeWei * 1000 >= costWei * multiple`.
|
|
141
|
+
* @param costWei the cost of the crossing, in wei
|
|
142
|
+
* @param safetyMultipleThousandths the safety multiple in thousandths (2000 is two times)
|
|
143
|
+
* @returns the least income, in wei, at which the crossing executes
|
|
144
|
+
*/
|
|
145
|
+
export declare const requiredIncomeWei: ({ costWei, safetyMultipleThousandths, }: {
|
|
146
|
+
costWei: bigint;
|
|
147
|
+
safetyMultipleThousandths: bigint;
|
|
148
|
+
}) => bigint;
|
|
149
|
+
/**
|
|
150
|
+
* The gibs fee HomeFeeLedger takes from a delivered amount: `amount * feeRateE18 / 1e18`, rounded down. The rate
|
|
151
|
+
* is read from the call data, so it is the address's own. The partner fee is left out: it is never the executor's.
|
|
152
|
+
* @param amount the amount delivered to the ledger, in base units
|
|
153
|
+
* @param feeRateE18 the address's committed gibs fee rate, 1e18 is all of it
|
|
154
|
+
* @returns the gibs fee, in base units
|
|
155
|
+
*/
|
|
156
|
+
export declare const gibsFeeOf: ({ amount, feeRateE18 }: {
|
|
157
|
+
amount: bigint;
|
|
158
|
+
feeRateE18: bigint;
|
|
159
|
+
}) => bigint;
|
|
160
|
+
/**
|
|
161
|
+
* Decides whether to cross one deposit now, and what the crossing is worth. Pure: the same input always
|
|
162
|
+
* gives the same decision.
|
|
163
|
+
* @param input the conditions and the deposit, all read at one moment
|
|
164
|
+
* @returns the decision, with the gas limit, the cost, the income and the amount at which a crossing first pays
|
|
165
|
+
*/
|
|
166
|
+
export declare const decideCrossing: (input: CrossingInput) => CrossingDecision;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
export const CROSSING_SPEC_VERSION = '7.0.0';
|
|
2
|
+
export const ETHER_TOKEN = '0x0000000000000000000000000000000000000000';
|
|
3
|
+
const WAD = 10n ** 18n;
|
|
4
|
+
const THOUSAND = 1000n;
|
|
5
|
+
const MAXIMUM_FEE_RATE_E18 = 10n ** 16n;
|
|
6
|
+
const SEARCH_LIMIT = 2n ** 192n;
|
|
7
|
+
export const GAS_TABLE_NAMES = ['ethereum-prague', 'ethereum-glamsterdam', 'sepolia-glamsterdam'];
|
|
8
|
+
export const GAS_TABLES = {
|
|
9
|
+
'ethereum-prague': {
|
|
10
|
+
chainId: 1n,
|
|
11
|
+
gasModel: {
|
|
12
|
+
paid: { tokenFlushGas: 295000n, etherFlushGas: 292000n },
|
|
13
|
+
beforeRefund: { tokenFlushGas: 340000n, etherFlushGas: 352000n },
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
'ethereum-glamsterdam': {
|
|
17
|
+
chainId: 1n,
|
|
18
|
+
gasModel: {
|
|
19
|
+
paid: { tokenFlushGas: 830000n, etherFlushGas: 645000n },
|
|
20
|
+
beforeRefund: { tokenFlushGas: 861000n, etherFlushGas: 675000n },
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
'sepolia-glamsterdam': {
|
|
24
|
+
chainId: 11155111n,
|
|
25
|
+
gasModel: {
|
|
26
|
+
paid: { tokenFlushGas: 832000n, etherFlushGas: 644000n },
|
|
27
|
+
beforeRefund: { tokenFlushGas: 863000n, etherFlushGas: 674000n },
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
export const gasTableOf = (name, chainId) => {
|
|
32
|
+
if (!Object.hasOwn(GAS_TABLES, name))
|
|
33
|
+
throw new Error(`unknown gas table ${name}`);
|
|
34
|
+
const table = GAS_TABLES[name];
|
|
35
|
+
if (table.chainId !== chainId)
|
|
36
|
+
throw new Error(`gas table ${name} is for chain ${table.chainId}, not chain ${chainId}`);
|
|
37
|
+
return table;
|
|
38
|
+
};
|
|
39
|
+
const ceilDiv = (numerator, denominator) => (numerator + denominator - 1n) / denominator;
|
|
40
|
+
export const requiredIncomeWei = ({ costWei, safetyMultipleThousandths, }) => ceilDiv(costWei * safetyMultipleThousandths, THOUSAND);
|
|
41
|
+
export const gibsFeeOf = ({ amount, feeRateE18 }) => (amount * feeRateE18) / WAD;
|
|
42
|
+
const crossableOf = (deposit) => deposit.balance;
|
|
43
|
+
const incomeOf = (amount, deposit) => {
|
|
44
|
+
if (deposit.weiPerWholeToken === null)
|
|
45
|
+
return 0n;
|
|
46
|
+
const delivered = amount - ceilDiv(amount * deposit.entryFeeWad, WAD);
|
|
47
|
+
const fee = gibsFeeOf({ amount: delivered, feeRateE18: deposit.feeRateE18 });
|
|
48
|
+
return (fee * deposit.weiPerWholeToken) / 10n ** deposit.decimals;
|
|
49
|
+
};
|
|
50
|
+
const flushGasOf = (deposit, figures) => deposit.token === ETHER_TOKEN ? figures.etherFlushGas : figures.tokenFlushGas;
|
|
51
|
+
const feePerGasOf = (conditions) => conditions.baseFeeWei + conditions.priorityFeeWei;
|
|
52
|
+
const costOf = (deposit, conditions) => flushGasOf(deposit, conditions.gasModel.paid) * feePerGasOf(conditions);
|
|
53
|
+
const netOf = (incomeWei, costWei, conditions) => incomeWei * THOUSAND - costWei * conditions.safetyMultipleThousandths;
|
|
54
|
+
const breakEvenOf = (incomeWei, deposit, conditions) => {
|
|
55
|
+
if (incomeWei === null)
|
|
56
|
+
return 0n;
|
|
57
|
+
const paidGas = flushGasOf(deposit, conditions.gasModel.paid);
|
|
58
|
+
return (incomeWei * THOUSAND) / (paidGas * conditions.safetyMultipleThousandths);
|
|
59
|
+
};
|
|
60
|
+
const waits = (reason) => ({ outcome: 'wait', reason });
|
|
61
|
+
const cannot = (reason) => ({ outcome: 'cannot-cross-automatically', reason });
|
|
62
|
+
const refusalOf = (deposit, conditions, amount) => {
|
|
63
|
+
if (deposit.retired)
|
|
64
|
+
return cannot('address-retired');
|
|
65
|
+
if (deposit.crossingInFlight)
|
|
66
|
+
return waits('crossing-in-flight');
|
|
67
|
+
if (amount === 0n)
|
|
68
|
+
return waits('nothing-waiting');
|
|
69
|
+
if (deposit.feeRateE18 === 0n)
|
|
70
|
+
return cannot('zero-fee-rate');
|
|
71
|
+
if (conditions.maximumBaseFeeWei !== null && conditions.baseFeeWei > conditions.maximumBaseFeeWei) {
|
|
72
|
+
return waits('gas-price-above-ceiling');
|
|
73
|
+
}
|
|
74
|
+
if (!deposit.autoCrossAllowed)
|
|
75
|
+
return cannot('token-not-allowed');
|
|
76
|
+
if (deposit.minPerTx === null)
|
|
77
|
+
return waits('limits-unavailable');
|
|
78
|
+
if (amount > deposit.maxPerTx)
|
|
79
|
+
return cannot('above-per-transaction-maximum');
|
|
80
|
+
if (amount < deposit.minPerTx)
|
|
81
|
+
return waits('below-bridge-minimum');
|
|
82
|
+
if (amount > deposit.dailyRemaining)
|
|
83
|
+
return waits('daily-limit-reached');
|
|
84
|
+
if (deposit.weiPerWholeToken === null)
|
|
85
|
+
return waits('price-missing');
|
|
86
|
+
return null;
|
|
87
|
+
};
|
|
88
|
+
const thresholdOf = (deposit, conditions) => {
|
|
89
|
+
const none = { amount: null, aboveMaximum: false };
|
|
90
|
+
if (deposit.retired)
|
|
91
|
+
return none;
|
|
92
|
+
if (deposit.minPerTx === null || deposit.weiPerWholeToken === null)
|
|
93
|
+
return none;
|
|
94
|
+
if (deposit.feeRateE18 === 0n)
|
|
95
|
+
return none;
|
|
96
|
+
const minimum = deposit.minPerTx;
|
|
97
|
+
const costWei = costOf(deposit, conditions);
|
|
98
|
+
const pays = (amount) => netOf(incomeOf(amount, deposit), costWei, conditions) >= 0n;
|
|
99
|
+
const finish = (profitable) => {
|
|
100
|
+
const amount = profitable > minimum ? profitable : minimum;
|
|
101
|
+
return { amount, aboveMaximum: amount > deposit.maxPerTx };
|
|
102
|
+
};
|
|
103
|
+
if (pays(0n))
|
|
104
|
+
return finish(0n);
|
|
105
|
+
let high = 1n;
|
|
106
|
+
while (!pays(high)) {
|
|
107
|
+
high *= 2n;
|
|
108
|
+
if (high > SEARCH_LIMIT)
|
|
109
|
+
return none;
|
|
110
|
+
}
|
|
111
|
+
let low = high / 2n;
|
|
112
|
+
while (high - low > 1n) {
|
|
113
|
+
const middle = (low + high) / 2n;
|
|
114
|
+
if (pays(middle))
|
|
115
|
+
high = middle;
|
|
116
|
+
else
|
|
117
|
+
low = middle;
|
|
118
|
+
}
|
|
119
|
+
return finish(high);
|
|
120
|
+
};
|
|
121
|
+
const assertValid = (input) => {
|
|
122
|
+
if (input.specVersion !== CROSSING_SPEC_VERSION) {
|
|
123
|
+
throw new Error(`the crossing spec is ${CROSSING_SPEC_VERSION}, the input names ${input.specVersion}`);
|
|
124
|
+
}
|
|
125
|
+
const { conditions, deposit } = input;
|
|
126
|
+
if (conditions.safetyMultipleThousandths <= 0n)
|
|
127
|
+
throw new Error('the safety multiple must be above zero');
|
|
128
|
+
const { paid, beforeRefund } = conditions.gasModel;
|
|
129
|
+
const figures = [paid.tokenFlushGas, paid.etherFlushGas, beforeRefund.tokenFlushGas, beforeRefund.etherFlushGas];
|
|
130
|
+
if (figures.some((gas) => gas <= 0n))
|
|
131
|
+
throw new Error('every gas figure must be above zero');
|
|
132
|
+
if (deposit.feeRateE18 < 0n || deposit.feeRateE18 > MAXIMUM_FEE_RATE_E18) {
|
|
133
|
+
throw new Error(`the fee rate must be 0 to ${MAXIMUM_FEE_RATE_E18} (1e18 is 100 percent)`);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
export const decideCrossing = (input) => {
|
|
137
|
+
assertValid(input);
|
|
138
|
+
const { conditions, deposit } = input;
|
|
139
|
+
const amount = crossableOf(deposit);
|
|
140
|
+
const costWei = costOf(deposit, conditions);
|
|
141
|
+
const threshold = thresholdOf(deposit, conditions);
|
|
142
|
+
const describe = (outcome, reason, incomeWei) => ({
|
|
143
|
+
specVersion: CROSSING_SPEC_VERSION,
|
|
144
|
+
outcome,
|
|
145
|
+
reason,
|
|
146
|
+
amount,
|
|
147
|
+
incomeWei,
|
|
148
|
+
gasLimit: flushGasOf(deposit, conditions.gasModel.beforeRefund),
|
|
149
|
+
paidGas: flushGasOf(deposit, conditions.gasModel.paid),
|
|
150
|
+
costWei,
|
|
151
|
+
breakEvenFeePerGasWei: breakEvenOf(incomeWei, deposit, conditions),
|
|
152
|
+
thresholdAmount: threshold.amount,
|
|
153
|
+
thresholdAboveMaximum: threshold.aboveMaximum,
|
|
154
|
+
});
|
|
155
|
+
const refusal = refusalOf(deposit, conditions, amount);
|
|
156
|
+
if (refusal !== null)
|
|
157
|
+
return describe(refusal.outcome, refusal.reason, null);
|
|
158
|
+
const incomeWei = incomeOf(amount, deposit);
|
|
159
|
+
if (netOf(incomeWei, costWei, conditions) >= 0n)
|
|
160
|
+
return describe('execute', null, incomeWei);
|
|
161
|
+
return describe('wait', 'below-cost', incomeWei);
|
|
162
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A guard for the boundary vectors of `crossing-vectors.json`. A boundary vector's name says it sits on an edge:
|
|
3
|
+
* one base unit under the threshold, at it, one wei above a break-even fee. When a gas table moves, the edge moves,
|
|
4
|
+
* and a balance or a fee left behind keeps its name but tests nothing. This guard runs the reference decision on
|
|
5
|
+
* each named pair and fails when the pair does not sit on its edge.
|
|
6
|
+
*/
|
|
7
|
+
/** The fields of a vector that the guard reads. */
|
|
8
|
+
export type GuardVector = {
|
|
9
|
+
id: string;
|
|
10
|
+
input: unknown;
|
|
11
|
+
expectedError?: string;
|
|
12
|
+
};
|
|
13
|
+
/** The vectors file, as the guard reads it. */
|
|
14
|
+
export type GuardVectorFile = {
|
|
15
|
+
vectors: readonly GuardVector[];
|
|
16
|
+
};
|
|
17
|
+
/** Turns every string made only of digits into a bigint. Addresses start with 0x, so they are safe. */
|
|
18
|
+
export declare const reviveBigints: (value: unknown) => unknown;
|
|
19
|
+
/**
|
|
20
|
+
* The edge that a pair sits on.
|
|
21
|
+
* - `threshold`: the first amount that pays. The lower vector is one base unit under it, the upper one sits on it.
|
|
22
|
+
* - `break-even`: the highest fee per gas that pays. The upper vector is at it, the lower one is one wei above it.
|
|
23
|
+
* - `income`: the least income that pays. The upper vector earns exactly it, the lower one earns one wei less.
|
|
24
|
+
* - `edge`: a limit that is inclusive (a ceiling, a cap, a minimum). Only the outcome is checked.
|
|
25
|
+
*/
|
|
26
|
+
export type BoundaryKind = 'threshold' | 'break-even' | 'income' | 'edge';
|
|
27
|
+
/** Two vectors that sit on one edge. The first must execute, the second must not. */
|
|
28
|
+
export type BoundaryPair = {
|
|
29
|
+
kind: BoundaryKind;
|
|
30
|
+
/** The vector id that sits on the edge, as named, and must execute. */
|
|
31
|
+
mustExecute: string;
|
|
32
|
+
/** The vector id one step beyond the edge, which must wait or be refused. */
|
|
33
|
+
mustNotExecute: string;
|
|
34
|
+
};
|
|
35
|
+
/** Every boundary pair of the vectors file. A vector whose name says it is on an edge must appear here. */
|
|
36
|
+
export declare const BOUNDARY_PAIRS: readonly BoundaryPair[];
|
|
37
|
+
/**
|
|
38
|
+
* Every way the boundary vectors fail to sit on their named edges. An empty list means they all do.
|
|
39
|
+
* It fails when a vector named as a boundary is in no pair, when a pair names a vector that is not in the file,
|
|
40
|
+
* and when a pair does not decide as its name says.
|
|
41
|
+
* @param file the vectors file, as parsed from JSON
|
|
42
|
+
* @param pairs the boundary pairs to check, `BOUNDARY_PAIRS` by default
|
|
43
|
+
* @returns one message per failure, empty when none
|
|
44
|
+
*/
|
|
45
|
+
export declare const boundaryPairFailures: (file: GuardVectorFile, pairs?: readonly BoundaryPair[]) => string[];
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { decideCrossing, requiredIncomeWei, } from './crossing-decision.js';
|
|
2
|
+
export const reviveBigints = (value) => {
|
|
3
|
+
if (typeof value === 'string')
|
|
4
|
+
return /^\d+$/.test(value) ? BigInt(value) : value;
|
|
5
|
+
if (Array.isArray(value))
|
|
6
|
+
return value.map(reviveBigints);
|
|
7
|
+
if (value === null || typeof value !== 'object')
|
|
8
|
+
return value;
|
|
9
|
+
return Object.fromEntries(Object.entries(value).map(([key, inner]) => [key, reviveBigints(inner)]));
|
|
10
|
+
};
|
|
11
|
+
export const BOUNDARY_PAIRS = [
|
|
12
|
+
{
|
|
13
|
+
kind: 'threshold',
|
|
14
|
+
mustNotExecute: '02-one-base-unit-under-threshold',
|
|
15
|
+
mustExecute: '03-exactly-the-threshold',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
kind: 'threshold',
|
|
19
|
+
mustNotExecute: '36-ether-one-wei-under-threshold',
|
|
20
|
+
mustExecute: '37-ether-at-threshold',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
kind: 'threshold',
|
|
24
|
+
mustNotExecute: '42-usdc-ethereum-glamsterdam-under',
|
|
25
|
+
mustExecute: '44-usdc-ethereum-glamsterdam-at',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
kind: 'threshold',
|
|
29
|
+
mustNotExecute: '43-usdc-sepolia-glamsterdam-under',
|
|
30
|
+
mustExecute: '45-usdc-sepolia-glamsterdam-at',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
kind: 'edge',
|
|
34
|
+
mustNotExecute: '14-base-fee-above-ceiling',
|
|
35
|
+
mustExecute: '15-base-fee-at-ceiling',
|
|
36
|
+
},
|
|
37
|
+
{ kind: 'edge', mustNotExecute: '19-fee-rate-above-cap', mustExecute: '18-fee-rate-at-cap' },
|
|
38
|
+
{
|
|
39
|
+
kind: 'edge',
|
|
40
|
+
mustNotExecute: '04-below-bridge-minimum',
|
|
41
|
+
mustExecute: '31-free-gas-executes-at-minimum',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
kind: 'break-even',
|
|
45
|
+
mustNotExecute: '49-above-break-even-waits',
|
|
46
|
+
mustExecute: '48-break-even-fee-executes',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
kind: 'income',
|
|
50
|
+
mustNotExecute: '65-income-one-wei-under-the-need',
|
|
51
|
+
mustExecute: '64-income-exactly-equals-the-need',
|
|
52
|
+
},
|
|
53
|
+
];
|
|
54
|
+
const BOUNDARY_NAME = /under|exactly|break-even|(^|-)at(-|$)/;
|
|
55
|
+
const nameOf = (id) => id.replace(/^\d+-/, '');
|
|
56
|
+
const decisionOf = (vector) => {
|
|
57
|
+
if (vector.expectedError !== undefined)
|
|
58
|
+
return null;
|
|
59
|
+
return decideCrossing(reviveBigints(vector.input));
|
|
60
|
+
};
|
|
61
|
+
const feePerGasOf = (vector) => {
|
|
62
|
+
const { conditions } = reviveBigints(vector.input);
|
|
63
|
+
return conditions.baseFeeWei + conditions.priorityFeeWei;
|
|
64
|
+
};
|
|
65
|
+
const multipleOf = (vector) => reviveBigints(vector.input).conditions.safetyMultipleThousandths;
|
|
66
|
+
const edgeFailuresOf = (pair, execute, beyond) => {
|
|
67
|
+
if (pair.kind === 'edge')
|
|
68
|
+
return [];
|
|
69
|
+
if (beyond.decision === null)
|
|
70
|
+
return [`${beyond.vector.id} has no decision, so the ${pair.kind} edge cannot be checked`];
|
|
71
|
+
if (pair.kind === 'threshold') {
|
|
72
|
+
const failures = [];
|
|
73
|
+
if (execute.decision.thresholdAmount !== execute.decision.amount) {
|
|
74
|
+
failures.push(`${execute.vector.id} must hold its threshold exactly, but it holds ${execute.decision.amount}`);
|
|
75
|
+
}
|
|
76
|
+
if (beyond.decision.amount + 1n !== execute.decision.amount) {
|
|
77
|
+
failures.push(`${beyond.vector.id} must hold one base unit under ${execute.vector.id}`);
|
|
78
|
+
}
|
|
79
|
+
return failures;
|
|
80
|
+
}
|
|
81
|
+
if (pair.kind === 'break-even') {
|
|
82
|
+
const failures = [];
|
|
83
|
+
if (feePerGasOf(execute.vector) !== execute.decision.breakEvenFeePerGasWei) {
|
|
84
|
+
failures.push(`${execute.vector.id} must pay exactly the break-even fee ${execute.decision.breakEvenFeePerGasWei}`);
|
|
85
|
+
}
|
|
86
|
+
if (feePerGasOf(beyond.vector) !== feePerGasOf(execute.vector) + 1n) {
|
|
87
|
+
failures.push(`${beyond.vector.id} must pay one wei above the break-even fee`);
|
|
88
|
+
}
|
|
89
|
+
return failures;
|
|
90
|
+
}
|
|
91
|
+
const required = requiredIncomeWei({
|
|
92
|
+
costWei: execute.decision.costWei,
|
|
93
|
+
safetyMultipleThousandths: multipleOf(execute.vector),
|
|
94
|
+
});
|
|
95
|
+
const failures = [];
|
|
96
|
+
if (execute.decision.incomeWei !== required)
|
|
97
|
+
failures.push(`${execute.vector.id} must earn exactly the need ${required}`);
|
|
98
|
+
if (beyond.decision.incomeWei !== required - 1n)
|
|
99
|
+
failures.push(`${beyond.vector.id} must earn one wei under the need`);
|
|
100
|
+
return failures;
|
|
101
|
+
};
|
|
102
|
+
const failuresOfPair = (pair, vectorsById) => {
|
|
103
|
+
const execute = vectorsById.get(pair.mustExecute);
|
|
104
|
+
const beyond = vectorsById.get(pair.mustNotExecute);
|
|
105
|
+
if (execute === undefined || beyond === undefined)
|
|
106
|
+
return [];
|
|
107
|
+
const executeDecision = decisionOf(execute);
|
|
108
|
+
const beyondDecision = decisionOf(beyond);
|
|
109
|
+
const outcomeFailures = [];
|
|
110
|
+
if (executeDecision?.outcome !== 'execute') {
|
|
111
|
+
outcomeFailures.push(`${execute.id} is named as executing on the edge, but its decision is ${executeDecision?.outcome ?? 'a refusal'}`);
|
|
112
|
+
}
|
|
113
|
+
if (beyondDecision?.outcome === 'execute') {
|
|
114
|
+
outcomeFailures.push(`${beyond.id} is named as beyond the edge, but it executes`);
|
|
115
|
+
}
|
|
116
|
+
if (executeDecision === null || executeDecision.outcome !== 'execute')
|
|
117
|
+
return outcomeFailures;
|
|
118
|
+
return [
|
|
119
|
+
...outcomeFailures,
|
|
120
|
+
...edgeFailuresOf(pair, { vector: execute, decision: executeDecision }, { vector: beyond, decision: beyondDecision }),
|
|
121
|
+
];
|
|
122
|
+
};
|
|
123
|
+
export const boundaryPairFailures = (file, pairs = BOUNDARY_PAIRS) => {
|
|
124
|
+
const vectorsById = new Map(file.vectors.map((vector) => [vector.id, vector]));
|
|
125
|
+
const declared = new Set(pairs.flatMap((pair) => [pair.mustExecute, pair.mustNotExecute]));
|
|
126
|
+
const undeclared = file.vectors
|
|
127
|
+
.filter((vector) => BOUNDARY_NAME.test(nameOf(vector.id)) && !declared.has(vector.id))
|
|
128
|
+
.map((vector) => `${vector.id} is named as a boundary but is in no boundary pair`);
|
|
129
|
+
const missing = [...declared]
|
|
130
|
+
.filter((id) => !vectorsById.has(id))
|
|
131
|
+
.map((id) => `${id} is named in a boundary pair but is not in the vectors file`);
|
|
132
|
+
const paired = pairs.flatMap((pair) => failuresOfPair(pair, vectorsById));
|
|
133
|
+
return [...undeclared, ...missing, ...paired];
|
|
134
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type Hex } from 'viem';
|
|
2
|
+
import { type PowProgress, type Stamper } from './exchange-deposit-pow.js';
|
|
3
|
+
/**
|
|
4
|
+
* Posting the sealed issuance records to the msgboard. The record is the ciphertext from `exchange-deposit-issuance.ts`,
|
|
5
|
+
* so the board holds only what the seed can open. Posting is a background step: a failure is the caller's to log, and
|
|
6
|
+
* it never stops a reader from getting an address.
|
|
7
|
+
*
|
|
8
|
+
* THIS FILE IS LOADED LAZILY. It imports the msgboard SDK, which the page must not load on its first render. The page
|
|
9
|
+
* imports this module with a dynamic import, so the SDK stays out of the entry chunk.
|
|
10
|
+
*
|
|
11
|
+
* PROOF OF WORK. A post needs a stamper, and the caller passes the WebAssembly engine's stamper. There is no default:
|
|
12
|
+
* the SDK would otherwise pick the JavaScript grind, which takes minutes. A read passes a stamper that refuses, so a
|
|
13
|
+
* read can never grind.
|
|
14
|
+
*
|
|
15
|
+
* THE BOARD CHAIN. A board serves one chain per node, and the archive indexes the chains that board serves (1, 369 and
|
|
16
|
+
* 943). A Sepolia factory has no board and no archive, so its records stay in the browser only.
|
|
17
|
+
*/
|
|
18
|
+
export { PowEngineUnavailableError, POW_ENGINE_WEBASSEMBLY, loadVerifiedEngine, progressOf } from './exchange-deposit-pow.js';
|
|
19
|
+
export type { PowEngineModule, PowProgress, PowWorkerRequest, PowWorkerResponse, Stamp, StampInput, Stamper, VerifiedEngine } from './exchange-deposit-pow.js';
|
|
20
|
+
/** The board chain for the mainnet factory. It is the factory's own chain. */
|
|
21
|
+
export declare const EXCHANGE_DEPOSIT_BOARD_MAINNET_CHAIN_ID = 1n;
|
|
22
|
+
/**
|
|
23
|
+
* Posts one sealed body under a category. It does the proof of work with the given stamper, then submits the message.
|
|
24
|
+
* If the stamper throws, the post rejects with the engine's error. The SDK's JavaScript grind never runs.
|
|
25
|
+
*
|
|
26
|
+
* @param input.rpcUrl - the board's endpoint for the chain
|
|
27
|
+
* @param input.category - the category from `issuanceCategoryOf`
|
|
28
|
+
* @param input.body - the sealed body from `sealIssuedAddressRecord`
|
|
29
|
+
* @param input.stamper - the WebAssembly engine's stamper, from `loadVerifiedStamper`
|
|
30
|
+
* @param input.onProgress - receives the grind's numbers as they change
|
|
31
|
+
* @returns the hash the board returns for the message
|
|
32
|
+
*/
|
|
33
|
+
export declare const postIssuedRecordBody: ({ rpcUrl, category, body, stamper, onProgress, }: {
|
|
34
|
+
rpcUrl: string;
|
|
35
|
+
category: Hex;
|
|
36
|
+
body: Hex;
|
|
37
|
+
stamper: Stamper;
|
|
38
|
+
onProgress?: (progress: PowProgress) => void;
|
|
39
|
+
}) => Promise<Hex>;
|
|
40
|
+
/**
|
|
41
|
+
* The bodies the board holds under one category, in the order the board returns them. Used by the live check, which
|
|
42
|
+
* reads back what it posted.
|
|
43
|
+
*
|
|
44
|
+
* @param input.rpcUrl - the board's endpoint for the chain
|
|
45
|
+
* @param input.category - the category to read
|
|
46
|
+
*/
|
|
47
|
+
export declare const readIssuedRecordBodies: ({ rpcUrl, category }: {
|
|
48
|
+
rpcUrl: string;
|
|
49
|
+
category: Hex;
|
|
50
|
+
}) => Promise<readonly Hex[]>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createPublicClient, http } from 'viem';
|
|
2
|
+
import { guardStamper, progressOf } from './exchange-deposit-pow.js';
|
|
3
|
+
export { PowEngineUnavailableError, POW_ENGINE_WEBASSEMBLY, loadVerifiedEngine, progressOf } from './exchange-deposit-pow.js';
|
|
4
|
+
export const EXCHANGE_DEPOSIT_BOARD_MAINNET_CHAIN_ID = 1n;
|
|
5
|
+
const refuseGrind = () => {
|
|
6
|
+
throw new Error('a board read never grinds proof of work');
|
|
7
|
+
};
|
|
8
|
+
const boardClientOf = async ({ rpcUrl, stamper }) => {
|
|
9
|
+
const { MsgBoardClient } = await import('@msgboard/sdk');
|
|
10
|
+
const provider = createPublicClient({ transport: http(rpcUrl) });
|
|
11
|
+
return new MsgBoardClient(provider, { stamper });
|
|
12
|
+
};
|
|
13
|
+
export const postIssuedRecordBody = async ({ rpcUrl, category, body, stamper, onProgress, }) => {
|
|
14
|
+
let stopBoard = () => undefined;
|
|
15
|
+
const guarded = guardStamper(stamper, () => stopBoard());
|
|
16
|
+
const board = await boardClientOf({ rpcUrl, stamper: guarded.stamper });
|
|
17
|
+
stopBoard = () => board.cancel();
|
|
18
|
+
board.progressHandler = (stats) => onProgress?.(progressOf(stats));
|
|
19
|
+
const work = await board.grind(category, body).catch((error) => {
|
|
20
|
+
throw guarded.failure() ?? error;
|
|
21
|
+
});
|
|
22
|
+
return board.addMessage(work.message);
|
|
23
|
+
};
|
|
24
|
+
export const readIssuedRecordBodies = async ({ rpcUrl, category }) => {
|
|
25
|
+
const board = await boardClientOf({ rpcUrl, stamper: refuseGrind });
|
|
26
|
+
const content = await board.content({ category });
|
|
27
|
+
return (content[category] ?? []).map((message) => message.data);
|
|
28
|
+
};
|