@tokenops/sdk 2.0.0-alpha.1 → 2.0.0-alpha.3
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/CHANGELOG.md +67 -2
- package/README.md +14 -8
- package/dist/{chunk-PUX5VXDB.cjs → chunk-4AWQJQXY.cjs} +1415 -69
- package/dist/{chunk-74QFZ5MK.js → chunk-4IB4IY5Y.js} +1 -1
- package/dist/{chunk-DZHYSUGY.js → chunk-6HCT4QIX.js} +12 -5
- package/dist/{chunk-FGEB7RMY.cjs → chunk-6XOAYDC6.cjs} +4 -4
- package/dist/{chunk-XAYGD4E4.cjs → chunk-AHU2HMNE.cjs} +3 -3
- package/dist/{chunk-6NAVMWZQ.js → chunk-BPIVVCSQ.js} +2 -2
- package/dist/{chunk-GKKDAW44.js → chunk-BXX5TETM.js} +1401 -59
- package/dist/{chunk-456VDDA3.js → chunk-GCJFAY4X.js} +78 -25
- package/dist/{chunk-CTED3MTR.cjs → chunk-GKYZQJGP.cjs} +82 -29
- package/dist/{chunk-JZLGCTGK.cjs → chunk-IEKTGJ4J.cjs} +2 -2
- package/dist/{chunk-6PXXGACR.cjs → chunk-JVNJSDQ4.cjs} +2 -2
- package/dist/{chunk-O5676ZWY.js → chunk-LEYYG4RF.js} +232 -6
- package/dist/{chunk-335Z2W67.js → chunk-NGU4JYIR.js} +1 -1
- package/dist/{chunk-5576FRT3.cjs → chunk-PG3WXT3K.cjs} +12 -5
- package/dist/{chunk-H5POPGOZ.js → chunk-PK6Q6J5F.js} +1 -1
- package/dist/chunk-TND5NDV7.cjs +263 -0
- package/dist/chunk-U3TBQRT7.js +253 -0
- package/dist/{chunk-EAJ7SYHE.js → chunk-WRWRA4TN.js} +1 -1
- package/dist/{chunk-JQYC66TO.cjs → chunk-YABHXJNH.cjs} +5 -5
- package/dist/{chunk-M4IT6DNJ.cjs → chunk-YTIYTV4K.cjs} +236 -4
- package/dist/core/addresses.d.ts +4 -4
- package/dist/core/errors.d.ts +1 -1
- package/dist/fhe/types.d.ts +2 -2
- package/dist/fhe-airdrop/abis/airdrop-base.d.ts +19 -0
- package/dist/fhe-airdrop/abis/ecdsa.d.ts +19 -0
- package/dist/fhe-airdrop/abis/factory.d.ts +113 -0
- package/dist/fhe-airdrop/abis/merkle.d.ts +43 -12
- package/dist/fhe-airdrop/advanced/index.cjs +4 -4
- package/dist/fhe-airdrop/advanced/index.js +1 -1
- package/dist/fhe-airdrop/advanced/react/index.cjs +620 -9
- package/dist/fhe-airdrop/advanced/react/index.d.cts +35 -0
- package/dist/fhe-airdrop/advanced/react/index.d.ts +35 -0
- package/dist/fhe-airdrop/advanced/react/index.js +590 -7
- package/dist/fhe-airdrop/advanced/react/useClearCompliancePolicy.d.ts +28 -0
- package/dist/fhe-airdrop/advanced/react/useClearUpgradeabilityPolicy.d.ts +26 -0
- package/dist/fhe-airdrop/advanced/react/useDisableCustomFee.d.ts +26 -0
- package/dist/fhe-airdrop/advanced/react/useEcdsaInitCodeHash.d.ts +30 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryComplianceDelegate.d.ts +25 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryCompliancePolicy.d.ts +38 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryCustomFee.d.ts +24 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryGrantRole.d.ts +32 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryHasRole.d.ts +27 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryImplementations.d.ts +33 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryRenounceRole.d.ts +37 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryRevokeRole.d.ts +37 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryRoleConstants.d.ts +46 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryRoleMembers.d.ts +48 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryUpgradeabilityPolicy.d.ts +39 -0
- package/dist/fhe-airdrop/advanced/react/useMerkleInitCodeHash.d.ts +24 -0
- package/dist/fhe-airdrop/advanced/react/useSetComplianceDelegate.d.ts +33 -0
- package/dist/fhe-airdrop/advanced/react/useSetComplianceManagerImpl.d.ts +27 -0
- package/dist/fhe-airdrop/advanced/react/useSetCompliancePolicy.d.ts +28 -0
- package/dist/fhe-airdrop/advanced/react/useSetCustomFee.d.ts +29 -0
- package/dist/fhe-airdrop/advanced/react/useSetDefaultDelegateToCompliance.d.ts +31 -0
- package/dist/fhe-airdrop/advanced/react/useSetDefaultGasFee.d.ts +30 -0
- package/dist/fhe-airdrop/advanced/react/useSetDefaultUpgradeable.d.ts +27 -0
- package/dist/fhe-airdrop/advanced/react/useSetEcdsaImplementation.d.ts +34 -0
- package/dist/fhe-airdrop/advanced/react/useSetFeeCollector.d.ts +27 -0
- package/dist/fhe-airdrop/advanced/react/useSetMaxGasFee.d.ts +33 -0
- package/dist/fhe-airdrop/advanced/react/useSetMerkleImplementation.d.ts +30 -0
- package/dist/fhe-airdrop/advanced/react/useSetUpgradeabilityPolicy.d.ts +31 -0
- package/dist/fhe-airdrop/airdrop-base.d.ts +55 -8
- package/dist/fhe-airdrop/campaign.d.ts +61 -20
- package/dist/fhe-airdrop/constants.d.ts +9 -1
- package/dist/fhe-airdrop/ecdsa.d.ts +13 -0
- package/dist/fhe-airdrop/errors.d.ts +87 -0
- package/dist/fhe-airdrop/factory.d.ts +62 -22
- package/dist/fhe-airdrop/guards.d.ts +133 -4
- package/dist/fhe-airdrop/index.cjs +86 -971
- package/dist/fhe-airdrop/index.d.cts +4 -4
- package/dist/fhe-airdrop/index.d.ts +4 -4
- package/dist/fhe-airdrop/index.js +8 -927
- package/dist/fhe-airdrop/merkle-tree.d.ts +32 -38
- package/dist/fhe-airdrop/merkle.d.ts +52 -31
- package/dist/fhe-airdrop/react/_shared.d.ts +13 -0
- package/dist/fhe-airdrop/react/index.cjs +997 -87
- package/dist/fhe-airdrop/react/index.d.cts +53 -4
- package/dist/fhe-airdrop/react/index.d.ts +53 -4
- package/dist/fhe-airdrop/react/index.js +887 -27
- package/dist/fhe-airdrop/react/keys.d.ts +98 -0
- package/dist/fhe-airdrop/react/useAccessEcdsaClaimAmount.d.ts +26 -0
- package/dist/fhe-airdrop/react/useAccessMerkleClaimAmount.d.ts +27 -0
- package/dist/fhe-airdrop/react/useAddComplianceDelegate.d.ts +37 -0
- package/dist/fhe-airdrop/react/useAdminBatchDiscloseBalanceToParties.d.ts +36 -0
- package/dist/fhe-airdrop/react/useAdminDiscloseBalanceToParty.d.ts +31 -0
- package/dist/fhe-airdrop/react/useAdminGetCurrentBalance.d.ts +27 -0
- package/dist/fhe-airdrop/react/useAirdropConfig.d.ts +49 -0
- package/dist/fhe-airdrop/react/useAirdropDeploymentMode.d.ts +28 -0
- package/dist/fhe-airdrop/react/useAirdropGrantRole.d.ts +35 -0
- package/dist/fhe-airdrop/react/useAirdropRenounceRole.d.ts +36 -0
- package/dist/fhe-airdrop/react/useAirdropRevokeRole.d.ts +33 -0
- package/dist/fhe-airdrop/react/useAirdropRoleAdmin.d.ts +28 -0
- package/dist/fhe-airdrop/react/useAirdropRoleConstants.d.ts +67 -0
- package/dist/fhe-airdrop/react/useAirdropRoleMembers.d.ts +49 -0
- package/dist/fhe-airdrop/react/useAirdropUpgradeToAndCall.d.ts +45 -0
- package/dist/fhe-airdrop/react/useBatchDiscloseHandlesToParty.d.ts +32 -0
- package/dist/fhe-airdrop/react/useBuildMerkleCampaign.d.ts +68 -0
- package/dist/fhe-airdrop/react/useComplianceGrantRole.d.ts +32 -0
- package/dist/fhe-airdrop/react/useComplianceHasRole.d.ts +37 -0
- package/dist/fhe-airdrop/react/useComplianceInfo.d.ts +50 -0
- package/dist/fhe-airdrop/react/useComplianceManagerOf.d.ts +32 -0
- package/dist/fhe-airdrop/react/useComplianceRenounceRole.d.ts +38 -0
- package/dist/fhe-airdrop/react/useComplianceRevokeRole.d.ts +36 -0
- package/dist/fhe-airdrop/react/useComplianceRoleConstants.d.ts +41 -0
- package/dist/fhe-airdrop/react/useComplianceRoleMembers.d.ts +45 -0
- package/dist/fhe-airdrop/react/useCreateAndFundEcdsaAirdrop.d.ts +55 -0
- package/dist/fhe-airdrop/react/useCreateAndFundMerkleAirdrop.d.ts +52 -0
- package/dist/fhe-airdrop/react/useDiscloseHandleToParty.d.ts +35 -0
- package/dist/fhe-airdrop/react/useEcdsaClaim.d.ts +4 -3
- package/dist/fhe-airdrop/react/useEcdsaClaimAndUnwrap.d.ts +27 -0
- package/dist/fhe-airdrop/react/useEcdsaDomain.d.ts +41 -0
- package/dist/fhe-airdrop/react/useEffectiveDelegateToCompliance.d.ts +26 -0
- package/dist/fhe-airdrop/react/useEncryptCampaignAmounts.d.ts +59 -0
- package/dist/fhe-airdrop/react/useFactoryFees.d.ts +11 -4
- package/dist/fhe-airdrop/react/useIsActiveDelegate.d.ts +29 -0
- package/dist/fhe-airdrop/react/useIsAirdrop.d.ts +44 -0
- package/dist/fhe-airdrop/react/useIsMerkleRootMutable.d.ts +21 -0
- package/dist/fhe-airdrop/react/useIsSignatureValid.d.ts +46 -0
- package/dist/fhe-airdrop/react/useMerkleClaim.d.ts +7 -19
- package/dist/fhe-airdrop/react/useMerkleClaimAndUnwrap.d.ts +29 -0
- package/dist/fhe-airdrop/react/usePlanMerkleCampaign.d.ts +53 -0
- package/dist/fhe-airdrop/react/usePreflightClaim.d.ts +46 -0
- package/dist/fhe-airdrop/react/usePreflightCreateAirdrop.d.ts +67 -0
- package/dist/fhe-airdrop/react/useRefreshComplianceBalance.d.ts +36 -0
- package/dist/fhe-airdrop/react/useRescueERC20.d.ts +30 -0
- package/dist/fhe-airdrop/react/useRescueOtherConfidentialToken.d.ts +34 -0
- package/dist/fhe-airdrop/react/useResolveGasFee.d.ts +30 -0
- package/dist/fhe-airdrop/react/useRevokeComplianceDelegate.d.ts +37 -0
- package/dist/fhe-airdrop/react/useRotateMerkleRoot.d.ts +52 -0
- package/dist/fhe-airdrop/react/useSignClaimAuthorization.d.ts +42 -0
- package/dist/fhe-airdrop/react/useWithdrawGasFee.d.ts +37 -0
- package/dist/fhe-airdrop/types.d.ts +27 -1
- package/dist/fhe-disperse/index.cjs +21 -21
- package/dist/fhe-disperse/index.js +2 -2
- package/dist/fhe-disperse/react/index.cjs +22 -22
- package/dist/fhe-disperse/react/index.js +3 -3
- package/dist/fhe-vesting/advanced/index.cjs +5 -5
- package/dist/fhe-vesting/advanced/index.js +3 -3
- package/dist/fhe-vesting/advanced/react/index.cjs +7 -7
- package/dist/fhe-vesting/advanced/react/index.js +4 -4
- package/dist/fhe-vesting/index.cjs +8 -8
- package/dist/fhe-vesting/index.js +2 -2
- package/dist/fhe-vesting/react/index.cjs +114 -114
- package/dist/fhe-vesting/react/index.js +3 -3
- package/dist/index.cjs +18 -18
- package/dist/index.js +1 -1
- package/dist/testnet-faucet/index.cjs +14 -14
- package/dist/testnet-faucet/index.js +2 -2
- package/dist/testnet-faucet/react/index.cjs +8 -8
- package/dist/testnet-faucet/react/index.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-NCVX3K2N.cjs +0 -161
- package/dist/chunk-VP2B4WM2.js +0 -154
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkYTIYTV4K_cjs = require('./chunk-YTIYTV4K.cjs');
|
|
4
4
|
var chunkFAXIIH5R_cjs = require('./chunk-FAXIIH5R.cjs');
|
|
5
5
|
var chunkUG5RKLU2_cjs = require('./chunk-UG5RKLU2.cjs');
|
|
6
6
|
var chunkMVDQMV25_cjs = require('./chunk-MVDQMV25.cjs');
|
|
7
|
-
var
|
|
7
|
+
var chunkPG3WXT3K_cjs = require('./chunk-PG3WXT3K.cjs');
|
|
8
8
|
var chunkJK4XMMKM_cjs = require('./chunk-JK4XMMKM.cjs');
|
|
9
9
|
var chunk66IHPTOK_cjs = require('./chunk-66IHPTOK.cjs');
|
|
10
10
|
var chunk67OV5CX2_cjs = require('./chunk-67OV5CX2.cjs');
|
|
@@ -71,6 +71,11 @@ var airdropFactoryAbi = [
|
|
|
71
71
|
internalType: "uint96",
|
|
72
72
|
name: "defaultGasFee_",
|
|
73
73
|
type: "uint96"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
internalType: "uint96",
|
|
77
|
+
name: "maxGasFee_",
|
|
78
|
+
type: "uint96"
|
|
74
79
|
}
|
|
75
80
|
],
|
|
76
81
|
stateMutability: "nonpayable",
|
|
@@ -175,6 +180,38 @@ var airdropFactoryAbi = [
|
|
|
175
180
|
name: "FailedDeployment",
|
|
176
181
|
type: "error"
|
|
177
182
|
},
|
|
183
|
+
{
|
|
184
|
+
inputs: [
|
|
185
|
+
{
|
|
186
|
+
internalType: "uint96",
|
|
187
|
+
name: "gasFee",
|
|
188
|
+
type: "uint96"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
internalType: "uint96",
|
|
192
|
+
name: "maxGasFee",
|
|
193
|
+
type: "uint96"
|
|
194
|
+
}
|
|
195
|
+
],
|
|
196
|
+
name: "GasFeeExceedsMaximum",
|
|
197
|
+
type: "error"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
inputs: [
|
|
201
|
+
{
|
|
202
|
+
internalType: "uint96",
|
|
203
|
+
name: "resolvedFee",
|
|
204
|
+
type: "uint96"
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
internalType: "uint96",
|
|
208
|
+
name: "maxAcceptedGasFee",
|
|
209
|
+
type: "uint96"
|
|
210
|
+
}
|
|
211
|
+
],
|
|
212
|
+
name: "GasFeeNotAccepted",
|
|
213
|
+
type: "error"
|
|
214
|
+
},
|
|
178
215
|
{
|
|
179
216
|
inputs: [
|
|
180
217
|
{
|
|
@@ -393,6 +430,11 @@ var airdropFactoryAbi = [
|
|
|
393
430
|
name: "ZeroToken",
|
|
394
431
|
type: "error"
|
|
395
432
|
},
|
|
433
|
+
{
|
|
434
|
+
inputs: [],
|
|
435
|
+
name: "ZeroUnwrapRequestId",
|
|
436
|
+
type: "error"
|
|
437
|
+
},
|
|
396
438
|
{
|
|
397
439
|
anonymous: false,
|
|
398
440
|
inputs: [
|
|
@@ -425,6 +467,12 @@ var airdropFactoryAbi = [
|
|
|
425
467
|
internalType: "uint256",
|
|
426
468
|
name: "deploymentBlockNumber",
|
|
427
469
|
type: "uint256"
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
indexed: false,
|
|
473
|
+
internalType: "uint256",
|
|
474
|
+
name: "gasFee",
|
|
475
|
+
type: "uint256"
|
|
428
476
|
}
|
|
429
477
|
],
|
|
430
478
|
name: "AirdropInitialized",
|
|
@@ -929,6 +977,19 @@ var airdropFactoryAbi = [
|
|
|
929
977
|
name: "SetDefaultGasFee",
|
|
930
978
|
type: "event"
|
|
931
979
|
},
|
|
980
|
+
{
|
|
981
|
+
anonymous: false,
|
|
982
|
+
inputs: [
|
|
983
|
+
{
|
|
984
|
+
indexed: false,
|
|
985
|
+
internalType: "uint256",
|
|
986
|
+
name: "maxGasFee",
|
|
987
|
+
type: "uint256"
|
|
988
|
+
}
|
|
989
|
+
],
|
|
990
|
+
name: "SetMaxGasFee",
|
|
991
|
+
type: "event"
|
|
992
|
+
},
|
|
932
993
|
{
|
|
933
994
|
anonymous: false,
|
|
934
995
|
inputs: [
|
|
@@ -1220,6 +1281,11 @@ var airdropFactoryAbi = [
|
|
|
1220
1281
|
internalType: "address",
|
|
1221
1282
|
name: "complianceAdmin",
|
|
1222
1283
|
type: "address"
|
|
1284
|
+
},
|
|
1285
|
+
{
|
|
1286
|
+
internalType: "uint96",
|
|
1287
|
+
name: "maxAcceptedGasFee",
|
|
1288
|
+
type: "uint96"
|
|
1223
1289
|
}
|
|
1224
1290
|
],
|
|
1225
1291
|
internalType: "struct IAirdropFactory.CommonAirdropParams",
|
|
@@ -1308,6 +1374,11 @@ var airdropFactoryAbi = [
|
|
|
1308
1374
|
internalType: "address",
|
|
1309
1375
|
name: "complianceAdmin",
|
|
1310
1376
|
type: "address"
|
|
1377
|
+
},
|
|
1378
|
+
{
|
|
1379
|
+
internalType: "uint96",
|
|
1380
|
+
name: "maxAcceptedGasFee",
|
|
1381
|
+
type: "uint96"
|
|
1311
1382
|
}
|
|
1312
1383
|
],
|
|
1313
1384
|
internalType: "struct IAirdropFactory.CommonAirdropParams",
|
|
@@ -1396,6 +1467,11 @@ var airdropFactoryAbi = [
|
|
|
1396
1467
|
internalType: "address",
|
|
1397
1468
|
name: "complianceAdmin",
|
|
1398
1469
|
type: "address"
|
|
1470
|
+
},
|
|
1471
|
+
{
|
|
1472
|
+
internalType: "uint96",
|
|
1473
|
+
name: "maxAcceptedGasFee",
|
|
1474
|
+
type: "uint96"
|
|
1399
1475
|
}
|
|
1400
1476
|
],
|
|
1401
1477
|
internalType: "struct IAirdropFactory.CommonAirdropParams",
|
|
@@ -1474,6 +1550,11 @@ var airdropFactoryAbi = [
|
|
|
1474
1550
|
internalType: "address",
|
|
1475
1551
|
name: "complianceAdmin",
|
|
1476
1552
|
type: "address"
|
|
1553
|
+
},
|
|
1554
|
+
{
|
|
1555
|
+
internalType: "uint96",
|
|
1556
|
+
name: "maxAcceptedGasFee",
|
|
1557
|
+
type: "uint96"
|
|
1477
1558
|
}
|
|
1478
1559
|
],
|
|
1479
1560
|
internalType: "struct IAirdropFactory.CommonAirdropParams",
|
|
@@ -1740,6 +1821,11 @@ var airdropFactoryAbi = [
|
|
|
1740
1821
|
internalType: "address",
|
|
1741
1822
|
name: "complianceAdmin",
|
|
1742
1823
|
type: "address"
|
|
1824
|
+
},
|
|
1825
|
+
{
|
|
1826
|
+
internalType: "uint96",
|
|
1827
|
+
name: "maxAcceptedGasFee",
|
|
1828
|
+
type: "uint96"
|
|
1743
1829
|
}
|
|
1744
1830
|
],
|
|
1745
1831
|
internalType: "struct IAirdropFactory.CommonAirdropParams",
|
|
@@ -1813,6 +1899,11 @@ var airdropFactoryAbi = [
|
|
|
1813
1899
|
internalType: "address",
|
|
1814
1900
|
name: "complianceAdmin",
|
|
1815
1901
|
type: "address"
|
|
1902
|
+
},
|
|
1903
|
+
{
|
|
1904
|
+
internalType: "uint96",
|
|
1905
|
+
name: "maxAcceptedGasFee",
|
|
1906
|
+
type: "uint96"
|
|
1816
1907
|
}
|
|
1817
1908
|
],
|
|
1818
1909
|
internalType: "struct IAirdropFactory.CommonAirdropParams",
|
|
@@ -2005,6 +2096,38 @@ var airdropFactoryAbi = [
|
|
|
2005
2096
|
stateMutability: "view",
|
|
2006
2097
|
type: "function"
|
|
2007
2098
|
},
|
|
2099
|
+
{
|
|
2100
|
+
inputs: [
|
|
2101
|
+
{
|
|
2102
|
+
internalType: "address",
|
|
2103
|
+
name: "candidate",
|
|
2104
|
+
type: "address"
|
|
2105
|
+
}
|
|
2106
|
+
],
|
|
2107
|
+
name: "isAirdrop",
|
|
2108
|
+
outputs: [
|
|
2109
|
+
{
|
|
2110
|
+
internalType: "bool",
|
|
2111
|
+
name: "",
|
|
2112
|
+
type: "bool"
|
|
2113
|
+
}
|
|
2114
|
+
],
|
|
2115
|
+
stateMutability: "view",
|
|
2116
|
+
type: "function"
|
|
2117
|
+
},
|
|
2118
|
+
{
|
|
2119
|
+
inputs: [],
|
|
2120
|
+
name: "maxGasFee",
|
|
2121
|
+
outputs: [
|
|
2122
|
+
{
|
|
2123
|
+
internalType: "uint256",
|
|
2124
|
+
name: "",
|
|
2125
|
+
type: "uint256"
|
|
2126
|
+
}
|
|
2127
|
+
],
|
|
2128
|
+
stateMutability: "view",
|
|
2129
|
+
type: "function"
|
|
2130
|
+
},
|
|
2008
2131
|
{
|
|
2009
2132
|
inputs: [],
|
|
2010
2133
|
name: "merkleImplementation",
|
|
@@ -2053,6 +2176,11 @@ var airdropFactoryAbi = [
|
|
|
2053
2176
|
internalType: "address",
|
|
2054
2177
|
name: "complianceAdmin",
|
|
2055
2178
|
type: "address"
|
|
2179
|
+
},
|
|
2180
|
+
{
|
|
2181
|
+
internalType: "uint96",
|
|
2182
|
+
name: "maxAcceptedGasFee",
|
|
2183
|
+
type: "uint96"
|
|
2056
2184
|
}
|
|
2057
2185
|
],
|
|
2058
2186
|
internalType: "struct IAirdropFactory.CommonAirdropParams",
|
|
@@ -2136,6 +2264,11 @@ var airdropFactoryAbi = [
|
|
|
2136
2264
|
internalType: "address",
|
|
2137
2265
|
name: "complianceAdmin",
|
|
2138
2266
|
type: "address"
|
|
2267
|
+
},
|
|
2268
|
+
{
|
|
2269
|
+
internalType: "uint96",
|
|
2270
|
+
name: "maxAcceptedGasFee",
|
|
2271
|
+
type: "uint96"
|
|
2139
2272
|
}
|
|
2140
2273
|
],
|
|
2141
2274
|
internalType: "struct IAirdropFactory.CommonAirdropParams",
|
|
@@ -2347,6 +2480,19 @@ var airdropFactoryAbi = [
|
|
|
2347
2480
|
stateMutability: "nonpayable",
|
|
2348
2481
|
type: "function"
|
|
2349
2482
|
},
|
|
2483
|
+
{
|
|
2484
|
+
inputs: [
|
|
2485
|
+
{
|
|
2486
|
+
internalType: "uint96",
|
|
2487
|
+
name: "maxGasFee_",
|
|
2488
|
+
type: "uint96"
|
|
2489
|
+
}
|
|
2490
|
+
],
|
|
2491
|
+
name: "setMaxGasFee",
|
|
2492
|
+
outputs: [],
|
|
2493
|
+
stateMutability: "nonpayable",
|
|
2494
|
+
type: "function"
|
|
2495
|
+
},
|
|
2350
2496
|
{
|
|
2351
2497
|
inputs: [
|
|
2352
2498
|
{
|
|
@@ -2765,6 +2911,11 @@ var ecdsaConfidentialAirdropAbi = [
|
|
|
2765
2911
|
name: "ZeroToken",
|
|
2766
2912
|
type: "error"
|
|
2767
2913
|
},
|
|
2914
|
+
{
|
|
2915
|
+
inputs: [],
|
|
2916
|
+
name: "ZeroUnwrapRequestId",
|
|
2917
|
+
type: "error"
|
|
2918
|
+
},
|
|
2768
2919
|
{
|
|
2769
2920
|
anonymous: false,
|
|
2770
2921
|
inputs: [
|
|
@@ -2797,6 +2948,12 @@ var ecdsaConfidentialAirdropAbi = [
|
|
|
2797
2948
|
internalType: "uint256",
|
|
2798
2949
|
name: "deploymentBlockNumber",
|
|
2799
2950
|
type: "uint256"
|
|
2951
|
+
},
|
|
2952
|
+
{
|
|
2953
|
+
indexed: false,
|
|
2954
|
+
internalType: "uint256",
|
|
2955
|
+
name: "gasFee",
|
|
2956
|
+
type: "uint256"
|
|
2800
2957
|
}
|
|
2801
2958
|
],
|
|
2802
2959
|
name: "AirdropInitialized",
|
|
@@ -3909,6 +4066,19 @@ var ecdsaConfidentialAirdropAbi = [
|
|
|
3909
4066
|
stateMutability: "view",
|
|
3910
4067
|
type: "function"
|
|
3911
4068
|
},
|
|
4069
|
+
{
|
|
4070
|
+
inputs: [],
|
|
4071
|
+
name: "refreshComplianceBalance",
|
|
4072
|
+
outputs: [
|
|
4073
|
+
{
|
|
4074
|
+
internalType: "euint64",
|
|
4075
|
+
name: "balance",
|
|
4076
|
+
type: "bytes32"
|
|
4077
|
+
}
|
|
4078
|
+
],
|
|
4079
|
+
stateMutability: "nonpayable",
|
|
4080
|
+
type: "function"
|
|
4081
|
+
},
|
|
3912
4082
|
{
|
|
3913
4083
|
inputs: [
|
|
3914
4084
|
{
|
|
@@ -4296,6 +4466,11 @@ var confidentialAirdropBaseAbi = [
|
|
|
4296
4466
|
name: "ZeroToken",
|
|
4297
4467
|
type: "error"
|
|
4298
4468
|
},
|
|
4469
|
+
{
|
|
4470
|
+
inputs: [],
|
|
4471
|
+
name: "ZeroUnwrapRequestId",
|
|
4472
|
+
type: "error"
|
|
4473
|
+
},
|
|
4299
4474
|
{
|
|
4300
4475
|
anonymous: false,
|
|
4301
4476
|
inputs: [
|
|
@@ -4328,6 +4503,12 @@ var confidentialAirdropBaseAbi = [
|
|
|
4328
4503
|
internalType: "uint256",
|
|
4329
4504
|
name: "deploymentBlockNumber",
|
|
4330
4505
|
type: "uint256"
|
|
4506
|
+
},
|
|
4507
|
+
{
|
|
4508
|
+
indexed: false,
|
|
4509
|
+
internalType: "uint256",
|
|
4510
|
+
name: "gasFee",
|
|
4511
|
+
type: "uint256"
|
|
4331
4512
|
}
|
|
4332
4513
|
],
|
|
4333
4514
|
name: "AirdropInitialized",
|
|
@@ -4804,6 +4985,19 @@ var confidentialAirdropBaseAbi = [
|
|
|
4804
4985
|
stateMutability: "nonpayable",
|
|
4805
4986
|
type: "function"
|
|
4806
4987
|
},
|
|
4988
|
+
{
|
|
4989
|
+
inputs: [],
|
|
4990
|
+
name: "refreshComplianceBalance",
|
|
4991
|
+
outputs: [
|
|
4992
|
+
{
|
|
4993
|
+
internalType: "euint64",
|
|
4994
|
+
name: "balance",
|
|
4995
|
+
type: "bytes32"
|
|
4996
|
+
}
|
|
4997
|
+
],
|
|
4998
|
+
stateMutability: "nonpayable",
|
|
4999
|
+
type: "function"
|
|
5000
|
+
},
|
|
4807
5001
|
{
|
|
4808
5002
|
inputs: [
|
|
4809
5003
|
{
|
|
@@ -5101,7 +5295,7 @@ var AirdropBaseClient = class {
|
|
|
5101
5295
|
clientLabel: "AirdropBaseClient"
|
|
5102
5296
|
});
|
|
5103
5297
|
}
|
|
5104
|
-
|
|
5298
|
+
chunkYTIYTV4K_cjs.assertSupportedChain(chainId);
|
|
5105
5299
|
this.chainId = chainId;
|
|
5106
5300
|
this.address = chunkJK4XMMKM_cjs.normaliseAddress(config.address);
|
|
5107
5301
|
this.aclAddress = config.aclAddress ? chunkJK4XMMKM_cjs.normaliseAddress(config.aclAddress) : chunkFAXIIH5R_cjs.requireFhevmAclAddress(chainId, "AirdropBaseClient");
|
|
@@ -5203,8 +5397,12 @@ var AirdropBaseClient = class {
|
|
|
5203
5397
|
* Sweep a plain ERC-20 that was sent to the instance by mistake. Requires
|
|
5204
5398
|
* `RESCUER_ROLE`.
|
|
5205
5399
|
*
|
|
5206
|
-
*
|
|
5207
|
-
*
|
|
5400
|
+
* Passing the campaign's own token reverts `CannotRescueAirdropToken`
|
|
5401
|
+
* (audit-05), matching {@link rescueOtherConfidentialToken}. ERC-7984 and
|
|
5402
|
+
* ERC-20 are not disjoint in practice - a wrapper token answers both
|
|
5403
|
+
* interfaces - so "the pool token is confidential, therefore out of reach
|
|
5404
|
+
* here" was never a guarantee, only an assumption. Use
|
|
5405
|
+
* {@link withdrawConfidential} for the pool.
|
|
5208
5406
|
*
|
|
5209
5407
|
* @returns The transaction hash.
|
|
5210
5408
|
*/
|
|
@@ -5564,17 +5762,56 @@ var AirdropBaseClient = class {
|
|
|
5564
5762
|
// DISCLOSURE (ENCRYPTED)
|
|
5565
5763
|
// ============================================================
|
|
5566
5764
|
//
|
|
5567
|
-
// The first
|
|
5765
|
+
// The first four read like getters and are `nonpayable` in the ABI: they
|
|
5568
5766
|
// call `FHE.allow`, which writes ACL state. They therefore submit a
|
|
5569
5767
|
// transaction and recover their `euint64` result from the receipt — never
|
|
5570
5768
|
// from a simulation. See `extractGrantedHandle`.
|
|
5571
5769
|
//
|
|
5770
|
+
// Three of those four grant the CALLER; `refreshComplianceBalance` grants the
|
|
5771
|
+
// compliance clone instead, which is why it resolves the clone address and
|
|
5772
|
+
// passes it as `grantee`.
|
|
5773
|
+
//
|
|
5572
5774
|
// The last two return nothing on-chain and are ordinary writes: they grant a
|
|
5573
5775
|
// handle the caller already has, so there is no new handle to recover.
|
|
5776
|
+
/**
|
|
5777
|
+
* Re-grant the compliance-manager clone on the instance's current pool
|
|
5778
|
+
* balance, and return the handle it was granted on.
|
|
5779
|
+
*
|
|
5780
|
+
* **Permissionless, and deliberately so** (audit-04). The token rotates the
|
|
5781
|
+
* instance's balance handle on every incoming transfer, including one no
|
|
5782
|
+
* airdrop code observes - a third party transferring in directly - and
|
|
5783
|
+
* grants the fresh handle to the token and the holder only. Without this the
|
|
5784
|
+
* compliance clone's grant can be stranded on a handle the token has already
|
|
5785
|
+
* replaced, with no admin necessarily around to restore it. There is no
|
|
5786
|
+
* argument to abuse: the only handle read is `address(this)`'s own balance,
|
|
5787
|
+
* and the only grantee is the clone wired at initialization.
|
|
5788
|
+
*
|
|
5789
|
+
* This is therefore the normative way to obtain a readable live-balance
|
|
5790
|
+
* handle - and it is a **snapshot, not a subscription**. Grants are
|
|
5791
|
+
* append-only, so the handle this returns stays readable forever; but the
|
|
5792
|
+
* next incoming transfer rotates the instance to a NEW handle the clone was
|
|
5793
|
+
* never granted on. A compliance reader that refreshes once and stops is
|
|
5794
|
+
* reading a stale balance, not a live one. Call it again after any transfer
|
|
5795
|
+
* in, or before each read.
|
|
5796
|
+
*
|
|
5797
|
+
* @returns `{ handle, hash }` - the handle the compliance clone may now decrypt.
|
|
5798
|
+
* @throws {@link ReceiptEventNotFoundError} when the transaction granted no ACL to the clone.
|
|
5799
|
+
*/
|
|
5800
|
+
async refreshComplianceBalance(args = {}) {
|
|
5801
|
+
const grantee = await this.complianceManager();
|
|
5802
|
+
return this.encryptedView({
|
|
5803
|
+
functionName: "refreshComplianceBalance",
|
|
5804
|
+
grantee,
|
|
5805
|
+
account: args.account
|
|
5806
|
+
});
|
|
5807
|
+
}
|
|
5574
5808
|
/**
|
|
5575
5809
|
* Read the instance's own remaining pool balance as a handle the **caller**
|
|
5576
5810
|
* can decrypt. Requires `DISCLOSURE_ADMIN_ROLE`.
|
|
5577
5811
|
*
|
|
5812
|
+
* Also re-grants the compliance-manager clone on the same handle (audit-04),
|
|
5813
|
+
* so an admin read doubles as a {@link refreshComplianceBalance}.
|
|
5814
|
+
*
|
|
5578
5815
|
* @returns `{ handle, hash }` — pass `handle` to the Zama relayer's `userDecrypt`.
|
|
5579
5816
|
* @throws {@link ReceiptEventNotFoundError} when the transaction granted no ACL to the caller.
|
|
5580
5817
|
*/
|
|
@@ -5650,11 +5887,18 @@ var AirdropBaseClient = class {
|
|
|
5650
5887
|
/**
|
|
5651
5888
|
* Grant `party` decrypt access to a handle you already hold.
|
|
5652
5889
|
*
|
|
5653
|
-
* Two gates apply on-chain: the
|
|
5654
|
-
*
|
|
5655
|
-
*
|
|
5656
|
-
*
|
|
5657
|
-
*
|
|
5890
|
+
* Two gates apply on-chain. Gate #1: the handle must be **persistently**
|
|
5891
|
+
* user-decryptable in the `(caller, instance)` context - BOTH legs, and a
|
|
5892
|
+
* transient allowance does not satisfy either (audit-06). `DISCLOSURE_ADMIN_ROLE`
|
|
5893
|
+
* bypasses gate #1 only. Gate #2: the instance must be allowed on the handle,
|
|
5894
|
+
* so an arbitrary handle from another contract cannot be laundered through
|
|
5895
|
+
* this campaign.
|
|
5896
|
+
*
|
|
5897
|
+
* **The transient case is the trap.** An `euint64` that just came back from
|
|
5898
|
+
* an FHE op carries a transient allowance, which used to be enough here and
|
|
5899
|
+
* no longer is. Handles worth disclosing come from the encrypted views on
|
|
5900
|
+
* this client, whose grants are persistent. A gate #1 failure surfaces as
|
|
5901
|
+
* `FheHandleNotAllowedError` carrying the offending handle.
|
|
5658
5902
|
*
|
|
5659
5903
|
* @param args.handle An existing `euint64` handle — a public pointer, not a value.
|
|
5660
5904
|
* @returns The transaction hash. No new handle is produced.
|
|
@@ -5788,7 +6032,7 @@ var AirdropBaseClient = class {
|
|
|
5788
6032
|
method,
|
|
5789
6033
|
contractAddress: this.address,
|
|
5790
6034
|
abi: this.abi,
|
|
5791
|
-
productMapper:
|
|
6035
|
+
productMapper: chunkYTIYTV4K_cjs.airdropProductMapper,
|
|
5792
6036
|
account: accountAddress(account),
|
|
5793
6037
|
productContext: {
|
|
5794
6038
|
creator: accountAddress(account),
|
|
@@ -5809,6 +6053,17 @@ var AirdropBaseClient = class {
|
|
|
5809
6053
|
}
|
|
5810
6054
|
return acct;
|
|
5811
6055
|
}
|
|
6056
|
+
/**
|
|
6057
|
+
* The address that will actually send the transaction, as a plain `Address`.
|
|
6058
|
+
*
|
|
6059
|
+
* Needed by any method whose arguments must be validated against the sender before
|
|
6060
|
+
* the write — on the Merkle variant the claim identity, the payout destination and
|
|
6061
|
+
* the submitter are three separate addresses with rules between them.
|
|
6062
|
+
*/
|
|
6063
|
+
resolveSender(override, method) {
|
|
6064
|
+
const wallet = this.requireWallet(method);
|
|
6065
|
+
return accountAddress(this.resolveAccount(wallet, override, method));
|
|
6066
|
+
}
|
|
5812
6067
|
};
|
|
5813
6068
|
function createAirdropBaseClient(config) {
|
|
5814
6069
|
return new AirdropBaseClient(config);
|
|
@@ -5913,11 +6168,24 @@ var EcdsaAirdropClient = class extends AirdropBaseClient {
|
|
|
5913
6168
|
* consuming either replay guard — the same input can still be claimed for
|
|
5914
6169
|
* real afterwards. No fee.
|
|
5915
6170
|
*
|
|
6171
|
+
* **It is repeatable, not unconditional** (audit-07). While the claim is
|
|
6172
|
+
* still available this may be called any number of times; once it is not,
|
|
6173
|
+
* this reverts with the same error the consuming claim would raise, in the
|
|
6174
|
+
* same order: the mode's dedup slot first (`AddressAlreadyClaimed` /
|
|
6175
|
+
* `DedupIdAlreadyClaimed`), the EIP-712 digest second (`SignatureAlreadyUsed`).
|
|
6176
|
+
* A rejected preview performs no FHE op, grants no ACL and emits nothing.
|
|
6177
|
+
*
|
|
6178
|
+
* So this is not a probe for "has this been claimed" - use
|
|
6179
|
+
* {@link isSignatureValid}, which never reverts and answers the same
|
|
6180
|
+
* question for free. Reach for this when you want the AMOUNT.
|
|
6181
|
+
*
|
|
5916
6182
|
* An encrypted view: the contract calls `FHE.allow(amount, msg.sender)`, so
|
|
5917
6183
|
* the result is recovered from the receipt's ACL `Allowed` event, never
|
|
5918
6184
|
* from a simulation. See {@link AirdropBaseClient}'s class TSDoc.
|
|
5919
6185
|
*
|
|
5920
6186
|
* @returns `{ handle, hash }` — pass `handle` to the Zama relayer's `userDecrypt`.
|
|
6187
|
+
* @throws {@link AlreadyClaimedError} when this recipient's dedup slot is consumed.
|
|
6188
|
+
* @throws {@link DedupIdConsumedError} when this `dedupId`'s slot is consumed.
|
|
5921
6189
|
*/
|
|
5922
6190
|
async getClaimAmount(args) {
|
|
5923
6191
|
return this.encryptedView({
|
|
@@ -6108,7 +6376,7 @@ async function signClaimAuthorization(args) {
|
|
|
6108
6376
|
return chunk66IHPTOK_cjs.asSignature(sig);
|
|
6109
6377
|
}
|
|
6110
6378
|
function toDeploymentModeOrdinal(mode) {
|
|
6111
|
-
return
|
|
6379
|
+
return chunkYTIYTV4K_cjs.DEPLOYMENT_MODE[mode];
|
|
6112
6380
|
}
|
|
6113
6381
|
function toContractCommonParams(common) {
|
|
6114
6382
|
return {
|
|
@@ -6117,14 +6385,15 @@ function toContractCommonParams(common) {
|
|
|
6117
6385
|
endTime: common.endTime,
|
|
6118
6386
|
canExtendClaimWindow: common.canExtendClaimWindow,
|
|
6119
6387
|
unwrappable: common.unwrappable,
|
|
6120
|
-
complianceAdmin: common.complianceAdmin
|
|
6388
|
+
complianceAdmin: common.complianceAdmin,
|
|
6389
|
+
maxAcceptedGasFee: common.maxAcceptedGasFee
|
|
6121
6390
|
};
|
|
6122
6391
|
}
|
|
6123
6392
|
function toContractEcdsaParams(params) {
|
|
6124
6393
|
return {
|
|
6125
6394
|
common: toContractCommonParams(params.common),
|
|
6126
6395
|
signer: params.signer,
|
|
6127
|
-
dedupMode:
|
|
6396
|
+
dedupMode: chunkYTIYTV4K_cjs.DEDUP_MODE[params.dedupMode]
|
|
6128
6397
|
};
|
|
6129
6398
|
}
|
|
6130
6399
|
function toContractMerkleParams(params) {
|
|
@@ -6155,9 +6424,9 @@ var ConfidentialAirdropFactoryClient = class {
|
|
|
6155
6424
|
clientLabel: "ConfidentialAirdropFactoryClient"
|
|
6156
6425
|
});
|
|
6157
6426
|
}
|
|
6158
|
-
|
|
6427
|
+
chunkYTIYTV4K_cjs.assertSupportedChain(chainId);
|
|
6159
6428
|
this.chainId = chainId;
|
|
6160
|
-
this.address = config.address ? chunkJK4XMMKM_cjs.normaliseAddress(config.address) :
|
|
6429
|
+
this.address = config.address ? chunkJK4XMMKM_cjs.normaliseAddress(config.address) : chunkPG3WXT3K_cjs.requireFheAirdropFactoryAddress(chainId);
|
|
6161
6430
|
this.#telemetry = config.telemetry;
|
|
6162
6431
|
this.#telemetry?.event("fhe-airdrop.client.init", {
|
|
6163
6432
|
surface: "factory",
|
|
@@ -6228,7 +6497,7 @@ var ConfidentialAirdropFactoryClient = class {
|
|
|
6228
6497
|
* @throws {@link InvalidArgumentError} when the root is zero and `isMerkleRootMutable` is false, or the salt was already used.
|
|
6229
6498
|
*/
|
|
6230
6499
|
async createMerkleAirdrop(args) {
|
|
6231
|
-
|
|
6500
|
+
chunkYTIYTV4K_cjs.assertMerkleModeSupported(args.mode);
|
|
6232
6501
|
return chunkVJKZWYYJ_cjs.withTelemetry(this.#telemetry, "fhe-airdrop.factory.createMerkleAirdrop", async () => {
|
|
6233
6502
|
const method = "createMerkleAirdrop";
|
|
6234
6503
|
const account = this.#senderFor(args.account, method);
|
|
@@ -6320,7 +6589,7 @@ var ConfidentialAirdropFactoryClient = class {
|
|
|
6320
6589
|
* @throws {@link MissingEncryptorError} when `amount` is given and no encryptor is resolvable.
|
|
6321
6590
|
*/
|
|
6322
6591
|
async createAndFundMerkleAirdrop(args) {
|
|
6323
|
-
|
|
6592
|
+
chunkYTIYTV4K_cjs.assertMerkleModeSupported(args.mode);
|
|
6324
6593
|
return chunkVJKZWYYJ_cjs.withTelemetry(
|
|
6325
6594
|
this.#telemetry,
|
|
6326
6595
|
"fhe-airdrop.factory.createAndFundMerkleAirdrop",
|
|
@@ -6474,11 +6743,28 @@ var ConfidentialAirdropFactoryClient = class {
|
|
|
6474
6743
|
async airdrops(offset, limit) {
|
|
6475
6744
|
return this.#read("airdrops", [offset, limit]);
|
|
6476
6745
|
}
|
|
6746
|
+
/**
|
|
6747
|
+
* Whether THIS factory created `candidate` - the genuineness check (audit-10).
|
|
6748
|
+
*
|
|
6749
|
+
* Nothing observable at an instance proves which factory, if any, deployed
|
|
6750
|
+
* it: an attacker can deploy a contract with the same ABI, the same events
|
|
6751
|
+
* and a pool it controls. The only trustworthy question is whether the
|
|
6752
|
+
* canonical factory's own registry contains the address, which is why this
|
|
6753
|
+
* read has to be addressed to a factory taken from
|
|
6754
|
+
* `src/core/addresses.ts` rather than one the instance names.
|
|
6755
|
+
*
|
|
6756
|
+
* @param candidate The address to check.
|
|
6757
|
+
* @returns True when this factory's registry contains `candidate`.
|
|
6758
|
+
*/
|
|
6759
|
+
async isAirdrop(candidate) {
|
|
6760
|
+
return this.#read("isAirdrop", [candidate]);
|
|
6761
|
+
}
|
|
6477
6762
|
/**
|
|
6478
6763
|
* The compliance-manager clone bound to an instance.
|
|
6479
6764
|
*
|
|
6480
|
-
* Doubles as a provenance check
|
|
6481
|
-
* instances it deployed, so a zero
|
|
6765
|
+
* Doubles as a provenance check, though a weaker one than {@link isAirdrop}:
|
|
6766
|
+
* the factory records this mapping only for instances it deployed, so a zero
|
|
6767
|
+
* address means the instance is not ours.
|
|
6482
6768
|
*
|
|
6483
6769
|
* @param airdrop Instance address.
|
|
6484
6770
|
* @returns The clone address, or the zero address when unknown to this factory.
|
|
@@ -6532,6 +6818,47 @@ var ConfidentialAirdropFactoryClient = class {
|
|
|
6532
6818
|
async defaultGasFee() {
|
|
6533
6819
|
return this.#read("defaultGasFee");
|
|
6534
6820
|
}
|
|
6821
|
+
/** The factory's own ceiling on every configurable fee and every create-time resolved fee. */
|
|
6822
|
+
async maxGasFee() {
|
|
6823
|
+
return this.#read("maxGasFee");
|
|
6824
|
+
}
|
|
6825
|
+
/**
|
|
6826
|
+
* Set the factory's ceiling on every fee `setDefaultGasFee`/`setCustomFee`
|
|
6827
|
+
* may configure, and on the fee resolved at create.
|
|
6828
|
+
*
|
|
6829
|
+
* Requires `DEFAULT_ADMIN_ROLE`, deliberately not `FEE_MANAGER_ROLE`: the fee
|
|
6830
|
+
* manager moves fees only within a bound the admin controls. `0n` admits a
|
|
6831
|
+
* zero fee and nothing else.
|
|
6832
|
+
*
|
|
6833
|
+
* Lowering it below an already-configured fee does not rewrite that fee - the
|
|
6834
|
+
* stale value stays in storage and reverts `GasFeeExceedsMaximum` at the next
|
|
6835
|
+
* create until it is lowered too.
|
|
6836
|
+
*
|
|
6837
|
+
* @throws {@link InvalidArgumentError} when `maxGasFee` is below a currently configured fee (`GasFeeExceedsMaximum`).
|
|
6838
|
+
*/
|
|
6839
|
+
async setMaxGasFee(maxGasFee, account) {
|
|
6840
|
+
return this.#write("setMaxGasFee", [maxGasFee], account, "setMaxGasFee");
|
|
6841
|
+
}
|
|
6842
|
+
/**
|
|
6843
|
+
* The per-claim fee a `create*` from `creator` would freeze into the new
|
|
6844
|
+
* instance right now: their {@link getCustomFee} override when enabled, else
|
|
6845
|
+
* {@link defaultGasFee}.
|
|
6846
|
+
*
|
|
6847
|
+
* This is the number `CommonAirdropParams.maxAcceptedGasFee` is checked
|
|
6848
|
+
* against, so it is also what to show a creator before they choose a bound.
|
|
6849
|
+
* It is a snapshot, not a quote: `FEE_MANAGER_ROLE` can move it between this
|
|
6850
|
+
* read and the create, which is exactly what the bound exists to catch.
|
|
6851
|
+
*
|
|
6852
|
+
* @param creator The account that will send `create*`.
|
|
6853
|
+
* @returns The resolved fee in wei.
|
|
6854
|
+
*/
|
|
6855
|
+
async resolveGasFee(creator) {
|
|
6856
|
+
const [custom, fallback] = await Promise.all([
|
|
6857
|
+
this.getCustomFee(creator),
|
|
6858
|
+
this.defaultGasFee()
|
|
6859
|
+
]);
|
|
6860
|
+
return custom.enabled ? custom.gasFee : fallback;
|
|
6861
|
+
}
|
|
6535
6862
|
// ----------------------- implementation admin -----------------------
|
|
6536
6863
|
/**
|
|
6537
6864
|
* Point future `createEcdsaAirdrop*` calls at a new ECDSA implementation.
|
|
@@ -6796,17 +7123,15 @@ var ConfidentialAirdropFactoryClient = class {
|
|
|
6796
7123
|
/**
|
|
6797
7124
|
* Revoke `role` from `holder`. Requires the role's admin role.
|
|
6798
7125
|
*
|
|
6799
|
-
*
|
|
6800
|
-
*
|
|
6801
|
-
*
|
|
6802
|
-
*
|
|
6803
|
-
*
|
|
6804
|
-
*
|
|
6805
|
-
*
|
|
6806
|
-
*
|
|
6807
|
-
*
|
|
6808
|
-
* that moment, with no way to rotate or remove them. Grant the successor
|
|
6809
|
-
* first.
|
|
7126
|
+
* **The factory floors `DEFAULT_ADMIN_ROLE` at one live member** (audit-14),
|
|
7127
|
+
* matching the instances. Renouncing or revoking the sole holder reverts
|
|
7128
|
+
* `LastAdmin`, and granting the role to the zero address reverts
|
|
7129
|
+
* `ZeroAdminGrant`, so the set can neither be emptied nor satisfied by a
|
|
7130
|
+
* member nobody controls. Before audit-14 this succeeded and froze role
|
|
7131
|
+
* administration permanently; it no longer does.
|
|
7132
|
+
*
|
|
7133
|
+
* A handover is still available and is the supported way out: grant the
|
|
7134
|
+
* successor first, then renounce.
|
|
6810
7135
|
*
|
|
6811
7136
|
* @returns The transaction hash.
|
|
6812
7137
|
*/
|
|
@@ -6878,11 +7203,15 @@ var ConfidentialAirdropFactoryClient = class {
|
|
|
6878
7203
|
/**
|
|
6879
7204
|
* The create-time guardrails that need a read, run before anything is sent.
|
|
6880
7205
|
*
|
|
6881
|
-
*
|
|
7206
|
+
* Three checks, in the order a failure is cheapest to discover:
|
|
6882
7207
|
*
|
|
6883
|
-
* 1. **
|
|
7208
|
+
* 1. **Accepted gas fee.** The fee is frozen into the instance at
|
|
7209
|
+
* initialization and immutable after, so a bound that no longer holds must
|
|
7210
|
+
* stop the transaction before anything else is spent on it (see
|
|
7211
|
+
* {@link GasFeeNotAcceptedError}).
|
|
7212
|
+
* 2. **Stock wrapper.** Only when `unwrappable` is requested; one
|
|
6884
7213
|
* `underlying()` probe (see {@link NonStockWrapperError}).
|
|
6885
|
-
*
|
|
7214
|
+
* 3. **Salt collision.** A predicted address commits to `(implementation,
|
|
6886
7215
|
* mode, deployer, userSalt)` and ignores the params struct entirely, so
|
|
6887
7216
|
* two campaigns differing only in token, window, signer or root still
|
|
6888
7217
|
* land on one address. The prediction plus one `eth_getCode` turns that
|
|
@@ -6893,7 +7222,13 @@ var ConfidentialAirdropFactoryClient = class {
|
|
|
6893
7222
|
*/
|
|
6894
7223
|
async #guardCreate(input) {
|
|
6895
7224
|
const { variant, args, deployer, method } = input;
|
|
6896
|
-
await
|
|
7225
|
+
await chunkYTIYTV4K_cjs.assertGasFeeAccepted({
|
|
7226
|
+
factory: this,
|
|
7227
|
+
creator: deployer,
|
|
7228
|
+
maxAcceptedGasFee: args.params.common.maxAcceptedGasFee,
|
|
7229
|
+
method
|
|
7230
|
+
});
|
|
7231
|
+
await chunkYTIYTV4K_cjs.assertStockWrapper({
|
|
6897
7232
|
publicClient: this.publicClient,
|
|
6898
7233
|
token: args.params.common.token,
|
|
6899
7234
|
unwrappable: args.params.common.unwrappable
|
|
@@ -6906,7 +7241,7 @@ var ConfidentialAirdropFactoryClient = class {
|
|
|
6906
7241
|
params: args.params,
|
|
6907
7242
|
...predictArgs
|
|
6908
7243
|
});
|
|
6909
|
-
await
|
|
7244
|
+
await chunkYTIYTV4K_cjs.assertSaltAvailable({
|
|
6910
7245
|
publicClient: this.publicClient,
|
|
6911
7246
|
predictedAddress,
|
|
6912
7247
|
variant,
|
|
@@ -7009,7 +7344,7 @@ var ConfidentialAirdropFactoryClient = class {
|
|
|
7009
7344
|
method,
|
|
7010
7345
|
contractAddress: this.address,
|
|
7011
7346
|
abi: airdropFactoryAbi,
|
|
7012
|
-
productMapper:
|
|
7347
|
+
productMapper: chunkYTIYTV4K_cjs.airdropProductMapper,
|
|
7013
7348
|
account: accountAddress2(account),
|
|
7014
7349
|
// `UpgradeabilityNotAllowed` and `ZamaProtocolUnsupported` carry no args
|
|
7015
7350
|
// on-chain; the mapper can only name the creator and chain if we forward
|
|
@@ -7332,22 +7667,6 @@ var merkleConfidentialAirdropAbi = [
|
|
|
7332
7667
|
name: "SafeERC20FailedOperation",
|
|
7333
7668
|
type: "error"
|
|
7334
7669
|
},
|
|
7335
|
-
{
|
|
7336
|
-
inputs: [
|
|
7337
|
-
{
|
|
7338
|
-
internalType: "bytes32",
|
|
7339
|
-
name: "handle",
|
|
7340
|
-
type: "bytes32"
|
|
7341
|
-
},
|
|
7342
|
-
{
|
|
7343
|
-
internalType: "address",
|
|
7344
|
-
name: "sender",
|
|
7345
|
-
type: "address"
|
|
7346
|
-
}
|
|
7347
|
-
],
|
|
7348
|
-
name: "SenderNotAllowedToUseHandle",
|
|
7349
|
-
type: "error"
|
|
7350
|
-
},
|
|
7351
7670
|
{
|
|
7352
7671
|
inputs: [],
|
|
7353
7672
|
name: "TokenNotAWrapper",
|
|
@@ -7374,11 +7693,32 @@ var merkleConfidentialAirdropAbi = [
|
|
|
7374
7693
|
name: "UUPSUnsupportedProxiableUUID",
|
|
7375
7694
|
type: "error"
|
|
7376
7695
|
},
|
|
7696
|
+
{
|
|
7697
|
+
inputs: [
|
|
7698
|
+
{
|
|
7699
|
+
internalType: "address",
|
|
7700
|
+
name: "account",
|
|
7701
|
+
type: "address"
|
|
7702
|
+
},
|
|
7703
|
+
{
|
|
7704
|
+
internalType: "address",
|
|
7705
|
+
name: "to",
|
|
7706
|
+
type: "address"
|
|
7707
|
+
}
|
|
7708
|
+
],
|
|
7709
|
+
name: "UnauthorizedRedirect",
|
|
7710
|
+
type: "error"
|
|
7711
|
+
},
|
|
7377
7712
|
{
|
|
7378
7713
|
inputs: [],
|
|
7379
7714
|
name: "ZamaProtocolUnsupported",
|
|
7380
7715
|
type: "error"
|
|
7381
7716
|
},
|
|
7717
|
+
{
|
|
7718
|
+
inputs: [],
|
|
7719
|
+
name: "ZeroAccount",
|
|
7720
|
+
type: "error"
|
|
7721
|
+
},
|
|
7382
7722
|
{
|
|
7383
7723
|
inputs: [],
|
|
7384
7724
|
name: "ZeroAdminGrant",
|
|
@@ -7419,6 +7759,11 @@ var merkleConfidentialAirdropAbi = [
|
|
|
7419
7759
|
name: "ZeroToken",
|
|
7420
7760
|
type: "error"
|
|
7421
7761
|
},
|
|
7762
|
+
{
|
|
7763
|
+
inputs: [],
|
|
7764
|
+
name: "ZeroUnwrapRequestId",
|
|
7765
|
+
type: "error"
|
|
7766
|
+
},
|
|
7422
7767
|
{
|
|
7423
7768
|
anonymous: false,
|
|
7424
7769
|
inputs: [
|
|
@@ -7451,6 +7796,12 @@ var merkleConfidentialAirdropAbi = [
|
|
|
7451
7796
|
internalType: "uint256",
|
|
7452
7797
|
name: "deploymentBlockNumber",
|
|
7453
7798
|
type: "uint256"
|
|
7799
|
+
},
|
|
7800
|
+
{
|
|
7801
|
+
indexed: false,
|
|
7802
|
+
internalType: "uint256",
|
|
7803
|
+
name: "gasFee",
|
|
7804
|
+
type: "uint256"
|
|
7454
7805
|
}
|
|
7455
7806
|
],
|
|
7456
7807
|
name: "AirdropInitialized",
|
|
@@ -8000,11 +8351,16 @@ var merkleConfidentialAirdropAbi = [
|
|
|
8000
8351
|
inputs: [
|
|
8001
8352
|
{
|
|
8002
8353
|
internalType: "address",
|
|
8003
|
-
name: "
|
|
8354
|
+
name: "account",
|
|
8004
8355
|
type: "address"
|
|
8005
8356
|
},
|
|
8006
8357
|
{
|
|
8007
|
-
internalType: "
|
|
8358
|
+
internalType: "address",
|
|
8359
|
+
name: "to",
|
|
8360
|
+
type: "address"
|
|
8361
|
+
},
|
|
8362
|
+
{
|
|
8363
|
+
internalType: "externalEuint64",
|
|
8008
8364
|
name: "inputAmount",
|
|
8009
8365
|
type: "bytes32"
|
|
8010
8366
|
},
|
|
@@ -8124,6 +8480,11 @@ var merkleConfidentialAirdropAbi = [
|
|
|
8124
8480
|
},
|
|
8125
8481
|
{
|
|
8126
8482
|
inputs: [
|
|
8483
|
+
{
|
|
8484
|
+
internalType: "address",
|
|
8485
|
+
name: "account",
|
|
8486
|
+
type: "address"
|
|
8487
|
+
},
|
|
8127
8488
|
{
|
|
8128
8489
|
internalType: "externalEuint64",
|
|
8129
8490
|
name: "inputAmount",
|
|
@@ -8468,6 +8829,19 @@ var merkleConfidentialAirdropAbi = [
|
|
|
8468
8829
|
stateMutability: "view",
|
|
8469
8830
|
type: "function"
|
|
8470
8831
|
},
|
|
8832
|
+
{
|
|
8833
|
+
inputs: [],
|
|
8834
|
+
name: "refreshComplianceBalance",
|
|
8835
|
+
outputs: [
|
|
8836
|
+
{
|
|
8837
|
+
internalType: "euint64",
|
|
8838
|
+
name: "balance",
|
|
8839
|
+
type: "bytes32"
|
|
8840
|
+
}
|
|
8841
|
+
],
|
|
8842
|
+
stateMutability: "nonpayable",
|
|
8843
|
+
type: "function"
|
|
8844
|
+
},
|
|
8471
8845
|
{
|
|
8472
8846
|
inputs: [
|
|
8473
8847
|
{
|
|
@@ -8676,8 +9050,8 @@ var MerkleAirdropClient = class extends AirdropBaseClient {
|
|
|
8676
9050
|
// CLAIM
|
|
8677
9051
|
// ============================================================
|
|
8678
9052
|
/**
|
|
8679
|
-
* Claim the outstanding amount for a proof-bearing entry, delivering the
|
|
8680
|
-
*
|
|
9053
|
+
* Claim the outstanding amount for a proof-bearing entry, delivering the tokens to
|
|
9054
|
+
* `to` — which defaults to `entry.account`, the CLAIM IDENTITY, not the sender.
|
|
8681
9055
|
*
|
|
8682
9056
|
* Requires `msg.value == gasFee()` exactly — handled for you; see the
|
|
8683
9057
|
* class TSDoc.
|
|
@@ -8694,16 +9068,31 @@ var MerkleAirdropClient = class extends AirdropBaseClient {
|
|
|
8694
9068
|
*
|
|
8695
9069
|
* @throws {@link ClaimNotStartedError} before `startTime`.
|
|
8696
9070
|
* @throws {@link ClaimWindowClosedError} after `endTime`.
|
|
8697
|
-
* @throws {@link InvalidArgumentError} (`argument: "
|
|
8698
|
-
*
|
|
9071
|
+
* @throws {@link InvalidArgumentError} (`argument: "entry.boundTo"`) when the entry's proof is bound to
|
|
9072
|
+
* another address, or (`argument: "merkleProof"`) when the proof does not verify against the current root.
|
|
9073
|
+
* @throws {@link UnauthorizedRedirectError} when a third-party submitter passes a `to` other than `entry.account`.
|
|
8699
9074
|
* @returns The transaction hash.
|
|
8700
9075
|
*/
|
|
8701
9076
|
async claim(args) {
|
|
8702
9077
|
return chunkVJKZWYYJ_cjs.withTelemetry(this.telemetry, `${this.spanPrefix}.claim`, async () => {
|
|
9078
|
+
const submitter = this.resolveSender(args.account, "claim");
|
|
9079
|
+
chunkYTIYTV4K_cjs.assertMerkleClaimIdentity({
|
|
9080
|
+
method: "claim",
|
|
9081
|
+
account: args.entry.account,
|
|
9082
|
+
boundTo: args.entry.boundTo,
|
|
9083
|
+
submitter,
|
|
9084
|
+
to: args.to
|
|
9085
|
+
});
|
|
8703
9086
|
const fee = await this.gasFee();
|
|
8704
9087
|
return this.write(
|
|
8705
9088
|
"claim",
|
|
8706
|
-
[
|
|
9089
|
+
[
|
|
9090
|
+
args.entry.account,
|
|
9091
|
+
args.to ?? viem.zeroAddress,
|
|
9092
|
+
args.entry.handle,
|
|
9093
|
+
args.entry.inputProof,
|
|
9094
|
+
args.entry.merkleProof
|
|
9095
|
+
],
|
|
8707
9096
|
args.account,
|
|
8708
9097
|
"claim",
|
|
8709
9098
|
fee
|
|
@@ -8719,12 +9108,29 @@ var MerkleAirdropClient = class extends AirdropBaseClient {
|
|
|
8719
9108
|
* Same replay/accounting semantics and `msg.value == gasFee()` requirement
|
|
8720
9109
|
* as {@link claim} — see its `@remarks`.
|
|
8721
9110
|
*
|
|
9111
|
+
* @remarks
|
|
9112
|
+
* **Self-only by design.** This entrypoint takes no claim identity: releasing an
|
|
9113
|
+
* allocation as a public ERC-20 transfer publishes the amount irreversibly, which is
|
|
9114
|
+
* the recipient's own choice to make. A relayed unwrap is therefore unrepresentable
|
|
9115
|
+
* rather than merely rejected, and an entry whose `account` is not the sender is
|
|
9116
|
+
* refused before the write. A third party can still submit a confidential
|
|
9117
|
+
* {@link claim}.
|
|
9118
|
+
*
|
|
8722
9119
|
* @returns The transaction hash. The underlying ERC-20 is released later by
|
|
8723
9120
|
* a separate, permissionless `finalizeUnwrap` — this hash is only the
|
|
8724
9121
|
* unwrap request.
|
|
8725
9122
|
*/
|
|
8726
9123
|
async claimAndUnwrap(args) {
|
|
8727
9124
|
return chunkVJKZWYYJ_cjs.withTelemetry(this.telemetry, `${this.spanPrefix}.claimAndUnwrap`, async () => {
|
|
9125
|
+
const submitter = this.resolveSender(args.account, "claimAndUnwrap");
|
|
9126
|
+
chunkYTIYTV4K_cjs.assertMerkleClaimIdentity({
|
|
9127
|
+
method: "claimAndUnwrap",
|
|
9128
|
+
account: args.entry.account,
|
|
9129
|
+
boundTo: args.entry.boundTo,
|
|
9130
|
+
submitter,
|
|
9131
|
+
to: args.to,
|
|
9132
|
+
entrypoint: "claimAndUnwrap"
|
|
9133
|
+
});
|
|
8728
9134
|
const fee = await this.gasFee();
|
|
8729
9135
|
return this.write(
|
|
8730
9136
|
"claimAndUnwrap",
|
|
@@ -8740,16 +9146,32 @@ var MerkleAirdropClient = class extends AirdropBaseClient {
|
|
|
8740
9146
|
* caller can decrypt. Consumes no accounting and no per-leaf state — the
|
|
8741
9147
|
* same entry still pays the same amount after a preview. No fee.
|
|
8742
9148
|
*
|
|
8743
|
-
*
|
|
8744
|
-
*
|
|
8745
|
-
*
|
|
9149
|
+
* **Submits a transaction.** The contract calls `FHE.allow(outstanding, account)`, so
|
|
9150
|
+
* the result is recovered from the receipt's ACL `Allowed` event, never from a
|
|
9151
|
+
* simulation. See {@link AirdropBaseClient}'s class TSDoc.
|
|
8746
9152
|
*
|
|
8747
|
-
*
|
|
9153
|
+
* **`entry.account` is the decryptable party, not the caller.** A relayer previewing on
|
|
9154
|
+
* someone's behalf gets a valid handle it cannot read — that is the contract's intent,
|
|
9155
|
+
* and it is what makes a blind relayed submission possible.
|
|
9156
|
+
*
|
|
9157
|
+
* @returns `{ handle, hash }` — pass `handle` to the Zama relayer's `userDecrypt`, as `entry.account`.
|
|
8748
9158
|
*/
|
|
8749
9159
|
async getClaimAmount(args) {
|
|
9160
|
+
const submitter = this.resolveSender(args.account, "getClaimAmount");
|
|
9161
|
+
chunkYTIYTV4K_cjs.assertMerkleClaimIdentity({
|
|
9162
|
+
method: "getClaimAmount",
|
|
9163
|
+
account: args.entry.account,
|
|
9164
|
+
boundTo: args.entry.boundTo,
|
|
9165
|
+
submitter
|
|
9166
|
+
});
|
|
8750
9167
|
return this.encryptedView({
|
|
8751
9168
|
functionName: "getClaimAmount",
|
|
8752
|
-
args: [args.entry.handle, args.entry.inputProof, args.entry.merkleProof],
|
|
9169
|
+
args: [args.entry.account, args.entry.handle, args.entry.inputProof, args.entry.merkleProof],
|
|
9170
|
+
// The contract grants the outstanding handle to `account`, never to the caller
|
|
9171
|
+
// (`_outstandingOf(account, account, …)`), so the receipt's ACL `Allowed` event
|
|
9172
|
+
// names the account. Defaulting to the sender would fail extraction on any
|
|
9173
|
+
// relayed preview — after the transaction had already been mined.
|
|
9174
|
+
grantee: args.entry.account,
|
|
8753
9175
|
account: args.account
|
|
8754
9176
|
});
|
|
8755
9177
|
}
|
|
@@ -8772,10 +9194,15 @@ var MerkleAirdropClient = class extends AirdropBaseClient {
|
|
|
8772
9194
|
* leaves for the same recipient, claiming both pays the higher of the
|
|
8773
9195
|
* two totals net of this running value — `max`, not `sum`.
|
|
8774
9196
|
*
|
|
8775
|
-
*
|
|
8776
|
-
*
|
|
9197
|
+
* **An account that has never claimed returns the ZERO handle, which cannot be
|
|
9198
|
+
* decrypted.** It is an uninitialized ciphertext, so nobody holds an ACL on it and
|
|
9199
|
+
* the relayer rejects it with "not authorized to user decrypt handle 0x0…0" rather
|
|
9200
|
+
* than answering zero. Treat `handle === zeroHash` as "nothing delivered yet" and
|
|
9201
|
+
* skip the decrypt; only call `userDecrypt` on a non-zero handle. (A mock FHEVM
|
|
9202
|
+
* instance does answer zero here, so this only bites against a live relayer.)
|
|
8777
9203
|
*
|
|
8778
|
-
* @returns The account's cumulative delivered total
|
|
9204
|
+
* @returns The account's cumulative delivered total as an encrypted handle, or the
|
|
9205
|
+
* zero handle if it has never claimed.
|
|
8779
9206
|
*/
|
|
8780
9207
|
async getClaimedAmount(account) {
|
|
8781
9208
|
const handle = await this.read("getClaimedAmount", [account]);
|
|
@@ -8822,9 +9249,925 @@ function createMerkleAirdropClient(config) {
|
|
|
8822
9249
|
return new MerkleAirdropClient(config);
|
|
8823
9250
|
}
|
|
8824
9251
|
|
|
9252
|
+
// src/fhe-airdrop/abis/compliance.ts
|
|
9253
|
+
var complianceRoleManagerAbi = [
|
|
9254
|
+
{
|
|
9255
|
+
inputs: [],
|
|
9256
|
+
stateMutability: "nonpayable",
|
|
9257
|
+
type: "constructor"
|
|
9258
|
+
},
|
|
9259
|
+
{
|
|
9260
|
+
inputs: [],
|
|
9261
|
+
name: "AccessControlBadConfirmation",
|
|
9262
|
+
type: "error"
|
|
9263
|
+
},
|
|
9264
|
+
{
|
|
9265
|
+
inputs: [
|
|
9266
|
+
{
|
|
9267
|
+
internalType: "address",
|
|
9268
|
+
name: "account",
|
|
9269
|
+
type: "address"
|
|
9270
|
+
},
|
|
9271
|
+
{
|
|
9272
|
+
internalType: "bytes32",
|
|
9273
|
+
name: "neededRole",
|
|
9274
|
+
type: "bytes32"
|
|
9275
|
+
}
|
|
9276
|
+
],
|
|
9277
|
+
name: "AccessControlUnauthorizedAccount",
|
|
9278
|
+
type: "error"
|
|
9279
|
+
},
|
|
9280
|
+
{
|
|
9281
|
+
inputs: [
|
|
9282
|
+
{
|
|
9283
|
+
internalType: "address",
|
|
9284
|
+
name: "airdrop",
|
|
9285
|
+
type: "address"
|
|
9286
|
+
}
|
|
9287
|
+
],
|
|
9288
|
+
name: "AirdropAndManagerAreSameAddress",
|
|
9289
|
+
type: "error"
|
|
9290
|
+
},
|
|
9291
|
+
{
|
|
9292
|
+
inputs: [],
|
|
9293
|
+
name: "CannotManageComplianceDelegate",
|
|
9294
|
+
type: "error"
|
|
9295
|
+
},
|
|
9296
|
+
{
|
|
9297
|
+
inputs: [],
|
|
9298
|
+
name: "DelegateAlreadyAdded",
|
|
9299
|
+
type: "error"
|
|
9300
|
+
},
|
|
9301
|
+
{
|
|
9302
|
+
inputs: [
|
|
9303
|
+
{
|
|
9304
|
+
internalType: "address",
|
|
9305
|
+
name: "delegate",
|
|
9306
|
+
type: "address"
|
|
9307
|
+
}
|
|
9308
|
+
],
|
|
9309
|
+
name: "DelegateAndAirdropAreSameAddress",
|
|
9310
|
+
type: "error"
|
|
9311
|
+
},
|
|
9312
|
+
{
|
|
9313
|
+
inputs: [
|
|
9314
|
+
{
|
|
9315
|
+
internalType: "address",
|
|
9316
|
+
name: "delegate",
|
|
9317
|
+
type: "address"
|
|
9318
|
+
}
|
|
9319
|
+
],
|
|
9320
|
+
name: "DelegateAndManagerAreSameAddress",
|
|
9321
|
+
type: "error"
|
|
9322
|
+
},
|
|
9323
|
+
{
|
|
9324
|
+
inputs: [],
|
|
9325
|
+
name: "DelegateNotFound",
|
|
9326
|
+
type: "error"
|
|
9327
|
+
},
|
|
9328
|
+
{
|
|
9329
|
+
inputs: [],
|
|
9330
|
+
name: "InvalidInitialization",
|
|
9331
|
+
type: "error"
|
|
9332
|
+
},
|
|
9333
|
+
{
|
|
9334
|
+
inputs: [],
|
|
9335
|
+
name: "NotInitializing",
|
|
9336
|
+
type: "error"
|
|
9337
|
+
},
|
|
9338
|
+
{
|
|
9339
|
+
inputs: [],
|
|
9340
|
+
name: "ZamaProtocolUnsupported",
|
|
9341
|
+
type: "error"
|
|
9342
|
+
},
|
|
9343
|
+
{
|
|
9344
|
+
inputs: [],
|
|
9345
|
+
name: "ZeroAirdrop",
|
|
9346
|
+
type: "error"
|
|
9347
|
+
},
|
|
9348
|
+
{
|
|
9349
|
+
inputs: [],
|
|
9350
|
+
name: "ZeroClientAdmin",
|
|
9351
|
+
type: "error"
|
|
9352
|
+
},
|
|
9353
|
+
{
|
|
9354
|
+
inputs: [],
|
|
9355
|
+
name: "ZeroDelegate",
|
|
9356
|
+
type: "error"
|
|
9357
|
+
},
|
|
9358
|
+
{
|
|
9359
|
+
anonymous: false,
|
|
9360
|
+
inputs: [
|
|
9361
|
+
{
|
|
9362
|
+
indexed: true,
|
|
9363
|
+
internalType: "address",
|
|
9364
|
+
name: "delegate",
|
|
9365
|
+
type: "address"
|
|
9366
|
+
}
|
|
9367
|
+
],
|
|
9368
|
+
name: "ClientDelegateAdded",
|
|
9369
|
+
type: "event"
|
|
9370
|
+
},
|
|
9371
|
+
{
|
|
9372
|
+
anonymous: false,
|
|
9373
|
+
inputs: [
|
|
9374
|
+
{
|
|
9375
|
+
indexed: true,
|
|
9376
|
+
internalType: "address",
|
|
9377
|
+
name: "delegate",
|
|
9378
|
+
type: "address"
|
|
9379
|
+
}
|
|
9380
|
+
],
|
|
9381
|
+
name: "ClientDelegateRevoked",
|
|
9382
|
+
type: "event"
|
|
9383
|
+
},
|
|
9384
|
+
{
|
|
9385
|
+
anonymous: false,
|
|
9386
|
+
inputs: [
|
|
9387
|
+
{
|
|
9388
|
+
indexed: true,
|
|
9389
|
+
internalType: "address",
|
|
9390
|
+
name: "delegate",
|
|
9391
|
+
type: "address"
|
|
9392
|
+
}
|
|
9393
|
+
],
|
|
9394
|
+
name: "ComplianceDelegateSet",
|
|
9395
|
+
type: "event"
|
|
9396
|
+
},
|
|
9397
|
+
{
|
|
9398
|
+
anonymous: false,
|
|
9399
|
+
inputs: [
|
|
9400
|
+
{
|
|
9401
|
+
indexed: false,
|
|
9402
|
+
internalType: "uint64",
|
|
9403
|
+
name: "version",
|
|
9404
|
+
type: "uint64"
|
|
9405
|
+
}
|
|
9406
|
+
],
|
|
9407
|
+
name: "Initialized",
|
|
9408
|
+
type: "event"
|
|
9409
|
+
},
|
|
9410
|
+
{
|
|
9411
|
+
anonymous: false,
|
|
9412
|
+
inputs: [
|
|
9413
|
+
{
|
|
9414
|
+
indexed: true,
|
|
9415
|
+
internalType: "bytes32",
|
|
9416
|
+
name: "role",
|
|
9417
|
+
type: "bytes32"
|
|
9418
|
+
},
|
|
9419
|
+
{
|
|
9420
|
+
indexed: true,
|
|
9421
|
+
internalType: "bytes32",
|
|
9422
|
+
name: "previousAdminRole",
|
|
9423
|
+
type: "bytes32"
|
|
9424
|
+
},
|
|
9425
|
+
{
|
|
9426
|
+
indexed: true,
|
|
9427
|
+
internalType: "bytes32",
|
|
9428
|
+
name: "newAdminRole",
|
|
9429
|
+
type: "bytes32"
|
|
9430
|
+
}
|
|
9431
|
+
],
|
|
9432
|
+
name: "RoleAdminChanged",
|
|
9433
|
+
type: "event"
|
|
9434
|
+
},
|
|
9435
|
+
{
|
|
9436
|
+
anonymous: false,
|
|
9437
|
+
inputs: [
|
|
9438
|
+
{
|
|
9439
|
+
indexed: true,
|
|
9440
|
+
internalType: "bytes32",
|
|
9441
|
+
name: "role",
|
|
9442
|
+
type: "bytes32"
|
|
9443
|
+
},
|
|
9444
|
+
{
|
|
9445
|
+
indexed: true,
|
|
9446
|
+
internalType: "address",
|
|
9447
|
+
name: "account",
|
|
9448
|
+
type: "address"
|
|
9449
|
+
},
|
|
9450
|
+
{
|
|
9451
|
+
indexed: true,
|
|
9452
|
+
internalType: "address",
|
|
9453
|
+
name: "sender",
|
|
9454
|
+
type: "address"
|
|
9455
|
+
}
|
|
9456
|
+
],
|
|
9457
|
+
name: "RoleGranted",
|
|
9458
|
+
type: "event"
|
|
9459
|
+
},
|
|
9460
|
+
{
|
|
9461
|
+
anonymous: false,
|
|
9462
|
+
inputs: [
|
|
9463
|
+
{
|
|
9464
|
+
indexed: true,
|
|
9465
|
+
internalType: "bytes32",
|
|
9466
|
+
name: "role",
|
|
9467
|
+
type: "bytes32"
|
|
9468
|
+
},
|
|
9469
|
+
{
|
|
9470
|
+
indexed: true,
|
|
9471
|
+
internalType: "address",
|
|
9472
|
+
name: "account",
|
|
9473
|
+
type: "address"
|
|
9474
|
+
},
|
|
9475
|
+
{
|
|
9476
|
+
indexed: true,
|
|
9477
|
+
internalType: "address",
|
|
9478
|
+
name: "sender",
|
|
9479
|
+
type: "address"
|
|
9480
|
+
}
|
|
9481
|
+
],
|
|
9482
|
+
name: "RoleRevoked",
|
|
9483
|
+
type: "event"
|
|
9484
|
+
},
|
|
9485
|
+
{
|
|
9486
|
+
inputs: [],
|
|
9487
|
+
name: "DEFAULT_ADMIN_ROLE",
|
|
9488
|
+
outputs: [
|
|
9489
|
+
{
|
|
9490
|
+
internalType: "bytes32",
|
|
9491
|
+
name: "",
|
|
9492
|
+
type: "bytes32"
|
|
9493
|
+
}
|
|
9494
|
+
],
|
|
9495
|
+
stateMutability: "view",
|
|
9496
|
+
type: "function"
|
|
9497
|
+
},
|
|
9498
|
+
{
|
|
9499
|
+
inputs: [],
|
|
9500
|
+
name: "DELEGATION_ADMIN_ROLE",
|
|
9501
|
+
outputs: [
|
|
9502
|
+
{
|
|
9503
|
+
internalType: "bytes32",
|
|
9504
|
+
name: "",
|
|
9505
|
+
type: "bytes32"
|
|
9506
|
+
}
|
|
9507
|
+
],
|
|
9508
|
+
stateMutability: "view",
|
|
9509
|
+
type: "function"
|
|
9510
|
+
},
|
|
9511
|
+
{
|
|
9512
|
+
inputs: [
|
|
9513
|
+
{
|
|
9514
|
+
internalType: "address",
|
|
9515
|
+
name: "delegate",
|
|
9516
|
+
type: "address"
|
|
9517
|
+
}
|
|
9518
|
+
],
|
|
9519
|
+
name: "addDelegate",
|
|
9520
|
+
outputs: [],
|
|
9521
|
+
stateMutability: "nonpayable",
|
|
9522
|
+
type: "function"
|
|
9523
|
+
},
|
|
9524
|
+
{
|
|
9525
|
+
inputs: [],
|
|
9526
|
+
name: "airdrop",
|
|
9527
|
+
outputs: [
|
|
9528
|
+
{
|
|
9529
|
+
internalType: "address",
|
|
9530
|
+
name: "",
|
|
9531
|
+
type: "address"
|
|
9532
|
+
}
|
|
9533
|
+
],
|
|
9534
|
+
stateMutability: "view",
|
|
9535
|
+
type: "function"
|
|
9536
|
+
},
|
|
9537
|
+
{
|
|
9538
|
+
inputs: [],
|
|
9539
|
+
name: "clientDelegates",
|
|
9540
|
+
outputs: [
|
|
9541
|
+
{
|
|
9542
|
+
internalType: "address[]",
|
|
9543
|
+
name: "",
|
|
9544
|
+
type: "address[]"
|
|
9545
|
+
}
|
|
9546
|
+
],
|
|
9547
|
+
stateMutability: "view",
|
|
9548
|
+
type: "function"
|
|
9549
|
+
},
|
|
9550
|
+
{
|
|
9551
|
+
inputs: [],
|
|
9552
|
+
name: "complianceDelegate",
|
|
9553
|
+
outputs: [
|
|
9554
|
+
{
|
|
9555
|
+
internalType: "address",
|
|
9556
|
+
name: "",
|
|
9557
|
+
type: "address"
|
|
9558
|
+
}
|
|
9559
|
+
],
|
|
9560
|
+
stateMutability: "view",
|
|
9561
|
+
type: "function"
|
|
9562
|
+
},
|
|
9563
|
+
{
|
|
9564
|
+
inputs: [
|
|
9565
|
+
{
|
|
9566
|
+
internalType: "bytes32",
|
|
9567
|
+
name: "role",
|
|
9568
|
+
type: "bytes32"
|
|
9569
|
+
}
|
|
9570
|
+
],
|
|
9571
|
+
name: "getRoleAdmin",
|
|
9572
|
+
outputs: [
|
|
9573
|
+
{
|
|
9574
|
+
internalType: "bytes32",
|
|
9575
|
+
name: "",
|
|
9576
|
+
type: "bytes32"
|
|
9577
|
+
}
|
|
9578
|
+
],
|
|
9579
|
+
stateMutability: "view",
|
|
9580
|
+
type: "function"
|
|
9581
|
+
},
|
|
9582
|
+
{
|
|
9583
|
+
inputs: [
|
|
9584
|
+
{
|
|
9585
|
+
internalType: "bytes32",
|
|
9586
|
+
name: "role",
|
|
9587
|
+
type: "bytes32"
|
|
9588
|
+
},
|
|
9589
|
+
{
|
|
9590
|
+
internalType: "uint256",
|
|
9591
|
+
name: "index",
|
|
9592
|
+
type: "uint256"
|
|
9593
|
+
}
|
|
9594
|
+
],
|
|
9595
|
+
name: "getRoleMember",
|
|
9596
|
+
outputs: [
|
|
9597
|
+
{
|
|
9598
|
+
internalType: "address",
|
|
9599
|
+
name: "",
|
|
9600
|
+
type: "address"
|
|
9601
|
+
}
|
|
9602
|
+
],
|
|
9603
|
+
stateMutability: "view",
|
|
9604
|
+
type: "function"
|
|
9605
|
+
},
|
|
9606
|
+
{
|
|
9607
|
+
inputs: [
|
|
9608
|
+
{
|
|
9609
|
+
internalType: "bytes32",
|
|
9610
|
+
name: "role",
|
|
9611
|
+
type: "bytes32"
|
|
9612
|
+
}
|
|
9613
|
+
],
|
|
9614
|
+
name: "getRoleMemberCount",
|
|
9615
|
+
outputs: [
|
|
9616
|
+
{
|
|
9617
|
+
internalType: "uint256",
|
|
9618
|
+
name: "",
|
|
9619
|
+
type: "uint256"
|
|
9620
|
+
}
|
|
9621
|
+
],
|
|
9622
|
+
stateMutability: "view",
|
|
9623
|
+
type: "function"
|
|
9624
|
+
},
|
|
9625
|
+
{
|
|
9626
|
+
inputs: [
|
|
9627
|
+
{
|
|
9628
|
+
internalType: "bytes32",
|
|
9629
|
+
name: "role",
|
|
9630
|
+
type: "bytes32"
|
|
9631
|
+
}
|
|
9632
|
+
],
|
|
9633
|
+
name: "getRoleMembers",
|
|
9634
|
+
outputs: [
|
|
9635
|
+
{
|
|
9636
|
+
internalType: "address[]",
|
|
9637
|
+
name: "",
|
|
9638
|
+
type: "address[]"
|
|
9639
|
+
}
|
|
9640
|
+
],
|
|
9641
|
+
stateMutability: "view",
|
|
9642
|
+
type: "function"
|
|
9643
|
+
},
|
|
9644
|
+
{
|
|
9645
|
+
inputs: [
|
|
9646
|
+
{
|
|
9647
|
+
internalType: "bytes32",
|
|
9648
|
+
name: "role",
|
|
9649
|
+
type: "bytes32"
|
|
9650
|
+
},
|
|
9651
|
+
{
|
|
9652
|
+
internalType: "address",
|
|
9653
|
+
name: "account",
|
|
9654
|
+
type: "address"
|
|
9655
|
+
}
|
|
9656
|
+
],
|
|
9657
|
+
name: "grantRole",
|
|
9658
|
+
outputs: [],
|
|
9659
|
+
stateMutability: "nonpayable",
|
|
9660
|
+
type: "function"
|
|
9661
|
+
},
|
|
9662
|
+
{
|
|
9663
|
+
inputs: [
|
|
9664
|
+
{
|
|
9665
|
+
internalType: "bytes32",
|
|
9666
|
+
name: "role",
|
|
9667
|
+
type: "bytes32"
|
|
9668
|
+
},
|
|
9669
|
+
{
|
|
9670
|
+
internalType: "address",
|
|
9671
|
+
name: "account",
|
|
9672
|
+
type: "address"
|
|
9673
|
+
}
|
|
9674
|
+
],
|
|
9675
|
+
name: "hasRole",
|
|
9676
|
+
outputs: [
|
|
9677
|
+
{
|
|
9678
|
+
internalType: "bool",
|
|
9679
|
+
name: "",
|
|
9680
|
+
type: "bool"
|
|
9681
|
+
}
|
|
9682
|
+
],
|
|
9683
|
+
stateMutability: "view",
|
|
9684
|
+
type: "function"
|
|
9685
|
+
},
|
|
9686
|
+
{
|
|
9687
|
+
inputs: [
|
|
9688
|
+
{
|
|
9689
|
+
internalType: "address",
|
|
9690
|
+
name: "airdrop_",
|
|
9691
|
+
type: "address"
|
|
9692
|
+
},
|
|
9693
|
+
{
|
|
9694
|
+
internalType: "address",
|
|
9695
|
+
name: "clientAdmin",
|
|
9696
|
+
type: "address"
|
|
9697
|
+
},
|
|
9698
|
+
{
|
|
9699
|
+
internalType: "address",
|
|
9700
|
+
name: "clientDelegate",
|
|
9701
|
+
type: "address"
|
|
9702
|
+
},
|
|
9703
|
+
{
|
|
9704
|
+
internalType: "address",
|
|
9705
|
+
name: "complianceDelegate_",
|
|
9706
|
+
type: "address"
|
|
9707
|
+
}
|
|
9708
|
+
],
|
|
9709
|
+
name: "initialize",
|
|
9710
|
+
outputs: [],
|
|
9711
|
+
stateMutability: "nonpayable",
|
|
9712
|
+
type: "function"
|
|
9713
|
+
},
|
|
9714
|
+
{
|
|
9715
|
+
inputs: [
|
|
9716
|
+
{
|
|
9717
|
+
internalType: "address",
|
|
9718
|
+
name: "delegate",
|
|
9719
|
+
type: "address"
|
|
9720
|
+
}
|
|
9721
|
+
],
|
|
9722
|
+
name: "isActiveDelegate",
|
|
9723
|
+
outputs: [
|
|
9724
|
+
{
|
|
9725
|
+
internalType: "bool",
|
|
9726
|
+
name: "",
|
|
9727
|
+
type: "bool"
|
|
9728
|
+
}
|
|
9729
|
+
],
|
|
9730
|
+
stateMutability: "view",
|
|
9731
|
+
type: "function"
|
|
9732
|
+
},
|
|
9733
|
+
{
|
|
9734
|
+
inputs: [
|
|
9735
|
+
{
|
|
9736
|
+
internalType: "bytes32",
|
|
9737
|
+
name: "role",
|
|
9738
|
+
type: "bytes32"
|
|
9739
|
+
},
|
|
9740
|
+
{
|
|
9741
|
+
internalType: "address",
|
|
9742
|
+
name: "callerConfirmation",
|
|
9743
|
+
type: "address"
|
|
9744
|
+
}
|
|
9745
|
+
],
|
|
9746
|
+
name: "renounceRole",
|
|
9747
|
+
outputs: [],
|
|
9748
|
+
stateMutability: "nonpayable",
|
|
9749
|
+
type: "function"
|
|
9750
|
+
},
|
|
9751
|
+
{
|
|
9752
|
+
inputs: [
|
|
9753
|
+
{
|
|
9754
|
+
internalType: "address",
|
|
9755
|
+
name: "delegate",
|
|
9756
|
+
type: "address"
|
|
9757
|
+
}
|
|
9758
|
+
],
|
|
9759
|
+
name: "revokeDelegate",
|
|
9760
|
+
outputs: [],
|
|
9761
|
+
stateMutability: "nonpayable",
|
|
9762
|
+
type: "function"
|
|
9763
|
+
},
|
|
9764
|
+
{
|
|
9765
|
+
inputs: [
|
|
9766
|
+
{
|
|
9767
|
+
internalType: "bytes32",
|
|
9768
|
+
name: "role",
|
|
9769
|
+
type: "bytes32"
|
|
9770
|
+
},
|
|
9771
|
+
{
|
|
9772
|
+
internalType: "address",
|
|
9773
|
+
name: "account",
|
|
9774
|
+
type: "address"
|
|
9775
|
+
}
|
|
9776
|
+
],
|
|
9777
|
+
name: "revokeRole",
|
|
9778
|
+
outputs: [],
|
|
9779
|
+
stateMutability: "nonpayable",
|
|
9780
|
+
type: "function"
|
|
9781
|
+
},
|
|
9782
|
+
{
|
|
9783
|
+
inputs: [
|
|
9784
|
+
{
|
|
9785
|
+
internalType: "bytes4",
|
|
9786
|
+
name: "interfaceId",
|
|
9787
|
+
type: "bytes4"
|
|
9788
|
+
}
|
|
9789
|
+
],
|
|
9790
|
+
name: "supportsInterface",
|
|
9791
|
+
outputs: [
|
|
9792
|
+
{
|
|
9793
|
+
internalType: "bool",
|
|
9794
|
+
name: "",
|
|
9795
|
+
type: "bool"
|
|
9796
|
+
}
|
|
9797
|
+
],
|
|
9798
|
+
stateMutability: "view",
|
|
9799
|
+
type: "function"
|
|
9800
|
+
}
|
|
9801
|
+
];
|
|
9802
|
+
|
|
9803
|
+
// src/fhe-airdrop/compliance.ts
|
|
9804
|
+
var ACL_PROPAGATION_CODE = "DELEGATION_NOT_PROPAGATED";
|
|
9805
|
+
var ACL_PROPAGATION_ERROR_NAME = "DelegationNotPropagatedError";
|
|
9806
|
+
var ACL_PROPAGATION_STATUSES = /* @__PURE__ */ new Set([400, 500]);
|
|
9807
|
+
function matchesPropagationMessage(message) {
|
|
9808
|
+
const lower = message.toLowerCase();
|
|
9809
|
+
if (lower.includes("acl check not propagated")) return true;
|
|
9810
|
+
return lower.includes("propagat") && lower.includes("gateway");
|
|
9811
|
+
}
|
|
9812
|
+
function readRecord(value) {
|
|
9813
|
+
return typeof value === "object" && value !== null ? value : void 0;
|
|
9814
|
+
}
|
|
9815
|
+
function readNumber(obj, key) {
|
|
9816
|
+
const value = obj?.[key];
|
|
9817
|
+
return typeof value === "number" ? value : void 0;
|
|
9818
|
+
}
|
|
9819
|
+
function readString(obj, key) {
|
|
9820
|
+
const value = obj?.[key];
|
|
9821
|
+
return typeof value === "string" ? value : void 0;
|
|
9822
|
+
}
|
|
9823
|
+
function isAclPropagationError(error) {
|
|
9824
|
+
const err = readRecord(error);
|
|
9825
|
+
if (!err) return false;
|
|
9826
|
+
const cause = readRecord(err["cause"]);
|
|
9827
|
+
if (err["code"] === ACL_PROPAGATION_CODE || err["name"] === ACL_PROPAGATION_ERROR_NAME || cause?.["code"] === ACL_PROPAGATION_CODE || cause?.["name"] === ACL_PROPAGATION_ERROR_NAME) {
|
|
9828
|
+
return true;
|
|
9829
|
+
}
|
|
9830
|
+
const status = readNumber(err, "status") ?? readNumber(err, "statusCode") ?? readNumber(cause, "status") ?? readNumber(cause, "statusCode");
|
|
9831
|
+
if (status === void 0 || !ACL_PROPAGATION_STATUSES.has(status)) return false;
|
|
9832
|
+
const errMessage = readString(err, "message");
|
|
9833
|
+
const causeMessage = readString(cause, "message");
|
|
9834
|
+
return errMessage !== void 0 && matchesPropagationMessage(errMessage) || causeMessage !== void 0 && matchesPropagationMessage(causeMessage);
|
|
9835
|
+
}
|
|
9836
|
+
var ComplianceManagerClient = class {
|
|
9837
|
+
publicClient;
|
|
9838
|
+
walletClient;
|
|
9839
|
+
address;
|
|
9840
|
+
chainId;
|
|
9841
|
+
#telemetry;
|
|
9842
|
+
constructor(config) {
|
|
9843
|
+
this.publicClient = config.publicClient;
|
|
9844
|
+
this.walletClient = config.walletClient;
|
|
9845
|
+
const chainId = config.chainId ?? config.publicClient.chain?.id;
|
|
9846
|
+
if (chainId === void 0) {
|
|
9847
|
+
throw new chunk67OV5CX2_cjs.DeploymentAddressUnavailableError({
|
|
9848
|
+
reason: "chain-id-missing",
|
|
9849
|
+
product: "fheAirdrop",
|
|
9850
|
+
contract: "complianceManager",
|
|
9851
|
+
clientLabel: "ComplianceManagerClient"
|
|
9852
|
+
});
|
|
9853
|
+
}
|
|
9854
|
+
chunkYTIYTV4K_cjs.assertSupportedChain(chainId);
|
|
9855
|
+
this.chainId = chainId;
|
|
9856
|
+
this.address = chunkJK4XMMKM_cjs.normaliseAddress(config.address);
|
|
9857
|
+
this.#telemetry = config.telemetry;
|
|
9858
|
+
this.#telemetry?.event("fhe-airdrop.client.init", {
|
|
9859
|
+
surface: "compliance",
|
|
9860
|
+
chainId,
|
|
9861
|
+
hasWallet: !!this.walletClient,
|
|
9862
|
+
sdkVersion: chunkUG5RKLU2_cjs.SDK_VERSION
|
|
9863
|
+
});
|
|
9864
|
+
}
|
|
9865
|
+
// ============================================================
|
|
9866
|
+
// CLIENT DELEGATION MGMT
|
|
9867
|
+
// ============================================================
|
|
9868
|
+
/**
|
|
9869
|
+
* Add a client delegate: grants `delegate` permanent (never-expiring)
|
|
9870
|
+
* user-decryption delegation over this clone's airdrop. Requires
|
|
9871
|
+
* {@link DELEGATION_ADMIN_ROLE}.
|
|
9872
|
+
*
|
|
9873
|
+
* Effective on-chain immediately; see the class TSDoc for the gateway
|
|
9874
|
+
* propagation lag before `delegatedUserDecrypt` catches up.
|
|
9875
|
+
*
|
|
9876
|
+
* @throws {@link InvalidArgumentError} (`argument: "delegate"`) when `delegate` is the zero address
|
|
9877
|
+
* (`ZeroDelegate`), already an active client delegate (`DelegateAlreadyAdded`), or targets the
|
|
9878
|
+
* irrevocable platform compliance delegate (`CannotManageComplianceDelegate`).
|
|
9879
|
+
* @returns The transaction hash.
|
|
9880
|
+
*/
|
|
9881
|
+
async addDelegate(args) {
|
|
9882
|
+
return chunkVJKZWYYJ_cjs.withTelemetry(
|
|
9883
|
+
this.#telemetry,
|
|
9884
|
+
"fhe-airdrop.compliance.addDelegate",
|
|
9885
|
+
() => this.#write("addDelegate", [args.delegate], args.account, "addDelegate")
|
|
9886
|
+
);
|
|
9887
|
+
}
|
|
9888
|
+
/**
|
|
9889
|
+
* Revoke a client delegate. Requires {@link DELEGATION_ADMIN_ROLE}.
|
|
9890
|
+
*
|
|
9891
|
+
* Effective on-chain immediately — but off-chain, gateway-served
|
|
9892
|
+
* `delegatedUserDecrypt` calls stop succeeding only once the gateway
|
|
9893
|
+
* observes the revocation, which is not instantaneous either. Cannot target
|
|
9894
|
+
* the platform compliance delegate, which is irrevocable by construction.
|
|
9895
|
+
*
|
|
9896
|
+
* **Not in the same block as {@link addDelegate} for the same delegate.**
|
|
9897
|
+
* The FHEVM ACL rejects an add and a revoke of one delegate within a single
|
|
9898
|
+
* block (`AlreadyDelegatedOrRevokedInSameBlock`), and because that revert
|
|
9899
|
+
* comes from the ACL rather than from this contract, it surfaces as an
|
|
9900
|
+
* opaque {@link ContractRevertError} with no decodable selector — nothing
|
|
9901
|
+
* names the delegate or the cause. Batching an add and a revoke into one
|
|
9902
|
+
* multicall, or sending both inside one block, is the way to hit it; wait a
|
|
9903
|
+
* block between them. This is the sequencing counterpart to the propagation
|
|
9904
|
+
* gotcha on the class TSDoc: that one is the gateway lagging the chain, this
|
|
9905
|
+
* one is the chain refusing two conflicting writes at the same height.
|
|
9906
|
+
*
|
|
9907
|
+
* @throws {@link InvalidArgumentError} (`argument: "delegate"`) when `delegate` is the zero address
|
|
9908
|
+
* (`ZeroDelegate`), not currently an active client delegate (`DelegateNotFound`), or targets the
|
|
9909
|
+
* irrevocable platform compliance delegate (`CannotManageComplianceDelegate`).
|
|
9910
|
+
* @returns The transaction hash.
|
|
9911
|
+
*/
|
|
9912
|
+
async revokeDelegate(args) {
|
|
9913
|
+
return chunkVJKZWYYJ_cjs.withTelemetry(
|
|
9914
|
+
this.#telemetry,
|
|
9915
|
+
"fhe-airdrop.compliance.revokeDelegate",
|
|
9916
|
+
() => this.#write("revokeDelegate", [args.delegate], args.account, "revokeDelegate")
|
|
9917
|
+
);
|
|
9918
|
+
}
|
|
9919
|
+
// ============================================================
|
|
9920
|
+
// READS
|
|
9921
|
+
// ============================================================
|
|
9922
|
+
/** The one airdrop instance this clone serves — set once, at `initialize`. */
|
|
9923
|
+
async airdrop() {
|
|
9924
|
+
return this.#read("airdrop");
|
|
9925
|
+
}
|
|
9926
|
+
/**
|
|
9927
|
+
* The platform compliance delegate.
|
|
9928
|
+
*
|
|
9929
|
+
* @returns The delegate address, or the zero address when this clone was
|
|
9930
|
+
* created with the platform compliance policy OFF. Because `initialize`
|
|
9931
|
+
* always runs atomically before this client can reach the clone (see the
|
|
9932
|
+
* class TSDoc), a zero return never means "not wired yet" — there is no
|
|
9933
|
+
* such observable state on this contract. It unambiguously means "no
|
|
9934
|
+
* platform delegate for this airdrop."
|
|
9935
|
+
*/
|
|
9936
|
+
async complianceDelegate() {
|
|
9937
|
+
return this.#read("complianceDelegate");
|
|
9938
|
+
}
|
|
9939
|
+
/** The current set of active client delegates (excludes the platform compliance delegate, if any). */
|
|
9940
|
+
async clientDelegates() {
|
|
9941
|
+
return this.#read("clientDelegates");
|
|
9942
|
+
}
|
|
9943
|
+
/**
|
|
9944
|
+
* Authoritative active-delegate check for `delegate` — reads the ACL
|
|
9945
|
+
* expiration date directly rather than the contract's `EnumerableSet`
|
|
9946
|
+
* mirror, so it reflects the platform compliance delegate too (which never
|
|
9947
|
+
* appears in {@link clientDelegates}).
|
|
9948
|
+
*
|
|
9949
|
+
* On-chain truth only: a `true` result means the delegation is live in the
|
|
9950
|
+
* ACL, not that the gateway has caught up with it yet — see the class
|
|
9951
|
+
* TSDoc's propagation note.
|
|
9952
|
+
*/
|
|
9953
|
+
async isActiveDelegate(delegate) {
|
|
9954
|
+
return this.#read("isActiveDelegate", [delegate]);
|
|
9955
|
+
}
|
|
9956
|
+
// Role-constant getters are named for the contract function they read, the
|
|
9957
|
+
// same convention every other client in this module follows: one spelling
|
|
9958
|
+
// per role, whichever client you happen to be holding.
|
|
9959
|
+
/** Gates {@link addDelegate} / {@link revokeDelegate}. */
|
|
9960
|
+
async DELEGATION_ADMIN_ROLE() {
|
|
9961
|
+
return this.#read("DELEGATION_ADMIN_ROLE");
|
|
9962
|
+
}
|
|
9963
|
+
/**
|
|
9964
|
+
* OpenZeppelin's root role (`bytes32(0)`), read from the clone rather than
|
|
9965
|
+
* hard-coded. It administers {@link DELEGATION_ADMIN_ROLE}.
|
|
9966
|
+
*/
|
|
9967
|
+
async DEFAULT_ADMIN_ROLE() {
|
|
9968
|
+
return this.#read("DEFAULT_ADMIN_ROLE");
|
|
9969
|
+
}
|
|
9970
|
+
// ============================================================
|
|
9971
|
+
// ROLE ADMINISTRATION
|
|
9972
|
+
// ============================================================
|
|
9973
|
+
//
|
|
9974
|
+
// The clone is `AccessControlEnumerableUpgradeable`, so membership is
|
|
9975
|
+
// enumerable as well as checkable. This surface is what makes the delegation
|
|
9976
|
+
// verbs above administrable: without it, whoever the factory named at
|
|
9977
|
+
// `initialize` is the only account that can ever add a delegate, and there
|
|
9978
|
+
// is no way to find out who that is.
|
|
9979
|
+
//
|
|
9980
|
+
// Unlike an airdrop instance, this contract adds no "never empty" floor of
|
|
9981
|
+
// its own - emptying `DEFAULT_ADMIN_ROLE` here permanently freezes the
|
|
9982
|
+
// clone's delegate set at whatever it currently holds.
|
|
9983
|
+
/**
|
|
9984
|
+
* Whether `holder` holds `role`.
|
|
9985
|
+
*
|
|
9986
|
+
* The role subject is called `holder`, not `account`: on the writes below
|
|
9987
|
+
* `account` already means "who sends this transaction", and one key cannot
|
|
9988
|
+
* be both.
|
|
9989
|
+
*
|
|
9990
|
+
* @param args.role A `bytes32` from {@link DELEGATION_ADMIN_ROLE} or {@link DEFAULT_ADMIN_ROLE}.
|
|
9991
|
+
*/
|
|
9992
|
+
async hasRole(args) {
|
|
9993
|
+
return this.#read("hasRole", [args.role, args.holder]);
|
|
9994
|
+
}
|
|
9995
|
+
/** The role whose holders may {@link grantRole} and {@link revokeRole} `role`. */
|
|
9996
|
+
async getRoleAdmin(role) {
|
|
9997
|
+
return this.#read("getRoleAdmin", [role]);
|
|
9998
|
+
}
|
|
9999
|
+
/** How many accounts hold `role`. */
|
|
10000
|
+
async getRoleMemberCount(role) {
|
|
10001
|
+
return this.#read("getRoleMemberCount", [role]);
|
|
10002
|
+
}
|
|
10003
|
+
/**
|
|
10004
|
+
* The `index`-th holder of `role`, in `EnumerableSet` order - which is not
|
|
10005
|
+
* stable across grants and revokes. Prefer {@link getRoleMembers}.
|
|
10006
|
+
*/
|
|
10007
|
+
async getRoleMember(args) {
|
|
10008
|
+
return this.#read("getRoleMember", [args.role, args.index]);
|
|
10009
|
+
}
|
|
10010
|
+
/**
|
|
10011
|
+
* Every account currently holding `role`.
|
|
10012
|
+
*
|
|
10013
|
+
* With {@link DELEGATION_ADMIN_ROLE} this answers "who may add or revoke a
|
|
10014
|
+
* delegate on this clone?" - the administrative counterpart to
|
|
10015
|
+
* {@link clientDelegates}, which answers "who may currently decrypt?".
|
|
10016
|
+
*/
|
|
10017
|
+
async getRoleMembers(role) {
|
|
10018
|
+
return this.#read("getRoleMembers", [role]);
|
|
10019
|
+
}
|
|
10020
|
+
/**
|
|
10021
|
+
* Grant `role` to `holder`. Requires the role's admin role
|
|
10022
|
+
* ({@link getRoleAdmin}).
|
|
10023
|
+
*
|
|
10024
|
+
* This is how a second operator is added to {@link DELEGATION_ADMIN_ROLE} -
|
|
10025
|
+
* the delegation verbs themselves are unaffected, the grant only widens who
|
|
10026
|
+
* may call them.
|
|
10027
|
+
*
|
|
10028
|
+
* @returns The transaction hash.
|
|
10029
|
+
*/
|
|
10030
|
+
async grantRole(args) {
|
|
10031
|
+
return chunkVJKZWYYJ_cjs.withTelemetry(
|
|
10032
|
+
this.#telemetry,
|
|
10033
|
+
"fhe-airdrop.compliance.grantRole",
|
|
10034
|
+
() => this.#write("grantRole", [args.role, args.holder], args.account, "grantRole")
|
|
10035
|
+
);
|
|
10036
|
+
}
|
|
10037
|
+
/**
|
|
10038
|
+
* Revoke `role` from `holder`. Requires the role's admin role.
|
|
10039
|
+
*
|
|
10040
|
+
* Revoking a delegation admin does **not** revoke the delegations they
|
|
10041
|
+
* created: an existing delegate keeps decrypting until
|
|
10042
|
+
* {@link revokeDelegate} is called for it explicitly.
|
|
10043
|
+
*
|
|
10044
|
+
* @returns The transaction hash.
|
|
10045
|
+
*/
|
|
10046
|
+
async revokeRole(args) {
|
|
10047
|
+
return chunkVJKZWYYJ_cjs.withTelemetry(
|
|
10048
|
+
this.#telemetry,
|
|
10049
|
+
"fhe-airdrop.compliance.revokeRole",
|
|
10050
|
+
() => this.#write("revokeRole", [args.role, args.holder], args.account, "revokeRole")
|
|
10051
|
+
);
|
|
10052
|
+
}
|
|
10053
|
+
/**
|
|
10054
|
+
* Give up `role` yourself.
|
|
10055
|
+
*
|
|
10056
|
+
* The contract's signature is `renounceRole(role, callerConfirmation)` and
|
|
10057
|
+
* it reverts `AccessControlBadConfirmation` unless `callerConfirmation` is
|
|
10058
|
+
* the sender, so this method takes no holder and fills the confirmation from
|
|
10059
|
+
* the resolved sending account. Renouncing for somebody else is not a call
|
|
10060
|
+
* that can succeed; use {@link revokeRole} to remove another account's role.
|
|
10061
|
+
*
|
|
10062
|
+
* @returns The transaction hash.
|
|
10063
|
+
*/
|
|
10064
|
+
async renounceRole(args) {
|
|
10065
|
+
const method = "renounceRole";
|
|
10066
|
+
const wallet = this.#requireWallet(method);
|
|
10067
|
+
const account = this.#resolveAccount(wallet, args.account, method);
|
|
10068
|
+
return chunkVJKZWYYJ_cjs.withTelemetry(
|
|
10069
|
+
this.#telemetry,
|
|
10070
|
+
"fhe-airdrop.compliance.renounceRole",
|
|
10071
|
+
() => this.#write(method, [args.role, accountAddress3(account)], account, method)
|
|
10072
|
+
);
|
|
10073
|
+
}
|
|
10074
|
+
// ============================================================
|
|
10075
|
+
// INTERNALS (private)
|
|
10076
|
+
// ============================================================
|
|
10077
|
+
async #write(functionName, args, account, method) {
|
|
10078
|
+
const wallet = this.#requireWallet(method);
|
|
10079
|
+
const acct = this.#resolveAccount(wallet, account, method);
|
|
10080
|
+
await this.#preflightWrite(method, functionName, args, acct);
|
|
10081
|
+
try {
|
|
10082
|
+
return await wallet.writeContract({
|
|
10083
|
+
address: this.address,
|
|
10084
|
+
abi: complianceRoleManagerAbi,
|
|
10085
|
+
functionName,
|
|
10086
|
+
args,
|
|
10087
|
+
account: acct,
|
|
10088
|
+
chain: wallet.chain
|
|
10089
|
+
});
|
|
10090
|
+
} catch (err) {
|
|
10091
|
+
throw this.#mapRevert(method, err, acct);
|
|
10092
|
+
}
|
|
10093
|
+
}
|
|
10094
|
+
async #read(functionName, args = []) {
|
|
10095
|
+
const result = await this.publicClient.readContract({
|
|
10096
|
+
address: this.address,
|
|
10097
|
+
abi: complianceRoleManagerAbi,
|
|
10098
|
+
functionName,
|
|
10099
|
+
args
|
|
10100
|
+
});
|
|
10101
|
+
return result;
|
|
10102
|
+
}
|
|
10103
|
+
/**
|
|
10104
|
+
* Simulate a write purely to surface typed reverts.
|
|
10105
|
+
*
|
|
10106
|
+
* The simulate's return value is discarded on principle: this contract
|
|
10107
|
+
* returns nothing from `addDelegate` / `revokeDelegate` anyway, but the
|
|
10108
|
+
* pattern is kept identical to every other airdrop v2 client so a revert is
|
|
10109
|
+
* always decoded before the user pays for it.
|
|
10110
|
+
*/
|
|
10111
|
+
async #preflightWrite(method, functionName, args, account) {
|
|
10112
|
+
try {
|
|
10113
|
+
await this.publicClient.simulateContract({
|
|
10114
|
+
address: this.address,
|
|
10115
|
+
abi: complianceRoleManagerAbi,
|
|
10116
|
+
functionName,
|
|
10117
|
+
args,
|
|
10118
|
+
account
|
|
10119
|
+
});
|
|
10120
|
+
} catch (err) {
|
|
10121
|
+
if (chunkMVDQMV25_cjs.isContractRevert(err)) {
|
|
10122
|
+
throw this.#mapRevert(method, err, account);
|
|
10123
|
+
}
|
|
10124
|
+
}
|
|
10125
|
+
}
|
|
10126
|
+
/**
|
|
10127
|
+
* Map a viem error to the SDK's typed palette.
|
|
10128
|
+
*
|
|
10129
|
+
* `productContext` deliberately carries only public identifiers — the
|
|
10130
|
+
* caller, the chain. Never an amount: this contract never handles amounts
|
|
10131
|
+
* at all, but the convention is shared across every airdrop v2 client.
|
|
10132
|
+
*/
|
|
10133
|
+
#mapRevert(method, err, account) {
|
|
10134
|
+
return chunkMVDQMV25_cjs.mapContractRevert(err, {
|
|
10135
|
+
method,
|
|
10136
|
+
contractAddress: this.address,
|
|
10137
|
+
abi: complianceRoleManagerAbi,
|
|
10138
|
+
productMapper: chunkYTIYTV4K_cjs.airdropProductMapper,
|
|
10139
|
+
account: accountAddress3(account),
|
|
10140
|
+
productContext: {
|
|
10141
|
+
creator: accountAddress3(account),
|
|
10142
|
+
chainId: this.chainId
|
|
10143
|
+
}
|
|
10144
|
+
});
|
|
10145
|
+
}
|
|
10146
|
+
#requireWallet(method) {
|
|
10147
|
+
if (!this.walletClient) {
|
|
10148
|
+
throw new chunk67OV5CX2_cjs.MissingWalletClientError(method);
|
|
10149
|
+
}
|
|
10150
|
+
return this.walletClient;
|
|
10151
|
+
}
|
|
10152
|
+
#resolveAccount(wallet, override, method) {
|
|
10153
|
+
const acct = override ?? wallet.account;
|
|
10154
|
+
if (!acct) {
|
|
10155
|
+
throw new chunk67OV5CX2_cjs.MissingAccountError(method);
|
|
10156
|
+
}
|
|
10157
|
+
return acct;
|
|
10158
|
+
}
|
|
10159
|
+
};
|
|
10160
|
+
function createComplianceManagerClient(config) {
|
|
10161
|
+
return new ComplianceManagerClient(config);
|
|
10162
|
+
}
|
|
10163
|
+
function accountAddress3(account) {
|
|
10164
|
+
return typeof account === "string" ? account : account.address;
|
|
10165
|
+
}
|
|
10166
|
+
|
|
8825
10167
|
exports.AirdropBaseClient = AirdropBaseClient;
|
|
8826
10168
|
exports.CLAIM_TYPEHASH = CLAIM_TYPEHASH;
|
|
8827
10169
|
exports.CLAIM_TYPES = CLAIM_TYPES;
|
|
10170
|
+
exports.ComplianceManagerClient = ComplianceManagerClient;
|
|
8828
10171
|
exports.ConfidentialAirdropFactoryClient = ConfidentialAirdropFactoryClient;
|
|
8829
10172
|
exports.EIP712_DOMAIN_NAME = EIP712_DOMAIN_NAME;
|
|
8830
10173
|
exports.EIP712_DOMAIN_VERSION = EIP712_DOMAIN_VERSION;
|
|
@@ -8832,14 +10175,17 @@ exports.EcdsaAirdropClient = EcdsaAirdropClient;
|
|
|
8832
10175
|
exports.FACTORY_ROLE_CONCENTRATION_NOTE = FACTORY_ROLE_CONCENTRATION_NOTE;
|
|
8833
10176
|
exports.MerkleAirdropClient = MerkleAirdropClient;
|
|
8834
10177
|
exports.airdropFactoryAbi = airdropFactoryAbi;
|
|
10178
|
+
exports.complianceRoleManagerAbi = complianceRoleManagerAbi;
|
|
8835
10179
|
exports.confidentialAirdropBaseAbi = confidentialAirdropBaseAbi;
|
|
8836
10180
|
exports.createAirdropBaseClient = createAirdropBaseClient;
|
|
10181
|
+
exports.createComplianceManagerClient = createComplianceManagerClient;
|
|
8837
10182
|
exports.createConfidentialAirdropFactoryClient = createConfidentialAirdropFactoryClient;
|
|
8838
10183
|
exports.createEcdsaAirdropClient = createEcdsaAirdropClient;
|
|
8839
10184
|
exports.createMerkleAirdropClient = createMerkleAirdropClient;
|
|
8840
10185
|
exports.ecdsaConfidentialAirdropAbi = ecdsaConfidentialAirdropAbi;
|
|
8841
10186
|
exports.encryptUint64 = encryptUint64;
|
|
8842
10187
|
exports.encryptUint64Batch = encryptUint64Batch;
|
|
10188
|
+
exports.isAclPropagationError = isAclPropagationError;
|
|
8843
10189
|
exports.merkleConfidentialAirdropAbi = merkleConfidentialAirdropAbi;
|
|
8844
10190
|
exports.resolveEncryptor = resolveEncryptor;
|
|
8845
10191
|
exports.signClaimAuthorization = signClaimAuthorization;
|