@whetstone-research/doppler-sdk 1.0.30 → 1.0.31
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/evm/index.cjs +764 -402
- package/dist/evm/index.cjs.map +1 -1
- package/dist/evm/index.d.cts +1803 -382
- package/dist/evm/index.d.ts +1803 -382
- package/dist/evm/index.js +760 -404
- package/dist/evm/index.js.map +1 -1
- package/dist/solana/index.cjs +51 -44
- package/dist/solana/index.cjs.map +1 -1
- package/dist/solana/index.d.cts +2 -1
- package/dist/solana/index.d.ts +2 -1
- package/dist/solana/index.js +51 -45
- package/dist/solana/index.js.map +1 -1
- package/package.json +1 -1
package/dist/evm/index.cjs
CHANGED
|
@@ -13,6 +13,7 @@ var GENERATED_DOPPLER_DEPLOYMENTS = {
|
|
|
13
13
|
CloneERC20Factory: "0xe7Df2A4520C26a2D4Dedb3a7585BFBcd30eABA6e",
|
|
14
14
|
CloneERC20Votes: "0xA8d0E8036D3fAE21C7Af075ad41942Bc1f807CDF",
|
|
15
15
|
CloneERC20VotesFactory: "0x5A92bFfbc01ea0396A9c7D4154d36d4EAF2e483E",
|
|
16
|
+
DopplerCreateXDeployer: "0x103004E50Bed65DFBa30dD9c264B6BdF5e529B83",
|
|
16
17
|
DopplerDeployer: "0xb35469ee64A87Afd19B31615094fE3962d73e421",
|
|
17
18
|
DopplerERC20V1: "0xDB7B520bb5C3a2C5d4871198081911359f93be87",
|
|
18
19
|
DopplerERC20V1Factory: "0x89C261C05B5F9b6BcBA07C199b8DeE7cFaD45292",
|
|
@@ -65,6 +66,7 @@ var GENERATED_DOPPLER_DEPLOYMENTS = {
|
|
|
65
66
|
Bundler: "0xC99b485499f78995C6F1640dbB1413c57f8BA684",
|
|
66
67
|
CloneDERC20VotesV2: "0x4BBfed1c27CDE12eF6638251D81ab4e3be7556b7",
|
|
67
68
|
CloneDERC20VotesV2Factory: "0x16F5ACB64F4FA17296E942C51d3395aDC318f9e1",
|
|
69
|
+
DopplerCreateXDeployer: "0x103004E50Bed65DFBa30dD9c264B6BdF5e529B83",
|
|
68
70
|
DopplerDeployer: "0xb35469ee64A87Afd19B31615094fE3962d73e421",
|
|
69
71
|
DopplerERC20V1: "0xDB7B520bb5C3a2C5d4871198081911359f93be87",
|
|
70
72
|
DopplerERC20V1Factory: "0x89C261C05B5F9b6BcBA07C199b8DeE7cFaD45292",
|
|
@@ -171,6 +173,7 @@ var GENERATED_DOPPLER_DEPLOYMENTS = {
|
|
|
171
173
|
CloneDERC20VotesV2Factory: "0x16F5ACB64F4FA17296E942C51d3395aDC318f9e1",
|
|
172
174
|
DecayMulticurveInitializer: "0xD59cE43E53D69F190E15d9822Fb4540dCcc91178",
|
|
173
175
|
DecayMulticurveInitializerHook: "0xbB7784A4d481184283Ed89619A3e3ed143e1Adc0",
|
|
176
|
+
DopplerCreateXDeployer: "0x103004E50Bed65DFBa30dD9c264B6BdF5e529B83",
|
|
174
177
|
DopplerDeployer: "0xb35469ee64A87Afd19B31615094fE3962d73e421",
|
|
175
178
|
DopplerERC20V1: "0xDB7B520bb5C3a2C5d4871198081911359f93be87",
|
|
176
179
|
DopplerERC20V1Factory: "0x89C261C05B5F9b6BcBA07C199b8DeE7cFaD45292",
|
|
@@ -268,10 +271,10 @@ var GENERATED_DOPPLER_DEPLOYMENTS = {
|
|
|
268
271
|
MulticurveLibrary: "0x32238a39ba5aF060EFbfAda59979B639E0945fE0",
|
|
269
272
|
NoOpGovernanceFactory: "0x7bD798fafC99A3b17E261F8308A8C11B56935ea1",
|
|
270
273
|
NoOpMigrator: "0xF11066abbd329ac4bBA39455340539322C222eb0",
|
|
271
|
-
Quoter: "
|
|
274
|
+
Quoter: "0x23C94d575C3e116fFDd7D5fbb50b7cA4972EdA83",
|
|
272
275
|
RehypeDopplerHook: "0x3Ec4798A9B11e8243A8Db99687f7A23597B96623",
|
|
273
|
-
RehypeDopplerHookInitializer: "
|
|
274
|
-
RehypeDopplerHookMigrator: "
|
|
276
|
+
RehypeDopplerHookInitializer: "0x78C79C95eacEb2D08f7a55cc0D31012f8aF510c3",
|
|
277
|
+
RehypeDopplerHookMigrator: "0x9349E5A3e6458aa65E2fB7ED67e9aD08Ae7F660D",
|
|
275
278
|
StreamableFeesLocker: "0x3345E557c5C0b474bE1eb4693264008B8562Aa9c",
|
|
276
279
|
StreamableFeesLockerV2: "0xcE3212e6536F33cD6fbFEE265224131353Ca3D47",
|
|
277
280
|
TeamGovernanceFactory: "0x8aF3001ED75F86f4Dd910577ECa9C5dB7CEa765c",
|
|
@@ -1237,7 +1240,7 @@ function estimateSlippage(amountIn, liquidity, currentTick, fee) {
|
|
|
1237
1240
|
}
|
|
1238
1241
|
|
|
1239
1242
|
// src/evm/abis/multicurve/feeClaimsAbi.ts
|
|
1240
|
-
var
|
|
1243
|
+
var feesManagerAbi = [
|
|
1241
1244
|
{
|
|
1242
1245
|
type: "function",
|
|
1243
1246
|
name: "getCumulatedFees0",
|
|
@@ -1291,8 +1294,119 @@ var feeClaimsInitializerAbi = [
|
|
|
1291
1294
|
{ name: "fees1", type: "uint128", internalType: "uint128" }
|
|
1292
1295
|
],
|
|
1293
1296
|
stateMutability: "nonpayable"
|
|
1294
|
-
}
|
|
1297
|
+
},
|
|
1298
|
+
{
|
|
1299
|
+
type: "function",
|
|
1300
|
+
name: "getPoolKey",
|
|
1301
|
+
inputs: [{ name: "poolId", type: "bytes32", internalType: "PoolId" }],
|
|
1302
|
+
outputs: [
|
|
1303
|
+
{
|
|
1304
|
+
name: "currency0",
|
|
1305
|
+
type: "address",
|
|
1306
|
+
internalType: "Currency"
|
|
1307
|
+
},
|
|
1308
|
+
{ name: "currency1", type: "address", internalType: "Currency" },
|
|
1309
|
+
{ name: "fee", type: "uint24", internalType: "uint24" },
|
|
1310
|
+
{ name: "tickSpacing", type: "int24", internalType: "int24" },
|
|
1311
|
+
{ name: "hooks", type: "address", internalType: "contract IHooks" }
|
|
1312
|
+
],
|
|
1313
|
+
stateMutability: "view"
|
|
1314
|
+
},
|
|
1315
|
+
{
|
|
1316
|
+
type: "function",
|
|
1317
|
+
name: "updateBeneficiary",
|
|
1318
|
+
inputs: [
|
|
1319
|
+
{ name: "poolId", type: "bytes32", internalType: "PoolId" },
|
|
1320
|
+
{ name: "newBeneficiary", type: "address", internalType: "address" }
|
|
1321
|
+
],
|
|
1322
|
+
outputs: [],
|
|
1323
|
+
stateMutability: "nonpayable"
|
|
1324
|
+
},
|
|
1325
|
+
{
|
|
1326
|
+
type: "event",
|
|
1327
|
+
name: "Collect",
|
|
1328
|
+
inputs: [
|
|
1329
|
+
{
|
|
1330
|
+
name: "poolId",
|
|
1331
|
+
type: "bytes32",
|
|
1332
|
+
indexed: true,
|
|
1333
|
+
internalType: "PoolId"
|
|
1334
|
+
},
|
|
1335
|
+
{
|
|
1336
|
+
name: "fees0",
|
|
1337
|
+
type: "uint256",
|
|
1338
|
+
indexed: false,
|
|
1339
|
+
internalType: "uint256"
|
|
1340
|
+
},
|
|
1341
|
+
{
|
|
1342
|
+
name: "fees1",
|
|
1343
|
+
type: "uint256",
|
|
1344
|
+
indexed: false,
|
|
1345
|
+
internalType: "uint256"
|
|
1346
|
+
}
|
|
1347
|
+
],
|
|
1348
|
+
anonymous: false
|
|
1349
|
+
},
|
|
1350
|
+
{
|
|
1351
|
+
type: "event",
|
|
1352
|
+
name: "Release",
|
|
1353
|
+
inputs: [
|
|
1354
|
+
{
|
|
1355
|
+
name: "poolId",
|
|
1356
|
+
type: "bytes32",
|
|
1357
|
+
indexed: true,
|
|
1358
|
+
internalType: "PoolId"
|
|
1359
|
+
},
|
|
1360
|
+
{
|
|
1361
|
+
name: "beneficiary",
|
|
1362
|
+
type: "address",
|
|
1363
|
+
indexed: true,
|
|
1364
|
+
internalType: "address"
|
|
1365
|
+
},
|
|
1366
|
+
{
|
|
1367
|
+
name: "fees0",
|
|
1368
|
+
type: "uint256",
|
|
1369
|
+
indexed: false,
|
|
1370
|
+
internalType: "uint256"
|
|
1371
|
+
},
|
|
1372
|
+
{
|
|
1373
|
+
name: "fees1",
|
|
1374
|
+
type: "uint256",
|
|
1375
|
+
indexed: false,
|
|
1376
|
+
internalType: "uint256"
|
|
1377
|
+
}
|
|
1378
|
+
],
|
|
1379
|
+
anonymous: false
|
|
1380
|
+
},
|
|
1381
|
+
{
|
|
1382
|
+
type: "event",
|
|
1383
|
+
name: "UpdateBeneficiary",
|
|
1384
|
+
inputs: [
|
|
1385
|
+
{
|
|
1386
|
+
name: "poolId",
|
|
1387
|
+
type: "bytes32",
|
|
1388
|
+
indexed: false,
|
|
1389
|
+
internalType: "PoolId"
|
|
1390
|
+
},
|
|
1391
|
+
{
|
|
1392
|
+
name: "oldBeneficiary",
|
|
1393
|
+
type: "address",
|
|
1394
|
+
indexed: false,
|
|
1395
|
+
internalType: "address"
|
|
1396
|
+
},
|
|
1397
|
+
{
|
|
1398
|
+
name: "newBeneficiary",
|
|
1399
|
+
type: "address",
|
|
1400
|
+
indexed: false,
|
|
1401
|
+
internalType: "address"
|
|
1402
|
+
}
|
|
1403
|
+
],
|
|
1404
|
+
anonymous: false
|
|
1405
|
+
},
|
|
1406
|
+
{ type: "error", name: "CallerNotBeneficiary", inputs: [] },
|
|
1407
|
+
{ type: "error", name: "InvalidNewBeneficiary", inputs: [] }
|
|
1295
1408
|
];
|
|
1409
|
+
var feeClaimsInitializerAbi = feesManagerAbi;
|
|
1296
1410
|
|
|
1297
1411
|
// src/evm/abis/bytecodes/doppler.ts
|
|
1298
1412
|
var doppler_default = "0x60a06040523461057b57604051601f615c0338819003918201601f19168301916001600160401b0383118484101761057f578084926101c09460405283398101031261057b5780516001600160a01b038116810361057b5760208201516040830151906060840151608085015160a08601519061007e60c088016105b3565b9161008b60e089016105b3565b91610100890151946100a06101208b016105b3565b976101408b0151978815988915810361057b576101608d01516101808e01516001600160a01b0381169e919d91908f0361057b576101a001519062ffffff821680920361057b576080525f6101a06100f6610593565b8281528260208201528260408201528260608201528260808201528260a08201528260c08201528260e0820152826101008201528261012082015282610140820152826101608201528261018082015201525f6101a0610154610593565b6001815260016020820152600160408201528260608201528260808201528260a0820152600160c0820152600160e082015260016101008201528261012082015282610140820152826101608201528261018082015201526120003016151560011480159061056a575b8015610559575b801561054c575b801561053f575b8015610532575b8015610522575b8015610512575b8015610502575b80156104f6575b80156104ea575b80156104de575b80156104d2575b80156104c6575b6104b35762ffffff1960165416176016558442116104a4578660020b8860020b91818303610463575b5050508484101561045457838503858111610440578a60020b5f811380159061042b575b61041c578915610408578982066103f9578c156103eb57600f8d116103eb578484116103dc5761029861029d928b81046017558b6105c1565b610658565b628000008110156103cf5762ffffff19601854169062ffffff1617601855600d55600e55600f5560105560115562ffffff6012549160181b65ffffff0000001692169065ffffffffffff1916171760125560135562ffffff63ff000000601454921560181b1692169063ffffffff1916171760145560155560018060a01b0319600c541617600c5560405161552f90816106d48239608051818181601c01528181610205015281816102a80152818161045c0152818161050c0152818161098701528181610a1e01528181610af501528181610b9201528181610c5a01528181610e8301528181610f3a0152818161103d015281816110b201528181611d2c01528181611de40152818161217801528181613b8301528181613c4d01528181613fe9015281816140f40152614be40152f35b6335278d125f526004601cfd5b638cc99b7b60e01b5f5260045ffd5b6287e39960e61b5f5260045ffd5b6388ac089760e01b5f5260045ffd5b634e487b7160e01b5f52601260045260245ffd5b6312469eb560e11b5f5260045ffd5b5061043a81610298848d6105c1565b1561025f565b634e487b7160e01b5f52601160045260245ffd5b63536a71af60e01b5f5260045ffd5b8061049b575b610483578a9182610491575b5050610483575f808061023b565b6264847d60e41b5f5260045ffd5b1390505f80610475565b50808212610469565b632ca4094f60e21b5f5260045ffd5b630732d7b560e51b5f523060045260245ffd5b50600130161515610212565b5060023016151561020b565b50600430161515610204565b506008301615156101fd565b506010301615156101f6565b50602030161515600114156101ef565b50604030161515600114156101e8565b50608030161515600114156101e1565b50610100301615156101da565b50610200301615156101d3565b50610400301615156101cc565b5061080030161515600114156101c5565b5061100030161515600114156101be565b5f80fd5b634e487b7160e01b5f52604160045260245ffd5b604051906101c082016001600160401b0381118382101761057f57604052565b51908160020b820361057b57565b90670de0b6b3a76400008202905f19670de0b6b3a764000084099282808510940393808503948584111561057b571461065157670de0b6b3a764000082910981805f03168092046002816003021880820260020302808202600203028082026002030280820260020302808202600203028091026002030293600183805f03040190848311900302920304170290565b5091500490565b808202905f1983820990828083109203918083039283670de0b6b3a7640000111561057b57146106c2577faccb18165bd6fe31ae1cf318dc5b51eee0e1ba569b88cd74c1773b91fac1066993670de0b6b3a7640000910990828211900360ee1b910360121c170290565b5050670de0b6b3a76400009150049056fe608080604052600436101561005b575b50361561001a575f80fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316330361004c57005b6393c866c160e01b5f5260045ffd5b5f905f3560e01c908163182148ef146111155750806318cb1700146110f357806321d0ee701461109f578063259982e51461102a578063392e53cd1461100857806339518b5e14610feb578063514ea4bf14610f96578063575e24b414610ee357806357d775f814610ec65780636c2bbe7e14610e705780636c47a6c314610e535780636fe7e6eb14610c19578063897479cb14610bfb57806390ebab0a14610bdd57806391dd734614610b5e5780639ce110d714610b355780639f063efc14610ade578063a4dee15514610ab9578063b137392914610a98578063b356603014610a74578063b47b2fb1146109c6578063b6a8b0fa14610970578063c19d93fb14610921578063c4e833ce146107b6578063c70dfb4f14610795578063ce5494bb146104cb578063d0c52e21146104a9578063d65b4cb91461048b578063dc4c90d314610446578063dc98354e14610276578063dcf93f3214610250578063e1b4af69146101ee5763ee4644300361000f57346101eb57806003193601126101eb576020600d54604051908152f35b80fd5b50346101eb57600490610200366112dc565b5050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163303925061024491505057630a85dc2960e01b8152fd5b63570c108560e11b8152fd5b50346101eb57806003193601126101eb57602060ff60145460181c166040519015158152f35b50346101eb5760e03660031901126101eb5761029061116b565b5060a03660231901126101eb576102a561128e565b507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633036104375760085460ff81166104295760ff19166001176008556001600160a01b03602435908116908181036104255750600980546001600160a01b0319169190911790556044356001600160a01b038116908181036104255750600a80546001600160a01b03191691909117905560643562ffffff8116810361042157600a5461035a612061565b60b81b62ffffff60b81b169162ffffff60a01b9060a01b169065ffffffffffff60a01b19161717600a5560a43560018060a01b03811680910361042157600b80546001600160a01b031916919091179055601e6103b5612061565b60020b136104125760145460020b6103cb612061565b60020b9081156103fe570760020b6103ef57604051636e4c1aa760e11b8152602090f35b6312469eb560e11b8152600490fd5b634e487b7160e01b83526012600452602483fd5b63013840ad60e51b8152600490fd5b5080fd5b8280fd5b62dc149f60e41b8252600482fd5b63570c108560e11b8152600490fd5b50346101eb57806003193601126101eb576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b50346101eb57806003193601126101eb576020600f54604051908152f35b50346101eb57806003193601126101eb5760ff60209154166040519015158152f35b50346101eb5760203660031901126101eb576104e561116b565b600c546001600160a01b031633036107865760ff825460081c161580610765575b610756577f000000000000000000000000000000000000000000000000000000000000000061059d8361057561058360405161054181611333565b610549611f3d565b815260018060a01b03871660208201528360408201526001606082015260405192839160208301611f8a565b03601f1981018352826113b4565b604051809381926348c8949160e01b8352600483016112b2565b0381836001600160a01b0387165af190811561074b57916105d785926105e2959460e09791610729575b50602080825183010191016114d8565b600695919554613282565b9161064160018060a01b0360095416926106306105fe856145cf565b948761061f8761061760018060a01b03600a54166145cf565b9a8b94614611565b600a546001600160a01b0316614611565b60a061063a611f3d565b2090614754565b5050600954600a5492976001600160a01b039182169791909316946106879250610678906001600160801b03608086901d16611472565b926001600160801b0316611472565b906001600160801b0381111561071a57506001600160801b03915b506001600160801b0381111561070b57506001600160801b03935b604080516001600160a01b0397909716875260208701919091526001600160801b03608085811d821692880192909252918216606087015285019190915290811660a08401521660c0820152f35b6001600160801b0316936106bd565b6001600160801b0316916106a2565b61074591503d8086833e61073d81836113b4565b810190611fcb565b5f6105c7565b6040513d86823e3d90fd5b63051a2a5560e51b8252600482fd5b50600454600e5411158061077a575b15610506565b50601154421015610774565b638341a67960e01b8252600482fd5b50346101eb57806003193601126101eb57602060125460020b604051908152f35b50346101eb57806003193601126101eb576020816101c0926101a06040516107dd81611362565b82815282858201528260408201528260608201528260808201528260a08201528260c08201528260e0820152826101008201528261012082015282610140820152826101608201528261018082015201528060405161083b81611362565b60018152838101600181526040820160018152606083018481526080840185815260a0850186815260c08601906001825260e087019260018452610100880194600186526101208901968a88526101408a01988b8a526101a06101608c019b8d8d5261018081019d8e52019c8d526040519d8e916001835251151591015251151560408d015251151560608c015251151560808b015251151560a08a015251151560c089015251151560e08801525115156101008701525115156101208601525115156101408501525115156101608401525115156101808301525115156101a0820152f35b50346101eb57806003193601126101eb5760c064ffffffffff600154166002546003546004546005549160065493604051958652602086015260408501526060840152608083015260a0820152f35b50346101eb57600490610982366112dc565b5050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316330392506102449150505763567d91d160e01b8152fd5b50346101eb576101603660031901126101eb576109e161116b565b5060a03660231901126101eb5760603660c31901126101eb57610144356001600160401b03811161042157610a1a903690600401611195565b50507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163303610437576040610a5a610124356140d7565b82516001600160e01b03199092168252600f0b6020820152f35b50346101eb57806003193601126101eb57602060125460181c60020b604051908152f35b50346101eb57806003193601126101eb57602060145460020b604051908152f35b50346101eb57806003193601126101eb5760ff6020915460081c166040519015158152f35b50346101eb57600490610af036611225565b5050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316330393506102449250505057630a85dc2960e01b8152fd5b50346101eb57806003193601126101eb57600c546040516001600160a01b039091168152602090f35b50346101eb5760203660031901126101eb576004356001600160401b03811161042157610b8f903690600401611195565b917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316330361043757610bd9610bcd848461168f565b604051918291826112b2565b0390f35b50346101eb57806003193601126101eb576020601554604051908152f35b50346101eb57806003193601126101eb576020600e54604051908152f35b5034610e4057610100366003190112610e4057610c3461116b565b60a0366023190112610e4057610c4861128e565b5060e435908160020b809203610e40577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169133839003610e445762ffffff6016541691833b15610e4057604051635275965160e01b815292602435906001600160a01b038216808303610e40576004860152604435946001600160a01b038616808703610e4057602482015260643562ffffff8116808203610e40576044830152608435918260020b808403610e4057606482015260a435936001600160a01b038516808603610e4057608483015260a48201525f8160c481838d5af18015610e3557610e07575b509488979461057594610da6948a9994610dc29960405196610d5a88611333565b60405194610d678661137e565b85526020850152604084015260608301526080820152835260018060a01b03166020830152604082015285606082015260405192839160208301611f8a565b6040519485809481936348c8949160e01b8352600483016112b2565b03925af18015610dfc57610de3575b604051636fe7e6eb60e01b8152602090f35b610df6913d8091833e61073d81836113b4565b5f610dd1565b6040513d84823e3d90fd5b610da69399509461057594610e245f610dc299949a959b986113b4565b5f9a94509450949791969095610d39565b6040513d5f823e3d90fd5b5f80fd5b63570c108560e11b5f5260045ffd5b34610e40575f366003190112610e40576020601154604051908152f35b34610e4057610e7e36611225565b5050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633039350610e449250505057630a85dc2960e01b5f5260045ffd5b34610e40575f366003190112610e40576020601354604051908152f35b34610e4057610140366003190112610e4057610efd61116b565b5060a0366023190112610e405760603660c3190112610e4057610124356001600160401b038111610e4057610f36903690600401611195565b50507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163303610e4457606062ffffff610f766120bd565b906040939293519363ffffffff60e01b1684526020840152166040820152f35b34610e40576020366003190112610e40576004355f526007602052608060405f205460ff604051918060020b83528060181c60020b6020840152600180851b038160301c16604084015260b01c166060820152f35b34610e40575f366003190112610e40576020601054604051908152f35b34610e40575f366003190112610e4057602060ff600854166040519015158152f35b34610e4057611038366111c2565b5050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633039050610e4457306001600160a01b03909116036110905760405163259982e560e01b8152602090f35b636d1ed89b60e01b5f5260045ffd5b34610e40576110ad366111c2565b5050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633039150610e44905057630a85dc2960e01b5f5260045ffd5b34610e40575f366003190112610e4057602062ffffff60165416604051908152f35b34610e40575f366003190112610e4057600954600a54600b546001600160a01b039283168452818316602085015260a082811c62ffffff16604086015260b89290921c60020b6060850152909116608083015290f35b600435906001600160a01b0382168203610e4057565b35906001600160a01b0382168203610e4057565b9181601f84011215610e40578235916001600160401b038311610e405760208381860195010111610e4057565b90610160600319830112610e40576004356001600160a01b0381168103610e40579160a0602319820112610e4057602491608060c319830112610e405760c49161014435906001600160401b038211610e405761122191600401611195565b9091565b906101a0600319830112610e40576004356001600160a01b0381168103610e40579160a0602319820112610e4057602491608060c319830112610e405760c4916101443591610164359161018435906001600160401b038211610e405761122191600401611195565b60c435906001600160a01b0382168203610e4057565b35908160020b8203610e4057565b602060409281835280519182918282860152018484015e5f828201840152601f01601f1916010190565b610120600319820112610e40576004356001600160a01b0381168103610e40579160a0602319830112610e405760249160c4359160e4359161010435906001600160401b038211610e405761122191600401611195565b608081019081106001600160401b0382111761134e57604052565b634e487b7160e01b5f52604160045260245ffd5b6101c081019081106001600160401b0382111761134e57604052565b60a081019081106001600160401b0382111761134e57604052565b606081019081106001600160401b0382111761134e57604052565b601f909101601f19168101906001600160401b0382119082101761134e57604052565b359062ffffff82168203610e4057565b91908260a0910312610e40576040516113ff8161137e565b608061144b81839561141081611181565b855261141e60208201611181565b602086015261142f604082016113d7565b6040860152611440606082016112a4565b606086015201611181565b910152565b600201908160021161145e57565b634e487b7160e01b5f52601160045260245ffd5b9190820180921161145e57565b9060405161148c81611333565b9154600281810b8452601882901c900b6020840152603081901c6001600160801b0316604084015260b01c60ff166060830152565b600f0b60016001607f1b0319811461145e575f0390565b9190826040910312610e40576020825192015190565b80516001600160a01b03908116835260208083015182169084015260408083015162ffffff169084015260608083015160020b9084015260809182015116910152565b9061016092611542836060936114ee565b805160020b60a0840152602081015160020b60c0840152604081015160e084015201516101008201526101406101208201525f6101408201520190565b6001600160a01b03918216815291166020820152604081019190915260600190565b9190820391821161145e57565b6001600160401b03811161134e5760051b60200190565b906115cf826115ae565b6115dc60405191826113b4565b82815280926115ed601f19916115ae565b01905f5b8281106115fd57505050565b60209060405161160c81611333565b5f81525f838201525f60408201525f6060820152828285010152016115f1565b8051156116395760200190565b634e487b7160e01b5f52603260045260245ffd5b8051600110156116395760400190565b80518210156116395760209160051b010190565b9081549060181b65ffffff000000169065ffffff0000001916179055565b919082015f61010084830312610e40576116b5604051926116af84611333565b856113e7565b938483526116c560a08201611181565b80602085015260e06116d960c084016112a4565b92836040870152013580151594858203610e40576060015260018060a01b03169060020b92611c4e5750600164ffffffffff1981541617600155606084019261173c845160020b61173761172c85614ef6565b60125460020b61209f565b614f2e565b6014549060ff8260181c165f14611c3b5761175a9160020b9061209f565b945b61176584613378565b61176e85613378565b956040519561177c87611399565b808752602087018181526118d8604089019a888c526118d0600d54956117a06136a5565b956118088c6118036117fa6117db6117d26117c96117c46117bf61480d565b614ea2565b6136c3565b60135490614e80565b60105490614ebe565b6117f46117eb60105480936115a1565b916011546115a1565b90615033565b600d5490615113565b6136d4565b8c929083811315611c2c5761186b9293508981115f14611c275750885b928d60185460020b835160020b8082135f14611c1f5750905b50818a5260145460181c60ff1615611c105761185f9150895160020b61209f565b905b5160020b90614f2e565b60020b60208701525b855160020b966020870197885160020b14155f14611c055760ff60145460181c166118c5836118a68a5160020b613378565b8b516001600160801b039491906118bf9060020b613378565b91614fcc565b1660408801526115a1565b90848861374b565b996118eb6118e68c51611450565b6115c5565b985160020b915160020b9060018060801b03905116906040519261190e84611333565b8352602083015260408201526001606082015261192a8861162c565b526119348761162c565b50805160020b915160020b90604060018060801b0391015116906040519261195b84611333565b835260208301526040820152600260608201526119778661164d565b526119818561164d565b50835b8751811015611a3457611997818961165d565b515160020b60206119a8838b61165d565b51015160020b6001600160801b0360406119c2858d61165d565b51015116836003019182600311611a2057611a1992600195949260ff92604051946119ec86611333565b855260208501526040840152166060820152611a0783611450565b90611a12828b61165d565b528861165d565b5001611984565b634e487b7160e01b89526011600452602489fd5b50611a429293969585613a82565b611a4b8261162c565b516001855260076020526040852090805162ffffff198354169062ffffff16178255611a7e602082015160020b83611671565b60408101518254606090920151600160301b600160b81b031990921660309190911b600160301b600160b01b03161760b09190911b60ff60b01b16179055611ac58261164d565b516002855260076020526040852090805162ffffff198354169062ffffff16178255611af8602082015160020b83611671565b60408101518254606090920151600160301b600160b81b031990921660309190911b600160301b600160b01b03161760b09190911b60ff60b01b16179055835b8351811015611be557611b53611b4d82611450565b8461165d565b518160030180600311611bd1579060019291875260076020526040872090805162ffffff198354169062ffffff16178255611b95602082015160020b83611671565b604081015190825490606060ff60b01b91015160b01b16918560301b8660b01b039060301b16908560301b8660b81b0319161717905501611b38565b634e487b7160e01b87526011600452602487fd5b509291505060405190611bf96020836113b4565b81525f36602083013790565b8b60408801526115a1565b611c199161335b565b90611861565b90509061183e565b611825565b50508087526020870152611874565b611c489160020b9061335b565b9461175c565b925f9250829160015b6015546003018060031161145e57811015611ddc57805f526007602052611c8060405f2061147f565b60408101516001600160801b031680611c9e575b5050600101611c57565b611d279160409160ff6014999598995460181c1691825f14611dce57805160020b925b15611db95760ff6060611ce3611cde602085015160020b95613263565b6114c1565b9201511691845193611cf485611333565b60020b845260020b6020840152600f0b838301526060820152815180938192632d35e7ed60e11b83528c60048401611531565b03815f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165af1918215610e3557600192611d7e925f905f92611d86575b50611d789192613282565b96613282565b93905f611c94565b611d789250611dac915060403d8111611db2575b611da481836113b4565b8101906114d8565b91611d6d565b503d611d9a565b60ff6060611ce3611cde845160020b95613263565b602081015160020b92611cc1565b5091929390947f000000000000000000000000000000000000000000000000000000000000000091611e1860018060a01b0383511630856132c4565b926020830192611e3260018060a01b0385511630846132c4565b945f8113611ed6575b5050848413611e6a575b5050505050604051916020830152604082015260408152611e676060826113b4565b90565b91516001600160a01b039283169216823b15611ed25791611ea6939185809460405196879586948593630b0d9c0960e01b85526004850161157f565b03925af18015610dfc57611ebd575b808080611e45565b611ec88280926113b4565b6101eb5780611eb5565b8480fd5b90516001600160a01b0383811692911690823b15610e4057611f1392855f809460405196879586948593630b0d9c0960e01b85526004850161157f565b03925af18015610e3557611f28575b80611e3b565b611f359195505f906113b4565b5f935f611f22565b60405190611f4a8261137e565b6009546001600160a01b039081168352600a54808216602085015260a081901c62ffffff16604085015260b81c60020b6060840152600b54166080830152565b91909160e06060610100830194611fa28482516114ee565b60208101516001600160a01b031660a0850152604081015160020b60c085015201511515910152565b602081830312610e40578051906001600160401b038211610e40570181601f82011215610e40578051906001600160401b03821161134e576040519261201b601f8401601f1916602001856113b4565b82845260208383010111610e4057815f9260208093018386015e8301015290565b600f91820b910b019060016001607f1b0319821260016001607f1b0383131761145e57565b6084358060020b8103610e405790565b60020b627fffff19811461145e575f0390565b60020b60010190627fffff8213627fffff1983121761145e57565b9060020b9060020b0190627fffff198212627fffff83131761145e57565b5f80549160ff8360081c16613254576010544210613245576120dd61480d565b64ffffffffff600154161015613234575f9260115442101580613229575b612e7e575b509060ff5f5416155f14612e105761211661480d565b9060015461212b64ffffffffff8216846115a1565b64ffffffffff1990911664ffffffffff84161760015560035460025f526007602052946121645f8051602061550383398151915261147f565b9461219c60a06121753660246113e7565b207f0000000000000000000000000000000000000000000000000000000000000000614754565b505050946121a986614841565b608435978860020b90818a14159283610e40578a6121c691614f2e565b905f916121d68d600554906136d4565b5f198a0194908a861161145e575f8f966121f26121f791613a72565b614fac565b80971115911280612e09575b15612cac575050506122249192505160020b9161221e615332565b90614ebe565b955b60018111612c165750612262908a60055561225c670de0b6b3a764000061224f89600254614ebe565b9880612c0d575b05614ef6565b9061209f565b90612c09578761227191614f2e565b9061228d8861173761172c670de0b6b3a76400005f9905614ef6565b9760145460ff8160181c165f14612bf6576122ab9060020b8a61209f565b955b8960ff60145460181c16809b811580612be6575b15612baa57505050612ba6576122d7908361209f565b945b6122e283613378565b986122ec87613378565b908b15612b9d5715612aea5760016123058c8c84615420565b91818060a01b038c1690828060a01b0316038060ff1d9081011891818060801b031661233183826150ca565b928260601b9109151516015b975b60155461234e6118e682611450565b9060018a52600760205261236460408b2061147f565b61236d8361162c565b526123778261162c565b5060028a52600760205261238d60408b2061147f565b6123968361164d565b526123a08261164d565b50895b818110612aa25750506123c1906123bb3660246113e7565b90614afa565b5060145460181c60ff1699908a156129fc576044356001600160a01b03811681036129f857612402906123f3906145cf565b6001600160801b038316611472565b6006549061241a906001600160801b038316906115a1565b916024356001600160a01b03811681036129f4579e6118e69f936124728e969461245d8c9561244b89879a506145cf565b9060801d6001600160801b0316611472565b60809190911d6001600160801b0316906115a1565b9e5b61247f3660246113e7565b906124886136a5565b958361299457505050505060020b80825260208201528260408201525b604081018051909c6125ab916125a391612591916001600160801b031615612985575b6124d33660246113e7565b906124fa6124df6136a5565b976118036117fa6117db6117d26117c96117c46117bf61480d565b88808213156129715750818111156129685750612555815b928d606060185460020b920191825160020b8082135f146129605750905b60020b90818b5260ff60145460181c165f14611c105761185f91508a5160020b61209f565b60020b60208801525b865160020b976020880198895160020b14155f14612956575060ff60145460181c166118c5836118a68a5160020b613378565b878561259e3660246113e7565b61374b565b9e8f51611450565b9b6020825160020b92015160020b9060018060801b0390511690604051926125d284611333565b835260208301526040820152600160608201526125ee8c61162c565b526125f88b61162c565b50805160020b915160020b90604060018060801b0391015116906040519261261f84611333565b8352602083015260408201526002606082015261263b8a61164d565b526126458961164d565b50875b8b518110156126f9578b602061266d83612662818561165d565b515160020b9361165d565b51015160020b8d60406126878560018060801b039361165d565b510151168360030191826003116126e5579260ff6126de938f9360019796604051946126b286611333565b8552602085015260408401521660608201526126d76126d085611450565b809361165d565b528c61165d565b5001612648565b634e487b7160e01b8d52601160045260248dfd5b50612719919293949596999a979a6127123660246113e7565b918a613a82565b6127228761162c565b5160018a52600760205260408a2090805162ffffff198354169062ffffff16178255612755602082015160020b83611671565b60408101518254606090920151600160301b600160b81b031990921660309190911b600160301b600160b01b03161760b09190911b60ff60b01b1617905561279c8761164d565b5160028a52600760205260408a2090805162ffffff198354169062ffffff161782556127cf602082015160020b83611671565b60408101518254606090920151600160301b600160b81b031990921660309190911b600160301b600160b01b03161760b09190911b60ff60b01b16179055885b6015548110156128fc578651811061285957806003018060031161284557906001918b5260076020528a60408120555b0161280f565b634e487b7160e01b8b52601160045260248bfd5b61286b61286582611450565b8961165d565b5181600301806003116128e85790600192918c52600760205260408c2090805162ffffff198354169062ffffff161782556128ad602082015160020b83611671565b604081015190825490606060ff60b01b91015160b01b16918560301b8660b01b039060301b16908560301b8660b81b0319161717905561283f565b634e487b7160e01b8c52601160045260248cfd5b5090919295507f223157ec47d7bd04fa3ed10c0a8adb38faf97b51ec856a777425a2e39253bd739450608093966040519360020b845260020b602084015260020b60408301526060820152a15b6315d7892d60e21b929190565b60408801526115a1565b905090612530565b61255590612512565b9250508b60020b808852602088015261255e565b602085015160020b85526124c8565b838111156129ad5750506129a89450614ca4565b6124a5565b92509350506129e991508c60020b84528960020b60208501526129cf8d613378565b6001600160801b0393906129e28c613378565b9115614fcc565b1660408201526124a5565b8c80fd5b8a80fd5b6024356001600160a01b03811681036129f857612a2f90612a1c906145cf565b608083901d6001600160801b0316611472565b60065490612a4b90608083901d6001600160801b0316906115a1565b916044356001600160a01b03811681036129f4579e6118e69f93612a9c8e9694612a8b8c95612a7c89879a506145cf565b906001600160801b0316611472565b6001600160801b03909116906115a1565b9e612474565b80600301806003116128e857906001918c526007602052612ae360408d20612ad2612acc84611450565b9161147f565b612adc828861165d565b528561165d565b50016123a3565b612af58b8b836153dd565b8a826001600160a01b0380831690821611612b92575b506001600160a01b038316918215612b865760601b600160601b600160e01b0316926001600160a01b03828116929190910316612b4982828661527d565b938215612b725709612b63575b808206151591040161233d565b906001019081612b56575b8880fd5b634e487b7160e01b8c52601260045260248cfd5b62bfc9218b526004601cfd5b8c935090505f612b0b565b5050869761233f565b8680fd5b91989392509081612bd5575b50612bc2575b506122d9565b612bce9196508361335b565b945f612bbc565b905060020b8460020b13155f612bb6565b508060020b8760020b12156122c1565b612c039060020b8a61335b565b956122ad565b8580fd5b89600255612256565b612c1f906136ec565b5f198101818111611a20576121f2612c3691613a72565b808c10612c44575b50612226565b612c59612c52989298615332565b918d615033565b670de0b6b3a76400000390670de0b6b3a76400008211612c9857612c8a612c919392670de0b6b3a764000092614e80565b0590614ebe565b955f612c3e565b634e487b7160e01b8a52601160045260248afd5b9192909115612d0957505083612b6e578a612cc691614f2e565b91612cd2612c52615332565b670de0b6b3a76400000390670de0b6b3a76400008211612c9857612c8a612d039392670de0b6b3a764000092614e80565b95612226565b93509350975050612d2f60125460020b670de0b6b3a76400006002540560020b9061209f565b60185460020b5f9381135f14612dfe57905b6014549260ff8460181c1692835f14612deb57612d61915160020b61209f565b915b829985610e4057612db394612d7b8e612dab96614f2e565b938315612dd857612d8f9160020b9061209f565b915b15612dc3578160020b8160020b135f14612dbc575061335b565b60020b614e5c565b955f9695612226565b905061335b565b8160020b8160020b125f14612dbc575061335b565b612de59160020b9061335b565b91612d91565b612df8915160020b61335b565b91612d63565b505f92508990612d41565b5080612203565b915060ff60145460181c168080612e67575b8115612e47575b50612e38576240000090612949565b63016ccb0760e01b5f5260045ffd5b90501580612e56575b5f612e29565b5060c4358015158114612e50575f80fd5b905060c43580159081158103610e40575090612e22565b600454600e54111561321a5760019060ff1916175f557fe8775e4a58023f399765c3455b45eebcc45ad6b99607a1163f02e1318430970c5f80a1612ed3612ecb60a06121753660246113e7565b505050614841565b601554612ee26118e682611450565b60015f52600760205290612f025f805160206154e383398151915261147f565b612f0b8361162c565b52612f158261162c565b5060025f526007602052612f355f8051602061550383398151915261147f565b612f3e8361164d565b52612f488261164d565b505f5b8181106131e9575050612f63906123bb3660246113e7565b5060145460181c60ff1690811561319e576044356001600160a01b0381168103610e4057612fce918491612fb8906001600160801b0390612fa3906145cf565b16600f0b60018060801b0392600f0b9061203c565b165b60035490612fc93660246113e7565b614ca4565b90604080519290612fdf81856113b4565b60018452601f19015f5b81811061316f575050805160020b6020820191825160020b90604060018060801b0391015116906040519261301d84611333565b835260208301526040820152600160608201526130398461162c565b526130438361162c565b505160020b901561314657608435928360020b8403610e405761308061307a613075613093948761309898509061209f565b613378565b91613378565b9061308c3660246113e7565b9184613a82565b61162c565b5160015f52600760205260405f2090805162ffffff198354169062ffffff161782556130cb602082015160020b83611671565b60408101518254606090920151600160301b600160b81b031990921660309190911b600160301b600160b01b03161760b09190911b60ff60b01b161790555f5b6015546001810180911161145e5781101561313f578061312c600192611450565b5f5260076020525f60408120550161310b565b505f612100565b608435928360020b8403610e405761308061307a6130756130939461225c886130989950612071565b60209060405161317e81611333565b5f81525f838201525f60408201525f606082015282828801015201612fe9565b6024356001600160a01b0381168103610e4057612fce9184916131e3906001600160801b03906131cd906145cf565b6001600160801b039360801d9116600f0b61203c565b16612fba565b80600301908160031161145e576001915f52600760205261321360405f20612ad2612acc84611450565b5001612f4b565b631ed9bcf960e01b5f5260045ffd5b5060ff8116156120fb565b6315d7892d60e21b92505f91508190565b630fc95b4360e01b5f5260045ffd5b636fce6c3960e01b5f5260045ffd5b6001607f1b81101561327557600f0b90565b6335278d125f526004601cfd5b6132a5906132978360801d8260801d01614ed9565b92600f0b90600f0b01614ed9565b60018060801b03169060801b1790565b90816020910312610e40575190565b6001600160a01b039182165f9081529282166020908152604093849020935163789add5560e11b815260048101949094529183916024918391165afa908115610e35575f91613311575090565b90506020813d602011613338575b8161332c602093836113b4565b81010312610e40575190565b3d915061331f565b60020b5f190190627fffff198212627fffff83131761145e57565b600291820b910b0390627fffff198212627fffff83131761145e57565b60020b908160ff1d82810118620d89e881116136925763ffffffff9192600182167001fffcb933bd6fad37aa2d162d1a59400102600160801b189160028116613676575b6004811661365a575b6008811661363e575b60108116613622575b60208116613606575b604081166135ea575b608081166135ce575b61010081166135b2575b6102008116613596575b610400811661357a575b610800811661355e575b6110008116613542575b6120008116613526575b614000811661350a575b61800081166134ee575b6201000081166134d2575b6202000081166134b7575b62040000811661349c575b6208000016613483575b5f1261347b575b0160201c90565b5f1904613474565b6b048a170391f7dc42444e8fa290910260801c9061346d565b6d2216e584f5fa1ea926041bedfe9890920260801c91613463565b916e5d6af8dedb81196699c329225ee6040260801c91613458565b916f09aa508b5b7a84e1c677de54f3e99bc90260801c9161344d565b916f31be135f97d08fd981231505542fcfa60260801c91613442565b916f70d869a156d2a1b890bb3df62baf32f70260801c91613438565b916fa9f746462d870fdf8a65dc1f90e061e50260801c9161342e565b916fd097f3bdfd2022b8845ad8f792aa58250260801c91613424565b916fe7159475a2c29b7443b29c7fa6e889d90260801c9161341a565b916ff3392b0822b70005940c7a398e4b70f30260801c91613410565b916ff987a7253ac413176f2b074cf7815e540260801c91613406565b916ffcbe86c7900a88aedcffc83b479aa3a40260801c916133fc565b916ffe5dee046a99a2a811c461f1969c30530260801c916133f2565b916fff2ea16466c96a3843ec78b326b528610260801c916133e9565b916fff973b41fa98c081472e6896dfb254c00260801c916133e0565b916fffcb9843d60f6159c9db58835c9266440260801c916133d7565b916fffe5caca7e10e4e61c3624eaa0941cd00260801c916133ce565b916ffff2e50f5f656932ef12357cf3c7fdcc0260801c916133c5565b916ffff97272373d413259a46990580e213a0260801c916133bc565b826345c3193d60e11b5f5260045260245ffd5b604051906136b282611399565b5f6040838281528260208201520152565b905f19820191821360011661145e57565b81810392915f13801582851316918412161761145e57565b801561145e575f190190565b60020b9060020b90811561371a57627fffff1981145f1983141661145e570590565b634e487b7160e01b5f52601260045260245ffd5b8181029291811591840414171561145e57565b811561371a570490565b9291909161375761480d565b613764601354809261372e565b906137726010548093611472565b9060115492838311613a46575b61378761480d565b6001810180911161145e576137a49261379f9161372e565b611472565b91808311613a3e575b50808214613a01576137e06137cf6137e6936117f46117eb60105480936115a1565b916117f46117eb60105480936115a1565b906115a1565b936015549384805b6139c0575b5061380a6020613814920194855160020b9061335b565b8560020b906136f8565b918461384b60ff60145460181c1694855f1461398657606085015160020b90818160020b125f1461397f57505b97600d5490615113565b9180613857838561372e565b1161396f575050925b5160020b9461386e856115ae565b9561387c60405197886113b4565b858752601f1961388b876115ae565b015f5b8181106139585750505f905b8682106138ab575050505050505090565b6138b5828961165d565b519060020b905260016138e76138d9846138cf858c61165d565b515160020b61209f565b606086015160020b90614f2e565b9160206138f4828b61165d565b51018360020b9052613939878a613932602061392786613921613917828761165d565b515160020b613378565b9461165d565b51015160020b613378565b9089614fcc565b6040613945838c61165d565b510190838060801b03169052019061389a565b6020906139636136a5565b82828c0101520161388e565b6139799250613741565b92613860565b9050613841565b60608501613997815160020b612071565b60020b8260020b125f146139ad57505b976117fa565b6139bb91505160020b612071565b6139a7565b945f19860186811161145e576139d590615001565b6139de87615001565b036139fb576139ef6139f5916136ec565b956136ec565b806137ee565b946137f3565b505050505050604051613a156020826113b4565b5f81525f805b818110613a2757505090565b602090613a326136a5565b82828601015201613a1b565b91505f6137ad565b83925061377f565b805115158252602080820151908301526040908101516001600160a01b0316910152565b600160ff1b811461145e575f0390565b9392916001600160a01b039182169116818103613f83575b50505f915f5b8451811015613c0d576001600160801b036040613abd838861165d565b51015116613ace575b600101613aa0565b613b7e90604060ff60145460181c16805f14613bf557613aee838961165d565b515160020b905b15613be1576020613b06848a61165d565b51015160020b5b613b2c6001600160801b0384613b23878d61165d565b51015116613263565b60ff6060613b3a878d61165d565b5101511691845193613b4b85611333565b60020b845260020b6020840152600f0b838301526060820152815180948192632d35e7ed60e11b83528860048401611531565b03815f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165af1918215610e3557600192613bc4575b509050613ac6565b613bdb9060403d8111611db257611da481836113b4565b50613bbc565b613beb838961165d565b515160020b613b0d565b6020613c01848a61165d565b51015160020b90613af5565b509190928051905f19820191821161145e57602091613c2b9161165d565b5101516018549060181b65ffffff000000169065ffffff0000001916176018557f0000000000000000000000000000000000000000000000000000000000000000613c8060018060a01b0385511630836132c4565b906020850194613c9a60018060a01b0387511630846132c4565b925f8113613f1c575b848413613ea7575b848112613db4575b5050828212613cc4575b5050509050565b84516001600160a01b039081169591169190823b15613db05760405195632961046560e21b87526004870152838660248183875af195861561074b57849596613d93575b505160209291613d2d916001600160a01b0316908390613d2790613a72565b91614611565b600460405180958193630476982d60e21b83525af1908115613d875750613d58575b80808392613cbd565b613d799060203d602011613d80575b613d7181836113b4565b8101906132b5565b505f613d4f565b503d613d67565b604051903d90823e3d90fd5b84613da29195929394956113b4565b613db057908392915f613d08565b8380fd5b81516001600160a01b03848116939116833b15612ba65760405190632961046560e21b82526004820152868160248183885af18015613e9c57908791613e87575b505080516001600160a01b031680613e73575b50516001600160a01b0316613e6957613e22602091613a72565b915b600460405180948193630476982d60e21b83525af1801561074b57613e4a575b80613cb3565b613e629060203d602011613d8057613d7181836113b4565b505f613e44565b5060208491613e24565b613e819084613d2785613a72565b5f613e08565b81613e91916113b4565b612c0957855f613df5565b6040513d89823e3d90fd5b86516001600160a01b038481169116813b15612ba65785613ee392889283604051809681958294630b0d9c0960e01b845230906004850161157f565b03925af18015613f1157908691613efc575b5050613cab565b81613f06916113b4565b611ed257845f613ef5565b6040513d88823e3d90fd5b81516001600160a01b03908116908416803b15610e4057825f91613f599383604051809681958294630b0d9c0960e01b845230906004850161157f565b03925af18015610e3557613f6e575b50613ca3565b613f7b9195505f906113b4565b5f935f613f68565b60405191613f9083611399565b81108252600160208301526040820152613fc860405191633cf3645360e21b8352613fbe60048401856114ee565b60a4830190613a4e565b6101206101048201525f610124820152602081610144815f60018060a01b037f0000000000000000000000000000000000000000000000000000000000000000165af18015610e355761401c575b80613a9a565b6140349060203d602011613d8057613d7181836113b4565b505f614016565b6101409290916140c391906001600160a01b0361405782611181565b1684526001600160a01b0361406e60208301611181565b16602085015262ffffff614084604083016113d7565b166040850152614096606082016112a4565b60020b60608501526001600160a01b03906140b390608001611181565b16608084015260a0830190613a4e565b6101206101008201525f6101208201520190565b60ff5f54166145c1576141299060a06140f13660246113e7565b207f00000000000000000000000000000000000000000000000000000000000000009061411e8183614754565b949290969150614841565b60145460181c60ff1680156145ae5760185460181c60020b8260020b135b60015f5260076020525f805160206154e38339815191525460020b9082156145a257818460020b12905b156144c05750505050906141ea91602060ff60145460181c16805f146144ac576141a561307560185460181c60020b612084565b604051916141b283611399565b151582526001838301526001600160a01b031660408083019190915251633cf3645360e21b815294859182919060246004840161403b565b03815f6001600160a01b0386165af18015610e3557614479575b61420e9250614754565b50509050925b60c435908115158203610e405762ffffff91610fff9182911561447057165b169116620f42408183020491010360ff60145460181c165f146143c757608082901d5f600f82900b1261438257600354614276916001600160801b031690611472565b6003555b600f82900b5f81126143285750505f805160206154c3833981519152916142ad60609260018060801b03166004546115a1565b6004555b600454600f548110156142e4575b600354906040519260020b835260208301526040820152a163b47b2fb160e01b905f90565b61010061ff00195f5416175f557f628a470bfdde264ef77cd19acfbfca22b3e4413adaf5837ec9fbc0043e35793f602061431c61480d565b604051908152a16142bf565b62ffffff919250614338906114c1565b9116620f42400391620f4240831161145e575f805160206154c38339815191529260609261437a91614372916001600160801b031661518e565b600454611472565b6004556142b1565b61438b906114c1565b62ffffff8216620f42400390620f4240821161145e576143bf916143b7916001600160801b031661518e565b6003546115a1565b60035561427a565b90600f81900b5f811261443357506003546143ec906001600160801b03831690611472565b6003555b60801d905f600f83900b1261442557505f805160206154c38339815191529161437a60609260018060801b03166004546115a1565b9061433862ffffff916114c1565b61443c906114c1565b62ffffff8316620f42400390620f4240821161145e57614468916143b7916001600160801b031661518e565b6003556143f0565b600c1c16614233565b6020833d6020116144a4575b81614492602093836113b4565b81010312610e405761420e9250614204565b3d9150614485565b6141a561307560185460181c60020b613340565b97949392976144d3575b50505050614214565b614534949750906144f0602092825f146145995761307590613340565b604051916144fd83611399565b1582526001838301526001600160a01b031660408083019190915251633cf3645360e21b815294859182919060246004840161403b565b03815f6001600160a01b0386165af18015610e3557614566575b6145589250614754565b50509050925f8080806144ca565b6020833d602011614591575b8161457f602093836113b4565b81010312610e4057614558925061454e565b3d9150614572565b61307590612084565b818460020b1390614171565b60185460181c60020b8260020b12614147565b5063b47b2fb160e01b905f90565b6001600160a01b0316806145e257504790565b6020602491604051928380926370a0823160e01b82523060048301525afa908115610e35575f91613311575090565b9091906001600160a01b038116908161469f5750505f80808093855af1156146365750565b6040516390bfb86560e01b81526001600160a01b0390911660048201525f602482018190526080604483015260a03d601f01601f191690810160648401523d6084840152903d9060a484013e808201600460a482015260c4633d2cec6f60e21b91015260e40190fd5b60205f604481949682604095865198899363a9059cbb60e01b855260018060a01b0316600485015260248401525af13d15601f3d116001855114161716928281528260208201520152156146f05750565b6040516390bfb86560e01b8152600481019190915263a9059cbb60e01b602482015260806044820152601f3d01601f191660a0810160648301523d60848301523d5f60a484013e808201600460a482015260c4633c9fd93960e21b91015260e40190fd5b919060209060405182810191825260066040820152604081526147786060826113b4565b519020604051631e2eaeaf60e01b8152600481019190915292839060249082906001600160a01b03165afa918215610e35575f926147d9575b506001600160a01b0382169160a081901c60020b9162ffffff60b883901c81169260d01c1690565b9091506020813d602011614805575b816147f5602093836113b4565b81010312610e405751905f6147b1565b3d91506147e8565b60105480421061483b5761482461482d91426115a1565b60135490613741565b6001810180911161145e5790565b50600190565b73fffd8963efd1fc6a506488495d951d51639616826401000276a21982016001600160a01b031611614ada57602081901b600160201b600160c01b0316808015610e4057693627a301d71055774c859160ff8260018060801b031060071b83811c60018060401b031060061b1783811c63ffffffff1060051b1783811c61ffff1060041b1783811c821060031b177b01c1818141808140018080c0814100004181408140c0c100414140c160221b6f8421084210842108cc6318c6db6d54be85831c1c601f161a17169160808310155f14614ace5750607e1982011c5b800280607f1c8160ff1c1c800280607f1c8160ff1c1c800280607f1c8160ff1c1c800280607f1c8160ff1c1c800280607f1c8160ff1c1c800280607f1c8160ff1c1c80029081607f1c8260ff1c1c80029283607f1c8460ff1c1c80029485607f1c8660ff1c1c80029687607f1c8860ff1c1c80029889607f1c8a60ff1c1c80029a8b607f1c8c60ff1c1c80029c8d80607f1c9060ff1c1c600160321b90800260cd1c169d600160331b9060cc1c169c600160341b9060cb1c169b600160351b9060ca1c169a600160361b9060c91c1699600160371b9060c81c1698600160381b9060c71c1697600160391b9060c61c16966001603a1b9060c51c16956001603b1b9060c41c16946001603c1b9060c31c16936001603d1b9060c21c16926001603e1b9060c11c16916001603f1b9060c01c1690607f190160401b1717171717171717171717171717026fdb2df09e81959a81455e260799a0632f6f028f6481ab7f045a5af012a19d003aa919820160801d60020b910160801d60020b918282145f14614aaa5750905090565b6001600160a01b0390811690614abf84613378565b1611614ac9575090565b905090565b905081607f031b61491e565b6318521d4960e21b5f9081526001600160a01b0391909116600452602490fd5b91905f905f905f5b8551811015614c8d576001600160801b036040614b1f838961165d565b51015116614b30575b600101614b02565b9192614bdf604060ff60145460181c16805f14614c7557614b51868a61165d565b515160020b905b15614c61576020614b69878b61165d565b51015160020b5b8960ff6060614b9b8a6139216001600160801b0389614b8f848961165d565b51015116600f0b6114c1565b5101511691845193614bac85611333565b60020b845260020b6020840152600f0b838301526060820152815180938192632d35e7ed60e11b83528760048401611531565b03815f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165af1918215610e3557600192614c36925f905f92614c3e575b50614c309192613282565b95613282565b929050614b28565b614c309250614c5b915060403d8111611db257611da481836113b4565b91614c25565b614c6b868a61165d565b515160020b614b70565b6020614c81878b61165d565b51015160020b90614b58565b505091909250614c9f82600654613282565b600655565b9093929193614cb16136a5565b9480614e0457505f5b6001600160a01b031680614cde5750505060020b80835260208301525f6040830152565b919250614de991614d9090606090614d829060b56001600160881b03821160071b82811c6001600160481b031060061b1782811c64ffffffffff1060051b1782811c62ffffff1060041b17600181811c9290921b9083901c62010000010260121c80830401811c80830401811c80830401811c80830401811c80830401811c80830401811c80830401901c908190048111900360301b6001600160a01b0316614841565b940193845160020b90614f2e565b92614dd1602087019460020b9182865260ff60145460181c1692835f14614df15750614dc690865160020b905160020b9061335b565b60020b808852613378565b93516001600160801b0394906129e29060020b613378565b166040830152565b614dff915160020b9061209f565b614dc6565b8160ff60145460181c165f14614e3d5750600654614e3891614e329160801d6001600160801b0316906115a1565b826152fd565b614cba565b600654614e3892614e57916001600160801b0316906115a1565b6152fd565b90670de0b6b3a7640000820291808305670de0b6b3a7640000149015171561145e57565b81810292915f8212600160ff1b82141661145e57818405149015171561145e57565b9060018201915f60018412911290801582169115161761145e57565b9190915f838201938412911290801582169115161761145e57565b9081600f0b918203614ee757565b6393dafdf160e01b5f5260045ffd5b80628000000160181c15614f11576335278d125f526004601cfd5b60020b90565b9060020b9060020b02908160020b91820361145e57565b9060ff60145460181c165f14614f7a575f8260020b125f14614f6d57614f6881614f63614f5e82611e679661335b565b612084565b6136f8565b614f17565b614f6881611e67936136f8565b5f8260020b125f14614f9357614f6881611e67936136f8565b614f6881614f63614fa782611e679661209f565b613340565b6117fa6117db6117d26117c96117c4611e6795614fc761480d565b614ebe565b90929091908015614ffb575f19810190811161145e57915b15614ff257611e6792615420565b611e67926153dd565b91614fe4565b61501c6150136150259261379f61480d565b6013549061372e565b60105490611472565b601154808211614ac9575090565b90670de0b6b3a76400008202905f19670de0b6b3a7640000840992828085109403938085039485841115610e4057146150c357670de0b6b3a764000082910981805f03168092046002816003021880820260020302808202600203028082026002030280820260020302808202600203028091026002030293600183805f03040190848311900302920304170290565b5091500490565b81810291905f1982820991838084109303928084039384600160601b1115610e40571461510a57600160601b910990828211900360a01b910360601c1790565b50505060601c90565b808202905f1983820990828083109203918083039283670de0b6b3a76400001115610e40571461517d577faccb18165bd6fe31ae1cf318dc5b51eee0e1ba569b88cd74c1773b91fac1066993670de0b6b3a7640000910990828211900360ee1b910360121c170290565b5050670de0b6b3a764000091500490565b808202905f1983820990828083109203918083039283620f42401115610e4057146151ee577fde8f6cefed634549b62c77574f722e1ac57e23f24d8fd5cb790fb65668c2613993620f4240910990828211900360fa1b910360061c170290565b5050620f424091500490565b90606082901b905f19600160601b840992828085109403938085039485841115610e4057146150c3578190600160601b900981805f03168092046002816003021880820260020302808202600203028082026002030280820260020302808202600203028091026002030293600183805f03040190848311900302920304170290565b91818302915f1981850993838086109503948086039586851115610e4057146152f5579082910981805f03168092046002816003021880820260020302808202600203028082026002030280820260020302808202600203028091026002030293600183805f03040190848311900302920304170290565b505091500490565b90615307916151fa565b6001600160a01b03811161532d57600160a01b811015613275576001600160a01b031690565b505f90565b615378612dab615348612ecb60a0612175611f3d565b60145460181c60ff16156153ac5760125460020b808260020b135f146153a557505b60125460181c60020b61335b565b61538a614824601154601054906115a1565b90811561371a57600160ff1b81145f1983141661145e570590565b905061536a565b60125460020b808260020b125f146153a5575061536a565b6001600160a01b03918216908216039190821161145e57565b611e67926154159290916001600160a01b038083169082161161541a575b6001600160a01b039161540e91906153c4565b16906151fa565b615474565b906153fb565b611e6792615415929091906001600160a01b038082169083161161546e575b6154676154586001600160a01b038381169085166150ca565b926001600160a01b03926153c4565b169161527d565b9061543f565b6001600160801b0381169190820361548857565b60405162461bcd60e51b81526020600482015260126024820152716c6971756964697479206f766572666c6f7760701b6044820152606490fdfe27db09392d7d230eb65a11bd84925fb8da90df8a067ca8a4fc2933b4f637262bb39221ace053465ec3453ce2b36430bd138b997ecea25c1043da0c366812b828b7c774451310d1be4108bc180d1b52823cb0ee0274a6c0081bcaf94f115fb96da164736f6c634300081a000a";
|
|
@@ -5930,7 +6044,8 @@ var weth9Abi = [
|
|
|
5930
6044
|
stateMutability: "view"
|
|
5931
6045
|
}
|
|
5932
6046
|
];
|
|
5933
|
-
var
|
|
6047
|
+
var rehypeDopplerHookInitializerAbi = [
|
|
6048
|
+
...feesManagerAbi,
|
|
5934
6049
|
{
|
|
5935
6050
|
type: "function",
|
|
5936
6051
|
name: "INITIALIZER",
|
|
@@ -6073,10 +6188,170 @@ var rehypeDopplerHookAbi = [
|
|
|
6073
6188
|
outputs: [{ name: "", type: "address", internalType: "contract Quoter" }],
|
|
6074
6189
|
stateMutability: "view"
|
|
6075
6190
|
},
|
|
6191
|
+
{
|
|
6192
|
+
type: "event",
|
|
6193
|
+
name: "AirlockOwnerFeesClaimed",
|
|
6194
|
+
inputs: [
|
|
6195
|
+
{
|
|
6196
|
+
name: "poolId",
|
|
6197
|
+
type: "bytes32",
|
|
6198
|
+
indexed: true,
|
|
6199
|
+
internalType: "PoolId"
|
|
6200
|
+
},
|
|
6201
|
+
{
|
|
6202
|
+
name: "airlockOwner",
|
|
6203
|
+
type: "address",
|
|
6204
|
+
indexed: true,
|
|
6205
|
+
internalType: "address"
|
|
6206
|
+
},
|
|
6207
|
+
{
|
|
6208
|
+
name: "fees0",
|
|
6209
|
+
type: "uint128",
|
|
6210
|
+
indexed: false,
|
|
6211
|
+
internalType: "uint128"
|
|
6212
|
+
},
|
|
6213
|
+
{
|
|
6214
|
+
name: "fees1",
|
|
6215
|
+
type: "uint128",
|
|
6216
|
+
indexed: false,
|
|
6217
|
+
internalType: "uint128"
|
|
6218
|
+
}
|
|
6219
|
+
],
|
|
6220
|
+
anonymous: false
|
|
6221
|
+
},
|
|
6222
|
+
{
|
|
6223
|
+
type: "event",
|
|
6224
|
+
name: "FeeBeneficiariesSet",
|
|
6225
|
+
inputs: [
|
|
6226
|
+
{
|
|
6227
|
+
name: "poolId",
|
|
6228
|
+
type: "bytes32",
|
|
6229
|
+
indexed: true,
|
|
6230
|
+
internalType: "PoolId"
|
|
6231
|
+
},
|
|
6232
|
+
{
|
|
6233
|
+
name: "beneficiaries",
|
|
6234
|
+
type: "tuple[]",
|
|
6235
|
+
indexed: false,
|
|
6236
|
+
internalType: "struct BeneficiaryData[]",
|
|
6237
|
+
components: [
|
|
6238
|
+
{
|
|
6239
|
+
name: "beneficiary",
|
|
6240
|
+
type: "address",
|
|
6241
|
+
internalType: "address"
|
|
6242
|
+
},
|
|
6243
|
+
{ name: "shares", type: "uint96", internalType: "uint96" }
|
|
6244
|
+
]
|
|
6245
|
+
}
|
|
6246
|
+
],
|
|
6247
|
+
anonymous: false
|
|
6248
|
+
},
|
|
6249
|
+
{
|
|
6250
|
+
type: "event",
|
|
6251
|
+
name: "FeeScheduleSet",
|
|
6252
|
+
inputs: [
|
|
6253
|
+
{
|
|
6254
|
+
name: "poolId",
|
|
6255
|
+
type: "bytes32",
|
|
6256
|
+
indexed: true,
|
|
6257
|
+
internalType: "PoolId"
|
|
6258
|
+
},
|
|
6259
|
+
{
|
|
6260
|
+
name: "startingTime",
|
|
6261
|
+
type: "uint32",
|
|
6262
|
+
indexed: false,
|
|
6263
|
+
internalType: "uint32"
|
|
6264
|
+
},
|
|
6265
|
+
{
|
|
6266
|
+
name: "startFee",
|
|
6267
|
+
type: "uint24",
|
|
6268
|
+
indexed: false,
|
|
6269
|
+
internalType: "uint24"
|
|
6270
|
+
},
|
|
6271
|
+
{
|
|
6272
|
+
name: "endFee",
|
|
6273
|
+
type: "uint24",
|
|
6274
|
+
indexed: false,
|
|
6275
|
+
internalType: "uint24"
|
|
6276
|
+
},
|
|
6277
|
+
{
|
|
6278
|
+
name: "durationSeconds",
|
|
6279
|
+
type: "uint32",
|
|
6280
|
+
indexed: false,
|
|
6281
|
+
internalType: "uint32"
|
|
6282
|
+
}
|
|
6283
|
+
],
|
|
6284
|
+
anonymous: false
|
|
6285
|
+
},
|
|
6286
|
+
{
|
|
6287
|
+
type: "event",
|
|
6288
|
+
name: "FeeUpdated",
|
|
6289
|
+
inputs: [
|
|
6290
|
+
{
|
|
6291
|
+
name: "poolId",
|
|
6292
|
+
type: "bytes32",
|
|
6293
|
+
indexed: true,
|
|
6294
|
+
internalType: "PoolId"
|
|
6295
|
+
},
|
|
6296
|
+
{
|
|
6297
|
+
name: "fee",
|
|
6298
|
+
type: "uint24",
|
|
6299
|
+
indexed: false,
|
|
6300
|
+
internalType: "uint24"
|
|
6301
|
+
}
|
|
6302
|
+
],
|
|
6303
|
+
anonymous: false
|
|
6304
|
+
},
|
|
6305
|
+
{ type: "error", name: "FeeBeneficiariesNotConfigured", inputs: [] },
|
|
6306
|
+
{
|
|
6307
|
+
type: "error",
|
|
6308
|
+
name: "FeeBeneficiariesNotSupportedInDirectBuyback",
|
|
6309
|
+
inputs: []
|
|
6310
|
+
},
|
|
6076
6311
|
{ type: "error", name: "FeeDistributionMustAddUpToWAD", inputs: [] },
|
|
6312
|
+
{
|
|
6313
|
+
type: "error",
|
|
6314
|
+
name: "FeeTooHigh",
|
|
6315
|
+
inputs: [{ name: "fee", type: "uint24", internalType: "uint24" }]
|
|
6316
|
+
},
|
|
6317
|
+
{ type: "error", name: "InsufficientFeeCurrency", inputs: [] },
|
|
6318
|
+
{
|
|
6319
|
+
type: "error",
|
|
6320
|
+
name: "InvalidDurationSeconds",
|
|
6321
|
+
inputs: [
|
|
6322
|
+
{
|
|
6323
|
+
name: "durationSeconds",
|
|
6324
|
+
type: "uint32",
|
|
6325
|
+
internalType: "uint32"
|
|
6326
|
+
}
|
|
6327
|
+
]
|
|
6328
|
+
},
|
|
6329
|
+
{
|
|
6330
|
+
type: "error",
|
|
6331
|
+
name: "InvalidFeeRange",
|
|
6332
|
+
inputs: [
|
|
6333
|
+
{ name: "startFee", type: "uint24", internalType: "uint24" },
|
|
6334
|
+
{ name: "endFee", type: "uint24", internalType: "uint24" }
|
|
6335
|
+
]
|
|
6336
|
+
},
|
|
6337
|
+
{ type: "error", name: "InvalidProtocolOwnerBeneficiary", inputs: [] },
|
|
6338
|
+
{
|
|
6339
|
+
type: "error",
|
|
6340
|
+
name: "InvalidProtocolOwnerShares",
|
|
6341
|
+
inputs: [
|
|
6342
|
+
{ name: "required", type: "uint96", internalType: "uint96" },
|
|
6343
|
+
{ name: "provided", type: "uint96", internalType: "uint96" }
|
|
6344
|
+
]
|
|
6345
|
+
},
|
|
6346
|
+
{ type: "error", name: "InvalidShares", inputs: [] },
|
|
6347
|
+
{ type: "error", name: "InvalidTotalShares", inputs: [] },
|
|
6348
|
+
{ type: "error", name: "PoolAlreadyInitialized", inputs: [] },
|
|
6349
|
+
{ type: "error", name: "Reentrancy", inputs: [] },
|
|
6077
6350
|
{ type: "error", name: "SenderNotAirlockOwner", inputs: [] },
|
|
6078
|
-
{ type: "error", name: "SenderNotInitializer", inputs: [] }
|
|
6351
|
+
{ type: "error", name: "SenderNotInitializer", inputs: [] },
|
|
6352
|
+
{ type: "error", name: "UnorderedBeneficiaries", inputs: [] }
|
|
6079
6353
|
];
|
|
6354
|
+
var rehypeDopplerHookAbi = rehypeDopplerHookInitializerAbi;
|
|
6080
6355
|
var rehypeDopplerHookMigratorAbi = [
|
|
6081
6356
|
{
|
|
6082
6357
|
type: "function",
|
|
@@ -6800,8 +7075,6 @@ function isToken0Expected(numeraire) {
|
|
|
6800
7075
|
return false;
|
|
6801
7076
|
}
|
|
6802
7077
|
}
|
|
6803
|
-
|
|
6804
|
-
// src/evm/utils/beneficiaries.ts
|
|
6805
7078
|
function sortBeneficiaries(beneficiaries) {
|
|
6806
7079
|
const sorted = [...beneficiaries].sort((a, b) => {
|
|
6807
7080
|
const aAddr = a.beneficiary.toLowerCase();
|
|
@@ -6815,62 +7088,369 @@ function sortBeneficiaries(beneficiaries) {
|
|
|
6815
7088
|
);
|
|
6816
7089
|
}
|
|
6817
7090
|
}
|
|
6818
|
-
return sorted;
|
|
7091
|
+
return sorted;
|
|
7092
|
+
}
|
|
7093
|
+
function normalizeBeneficiaries(beneficiaries, label) {
|
|
7094
|
+
const sorted = sortBeneficiaries(beneficiaries);
|
|
7095
|
+
if (!isNonEmpty(sorted)) {
|
|
7096
|
+
throw new Error(`${label} list must not be empty`);
|
|
7097
|
+
}
|
|
7098
|
+
let totalShares = 0n;
|
|
7099
|
+
for (const beneficiary of sorted) {
|
|
7100
|
+
if (!viem.isAddress(beneficiary.beneficiary, { strict: false })) {
|
|
7101
|
+
throw new Error(
|
|
7102
|
+
`${label} address is invalid: ${beneficiary.beneficiary}`
|
|
7103
|
+
);
|
|
7104
|
+
}
|
|
7105
|
+
if (beneficiary.beneficiary.toLowerCase() === viem.zeroAddress) {
|
|
7106
|
+
throw new Error(`${label} address cannot be the zero address`);
|
|
7107
|
+
}
|
|
7108
|
+
if (beneficiary.shares <= 0n) {
|
|
7109
|
+
throw new Error(`${label} shares must be positive`);
|
|
7110
|
+
}
|
|
7111
|
+
totalShares += beneficiary.shares;
|
|
7112
|
+
}
|
|
7113
|
+
if (totalShares !== WAD) {
|
|
7114
|
+
throw new Error(
|
|
7115
|
+
`${label} shares must sum to ${WAD} (100%), but got ${totalShares}`
|
|
7116
|
+
);
|
|
7117
|
+
}
|
|
7118
|
+
return sorted;
|
|
7119
|
+
}
|
|
7120
|
+
function isNonEmpty(values) {
|
|
7121
|
+
return values.length > 0;
|
|
7122
|
+
}
|
|
7123
|
+
|
|
7124
|
+
// src/evm/types.ts
|
|
7125
|
+
var NO_OP_ENABLED_CHAIN_IDS = [
|
|
7126
|
+
CHAIN_IDS.MAINNET,
|
|
7127
|
+
CHAIN_IDS.ETH_SEPOLIA,
|
|
7128
|
+
CHAIN_IDS.BASE,
|
|
7129
|
+
CHAIN_IDS.BASE_SEPOLIA,
|
|
7130
|
+
CHAIN_IDS.UNICHAIN,
|
|
7131
|
+
CHAIN_IDS.UNICHAIN_SEPOLIA,
|
|
7132
|
+
CHAIN_IDS.ROBINHOOD,
|
|
7133
|
+
CHAIN_IDS.MONAD_TESTNET,
|
|
7134
|
+
CHAIN_IDS.MONAD_MAINNET
|
|
7135
|
+
];
|
|
7136
|
+
function isNoOpEnabledChain(chainId) {
|
|
7137
|
+
return NO_OP_ENABLED_CHAIN_IDS.includes(chainId);
|
|
7138
|
+
}
|
|
7139
|
+
var LAUNCHPAD_ENABLED_CHAIN_IDS = [
|
|
7140
|
+
CHAIN_IDS.MAINNET,
|
|
7141
|
+
CHAIN_IDS.BASE,
|
|
7142
|
+
CHAIN_IDS.BASE_SEPOLIA,
|
|
7143
|
+
CHAIN_IDS.ROBINHOOD,
|
|
7144
|
+
CHAIN_IDS.MONAD_MAINNET
|
|
7145
|
+
];
|
|
7146
|
+
function isLaunchpadEnabledChain(chainId) {
|
|
7147
|
+
return LAUNCHPAD_ENABLED_CHAIN_IDS.includes(chainId);
|
|
7148
|
+
}
|
|
7149
|
+
var LockablePoolStatus = /* @__PURE__ */ ((LockablePoolStatus2) => {
|
|
7150
|
+
LockablePoolStatus2[LockablePoolStatus2["Uninitialized"] = 0] = "Uninitialized";
|
|
7151
|
+
LockablePoolStatus2[LockablePoolStatus2["Initialized"] = 1] = "Initialized";
|
|
7152
|
+
LockablePoolStatus2[LockablePoolStatus2["Locked"] = 2] = "Locked";
|
|
7153
|
+
LockablePoolStatus2[LockablePoolStatus2["Exited"] = 3] = "Exited";
|
|
7154
|
+
return LockablePoolStatus2;
|
|
7155
|
+
})(LockablePoolStatus || {});
|
|
7156
|
+
var OpeningAuctionPhase = /* @__PURE__ */ ((OpeningAuctionPhase2) => {
|
|
7157
|
+
OpeningAuctionPhase2[OpeningAuctionPhase2["NotStarted"] = 0] = "NotStarted";
|
|
7158
|
+
OpeningAuctionPhase2[OpeningAuctionPhase2["Active"] = 1] = "Active";
|
|
7159
|
+
OpeningAuctionPhase2[OpeningAuctionPhase2["Closed"] = 2] = "Closed";
|
|
7160
|
+
OpeningAuctionPhase2[OpeningAuctionPhase2["Settled"] = 3] = "Settled";
|
|
7161
|
+
return OpeningAuctionPhase2;
|
|
7162
|
+
})(OpeningAuctionPhase || {});
|
|
7163
|
+
var OpeningAuctionStatus = /* @__PURE__ */ ((OpeningAuctionStatus2) => {
|
|
7164
|
+
OpeningAuctionStatus2[OpeningAuctionStatus2["Uninitialized"] = 0] = "Uninitialized";
|
|
7165
|
+
OpeningAuctionStatus2[OpeningAuctionStatus2["AuctionActive"] = 1] = "AuctionActive";
|
|
7166
|
+
OpeningAuctionStatus2[OpeningAuctionStatus2["DopplerActive"] = 2] = "DopplerActive";
|
|
7167
|
+
OpeningAuctionStatus2[OpeningAuctionStatus2["Exited"] = 3] = "Exited";
|
|
7168
|
+
return OpeningAuctionStatus2;
|
|
7169
|
+
})(OpeningAuctionStatus || {});
|
|
7170
|
+
var RehypeFeeRoutingMode = /* @__PURE__ */ ((RehypeFeeRoutingMode2) => {
|
|
7171
|
+
RehypeFeeRoutingMode2[RehypeFeeRoutingMode2["DirectBuyback"] = 0] = "DirectBuyback";
|
|
7172
|
+
RehypeFeeRoutingMode2[RehypeFeeRoutingMode2["RouteToBeneficiaryFees"] = 1] = "RouteToBeneficiaryFees";
|
|
7173
|
+
return RehypeFeeRoutingMode2;
|
|
7174
|
+
})(RehypeFeeRoutingMode || {});
|
|
7175
|
+
|
|
7176
|
+
// src/evm/utils/rehypeFeeDistribution.ts
|
|
7177
|
+
function resolveRehypeFeeDistributionInfo(config) {
|
|
7178
|
+
const feeDistributionInfo = config.feeDistributionInfo ?? resolveLegacyFeeDistributionInfo(config);
|
|
7179
|
+
validateFeeDistributionInfo(feeDistributionInfo);
|
|
7180
|
+
return feeDistributionInfo;
|
|
7181
|
+
}
|
|
7182
|
+
function resolveLegacyFeeDistributionInfo(config) {
|
|
7183
|
+
const assetBuyback = config.assetBuybackPercentWad;
|
|
7184
|
+
const numeraireBuyback = config.numeraireBuybackPercentWad;
|
|
7185
|
+
const beneficiary = config.beneficiaryPercentWad;
|
|
7186
|
+
const lp = config.lpPercentWad;
|
|
7187
|
+
if (assetBuyback === void 0 || numeraireBuyback === void 0 || beneficiary === void 0 || lp === void 0) {
|
|
7188
|
+
throw new Error(
|
|
7189
|
+
"Rehype feeDistributionInfo is required, or provide all deprecated legacy percentages."
|
|
7190
|
+
);
|
|
7191
|
+
}
|
|
7192
|
+
return {
|
|
7193
|
+
assetFeesToAssetBuybackWad: assetBuyback,
|
|
7194
|
+
assetFeesToNumeraireBuybackWad: numeraireBuyback,
|
|
7195
|
+
assetFeesToBeneficiaryWad: beneficiary,
|
|
7196
|
+
assetFeesToLpWad: lp,
|
|
7197
|
+
numeraireFeesToAssetBuybackWad: assetBuyback,
|
|
7198
|
+
numeraireFeesToNumeraireBuybackWad: numeraireBuyback,
|
|
7199
|
+
numeraireFeesToBeneficiaryWad: beneficiary,
|
|
7200
|
+
numeraireFeesToLpWad: lp
|
|
7201
|
+
};
|
|
7202
|
+
}
|
|
7203
|
+
function validateFeeDistributionInfo(feeDistributionInfo) {
|
|
7204
|
+
if (feeDistributionInfo.assetFeesToAssetBuybackWad < 0n || feeDistributionInfo.assetFeesToNumeraireBuybackWad < 0n || feeDistributionInfo.assetFeesToBeneficiaryWad < 0n || feeDistributionInfo.assetFeesToLpWad < 0n) {
|
|
7205
|
+
throw new Error(
|
|
7206
|
+
"Rehype asset fee distribution cannot contain negative components"
|
|
7207
|
+
);
|
|
7208
|
+
}
|
|
7209
|
+
const assetRowTotal = feeDistributionInfo.assetFeesToAssetBuybackWad + feeDistributionInfo.assetFeesToNumeraireBuybackWad + feeDistributionInfo.assetFeesToBeneficiaryWad + feeDistributionInfo.assetFeesToLpWad;
|
|
7210
|
+
if (assetRowTotal !== WAD) {
|
|
7211
|
+
throw new Error(
|
|
7212
|
+
`Rehype asset fee distribution must sum to ${WAD} (100%), but got ${assetRowTotal}`
|
|
7213
|
+
);
|
|
7214
|
+
}
|
|
7215
|
+
if (feeDistributionInfo.numeraireFeesToAssetBuybackWad < 0n || feeDistributionInfo.numeraireFeesToNumeraireBuybackWad < 0n || feeDistributionInfo.numeraireFeesToBeneficiaryWad < 0n || feeDistributionInfo.numeraireFeesToLpWad < 0n) {
|
|
7216
|
+
throw new Error(
|
|
7217
|
+
"Rehype numeraire fee distribution cannot contain negative components"
|
|
7218
|
+
);
|
|
7219
|
+
}
|
|
7220
|
+
const numeraireRowTotal = feeDistributionInfo.numeraireFeesToAssetBuybackWad + feeDistributionInfo.numeraireFeesToNumeraireBuybackWad + feeDistributionInfo.numeraireFeesToBeneficiaryWad + feeDistributionInfo.numeraireFeesToLpWad;
|
|
7221
|
+
if (numeraireRowTotal !== WAD) {
|
|
7222
|
+
throw new Error(
|
|
7223
|
+
`Rehype numeraire fee distribution must sum to ${WAD} (100%), but got ${numeraireRowTotal}`
|
|
7224
|
+
);
|
|
7225
|
+
}
|
|
7226
|
+
}
|
|
7227
|
+
|
|
7228
|
+
// src/evm/utils/rehypeDopplerHookInitializer.ts
|
|
7229
|
+
function normalizeRehypeDopplerHookInitializerConfig(config) {
|
|
7230
|
+
assertNonZeroAddress(config.hookAddress, "Rehype hookAddress");
|
|
7231
|
+
const feeBeneficiaries = config.feeBeneficiaries;
|
|
7232
|
+
if (feeBeneficiaries !== void 0 && config.buybackDestination !== void 0) {
|
|
7233
|
+
throw new Error(
|
|
7234
|
+
"Rehype buybackDestination and feeBeneficiaries are mutually exclusive"
|
|
7235
|
+
);
|
|
7236
|
+
}
|
|
7237
|
+
const feeDistributionInfo = resolveRehypeFeeDistributionInfo(config);
|
|
7238
|
+
const { startFee, endFee, durationSeconds, startingTime } = normalizeFeeSchedule(config);
|
|
7239
|
+
const feeRoutingMode = feeBeneficiaries !== void 0 ? normalizeBeneficiaryFeeRoutingMode(config.feeRoutingMode) : normalizeFeeRoutingMode(config.feeRoutingMode);
|
|
7240
|
+
const common = {
|
|
7241
|
+
hookAddress: config.hookAddress,
|
|
7242
|
+
startFee,
|
|
7243
|
+
endFee,
|
|
7244
|
+
durationSeconds,
|
|
7245
|
+
startingTime,
|
|
7246
|
+
feeDistributionInfo,
|
|
7247
|
+
graduationCalldata: config.graduationCalldata,
|
|
7248
|
+
graduationMarketCap: config.graduationMarketCap,
|
|
7249
|
+
numerairePrice: config.numerairePrice,
|
|
7250
|
+
farTick: config.farTick
|
|
7251
|
+
};
|
|
7252
|
+
if (feeBeneficiaries !== void 0) {
|
|
7253
|
+
const normalizedBeneficiaries = normalizeBeneficiaries(
|
|
7254
|
+
feeBeneficiaries,
|
|
7255
|
+
"Rehype fee beneficiary"
|
|
7256
|
+
);
|
|
7257
|
+
return {
|
|
7258
|
+
...common,
|
|
7259
|
+
feeBeneficiaries: normalizedBeneficiaries,
|
|
7260
|
+
feeRoutingMode: 1 /* RouteToBeneficiaryFees */
|
|
7261
|
+
};
|
|
7262
|
+
}
|
|
7263
|
+
if (config.buybackDestination === void 0) {
|
|
7264
|
+
throw new Error(
|
|
7265
|
+
"Rehype requires either buybackDestination or feeBeneficiaries"
|
|
7266
|
+
);
|
|
7267
|
+
}
|
|
7268
|
+
assertNonZeroAddress(config.buybackDestination, "Rehype buybackDestination");
|
|
7269
|
+
return {
|
|
7270
|
+
...common,
|
|
7271
|
+
buybackDestination: config.buybackDestination,
|
|
7272
|
+
feeRoutingMode
|
|
7273
|
+
};
|
|
7274
|
+
}
|
|
7275
|
+
function assertNonZeroAddress(address, label) {
|
|
7276
|
+
if (!viem.isAddress(address, { strict: false }) || address.toLowerCase() === ZERO_ADDRESS) {
|
|
7277
|
+
throw new Error(`${label} must be a non-zero address`);
|
|
7278
|
+
}
|
|
7279
|
+
}
|
|
7280
|
+
function normalizeFeeRoutingMode(mode) {
|
|
7281
|
+
if (mode === void 0 || mode === 0 /* DirectBuyback */) {
|
|
7282
|
+
return 0 /* DirectBuyback */;
|
|
7283
|
+
}
|
|
7284
|
+
if (mode === 1 /* RouteToBeneficiaryFees */) {
|
|
7285
|
+
return 1 /* RouteToBeneficiaryFees */;
|
|
7286
|
+
}
|
|
7287
|
+
if (mode === "directBuyback") {
|
|
7288
|
+
return 0 /* DirectBuyback */;
|
|
7289
|
+
}
|
|
7290
|
+
if (mode === "routeToBeneficiaryFees") {
|
|
7291
|
+
return 1 /* RouteToBeneficiaryFees */;
|
|
7292
|
+
}
|
|
7293
|
+
throw new Error("Unsupported Rehype feeRoutingMode");
|
|
7294
|
+
}
|
|
7295
|
+
function normalizeBeneficiaryFeeRoutingMode(mode) {
|
|
7296
|
+
if (mode === void 0 || mode === 1 /* RouteToBeneficiaryFees */ || mode === "routeToBeneficiaryFees") {
|
|
7297
|
+
return 1 /* RouteToBeneficiaryFees */;
|
|
7298
|
+
}
|
|
7299
|
+
throw new Error(
|
|
7300
|
+
"Rehype fee beneficiaries are incompatible with DirectBuyback routing"
|
|
7301
|
+
);
|
|
7302
|
+
}
|
|
7303
|
+
function normalizeFeeSchedule(config) {
|
|
7304
|
+
const maxRehypeFee = DECAY_MAX_START_FEE;
|
|
7305
|
+
const startFeeRaw = config.startFee ?? config.customFee;
|
|
7306
|
+
if (startFeeRaw === void 0) {
|
|
7307
|
+
throw new Error(
|
|
7308
|
+
"Rehype startFee is required, or provide deprecated customFee."
|
|
7309
|
+
);
|
|
7310
|
+
}
|
|
7311
|
+
const startFee = Number(startFeeRaw);
|
|
7312
|
+
const endFee = Number(config.endFee ?? startFee);
|
|
7313
|
+
if (!Number.isInteger(startFee) || startFee < 0 || startFee > maxRehypeFee) {
|
|
7314
|
+
throw new Error(
|
|
7315
|
+
`Rehype startFee must be an integer between 0 and ${maxRehypeFee}`
|
|
7316
|
+
);
|
|
7317
|
+
}
|
|
7318
|
+
if (!Number.isInteger(endFee) || endFee < 0 || endFee > maxRehypeFee) {
|
|
7319
|
+
throw new Error(
|
|
7320
|
+
`Rehype endFee must be an integer between 0 and ${maxRehypeFee}`
|
|
7321
|
+
);
|
|
7322
|
+
}
|
|
7323
|
+
if (startFee < endFee) {
|
|
7324
|
+
throw new Error(
|
|
7325
|
+
`Rehype startFee (${startFee}) must be greater than or equal to endFee (${endFee})`
|
|
7326
|
+
);
|
|
7327
|
+
}
|
|
7328
|
+
const durationRaw = config.durationSeconds ?? (startFee === endFee ? 0 : void 0);
|
|
7329
|
+
if (durationRaw === void 0) {
|
|
7330
|
+
throw new Error(
|
|
7331
|
+
"Rehype durationSeconds must be provided when startFee is greater than endFee."
|
|
7332
|
+
);
|
|
7333
|
+
}
|
|
7334
|
+
const durationSeconds = normalizeUint32(
|
|
7335
|
+
durationRaw,
|
|
7336
|
+
"Rehype durationSeconds"
|
|
7337
|
+
);
|
|
7338
|
+
if (startFee > endFee && durationSeconds === 0) {
|
|
7339
|
+
throw new Error(
|
|
7340
|
+
"Rehype durationSeconds must be greater than 0 when startFee is greater than endFee."
|
|
7341
|
+
);
|
|
7342
|
+
}
|
|
7343
|
+
const startingTimeValue = config.startingTime;
|
|
7344
|
+
const startingTime = startingTimeValue === void 0 ? 0 : normalizeUint32(
|
|
7345
|
+
startingTimeValue instanceof Date ? Math.floor(startingTimeValue.getTime() / 1e3) : startingTimeValue,
|
|
7346
|
+
"Rehype startingTime"
|
|
7347
|
+
);
|
|
7348
|
+
return { startFee, endFee, durationSeconds, startingTime };
|
|
7349
|
+
}
|
|
7350
|
+
function normalizeUint32(value, label) {
|
|
7351
|
+
const normalized = Number(value);
|
|
7352
|
+
if (!Number.isFinite(normalized) || !Number.isInteger(normalized)) {
|
|
7353
|
+
throw new Error(`${label} must be an integer number of seconds`);
|
|
7354
|
+
}
|
|
7355
|
+
if (normalized < 0) {
|
|
7356
|
+
throw new Error(`${label} cannot be negative`);
|
|
7357
|
+
}
|
|
7358
|
+
if (normalized > 4294967295) {
|
|
7359
|
+
throw new Error(`${label} must fit within uint32`);
|
|
7360
|
+
}
|
|
7361
|
+
return normalized;
|
|
7362
|
+
}
|
|
7363
|
+
function encodeRehypeDopplerHookInitializerData(numeraire, config, chainId) {
|
|
7364
|
+
if (chainId === CHAIN_IDS.BASE_SEPOLIA) {
|
|
7365
|
+
return viem.encodeAbiParameters(rehypeInitializerDataAbi, [
|
|
7366
|
+
{
|
|
7367
|
+
numeraire,
|
|
7368
|
+
buybackDst: config.buybackDestination ?? ZERO_ADDRESS,
|
|
7369
|
+
startFee: config.startFee,
|
|
7370
|
+
endFee: config.endFee,
|
|
7371
|
+
durationSeconds: config.durationSeconds,
|
|
7372
|
+
startingTime: config.startingTime,
|
|
7373
|
+
feeRoutingMode: config.feeRoutingMode,
|
|
7374
|
+
feeDistributionInfo: config.feeDistributionInfo,
|
|
7375
|
+
feeBeneficiaries: config.feeBeneficiaries ?? []
|
|
7376
|
+
}
|
|
7377
|
+
]);
|
|
7378
|
+
}
|
|
7379
|
+
if (config.feeBeneficiaries !== void 0) {
|
|
7380
|
+
throw new Error(
|
|
7381
|
+
"Rehype fee beneficiaries are temporarily supported only on Base Sepolia until the remaining initializer deployments are upgraded"
|
|
7382
|
+
);
|
|
7383
|
+
}
|
|
7384
|
+
return viem.encodeAbiParameters(legacyRehypeInitializerDataAbi, [
|
|
7385
|
+
{
|
|
7386
|
+
numeraire,
|
|
7387
|
+
buybackDst: config.buybackDestination,
|
|
7388
|
+
startFee: config.startFee,
|
|
7389
|
+
endFee: config.endFee,
|
|
7390
|
+
durationSeconds: config.durationSeconds,
|
|
7391
|
+
startingTime: config.startingTime,
|
|
7392
|
+
feeRoutingMode: config.feeRoutingMode,
|
|
7393
|
+
feeDistributionInfo: config.feeDistributionInfo
|
|
7394
|
+
}
|
|
7395
|
+
]);
|
|
6819
7396
|
}
|
|
6820
|
-
|
|
6821
|
-
|
|
6822
|
-
|
|
6823
|
-
CHAIN_IDS.MAINNET,
|
|
6824
|
-
CHAIN_IDS.ETH_SEPOLIA,
|
|
6825
|
-
CHAIN_IDS.BASE,
|
|
6826
|
-
CHAIN_IDS.BASE_SEPOLIA,
|
|
6827
|
-
CHAIN_IDS.UNICHAIN,
|
|
6828
|
-
CHAIN_IDS.UNICHAIN_SEPOLIA,
|
|
6829
|
-
CHAIN_IDS.ROBINHOOD,
|
|
6830
|
-
CHAIN_IDS.MONAD_TESTNET,
|
|
6831
|
-
CHAIN_IDS.MONAD_MAINNET
|
|
7397
|
+
var beneficiaryComponents = [
|
|
7398
|
+
{ name: "beneficiary", type: "address" },
|
|
7399
|
+
{ name: "shares", type: "uint96" }
|
|
6832
7400
|
];
|
|
6833
|
-
|
|
6834
|
-
|
|
6835
|
-
}
|
|
6836
|
-
|
|
6837
|
-
|
|
6838
|
-
|
|
6839
|
-
|
|
6840
|
-
|
|
6841
|
-
|
|
7401
|
+
var feeDistributionComponents = [
|
|
7402
|
+
{ name: "assetFeesToAssetBuybackWad", type: "uint256" },
|
|
7403
|
+
{ name: "assetFeesToNumeraireBuybackWad", type: "uint256" },
|
|
7404
|
+
{ name: "assetFeesToBeneficiaryWad", type: "uint256" },
|
|
7405
|
+
{ name: "assetFeesToLpWad", type: "uint256" },
|
|
7406
|
+
{ name: "numeraireFeesToAssetBuybackWad", type: "uint256" },
|
|
7407
|
+
{ name: "numeraireFeesToNumeraireBuybackWad", type: "uint256" },
|
|
7408
|
+
{ name: "numeraireFeesToBeneficiaryWad", type: "uint256" },
|
|
7409
|
+
{ name: "numeraireFeesToLpWad", type: "uint256" }
|
|
7410
|
+
];
|
|
7411
|
+
var legacyRehypeInitializerDataAbi = [
|
|
7412
|
+
{
|
|
7413
|
+
type: "tuple",
|
|
7414
|
+
components: [
|
|
7415
|
+
{ name: "numeraire", type: "address" },
|
|
7416
|
+
{ name: "buybackDst", type: "address" },
|
|
7417
|
+
{ name: "startFee", type: "uint24" },
|
|
7418
|
+
{ name: "endFee", type: "uint24" },
|
|
7419
|
+
{ name: "durationSeconds", type: "uint32" },
|
|
7420
|
+
{ name: "startingTime", type: "uint32" },
|
|
7421
|
+
{ name: "feeRoutingMode", type: "uint8" },
|
|
7422
|
+
{
|
|
7423
|
+
name: "feeDistributionInfo",
|
|
7424
|
+
type: "tuple",
|
|
7425
|
+
components: feeDistributionComponents
|
|
7426
|
+
}
|
|
7427
|
+
]
|
|
7428
|
+
}
|
|
7429
|
+
];
|
|
7430
|
+
var rehypeInitializerDataAbi = [
|
|
7431
|
+
{
|
|
7432
|
+
type: "tuple",
|
|
7433
|
+
components: [
|
|
7434
|
+
{ name: "numeraire", type: "address" },
|
|
7435
|
+
{ name: "buybackDst", type: "address" },
|
|
7436
|
+
{ name: "startFee", type: "uint24" },
|
|
7437
|
+
{ name: "endFee", type: "uint24" },
|
|
7438
|
+
{ name: "durationSeconds", type: "uint32" },
|
|
7439
|
+
{ name: "startingTime", type: "uint32" },
|
|
7440
|
+
{ name: "feeRoutingMode", type: "uint8" },
|
|
7441
|
+
{
|
|
7442
|
+
name: "feeDistributionInfo",
|
|
7443
|
+
type: "tuple",
|
|
7444
|
+
components: feeDistributionComponents
|
|
7445
|
+
},
|
|
7446
|
+
{
|
|
7447
|
+
name: "feeBeneficiaries",
|
|
7448
|
+
type: "tuple[]",
|
|
7449
|
+
components: beneficiaryComponents
|
|
7450
|
+
}
|
|
7451
|
+
]
|
|
7452
|
+
}
|
|
6842
7453
|
];
|
|
6843
|
-
function isLaunchpadEnabledChain(chainId) {
|
|
6844
|
-
return LAUNCHPAD_ENABLED_CHAIN_IDS.includes(chainId);
|
|
6845
|
-
}
|
|
6846
|
-
var LockablePoolStatus = /* @__PURE__ */ ((LockablePoolStatus2) => {
|
|
6847
|
-
LockablePoolStatus2[LockablePoolStatus2["Uninitialized"] = 0] = "Uninitialized";
|
|
6848
|
-
LockablePoolStatus2[LockablePoolStatus2["Initialized"] = 1] = "Initialized";
|
|
6849
|
-
LockablePoolStatus2[LockablePoolStatus2["Locked"] = 2] = "Locked";
|
|
6850
|
-
LockablePoolStatus2[LockablePoolStatus2["Exited"] = 3] = "Exited";
|
|
6851
|
-
return LockablePoolStatus2;
|
|
6852
|
-
})(LockablePoolStatus || {});
|
|
6853
|
-
var OpeningAuctionPhase = /* @__PURE__ */ ((OpeningAuctionPhase2) => {
|
|
6854
|
-
OpeningAuctionPhase2[OpeningAuctionPhase2["NotStarted"] = 0] = "NotStarted";
|
|
6855
|
-
OpeningAuctionPhase2[OpeningAuctionPhase2["Active"] = 1] = "Active";
|
|
6856
|
-
OpeningAuctionPhase2[OpeningAuctionPhase2["Closed"] = 2] = "Closed";
|
|
6857
|
-
OpeningAuctionPhase2[OpeningAuctionPhase2["Settled"] = 3] = "Settled";
|
|
6858
|
-
return OpeningAuctionPhase2;
|
|
6859
|
-
})(OpeningAuctionPhase || {});
|
|
6860
|
-
var OpeningAuctionStatus = /* @__PURE__ */ ((OpeningAuctionStatus2) => {
|
|
6861
|
-
OpeningAuctionStatus2[OpeningAuctionStatus2["Uninitialized"] = 0] = "Uninitialized";
|
|
6862
|
-
OpeningAuctionStatus2[OpeningAuctionStatus2["AuctionActive"] = 1] = "AuctionActive";
|
|
6863
|
-
OpeningAuctionStatus2[OpeningAuctionStatus2["DopplerActive"] = 2] = "DopplerActive";
|
|
6864
|
-
OpeningAuctionStatus2[OpeningAuctionStatus2["Exited"] = 3] = "Exited";
|
|
6865
|
-
return OpeningAuctionStatus2;
|
|
6866
|
-
})(OpeningAuctionStatus || {});
|
|
6867
|
-
var RehypeFeeRoutingMode = /* @__PURE__ */ ((RehypeFeeRoutingMode2) => {
|
|
6868
|
-
RehypeFeeRoutingMode2[RehypeFeeRoutingMode2["DirectBuyback"] = 0] = "DirectBuyback";
|
|
6869
|
-
RehypeFeeRoutingMode2[RehypeFeeRoutingMode2["RouteToBeneficiaryFees"] = 1] = "RouteToBeneficiaryFees";
|
|
6870
|
-
return RehypeFeeRoutingMode2;
|
|
6871
|
-
})(RehypeFeeRoutingMode || {});
|
|
6872
|
-
|
|
6873
|
-
// src/evm/utils/dopplerHookMigrator.ts
|
|
6874
7454
|
function normalizeRehypeFeeRoutingMode(mode) {
|
|
6875
7455
|
if (mode === void 0 || mode === 0 /* DirectBuyback */) {
|
|
6876
7456
|
return 0 /* DirectBuyback */;
|
|
@@ -6888,7 +7468,7 @@ function normalizeRehypeFeeRoutingMode(mode) {
|
|
|
6888
7468
|
"Rehype feeRoutingMode must be DirectBuyback/directBuyback or RouteToBeneficiaryFees/routeToBeneficiaryFees"
|
|
6889
7469
|
);
|
|
6890
7470
|
}
|
|
6891
|
-
function
|
|
7471
|
+
function resolveRehypeFeeDistributionInfo2(config) {
|
|
6892
7472
|
if (config.feeDistributionInfo) {
|
|
6893
7473
|
return config.feeDistributionInfo;
|
|
6894
7474
|
}
|
|
@@ -6933,7 +7513,7 @@ function normalizeRehypeDopplerHookMigratorConfig(config) {
|
|
|
6933
7513
|
if (config.customFee > 1e6) {
|
|
6934
7514
|
throw new Error("Rehype customFee must be <= 1000000 (100%)");
|
|
6935
7515
|
}
|
|
6936
|
-
const feeDistributionInfo =
|
|
7516
|
+
const feeDistributionInfo = resolveRehypeFeeDistributionInfo2(config);
|
|
6937
7517
|
validateRehypeFeeDistributionInfo(feeDistributionInfo);
|
|
6938
7518
|
return {
|
|
6939
7519
|
buybackDestination: config.buybackDestination,
|
|
@@ -10108,68 +10688,6 @@ var DopplerFactory = class {
|
|
|
10108
10688
|
}
|
|
10109
10689
|
return normalized;
|
|
10110
10690
|
}
|
|
10111
|
-
normalizeRehypeStartingTime(value, label) {
|
|
10112
|
-
if (value === void 0) return 0;
|
|
10113
|
-
if (value instanceof Date) {
|
|
10114
|
-
return this.normalizeUint32(Math.floor(value.getTime() / 1e3), label);
|
|
10115
|
-
}
|
|
10116
|
-
return this.normalizeUint32(value, label);
|
|
10117
|
-
}
|
|
10118
|
-
normalizeRehypeFeeRoutingMode(mode) {
|
|
10119
|
-
if (mode === void 0 || mode === 0 /* DirectBuyback */) {
|
|
10120
|
-
return 0 /* DirectBuyback */;
|
|
10121
|
-
}
|
|
10122
|
-
if (mode === 1 /* RouteToBeneficiaryFees */) {
|
|
10123
|
-
return 1 /* RouteToBeneficiaryFees */;
|
|
10124
|
-
}
|
|
10125
|
-
if (mode === "directBuyback") {
|
|
10126
|
-
return 0 /* DirectBuyback */;
|
|
10127
|
-
}
|
|
10128
|
-
if (mode === "routeToBeneficiaryFees") {
|
|
10129
|
-
return 1 /* RouteToBeneficiaryFees */;
|
|
10130
|
-
}
|
|
10131
|
-
throw new Error(
|
|
10132
|
-
"Rehype feeRoutingMode must be DirectBuyback/directBuyback or RouteToBeneficiaryFees/routeToBeneficiaryFees"
|
|
10133
|
-
);
|
|
10134
|
-
}
|
|
10135
|
-
resolveRehypeFeeDistributionInfo(config) {
|
|
10136
|
-
if (config.feeDistributionInfo) {
|
|
10137
|
-
return config.feeDistributionInfo;
|
|
10138
|
-
}
|
|
10139
|
-
const assetBuyback = config.assetBuybackPercentWad;
|
|
10140
|
-
const numeraireBuyback = config.numeraireBuybackPercentWad;
|
|
10141
|
-
const beneficiary = config.beneficiaryPercentWad;
|
|
10142
|
-
const lp = config.lpPercentWad;
|
|
10143
|
-
if (assetBuyback === void 0 || numeraireBuyback === void 0 || beneficiary === void 0 || lp === void 0) {
|
|
10144
|
-
throw new Error(
|
|
10145
|
-
"Rehype feeDistributionInfo is required, or provide all deprecated legacy percentages."
|
|
10146
|
-
);
|
|
10147
|
-
}
|
|
10148
|
-
return {
|
|
10149
|
-
assetFeesToAssetBuybackWad: assetBuyback,
|
|
10150
|
-
assetFeesToNumeraireBuybackWad: numeraireBuyback,
|
|
10151
|
-
assetFeesToBeneficiaryWad: beneficiary,
|
|
10152
|
-
assetFeesToLpWad: lp,
|
|
10153
|
-
numeraireFeesToAssetBuybackWad: assetBuyback,
|
|
10154
|
-
numeraireFeesToNumeraireBuybackWad: numeraireBuyback,
|
|
10155
|
-
numeraireFeesToBeneficiaryWad: beneficiary,
|
|
10156
|
-
numeraireFeesToLpWad: lp
|
|
10157
|
-
};
|
|
10158
|
-
}
|
|
10159
|
-
validateRehypeFeeDistributionInfo(feeDistributionInfo) {
|
|
10160
|
-
const assetRowTotal = feeDistributionInfo.assetFeesToAssetBuybackWad + feeDistributionInfo.assetFeesToNumeraireBuybackWad + feeDistributionInfo.assetFeesToBeneficiaryWad + feeDistributionInfo.assetFeesToLpWad;
|
|
10161
|
-
if (assetRowTotal !== WAD) {
|
|
10162
|
-
throw new Error(
|
|
10163
|
-
`Rehype asset fee distribution must sum to ${WAD} (100%), but got ${assetRowTotal}`
|
|
10164
|
-
);
|
|
10165
|
-
}
|
|
10166
|
-
const numeraireRowTotal = feeDistributionInfo.numeraireFeesToAssetBuybackWad + feeDistributionInfo.numeraireFeesToNumeraireBuybackWad + feeDistributionInfo.numeraireFeesToBeneficiaryWad + feeDistributionInfo.numeraireFeesToLpWad;
|
|
10167
|
-
if (numeraireRowTotal !== WAD) {
|
|
10168
|
-
throw new Error(
|
|
10169
|
-
`Rehype numeraire fee distribution must sum to ${WAD} (100%), but got ${numeraireRowTotal}`
|
|
10170
|
-
);
|
|
10171
|
-
}
|
|
10172
|
-
}
|
|
10173
10691
|
validateV4StreamableFeesConfig(streamableFees, label, required = false) {
|
|
10174
10692
|
if (!streamableFees) {
|
|
10175
10693
|
if (required) {
|
|
@@ -10218,69 +10736,6 @@ var DopplerFactory = class {
|
|
|
10218
10736
|
);
|
|
10219
10737
|
}
|
|
10220
10738
|
}
|
|
10221
|
-
normalizeRehypeHookConfig(config) {
|
|
10222
|
-
const MAX_REHYPE_FEE = 1e6;
|
|
10223
|
-
const startFeeRaw = config.startFee ?? config.customFee;
|
|
10224
|
-
if (startFeeRaw === void 0) {
|
|
10225
|
-
throw new Error(
|
|
10226
|
-
"Rehype startFee is required, or provide deprecated customFee."
|
|
10227
|
-
);
|
|
10228
|
-
}
|
|
10229
|
-
const endFeeRaw = config.endFee ?? startFeeRaw;
|
|
10230
|
-
const startFee = Number(startFeeRaw);
|
|
10231
|
-
const endFee = Number(endFeeRaw);
|
|
10232
|
-
if (!Number.isInteger(startFee) || startFee < 0 || startFee > MAX_REHYPE_FEE) {
|
|
10233
|
-
throw new Error(
|
|
10234
|
-
`Rehype startFee must be an integer between 0 and ${MAX_REHYPE_FEE}`
|
|
10235
|
-
);
|
|
10236
|
-
}
|
|
10237
|
-
if (!Number.isInteger(endFee) || endFee < 0 || endFee > MAX_REHYPE_FEE) {
|
|
10238
|
-
throw new Error(
|
|
10239
|
-
`Rehype endFee must be an integer between 0 and ${MAX_REHYPE_FEE}`
|
|
10240
|
-
);
|
|
10241
|
-
}
|
|
10242
|
-
if (startFee < endFee) {
|
|
10243
|
-
throw new Error(
|
|
10244
|
-
`Rehype startFee (${startFee}) must be greater than or equal to endFee (${endFee})`
|
|
10245
|
-
);
|
|
10246
|
-
}
|
|
10247
|
-
const durationRaw = config.durationSeconds ?? (startFee === endFee ? 0 : void 0);
|
|
10248
|
-
if (durationRaw === void 0) {
|
|
10249
|
-
throw new Error(
|
|
10250
|
-
"Rehype durationSeconds must be provided when startFee is greater than endFee."
|
|
10251
|
-
);
|
|
10252
|
-
}
|
|
10253
|
-
const durationSeconds = this.normalizeUint32(
|
|
10254
|
-
durationRaw,
|
|
10255
|
-
"Rehype durationSeconds"
|
|
10256
|
-
);
|
|
10257
|
-
if (startFee > endFee && durationSeconds <= 0) {
|
|
10258
|
-
throw new Error(
|
|
10259
|
-
"Rehype durationSeconds must be greater than 0 when startFee is greater than endFee."
|
|
10260
|
-
);
|
|
10261
|
-
}
|
|
10262
|
-
const startingTime = this.normalizeRehypeStartingTime(
|
|
10263
|
-
config.startingTime,
|
|
10264
|
-
"Rehype startingTime"
|
|
10265
|
-
);
|
|
10266
|
-
const feeRoutingMode = this.normalizeRehypeFeeRoutingMode(
|
|
10267
|
-
config.feeRoutingMode
|
|
10268
|
-
);
|
|
10269
|
-
const feeDistributionInfo = this.resolveRehypeFeeDistributionInfo(config);
|
|
10270
|
-
this.validateRehypeFeeDistributionInfo(feeDistributionInfo);
|
|
10271
|
-
return {
|
|
10272
|
-
hookAddress: config.hookAddress,
|
|
10273
|
-
buybackDestination: config.buybackDestination,
|
|
10274
|
-
startFee,
|
|
10275
|
-
endFee,
|
|
10276
|
-
durationSeconds,
|
|
10277
|
-
startingTime,
|
|
10278
|
-
feeRoutingMode,
|
|
10279
|
-
feeDistributionInfo,
|
|
10280
|
-
graduationCalldata: config.graduationCalldata,
|
|
10281
|
-
farTick: config.farTick
|
|
10282
|
-
};
|
|
10283
|
-
}
|
|
10284
10739
|
resolveMulticurveInitializerMode(params) {
|
|
10285
10740
|
const legacySchedule = params.schedule;
|
|
10286
10741
|
const legacyHook = params.dopplerHook;
|
|
@@ -10438,14 +10893,16 @@ var DopplerFactory = class {
|
|
|
10438
10893
|
const useScheduledInitializer = initializerMode.type === "scheduled";
|
|
10439
10894
|
const useDecayInitializer = initializerMode.type === "decay";
|
|
10440
10895
|
const useDopplerHookInitializer = initializerMode.type === "rehype";
|
|
10441
|
-
const normalizedRehypeHookConfig = initializerMode.type === "rehype" && initializerMode.hookConfig ?
|
|
10896
|
+
const normalizedRehypeHookConfig = initializerMode.type === "rehype" && initializerMode.hookConfig ? normalizeRehypeDopplerHookInitializerConfig(
|
|
10897
|
+
initializerMode.hookConfig
|
|
10898
|
+
) : void 0;
|
|
10442
10899
|
const curveComponents = [
|
|
10443
10900
|
{ type: "int24", name: "tickLower" },
|
|
10444
10901
|
{ type: "int24", name: "tickUpper" },
|
|
10445
10902
|
{ type: "uint16", name: "numPositions" },
|
|
10446
10903
|
{ type: "uint256", name: "shares" }
|
|
10447
10904
|
];
|
|
10448
|
-
const
|
|
10905
|
+
const beneficiaryComponents2 = [
|
|
10449
10906
|
{ type: "address", name: "beneficiary" },
|
|
10450
10907
|
{ type: "uint96", name: "shares" }
|
|
10451
10908
|
];
|
|
@@ -10478,44 +10935,10 @@ var DopplerFactory = class {
|
|
|
10478
10935
|
let dopplerHookAddress = ZERO_ADDRESS;
|
|
10479
10936
|
if (hookConfig) {
|
|
10480
10937
|
dopplerHookAddress = hookConfig.hookAddress;
|
|
10481
|
-
|
|
10482
|
-
|
|
10483
|
-
|
|
10484
|
-
|
|
10485
|
-
{ name: "assetFeesToLpWad", type: "uint256" },
|
|
10486
|
-
{ name: "numeraireFeesToAssetBuybackWad", type: "uint256" },
|
|
10487
|
-
{ name: "numeraireFeesToNumeraireBuybackWad", type: "uint256" },
|
|
10488
|
-
{ name: "numeraireFeesToBeneficiaryWad", type: "uint256" },
|
|
10489
|
-
{ name: "numeraireFeesToLpWad", type: "uint256" }
|
|
10490
|
-
];
|
|
10491
|
-
const rehypeInitDataComponents = [
|
|
10492
|
-
{ name: "numeraire", type: "address" },
|
|
10493
|
-
{ name: "buybackDst", type: "address" },
|
|
10494
|
-
{ name: "startFee", type: "uint24" },
|
|
10495
|
-
{ name: "endFee", type: "uint24" },
|
|
10496
|
-
{ name: "durationSeconds", type: "uint32" },
|
|
10497
|
-
{ name: "startingTime", type: "uint32" },
|
|
10498
|
-
{ name: "feeRoutingMode", type: "uint8" },
|
|
10499
|
-
{
|
|
10500
|
-
name: "feeDistributionInfo",
|
|
10501
|
-
type: "tuple",
|
|
10502
|
-
components: feeDistributionComponents
|
|
10503
|
-
}
|
|
10504
|
-
];
|
|
10505
|
-
onInitializationDopplerHookCalldata = viem.encodeAbiParameters(
|
|
10506
|
-
[{ type: "tuple", components: rehypeInitDataComponents }],
|
|
10507
|
-
[
|
|
10508
|
-
{
|
|
10509
|
-
numeraire: params.sale.numeraire,
|
|
10510
|
-
buybackDst: hookConfig.buybackDestination,
|
|
10511
|
-
startFee: hookConfig.startFee,
|
|
10512
|
-
endFee: hookConfig.endFee,
|
|
10513
|
-
durationSeconds: hookConfig.durationSeconds,
|
|
10514
|
-
startingTime: hookConfig.startingTime,
|
|
10515
|
-
feeRoutingMode: hookConfig.feeRoutingMode,
|
|
10516
|
-
feeDistributionInfo: hookConfig.feeDistributionInfo
|
|
10517
|
-
}
|
|
10518
|
-
]
|
|
10938
|
+
onInitializationDopplerHookCalldata = encodeRehypeDopplerHookInitializerData(
|
|
10939
|
+
params.sale.numeraire,
|
|
10940
|
+
hookConfig,
|
|
10941
|
+
this.chainId
|
|
10519
10942
|
);
|
|
10520
10943
|
graduationDopplerHookCalldata = hookConfig.graduationCalldata ?? "0x";
|
|
10521
10944
|
}
|
|
@@ -10527,7 +10950,7 @@ var DopplerFactory = class {
|
|
|
10527
10950
|
{
|
|
10528
10951
|
name: "beneficiaries",
|
|
10529
10952
|
type: "tuple[]",
|
|
10530
|
-
components:
|
|
10953
|
+
components: beneficiaryComponents2
|
|
10531
10954
|
},
|
|
10532
10955
|
{ name: "dopplerHook", type: "address" },
|
|
10533
10956
|
{ name: "onInitializationDopplerHookCalldata", type: "bytes" },
|
|
@@ -10558,7 +10981,7 @@ var DopplerFactory = class {
|
|
|
10558
10981
|
{
|
|
10559
10982
|
name: "beneficiaries",
|
|
10560
10983
|
type: "tuple[]",
|
|
10561
|
-
components:
|
|
10984
|
+
components: beneficiaryComponents2
|
|
10562
10985
|
},
|
|
10563
10986
|
{ name: "startingTime", type: "uint32" }
|
|
10564
10987
|
];
|
|
@@ -10592,7 +11015,7 @@ var DopplerFactory = class {
|
|
|
10592
11015
|
{
|
|
10593
11016
|
name: "beneficiaries",
|
|
10594
11017
|
type: "tuple[]",
|
|
10595
|
-
components:
|
|
11018
|
+
components: beneficiaryComponents2
|
|
10596
11019
|
},
|
|
10597
11020
|
{ name: "startingTime", type: "uint32" }
|
|
10598
11021
|
];
|
|
@@ -10616,7 +11039,7 @@ var DopplerFactory = class {
|
|
|
10616
11039
|
{
|
|
10617
11040
|
name: "beneficiaries",
|
|
10618
11041
|
type: "tuple[]",
|
|
10619
|
-
components:
|
|
11042
|
+
components: beneficiaryComponents2
|
|
10620
11043
|
}
|
|
10621
11044
|
];
|
|
10622
11045
|
poolInitializerData = viem.encodeAbiParameters(
|
|
@@ -12096,8 +12519,9 @@ var DopplerFactory = class {
|
|
|
12096
12519
|
});
|
|
12097
12520
|
}
|
|
12098
12521
|
const numeraire = params.sale.numeraire;
|
|
12099
|
-
const
|
|
12100
|
-
const
|
|
12522
|
+
const tokenIsCurrency0 = BigInt(tokenAddress) < BigInt(numeraire);
|
|
12523
|
+
const currency0 = tokenIsCurrency0 ? tokenAddress : numeraire;
|
|
12524
|
+
const currency1 = tokenIsCurrency0 ? numeraire : tokenAddress;
|
|
12101
12525
|
const fee = initializerMode.type === "decay" || initializerMode.type === "rehype" && initializerMode.hookConfig ? DYNAMIC_FEE_FLAG : params.pool.fee;
|
|
12102
12526
|
return this.computePoolId({
|
|
12103
12527
|
currency0,
|
|
@@ -13398,8 +13822,12 @@ function getTokenBatchSize(tokenBatchSize) {
|
|
|
13398
13822
|
return tokenBatchSize;
|
|
13399
13823
|
}
|
|
13400
13824
|
|
|
13401
|
-
// src/evm/entities/auction/
|
|
13402
|
-
var
|
|
13825
|
+
// src/evm/entities/auction/RehypeDopplerHookInitializer.ts
|
|
13826
|
+
var rehypeFeesManagerAbi = [
|
|
13827
|
+
...feesManagerAbi,
|
|
13828
|
+
{ type: "error", name: "FeeBeneficiariesNotConfigured", inputs: [] }
|
|
13829
|
+
];
|
|
13830
|
+
var RehypeDopplerHookInitializer = class {
|
|
13403
13831
|
client;
|
|
13404
13832
|
walletClient;
|
|
13405
13833
|
hookAddress;
|
|
@@ -13415,37 +13843,84 @@ var RehypeDopplerHook = class {
|
|
|
13415
13843
|
return this.hookAddress;
|
|
13416
13844
|
}
|
|
13417
13845
|
async collectFees(asset) {
|
|
13418
|
-
|
|
13419
|
-
|
|
13420
|
-
|
|
13846
|
+
const walletClient = this.requireWalletClient(
|
|
13847
|
+
"Wallet client required to collect rehype fees"
|
|
13848
|
+
);
|
|
13421
13849
|
const { request, result } = await this.rpc.simulateContract({
|
|
13422
13850
|
address: this.hookAddress,
|
|
13423
|
-
abi:
|
|
13851
|
+
abi: rehypeDopplerHookInitializerAbi,
|
|
13424
13852
|
functionName: "collectFees",
|
|
13425
13853
|
args: [asset],
|
|
13426
|
-
account:
|
|
13854
|
+
account: walletClient.account
|
|
13427
13855
|
});
|
|
13428
|
-
const hash = await
|
|
13856
|
+
const hash = await walletClient.writeContract(request);
|
|
13429
13857
|
await this.rpc.waitForTransactionReceipt({ hash, confirmations: 1 });
|
|
13430
13858
|
const decoded = decodeBalanceDelta(result);
|
|
13431
|
-
return {
|
|
13432
|
-
amount0: decoded.amount0,
|
|
13433
|
-
amount1: decoded.amount1,
|
|
13434
|
-
transactionHash: hash
|
|
13435
|
-
};
|
|
13859
|
+
return { ...decoded, transactionHash: hash };
|
|
13436
13860
|
}
|
|
13437
|
-
|
|
13438
|
-
|
|
13439
|
-
|
|
13861
|
+
/**
|
|
13862
|
+
* Collect fees and release the caller's pending beneficiary share.
|
|
13863
|
+
*
|
|
13864
|
+
* @returns The FeesManager `collectFees` return values and transaction hash.
|
|
13865
|
+
* The fee amounts are newly collected pool fees, not necessarily the caller's
|
|
13866
|
+
* beneficiary payout.
|
|
13867
|
+
*/
|
|
13868
|
+
async claimFees(poolId) {
|
|
13869
|
+
const walletClient = this.requireWalletClient(
|
|
13870
|
+
"Wallet client required to claim rehype beneficiary fees"
|
|
13871
|
+
);
|
|
13872
|
+
const { request, result } = await this.rpc.simulateContract({
|
|
13873
|
+
address: this.hookAddress,
|
|
13874
|
+
abi: rehypeFeesManagerAbi,
|
|
13875
|
+
functionName: "collectFees",
|
|
13876
|
+
args: [poolId],
|
|
13877
|
+
account: walletClient.account
|
|
13878
|
+
});
|
|
13879
|
+
const hash = await walletClient.writeContract(request);
|
|
13880
|
+
await this.rpc.waitForTransactionReceipt({ hash, confirmations: 1 });
|
|
13881
|
+
const [fees0, fees1] = result;
|
|
13882
|
+
return { fees0, fees1, transactionHash: hash };
|
|
13883
|
+
}
|
|
13884
|
+
async getPendingFees(poolId, beneficiary) {
|
|
13885
|
+
const calls = createPendingFeePreviewCalls(
|
|
13886
|
+
this.hookAddress,
|
|
13887
|
+
poolId,
|
|
13888
|
+
beneficiary
|
|
13889
|
+
);
|
|
13890
|
+
return calculatePendingFees(await callAggregate3(this.rpc, calls));
|
|
13891
|
+
}
|
|
13892
|
+
async updateBeneficiary(poolId, newBeneficiary) {
|
|
13893
|
+
if (newBeneficiary.toLowerCase() === ZERO_ADDRESS) {
|
|
13894
|
+
throw new Error(
|
|
13895
|
+
"Rehype beneficiary cannot be updated to the zero address"
|
|
13896
|
+
);
|
|
13440
13897
|
}
|
|
13898
|
+
const walletClient = this.requireWalletClient(
|
|
13899
|
+
"Wallet client required to update rehype beneficiary"
|
|
13900
|
+
);
|
|
13901
|
+
const { request } = await this.rpc.simulateContract({
|
|
13902
|
+
address: this.hookAddress,
|
|
13903
|
+
abi: feesManagerAbi,
|
|
13904
|
+
functionName: "updateBeneficiary",
|
|
13905
|
+
args: [poolId, newBeneficiary],
|
|
13906
|
+
account: walletClient.account
|
|
13907
|
+
});
|
|
13908
|
+
const hash = await walletClient.writeContract(request);
|
|
13909
|
+
await this.rpc.waitForTransactionReceipt({ hash, confirmations: 1 });
|
|
13910
|
+
return { transactionHash: hash };
|
|
13911
|
+
}
|
|
13912
|
+
async claimAirlockOwnerFees(asset) {
|
|
13913
|
+
const walletClient = this.requireWalletClient(
|
|
13914
|
+
"Wallet client required to claim rehype owner fees"
|
|
13915
|
+
);
|
|
13441
13916
|
const { request, result } = await this.rpc.simulateContract({
|
|
13442
13917
|
address: this.hookAddress,
|
|
13443
|
-
abi:
|
|
13918
|
+
abi: rehypeDopplerHookInitializerAbi,
|
|
13444
13919
|
functionName: "claimAirlockOwnerFees",
|
|
13445
13920
|
args: [asset],
|
|
13446
|
-
account:
|
|
13921
|
+
account: walletClient.account
|
|
13447
13922
|
});
|
|
13448
|
-
const hash = await
|
|
13923
|
+
const hash = await walletClient.writeContract(request);
|
|
13449
13924
|
await this.rpc.waitForTransactionReceipt({ hash, confirmations: 1 });
|
|
13450
13925
|
const [fees0, fees1] = result;
|
|
13451
13926
|
return { fees0, fees1, transactionHash: hash };
|
|
@@ -13453,7 +13928,7 @@ var RehypeDopplerHook = class {
|
|
|
13453
13928
|
async getFeeDistributionInfo(poolId) {
|
|
13454
13929
|
const result = await this.rpc.readContract({
|
|
13455
13930
|
address: this.hookAddress,
|
|
13456
|
-
abi:
|
|
13931
|
+
abi: rehypeDopplerHookInitializerAbi,
|
|
13457
13932
|
functionName: "getFeeDistributionInfo",
|
|
13458
13933
|
args: [poolId]
|
|
13459
13934
|
});
|
|
@@ -13462,7 +13937,7 @@ var RehypeDopplerHook = class {
|
|
|
13462
13937
|
async getFeeRoutingMode(poolId) {
|
|
13463
13938
|
const mode = await this.rpc.readContract({
|
|
13464
13939
|
address: this.hookAddress,
|
|
13465
|
-
abi:
|
|
13940
|
+
abi: rehypeDopplerHookInitializerAbi,
|
|
13466
13941
|
functionName: "getFeeRoutingMode",
|
|
13467
13942
|
args: [poolId]
|
|
13468
13943
|
});
|
|
@@ -13471,7 +13946,7 @@ var RehypeDopplerHook = class {
|
|
|
13471
13946
|
async getFeeSchedule(poolId) {
|
|
13472
13947
|
const result = await this.rpc.readContract({
|
|
13473
13948
|
address: this.hookAddress,
|
|
13474
|
-
abi:
|
|
13949
|
+
abi: rehypeDopplerHookInitializerAbi,
|
|
13475
13950
|
functionName: "getFeeSchedule",
|
|
13476
13951
|
args: [poolId]
|
|
13477
13952
|
});
|
|
@@ -13480,7 +13955,7 @@ var RehypeDopplerHook = class {
|
|
|
13480
13955
|
async getHookFees(poolId) {
|
|
13481
13956
|
const result = await this.rpc.readContract({
|
|
13482
13957
|
address: this.hookAddress,
|
|
13483
|
-
abi:
|
|
13958
|
+
abi: rehypeDopplerHookInitializerAbi,
|
|
13484
13959
|
functionName: "getHookFees",
|
|
13485
13960
|
args: [poolId]
|
|
13486
13961
|
});
|
|
@@ -13489,14 +13964,23 @@ var RehypeDopplerHook = class {
|
|
|
13489
13964
|
async getPoolInfo(poolId) {
|
|
13490
13965
|
const result = await this.rpc.readContract({
|
|
13491
13966
|
address: this.hookAddress,
|
|
13492
|
-
abi:
|
|
13967
|
+
abi: rehypeDopplerHookInitializerAbi,
|
|
13493
13968
|
functionName: "getPoolInfo",
|
|
13494
13969
|
args: [poolId]
|
|
13495
13970
|
});
|
|
13496
13971
|
return normalizeRehypePoolInfo(result);
|
|
13497
13972
|
}
|
|
13973
|
+
requireWalletClient(message) {
|
|
13974
|
+
if (!this.walletClient) {
|
|
13975
|
+
throw new Error(message);
|
|
13976
|
+
}
|
|
13977
|
+
return this.walletClient;
|
|
13978
|
+
}
|
|
13498
13979
|
};
|
|
13499
13980
|
|
|
13981
|
+
// src/evm/entities/auction/RehypeDopplerHook.ts
|
|
13982
|
+
var RehypeDopplerHook = RehypeDopplerHookInitializer;
|
|
13983
|
+
|
|
13500
13984
|
// src/evm/entities/auction/RehypeDopplerHookMigrator.ts
|
|
13501
13985
|
var RehypeDopplerHookMigrator = class {
|
|
13502
13986
|
client;
|
|
@@ -18320,7 +18804,7 @@ var MulticurveBuilder = class _MulticurveBuilder {
|
|
|
18320
18804
|
}
|
|
18321
18805
|
}
|
|
18322
18806
|
/**
|
|
18323
|
-
* Configure a
|
|
18807
|
+
* Configure a RehypeDopplerHookInitializer for the pool.
|
|
18324
18808
|
*
|
|
18325
18809
|
* When configured, the hook will be initialized with the pool and will handle:
|
|
18326
18810
|
* - Custom swap fees
|
|
@@ -18332,7 +18816,7 @@ var MulticurveBuilder = class _MulticurveBuilder {
|
|
|
18332
18816
|
*
|
|
18333
18817
|
* @example
|
|
18334
18818
|
* ```typescript
|
|
18335
|
-
* builder.
|
|
18819
|
+
* builder.withRehypeDopplerHookInitializer({
|
|
18336
18820
|
* hookAddress: '0x...',
|
|
18337
18821
|
* buybackDestination: '0x...',
|
|
18338
18822
|
* startFee: 3000, // 0.3%
|
|
@@ -18351,153 +18835,21 @@ var MulticurveBuilder = class _MulticurveBuilder {
|
|
|
18351
18835
|
* })
|
|
18352
18836
|
* ```
|
|
18353
18837
|
*/
|
|
18354
|
-
|
|
18838
|
+
withRehypeDopplerHookInitializer(params) {
|
|
18355
18839
|
this.assertCanSetInitializer("rehype");
|
|
18356
|
-
const feeDistributionInfo = this.resolveRehypeFeeDistributionInfo(params);
|
|
18357
|
-
this.validateRehypeDistribution(feeDistributionInfo);
|
|
18358
|
-
const { startFee, endFee, durationSeconds, startingTime, feeRoutingMode } = this.resolveRehypeFeeSchedule(params);
|
|
18359
18840
|
if (params.graduationMarketCap !== void 0 && params.farTick !== void 0) {
|
|
18360
18841
|
throw new Error(
|
|
18361
18842
|
"Cannot specify both graduationMarketCap and farTick. Use one or the other."
|
|
18362
18843
|
);
|
|
18363
18844
|
}
|
|
18364
|
-
const normalizedParams =
|
|
18365
|
-
...params,
|
|
18366
|
-
startFee,
|
|
18367
|
-
endFee,
|
|
18368
|
-
durationSeconds,
|
|
18369
|
-
startingTime,
|
|
18370
|
-
feeRoutingMode,
|
|
18371
|
-
feeDistributionInfo
|
|
18372
|
-
};
|
|
18845
|
+
const normalizedParams = normalizeRehypeDopplerHookInitializerConfig(params);
|
|
18373
18846
|
this.dopplerHook = normalizedParams;
|
|
18374
18847
|
this.initializer = { type: "rehype", config: normalizedParams };
|
|
18375
18848
|
return this;
|
|
18376
18849
|
}
|
|
18377
|
-
|
|
18378
|
-
|
|
18379
|
-
|
|
18380
|
-
throw new Error(`${label} must be an integer number of seconds`);
|
|
18381
|
-
}
|
|
18382
|
-
if (normalized < 0) {
|
|
18383
|
-
throw new Error(`${label} cannot be negative`);
|
|
18384
|
-
}
|
|
18385
|
-
const UINT32_MAX = 4294967295;
|
|
18386
|
-
if (normalized > UINT32_MAX) {
|
|
18387
|
-
throw new Error(`${label} must fit within uint32`);
|
|
18388
|
-
}
|
|
18389
|
-
return normalized;
|
|
18390
|
-
}
|
|
18391
|
-
normalizeRehypeFeeRoutingMode(mode) {
|
|
18392
|
-
if (mode === void 0 || mode === 0 /* DirectBuyback */) {
|
|
18393
|
-
return 0 /* DirectBuyback */;
|
|
18394
|
-
}
|
|
18395
|
-
if (mode === 1 /* RouteToBeneficiaryFees */) {
|
|
18396
|
-
return 1 /* RouteToBeneficiaryFees */;
|
|
18397
|
-
}
|
|
18398
|
-
if (mode === "directBuyback") {
|
|
18399
|
-
return 0 /* DirectBuyback */;
|
|
18400
|
-
}
|
|
18401
|
-
if (mode === "routeToBeneficiaryFees") {
|
|
18402
|
-
return 1 /* RouteToBeneficiaryFees */;
|
|
18403
|
-
}
|
|
18404
|
-
throw new Error(
|
|
18405
|
-
"Rehype feeRoutingMode must be DirectBuyback/directBuyback or RouteToBeneficiaryFees/routeToBeneficiaryFees"
|
|
18406
|
-
);
|
|
18407
|
-
}
|
|
18408
|
-
resolveRehypeFeeDistributionInfo(params) {
|
|
18409
|
-
if (params.feeDistributionInfo) {
|
|
18410
|
-
return params.feeDistributionInfo;
|
|
18411
|
-
}
|
|
18412
|
-
const assetBuyback = params.assetBuybackPercentWad;
|
|
18413
|
-
const numeraireBuyback = params.numeraireBuybackPercentWad;
|
|
18414
|
-
const beneficiary = params.beneficiaryPercentWad;
|
|
18415
|
-
const lp = params.lpPercentWad;
|
|
18416
|
-
if (assetBuyback === void 0 || numeraireBuyback === void 0 || beneficiary === void 0 || lp === void 0) {
|
|
18417
|
-
throw new Error(
|
|
18418
|
-
"Rehype feeDistributionInfo is required, or provide all deprecated legacy percentages."
|
|
18419
|
-
);
|
|
18420
|
-
}
|
|
18421
|
-
return {
|
|
18422
|
-
assetFeesToAssetBuybackWad: assetBuyback,
|
|
18423
|
-
assetFeesToNumeraireBuybackWad: numeraireBuyback,
|
|
18424
|
-
assetFeesToBeneficiaryWad: beneficiary,
|
|
18425
|
-
assetFeesToLpWad: lp,
|
|
18426
|
-
numeraireFeesToAssetBuybackWad: assetBuyback,
|
|
18427
|
-
numeraireFeesToNumeraireBuybackWad: numeraireBuyback,
|
|
18428
|
-
numeraireFeesToBeneficiaryWad: beneficiary,
|
|
18429
|
-
numeraireFeesToLpWad: lp
|
|
18430
|
-
};
|
|
18431
|
-
}
|
|
18432
|
-
validateRehypeDistribution(feeDistributionInfo) {
|
|
18433
|
-
const assetRowTotal = feeDistributionInfo.assetFeesToAssetBuybackWad + feeDistributionInfo.assetFeesToNumeraireBuybackWad + feeDistributionInfo.assetFeesToBeneficiaryWad + feeDistributionInfo.assetFeesToLpWad;
|
|
18434
|
-
if (assetRowTotal !== WAD) {
|
|
18435
|
-
throw new Error(
|
|
18436
|
-
`Rehype asset fee distribution must sum to ${WAD} (100%), but got ${assetRowTotal}`
|
|
18437
|
-
);
|
|
18438
|
-
}
|
|
18439
|
-
const numeraireRowTotal = feeDistributionInfo.numeraireFeesToAssetBuybackWad + feeDistributionInfo.numeraireFeesToNumeraireBuybackWad + feeDistributionInfo.numeraireFeesToBeneficiaryWad + feeDistributionInfo.numeraireFeesToLpWad;
|
|
18440
|
-
if (numeraireRowTotal !== WAD) {
|
|
18441
|
-
throw new Error(
|
|
18442
|
-
`Rehype numeraire fee distribution must sum to ${WAD} (100%), but got ${numeraireRowTotal}`
|
|
18443
|
-
);
|
|
18444
|
-
}
|
|
18445
|
-
}
|
|
18446
|
-
resolveRehypeFeeSchedule(params) {
|
|
18447
|
-
const MAX_REHYPE_FEE = 1e6;
|
|
18448
|
-
const startFeeRaw = params.startFee ?? params.customFee;
|
|
18449
|
-
if (startFeeRaw === void 0) {
|
|
18450
|
-
throw new Error(
|
|
18451
|
-
"Rehype startFee is required, or provide deprecated customFee."
|
|
18452
|
-
);
|
|
18453
|
-
}
|
|
18454
|
-
const endFeeRaw = params.endFee ?? startFeeRaw;
|
|
18455
|
-
const startFee = Number(startFeeRaw);
|
|
18456
|
-
const endFee = Number(endFeeRaw);
|
|
18457
|
-
if (!Number.isInteger(startFee) || startFee < 0 || startFee > MAX_REHYPE_FEE) {
|
|
18458
|
-
throw new Error(
|
|
18459
|
-
`Rehype startFee must be an integer between 0 and ${MAX_REHYPE_FEE}`
|
|
18460
|
-
);
|
|
18461
|
-
}
|
|
18462
|
-
if (!Number.isInteger(endFee) || endFee < 0 || endFee > MAX_REHYPE_FEE) {
|
|
18463
|
-
throw new Error(
|
|
18464
|
-
`Rehype endFee must be an integer between 0 and ${MAX_REHYPE_FEE}`
|
|
18465
|
-
);
|
|
18466
|
-
}
|
|
18467
|
-
if (startFee < endFee) {
|
|
18468
|
-
throw new Error(
|
|
18469
|
-
`Rehype startFee (${startFee}) must be greater than or equal to endFee (${endFee})`
|
|
18470
|
-
);
|
|
18471
|
-
}
|
|
18472
|
-
const durationRaw = params.durationSeconds ?? (startFee === endFee ? 0 : void 0);
|
|
18473
|
-
if (durationRaw === void 0) {
|
|
18474
|
-
throw new Error(
|
|
18475
|
-
"Rehype durationSeconds must be provided when startFee is greater than endFee."
|
|
18476
|
-
);
|
|
18477
|
-
}
|
|
18478
|
-
const durationSeconds = this.parseUint32Value(
|
|
18479
|
-
durationRaw,
|
|
18480
|
-
"Rehype durationSeconds"
|
|
18481
|
-
);
|
|
18482
|
-
if (startFee > endFee && durationSeconds <= 0) {
|
|
18483
|
-
throw new Error(
|
|
18484
|
-
"Rehype durationSeconds must be greater than 0 when startFee is greater than endFee."
|
|
18485
|
-
);
|
|
18486
|
-
}
|
|
18487
|
-
const startingTime = params.startingTime === void 0 ? 0 : this.parseStartTimeSeconds(
|
|
18488
|
-
params.startingTime,
|
|
18489
|
-
"Rehype startingTime"
|
|
18490
|
-
);
|
|
18491
|
-
const feeRoutingMode = this.normalizeRehypeFeeRoutingMode(
|
|
18492
|
-
params.feeRoutingMode
|
|
18493
|
-
);
|
|
18494
|
-
return {
|
|
18495
|
-
startFee,
|
|
18496
|
-
endFee,
|
|
18497
|
-
durationSeconds,
|
|
18498
|
-
startingTime,
|
|
18499
|
-
feeRoutingMode
|
|
18500
|
-
};
|
|
18850
|
+
/** @deprecated Use withRehypeDopplerHookInitializer instead. */
|
|
18851
|
+
withRehypeDopplerHook(params) {
|
|
18852
|
+
return this.withRehypeDopplerHookInitializer(params);
|
|
18501
18853
|
}
|
|
18502
18854
|
withVesting(params) {
|
|
18503
18855
|
if (!params) {
|
|
@@ -18774,7 +19126,7 @@ var MulticurveBuilder = class _MulticurveBuilder {
|
|
|
18774
19126
|
const numerairePrice = dopplerHook.numerairePrice ?? this.numerairePrice;
|
|
18775
19127
|
if (!numerairePrice) {
|
|
18776
19128
|
throw new Error(
|
|
18777
|
-
"graduationMarketCap requires numerairePrice. Either use withCurves() (which provides numerairePrice), or pass numerairePrice explicitly in
|
|
19129
|
+
"graduationMarketCap requires numerairePrice. Either use withCurves() (which provides numerairePrice), or pass numerairePrice explicitly in withRehypeDopplerHookInitializer()."
|
|
18778
19130
|
);
|
|
18779
19131
|
}
|
|
18780
19132
|
if (dopplerHook.graduationMarketCap <= 0) {
|
|
@@ -19299,16 +19651,20 @@ var DopplerSDK = class {
|
|
|
19299
19651
|
return new DynamicAuction(this.publicClient, hookAddress);
|
|
19300
19652
|
}
|
|
19301
19653
|
/**
|
|
19302
|
-
* Get a
|
|
19654
|
+
* Get a RehypeDopplerHookInitializer instance.
|
|
19303
19655
|
* @param hookAddress The address of the RehypeDopplerHookInitializer
|
|
19304
19656
|
*/
|
|
19305
|
-
async
|
|
19306
|
-
return new
|
|
19657
|
+
async getRehypeDopplerHookInitializer(hookAddress) {
|
|
19658
|
+
return new RehypeDopplerHookInitializer(
|
|
19307
19659
|
this.publicClient,
|
|
19308
19660
|
this.walletClient,
|
|
19309
19661
|
hookAddress
|
|
19310
19662
|
);
|
|
19311
19663
|
}
|
|
19664
|
+
/** @deprecated Use getRehypeDopplerHookInitializer instead. */
|
|
19665
|
+
async getRehypeDopplerHook(hookAddress) {
|
|
19666
|
+
return this.getRehypeDopplerHookInitializer(hookAddress);
|
|
19667
|
+
}
|
|
19312
19668
|
/**
|
|
19313
19669
|
* Get a RehypeDopplerHookMigrator instance for interacting with migrator-side rehype hook state.
|
|
19314
19670
|
* @param hookAddress The address of the RehypeDopplerHookMigrator
|
|
@@ -19585,6 +19941,7 @@ exports.OpeningAuctionStatus = OpeningAuctionStatus;
|
|
|
19585
19941
|
exports.Q96 = Q96;
|
|
19586
19942
|
exports.Quoter = Quoter;
|
|
19587
19943
|
exports.RehypeDopplerHook = RehypeDopplerHook;
|
|
19944
|
+
exports.RehypeDopplerHookInitializer = RehypeDopplerHookInitializer;
|
|
19588
19945
|
exports.RehypeDopplerHookMigrator = RehypeDopplerHookMigrator;
|
|
19589
19946
|
exports.RehypeFeeRoutingMode = RehypeFeeRoutingMode;
|
|
19590
19947
|
exports.SECONDS_PER_DAY = SECONDS_PER_DAY;
|
|
@@ -19620,10 +19977,12 @@ exports.dopplerERC20V1Abi = dopplerERC20V1Abi;
|
|
|
19620
19977
|
exports.dopplerHookAbi = dopplerHookAbi;
|
|
19621
19978
|
exports.dopplerHookInitializerAbi = dopplerHookInitializerAbi;
|
|
19622
19979
|
exports.dopplerLensAbi = dopplerLensAbi;
|
|
19980
|
+
exports.encodeRehypeDopplerHookInitializerData = encodeRehypeDopplerHookInitializerData;
|
|
19623
19981
|
exports.encodeRehypeDopplerHookMigratorCalldata = encodeRehypeDopplerHookMigratorCalldata;
|
|
19624
19982
|
exports.estimatePriceAtEpoch = estimatePriceAtEpoch;
|
|
19625
19983
|
exports.estimateSlippage = estimateSlippage;
|
|
19626
19984
|
exports.feeClaimsInitializerAbi = feeClaimsInitializerAbi;
|
|
19985
|
+
exports.feesManagerAbi = feesManagerAbi;
|
|
19627
19986
|
exports.formatTickAsPrice = formatTickAsPrice;
|
|
19628
19987
|
exports.getAddresses = getAddresses;
|
|
19629
19988
|
exports.getAirlockBeneficiary = getAirlockBeneficiary;
|
|
@@ -19649,7 +20008,9 @@ exports.marketCapToTicksForMulticurve = marketCapToTicksForMulticurve;
|
|
|
19649
20008
|
exports.marketCapToTicksForStaticAuction = marketCapToTicksForStaticAuction;
|
|
19650
20009
|
exports.marketCapToTokenPrice = marketCapToTokenPrice;
|
|
19651
20010
|
exports.mineTokenAddress = mineTokenAddress;
|
|
20011
|
+
exports.normalizeBeneficiaries = normalizeBeneficiaries;
|
|
19652
20012
|
exports.normalizePoolKey = normalizePoolKey;
|
|
20013
|
+
exports.normalizeRehypeDopplerHookInitializerConfig = normalizeRehypeDopplerHookInitializerConfig;
|
|
19653
20014
|
exports.openingAuctionAbi = openingAuctionAbi;
|
|
19654
20015
|
exports.openingAuctionInitializerAbi = openingAuctionInitializerAbi;
|
|
19655
20016
|
exports.openingAuctionPositionManagerAbi = openingAuctionPositionManagerAbi;
|
|
@@ -19659,6 +20020,7 @@ exports.priceToTick = priceToTick;
|
|
|
19659
20020
|
exports.quoterV2Abi = quoterV2Abi;
|
|
19660
20021
|
exports.ratioToTick = ratioToTick;
|
|
19661
20022
|
exports.rehypeDopplerHookAbi = rehypeDopplerHookAbi;
|
|
20023
|
+
exports.rehypeDopplerHookInitializerAbi = rehypeDopplerHookInitializerAbi;
|
|
19662
20024
|
exports.rehypeDopplerHookMigratorAbi = rehypeDopplerHookMigratorAbi;
|
|
19663
20025
|
exports.resolveGasEstimate = resolveGasEstimate;
|
|
19664
20026
|
exports.sortBeneficiaries = sortBeneficiaries;
|