@1stdex/first-sdk 1.0.90-beta.1 → 1.0.90
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/dist/cjs/calls/batch/index.js +2 -3
- package/dist/cjs/calls/batch/index.js.map +1 -1
- package/dist/cjs/calls/batch/prepare-claim-real-tokens.js +41 -99
- package/dist/cjs/calls/batch/prepare-claim-real-tokens.js.map +1 -1
- package/dist/cjs/calls/index.js +2 -3
- package/dist/cjs/calls/index.js.map +1 -1
- package/dist/cjs/constants/abis/core/erc20.js +33 -0
- package/dist/cjs/constants/abis/core/erc20.js.map +1 -0
- package/dist/cjs/constants/abis/core/layer-zero-sponsor.js +514 -0
- package/dist/cjs/constants/abis/core/layer-zero-sponsor.js.map +1 -0
- package/dist/cjs/constants/chain-configs/addresses.js +4 -0
- package/dist/cjs/constants/chain-configs/addresses.js.map +1 -1
- package/dist/esm/calls/batch/index.js +1 -1
- package/dist/esm/calls/batch/index.js.map +1 -1
- package/dist/esm/calls/batch/prepare-claim-real-tokens.js +50 -134
- package/dist/esm/calls/batch/prepare-claim-real-tokens.js.map +1 -1
- package/dist/esm/calls/index.js +1 -1
- package/dist/esm/calls/index.js.map +1 -1
- package/dist/esm/constants/abis/core/erc20.js +30 -0
- package/dist/esm/constants/abis/core/erc20.js.map +1 -0
- package/dist/esm/constants/abis/core/layer-zero-sponsor.js +511 -0
- package/dist/esm/constants/abis/core/layer-zero-sponsor.js.map +1 -0
- package/dist/esm/constants/chain-configs/addresses.js +4 -0
- package/dist/esm/constants/chain-configs/addresses.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/calls/batch/index.d.ts +1 -1
- package/dist/types/calls/batch/index.d.ts.map +1 -1
- package/dist/types/calls/batch/prepare-claim-real-tokens.d.ts +6 -38
- package/dist/types/calls/batch/prepare-claim-real-tokens.d.ts.map +1 -1
- package/dist/types/calls/index.d.ts +1 -1
- package/dist/types/calls/index.d.ts.map +1 -1
- package/dist/types/constants/abis/core/erc20.d.ts +52 -0
- package/dist/types/constants/abis/core/erc20.d.ts.map +1 -0
- package/dist/types/constants/abis/core/layer-zero-sponsor.d.ts +399 -0
- package/dist/types/constants/abis/core/layer-zero-sponsor.d.ts.map +1 -0
- package/dist/types/constants/chain-configs/addresses.d.ts +1 -0
- package/dist/types/constants/chain-configs/addresses.d.ts.map +1 -1
- package/dist/types/views/address.d.ts +1 -0
- package/dist/types/views/address.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,9 @@ import { CHAIN_MAP } from '../../constants/chain-configs/chain';
|
|
|
3
3
|
import { CHAIN_EIDS } from '../../constants/chain-configs/eids';
|
|
4
4
|
import { CLAIMABLE_DEX_VAULT_ABI } from '../../constants/abis/core/claimable-dex-vault-abi';
|
|
5
5
|
import { MIRROR_TOKEN_ABI } from '../../constants/abis/core/mirror-token-abi';
|
|
6
|
-
import {
|
|
6
|
+
import { LAYER_ZERO_SPONSOR_ABI } from '../../constants/abis/core/layer-zero-sponsor';
|
|
7
|
+
import { CONTRACT_ADDRESSES } from '../../constants/chain-configs/addresses';
|
|
8
|
+
import { ERC20_ABI } from '../../constants/abis/core/erc20';
|
|
7
9
|
import { getVault } from '../../views/vault';
|
|
8
10
|
/**
|
|
9
11
|
* Error thrown when there are insufficient claimable funds in vault and mirror token combined.
|
|
@@ -28,92 +30,10 @@ export class NotEnoughClaimableError extends Error {
|
|
|
28
30
|
}
|
|
29
31
|
}
|
|
30
32
|
/**
|
|
31
|
-
* Prepares transactions to claim real tokens
|
|
32
|
-
* Checks vault claimable assets and mirror token claimable assets, then creates
|
|
33
|
-
* claim calls to transfer all available real tokens to the receiving address.
|
|
34
|
-
*
|
|
35
|
-
* @param chainId The chain ID.
|
|
36
|
-
* @param userAddress The user address.
|
|
37
|
-
* @param mirrorTokenAddress The mirror token address.
|
|
38
|
-
* @param receivingAddress The address to receive the claimed real tokens.
|
|
39
|
-
* @param options Optional parameters.
|
|
40
|
-
* @returns Promise resolving to array of batch calls.
|
|
41
|
-
* @example
|
|
42
|
-
* import { prepareClaimRealTokensSameChain } from '@1stdex/first-sdk'
|
|
43
|
-
* import { useSmartWallets } from '@privy-io/react-auth/smart-wallets'
|
|
44
|
-
*
|
|
45
|
-
* const calls = await prepareClaimRealTokensSameChain({
|
|
46
|
-
* chainId: 421614,
|
|
47
|
-
* userAddress: '0xF8c1869Ecd4df136693C45EcE1b67f85B6bDaE69',
|
|
48
|
-
* mirrorTokenAddress: '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0',
|
|
49
|
-
* receivingAddress: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb'
|
|
50
|
-
* })
|
|
51
|
-
*
|
|
52
|
-
* // Send all calls in one batched transaction
|
|
53
|
-
* const { client } = useSmartWallets()
|
|
54
|
-
* const txHash = await client.sendUserOperation({ calls })
|
|
55
|
-
*/
|
|
56
|
-
export const prepareClaimRealTokensSameChain = async ({ chainId, userAddress, mirrorTokenAddress, receivingAddress, options, }) => {
|
|
57
|
-
const publicClient = createPublicClient({
|
|
58
|
-
chain: CHAIN_MAP[chainId],
|
|
59
|
-
transport: options?.rpcUrl ? http(options.rpcUrl) : http(),
|
|
60
|
-
});
|
|
61
|
-
const vault = await getVault({
|
|
62
|
-
chainId,
|
|
63
|
-
tokenAddress: mirrorTokenAddress,
|
|
64
|
-
...(options?.rpcUrl && { options: { rpcUrl: options.rpcUrl } }),
|
|
65
|
-
});
|
|
66
|
-
const contracts = [
|
|
67
|
-
{
|
|
68
|
-
address: vault.address,
|
|
69
|
-
abi: CLAIMABLE_DEX_VAULT_ABI,
|
|
70
|
-
functionName: 'getClaimableAssets',
|
|
71
|
-
args: [userAddress],
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
address: mirrorTokenAddress,
|
|
75
|
-
abi: MIRROR_TOKEN_ABI,
|
|
76
|
-
functionName: 'getClaimableAmount',
|
|
77
|
-
args: [userAddress],
|
|
78
|
-
},
|
|
79
|
-
];
|
|
80
|
-
const results = await publicClient.multicall({
|
|
81
|
-
contracts,
|
|
82
|
-
});
|
|
83
|
-
const vaultClaimableAmount = results[0].result || 0n;
|
|
84
|
-
const mirrorTokenClaimableAmount = results[1].result || 0n;
|
|
85
|
-
const calls = [];
|
|
86
|
-
// If vault has claimable assets, claim them first
|
|
87
|
-
if (vaultClaimableAmount > 0n) {
|
|
88
|
-
calls.push({
|
|
89
|
-
to: vault.address,
|
|
90
|
-
data: encodeFunctionData({
|
|
91
|
-
abi: MIRROR_TOKEN_ABI,
|
|
92
|
-
functionName: 'claim',
|
|
93
|
-
args: [userAddress, vaultClaimableAmount],
|
|
94
|
-
}),
|
|
95
|
-
value: 0n,
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
// Claim total available amount from mirror token to receiving address
|
|
99
|
-
const totalClaimableAmount = vaultClaimableAmount + mirrorTokenClaimableAmount;
|
|
100
|
-
if (totalClaimableAmount > 0n) {
|
|
101
|
-
calls.push({
|
|
102
|
-
to: mirrorTokenAddress,
|
|
103
|
-
data: encodeFunctionData({
|
|
104
|
-
abi: MIRROR_TOKEN_ABI,
|
|
105
|
-
functionName: 'claim',
|
|
106
|
-
args: [receivingAddress, totalClaimableAmount],
|
|
107
|
-
}),
|
|
108
|
-
value: 0n,
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
return calls;
|
|
112
|
-
};
|
|
113
|
-
/**
|
|
114
|
-
* Prepares transactions to claim real tokens and bridge them cross-chain via LayerZero.
|
|
33
|
+
* Prepares transactions to claim real tokens and bridge them cross-chain via LayerZero using the sponsor contract.
|
|
115
34
|
* Claims the specified amount optimally (from mirror token and/or vault) to the user address,
|
|
116
|
-
* then bridges them to a receiving address on the destination chain using LayerZero's OFT protocol
|
|
35
|
+
* then bridges them to a receiving address on the destination chain using LayerZero's OFT protocol
|
|
36
|
+
* through the LayerZeroSponsor contract which pays the native fee.
|
|
117
37
|
* Throws NotEnoughClaimableError if combined claimable amount is insufficient.
|
|
118
38
|
*
|
|
119
39
|
* @param chainId The source chain ID.
|
|
@@ -125,10 +45,10 @@ export const prepareClaimRealTokensSameChain = async ({ chainId, userAddress, mi
|
|
|
125
45
|
* @param options Optional parameters.
|
|
126
46
|
* @returns Promise resolving to array of batch calls.
|
|
127
47
|
* @example
|
|
128
|
-
* import {
|
|
48
|
+
* import { prepareClaimRealTokensCrossChainBridgeLZ } from '@1stdex/first-sdk'
|
|
129
49
|
* import { useSmartWallets } from '@privy-io/react-auth/smart-wallets'
|
|
130
50
|
*
|
|
131
|
-
* const calls = await
|
|
51
|
+
* const calls = await prepareClaimRealTokensCrossChainBridgeLZ({
|
|
132
52
|
* chainId: 84532,
|
|
133
53
|
* destinationChainId: 8453,
|
|
134
54
|
* userAddress: '0xF8c1869Ecd4df136693C45EcE1b67f85B6bDaE69',
|
|
@@ -141,7 +61,7 @@ export const prepareClaimRealTokensSameChain = async ({ chainId, userAddress, mi
|
|
|
141
61
|
* const { client } = useSmartWallets()
|
|
142
62
|
* const txHash = await client.sendUserOperation({ calls })
|
|
143
63
|
*/
|
|
144
|
-
export const
|
|
64
|
+
export const prepareClaimRealTokensCrossChainBridgeLZ = async ({ chainId, destinationChainId, userAddress, mirrorTokenAddress, receivingAddress, amount, options, }) => {
|
|
145
65
|
const publicClient = createPublicClient({
|
|
146
66
|
chain: CHAIN_MAP[chainId],
|
|
147
67
|
transport: options?.rpcUrl ? http(options.rpcUrl) : http(),
|
|
@@ -151,17 +71,15 @@ export const prepareClaimRealTokensCrossChainLZ = async ({ chainId, destinationC
|
|
|
151
71
|
tokenAddress: mirrorTokenAddress,
|
|
152
72
|
...(options?.rpcUrl && { options: { rpcUrl: options.rpcUrl } }),
|
|
153
73
|
});
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
// First multicall to get vault, mirror token claimable, and real token address
|
|
164
|
-
const initialContracts = [
|
|
74
|
+
const layerZeroSponsor = CONTRACT_ADDRESSES[chainId].LayerZeroSponsor;
|
|
75
|
+
// Get real token address first to construct all read calls
|
|
76
|
+
const realTokenAddress = await publicClient.readContract({
|
|
77
|
+
address: mirrorTokenAddress,
|
|
78
|
+
abi: MIRROR_TOKEN_ABI,
|
|
79
|
+
functionName: 'realToken',
|
|
80
|
+
});
|
|
81
|
+
// Single multicall to get all data: vault claimable, mirror token claimable, balance, and allowance
|
|
82
|
+
const contracts = [
|
|
165
83
|
{
|
|
166
84
|
address: vault.address,
|
|
167
85
|
abi: CLAIMABLE_DEX_VAULT_ABI,
|
|
@@ -174,32 +92,27 @@ export const prepareClaimRealTokensCrossChainLZ = async ({ chainId, destinationC
|
|
|
174
92
|
functionName: 'getClaimableAmount',
|
|
175
93
|
args: [userAddress],
|
|
176
94
|
},
|
|
177
|
-
{
|
|
178
|
-
address: mirrorTokenAddress,
|
|
179
|
-
abi: MIRROR_TOKEN_ABI,
|
|
180
|
-
functionName: 'realToken',
|
|
181
|
-
},
|
|
182
|
-
];
|
|
183
|
-
const initialResults = await publicClient.multicall({
|
|
184
|
-
contracts: initialContracts,
|
|
185
|
-
});
|
|
186
|
-
const vaultClaimableAmount = initialResults[0].result || 0n;
|
|
187
|
-
const mirrorTokenClaimableAmount = initialResults[1].result || 0n;
|
|
188
|
-
const realTokenAddress = initialResults[2].result;
|
|
189
|
-
const totalClaimableAmount = vaultClaimableAmount + mirrorTokenClaimableAmount;
|
|
190
|
-
// Check balance for the real token
|
|
191
|
-
const balanceContracts = [
|
|
192
95
|
{
|
|
193
96
|
address: realTokenAddress,
|
|
194
97
|
abi: ERC20_ABI,
|
|
195
98
|
functionName: 'balanceOf',
|
|
196
99
|
args: [userAddress],
|
|
197
100
|
},
|
|
101
|
+
{
|
|
102
|
+
address: realTokenAddress,
|
|
103
|
+
abi: ERC20_ABI,
|
|
104
|
+
functionName: 'allowance',
|
|
105
|
+
args: [userAddress, layerZeroSponsor],
|
|
106
|
+
},
|
|
198
107
|
];
|
|
199
|
-
const
|
|
200
|
-
contracts
|
|
108
|
+
const results = await publicClient.multicall({
|
|
109
|
+
contracts,
|
|
201
110
|
});
|
|
202
|
-
const
|
|
111
|
+
const vaultClaimableAmount = results[0].result || 0n;
|
|
112
|
+
const mirrorTokenClaimableAmount = results[1].result || 0n;
|
|
113
|
+
const realTokenBalance = results[2].result || 0n;
|
|
114
|
+
const currentAllowance = results[3].result || 0n;
|
|
115
|
+
const totalClaimableAmount = vaultClaimableAmount + mirrorTokenClaimableAmount;
|
|
203
116
|
// Calculate how much we need to claim (accounting for existing balance)
|
|
204
117
|
const amountNeededToClaim = amount > realTokenBalance ? amount - realTokenBalance : 0n;
|
|
205
118
|
// Check if there's enough claimable to cover what we need
|
|
@@ -249,11 +162,23 @@ export const prepareClaimRealTokensCrossChainLZ = async ({ chainId, destinationC
|
|
|
249
162
|
}
|
|
250
163
|
}
|
|
251
164
|
}
|
|
165
|
+
// Check if approval is needed for LayerZeroSponsor
|
|
166
|
+
if (currentAllowance < amount) {
|
|
167
|
+
calls.push({
|
|
168
|
+
to: realTokenAddress,
|
|
169
|
+
data: encodeFunctionData({
|
|
170
|
+
abi: ERC20_ABI,
|
|
171
|
+
functionName: 'approve',
|
|
172
|
+
args: [layerZeroSponsor, amount],
|
|
173
|
+
}),
|
|
174
|
+
value: 0n,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
252
177
|
// Convert receivingAddress to bytes32 for LayerZero
|
|
253
178
|
const receivingAddressBytes32 = `0x000000000000000000000000${receivingAddress.slice(2)}`;
|
|
254
179
|
// Get destination EID
|
|
255
180
|
const destinationEid = CHAIN_EIDS[destinationChainId];
|
|
256
|
-
// Prepare SendParam for
|
|
181
|
+
// Prepare SendParam for sponsorBridge
|
|
257
182
|
const sendParam = {
|
|
258
183
|
dstEid: destinationEid,
|
|
259
184
|
to: receivingAddressBytes32,
|
|
@@ -263,28 +188,19 @@ export const prepareClaimRealTokensCrossChainLZ = async ({ chainId, destinationC
|
|
|
263
188
|
composeMsg: '0x',
|
|
264
189
|
oftCmd: '0x',
|
|
265
190
|
};
|
|
266
|
-
//
|
|
267
|
-
const quoteFee = await publicClient.readContract({
|
|
268
|
-
address: realTokenAddress,
|
|
269
|
-
abi: FIRST_OFT_ABI,
|
|
270
|
-
functionName: 'quoteSend',
|
|
271
|
-
args: [sendParam, false], // false = pay in native token
|
|
272
|
-
});
|
|
273
|
-
console.log('sendparam', sendParam);
|
|
274
|
-
console.log('quoteFee', quoteFee);
|
|
275
|
-
// Call send() to bridge tokens cross-chain (using real token, not mirror token)
|
|
191
|
+
// Call sponsorBridge on LayerZeroSponsor (no value needed, sponsor pays)
|
|
276
192
|
calls.push({
|
|
277
|
-
to:
|
|
193
|
+
to: layerZeroSponsor,
|
|
278
194
|
data: encodeFunctionData({
|
|
279
|
-
abi:
|
|
280
|
-
functionName: '
|
|
195
|
+
abi: LAYER_ZERO_SPONSOR_ABI,
|
|
196
|
+
functionName: 'sponsorBridge',
|
|
281
197
|
args: [
|
|
198
|
+
realTokenAddress,
|
|
282
199
|
sendParam,
|
|
283
|
-
{ nativeFee: quoteFee.nativeFee, lzTokenFee: 0n },
|
|
284
200
|
userAddress, // refund address
|
|
285
201
|
],
|
|
286
202
|
}),
|
|
287
|
-
value:
|
|
203
|
+
value: 0n, // No native value needed - sponsor pays
|
|
288
204
|
});
|
|
289
205
|
return calls;
|
|
290
206
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepare-claim-real-tokens.js","sourceRoot":"","sources":["../../../../src/calls/batch/prepare-claim-real-tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAEpE,OAAO,EAAa,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,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CAAC,CAAC;IAEtD,sCAAsC;IACtC,MAAM,SAAS,GAAG;QAChB,MAAM,EAAE,cAAc;QACtB,EAAE,EAAE,uBAAuB;QAC3B,QAAQ,EAAE,MAAM;QAChB,WAAW,EAAE,MAAM;QACnB,YAAY,EAAE,IAAqB;QACnC,UAAU,EAAE,IAAqB;QACjC,MAAM,EAAE,IAAqB;KAC9B,CAAC;IAEF,yEAAyE;IACzE,KAAK,CAAC,IAAI,CAAC;QACT,EAAE,EAAE,gBAAgB;QACpB,IAAI,EAAE,kBAAkB,CAAC;YACvB,GAAG,EAAE,sBAAsB;YAC3B,YAAY,EAAE,eAAe;YAC7B,IAAI,EAAE;gBACJ,gBAAgB;gBAChB,SAAS;gBACT,WAAW,EAAE,iBAAiB;aAC/B;SACF,CAAC;QACF,KAAK,EAAE,EAAE,EAAE,wCAAwC;KACpD,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
|
package/dist/esm/calls/index.js
CHANGED
|
@@ -8,5 +8,5 @@ export { setApprovalOfOpenOrdersForAll } from './approval/open-order';
|
|
|
8
8
|
export { setTokenAllowances } from './approval/token';
|
|
9
9
|
export { approveAllForMarket } from './approval/market';
|
|
10
10
|
export { setVault, removeVault, depositToVault, withdrawFromVault, } from './vault';
|
|
11
|
-
export { prepareLimitOrderWithSetup, prepareMarketOrderWithSetup, prepareWithdraw, NotEnoughFundsError,
|
|
11
|
+
export { prepareLimitOrderWithSetup, prepareMarketOrderWithSetup, prepareWithdraw, NotEnoughFundsError, prepareClaimRealTokensCrossChainBridgeLZ, NotEnoughClaimableError, } from './batch';
|
|
12
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/calls/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD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S,CAAC;AAEjB,OAAO,EACL,0BAA0B,EAC1B,2BAA2B,EAC3B,eAAe,EACf,mBAAmB,EACnB,wCAAwC,EACxC,uBAAuB,GACxB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export const ERC20_ABI = [
|
|
2
|
+
{
|
|
3
|
+
inputs: [{ internalType: 'address', name: 'account', type: 'address' }],
|
|
4
|
+
name: 'balanceOf',
|
|
5
|
+
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
|
|
6
|
+
stateMutability: 'view',
|
|
7
|
+
type: 'function',
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
inputs: [
|
|
11
|
+
{ internalType: 'address', name: 'owner', type: 'address' },
|
|
12
|
+
{ internalType: 'address', name: 'spender', type: 'address' },
|
|
13
|
+
],
|
|
14
|
+
name: 'allowance',
|
|
15
|
+
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
|
|
16
|
+
stateMutability: 'view',
|
|
17
|
+
type: 'function',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
inputs: [
|
|
21
|
+
{ internalType: 'address', name: 'spender', type: 'address' },
|
|
22
|
+
{ internalType: 'uint256', name: 'amount', type: 'uint256' },
|
|
23
|
+
],
|
|
24
|
+
name: 'approve',
|
|
25
|
+
outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
|
|
26
|
+
stateMutability: 'nonpayable',
|
|
27
|
+
type: 'function',
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
//# sourceMappingURL=erc20.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"erc20.js","sourceRoot":"","sources":["../../../../../src/constants/abis/core/erc20.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB;QACE,MAAM,EAAE,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC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