@whetstone-research/doppler-sdk 1.0.21 → 1.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -18
- package/dist/evm/index.cjs +680 -194
- package/dist/evm/index.cjs.map +1 -1
- package/dist/evm/index.d.cts +135 -11
- package/dist/evm/index.d.ts +135 -11
- package/dist/evm/index.js +680 -196
- package/dist/evm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/evm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '../chunk-PZ5AY32C.js';
|
|
2
|
-
import { parseEther, formatEther, getAddress, encodeAbiParameters, keccak256, decodeAbiParameters, encodePacked, decodeEventLog, toHex, zeroAddress, zeroHash, encodeFunctionData } from 'viem';
|
|
2
|
+
import { parseEther, formatEther, getAddress, encodeAbiParameters, keccak256, decodeAbiParameters, encodePacked, decodeEventLog, toHex, zeroAddress, zeroHash, encodeFunctionData, BaseError, ContractFunctionRevertedError, ContractFunctionZeroDataError, multicall3Abi, decodeFunctionResult, decodeErrorResult } from 'viem';
|
|
3
3
|
|
|
4
4
|
// src/evm/deployments.generated.ts
|
|
5
5
|
var GENERATED_DOPPLER_DEPLOYMENTS = {
|
|
@@ -1155,6 +1155,64 @@ function estimateSlippage(amountIn, liquidity, currentTick, fee) {
|
|
|
1155
1155
|
return Math.min(slippage, 100);
|
|
1156
1156
|
}
|
|
1157
1157
|
|
|
1158
|
+
// src/evm/abis/multicurve/feeClaimsAbi.ts
|
|
1159
|
+
var feeClaimsInitializerAbi = [
|
|
1160
|
+
{
|
|
1161
|
+
type: "function",
|
|
1162
|
+
name: "getCumulatedFees0",
|
|
1163
|
+
inputs: [{ name: "poolId", type: "bytes32", internalType: "PoolId" }],
|
|
1164
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
1165
|
+
stateMutability: "view"
|
|
1166
|
+
},
|
|
1167
|
+
{
|
|
1168
|
+
type: "function",
|
|
1169
|
+
name: "getCumulatedFees1",
|
|
1170
|
+
inputs: [{ name: "poolId", type: "bytes32", internalType: "PoolId" }],
|
|
1171
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
1172
|
+
stateMutability: "view"
|
|
1173
|
+
},
|
|
1174
|
+
{
|
|
1175
|
+
type: "function",
|
|
1176
|
+
name: "getLastCumulatedFees0",
|
|
1177
|
+
inputs: [
|
|
1178
|
+
{ name: "poolId", type: "bytes32", internalType: "PoolId" },
|
|
1179
|
+
{ name: "user", type: "address", internalType: "address" }
|
|
1180
|
+
],
|
|
1181
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
1182
|
+
stateMutability: "view"
|
|
1183
|
+
},
|
|
1184
|
+
{
|
|
1185
|
+
type: "function",
|
|
1186
|
+
name: "getLastCumulatedFees1",
|
|
1187
|
+
inputs: [
|
|
1188
|
+
{ name: "poolId", type: "bytes32", internalType: "PoolId" },
|
|
1189
|
+
{ name: "user", type: "address", internalType: "address" }
|
|
1190
|
+
],
|
|
1191
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
1192
|
+
stateMutability: "view"
|
|
1193
|
+
},
|
|
1194
|
+
{
|
|
1195
|
+
type: "function",
|
|
1196
|
+
name: "getShares",
|
|
1197
|
+
inputs: [
|
|
1198
|
+
{ name: "poolId", type: "bytes32", internalType: "PoolId" },
|
|
1199
|
+
{ name: "user", type: "address", internalType: "address" }
|
|
1200
|
+
],
|
|
1201
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
1202
|
+
stateMutability: "view"
|
|
1203
|
+
},
|
|
1204
|
+
{
|
|
1205
|
+
type: "function",
|
|
1206
|
+
name: "collectFees",
|
|
1207
|
+
inputs: [{ name: "poolId", type: "bytes32", internalType: "PoolId" }],
|
|
1208
|
+
outputs: [
|
|
1209
|
+
{ name: "fees0", type: "uint128", internalType: "uint128" },
|
|
1210
|
+
{ name: "fees1", type: "uint128", internalType: "uint128" }
|
|
1211
|
+
],
|
|
1212
|
+
stateMutability: "nonpayable"
|
|
1213
|
+
}
|
|
1214
|
+
];
|
|
1215
|
+
|
|
1158
1216
|
// src/evm/abis/bytecodes/doppler.ts
|
|
1159
1217
|
var doppler_default = "0x60a06040523461057b57604051601f615c0338819003918201601f19168301916001600160401b0383118484101761057f578084926101c09460405283398101031261057b5780516001600160a01b038116810361057b5760208201516040830151906060840151608085015160a08601519061007e60c088016105b3565b9161008b60e089016105b3565b91610100890151946100a06101208b016105b3565b976101408b0151978815988915810361057b576101608d01516101808e01516001600160a01b0381169e919d91908f0361057b576101a001519062ffffff821680920361057b576080525f6101a06100f6610593565b8281528260208201528260408201528260608201528260808201528260a08201528260c08201528260e0820152826101008201528261012082015282610140820152826101608201528261018082015201525f6101a0610154610593565b6001815260016020820152600160408201528260608201528260808201528260a0820152600160c0820152600160e082015260016101008201528261012082015282610140820152826101608201528261018082015201526120003016151560011480159061056a575b8015610559575b801561054c575b801561053f575b8015610532575b8015610522575b8015610512575b8015610502575b80156104f6575b80156104ea575b80156104de575b80156104d2575b80156104c6575b6104b35762ffffff1960165416176016558442116104a4578660020b8860020b91818303610463575b5050508484101561045457838503858111610440578a60020b5f811380159061042b575b61041c578915610408578982066103f9578c156103eb57600f8d116103eb578484116103dc5761029861029d928b81046017558b6105c1565b610658565b628000008110156103cf5762ffffff19601854169062ffffff1617601855600d55600e55600f5560105560115562ffffff6012549160181b65ffffff0000001692169065ffffffffffff1916171760125560135562ffffff63ff000000601454921560181b1692169063ffffffff1916171760145560155560018060a01b0319600c541617600c5560405161552f90816106d48239608051818181601c01528181610205015281816102a80152818161045c0152818161050c0152818161098701528181610a1e01528181610af501528181610b9201528181610c5a01528181610e8301528181610f3a0152818161103d015281816110b201528181611d2c01528181611de40152818161217801528181613b8301528181613c4d01528181613fe9015281816140f40152614be40152f35b6335278d125f526004601cfd5b638cc99b7b60e01b5f5260045ffd5b6287e39960e61b5f5260045ffd5b6388ac089760e01b5f5260045ffd5b634e487b7160e01b5f52601260045260245ffd5b6312469eb560e11b5f5260045ffd5b5061043a81610298848d6105c1565b1561025f565b634e487b7160e01b5f52601160045260245ffd5b63536a71af60e01b5f5260045ffd5b8061049b575b610483578a9182610491575b5050610483575f808061023b565b6264847d60e41b5f5260045ffd5b1390505f80610475565b50808212610469565b632ca4094f60e21b5f5260045ffd5b630732d7b560e51b5f523060045260245ffd5b50600130161515610212565b5060023016151561020b565b50600430161515610204565b506008301615156101fd565b506010301615156101f6565b50602030161515600114156101ef565b50604030161515600114156101e8565b50608030161515600114156101e1565b50610100301615156101da565b50610200301615156101d3565b50610400301615156101cc565b5061080030161515600114156101c5565b5061100030161515600114156101be565b5f80fd5b634e487b7160e01b5f52604160045260245ffd5b604051906101c082016001600160401b0381118382101761057f57604052565b51908160020b820361057b57565b90670de0b6b3a76400008202905f19670de0b6b3a764000084099282808510940393808503948584111561057b571461065157670de0b6b3a764000082910981805f03168092046002816003021880820260020302808202600203028082026002030280820260020302808202600203028091026002030293600183805f03040190848311900302920304170290565b5091500490565b808202905f1983820990828083109203918083039283670de0b6b3a7640000111561057b57146106c2577faccb18165bd6fe31ae1cf318dc5b51eee0e1ba569b88cd74c1773b91fac1066993670de0b6b3a7640000910990828211900360ee1b910360121c170290565b5050670de0b6b3a76400009150049056fe608080604052600436101561005b575b50361561001a575f80fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316330361004c57005b6393c866c160e01b5f5260045ffd5b5f905f3560e01c908163182148ef146111155750806318cb1700146110f357806321d0ee701461109f578063259982e51461102a578063392e53cd1461100857806339518b5e14610feb578063514ea4bf14610f96578063575e24b414610ee357806357d775f814610ec65780636c2bbe7e14610e705780636c47a6c314610e535780636fe7e6eb14610c19578063897479cb14610bfb57806390ebab0a14610bdd57806391dd734614610b5e5780639ce110d714610b355780639f063efc14610ade578063a4dee15514610ab9578063b137392914610a98578063b356603014610a74578063b47b2fb1146109c6578063b6a8b0fa14610970578063c19d93fb14610921578063c4e833ce146107b6578063c70dfb4f14610795578063ce5494bb146104cb578063d0c52e21146104a9578063d65b4cb91461048b578063dc4c90d314610446578063dc98354e14610276578063dcf93f3214610250578063e1b4af69146101ee5763ee4644300361000f57346101eb57806003193601126101eb576020600d54604051908152f35b80fd5b50346101eb57600490610200366112dc565b5050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163303925061024491505057630a85dc2960e01b8152fd5b63570c108560e11b8152fd5b50346101eb57806003193601126101eb57602060ff60145460181c166040519015158152f35b50346101eb5760e03660031901126101eb5761029061116b565b5060a03660231901126101eb576102a561128e565b507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633036104375760085460ff81166104295760ff19166001176008556001600160a01b03602435908116908181036104255750600980546001600160a01b0319169190911790556044356001600160a01b038116908181036104255750600a80546001600160a01b03191691909117905560643562ffffff8116810361042157600a5461035a612061565b60b81b62ffffff60b81b169162ffffff60a01b9060a01b169065ffffffffffff60a01b19161717600a5560a43560018060a01b03811680910361042157600b80546001600160a01b031916919091179055601e6103b5612061565b60020b136104125760145460020b6103cb612061565b60020b9081156103fe570760020b6103ef57604051636e4c1aa760e11b8152602090f35b6312469eb560e11b8152600490fd5b634e487b7160e01b83526012600452602483fd5b63013840ad60e51b8152600490fd5b5080fd5b8280fd5b62dc149f60e41b8252600482fd5b63570c108560e11b8152600490fd5b50346101eb57806003193601126101eb576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b50346101eb57806003193601126101eb576020600f54604051908152f35b50346101eb57806003193601126101eb5760ff60209154166040519015158152f35b50346101eb5760203660031901126101eb576104e561116b565b600c546001600160a01b031633036107865760ff825460081c161580610765575b610756577f000000000000000000000000000000000000000000000000000000000000000061059d8361057561058360405161054181611333565b610549611f3d565b815260018060a01b03871660208201528360408201526001606082015260405192839160208301611f8a565b03601f1981018352826113b4565b604051809381926348c8949160e01b8352600483016112b2565b0381836001600160a01b0387165af190811561074b57916105d785926105e2959460e09791610729575b50602080825183010191016114d8565b600695919554613282565b9161064160018060a01b0360095416926106306105fe856145cf565b948761061f8761061760018060a01b03600a54166145cf565b9a8b94614611565b600a546001600160a01b0316614611565b60a061063a611f3d565b2090614754565b5050600954600a5492976001600160a01b039182169791909316946106879250610678906001600160801b03608086901d16611472565b926001600160801b0316611472565b906001600160801b0381111561071a57506001600160801b03915b506001600160801b0381111561070b57506001600160801b03935b604080516001600160a01b0397909716875260208701919091526001600160801b03608085811d821692880192909252918216606087015285019190915290811660a08401521660c0820152f35b6001600160801b0316936106bd565b6001600160801b0316916106a2565b61074591503d8086833e61073d81836113b4565b810190611fcb565b5f6105c7565b6040513d86823e3d90fd5b63051a2a5560e51b8252600482fd5b50600454600e5411158061077a575b15610506565b50601154421015610774565b638341a67960e01b8252600482fd5b50346101eb57806003193601126101eb57602060125460020b604051908152f35b50346101eb57806003193601126101eb576020816101c0926101a06040516107dd81611362565b82815282858201528260408201528260608201528260808201528260a08201528260c08201528260e0820152826101008201528261012082015282610140820152826101608201528261018082015201528060405161083b81611362565b60018152838101600181526040820160018152606083018481526080840185815260a0850186815260c08601906001825260e087019260018452610100880194600186526101208901968a88526101408a01988b8a526101a06101608c019b8d8d5261018081019d8e52019c8d526040519d8e916001835251151591015251151560408d015251151560608c015251151560808b015251151560a08a015251151560c089015251151560e08801525115156101008701525115156101208601525115156101408501525115156101608401525115156101808301525115156101a0820152f35b50346101eb57806003193601126101eb5760c064ffffffffff600154166002546003546004546005549160065493604051958652602086015260408501526060840152608083015260a0820152f35b50346101eb57600490610982366112dc565b5050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316330392506102449150505763567d91d160e01b8152fd5b50346101eb576101603660031901126101eb576109e161116b565b5060a03660231901126101eb5760603660c31901126101eb57610144356001600160401b03811161042157610a1a903690600401611195565b50507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163303610437576040610a5a610124356140d7565b82516001600160e01b03199092168252600f0b6020820152f35b50346101eb57806003193601126101eb57602060125460181c60020b604051908152f35b50346101eb57806003193601126101eb57602060145460020b604051908152f35b50346101eb57806003193601126101eb5760ff6020915460081c166040519015158152f35b50346101eb57600490610af036611225565b5050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316330393506102449250505057630a85dc2960e01b8152fd5b50346101eb57806003193601126101eb57600c546040516001600160a01b039091168152602090f35b50346101eb5760203660031901126101eb576004356001600160401b03811161042157610b8f903690600401611195565b917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316330361043757610bd9610bcd848461168f565b604051918291826112b2565b0390f35b50346101eb57806003193601126101eb576020601554604051908152f35b50346101eb57806003193601126101eb576020600e54604051908152f35b5034610e4057610100366003190112610e4057610c3461116b565b60a0366023190112610e4057610c4861128e565b5060e435908160020b809203610e40577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169133839003610e445762ffffff6016541691833b15610e4057604051635275965160e01b815292602435906001600160a01b038216808303610e40576004860152604435946001600160a01b038616808703610e4057602482015260643562ffffff8116808203610e40576044830152608435918260020b808403610e4057606482015260a435936001600160a01b038516808603610e4057608483015260a48201525f8160c481838d5af18015610e3557610e07575b509488979461057594610da6948a9994610dc29960405196610d5a88611333565b60405194610d678661137e565b85526020850152604084015260608301526080820152835260018060a01b03166020830152604082015285606082015260405192839160208301611f8a565b6040519485809481936348c8949160e01b8352600483016112b2565b03925af18015610dfc57610de3575b604051636fe7e6eb60e01b8152602090f35b610df6913d8091833e61073d81836113b4565b5f610dd1565b6040513d84823e3d90fd5b610da69399509461057594610e245f610dc299949a959b986113b4565b5f9a94509450949791969095610d39565b6040513d5f823e3d90fd5b5f80fd5b63570c108560e11b5f5260045ffd5b34610e40575f366003190112610e40576020601154604051908152f35b34610e4057610e7e36611225565b5050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633039350610e449250505057630a85dc2960e01b5f5260045ffd5b34610e40575f366003190112610e40576020601354604051908152f35b34610e4057610140366003190112610e4057610efd61116b565b5060a0366023190112610e405760603660c3190112610e4057610124356001600160401b038111610e4057610f36903690600401611195565b50507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163303610e4457606062ffffff610f766120bd565b906040939293519363ffffffff60e01b1684526020840152166040820152f35b34610e40576020366003190112610e40576004355f526007602052608060405f205460ff604051918060020b83528060181c60020b6020840152600180851b038160301c16604084015260b01c166060820152f35b34610e40575f366003190112610e40576020601054604051908152f35b34610e40575f366003190112610e4057602060ff600854166040519015158152f35b34610e4057611038366111c2565b5050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633039050610e4457306001600160a01b03909116036110905760405163259982e560e01b8152602090f35b636d1ed89b60e01b5f5260045ffd5b34610e40576110ad366111c2565b5050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633039150610e44905057630a85dc2960e01b5f5260045ffd5b34610e40575f366003190112610e4057602062ffffff60165416604051908152f35b34610e40575f366003190112610e4057600954600a54600b546001600160a01b039283168452818316602085015260a082811c62ffffff16604086015260b89290921c60020b6060850152909116608083015290f35b600435906001600160a01b0382168203610e4057565b35906001600160a01b0382168203610e4057565b9181601f84011215610e40578235916001600160401b038311610e405760208381860195010111610e4057565b90610160600319830112610e40576004356001600160a01b0381168103610e40579160a0602319820112610e4057602491608060c319830112610e405760c49161014435906001600160401b038211610e405761122191600401611195565b9091565b906101a0600319830112610e40576004356001600160a01b0381168103610e40579160a0602319820112610e4057602491608060c319830112610e405760c4916101443591610164359161018435906001600160401b038211610e405761122191600401611195565b60c435906001600160a01b0382168203610e4057565b35908160020b8203610e4057565b602060409281835280519182918282860152018484015e5f828201840152601f01601f1916010190565b610120600319820112610e40576004356001600160a01b0381168103610e40579160a0602319830112610e405760249160c4359160e4359161010435906001600160401b038211610e405761122191600401611195565b608081019081106001600160401b0382111761134e57604052565b634e487b7160e01b5f52604160045260245ffd5b6101c081019081106001600160401b0382111761134e57604052565b60a081019081106001600160401b0382111761134e57604052565b606081019081106001600160401b0382111761134e57604052565b601f909101601f19168101906001600160401b0382119082101761134e57604052565b359062ffffff82168203610e4057565b91908260a0910312610e40576040516113ff8161137e565b608061144b81839561141081611181565b855261141e60208201611181565b602086015261142f604082016113d7565b6040860152611440606082016112a4565b606086015201611181565b910152565b600201908160021161145e57565b634e487b7160e01b5f52601160045260245ffd5b9190820180921161145e57565b9060405161148c81611333565b9154600281810b8452601882901c900b6020840152603081901c6001600160801b0316604084015260b01c60ff166060830152565b600f0b60016001607f1b0319811461145e575f0390565b9190826040910312610e40576020825192015190565b80516001600160a01b03908116835260208083015182169084015260408083015162ffffff169084015260608083015160020b9084015260809182015116910152565b9061016092611542836060936114ee565b805160020b60a0840152602081015160020b60c0840152604081015160e084015201516101008201526101406101208201525f6101408201520190565b6001600160a01b03918216815291166020820152604081019190915260600190565b9190820391821161145e57565b6001600160401b03811161134e5760051b60200190565b906115cf826115ae565b6115dc60405191826113b4565b82815280926115ed601f19916115ae565b01905f5b8281106115fd57505050565b60209060405161160c81611333565b5f81525f838201525f60408201525f6060820152828285010152016115f1565b8051156116395760200190565b634e487b7160e01b5f52603260045260245ffd5b8051600110156116395760400190565b80518210156116395760209160051b010190565b9081549060181b65ffffff000000169065ffffff0000001916179055565b919082015f61010084830312610e40576116b5604051926116af84611333565b856113e7565b938483526116c560a08201611181565b80602085015260e06116d960c084016112a4565b92836040870152013580151594858203610e40576060015260018060a01b03169060020b92611c4e5750600164ffffffffff1981541617600155606084019261173c845160020b61173761172c85614ef6565b60125460020b61209f565b614f2e565b6014549060ff8260181c165f14611c3b5761175a9160020b9061209f565b945b61176584613378565b61176e85613378565b956040519561177c87611399565b808752602087018181526118d8604089019a888c526118d0600d54956117a06136a5565b956118088c6118036117fa6117db6117d26117c96117c46117bf61480d565b614ea2565b6136c3565b60135490614e80565b60105490614ebe565b6117f46117eb60105480936115a1565b916011546115a1565b90615033565b600d5490615113565b6136d4565b8c929083811315611c2c5761186b9293508981115f14611c275750885b928d60185460020b835160020b8082135f14611c1f5750905b50818a5260145460181c60ff1615611c105761185f9150895160020b61209f565b905b5160020b90614f2e565b60020b60208701525b855160020b966020870197885160020b14155f14611c055760ff60145460181c166118c5836118a68a5160020b613378565b8b516001600160801b039491906118bf9060020b613378565b91614fcc565b1660408801526115a1565b90848861374b565b996118eb6118e68c51611450565b6115c5565b985160020b915160020b9060018060801b03905116906040519261190e84611333565b8352602083015260408201526001606082015261192a8861162c565b526119348761162c565b50805160020b915160020b90604060018060801b0391015116906040519261195b84611333565b835260208301526040820152600260608201526119778661164d565b526119818561164d565b50835b8751811015611a3457611997818961165d565b515160020b60206119a8838b61165d565b51015160020b6001600160801b0360406119c2858d61165d565b51015116836003019182600311611a2057611a1992600195949260ff92604051946119ec86611333565b855260208501526040840152166060820152611a0783611450565b90611a12828b61165d565b528861165d565b5001611984565b634e487b7160e01b89526011600452602489fd5b50611a429293969585613a82565b611a4b8261162c565b516001855260076020526040852090805162ffffff198354169062ffffff16178255611a7e602082015160020b83611671565b60408101518254606090920151600160301b600160b81b031990921660309190911b600160301b600160b01b03161760b09190911b60ff60b01b16179055611ac58261164d565b516002855260076020526040852090805162ffffff198354169062ffffff16178255611af8602082015160020b83611671565b60408101518254606090920151600160301b600160b81b031990921660309190911b600160301b600160b01b03161760b09190911b60ff60b01b16179055835b8351811015611be557611b53611b4d82611450565b8461165d565b518160030180600311611bd1579060019291875260076020526040872090805162ffffff198354169062ffffff16178255611b95602082015160020b83611671565b604081015190825490606060ff60b01b91015160b01b16918560301b8660b01b039060301b16908560301b8660b81b0319161717905501611b38565b634e487b7160e01b87526011600452602487fd5b509291505060405190611bf96020836113b4565b81525f36602083013790565b8b60408801526115a1565b611c199161335b565b90611861565b90509061183e565b611825565b50508087526020870152611874565b611c489160020b9061335b565b9461175c565b925f9250829160015b6015546003018060031161145e57811015611ddc57805f526007602052611c8060405f2061147f565b60408101516001600160801b031680611c9e575b5050600101611c57565b611d279160409160ff6014999598995460181c1691825f14611dce57805160020b925b15611db95760ff6060611ce3611cde602085015160020b95613263565b6114c1565b9201511691845193611cf485611333565b60020b845260020b6020840152600f0b838301526060820152815180938192632d35e7ed60e11b83528c60048401611531565b03815f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165af1918215610e3557600192611d7e925f905f92611d86575b50611d789192613282565b96613282565b93905f611c94565b611d789250611dac915060403d8111611db2575b611da481836113b4565b8101906114d8565b91611d6d565b503d611d9a565b60ff6060611ce3611cde845160020b95613263565b602081015160020b92611cc1565b5091929390947f000000000000000000000000000000000000000000000000000000000000000091611e1860018060a01b0383511630856132c4565b926020830192611e3260018060a01b0385511630846132c4565b945f8113611ed6575b5050848413611e6a575b5050505050604051916020830152604082015260408152611e676060826113b4565b90565b91516001600160a01b039283169216823b15611ed25791611ea6939185809460405196879586948593630b0d9c0960e01b85526004850161157f565b03925af18015610dfc57611ebd575b808080611e45565b611ec88280926113b4565b6101eb5780611eb5565b8480fd5b90516001600160a01b0383811692911690823b15610e4057611f1392855f809460405196879586948593630b0d9c0960e01b85526004850161157f565b03925af18015610e3557611f28575b80611e3b565b611f359195505f906113b4565b5f935f611f22565b60405190611f4a8261137e565b6009546001600160a01b039081168352600a54808216602085015260a081901c62ffffff16604085015260b81c60020b6060840152600b54166080830152565b91909160e06060610100830194611fa28482516114ee565b60208101516001600160a01b031660a0850152604081015160020b60c085015201511515910152565b602081830312610e40578051906001600160401b038211610e40570181601f82011215610e40578051906001600160401b03821161134e576040519261201b601f8401601f1916602001856113b4565b82845260208383010111610e4057815f9260208093018386015e8301015290565b600f91820b910b019060016001607f1b0319821260016001607f1b0383131761145e57565b6084358060020b8103610e405790565b60020b627fffff19811461145e575f0390565b60020b60010190627fffff8213627fffff1983121761145e57565b9060020b9060020b0190627fffff198212627fffff83131761145e57565b5f80549160ff8360081c16613254576010544210613245576120dd61480d565b64ffffffffff600154161015613234575f9260115442101580613229575b612e7e575b509060ff5f5416155f14612e105761211661480d565b9060015461212b64ffffffffff8216846115a1565b64ffffffffff1990911664ffffffffff84161760015560035460025f526007602052946121645f8051602061550383398151915261147f565b9461219c60a06121753660246113e7565b207f0000000000000000000000000000000000000000000000000000000000000000614754565b505050946121a986614841565b608435978860020b90818a14159283610e40578a6121c691614f2e565b905f916121d68d600554906136d4565b5f198a0194908a861161145e575f8f966121f26121f791613a72565b614fac565b80971115911280612e09575b15612cac575050506122249192505160020b9161221e615332565b90614ebe565b955b60018111612c165750612262908a60055561225c670de0b6b3a764000061224f89600254614ebe565b9880612c0d575b05614ef6565b9061209f565b90612c09578761227191614f2e565b9061228d8861173761172c670de0b6b3a76400005f9905614ef6565b9760145460ff8160181c165f14612bf6576122ab9060020b8a61209f565b955b8960ff60145460181c16809b811580612be6575b15612baa57505050612ba6576122d7908361209f565b945b6122e283613378565b986122ec87613378565b908b15612b9d5715612aea5760016123058c8c84615420565b91818060a01b038c1690828060a01b0316038060ff1d9081011891818060801b031661233183826150ca565b928260601b9109151516015b975b60155461234e6118e682611450565b9060018a52600760205261236460408b2061147f565b61236d8361162c565b526123778261162c565b5060028a52600760205261238d60408b2061147f565b6123968361164d565b526123a08261164d565b50895b818110612aa25750506123c1906123bb3660246113e7565b90614afa565b5060145460181c60ff1699908a156129fc576044356001600160a01b03811681036129f857612402906123f3906145cf565b6001600160801b038316611472565b6006549061241a906001600160801b038316906115a1565b916024356001600160a01b03811681036129f4579e6118e69f936124728e969461245d8c9561244b89879a506145cf565b9060801d6001600160801b0316611472565b60809190911d6001600160801b0316906115a1565b9e5b61247f3660246113e7565b906124886136a5565b958361299457505050505060020b80825260208201528260408201525b604081018051909c6125ab916125a391612591916001600160801b031615612985575b6124d33660246113e7565b906124fa6124df6136a5565b976118036117fa6117db6117d26117c96117c46117bf61480d565b88808213156129715750818111156129685750612555815b928d606060185460020b920191825160020b8082135f146129605750905b60020b90818b5260ff60145460181c165f14611c105761185f91508a5160020b61209f565b60020b60208801525b865160020b976020880198895160020b14155f14612956575060ff60145460181c166118c5836118a68a5160020b613378565b878561259e3660246113e7565b61374b565b9e8f51611450565b9b6020825160020b92015160020b9060018060801b0390511690604051926125d284611333565b835260208301526040820152600160608201526125ee8c61162c565b526125f88b61162c565b50805160020b915160020b90604060018060801b0391015116906040519261261f84611333565b8352602083015260408201526002606082015261263b8a61164d565b526126458961164d565b50875b8b518110156126f9578b602061266d83612662818561165d565b515160020b9361165d565b51015160020b8d60406126878560018060801b039361165d565b510151168360030191826003116126e5579260ff6126de938f9360019796604051946126b286611333565b8552602085015260408401521660608201526126d76126d085611450565b809361165d565b528c61165d565b5001612648565b634e487b7160e01b8d52601160045260248dfd5b50612719919293949596999a979a6127123660246113e7565b918a613a82565b6127228761162c565b5160018a52600760205260408a2090805162ffffff198354169062ffffff16178255612755602082015160020b83611671565b60408101518254606090920151600160301b600160b81b031990921660309190911b600160301b600160b01b03161760b09190911b60ff60b01b1617905561279c8761164d565b5160028a52600760205260408a2090805162ffffff198354169062ffffff161782556127cf602082015160020b83611671565b60408101518254606090920151600160301b600160b81b031990921660309190911b600160301b600160b01b03161760b09190911b60ff60b01b16179055885b6015548110156128fc578651811061285957806003018060031161284557906001918b5260076020528a60408120555b0161280f565b634e487b7160e01b8b52601160045260248bfd5b61286b61286582611450565b8961165d565b5181600301806003116128e85790600192918c52600760205260408c2090805162ffffff198354169062ffffff161782556128ad602082015160020b83611671565b604081015190825490606060ff60b01b91015160b01b16918560301b8660b01b039060301b16908560301b8660b81b0319161717905561283f565b634e487b7160e01b8c52601160045260248cfd5b5090919295507f223157ec47d7bd04fa3ed10c0a8adb38faf97b51ec856a777425a2e39253bd739450608093966040519360020b845260020b602084015260020b60408301526060820152a15b6315d7892d60e21b929190565b60408801526115a1565b905090612530565b61255590612512565b9250508b60020b808852602088015261255e565b602085015160020b85526124c8565b838111156129ad5750506129a89450614ca4565b6124a5565b92509350506129e991508c60020b84528960020b60208501526129cf8d613378565b6001600160801b0393906129e28c613378565b9115614fcc565b1660408201526124a5565b8c80fd5b8a80fd5b6024356001600160a01b03811681036129f857612a2f90612a1c906145cf565b608083901d6001600160801b0316611472565b60065490612a4b90608083901d6001600160801b0316906115a1565b916044356001600160a01b03811681036129f4579e6118e69f93612a9c8e9694612a8b8c95612a7c89879a506145cf565b906001600160801b0316611472565b6001600160801b03909116906115a1565b9e612474565b80600301806003116128e857906001918c526007602052612ae360408d20612ad2612acc84611450565b9161147f565b612adc828861165d565b528561165d565b50016123a3565b612af58b8b836153dd565b8a826001600160a01b0380831690821611612b92575b506001600160a01b038316918215612b865760601b600160601b600160e01b0316926001600160a01b03828116929190910316612b4982828661527d565b938215612b725709612b63575b808206151591040161233d565b906001019081612b56575b8880fd5b634e487b7160e01b8c52601260045260248cfd5b62bfc9218b526004601cfd5b8c935090505f612b0b565b5050869761233f565b8680fd5b91989392509081612bd5575b50612bc2575b506122d9565b612bce9196508361335b565b945f612bbc565b905060020b8460020b13155f612bb6565b508060020b8760020b12156122c1565b612c039060020b8a61335b565b956122ad565b8580fd5b89600255612256565b612c1f906136ec565b5f198101818111611a20576121f2612c3691613a72565b808c10612c44575b50612226565b612c59612c52989298615332565b918d615033565b670de0b6b3a76400000390670de0b6b3a76400008211612c9857612c8a612c919392670de0b6b3a764000092614e80565b0590614ebe565b955f612c3e565b634e487b7160e01b8a52601160045260248afd5b9192909115612d0957505083612b6e578a612cc691614f2e565b91612cd2612c52615332565b670de0b6b3a76400000390670de0b6b3a76400008211612c9857612c8a612d039392670de0b6b3a764000092614e80565b95612226565b93509350975050612d2f60125460020b670de0b6b3a76400006002540560020b9061209f565b60185460020b5f9381135f14612dfe57905b6014549260ff8460181c1692835f14612deb57612d61915160020b61209f565b915b829985610e4057612db394612d7b8e612dab96614f2e565b938315612dd857612d8f9160020b9061209f565b915b15612dc3578160020b8160020b135f14612dbc575061335b565b60020b614e5c565b955f9695612226565b905061335b565b8160020b8160020b125f14612dbc575061335b565b612de59160020b9061335b565b91612d91565b612df8915160020b61335b565b91612d63565b505f92508990612d41565b5080612203565b915060ff60145460181c168080612e67575b8115612e47575b50612e38576240000090612949565b63016ccb0760e01b5f5260045ffd5b90501580612e56575b5f612e29565b5060c4358015158114612e50575f80fd5b905060c43580159081158103610e40575090612e22565b600454600e54111561321a5760019060ff1916175f557fe8775e4a58023f399765c3455b45eebcc45ad6b99607a1163f02e1318430970c5f80a1612ed3612ecb60a06121753660246113e7565b505050614841565b601554612ee26118e682611450565b60015f52600760205290612f025f805160206154e383398151915261147f565b612f0b8361162c565b52612f158261162c565b5060025f526007602052612f355f8051602061550383398151915261147f565b612f3e8361164d565b52612f488261164d565b505f5b8181106131e9575050612f63906123bb3660246113e7565b5060145460181c60ff1690811561319e576044356001600160a01b0381168103610e4057612fce918491612fb8906001600160801b0390612fa3906145cf565b16600f0b60018060801b0392600f0b9061203c565b165b60035490612fc93660246113e7565b614ca4565b90604080519290612fdf81856113b4565b60018452601f19015f5b81811061316f575050805160020b6020820191825160020b90604060018060801b0391015116906040519261301d84611333565b835260208301526040820152600160608201526130398461162c565b526130438361162c565b505160020b901561314657608435928360020b8403610e405761308061307a613075613093948761309898509061209f565b613378565b91613378565b9061308c3660246113e7565b9184613a82565b61162c565b5160015f52600760205260405f2090805162ffffff198354169062ffffff161782556130cb602082015160020b83611671565b60408101518254606090920151600160301b600160b81b031990921660309190911b600160301b600160b01b03161760b09190911b60ff60b01b161790555f5b6015546001810180911161145e5781101561313f578061312c600192611450565b5f5260076020525f60408120550161310b565b505f612100565b608435928360020b8403610e405761308061307a6130756130939461225c886130989950612071565b60209060405161317e81611333565b5f81525f838201525f60408201525f606082015282828801015201612fe9565b6024356001600160a01b0381168103610e4057612fce9184916131e3906001600160801b03906131cd906145cf565b6001600160801b039360801d9116600f0b61203c565b16612fba565b80600301908160031161145e576001915f52600760205261321360405f20612ad2612acc84611450565b5001612f4b565b631ed9bcf960e01b5f5260045ffd5b5060ff8116156120fb565b6315d7892d60e21b92505f91508190565b630fc95b4360e01b5f5260045ffd5b636fce6c3960e01b5f5260045ffd5b6001607f1b81101561327557600f0b90565b6335278d125f526004601cfd5b6132a5906132978360801d8260801d01614ed9565b92600f0b90600f0b01614ed9565b60018060801b03169060801b1790565b90816020910312610e40575190565b6001600160a01b039182165f9081529282166020908152604093849020935163789add5560e11b815260048101949094529183916024918391165afa908115610e35575f91613311575090565b90506020813d602011613338575b8161332c602093836113b4565b81010312610e40575190565b3d915061331f565b60020b5f190190627fffff198212627fffff83131761145e57565b600291820b910b0390627fffff198212627fffff83131761145e57565b60020b908160ff1d82810118620d89e881116136925763ffffffff9192600182167001fffcb933bd6fad37aa2d162d1a59400102600160801b189160028116613676575b6004811661365a575b6008811661363e575b60108116613622575b60208116613606575b604081166135ea575b608081166135ce575b61010081166135b2575b6102008116613596575b610400811661357a575b610800811661355e575b6110008116613542575b6120008116613526575b614000811661350a575b61800081166134ee575b6201000081166134d2575b6202000081166134b7575b62040000811661349c575b6208000016613483575b5f1261347b575b0160201c90565b5f1904613474565b6b048a170391f7dc42444e8fa290910260801c9061346d565b6d2216e584f5fa1ea926041bedfe9890920260801c91613463565b916e5d6af8dedb81196699c329225ee6040260801c91613458565b916f09aa508b5b7a84e1c677de54f3e99bc90260801c9161344d565b916f31be135f97d08fd981231505542fcfa60260801c91613442565b916f70d869a156d2a1b890bb3df62baf32f70260801c91613438565b916fa9f746462d870fdf8a65dc1f90e061e50260801c9161342e565b916fd097f3bdfd2022b8845ad8f792aa58250260801c91613424565b916fe7159475a2c29b7443b29c7fa6e889d90260801c9161341a565b916ff3392b0822b70005940c7a398e4b70f30260801c91613410565b916ff987a7253ac413176f2b074cf7815e540260801c91613406565b916ffcbe86c7900a88aedcffc83b479aa3a40260801c916133fc565b916ffe5dee046a99a2a811c461f1969c30530260801c916133f2565b916fff2ea16466c96a3843ec78b326b528610260801c916133e9565b916fff973b41fa98c081472e6896dfb254c00260801c916133e0565b916fffcb9843d60f6159c9db58835c9266440260801c916133d7565b916fffe5caca7e10e4e61c3624eaa0941cd00260801c916133ce565b916ffff2e50f5f656932ef12357cf3c7fdcc0260801c916133c5565b916ffff97272373d413259a46990580e213a0260801c916133bc565b826345c3193d60e11b5f5260045260245ffd5b604051906136b282611399565b5f6040838281528260208201520152565b905f19820191821360011661145e57565b81810392915f13801582851316918412161761145e57565b801561145e575f190190565b60020b9060020b90811561371a57627fffff1981145f1983141661145e570590565b634e487b7160e01b5f52601260045260245ffd5b8181029291811591840414171561145e57565b811561371a570490565b9291909161375761480d565b613764601354809261372e565b906137726010548093611472565b9060115492838311613a46575b61378761480d565b6001810180911161145e576137a49261379f9161372e565b611472565b91808311613a3e575b50808214613a01576137e06137cf6137e6936117f46117eb60105480936115a1565b916117f46117eb60105480936115a1565b906115a1565b936015549384805b6139c0575b5061380a6020613814920194855160020b9061335b565b8560020b906136f8565b918461384b60ff60145460181c1694855f1461398657606085015160020b90818160020b125f1461397f57505b97600d5490615113565b9180613857838561372e565b1161396f575050925b5160020b9461386e856115ae565b9561387c60405197886113b4565b858752601f1961388b876115ae565b015f5b8181106139585750505f905b8682106138ab575050505050505090565b6138b5828961165d565b519060020b905260016138e76138d9846138cf858c61165d565b515160020b61209f565b606086015160020b90614f2e565b9160206138f4828b61165d565b51018360020b9052613939878a613932602061392786613921613917828761165d565b515160020b613378565b9461165d565b51015160020b613378565b9089614fcc565b6040613945838c61165d565b510190838060801b03169052019061389a565b6020906139636136a5565b82828c0101520161388e565b6139799250613741565b92613860565b9050613841565b60608501613997815160020b612071565b60020b8260020b125f146139ad57505b976117fa565b6139bb91505160020b612071565b6139a7565b945f19860186811161145e576139d590615001565b6139de87615001565b036139fb576139ef6139f5916136ec565b956136ec565b806137ee565b946137f3565b505050505050604051613a156020826113b4565b5f81525f805b818110613a2757505090565b602090613a326136a5565b82828601015201613a1b565b91505f6137ad565b83925061377f565b805115158252602080820151908301526040908101516001600160a01b0316910152565b600160ff1b811461145e575f0390565b9392916001600160a01b039182169116818103613f83575b50505f915f5b8451811015613c0d576001600160801b036040613abd838861165d565b51015116613ace575b600101613aa0565b613b7e90604060ff60145460181c16805f14613bf557613aee838961165d565b515160020b905b15613be1576020613b06848a61165d565b51015160020b5b613b2c6001600160801b0384613b23878d61165d565b51015116613263565b60ff6060613b3a878d61165d565b5101511691845193613b4b85611333565b60020b845260020b6020840152600f0b838301526060820152815180948192632d35e7ed60e11b83528860048401611531565b03815f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165af1918215610e3557600192613bc4575b509050613ac6565b613bdb9060403d8111611db257611da481836113b4565b50613bbc565b613beb838961165d565b515160020b613b0d565b6020613c01848a61165d565b51015160020b90613af5565b509190928051905f19820191821161145e57602091613c2b9161165d565b5101516018549060181b65ffffff000000169065ffffff0000001916176018557f0000000000000000000000000000000000000000000000000000000000000000613c8060018060a01b0385511630836132c4565b906020850194613c9a60018060a01b0387511630846132c4565b925f8113613f1c575b848413613ea7575b848112613db4575b5050828212613cc4575b5050509050565b84516001600160a01b039081169591169190823b15613db05760405195632961046560e21b87526004870152838660248183875af195861561074b57849596613d93575b505160209291613d2d916001600160a01b0316908390613d2790613a72565b91614611565b600460405180958193630476982d60e21b83525af1908115613d875750613d58575b80808392613cbd565b613d799060203d602011613d80575b613d7181836113b4565b8101906132b5565b505f613d4f565b503d613d67565b604051903d90823e3d90fd5b84613da29195929394956113b4565b613db057908392915f613d08565b8380fd5b81516001600160a01b03848116939116833b15612ba65760405190632961046560e21b82526004820152868160248183885af18015613e9c57908791613e87575b505080516001600160a01b031680613e73575b50516001600160a01b0316613e6957613e22602091613a72565b915b600460405180948193630476982d60e21b83525af1801561074b57613e4a575b80613cb3565b613e629060203d602011613d8057613d7181836113b4565b505f613e44565b5060208491613e24565b613e819084613d2785613a72565b5f613e08565b81613e91916113b4565b612c0957855f613df5565b6040513d89823e3d90fd5b86516001600160a01b038481169116813b15612ba65785613ee392889283604051809681958294630b0d9c0960e01b845230906004850161157f565b03925af18015613f1157908691613efc575b5050613cab565b81613f06916113b4565b611ed257845f613ef5565b6040513d88823e3d90fd5b81516001600160a01b03908116908416803b15610e4057825f91613f599383604051809681958294630b0d9c0960e01b845230906004850161157f565b03925af18015610e3557613f6e575b50613ca3565b613f7b9195505f906113b4565b5f935f613f68565b60405191613f9083611399565b81108252600160208301526040820152613fc860405191633cf3645360e21b8352613fbe60048401856114ee565b60a4830190613a4e565b6101206101048201525f610124820152602081610144815f60018060a01b037f0000000000000000000000000000000000000000000000000000000000000000165af18015610e355761401c575b80613a9a565b6140349060203d602011613d8057613d7181836113b4565b505f614016565b6101409290916140c391906001600160a01b0361405782611181565b1684526001600160a01b0361406e60208301611181565b16602085015262ffffff614084604083016113d7565b166040850152614096606082016112a4565b60020b60608501526001600160a01b03906140b390608001611181565b16608084015260a0830190613a4e565b6101206101008201525f6101208201520190565b60ff5f54166145c1576141299060a06140f13660246113e7565b207f00000000000000000000000000000000000000000000000000000000000000009061411e8183614754565b949290969150614841565b60145460181c60ff1680156145ae5760185460181c60020b8260020b135b60015f5260076020525f805160206154e38339815191525460020b9082156145a257818460020b12905b156144c05750505050906141ea91602060ff60145460181c16805f146144ac576141a561307560185460181c60020b612084565b604051916141b283611399565b151582526001838301526001600160a01b031660408083019190915251633cf3645360e21b815294859182919060246004840161403b565b03815f6001600160a01b0386165af18015610e3557614479575b61420e9250614754565b50509050925b60c435908115158203610e405762ffffff91610fff9182911561447057165b169116620f42408183020491010360ff60145460181c165f146143c757608082901d5f600f82900b1261438257600354614276916001600160801b031690611472565b6003555b600f82900b5f81126143285750505f805160206154c3833981519152916142ad60609260018060801b03166004546115a1565b6004555b600454600f548110156142e4575b600354906040519260020b835260208301526040820152a163b47b2fb160e01b905f90565b61010061ff00195f5416175f557f628a470bfdde264ef77cd19acfbfca22b3e4413adaf5837ec9fbc0043e35793f602061431c61480d565b604051908152a16142bf565b62ffffff919250614338906114c1565b9116620f42400391620f4240831161145e575f805160206154c38339815191529260609261437a91614372916001600160801b031661518e565b600454611472565b6004556142b1565b61438b906114c1565b62ffffff8216620f42400390620f4240821161145e576143bf916143b7916001600160801b031661518e565b6003546115a1565b60035561427a565b90600f81900b5f811261443357506003546143ec906001600160801b03831690611472565b6003555b60801d905f600f83900b1261442557505f805160206154c38339815191529161437a60609260018060801b03166004546115a1565b9061433862ffffff916114c1565b61443c906114c1565b62ffffff8316620f42400390620f4240821161145e57614468916143b7916001600160801b031661518e565b6003556143f0565b600c1c16614233565b6020833d6020116144a4575b81614492602093836113b4565b81010312610e405761420e9250614204565b3d9150614485565b6141a561307560185460181c60020b613340565b97949392976144d3575b50505050614214565b614534949750906144f0602092825f146145995761307590613340565b604051916144fd83611399565b1582526001838301526001600160a01b031660408083019190915251633cf3645360e21b815294859182919060246004840161403b565b03815f6001600160a01b0386165af18015610e3557614566575b6145589250614754565b50509050925f8080806144ca565b6020833d602011614591575b8161457f602093836113b4565b81010312610e4057614558925061454e565b3d9150614572565b61307590612084565b818460020b1390614171565b60185460181c60020b8260020b12614147565b5063b47b2fb160e01b905f90565b6001600160a01b0316806145e257504790565b6020602491604051928380926370a0823160e01b82523060048301525afa908115610e35575f91613311575090565b9091906001600160a01b038116908161469f5750505f80808093855af1156146365750565b6040516390bfb86560e01b81526001600160a01b0390911660048201525f602482018190526080604483015260a03d601f01601f191690810160648401523d6084840152903d9060a484013e808201600460a482015260c4633d2cec6f60e21b91015260e40190fd5b60205f604481949682604095865198899363a9059cbb60e01b855260018060a01b0316600485015260248401525af13d15601f3d116001855114161716928281528260208201520152156146f05750565b6040516390bfb86560e01b8152600481019190915263a9059cbb60e01b602482015260806044820152601f3d01601f191660a0810160648301523d60848301523d5f60a484013e808201600460a482015260c4633c9fd93960e21b91015260e40190fd5b919060209060405182810191825260066040820152604081526147786060826113b4565b519020604051631e2eaeaf60e01b8152600481019190915292839060249082906001600160a01b03165afa918215610e35575f926147d9575b506001600160a01b0382169160a081901c60020b9162ffffff60b883901c81169260d01c1690565b9091506020813d602011614805575b816147f5602093836113b4565b81010312610e405751905f6147b1565b3d91506147e8565b60105480421061483b5761482461482d91426115a1565b60135490613741565b6001810180911161145e5790565b50600190565b73fffd8963efd1fc6a506488495d951d51639616826401000276a21982016001600160a01b031611614ada57602081901b600160201b600160c01b0316808015610e4057693627a301d71055774c859160ff8260018060801b031060071b83811c60018060401b031060061b1783811c63ffffffff1060051b1783811c61ffff1060041b1783811c821060031b177b01c1818141808140018080c0814100004181408140c0c100414140c160221b6f8421084210842108cc6318c6db6d54be85831c1c601f161a17169160808310155f14614ace5750607e1982011c5b800280607f1c8160ff1c1c800280607f1c8160ff1c1c800280607f1c8160ff1c1c800280607f1c8160ff1c1c800280607f1c8160ff1c1c800280607f1c8160ff1c1c80029081607f1c8260ff1c1c80029283607f1c8460ff1c1c80029485607f1c8660ff1c1c80029687607f1c8860ff1c1c80029889607f1c8a60ff1c1c80029a8b607f1c8c60ff1c1c80029c8d80607f1c9060ff1c1c600160321b90800260cd1c169d600160331b9060cc1c169c600160341b9060cb1c169b600160351b9060ca1c169a600160361b9060c91c1699600160371b9060c81c1698600160381b9060c71c1697600160391b9060c61c16966001603a1b9060c51c16956001603b1b9060c41c16946001603c1b9060c31c16936001603d1b9060c21c16926001603e1b9060c11c16916001603f1b9060c01c1690607f190160401b1717171717171717171717171717026fdb2df09e81959a81455e260799a0632f6f028f6481ab7f045a5af012a19d003aa919820160801d60020b910160801d60020b918282145f14614aaa5750905090565b6001600160a01b0390811690614abf84613378565b1611614ac9575090565b905090565b905081607f031b61491e565b6318521d4960e21b5f9081526001600160a01b0391909116600452602490fd5b91905f905f905f5b8551811015614c8d576001600160801b036040614b1f838961165d565b51015116614b30575b600101614b02565b9192614bdf604060ff60145460181c16805f14614c7557614b51868a61165d565b515160020b905b15614c61576020614b69878b61165d565b51015160020b5b8960ff6060614b9b8a6139216001600160801b0389614b8f848961165d565b51015116600f0b6114c1565b5101511691845193614bac85611333565b60020b845260020b6020840152600f0b838301526060820152815180938192632d35e7ed60e11b83528760048401611531565b03815f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165af1918215610e3557600192614c36925f905f92614c3e575b50614c309192613282565b95613282565b929050614b28565b614c309250614c5b915060403d8111611db257611da481836113b4565b91614c25565b614c6b868a61165d565b515160020b614b70565b6020614c81878b61165d565b51015160020b90614b58565b505091909250614c9f82600654613282565b600655565b9093929193614cb16136a5565b9480614e0457505f5b6001600160a01b031680614cde5750505060020b80835260208301525f6040830152565b919250614de991614d9090606090614d829060b56001600160881b03821160071b82811c6001600160481b031060061b1782811c64ffffffffff1060051b1782811c62ffffff1060041b17600181811c9290921b9083901c62010000010260121c80830401811c80830401811c80830401811c80830401811c80830401811c80830401811c80830401901c908190048111900360301b6001600160a01b0316614841565b940193845160020b90614f2e565b92614dd1602087019460020b9182865260ff60145460181c1692835f14614df15750614dc690865160020b905160020b9061335b565b60020b808852613378565b93516001600160801b0394906129e29060020b613378565b166040830152565b614dff915160020b9061209f565b614dc6565b8160ff60145460181c165f14614e3d5750600654614e3891614e329160801d6001600160801b0316906115a1565b826152fd565b614cba565b600654614e3892614e57916001600160801b0316906115a1565b6152fd565b90670de0b6b3a7640000820291808305670de0b6b3a7640000149015171561145e57565b81810292915f8212600160ff1b82141661145e57818405149015171561145e57565b9060018201915f60018412911290801582169115161761145e57565b9190915f838201938412911290801582169115161761145e57565b9081600f0b918203614ee757565b6393dafdf160e01b5f5260045ffd5b80628000000160181c15614f11576335278d125f526004601cfd5b60020b90565b9060020b9060020b02908160020b91820361145e57565b9060ff60145460181c165f14614f7a575f8260020b125f14614f6d57614f6881614f63614f5e82611e679661335b565b612084565b6136f8565b614f17565b614f6881611e67936136f8565b5f8260020b125f14614f9357614f6881611e67936136f8565b614f6881614f63614fa782611e679661209f565b613340565b6117fa6117db6117d26117c96117c4611e6795614fc761480d565b614ebe565b90929091908015614ffb575f19810190811161145e57915b15614ff257611e6792615420565b611e67926153dd565b91614fe4565b61501c6150136150259261379f61480d565b6013549061372e565b60105490611472565b601154808211614ac9575090565b90670de0b6b3a76400008202905f19670de0b6b3a7640000840992828085109403938085039485841115610e4057146150c357670de0b6b3a764000082910981805f03168092046002816003021880820260020302808202600203028082026002030280820260020302808202600203028091026002030293600183805f03040190848311900302920304170290565b5091500490565b81810291905f1982820991838084109303928084039384600160601b1115610e40571461510a57600160601b910990828211900360a01b910360601c1790565b50505060601c90565b808202905f1983820990828083109203918083039283670de0b6b3a76400001115610e40571461517d577faccb18165bd6fe31ae1cf318dc5b51eee0e1ba569b88cd74c1773b91fac1066993670de0b6b3a7640000910990828211900360ee1b910360121c170290565b5050670de0b6b3a764000091500490565b808202905f1983820990828083109203918083039283620f42401115610e4057146151ee577fde8f6cefed634549b62c77574f722e1ac57e23f24d8fd5cb790fb65668c2613993620f4240910990828211900360fa1b910360061c170290565b5050620f424091500490565b90606082901b905f19600160601b840992828085109403938085039485841115610e4057146150c3578190600160601b900981805f03168092046002816003021880820260020302808202600203028082026002030280820260020302808202600203028091026002030293600183805f03040190848311900302920304170290565b91818302915f1981850993838086109503948086039586851115610e4057146152f5579082910981805f03168092046002816003021880820260020302808202600203028082026002030280820260020302808202600203028091026002030293600183805f03040190848311900302920304170290565b505091500490565b90615307916151fa565b6001600160a01b03811161532d57600160a01b811015613275576001600160a01b031690565b505f90565b615378612dab615348612ecb60a0612175611f3d565b60145460181c60ff16156153ac5760125460020b808260020b135f146153a557505b60125460181c60020b61335b565b61538a614824601154601054906115a1565b90811561371a57600160ff1b81145f1983141661145e570590565b905061536a565b60125460020b808260020b125f146153a5575061536a565b6001600160a01b03918216908216039190821161145e57565b611e67926154159290916001600160a01b038083169082161161541a575b6001600160a01b039161540e91906153c4565b16906151fa565b615474565b906153fb565b611e6792615415929091906001600160a01b038082169083161161546e575b6154676154586001600160a01b038381169085166150ca565b926001600160a01b03926153c4565b169161527d565b9061543f565b6001600160801b0381169190820361548857565b60405162461bcd60e51b81526020600482015260126024820152716c6971756964697479206f766572666c6f7760701b6044820152606490fdfe27db09392d7d230eb65a11bd84925fb8da90df8a067ca8a4fc2933b4f637262bb39221ace053465ec3453ce2b36430bd138b997ecea25c1043da0c366812b828b7c774451310d1be4108bc180d1b52823cb0ee0274a6c0081bcaf94f115fb96da164736f6c634300081a000a";
|
|
1160
1218
|
|
|
@@ -12317,6 +12375,550 @@ var DynamicAuction = class {
|
|
|
12317
12375
|
return value;
|
|
12318
12376
|
}
|
|
12319
12377
|
};
|
|
12378
|
+
var ABSENT_POOL_ERROR_ABI = [
|
|
12379
|
+
{ type: "error", name: "PoolNotFound", inputs: [] },
|
|
12380
|
+
{ type: "error", name: "PoolNotInitialized", inputs: [] }
|
|
12381
|
+
];
|
|
12382
|
+
async function findMulticurveInitializerForPool({
|
|
12383
|
+
client,
|
|
12384
|
+
tokenAddress,
|
|
12385
|
+
addresses
|
|
12386
|
+
}) {
|
|
12387
|
+
const initializersToTry = getMulticurveInitializerCandidates(addresses);
|
|
12388
|
+
if (initializersToTry.length === 0) {
|
|
12389
|
+
throw new Error(
|
|
12390
|
+
"No V4 multicurve initializer addresses configured for this chain"
|
|
12391
|
+
);
|
|
12392
|
+
}
|
|
12393
|
+
const triedInitializers = [];
|
|
12394
|
+
const failedInitializers = [];
|
|
12395
|
+
for (const initializer of initializersToTry) {
|
|
12396
|
+
const { address: initializerAddress, kind } = initializer;
|
|
12397
|
+
triedInitializers.push(initializerAddress);
|
|
12398
|
+
let stateData;
|
|
12399
|
+
try {
|
|
12400
|
+
stateData = await client.readContract({
|
|
12401
|
+
address: initializerAddress,
|
|
12402
|
+
abi: getMulticurveInitializerAbi(kind),
|
|
12403
|
+
functionName: "getState",
|
|
12404
|
+
args: [tokenAddress]
|
|
12405
|
+
});
|
|
12406
|
+
} catch (error) {
|
|
12407
|
+
if (!isAbsentPoolReadFailure(error)) {
|
|
12408
|
+
throw error;
|
|
12409
|
+
}
|
|
12410
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
12411
|
+
failedInitializers.push(
|
|
12412
|
+
new Error(`${initializerAddress} getState failed: ${reason}`)
|
|
12413
|
+
);
|
|
12414
|
+
continue;
|
|
12415
|
+
}
|
|
12416
|
+
const discoveryResult = parseMulticurveInitializerDiscoveryResult({
|
|
12417
|
+
tokenAddress,
|
|
12418
|
+
initializerAddress,
|
|
12419
|
+
kind,
|
|
12420
|
+
stateData
|
|
12421
|
+
});
|
|
12422
|
+
if (isInitializedMulticurvePoolKey(discoveryResult.state.poolKey)) {
|
|
12423
|
+
return discoveryResult;
|
|
12424
|
+
}
|
|
12425
|
+
}
|
|
12426
|
+
const notFoundError = new Error(
|
|
12427
|
+
`Pool not found for token ${tokenAddress}. Tried initializers: ${triedInitializers.join(", ")}` + (failedInitializers.length > 0 ? `. Failed initializers: ${failedInitializers.map((error) => error.message).join(" | ")}` : "")
|
|
12428
|
+
);
|
|
12429
|
+
if (failedInitializers.length > 0) {
|
|
12430
|
+
notFoundError.cause = new AggregateError(
|
|
12431
|
+
failedInitializers,
|
|
12432
|
+
`Initializer discovery failed for token ${tokenAddress}`
|
|
12433
|
+
);
|
|
12434
|
+
}
|
|
12435
|
+
throw notFoundError;
|
|
12436
|
+
}
|
|
12437
|
+
function parseMulticurvePoolKey(rawPoolKey) {
|
|
12438
|
+
const poolKeyStruct = rawPoolKey;
|
|
12439
|
+
return {
|
|
12440
|
+
currency0: poolKeyStruct.currency0 ?? poolKeyStruct[0],
|
|
12441
|
+
currency1: poolKeyStruct.currency1 ?? poolKeyStruct[1],
|
|
12442
|
+
fee: Number(poolKeyStruct.fee ?? poolKeyStruct[2]),
|
|
12443
|
+
tickSpacing: Number(poolKeyStruct.tickSpacing ?? poolKeyStruct[3]),
|
|
12444
|
+
hooks: poolKeyStruct.hooks ?? poolKeyStruct[4]
|
|
12445
|
+
};
|
|
12446
|
+
}
|
|
12447
|
+
function getMulticurveInitializerCandidates(addresses) {
|
|
12448
|
+
return [
|
|
12449
|
+
{
|
|
12450
|
+
address: addresses.v4MulticurveInitializer,
|
|
12451
|
+
kind: "standard"
|
|
12452
|
+
},
|
|
12453
|
+
{
|
|
12454
|
+
address: addresses.v4ScheduledMulticurveInitializer,
|
|
12455
|
+
kind: "standard"
|
|
12456
|
+
},
|
|
12457
|
+
{
|
|
12458
|
+
address: addresses.v4DecayMulticurveInitializer,
|
|
12459
|
+
kind: "standard"
|
|
12460
|
+
},
|
|
12461
|
+
{
|
|
12462
|
+
address: addresses.dopplerHookInitializer,
|
|
12463
|
+
kind: "dopplerHook"
|
|
12464
|
+
}
|
|
12465
|
+
].filter(
|
|
12466
|
+
(entry) => Boolean(entry.address && entry.address !== zeroAddress)
|
|
12467
|
+
);
|
|
12468
|
+
}
|
|
12469
|
+
function getMulticurveInitializerAbi(kind) {
|
|
12470
|
+
return kind === "dopplerHook" ? dopplerHookInitializerAbi : v4MulticurveInitializerAbi;
|
|
12471
|
+
}
|
|
12472
|
+
function parseMulticurveInitializerDiscoveryResult({
|
|
12473
|
+
tokenAddress,
|
|
12474
|
+
initializerAddress,
|
|
12475
|
+
kind,
|
|
12476
|
+
stateData
|
|
12477
|
+
}) {
|
|
12478
|
+
const parsedState = kind === "dopplerHook" ? parseDopplerHookInitializerState(stateData) : parseStandardInitializerState(stateData);
|
|
12479
|
+
const { numeraire, status, poolKey, farTick } = parsedState;
|
|
12480
|
+
return {
|
|
12481
|
+
initializerAddress,
|
|
12482
|
+
state: {
|
|
12483
|
+
asset: tokenAddress,
|
|
12484
|
+
numeraire,
|
|
12485
|
+
fee: poolKey.fee,
|
|
12486
|
+
tickSpacing: poolKey.tickSpacing,
|
|
12487
|
+
status,
|
|
12488
|
+
poolKey,
|
|
12489
|
+
farTick: Number(farTick)
|
|
12490
|
+
}
|
|
12491
|
+
};
|
|
12492
|
+
}
|
|
12493
|
+
function isInitializedMulticurvePoolKey(poolKey) {
|
|
12494
|
+
return poolKey.hooks !== zeroAddress && poolKey.tickSpacing !== 0;
|
|
12495
|
+
}
|
|
12496
|
+
function isAbsentPoolRevertData(data) {
|
|
12497
|
+
if (data === "0x") {
|
|
12498
|
+
return false;
|
|
12499
|
+
}
|
|
12500
|
+
try {
|
|
12501
|
+
const decodedError = decodeErrorResult({
|
|
12502
|
+
abi: ABSENT_POOL_ERROR_ABI,
|
|
12503
|
+
data
|
|
12504
|
+
});
|
|
12505
|
+
return decodedError.errorName === "PoolNotFound" || decodedError.errorName === "PoolNotInitialized";
|
|
12506
|
+
} catch (error) {
|
|
12507
|
+
if (error instanceof Error) {
|
|
12508
|
+
return false;
|
|
12509
|
+
}
|
|
12510
|
+
throw error;
|
|
12511
|
+
}
|
|
12512
|
+
}
|
|
12513
|
+
function parseStandardInitializerState(stateData) {
|
|
12514
|
+
const state = stateData;
|
|
12515
|
+
return {
|
|
12516
|
+
numeraire: state.numeraire ?? state[0],
|
|
12517
|
+
status: Number(state.status ?? state[1]),
|
|
12518
|
+
poolKey: parseMulticurvePoolKey(state.poolKey ?? state[2]),
|
|
12519
|
+
farTick: Number(state.farTick ?? state[3])
|
|
12520
|
+
};
|
|
12521
|
+
}
|
|
12522
|
+
function parseDopplerHookInitializerState(stateData) {
|
|
12523
|
+
const state = stateData;
|
|
12524
|
+
return {
|
|
12525
|
+
numeraire: state.numeraire ?? state[0],
|
|
12526
|
+
status: Number(state.status ?? state[4]),
|
|
12527
|
+
poolKey: parseMulticurvePoolKey(state.poolKey ?? state[5]),
|
|
12528
|
+
farTick: Number(state.farTick ?? state[6])
|
|
12529
|
+
};
|
|
12530
|
+
}
|
|
12531
|
+
function isAbsentPoolReadFailure(error) {
|
|
12532
|
+
if (!(error instanceof BaseError)) {
|
|
12533
|
+
return false;
|
|
12534
|
+
}
|
|
12535
|
+
const revertedError = error.walk(
|
|
12536
|
+
(cause) => cause instanceof ContractFunctionRevertedError
|
|
12537
|
+
);
|
|
12538
|
+
if (!(revertedError instanceof ContractFunctionRevertedError)) {
|
|
12539
|
+
return false;
|
|
12540
|
+
}
|
|
12541
|
+
return revertedError.data?.errorName === "PoolNotFound" || revertedError.data?.errorName === "PoolNotInitialized";
|
|
12542
|
+
}
|
|
12543
|
+
|
|
12544
|
+
// src/evm/entities/auction/multicurve/multicurveFeeCollection.ts
|
|
12545
|
+
async function collectMulticurveFees({
|
|
12546
|
+
client,
|
|
12547
|
+
walletClient,
|
|
12548
|
+
initializerAddress,
|
|
12549
|
+
state,
|
|
12550
|
+
addresses
|
|
12551
|
+
}) {
|
|
12552
|
+
if (state.status === 2 /* Locked */) {
|
|
12553
|
+
const poolId = computePoolId(state.poolKey);
|
|
12554
|
+
const collectFeesAbi = initializerAddress === addresses.dopplerHookInitializer ? dopplerHookInitializerAbi : v4MulticurveInitializerAbi;
|
|
12555
|
+
return collectFeesFromContract({
|
|
12556
|
+
client,
|
|
12557
|
+
walletClient,
|
|
12558
|
+
contractAddress: initializerAddress,
|
|
12559
|
+
abi: collectFeesAbi,
|
|
12560
|
+
poolId
|
|
12561
|
+
});
|
|
12562
|
+
}
|
|
12563
|
+
throw new Error("Multicurve pool is not locked or was migrated");
|
|
12564
|
+
}
|
|
12565
|
+
async function collectFeesFromContract({
|
|
12566
|
+
client,
|
|
12567
|
+
walletClient,
|
|
12568
|
+
contractAddress,
|
|
12569
|
+
abi,
|
|
12570
|
+
poolId
|
|
12571
|
+
}) {
|
|
12572
|
+
const { request, result } = await client.simulateContract({
|
|
12573
|
+
address: contractAddress,
|
|
12574
|
+
abi,
|
|
12575
|
+
functionName: "collectFees",
|
|
12576
|
+
args: [poolId],
|
|
12577
|
+
account: walletClient.account
|
|
12578
|
+
});
|
|
12579
|
+
const hash = await walletClient.writeContract(request);
|
|
12580
|
+
await client.waitForTransactionReceipt({ hash, confirmations: 1 });
|
|
12581
|
+
const [fees0, fees1] = result;
|
|
12582
|
+
return {
|
|
12583
|
+
fees0,
|
|
12584
|
+
fees1,
|
|
12585
|
+
transactionHash: hash
|
|
12586
|
+
};
|
|
12587
|
+
}
|
|
12588
|
+
async function getMulticurveFeeSchedule(client, state) {
|
|
12589
|
+
if (state.poolKey.fee !== DYNAMIC_FEE_FLAG) {
|
|
12590
|
+
return null;
|
|
12591
|
+
}
|
|
12592
|
+
const poolId = computePoolId(state.poolKey);
|
|
12593
|
+
try {
|
|
12594
|
+
const scheduleData = await client.readContract({
|
|
12595
|
+
address: state.poolKey.hooks,
|
|
12596
|
+
abi: decayMulticurveInitializerHookAbi,
|
|
12597
|
+
functionName: "getFeeScheduleOf",
|
|
12598
|
+
args: [poolId]
|
|
12599
|
+
});
|
|
12600
|
+
return {
|
|
12601
|
+
startingTime: Number(readStructField(scheduleData, "startingTime", 0)),
|
|
12602
|
+
startFee: Number(readStructField(scheduleData, "startFee", 1)),
|
|
12603
|
+
endFee: Number(readStructField(scheduleData, "endFee", 2)),
|
|
12604
|
+
lastFee: Number(readStructField(scheduleData, "lastFee", 3)),
|
|
12605
|
+
durationSeconds: Number(
|
|
12606
|
+
readStructField(scheduleData, "durationSeconds", 4)
|
|
12607
|
+
)
|
|
12608
|
+
};
|
|
12609
|
+
} catch (error) {
|
|
12610
|
+
if (!isMissingFeeScheduleHook(error)) {
|
|
12611
|
+
throw error;
|
|
12612
|
+
}
|
|
12613
|
+
throw new Error(
|
|
12614
|
+
`Dynamic multicurve hook at ${state.poolKey.hooks} does not expose getFeeScheduleOf(poolId)`,
|
|
12615
|
+
{ cause: error }
|
|
12616
|
+
);
|
|
12617
|
+
}
|
|
12618
|
+
}
|
|
12619
|
+
function isMissingFeeScheduleHook(error) {
|
|
12620
|
+
if (!(error instanceof BaseError)) {
|
|
12621
|
+
return false;
|
|
12622
|
+
}
|
|
12623
|
+
return Boolean(
|
|
12624
|
+
error.walk(
|
|
12625
|
+
(cause) => cause instanceof ContractFunctionZeroDataError || cause instanceof ContractFunctionRevertedError && !cause.data && !cause.reason && !cause.signature
|
|
12626
|
+
)
|
|
12627
|
+
);
|
|
12628
|
+
}
|
|
12629
|
+
function readStructField(value, fieldName, tupleIndex) {
|
|
12630
|
+
if (Array.isArray(value)) {
|
|
12631
|
+
return value[tupleIndex] ?? 0;
|
|
12632
|
+
}
|
|
12633
|
+
if (typeof value === "object" && value !== null && fieldName in value) {
|
|
12634
|
+
return value[fieldName] ?? 0;
|
|
12635
|
+
}
|
|
12636
|
+
return 0;
|
|
12637
|
+
}
|
|
12638
|
+
function getMulticall3Address(client) {
|
|
12639
|
+
const multicall3Address = client.chain?.contracts?.multicall3?.address;
|
|
12640
|
+
if (!multicall3Address || multicall3Address === zeroAddress) {
|
|
12641
|
+
throw new Error(
|
|
12642
|
+
"Multicall3 address is not configured on this chain. Configure the viem chain multicall3 contract before previewing pending fees."
|
|
12643
|
+
);
|
|
12644
|
+
}
|
|
12645
|
+
return multicall3Address;
|
|
12646
|
+
}
|
|
12647
|
+
async function callAggregate3(client, calls) {
|
|
12648
|
+
const response = await client.call({
|
|
12649
|
+
to: getMulticall3Address(client),
|
|
12650
|
+
data: encodeFunctionData({
|
|
12651
|
+
abi: multicall3Abi,
|
|
12652
|
+
functionName: "aggregate3",
|
|
12653
|
+
args: [calls]
|
|
12654
|
+
})
|
|
12655
|
+
});
|
|
12656
|
+
if (!response.data) {
|
|
12657
|
+
throw new Error("Multicall3 aggregate3 returned no data");
|
|
12658
|
+
}
|
|
12659
|
+
return decodeFunctionResult({
|
|
12660
|
+
abi: multicall3Abi,
|
|
12661
|
+
functionName: "aggregate3",
|
|
12662
|
+
data: response.data
|
|
12663
|
+
});
|
|
12664
|
+
}
|
|
12665
|
+
var PENDING_FEE_CALL_ORDER = [
|
|
12666
|
+
"collectFees",
|
|
12667
|
+
"getShares",
|
|
12668
|
+
"getCumulatedFees0",
|
|
12669
|
+
"getCumulatedFees1",
|
|
12670
|
+
"getLastCumulatedFees0",
|
|
12671
|
+
"getLastCumulatedFees1"
|
|
12672
|
+
];
|
|
12673
|
+
var PENDING_FEE_PREVIEW_CALL_COUNT = PENDING_FEE_CALL_ORDER.length;
|
|
12674
|
+
function createPendingFeePreviewCalls(target, poolId, beneficiary) {
|
|
12675
|
+
return PENDING_FEE_CALL_ORDER.map((functionName) => ({
|
|
12676
|
+
target,
|
|
12677
|
+
allowFailure: true,
|
|
12678
|
+
callData: encodeFunctionData({
|
|
12679
|
+
abi: feeClaimsInitializerAbi,
|
|
12680
|
+
functionName,
|
|
12681
|
+
args: functionName === "collectFees" || functionName === "getCumulatedFees0" || functionName === "getCumulatedFees1" ? [poolId] : [poolId, beneficiary]
|
|
12682
|
+
})
|
|
12683
|
+
}));
|
|
12684
|
+
}
|
|
12685
|
+
function calculatePendingFees(callResults) {
|
|
12686
|
+
const preview = decodePendingFeePreview(callResults);
|
|
12687
|
+
if (preview.cumulatedFees0 < preview.lastCumulatedFees0) {
|
|
12688
|
+
throw new Error("Accumulated fees are below beneficiary checkpoint");
|
|
12689
|
+
}
|
|
12690
|
+
if (preview.cumulatedFees1 < preview.lastCumulatedFees1) {
|
|
12691
|
+
throw new Error("Accumulated fees are below beneficiary checkpoint");
|
|
12692
|
+
}
|
|
12693
|
+
return {
|
|
12694
|
+
fees0: (preview.cumulatedFees0 - preview.lastCumulatedFees0) * preview.shares / WAD,
|
|
12695
|
+
fees1: (preview.cumulatedFees1 - preview.lastCumulatedFees1) * preview.shares / WAD
|
|
12696
|
+
};
|
|
12697
|
+
}
|
|
12698
|
+
function decodePendingFeePreview(callResults) {
|
|
12699
|
+
if (callResults.length !== PENDING_FEE_CALL_ORDER.length) {
|
|
12700
|
+
throw new Error("Multicall3 aggregate3 returned an incomplete pool result");
|
|
12701
|
+
}
|
|
12702
|
+
for (const [index, result] of callResults.entries()) {
|
|
12703
|
+
const functionName = PENDING_FEE_CALL_ORDER[index];
|
|
12704
|
+
if (!result.success) {
|
|
12705
|
+
throw new Error(`${functionName} call failed`);
|
|
12706
|
+
}
|
|
12707
|
+
if (!result.returnData || result.returnData === "0x") {
|
|
12708
|
+
throw new Error(`${functionName} returned no data`);
|
|
12709
|
+
}
|
|
12710
|
+
}
|
|
12711
|
+
decodeFunctionResult({
|
|
12712
|
+
abi: feeClaimsInitializerAbi,
|
|
12713
|
+
functionName: "collectFees",
|
|
12714
|
+
data: callResults[0].returnData
|
|
12715
|
+
});
|
|
12716
|
+
return {
|
|
12717
|
+
shares: decodeUint256("getShares", callResults[1].returnData),
|
|
12718
|
+
cumulatedFees0: decodeUint256(
|
|
12719
|
+
"getCumulatedFees0",
|
|
12720
|
+
callResults[2].returnData
|
|
12721
|
+
),
|
|
12722
|
+
cumulatedFees1: decodeUint256(
|
|
12723
|
+
"getCumulatedFees1",
|
|
12724
|
+
callResults[3].returnData
|
|
12725
|
+
),
|
|
12726
|
+
lastCumulatedFees0: decodeUint256(
|
|
12727
|
+
"getLastCumulatedFees0",
|
|
12728
|
+
callResults[4].returnData
|
|
12729
|
+
),
|
|
12730
|
+
lastCumulatedFees1: decodeUint256(
|
|
12731
|
+
"getLastCumulatedFees1",
|
|
12732
|
+
callResults[5].returnData
|
|
12733
|
+
)
|
|
12734
|
+
};
|
|
12735
|
+
}
|
|
12736
|
+
function decodeUint256(functionName, data) {
|
|
12737
|
+
const value = decodeFunctionResult({
|
|
12738
|
+
abi: feeClaimsInitializerAbi,
|
|
12739
|
+
functionName,
|
|
12740
|
+
data
|
|
12741
|
+
});
|
|
12742
|
+
if (typeof value !== "bigint") {
|
|
12743
|
+
throw new Error(`${functionName} returned invalid data`);
|
|
12744
|
+
}
|
|
12745
|
+
return value;
|
|
12746
|
+
}
|
|
12747
|
+
|
|
12748
|
+
// src/evm/entities/auction/multicurve/multicurvePendingFeeReader.ts
|
|
12749
|
+
async function getPendingFeesForMulticurvePool({
|
|
12750
|
+
client,
|
|
12751
|
+
beneficiary,
|
|
12752
|
+
poolContext
|
|
12753
|
+
}) {
|
|
12754
|
+
const pendingFees = await getPendingFeesForDiscoveredMulticurvePools({
|
|
12755
|
+
client,
|
|
12756
|
+
beneficiary,
|
|
12757
|
+
poolContexts: [poolContext]
|
|
12758
|
+
});
|
|
12759
|
+
const poolPendingFees = pendingFees[0];
|
|
12760
|
+
if (!poolPendingFees) {
|
|
12761
|
+
throw new Error("Pending fee preview returned no pool result");
|
|
12762
|
+
}
|
|
12763
|
+
return {
|
|
12764
|
+
fees0: poolPendingFees.fees0,
|
|
12765
|
+
fees1: poolPendingFees.fees1
|
|
12766
|
+
};
|
|
12767
|
+
}
|
|
12768
|
+
async function getPendingFeesForMulticurveTokens({
|
|
12769
|
+
client,
|
|
12770
|
+
beneficiary,
|
|
12771
|
+
tokenAddresses
|
|
12772
|
+
}) {
|
|
12773
|
+
if (tokenAddresses.length === 0) {
|
|
12774
|
+
return [];
|
|
12775
|
+
}
|
|
12776
|
+
const feeClient = client;
|
|
12777
|
+
const poolContexts = await discoverMulticurveFeePoolContexts(
|
|
12778
|
+
feeClient,
|
|
12779
|
+
tokenAddresses
|
|
12780
|
+
);
|
|
12781
|
+
return getPendingFeesForDiscoveredMulticurvePools({
|
|
12782
|
+
client: feeClient,
|
|
12783
|
+
beneficiary,
|
|
12784
|
+
poolContexts
|
|
12785
|
+
});
|
|
12786
|
+
}
|
|
12787
|
+
async function discoverMulticurveFeePoolContexts(client, tokenAddresses) {
|
|
12788
|
+
const chainId = await client.getChainId();
|
|
12789
|
+
const addresses = getAddresses(chainId);
|
|
12790
|
+
const initializers = getMulticurveInitializerCandidates(addresses);
|
|
12791
|
+
if (initializers.length === 0) {
|
|
12792
|
+
throw new Error(
|
|
12793
|
+
"No V4 multicurve initializer addresses configured for this chain"
|
|
12794
|
+
);
|
|
12795
|
+
}
|
|
12796
|
+
const discoveryContexts = createDiscoveryCallContexts(
|
|
12797
|
+
tokenAddresses,
|
|
12798
|
+
initializers
|
|
12799
|
+
);
|
|
12800
|
+
const discoveryResults = await callAggregate3(
|
|
12801
|
+
client,
|
|
12802
|
+
createDiscoveryCalls(discoveryContexts)
|
|
12803
|
+
);
|
|
12804
|
+
if (discoveryResults.length !== discoveryContexts.length) {
|
|
12805
|
+
throw new Error(
|
|
12806
|
+
"Multicall3 aggregate3 returned an incomplete initializer discovery result"
|
|
12807
|
+
);
|
|
12808
|
+
}
|
|
12809
|
+
return tokenAddresses.map(
|
|
12810
|
+
(tokenAddress, tokenIndex) => findInitializedPoolForToken({
|
|
12811
|
+
tokenAddress,
|
|
12812
|
+
initializers,
|
|
12813
|
+
discoveryResults: discoveryResults.slice(
|
|
12814
|
+
tokenIndex * initializers.length,
|
|
12815
|
+
(tokenIndex + 1) * initializers.length
|
|
12816
|
+
)
|
|
12817
|
+
})
|
|
12818
|
+
);
|
|
12819
|
+
}
|
|
12820
|
+
function createDiscoveryCallContexts(tokenAddresses, initializers) {
|
|
12821
|
+
return tokenAddresses.flatMap(
|
|
12822
|
+
(tokenAddress) => initializers.map((initializer) => ({
|
|
12823
|
+
tokenAddress,
|
|
12824
|
+
initializer
|
|
12825
|
+
}))
|
|
12826
|
+
);
|
|
12827
|
+
}
|
|
12828
|
+
function createDiscoveryCalls(contexts) {
|
|
12829
|
+
return contexts.map(({ tokenAddress, initializer }) => ({
|
|
12830
|
+
target: initializer.address,
|
|
12831
|
+
allowFailure: true,
|
|
12832
|
+
callData: encodeFunctionData({
|
|
12833
|
+
abi: getMulticurveInitializerAbi(initializer.kind),
|
|
12834
|
+
functionName: "getState",
|
|
12835
|
+
args: [tokenAddress]
|
|
12836
|
+
})
|
|
12837
|
+
}));
|
|
12838
|
+
}
|
|
12839
|
+
function findInitializedPoolForToken({
|
|
12840
|
+
tokenAddress,
|
|
12841
|
+
initializers,
|
|
12842
|
+
discoveryResults
|
|
12843
|
+
}) {
|
|
12844
|
+
for (const [index, result] of discoveryResults.entries()) {
|
|
12845
|
+
const initializer = initializers[index];
|
|
12846
|
+
if (!initializer) {
|
|
12847
|
+
throw new Error(
|
|
12848
|
+
"Multicall3 aggregate3 returned an incomplete initializer discovery result"
|
|
12849
|
+
);
|
|
12850
|
+
}
|
|
12851
|
+
if (!result.success) {
|
|
12852
|
+
if (isAbsentPoolRevertData(result.returnData)) {
|
|
12853
|
+
continue;
|
|
12854
|
+
}
|
|
12855
|
+
throw new Error(
|
|
12856
|
+
`${initializer.address} getState failed for token ${tokenAddress}`
|
|
12857
|
+
);
|
|
12858
|
+
}
|
|
12859
|
+
if (!result.returnData || result.returnData === "0x") {
|
|
12860
|
+
throw new Error(
|
|
12861
|
+
`${initializer.address} getState returned no data for token ${tokenAddress}`
|
|
12862
|
+
);
|
|
12863
|
+
}
|
|
12864
|
+
const discoveryResult = parseMulticurveInitializerDiscoveryResult({
|
|
12865
|
+
tokenAddress,
|
|
12866
|
+
initializerAddress: initializer.address,
|
|
12867
|
+
kind: initializer.kind,
|
|
12868
|
+
stateData: decodeFunctionResult({
|
|
12869
|
+
abi: getMulticurveInitializerAbi(initializer.kind),
|
|
12870
|
+
functionName: "getState",
|
|
12871
|
+
data: result.returnData
|
|
12872
|
+
})
|
|
12873
|
+
});
|
|
12874
|
+
if (isInitializedMulticurvePoolKey(discoveryResult.state.poolKey)) {
|
|
12875
|
+
assertPendingFeePreviewable(discoveryResult);
|
|
12876
|
+
return discoveryResult;
|
|
12877
|
+
}
|
|
12878
|
+
}
|
|
12879
|
+
throw new Error(
|
|
12880
|
+
`Pool not found for token ${tokenAddress}. Tried initializers: ${initializers.map((initializer) => initializer.address).join(", ")}`
|
|
12881
|
+
);
|
|
12882
|
+
}
|
|
12883
|
+
function assertPendingFeePreviewable(discoveryResult) {
|
|
12884
|
+
const { asset, status } = discoveryResult.state;
|
|
12885
|
+
if (status === 3 /* Exited */) {
|
|
12886
|
+
throw new Error(
|
|
12887
|
+
`Pending fee preview is only supported for initializer-side multicurve pools: ${asset}`
|
|
12888
|
+
);
|
|
12889
|
+
}
|
|
12890
|
+
if (status !== 2 /* Locked */) {
|
|
12891
|
+
throw new Error(`Multicurve pool is not locked or was migrated: ${asset}`);
|
|
12892
|
+
}
|
|
12893
|
+
}
|
|
12894
|
+
async function getPendingFeesForDiscoveredMulticurvePools({
|
|
12895
|
+
client,
|
|
12896
|
+
beneficiary,
|
|
12897
|
+
poolContexts
|
|
12898
|
+
}) {
|
|
12899
|
+
for (const poolContext of poolContexts) {
|
|
12900
|
+
assertPendingFeePreviewable(poolContext);
|
|
12901
|
+
}
|
|
12902
|
+
const previewCalls = poolContexts.flatMap(
|
|
12903
|
+
({ initializerAddress, state }) => createPendingFeePreviewCalls(
|
|
12904
|
+
initializerAddress,
|
|
12905
|
+
computePoolId(state.poolKey),
|
|
12906
|
+
beneficiary
|
|
12907
|
+
)
|
|
12908
|
+
);
|
|
12909
|
+
const previewResults = await callAggregate3(client, previewCalls);
|
|
12910
|
+
return poolContexts.map(({ state }, index) => ({
|
|
12911
|
+
tokenAddress: state.asset,
|
|
12912
|
+
...calculatePendingFees(
|
|
12913
|
+
previewResults.slice(
|
|
12914
|
+
index * PENDING_FEE_PREVIEW_CALL_COUNT,
|
|
12915
|
+
(index + 1) * PENDING_FEE_PREVIEW_CALL_COUNT
|
|
12916
|
+
)
|
|
12917
|
+
)
|
|
12918
|
+
}));
|
|
12919
|
+
}
|
|
12920
|
+
|
|
12921
|
+
// src/evm/entities/auction/MulticurvePool.ts
|
|
12320
12922
|
var MulticurvePool = class {
|
|
12321
12923
|
client;
|
|
12322
12924
|
walletClient;
|
|
@@ -12357,130 +12959,47 @@ var MulticurvePool = class {
|
|
|
12357
12959
|
async findInitializerForPool() {
|
|
12358
12960
|
const chainId = await this.rpc.getChainId();
|
|
12359
12961
|
const addresses = getAddresses(chainId);
|
|
12360
|
-
|
|
12361
|
-
|
|
12362
|
-
|
|
12363
|
-
|
|
12364
|
-
|
|
12365
|
-
{
|
|
12366
|
-
address: addresses.v4ScheduledMulticurveInitializer,
|
|
12367
|
-
kind: "standard"
|
|
12368
|
-
},
|
|
12369
|
-
{
|
|
12370
|
-
address: addresses.v4DecayMulticurveInitializer,
|
|
12371
|
-
kind: "standard"
|
|
12372
|
-
},
|
|
12373
|
-
{
|
|
12374
|
-
address: addresses.dopplerHookInitializer,
|
|
12375
|
-
kind: "dopplerHook"
|
|
12376
|
-
}
|
|
12377
|
-
].filter(
|
|
12378
|
-
(entry) => entry.address !== void 0 && entry.address !== zeroAddress
|
|
12379
|
-
);
|
|
12380
|
-
if (initializersToTry.length === 0) {
|
|
12381
|
-
throw new Error(
|
|
12382
|
-
"No V4 multicurve initializer addresses configured for this chain"
|
|
12383
|
-
);
|
|
12384
|
-
}
|
|
12385
|
-
const triedInitializers = [];
|
|
12386
|
-
for (const initializer of initializersToTry) {
|
|
12387
|
-
const { address: initializerAddress, kind } = initializer;
|
|
12388
|
-
triedInitializers.push(initializerAddress);
|
|
12389
|
-
const stateData = await this.rpc.readContract({
|
|
12390
|
-
address: initializerAddress,
|
|
12391
|
-
abi: kind === "dopplerHook" ? dopplerHookInitializerAbi : v4MulticurveInitializerAbi,
|
|
12392
|
-
functionName: "getState",
|
|
12393
|
-
args: [this.tokenAddress]
|
|
12394
|
-
});
|
|
12395
|
-
const parsedState = kind === "dopplerHook" ? this.parseDopplerHookInitializerState(stateData) : this.parseStandardInitializerState(stateData);
|
|
12396
|
-
const { numeraire, status, poolKey, farTick } = parsedState;
|
|
12397
|
-
if (poolKey.hooks !== zeroAddress && poolKey.tickSpacing !== 0) {
|
|
12398
|
-
const state = {
|
|
12399
|
-
asset: this.tokenAddress,
|
|
12400
|
-
numeraire,
|
|
12401
|
-
fee: poolKey.fee,
|
|
12402
|
-
tickSpacing: poolKey.tickSpacing,
|
|
12403
|
-
status,
|
|
12404
|
-
poolKey,
|
|
12405
|
-
farTick: Number(farTick)
|
|
12406
|
-
};
|
|
12407
|
-
return { initializerAddress, state };
|
|
12408
|
-
}
|
|
12409
|
-
}
|
|
12410
|
-
throw new Error(
|
|
12411
|
-
`Pool not found for token ${this.tokenAddress}. Tried initializers: ${triedInitializers.join(", ")}`
|
|
12412
|
-
);
|
|
12962
|
+
return findMulticurveInitializerForPool({
|
|
12963
|
+
client: this.rpc,
|
|
12964
|
+
tokenAddress: this.tokenAddress,
|
|
12965
|
+
addresses
|
|
12966
|
+
});
|
|
12413
12967
|
}
|
|
12414
12968
|
/**
|
|
12415
|
-
* Collect fees from
|
|
12969
|
+
* Collect fees from a locked initializer-side pool.
|
|
12416
12970
|
*
|
|
12417
|
-
* This function can be called by any
|
|
12418
|
-
*
|
|
12419
|
-
*
|
|
12971
|
+
* This function can be called by any account to pull pool fees into the
|
|
12972
|
+
* initializer. If the caller is a configured beneficiary, their pending share
|
|
12973
|
+
* is released as part of the same transaction.
|
|
12420
12974
|
*
|
|
12421
|
-
* @returns Object containing the
|
|
12975
|
+
* @returns Object containing the contract's collectFees return values and the transaction hash.
|
|
12976
|
+
* The returned fee amounts are newly collected pool fees, not necessarily the caller's beneficiary payout.
|
|
12422
12977
|
*/
|
|
12423
12978
|
async collectFees() {
|
|
12424
|
-
|
|
12979
|
+
const walletClient = this.walletClient;
|
|
12980
|
+
if (!walletClient) {
|
|
12425
12981
|
throw new Error("Wallet client required to collect fees");
|
|
12426
12982
|
}
|
|
12427
12983
|
const chainId = await this.rpc.getChainId();
|
|
12428
12984
|
const addresses = getAddresses(chainId);
|
|
12429
12985
|
const { initializerAddress, state } = await this.findInitializerForPool();
|
|
12430
|
-
|
|
12431
|
-
|
|
12432
|
-
|
|
12433
|
-
|
|
12434
|
-
|
|
12435
|
-
|
|
12436
|
-
|
|
12437
|
-
|
|
12438
|
-
|
|
12439
|
-
|
|
12440
|
-
|
|
12441
|
-
|
|
12442
|
-
|
|
12443
|
-
|
|
12444
|
-
|
|
12445
|
-
|
|
12446
|
-
|
|
12447
|
-
abi: v4MulticurveMigratorAbi,
|
|
12448
|
-
functionName: "getAssetData",
|
|
12449
|
-
args: [state.poolKey.currency0, state.poolKey.currency1]
|
|
12450
|
-
});
|
|
12451
|
-
const migratorPoolKey = this.parsePoolKey(
|
|
12452
|
-
assetData.poolKey ?? assetData[1]
|
|
12453
|
-
);
|
|
12454
|
-
const poolId = computePoolId(migratorPoolKey);
|
|
12455
|
-
const beneficiaries = assetData.beneficiaries ?? assetData[4] ?? [];
|
|
12456
|
-
if (!Array.isArray(beneficiaries) || beneficiaries.length === 0) {
|
|
12457
|
-
throw new Error(
|
|
12458
|
-
"Migrated multicurve pool has no beneficiaries configured"
|
|
12459
|
-
);
|
|
12460
|
-
}
|
|
12461
|
-
const lockerAddress = await this.resolveLockerAddress(
|
|
12462
|
-
addresses.v4Migrator,
|
|
12463
|
-
addresses.streamableFeesLocker
|
|
12464
|
-
);
|
|
12465
|
-
const streamData = await this.rpc.readContract({
|
|
12466
|
-
address: lockerAddress,
|
|
12467
|
-
abi: streamableFeesLockerAbi,
|
|
12468
|
-
functionName: "streams",
|
|
12469
|
-
args: [poolId]
|
|
12470
|
-
});
|
|
12471
|
-
const startDate = Number(
|
|
12472
|
-
streamData.startDate ?? streamData[2] ?? 0
|
|
12473
|
-
);
|
|
12474
|
-
if (startDate === 0) {
|
|
12475
|
-
throw new Error("Migrated multicurve stream not initialized");
|
|
12476
|
-
}
|
|
12477
|
-
return this.collectFeesFromContract(
|
|
12478
|
-
lockerAddress,
|
|
12479
|
-
streamableFeesLockerAbi,
|
|
12480
|
-
poolId
|
|
12481
|
-
);
|
|
12482
|
-
}
|
|
12483
|
-
throw new Error("Multicurve pool is not locked or migrated");
|
|
12986
|
+
return collectMulticurveFees({
|
|
12987
|
+
client: this.rpc,
|
|
12988
|
+
walletClient,
|
|
12989
|
+
initializerAddress,
|
|
12990
|
+
state,
|
|
12991
|
+
addresses
|
|
12992
|
+
});
|
|
12993
|
+
}
|
|
12994
|
+
/**
|
|
12995
|
+
* Preview pending fees for a beneficiary on an initializer-side multicurve pool.
|
|
12996
|
+
*/
|
|
12997
|
+
async getPendingFees(beneficiary) {
|
|
12998
|
+
return getPendingFeesForMulticurvePool({
|
|
12999
|
+
client: this.rpc,
|
|
13000
|
+
beneficiary,
|
|
13001
|
+
poolContext: await this.findInitializerForPool()
|
|
13002
|
+
});
|
|
12484
13003
|
}
|
|
12485
13004
|
/**
|
|
12486
13005
|
* Get the numeraire address for this pool
|
|
@@ -12496,93 +13015,58 @@ var MulticurvePool = class {
|
|
|
12496
13015
|
*/
|
|
12497
13016
|
async getFeeSchedule() {
|
|
12498
13017
|
const { state } = await this.findInitializerForPool();
|
|
12499
|
-
|
|
12500
|
-
|
|
13018
|
+
return getMulticurveFeeSchedule(this.rpc, state);
|
|
13019
|
+
}
|
|
13020
|
+
};
|
|
13021
|
+
|
|
13022
|
+
// src/evm/entities/auction/MulticurveFees.ts
|
|
13023
|
+
var MulticurveFees = class {
|
|
13024
|
+
client;
|
|
13025
|
+
tokenAddresses;
|
|
13026
|
+
options;
|
|
13027
|
+
constructor(client, _walletClient, tokenAddresses, options = {}) {
|
|
13028
|
+
this.client = client;
|
|
13029
|
+
this.tokenAddresses = [...tokenAddresses];
|
|
13030
|
+
this.options = { ...options };
|
|
13031
|
+
}
|
|
13032
|
+
async getPendingFees(beneficiary, tokenAddressesOrOptions, options) {
|
|
13033
|
+
const hasTokenAddressOverride = isTokenAddressList(tokenAddressesOrOptions);
|
|
13034
|
+
const tokenAddresses = hasTokenAddressOverride ? tokenAddressesOrOptions : this.tokenAddresses;
|
|
13035
|
+
const callOptions = hasTokenAddressOverride ? options : tokenAddressesOrOptions;
|
|
13036
|
+
const tokenBatchSize = getTokenBatchSize(
|
|
13037
|
+
callOptions?.tokenBatchSize ?? this.options.tokenBatchSize
|
|
13038
|
+
);
|
|
13039
|
+
if (!tokenBatchSize || tokenAddresses.length <= tokenBatchSize) {
|
|
13040
|
+
return getPendingFeesForMulticurveTokens({
|
|
13041
|
+
client: this.client,
|
|
13042
|
+
beneficiary,
|
|
13043
|
+
tokenAddresses
|
|
13044
|
+
});
|
|
12501
13045
|
}
|
|
12502
|
-
|
|
12503
|
-
|
|
12504
|
-
const
|
|
12505
|
-
|
|
12506
|
-
|
|
12507
|
-
|
|
12508
|
-
args: [poolId]
|
|
13046
|
+
let pendingFees = [];
|
|
13047
|
+
for (let index = 0; index < tokenAddresses.length; index += tokenBatchSize) {
|
|
13048
|
+
const batchPendingFees = await getPendingFeesForMulticurveTokens({
|
|
13049
|
+
client: this.client,
|
|
13050
|
+
beneficiary,
|
|
13051
|
+
tokenAddresses: tokenAddresses.slice(index, index + tokenBatchSize)
|
|
12509
13052
|
});
|
|
12510
|
-
|
|
12511
|
-
return {
|
|
12512
|
-
startingTime: Number(
|
|
12513
|
-
scheduleStruct.startingTime ?? scheduleStruct[0] ?? 0
|
|
12514
|
-
),
|
|
12515
|
-
startFee: Number(scheduleStruct.startFee ?? scheduleStruct[1] ?? 0),
|
|
12516
|
-
endFee: Number(scheduleStruct.endFee ?? scheduleStruct[2] ?? 0),
|
|
12517
|
-
lastFee: Number(scheduleStruct.lastFee ?? scheduleStruct[3] ?? 0),
|
|
12518
|
-
durationSeconds: Number(
|
|
12519
|
-
scheduleStruct.durationSeconds ?? scheduleStruct[4] ?? 0
|
|
12520
|
-
)
|
|
12521
|
-
};
|
|
12522
|
-
} catch {
|
|
12523
|
-
throw new Error(
|
|
12524
|
-
`Dynamic multicurve hook at ${state.poolKey.hooks} does not expose getFeeScheduleOf(poolId)`
|
|
12525
|
-
);
|
|
13053
|
+
pendingFees = [...pendingFees, ...batchPendingFees];
|
|
12526
13054
|
}
|
|
13055
|
+
return pendingFees;
|
|
12527
13056
|
}
|
|
12528
|
-
|
|
12529
|
-
|
|
12530
|
-
|
|
12531
|
-
|
|
12532
|
-
|
|
12533
|
-
|
|
12534
|
-
|
|
12535
|
-
hooks: poolKeyStruct.hooks ?? poolKeyStruct[4]
|
|
12536
|
-
};
|
|
12537
|
-
}
|
|
12538
|
-
parseStandardInitializerState(stateData) {
|
|
12539
|
-
const state = stateData;
|
|
12540
|
-
return {
|
|
12541
|
-
numeraire: state.numeraire ?? state[0],
|
|
12542
|
-
status: Number(state.status ?? state[1]),
|
|
12543
|
-
poolKey: this.parsePoolKey(state.poolKey ?? state[2]),
|
|
12544
|
-
farTick: Number(state.farTick ?? state[3])
|
|
12545
|
-
};
|
|
12546
|
-
}
|
|
12547
|
-
parseDopplerHookInitializerState(stateData) {
|
|
12548
|
-
const state = stateData;
|
|
12549
|
-
return {
|
|
12550
|
-
numeraire: state.numeraire ?? state[0],
|
|
12551
|
-
status: Number(state.status ?? state[4]),
|
|
12552
|
-
poolKey: this.parsePoolKey(state.poolKey ?? state[5]),
|
|
12553
|
-
farTick: Number(state.farTick ?? state[6])
|
|
12554
|
-
};
|
|
13057
|
+
};
|
|
13058
|
+
function isTokenAddressList(value) {
|
|
13059
|
+
return Array.isArray(value);
|
|
13060
|
+
}
|
|
13061
|
+
function getTokenBatchSize(tokenBatchSize) {
|
|
13062
|
+
if (tokenBatchSize === void 0) {
|
|
13063
|
+
return void 0;
|
|
12555
13064
|
}
|
|
12556
|
-
|
|
12557
|
-
|
|
12558
|
-
return configuredLocker;
|
|
12559
|
-
}
|
|
12560
|
-
const lockerAddress = await this.rpc.readContract({
|
|
12561
|
-
address: migratorAddress,
|
|
12562
|
-
abi: v4MulticurveMigratorAbi,
|
|
12563
|
-
functionName: "locker",
|
|
12564
|
-
args: []
|
|
12565
|
-
});
|
|
12566
|
-
return lockerAddress;
|
|
13065
|
+
if (!Number.isInteger(tokenBatchSize) || tokenBatchSize < 1) {
|
|
13066
|
+
throw new Error("tokenBatchSize must be a positive integer");
|
|
12567
13067
|
}
|
|
12568
|
-
|
|
12569
|
-
|
|
12570
|
-
address: contractAddress,
|
|
12571
|
-
abi,
|
|
12572
|
-
functionName: "collectFees",
|
|
12573
|
-
args: [poolId],
|
|
12574
|
-
account: this.walletClient.account
|
|
12575
|
-
});
|
|
12576
|
-
const hash = await this.walletClient.writeContract(request);
|
|
12577
|
-
await this.rpc.waitForTransactionReceipt({ hash, confirmations: 1 });
|
|
12578
|
-
const [fees0, fees1] = result;
|
|
12579
|
-
return {
|
|
12580
|
-
fees0,
|
|
12581
|
-
fees1,
|
|
12582
|
-
transactionHash: hash
|
|
12583
|
-
};
|
|
12584
|
-
}
|
|
12585
|
-
};
|
|
13068
|
+
return tokenBatchSize;
|
|
13069
|
+
}
|
|
12586
13070
|
|
|
12587
13071
|
// src/evm/entities/auction/RehypeDopplerHook.ts
|
|
12588
13072
|
var RehypeDopplerHook = class {
|
|
@@ -18755,6 +19239,6 @@ var DopplerSDK = class {
|
|
|
18755
19239
|
// src/evm/index.ts
|
|
18756
19240
|
var VERSION = "1.0.0";
|
|
18757
19241
|
|
|
18758
|
-
export { ADDRESSES, BASIS_POINTS, CHAIN_IDS, DAY_SECONDS, DEAD_ADDRESS, DECAY_MAX_START_FEE, DEFAULT_AIRLOCK_BENEFICIARY_SHARES, DEFAULT_AUCTION_DURATION, DEFAULT_EPOCH_LENGTH, DEFAULT_LOCK_DURATION, DEFAULT_MULTICURVE_LOWER_TICKS, DEFAULT_MULTICURVE_MAX_SUPPLY_SHARES, DEFAULT_MULTICURVE_NUM_POSITIONS, DEFAULT_MULTICURVE_UPPER_TICKS, DEFAULT_OPENING_AUCTION_DURATION, DEFAULT_OPENING_AUCTION_FEE, DEFAULT_OPENING_AUCTION_INCENTIVE_SHARE_BPS, DEFAULT_OPENING_AUCTION_MIN_ACCEPTABLE_TICK_TOKEN0, DEFAULT_OPENING_AUCTION_MIN_ACCEPTABLE_TICK_TOKEN1, DEFAULT_OPENING_AUCTION_MIN_LIQUIDITY, DEFAULT_OPENING_AUCTION_SHARE_TO_AUCTION_BPS, DEFAULT_OPENING_DOPPLER_DURATION, DEFAULT_OPENING_DOPPLER_EPOCH_LENGTH, DEFAULT_OPENING_DOPPLER_FEE, DEFAULT_OPENING_DOPPLER_NUM_PD_SLUGS, DEFAULT_OPENING_DOPPLER_TICK_SPACING, DEFAULT_PD_SLUGS, DEFAULT_V3_END_TICK, DEFAULT_V3_FEE, DEFAULT_V3_INITIAL_PROPOSAL_THRESHOLD, DEFAULT_V3_INITIAL_SUPPLY, DEFAULT_V3_INITIAL_VOTING_DELAY, DEFAULT_V3_INITIAL_VOTING_PERIOD, DEFAULT_V3_MAX_SHARE_TO_BE_SOLD, DEFAULT_V3_NUM_POSITIONS, DEFAULT_V3_NUM_TOKENS_TO_SELL, DEFAULT_V3_PRE_MINT, DEFAULT_V3_START_TICK, DEFAULT_V3_VESTING_DURATION, DEFAULT_V3_YEARLY_MINT_RATE, DEFAULT_V4_INITIAL_PROPOSAL_THRESHOLD, DEFAULT_V4_INITIAL_VOTING_DELAY, DEFAULT_V4_INITIAL_VOTING_PERIOD, DEFAULT_V4_YEARLY_MINT_RATE, derc2080_default as DERC2080Bytecode, derc20_default as DERC20Bytecode, DOPPLER_FLAGS, DOPPLER_MAX_TICK_SPACING, DYNAMIC_FEE_FLAG, Derc20, Derc20V2, doppler_default as DopplerBytecode, dopplerDN404_default as DopplerDN404Bytecode, DopplerERC20V1, DopplerFactory, DopplerSDK, DynamicAuction, DynamicAuctionBuilder, Eth, FEE_AMOUNT_MASK, FEE_TIERS, FLAG_MASK, INT24_MAX, INT24_MIN, LAUNCHPAD_ENABLED_CHAIN_IDS, LockablePoolStatus, MAX_SQRT_RATIO, MAX_TICK, MIN_SQRT_RATIO, MIN_TICK, MulticurveBuilder, MulticurvePool, NO_OP_ENABLED_CHAIN_IDS, OPENING_AUCTION_FLAGS, OPENING_AUCTION_PHASE_ACTIVE, OPENING_AUCTION_PHASE_CLOSED, OPENING_AUCTION_PHASE_NOT_STARTED, OPENING_AUCTION_PHASE_SETTLED, OPENING_AUCTION_STATUS_ACTIVE, OPENING_AUCTION_STATUS_DOPPLER_ACTIVE, OPENING_AUCTION_STATUS_EXITED, OPENING_AUCTION_STATUS_UNINITIALIZED, OpeningAuction, OpeningAuctionBidManager, OpeningAuctionBuilder, openingAuction_default as OpeningAuctionBytecode, OpeningAuctionLifecycle, OpeningAuctionPhase, OpeningAuctionPositionManager, OpeningAuctionStatus, Q96, Quoter, RehypeDopplerHook, RehypeDopplerHookMigrator, RehypeFeeRoutingMode, SECONDS_PER_DAY, SECONDS_PER_YEAR, SUPPORTED_CHAIN_IDS, stateView_default as StateViewBytecode, StaticAuction, StaticAuctionBuilder, TICK_SPACINGS, TopUpDistributor, V3_FEE_TIERS, V4_MAX_FEE, VALID_FEE_TIERS, VERSION, WAD, ZERO_ADDRESS, airlockAbi, applyTickOffsets, bundlerAbi, calculateFDV, calculateGamma, calculateMarketCap, calculateTickRange, calculateTokensToSell, computeOptimalGamma, computePoolId, createAirlockBeneficiary, decayMulticurveInitializerHookAbi, decodeBalanceDelta, derc20Abi, derc20V2Abi, dopplerERC20V1Abi, dopplerHookAbi, dopplerHookInitializerAbi, dopplerLensAbi, encodeRehypeDopplerHookMigratorCalldata, estimatePriceAtEpoch, estimateSlippage, formatTickAsPrice, getAddresses, getAirlockBeneficiary, getAirlockOwner, getAmount0ForLiquidity, getAmount1ForLiquidity, getLiquidityForAmount0, getLiquidityForAmount1, getMaxTickRounded, getNearestUsableTick, getSqrtRatioAtTick, getTickAtSqrtRatio, isLaunchpadEnabledChain, isNoOpEnabledChain, isSupportedChainId, isToken0Expected, isToken1, lockableUniswapV3InitializerAbi, marketCapToTickForMulticurve, marketCapToTicksForDynamicAuction, marketCapToTicksForMulticurve, marketCapToTicksForStaticAuction, marketCapToTokenPrice, mineTokenAddress, normalizePoolKey, openingAuctionAbi, openingAuctionInitializerAbi, openingAuctionPositionManagerAbi, poolManagerAbi, priceToSqrtPriceX96, priceToTick, quoterV2Abi, ratioToTick, rehypeDopplerHookAbi, rehypeDopplerHookMigratorAbi, resolveGasEstimate, sqrtPriceX96ToPrice, streamableFeesLockerAbi, streamableFeesLockerV2Abi, tickToMarketCap, tickToPrice, tokenPriceToRatio, topUpDistributorAbi, uniswapV2Router02Abi, uniswapV3InitializerAbi, uniswapV3PoolAbi, uniswapV4InitializerAbi, v2MigratorAbi, v3MigratorAbi, v4MigratorAbi, v4MulticurveInitializerAbi, v4MulticurveMigratorAbi, v4QuoterAbi, validateMarketCapParameters, weth9Abi };
|
|
19242
|
+
export { ADDRESSES, BASIS_POINTS, CHAIN_IDS, DAY_SECONDS, DEAD_ADDRESS, DECAY_MAX_START_FEE, DEFAULT_AIRLOCK_BENEFICIARY_SHARES, DEFAULT_AUCTION_DURATION, DEFAULT_EPOCH_LENGTH, DEFAULT_LOCK_DURATION, DEFAULT_MULTICURVE_LOWER_TICKS, DEFAULT_MULTICURVE_MAX_SUPPLY_SHARES, DEFAULT_MULTICURVE_NUM_POSITIONS, DEFAULT_MULTICURVE_UPPER_TICKS, DEFAULT_OPENING_AUCTION_DURATION, DEFAULT_OPENING_AUCTION_FEE, DEFAULT_OPENING_AUCTION_INCENTIVE_SHARE_BPS, DEFAULT_OPENING_AUCTION_MIN_ACCEPTABLE_TICK_TOKEN0, DEFAULT_OPENING_AUCTION_MIN_ACCEPTABLE_TICK_TOKEN1, DEFAULT_OPENING_AUCTION_MIN_LIQUIDITY, DEFAULT_OPENING_AUCTION_SHARE_TO_AUCTION_BPS, DEFAULT_OPENING_DOPPLER_DURATION, DEFAULT_OPENING_DOPPLER_EPOCH_LENGTH, DEFAULT_OPENING_DOPPLER_FEE, DEFAULT_OPENING_DOPPLER_NUM_PD_SLUGS, DEFAULT_OPENING_DOPPLER_TICK_SPACING, DEFAULT_PD_SLUGS, DEFAULT_V3_END_TICK, DEFAULT_V3_FEE, DEFAULT_V3_INITIAL_PROPOSAL_THRESHOLD, DEFAULT_V3_INITIAL_SUPPLY, DEFAULT_V3_INITIAL_VOTING_DELAY, DEFAULT_V3_INITIAL_VOTING_PERIOD, DEFAULT_V3_MAX_SHARE_TO_BE_SOLD, DEFAULT_V3_NUM_POSITIONS, DEFAULT_V3_NUM_TOKENS_TO_SELL, DEFAULT_V3_PRE_MINT, DEFAULT_V3_START_TICK, DEFAULT_V3_VESTING_DURATION, DEFAULT_V3_YEARLY_MINT_RATE, DEFAULT_V4_INITIAL_PROPOSAL_THRESHOLD, DEFAULT_V4_INITIAL_VOTING_DELAY, DEFAULT_V4_INITIAL_VOTING_PERIOD, DEFAULT_V4_YEARLY_MINT_RATE, derc2080_default as DERC2080Bytecode, derc20_default as DERC20Bytecode, DOPPLER_FLAGS, DOPPLER_MAX_TICK_SPACING, DYNAMIC_FEE_FLAG, Derc20, Derc20V2, doppler_default as DopplerBytecode, dopplerDN404_default as DopplerDN404Bytecode, DopplerERC20V1, DopplerFactory, DopplerSDK, DynamicAuction, DynamicAuctionBuilder, Eth, FEE_AMOUNT_MASK, FEE_TIERS, FLAG_MASK, INT24_MAX, INT24_MIN, LAUNCHPAD_ENABLED_CHAIN_IDS, LockablePoolStatus, MAX_SQRT_RATIO, MAX_TICK, MIN_SQRT_RATIO, MIN_TICK, MulticurveBuilder, MulticurveFees, MulticurvePool, NO_OP_ENABLED_CHAIN_IDS, OPENING_AUCTION_FLAGS, OPENING_AUCTION_PHASE_ACTIVE, OPENING_AUCTION_PHASE_CLOSED, OPENING_AUCTION_PHASE_NOT_STARTED, OPENING_AUCTION_PHASE_SETTLED, OPENING_AUCTION_STATUS_ACTIVE, OPENING_AUCTION_STATUS_DOPPLER_ACTIVE, OPENING_AUCTION_STATUS_EXITED, OPENING_AUCTION_STATUS_UNINITIALIZED, OpeningAuction, OpeningAuctionBidManager, OpeningAuctionBuilder, openingAuction_default as OpeningAuctionBytecode, OpeningAuctionLifecycle, OpeningAuctionPhase, OpeningAuctionPositionManager, OpeningAuctionStatus, Q96, Quoter, RehypeDopplerHook, RehypeDopplerHookMigrator, RehypeFeeRoutingMode, SECONDS_PER_DAY, SECONDS_PER_YEAR, SUPPORTED_CHAIN_IDS, stateView_default as StateViewBytecode, StaticAuction, StaticAuctionBuilder, TICK_SPACINGS, TopUpDistributor, V3_FEE_TIERS, V4_MAX_FEE, VALID_FEE_TIERS, VERSION, WAD, ZERO_ADDRESS, airlockAbi, applyTickOffsets, bundlerAbi, calculateFDV, calculateGamma, calculateMarketCap, calculateTickRange, calculateTokensToSell, computeOptimalGamma, computePoolId, createAirlockBeneficiary, decayMulticurveInitializerHookAbi, decodeBalanceDelta, derc20Abi, derc20V2Abi, dopplerERC20V1Abi, dopplerHookAbi, dopplerHookInitializerAbi, dopplerLensAbi, encodeRehypeDopplerHookMigratorCalldata, estimatePriceAtEpoch, estimateSlippage, feeClaimsInitializerAbi, formatTickAsPrice, getAddresses, getAirlockBeneficiary, getAirlockOwner, getAmount0ForLiquidity, getAmount1ForLiquidity, getLiquidityForAmount0, getLiquidityForAmount1, getMaxTickRounded, getNearestUsableTick, getSqrtRatioAtTick, getTickAtSqrtRatio, isLaunchpadEnabledChain, isNoOpEnabledChain, isSupportedChainId, isToken0Expected, isToken1, lockableUniswapV3InitializerAbi, marketCapToTickForMulticurve, marketCapToTicksForDynamicAuction, marketCapToTicksForMulticurve, marketCapToTicksForStaticAuction, marketCapToTokenPrice, mineTokenAddress, normalizePoolKey, openingAuctionAbi, openingAuctionInitializerAbi, openingAuctionPositionManagerAbi, poolManagerAbi, priceToSqrtPriceX96, priceToTick, quoterV2Abi, ratioToTick, rehypeDopplerHookAbi, rehypeDopplerHookMigratorAbi, resolveGasEstimate, sqrtPriceX96ToPrice, streamableFeesLockerAbi, streamableFeesLockerV2Abi, tickToMarketCap, tickToPrice, tokenPriceToRatio, topUpDistributorAbi, uniswapV2Router02Abi, uniswapV3InitializerAbi, uniswapV3PoolAbi, uniswapV4InitializerAbi, v2MigratorAbi, v3MigratorAbi, v4MigratorAbi, v4MulticurveInitializerAbi, v4MulticurveMigratorAbi, v4QuoterAbi, validateMarketCapParameters, weth9Abi };
|
|
18759
19243
|
//# sourceMappingURL=index.js.map
|
|
18760
19244
|
//# sourceMappingURL=index.js.map
|