timelock-sdk 0.0.162 → 0.0.164
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abis.cjs +1059 -308
- package/dist/abis.cjs.map +1 -1
- package/dist/abis.d.cts +2967 -766
- package/dist/abis.d.ts +2967 -766
- package/dist/abis.js +1051 -303
- package/dist/abis.js.map +1 -1
- package/dist/{client-BVPR3obW.d.cts → client-Di1eoh5l.d.cts} +870 -1797
- package/dist/{client-BFhMekeP.d.ts → client-Dp-YTEVp.d.ts} +35 -962
- package/dist/client.cjs +113 -949
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +3 -3
- package/dist/client.d.ts +3 -3
- package/dist/client.js +79 -915
- package/dist/client.js.map +1 -1
- package/dist/factory-DitVXzjQ.cjs +1715 -0
- package/dist/factory-DitVXzjQ.cjs.map +1 -0
- package/dist/factory-y-iVl_er.js +1697 -0
- package/dist/factory-y-iVl_er.js.map +1 -0
- package/dist/{optionUtils-R9Y-jxoz.cjs → optionUtils-Cuuw6jXD.cjs} +6 -1048
- package/dist/optionUtils-Cuuw6jXD.cjs.map +1 -0
- package/dist/optionUtils-OyY8qOu0.js +381 -0
- package/dist/optionUtils-OyY8qOu0.js.map +1 -0
- package/dist/{uniswapMathLens-oe-gukfo.d.ts → optionsMarket-2HZ-p_dl.d.ts} +2 -625
- package/dist/{uniswapMathLens-B6gp2UGI.d.cts → optionsMarket-c4hgszY_.d.cts} +2 -625
- package/dist/package.cjs +2 -2
- package/dist/package.d.cts +3 -3
- package/dist/package.d.ts +3 -3
- package/dist/package.js +2 -2
- package/dist/{optionsMarket-CWigPja1.js → statelessStateView-CBkcP7CK.js} +1599 -1322
- package/dist/statelessStateView-CBkcP7CK.js.map +1 -0
- package/dist/{optionsMarket-CtlBxuj0.cjs → statelessStateView-XdTJQxsY.cjs} +1600 -1323
- package/dist/statelessStateView-XdTJQxsY.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/optionUtils-R9Y-jxoz.cjs.map +0 -1
- package/dist/optionUtils-fCYueZl2.js +0 -1417
- package/dist/optionUtils-fCYueZl2.js.map +0 -1
- package/dist/optionsMarket-CWigPja1.js.map +0 -1
- package/dist/optionsMarket-CtlBxuj0.cjs.map +0 -1
- package/dist/singleOwnerVault-BJyEs_D_.js +0 -847
- package/dist/singleOwnerVault-BJyEs_D_.js.map +0 -1
- package/dist/singleOwnerVault-GCpQV7pN.cjs +0 -853
- package/dist/singleOwnerVault-GCpQV7pN.cjs.map +0 -1
package/dist/client.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
const require_optionUtils = require('./optionUtils-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
4
|
+
const require_optionUtils = require('./optionUtils-Cuuw6jXD.cjs');
|
|
5
|
+
const require_statelessStateView = require('./statelessStateView-XdTJQxsY.cjs');
|
|
6
|
+
const require_factory = require('./factory-DitVXzjQ.cjs');
|
|
7
7
|
let viem = require("viem");
|
|
8
8
|
let react = require("react");
|
|
9
9
|
react = require_optionUtils.__toESM(react);
|
|
@@ -454,7 +454,7 @@ const useMarketData = (marketAddr) => {
|
|
|
454
454
|
const { timelockLens } = useLens();
|
|
455
455
|
const { data } = (0, wagmi.useReadContract)({
|
|
456
456
|
address: timelockLens === null || timelockLens === void 0 ? void 0 : timelockLens.address,
|
|
457
|
-
abi:
|
|
457
|
+
abi: require_statelessStateView.lensAbi,
|
|
458
458
|
functionName: "getMarketData",
|
|
459
459
|
args: marketAddr ? [marketAddr] : void 0
|
|
460
460
|
});
|
|
@@ -467,7 +467,7 @@ const useMarketState = (marketAddr) => {
|
|
|
467
467
|
const { timelockLens } = useLens();
|
|
468
468
|
const { data, ...rest } = (0, wagmi.useReadContract)({
|
|
469
469
|
address: timelockLens === null || timelockLens === void 0 ? void 0 : timelockLens.address,
|
|
470
|
-
abi:
|
|
470
|
+
abi: require_statelessStateView.lensAbi,
|
|
471
471
|
functionName: "getMarketState",
|
|
472
472
|
args: marketAddr ? [marketAddr] : void 0
|
|
473
473
|
});
|
|
@@ -508,7 +508,7 @@ const useMaxPositionSize = (marketAddr, strikeTick, maxSteps = 100) => {
|
|
|
508
508
|
const { optionAssetDecimals } = useMarketData(marketAddr);
|
|
509
509
|
const { data, ...rest } = (0, wagmi.useReadContract)({
|
|
510
510
|
address: timelockLens === null || timelockLens === void 0 ? void 0 : timelockLens.address,
|
|
511
|
-
abi:
|
|
511
|
+
abi: require_statelessStateView.lensAbi,
|
|
512
512
|
functionName: strikeTick ? "getMaxPositionSizes" : "getMaxATMPositionSizes",
|
|
513
513
|
args: marketAddr ? strikeTick ? [
|
|
514
514
|
marketAddr,
|
|
@@ -531,7 +531,7 @@ const usePoolData = (poolManager, poolKey) => {
|
|
|
531
531
|
const { timelockLens } = useLens();
|
|
532
532
|
const { data } = (0, wagmi.useReadContract)({
|
|
533
533
|
address: timelockLens === null || timelockLens === void 0 ? void 0 : timelockLens.address,
|
|
534
|
-
abi:
|
|
534
|
+
abi: require_statelessStateView.lensAbi,
|
|
535
535
|
functionName: "getPoolData",
|
|
536
536
|
args: poolManager && poolKey ? [poolManager, poolKey] : void 0,
|
|
537
537
|
query: { enabled: !!poolManager && !!poolKey }
|
|
@@ -552,7 +552,7 @@ const useCurrentTick = (poolManager, poolKey) => {
|
|
|
552
552
|
const { tickSpacing } = usePoolData(poolManager, poolKey);
|
|
553
553
|
const { data, ...rest } = (0, wagmi.useReadContract)({
|
|
554
554
|
address: stateView === null || stateView === void 0 ? void 0 : stateView.address,
|
|
555
|
-
abi:
|
|
555
|
+
abi: require_statelessStateView.statelessStateViewAbi,
|
|
556
556
|
functionName: "getSlot0",
|
|
557
557
|
args: poolManager && poolKey ? [poolManager, poolKey] : void 0,
|
|
558
558
|
query: {
|
|
@@ -636,7 +636,7 @@ const useMintOption = (marketAddr) => {
|
|
|
636
636
|
await askForApproval(payoutAsset, marketAddr, (premium + protocolFee) * 11n / 10n);
|
|
637
637
|
const hash = await writeContractAsync({
|
|
638
638
|
address: marketAddr,
|
|
639
|
-
abi:
|
|
639
|
+
abi: require_statelessStateView.optionsMarketAbi,
|
|
640
640
|
functionName: "mintOption",
|
|
641
641
|
args: [
|
|
642
642
|
address,
|
|
@@ -723,7 +723,7 @@ const useExerciseOption = (marketAddr) => {
|
|
|
723
723
|
const refTick = await timelockLens.read.getRefTick([vault, option.startTick]);
|
|
724
724
|
const hash = await writeContractAsync({
|
|
725
725
|
address: marketAddr,
|
|
726
|
-
abi:
|
|
726
|
+
abi: require_statelessStateView.optionsMarketAbi,
|
|
727
727
|
functionName: "exerciseOption",
|
|
728
728
|
args: [
|
|
729
729
|
option.optionId,
|
|
@@ -831,7 +831,7 @@ const useOptionPremium = (marketAddr, optionType, optionAmount, addedDuration, r
|
|
|
831
831
|
]);
|
|
832
832
|
const { data: [premium, protocolFee] = [] } = (0, wagmi.useReadContract)({
|
|
833
833
|
address: marketAddr,
|
|
834
|
-
abi:
|
|
834
|
+
abi: require_statelessStateView.optionsMarketAbi,
|
|
835
835
|
functionName: "calculatePremium",
|
|
836
836
|
args: strikeTickRounded !== void 0 && optionAmount !== void 0 && addedDuration !== void 0 ? [
|
|
837
837
|
optionType === "CALL" ? 0 : 1,
|
|
@@ -932,7 +932,7 @@ const useExtendOption = (marketAddr) => {
|
|
|
932
932
|
await askForApproval(payoutAsset, marketAddr, (premium + protocolFee) * 11n / 10n);
|
|
933
933
|
const hash = await writeContractAsync({
|
|
934
934
|
address: marketAddr,
|
|
935
|
-
abi:
|
|
935
|
+
abi: require_statelessStateView.optionsMarketAbi,
|
|
936
936
|
functionName: "extendOption",
|
|
937
937
|
args: [
|
|
938
938
|
option.optionId,
|
|
@@ -1103,9 +1103,9 @@ const useMintPerp = (marketAddr) => {
|
|
|
1103
1103
|
const { address } = (0, wagmi.useConnection)();
|
|
1104
1104
|
const { operator, address: operatorAddr, signMessage: { mutateAsync: signMessage } } = usePerpsOperator();
|
|
1105
1105
|
const { askForApproval } = useApproval();
|
|
1106
|
-
const {
|
|
1107
|
-
const { tickSpacing } = usePoolData(
|
|
1108
|
-
const { refetch: refetchCurrentTick } = useCurrentTick(
|
|
1106
|
+
const { poolManager, poolKey, optionAssetIsToken0, payoutAsset } = useMarketData(marketAddr);
|
|
1107
|
+
const { tickSpacing } = usePoolData(poolManager, poolKey);
|
|
1108
|
+
const { refetch: refetchCurrentTick } = useCurrentTick(poolManager, poolKey);
|
|
1109
1109
|
const mintPerp = async (data) => {
|
|
1110
1110
|
const { optionType, amount, duration, strikeTick } = data;
|
|
1111
1111
|
if (!client || !address) throw new Error("Wallet not connected");
|
|
@@ -1195,7 +1195,7 @@ const useTokenData = (tokenAddr) => {
|
|
|
1195
1195
|
const client = (0, wagmi.useClient)();
|
|
1196
1196
|
const { data } = (0, wagmi.useReadContract)({
|
|
1197
1197
|
address: timelockLens === null || timelockLens === void 0 ? void 0 : timelockLens.address,
|
|
1198
|
-
abi:
|
|
1198
|
+
abi: require_statelessStateView.lensAbi,
|
|
1199
1199
|
functionName: "getTokenData",
|
|
1200
1200
|
args: tokenAddr ? [tokenAddr] : void 0,
|
|
1201
1201
|
query: { enabled: !!tokenAddr && !!client }
|
|
@@ -1209,7 +1209,7 @@ const useTokenBalance = (token, user) => {
|
|
|
1209
1209
|
const { decimals } = useTokenData(token);
|
|
1210
1210
|
const { data: raw, ...rest } = (0, wagmi.useReadContract)({
|
|
1211
1211
|
address: token,
|
|
1212
|
-
abi:
|
|
1212
|
+
abi: require_statelessStateView.erc20Abi,
|
|
1213
1213
|
functionName: "balanceOf",
|
|
1214
1214
|
args: user ? [user] : void 0,
|
|
1215
1215
|
query: { enabled: !!token && !!user }
|
|
@@ -1226,7 +1226,7 @@ const useOperatorPerms = (marketAddr, userAddr, operatorAddr) => {
|
|
|
1226
1226
|
const { payoutAsset } = useMarketData(marketAddr);
|
|
1227
1227
|
const { data: payoutAssetBalance } = useTokenBalance(payoutAsset, userAddr);
|
|
1228
1228
|
const { data, ...rest } = (0, wagmi.useReadContract)({
|
|
1229
|
-
abi:
|
|
1229
|
+
abi: require_statelessStateView.optionsMarketAbi,
|
|
1230
1230
|
address: marketAddr,
|
|
1231
1231
|
functionName: "operatorPerms",
|
|
1232
1232
|
args: [userAddr, operatorAddr],
|
|
@@ -1299,7 +1299,7 @@ const useSetOperatorPerms = (marketAddr) => {
|
|
|
1299
1299
|
if (!marketAddr) throw new Error("Market address not available");
|
|
1300
1300
|
const hash = await writeContractAsync({
|
|
1301
1301
|
address: marketAddr,
|
|
1302
|
-
abi:
|
|
1302
|
+
abi: require_statelessStateView.optionsMarketAbi,
|
|
1303
1303
|
functionName: "setOperatorPerms",
|
|
1304
1304
|
args: [
|
|
1305
1305
|
operator,
|
|
@@ -1349,7 +1349,7 @@ const useVaultData = (vaultAddr) => {
|
|
|
1349
1349
|
const { timelockLens } = useLens();
|
|
1350
1350
|
const { data } = (0, wagmi.useReadContract)({
|
|
1351
1351
|
address: timelockLens === null || timelockLens === void 0 ? void 0 : timelockLens.address,
|
|
1352
|
-
abi:
|
|
1352
|
+
abi: require_statelessStateView.lensAbi,
|
|
1353
1353
|
functionName: "getVaultData",
|
|
1354
1354
|
args: vaultAddr ? [vaultAddr] : void 0
|
|
1355
1355
|
});
|
|
@@ -1370,7 +1370,7 @@ const useBurnLiquidity = (vaultAddr) => {
|
|
|
1370
1370
|
if (!vaultAddr || !timelockLens) throw new Error("Vault/lens not available");
|
|
1371
1371
|
const hash$1 = await writeContractAsync({
|
|
1372
1372
|
address: vaultAddr,
|
|
1373
|
-
abi:
|
|
1373
|
+
abi: require_factory.singleOwnerVaultAbi,
|
|
1374
1374
|
functionName: "burn",
|
|
1375
1375
|
args: [
|
|
1376
1376
|
tickLower,
|
|
@@ -1392,10 +1392,10 @@ const useBurnLiquidity = (vaultAddr) => {
|
|
|
1392
1392
|
const refTick = await timelockLens.read.getRefTick([vaultAddr, Math.min(...positions.map((p) => p.tickLower))]);
|
|
1393
1393
|
await (0, viem_actions.waitForTransactionReceipt)(client, { hash: await writeContractAsync({
|
|
1394
1394
|
address: vaultAddr,
|
|
1395
|
-
abi:
|
|
1395
|
+
abi: require_factory.singleOwnerVaultAbi,
|
|
1396
1396
|
functionName: "multicall",
|
|
1397
1397
|
args: [positions.map((p) => (0, viem.encodeFunctionData)({
|
|
1398
|
-
abi:
|
|
1398
|
+
abi: require_factory.singleOwnerVaultAbi,
|
|
1399
1399
|
functionName: "burn",
|
|
1400
1400
|
args: [
|
|
1401
1401
|
p.tickLower,
|
|
@@ -1425,7 +1425,7 @@ const useLiquidityBlocks = (vaultAddr) => {
|
|
|
1425
1425
|
const { timelockLens } = useLens();
|
|
1426
1426
|
const { data: blocks = [], ...rest } = (0, wagmi.useReadContract)({
|
|
1427
1427
|
address: timelockLens === null || timelockLens === void 0 ? void 0 : timelockLens.address,
|
|
1428
|
-
abi:
|
|
1428
|
+
abi: require_statelessStateView.lensAbi,
|
|
1429
1429
|
functionName: "getAllBlocks",
|
|
1430
1430
|
args: [vaultAddr || viem.zeroAddress],
|
|
1431
1431
|
query: { enabled: !!vaultAddr }
|
|
@@ -1482,10 +1482,10 @@ const useMintLiquidity = (vaultAddr) => {
|
|
|
1482
1482
|
const refTicks = await timelockLens.read.batchGetRefTick([vaultAddr, params.map((position) => position.tickLower)]);
|
|
1483
1483
|
await (0, viem_actions.waitForTransactionReceipt)(client, { hash: await writeContractAsync({
|
|
1484
1484
|
address: vaultAddr,
|
|
1485
|
-
abi:
|
|
1485
|
+
abi: require_factory.singleOwnerVaultAbi,
|
|
1486
1486
|
functionName: "multicall",
|
|
1487
1487
|
args: [params.map((p, i) => (0, viem.encodeFunctionData)({
|
|
1488
|
-
abi:
|
|
1488
|
+
abi: require_factory.singleOwnerVaultAbi,
|
|
1489
1489
|
functionName: "mint",
|
|
1490
1490
|
args: [
|
|
1491
1491
|
p.tickLower,
|
|
@@ -1507,7 +1507,7 @@ const useVaultTVL = (vaultAddr) => {
|
|
|
1507
1507
|
const { token0Decimals, token1Decimals } = usePoolData(poolManager, poolKey);
|
|
1508
1508
|
const { data, refetch } = (0, wagmi.useReadContract)({
|
|
1509
1509
|
address: timelockLens === null || timelockLens === void 0 ? void 0 : timelockLens.address,
|
|
1510
|
-
abi:
|
|
1510
|
+
abi: require_statelessStateView.lensAbi,
|
|
1511
1511
|
functionName: "getVaultTVL",
|
|
1512
1512
|
args: [vaultAddr],
|
|
1513
1513
|
query: { enabled: !!vaultAddr && !!timelockLens }
|
|
@@ -1542,7 +1542,7 @@ const useGuardianGlobalState = (guardianAddr) => {
|
|
|
1542
1542
|
const { timelockLens } = useLens();
|
|
1543
1543
|
const { data, ...rest } = (0, wagmi.useReadContract)({
|
|
1544
1544
|
address: timelockLens === null || timelockLens === void 0 ? void 0 : timelockLens.address,
|
|
1545
|
-
abi:
|
|
1545
|
+
abi: require_statelessStateView.lensAbi,
|
|
1546
1546
|
functionName: "getGlobalGuardianState",
|
|
1547
1547
|
args: guardianAddr ? [guardianAddr] : void 0
|
|
1548
1548
|
});
|
|
@@ -1552,602 +1552,6 @@ const useGuardianGlobalState = (guardianAddr) => {
|
|
|
1552
1552
|
};
|
|
1553
1553
|
};
|
|
1554
1554
|
|
|
1555
|
-
//#endregion
|
|
1556
|
-
//#region src/abis/guardian.ts
|
|
1557
|
-
const guardianAbi = [
|
|
1558
|
-
{
|
|
1559
|
-
type: "constructor",
|
|
1560
|
-
inputs: [],
|
|
1561
|
-
stateMutability: "nonpayable"
|
|
1562
|
-
},
|
|
1563
|
-
{
|
|
1564
|
-
type: "function",
|
|
1565
|
-
name: "DEFAULT_ADMIN_ROLE",
|
|
1566
|
-
inputs: [],
|
|
1567
|
-
outputs: [{
|
|
1568
|
-
name: "",
|
|
1569
|
-
type: "bytes32",
|
|
1570
|
-
internalType: "bytes32"
|
|
1571
|
-
}],
|
|
1572
|
-
stateMutability: "view"
|
|
1573
|
-
},
|
|
1574
|
-
{
|
|
1575
|
-
type: "function",
|
|
1576
|
-
name: "MIN_WITHDRAW_INTERVAL",
|
|
1577
|
-
inputs: [],
|
|
1578
|
-
outputs: [{
|
|
1579
|
-
name: "",
|
|
1580
|
-
type: "uint256",
|
|
1581
|
-
internalType: "uint256"
|
|
1582
|
-
}],
|
|
1583
|
-
stateMutability: "view"
|
|
1584
|
-
},
|
|
1585
|
-
{
|
|
1586
|
-
type: "function",
|
|
1587
|
-
name: "PAUSER_ROLE",
|
|
1588
|
-
inputs: [],
|
|
1589
|
-
outputs: [{
|
|
1590
|
-
name: "",
|
|
1591
|
-
type: "bytes32",
|
|
1592
|
-
internalType: "bytes32"
|
|
1593
|
-
}],
|
|
1594
|
-
stateMutability: "view"
|
|
1595
|
-
},
|
|
1596
|
-
{
|
|
1597
|
-
type: "function",
|
|
1598
|
-
name: "allowBurn",
|
|
1599
|
-
inputs: [{
|
|
1600
|
-
name: "vault",
|
|
1601
|
-
type: "address",
|
|
1602
|
-
internalType: "address"
|
|
1603
|
-
}],
|
|
1604
|
-
outputs: [{
|
|
1605
|
-
name: "",
|
|
1606
|
-
type: "bool",
|
|
1607
|
-
internalType: "bool"
|
|
1608
|
-
}],
|
|
1609
|
-
stateMutability: "view"
|
|
1610
|
-
},
|
|
1611
|
-
{
|
|
1612
|
-
type: "function",
|
|
1613
|
-
name: "allowEmergencyMarketWithdraw",
|
|
1614
|
-
inputs: [{
|
|
1615
|
-
name: "market",
|
|
1616
|
-
type: "address",
|
|
1617
|
-
internalType: "address"
|
|
1618
|
-
}],
|
|
1619
|
-
outputs: [{
|
|
1620
|
-
name: "",
|
|
1621
|
-
type: "bool",
|
|
1622
|
-
internalType: "bool"
|
|
1623
|
-
}],
|
|
1624
|
-
stateMutability: "view"
|
|
1625
|
-
},
|
|
1626
|
-
{
|
|
1627
|
-
type: "function",
|
|
1628
|
-
name: "allowEmergencyVaultWithdraw",
|
|
1629
|
-
inputs: [{
|
|
1630
|
-
name: "vault",
|
|
1631
|
-
type: "address",
|
|
1632
|
-
internalType: "address"
|
|
1633
|
-
}],
|
|
1634
|
-
outputs: [{
|
|
1635
|
-
name: "",
|
|
1636
|
-
type: "bool",
|
|
1637
|
-
internalType: "bool"
|
|
1638
|
-
}],
|
|
1639
|
-
stateMutability: "view"
|
|
1640
|
-
},
|
|
1641
|
-
{
|
|
1642
|
-
type: "function",
|
|
1643
|
-
name: "allowMint",
|
|
1644
|
-
inputs: [{
|
|
1645
|
-
name: "vault",
|
|
1646
|
-
type: "address",
|
|
1647
|
-
internalType: "address"
|
|
1648
|
-
}],
|
|
1649
|
-
outputs: [{
|
|
1650
|
-
name: "",
|
|
1651
|
-
type: "bool",
|
|
1652
|
-
internalType: "bool"
|
|
1653
|
-
}],
|
|
1654
|
-
stateMutability: "view"
|
|
1655
|
-
},
|
|
1656
|
-
{
|
|
1657
|
-
type: "function",
|
|
1658
|
-
name: "allowTrade",
|
|
1659
|
-
inputs: [
|
|
1660
|
-
{
|
|
1661
|
-
name: "market",
|
|
1662
|
-
type: "address",
|
|
1663
|
-
internalType: "address"
|
|
1664
|
-
},
|
|
1665
|
-
{
|
|
1666
|
-
name: "owner",
|
|
1667
|
-
type: "address",
|
|
1668
|
-
internalType: "address"
|
|
1669
|
-
},
|
|
1670
|
-
{
|
|
1671
|
-
name: "sender",
|
|
1672
|
-
type: "address",
|
|
1673
|
-
internalType: "address"
|
|
1674
|
-
}
|
|
1675
|
-
],
|
|
1676
|
-
outputs: [{
|
|
1677
|
-
name: "",
|
|
1678
|
-
type: "bool",
|
|
1679
|
-
internalType: "bool"
|
|
1680
|
-
}],
|
|
1681
|
-
stateMutability: "view"
|
|
1682
|
-
},
|
|
1683
|
-
{
|
|
1684
|
-
type: "function",
|
|
1685
|
-
name: "getRoleAdmin",
|
|
1686
|
-
inputs: [{
|
|
1687
|
-
name: "role",
|
|
1688
|
-
type: "bytes32",
|
|
1689
|
-
internalType: "bytes32"
|
|
1690
|
-
}],
|
|
1691
|
-
outputs: [{
|
|
1692
|
-
name: "",
|
|
1693
|
-
type: "bytes32",
|
|
1694
|
-
internalType: "bytes32"
|
|
1695
|
-
}],
|
|
1696
|
-
stateMutability: "view"
|
|
1697
|
-
},
|
|
1698
|
-
{
|
|
1699
|
-
type: "function",
|
|
1700
|
-
name: "globalBurnPaused",
|
|
1701
|
-
inputs: [],
|
|
1702
|
-
outputs: [{
|
|
1703
|
-
name: "paused",
|
|
1704
|
-
type: "bool",
|
|
1705
|
-
internalType: "bool"
|
|
1706
|
-
}, {
|
|
1707
|
-
name: "updatedAt",
|
|
1708
|
-
type: "uint64",
|
|
1709
|
-
internalType: "uint64"
|
|
1710
|
-
}],
|
|
1711
|
-
stateMutability: "view"
|
|
1712
|
-
},
|
|
1713
|
-
{
|
|
1714
|
-
type: "function",
|
|
1715
|
-
name: "globalMintPaused",
|
|
1716
|
-
inputs: [],
|
|
1717
|
-
outputs: [{
|
|
1718
|
-
name: "paused",
|
|
1719
|
-
type: "bool",
|
|
1720
|
-
internalType: "bool"
|
|
1721
|
-
}, {
|
|
1722
|
-
name: "updatedAt",
|
|
1723
|
-
type: "uint64",
|
|
1724
|
-
internalType: "uint64"
|
|
1725
|
-
}],
|
|
1726
|
-
stateMutability: "view"
|
|
1727
|
-
},
|
|
1728
|
-
{
|
|
1729
|
-
type: "function",
|
|
1730
|
-
name: "globalTradingPaused",
|
|
1731
|
-
inputs: [],
|
|
1732
|
-
outputs: [{
|
|
1733
|
-
name: "paused",
|
|
1734
|
-
type: "bool",
|
|
1735
|
-
internalType: "bool"
|
|
1736
|
-
}, {
|
|
1737
|
-
name: "updatedAt",
|
|
1738
|
-
type: "uint64",
|
|
1739
|
-
internalType: "uint64"
|
|
1740
|
-
}],
|
|
1741
|
-
stateMutability: "view"
|
|
1742
|
-
},
|
|
1743
|
-
{
|
|
1744
|
-
type: "function",
|
|
1745
|
-
name: "grantRole",
|
|
1746
|
-
inputs: [{
|
|
1747
|
-
name: "role",
|
|
1748
|
-
type: "bytes32",
|
|
1749
|
-
internalType: "bytes32"
|
|
1750
|
-
}, {
|
|
1751
|
-
name: "account",
|
|
1752
|
-
type: "address",
|
|
1753
|
-
internalType: "address"
|
|
1754
|
-
}],
|
|
1755
|
-
outputs: [],
|
|
1756
|
-
stateMutability: "nonpayable"
|
|
1757
|
-
},
|
|
1758
|
-
{
|
|
1759
|
-
type: "function",
|
|
1760
|
-
name: "hasRole",
|
|
1761
|
-
inputs: [{
|
|
1762
|
-
name: "role",
|
|
1763
|
-
type: "bytes32",
|
|
1764
|
-
internalType: "bytes32"
|
|
1765
|
-
}, {
|
|
1766
|
-
name: "account",
|
|
1767
|
-
type: "address",
|
|
1768
|
-
internalType: "address"
|
|
1769
|
-
}],
|
|
1770
|
-
outputs: [{
|
|
1771
|
-
name: "",
|
|
1772
|
-
type: "bool",
|
|
1773
|
-
internalType: "bool"
|
|
1774
|
-
}],
|
|
1775
|
-
stateMutability: "view"
|
|
1776
|
-
},
|
|
1777
|
-
{
|
|
1778
|
-
type: "function",
|
|
1779
|
-
name: "marketTradingPaused",
|
|
1780
|
-
inputs: [{
|
|
1781
|
-
name: "",
|
|
1782
|
-
type: "address",
|
|
1783
|
-
internalType: "address"
|
|
1784
|
-
}],
|
|
1785
|
-
outputs: [{
|
|
1786
|
-
name: "paused",
|
|
1787
|
-
type: "bool",
|
|
1788
|
-
internalType: "bool"
|
|
1789
|
-
}, {
|
|
1790
|
-
name: "updatedAt",
|
|
1791
|
-
type: "uint64",
|
|
1792
|
-
internalType: "uint64"
|
|
1793
|
-
}],
|
|
1794
|
-
stateMutability: "view"
|
|
1795
|
-
},
|
|
1796
|
-
{
|
|
1797
|
-
type: "function",
|
|
1798
|
-
name: "operatorsPaused",
|
|
1799
|
-
inputs: [{
|
|
1800
|
-
name: "",
|
|
1801
|
-
type: "address",
|
|
1802
|
-
internalType: "address"
|
|
1803
|
-
}],
|
|
1804
|
-
outputs: [{
|
|
1805
|
-
name: "paused",
|
|
1806
|
-
type: "bool",
|
|
1807
|
-
internalType: "bool"
|
|
1808
|
-
}, {
|
|
1809
|
-
name: "updatedAt",
|
|
1810
|
-
type: "uint64",
|
|
1811
|
-
internalType: "uint64"
|
|
1812
|
-
}],
|
|
1813
|
-
stateMutability: "view"
|
|
1814
|
-
},
|
|
1815
|
-
{
|
|
1816
|
-
type: "function",
|
|
1817
|
-
name: "pauseGlobal",
|
|
1818
|
-
inputs: [
|
|
1819
|
-
{
|
|
1820
|
-
name: "mintPaused",
|
|
1821
|
-
type: "bool",
|
|
1822
|
-
internalType: "bool"
|
|
1823
|
-
},
|
|
1824
|
-
{
|
|
1825
|
-
name: "burnPaused",
|
|
1826
|
-
type: "bool",
|
|
1827
|
-
internalType: "bool"
|
|
1828
|
-
},
|
|
1829
|
-
{
|
|
1830
|
-
name: "TradingPaused",
|
|
1831
|
-
type: "bool",
|
|
1832
|
-
internalType: "bool"
|
|
1833
|
-
}
|
|
1834
|
-
],
|
|
1835
|
-
outputs: [],
|
|
1836
|
-
stateMutability: "nonpayable"
|
|
1837
|
-
},
|
|
1838
|
-
{
|
|
1839
|
-
type: "function",
|
|
1840
|
-
name: "pauseMarket",
|
|
1841
|
-
inputs: [{
|
|
1842
|
-
name: "market",
|
|
1843
|
-
type: "address",
|
|
1844
|
-
internalType: "address"
|
|
1845
|
-
}, {
|
|
1846
|
-
name: "TradingPaused",
|
|
1847
|
-
type: "bool",
|
|
1848
|
-
internalType: "bool"
|
|
1849
|
-
}],
|
|
1850
|
-
outputs: [],
|
|
1851
|
-
stateMutability: "nonpayable"
|
|
1852
|
-
},
|
|
1853
|
-
{
|
|
1854
|
-
type: "function",
|
|
1855
|
-
name: "pauseOperator",
|
|
1856
|
-
inputs: [{
|
|
1857
|
-
name: "operator",
|
|
1858
|
-
type: "address",
|
|
1859
|
-
internalType: "address"
|
|
1860
|
-
}, {
|
|
1861
|
-
name: "paused",
|
|
1862
|
-
type: "bool",
|
|
1863
|
-
internalType: "bool"
|
|
1864
|
-
}],
|
|
1865
|
-
outputs: [],
|
|
1866
|
-
stateMutability: "nonpayable"
|
|
1867
|
-
},
|
|
1868
|
-
{
|
|
1869
|
-
type: "function",
|
|
1870
|
-
name: "pauseVault",
|
|
1871
|
-
inputs: [
|
|
1872
|
-
{
|
|
1873
|
-
name: "vault",
|
|
1874
|
-
type: "address",
|
|
1875
|
-
internalType: "address"
|
|
1876
|
-
},
|
|
1877
|
-
{
|
|
1878
|
-
name: "mintPaused",
|
|
1879
|
-
type: "bool",
|
|
1880
|
-
internalType: "bool"
|
|
1881
|
-
},
|
|
1882
|
-
{
|
|
1883
|
-
name: "burnPaused",
|
|
1884
|
-
type: "bool",
|
|
1885
|
-
internalType: "bool"
|
|
1886
|
-
}
|
|
1887
|
-
],
|
|
1888
|
-
outputs: [],
|
|
1889
|
-
stateMutability: "nonpayable"
|
|
1890
|
-
},
|
|
1891
|
-
{
|
|
1892
|
-
type: "function",
|
|
1893
|
-
name: "renounceRole",
|
|
1894
|
-
inputs: [{
|
|
1895
|
-
name: "role",
|
|
1896
|
-
type: "bytes32",
|
|
1897
|
-
internalType: "bytes32"
|
|
1898
|
-
}, {
|
|
1899
|
-
name: "callerConfirmation",
|
|
1900
|
-
type: "address",
|
|
1901
|
-
internalType: "address"
|
|
1902
|
-
}],
|
|
1903
|
-
outputs: [],
|
|
1904
|
-
stateMutability: "nonpayable"
|
|
1905
|
-
},
|
|
1906
|
-
{
|
|
1907
|
-
type: "function",
|
|
1908
|
-
name: "revokeRole",
|
|
1909
|
-
inputs: [{
|
|
1910
|
-
name: "role",
|
|
1911
|
-
type: "bytes32",
|
|
1912
|
-
internalType: "bytes32"
|
|
1913
|
-
}, {
|
|
1914
|
-
name: "account",
|
|
1915
|
-
type: "address",
|
|
1916
|
-
internalType: "address"
|
|
1917
|
-
}],
|
|
1918
|
-
outputs: [],
|
|
1919
|
-
stateMutability: "nonpayable"
|
|
1920
|
-
},
|
|
1921
|
-
{
|
|
1922
|
-
type: "function",
|
|
1923
|
-
name: "supportsInterface",
|
|
1924
|
-
inputs: [{
|
|
1925
|
-
name: "interfaceId",
|
|
1926
|
-
type: "bytes4",
|
|
1927
|
-
internalType: "bytes4"
|
|
1928
|
-
}],
|
|
1929
|
-
outputs: [{
|
|
1930
|
-
name: "",
|
|
1931
|
-
type: "bool",
|
|
1932
|
-
internalType: "bool"
|
|
1933
|
-
}],
|
|
1934
|
-
stateMutability: "view"
|
|
1935
|
-
},
|
|
1936
|
-
{
|
|
1937
|
-
type: "function",
|
|
1938
|
-
name: "vaultBurnPaused",
|
|
1939
|
-
inputs: [{
|
|
1940
|
-
name: "",
|
|
1941
|
-
type: "address",
|
|
1942
|
-
internalType: "address"
|
|
1943
|
-
}],
|
|
1944
|
-
outputs: [{
|
|
1945
|
-
name: "paused",
|
|
1946
|
-
type: "bool",
|
|
1947
|
-
internalType: "bool"
|
|
1948
|
-
}, {
|
|
1949
|
-
name: "updatedAt",
|
|
1950
|
-
type: "uint64",
|
|
1951
|
-
internalType: "uint64"
|
|
1952
|
-
}],
|
|
1953
|
-
stateMutability: "view"
|
|
1954
|
-
},
|
|
1955
|
-
{
|
|
1956
|
-
type: "function",
|
|
1957
|
-
name: "vaultMintPaused",
|
|
1958
|
-
inputs: [{
|
|
1959
|
-
name: "",
|
|
1960
|
-
type: "address",
|
|
1961
|
-
internalType: "address"
|
|
1962
|
-
}],
|
|
1963
|
-
outputs: [{
|
|
1964
|
-
name: "paused",
|
|
1965
|
-
type: "bool",
|
|
1966
|
-
internalType: "bool"
|
|
1967
|
-
}, {
|
|
1968
|
-
name: "updatedAt",
|
|
1969
|
-
type: "uint64",
|
|
1970
|
-
internalType: "uint64"
|
|
1971
|
-
}],
|
|
1972
|
-
stateMutability: "view"
|
|
1973
|
-
},
|
|
1974
|
-
{
|
|
1975
|
-
type: "event",
|
|
1976
|
-
name: "PauseGlobal",
|
|
1977
|
-
inputs: [
|
|
1978
|
-
{
|
|
1979
|
-
name: "mintPaused",
|
|
1980
|
-
type: "bool",
|
|
1981
|
-
indexed: false,
|
|
1982
|
-
internalType: "bool"
|
|
1983
|
-
},
|
|
1984
|
-
{
|
|
1985
|
-
name: "burnPaused",
|
|
1986
|
-
type: "bool",
|
|
1987
|
-
indexed: false,
|
|
1988
|
-
internalType: "bool"
|
|
1989
|
-
},
|
|
1990
|
-
{
|
|
1991
|
-
name: "TradingPaused",
|
|
1992
|
-
type: "bool",
|
|
1993
|
-
indexed: false,
|
|
1994
|
-
internalType: "bool"
|
|
1995
|
-
}
|
|
1996
|
-
],
|
|
1997
|
-
anonymous: false
|
|
1998
|
-
},
|
|
1999
|
-
{
|
|
2000
|
-
type: "event",
|
|
2001
|
-
name: "PauseMarket",
|
|
2002
|
-
inputs: [{
|
|
2003
|
-
name: "market",
|
|
2004
|
-
type: "address",
|
|
2005
|
-
indexed: true,
|
|
2006
|
-
internalType: "address"
|
|
2007
|
-
}, {
|
|
2008
|
-
name: "paused",
|
|
2009
|
-
type: "bool",
|
|
2010
|
-
indexed: false,
|
|
2011
|
-
internalType: "bool"
|
|
2012
|
-
}],
|
|
2013
|
-
anonymous: false
|
|
2014
|
-
},
|
|
2015
|
-
{
|
|
2016
|
-
type: "event",
|
|
2017
|
-
name: "PauseOperator",
|
|
2018
|
-
inputs: [{
|
|
2019
|
-
name: "operator",
|
|
2020
|
-
type: "address",
|
|
2021
|
-
indexed: true,
|
|
2022
|
-
internalType: "address"
|
|
2023
|
-
}, {
|
|
2024
|
-
name: "paused",
|
|
2025
|
-
type: "bool",
|
|
2026
|
-
indexed: false,
|
|
2027
|
-
internalType: "bool"
|
|
2028
|
-
}],
|
|
2029
|
-
anonymous: false
|
|
2030
|
-
},
|
|
2031
|
-
{
|
|
2032
|
-
type: "event",
|
|
2033
|
-
name: "PauseVault",
|
|
2034
|
-
inputs: [
|
|
2035
|
-
{
|
|
2036
|
-
name: "vault",
|
|
2037
|
-
type: "address",
|
|
2038
|
-
indexed: true,
|
|
2039
|
-
internalType: "address"
|
|
2040
|
-
},
|
|
2041
|
-
{
|
|
2042
|
-
name: "mintPaused",
|
|
2043
|
-
type: "bool",
|
|
2044
|
-
indexed: false,
|
|
2045
|
-
internalType: "bool"
|
|
2046
|
-
},
|
|
2047
|
-
{
|
|
2048
|
-
name: "burnPaused",
|
|
2049
|
-
type: "bool",
|
|
2050
|
-
indexed: false,
|
|
2051
|
-
internalType: "bool"
|
|
2052
|
-
}
|
|
2053
|
-
],
|
|
2054
|
-
anonymous: false
|
|
2055
|
-
},
|
|
2056
|
-
{
|
|
2057
|
-
type: "event",
|
|
2058
|
-
name: "RoleAdminChanged",
|
|
2059
|
-
inputs: [
|
|
2060
|
-
{
|
|
2061
|
-
name: "role",
|
|
2062
|
-
type: "bytes32",
|
|
2063
|
-
indexed: true,
|
|
2064
|
-
internalType: "bytes32"
|
|
2065
|
-
},
|
|
2066
|
-
{
|
|
2067
|
-
name: "previousAdminRole",
|
|
2068
|
-
type: "bytes32",
|
|
2069
|
-
indexed: true,
|
|
2070
|
-
internalType: "bytes32"
|
|
2071
|
-
},
|
|
2072
|
-
{
|
|
2073
|
-
name: "newAdminRole",
|
|
2074
|
-
type: "bytes32",
|
|
2075
|
-
indexed: true,
|
|
2076
|
-
internalType: "bytes32"
|
|
2077
|
-
}
|
|
2078
|
-
],
|
|
2079
|
-
anonymous: false
|
|
2080
|
-
},
|
|
2081
|
-
{
|
|
2082
|
-
type: "event",
|
|
2083
|
-
name: "RoleGranted",
|
|
2084
|
-
inputs: [
|
|
2085
|
-
{
|
|
2086
|
-
name: "role",
|
|
2087
|
-
type: "bytes32",
|
|
2088
|
-
indexed: true,
|
|
2089
|
-
internalType: "bytes32"
|
|
2090
|
-
},
|
|
2091
|
-
{
|
|
2092
|
-
name: "account",
|
|
2093
|
-
type: "address",
|
|
2094
|
-
indexed: true,
|
|
2095
|
-
internalType: "address"
|
|
2096
|
-
},
|
|
2097
|
-
{
|
|
2098
|
-
name: "sender",
|
|
2099
|
-
type: "address",
|
|
2100
|
-
indexed: true,
|
|
2101
|
-
internalType: "address"
|
|
2102
|
-
}
|
|
2103
|
-
],
|
|
2104
|
-
anonymous: false
|
|
2105
|
-
},
|
|
2106
|
-
{
|
|
2107
|
-
type: "event",
|
|
2108
|
-
name: "RoleRevoked",
|
|
2109
|
-
inputs: [
|
|
2110
|
-
{
|
|
2111
|
-
name: "role",
|
|
2112
|
-
type: "bytes32",
|
|
2113
|
-
indexed: true,
|
|
2114
|
-
internalType: "bytes32"
|
|
2115
|
-
},
|
|
2116
|
-
{
|
|
2117
|
-
name: "account",
|
|
2118
|
-
type: "address",
|
|
2119
|
-
indexed: true,
|
|
2120
|
-
internalType: "address"
|
|
2121
|
-
},
|
|
2122
|
-
{
|
|
2123
|
-
name: "sender",
|
|
2124
|
-
type: "address",
|
|
2125
|
-
indexed: true,
|
|
2126
|
-
internalType: "address"
|
|
2127
|
-
}
|
|
2128
|
-
],
|
|
2129
|
-
anonymous: false
|
|
2130
|
-
},
|
|
2131
|
-
{
|
|
2132
|
-
type: "error",
|
|
2133
|
-
name: "AccessControlBadConfirmation",
|
|
2134
|
-
inputs: []
|
|
2135
|
-
},
|
|
2136
|
-
{
|
|
2137
|
-
type: "error",
|
|
2138
|
-
name: "AccessControlUnauthorizedAccount",
|
|
2139
|
-
inputs: [{
|
|
2140
|
-
name: "account",
|
|
2141
|
-
type: "address",
|
|
2142
|
-
internalType: "address"
|
|
2143
|
-
}, {
|
|
2144
|
-
name: "neededRole",
|
|
2145
|
-
type: "bytes32",
|
|
2146
|
-
internalType: "bytes32"
|
|
2147
|
-
}]
|
|
2148
|
-
}
|
|
2149
|
-
];
|
|
2150
|
-
|
|
2151
1555
|
//#endregion
|
|
2152
1556
|
//#region src/hooks/guardian/usePauseGlobalTrading.ts
|
|
2153
1557
|
const usePauseGlobalTrading = ({ marketAddr }) => {
|
|
@@ -2162,7 +1566,7 @@ const usePauseGlobalTrading = ({ marketAddr }) => {
|
|
|
2162
1566
|
if (!publicClient) throw new Error("Could not load public client");
|
|
2163
1567
|
const hash = await writeContractAsync({
|
|
2164
1568
|
address: guardian,
|
|
2165
|
-
abi: guardianAbi,
|
|
1569
|
+
abi: require_factory.guardianAbi,
|
|
2166
1570
|
functionName: "pauseGlobal",
|
|
2167
1571
|
args: [
|
|
2168
1572
|
globalMintPaused.paused,
|
|
@@ -2190,7 +1594,7 @@ const usePauseMarketTrading = ({ marketAddr }) => {
|
|
|
2190
1594
|
if (!guardian) throw new Error("Could not load guardian address");
|
|
2191
1595
|
return await writeContractAsync({
|
|
2192
1596
|
address: guardian,
|
|
2193
|
-
abi: guardianAbi,
|
|
1597
|
+
abi: require_factory.guardianAbi,
|
|
2194
1598
|
functionName: "pauseMarket",
|
|
2195
1599
|
args: [marketAddr, paused]
|
|
2196
1600
|
});
|
|
@@ -2207,267 +1611,13 @@ const useFeeRates = (feeStrategy) => {
|
|
|
2207
1611
|
const { timelockLens } = useLens();
|
|
2208
1612
|
const { data } = (0, wagmi.useReadContract)({
|
|
2209
1613
|
address: timelockLens === null || timelockLens === void 0 ? void 0 : timelockLens.address,
|
|
2210
|
-
abi:
|
|
1614
|
+
abi: require_statelessStateView.lensAbi,
|
|
2211
1615
|
args: feeStrategy ? [feeStrategy] : void 0,
|
|
2212
1616
|
functionName: "getFeeRates"
|
|
2213
1617
|
});
|
|
2214
1618
|
return data || {};
|
|
2215
1619
|
};
|
|
2216
1620
|
|
|
2217
|
-
//#endregion
|
|
2218
|
-
//#region src/abis/factory.ts
|
|
2219
|
-
const factoryAbi = [
|
|
2220
|
-
{
|
|
2221
|
-
type: "function",
|
|
2222
|
-
name: "deployFeeStrategy",
|
|
2223
|
-
inputs: [
|
|
2224
|
-
{
|
|
2225
|
-
name: "_openingFeeRate",
|
|
2226
|
-
type: "uint32",
|
|
2227
|
-
internalType: "uint32"
|
|
2228
|
-
},
|
|
2229
|
-
{
|
|
2230
|
-
name: "_baseFeeRate",
|
|
2231
|
-
type: "uint32",
|
|
2232
|
-
internalType: "uint32"
|
|
2233
|
-
},
|
|
2234
|
-
{
|
|
2235
|
-
name: "_minOpeningFee",
|
|
2236
|
-
type: "uint128",
|
|
2237
|
-
internalType: "uint128"
|
|
2238
|
-
},
|
|
2239
|
-
{
|
|
2240
|
-
name: "_minBaseFee",
|
|
2241
|
-
type: "uint128",
|
|
2242
|
-
internalType: "uint128"
|
|
2243
|
-
},
|
|
2244
|
-
{
|
|
2245
|
-
name: "_feeRecipient",
|
|
2246
|
-
type: "address",
|
|
2247
|
-
internalType: "address"
|
|
2248
|
-
}
|
|
2249
|
-
],
|
|
2250
|
-
outputs: [{
|
|
2251
|
-
name: "",
|
|
2252
|
-
type: "address",
|
|
2253
|
-
internalType: "contract FeeStrategy"
|
|
2254
|
-
}],
|
|
2255
|
-
stateMutability: "nonpayable"
|
|
2256
|
-
},
|
|
2257
|
-
{
|
|
2258
|
-
type: "function",
|
|
2259
|
-
name: "deployOptionPricing",
|
|
2260
|
-
inputs: [
|
|
2261
|
-
{
|
|
2262
|
-
name: "_logicContract",
|
|
2263
|
-
type: "address",
|
|
2264
|
-
internalType: "contract StatelessOptionPricing"
|
|
2265
|
-
},
|
|
2266
|
-
{
|
|
2267
|
-
name: "_iv",
|
|
2268
|
-
type: "uint32",
|
|
2269
|
-
internalType: "uint32"
|
|
2270
|
-
},
|
|
2271
|
-
{
|
|
2272
|
-
name: "_riskFreeRate",
|
|
2273
|
-
type: "uint32",
|
|
2274
|
-
internalType: "uint32"
|
|
2275
|
-
},
|
|
2276
|
-
{
|
|
2277
|
-
name: "_minPremiumDailyRate",
|
|
2278
|
-
type: "uint32",
|
|
2279
|
-
internalType: "uint32"
|
|
2280
|
-
},
|
|
2281
|
-
{
|
|
2282
|
-
name: "_minPremiumAmount",
|
|
2283
|
-
type: "uint256",
|
|
2284
|
-
internalType: "uint256"
|
|
2285
|
-
}
|
|
2286
|
-
],
|
|
2287
|
-
outputs: [{
|
|
2288
|
-
name: "",
|
|
2289
|
-
type: "address",
|
|
2290
|
-
internalType: "contract OptionPricing"
|
|
2291
|
-
}],
|
|
2292
|
-
stateMutability: "nonpayable"
|
|
2293
|
-
},
|
|
2294
|
-
{
|
|
2295
|
-
type: "function",
|
|
2296
|
-
name: "deployStaticPerpsPricing",
|
|
2297
|
-
inputs: [{
|
|
2298
|
-
name: "_dailyFundingRate",
|
|
2299
|
-
type: "uint32",
|
|
2300
|
-
internalType: "uint32"
|
|
2301
|
-
}, {
|
|
2302
|
-
name: "_minFundingAmount",
|
|
2303
|
-
type: "uint128",
|
|
2304
|
-
internalType: "uint128"
|
|
2305
|
-
}],
|
|
2306
|
-
outputs: [{
|
|
2307
|
-
name: "",
|
|
2308
|
-
type: "address",
|
|
2309
|
-
internalType: "contract StaticPerpsPricing"
|
|
2310
|
-
}],
|
|
2311
|
-
stateMutability: "nonpayable"
|
|
2312
|
-
},
|
|
2313
|
-
{
|
|
2314
|
-
type: "function",
|
|
2315
|
-
name: "feeStrategies",
|
|
2316
|
-
inputs: [{
|
|
2317
|
-
name: "",
|
|
2318
|
-
type: "bytes32",
|
|
2319
|
-
internalType: "bytes32"
|
|
2320
|
-
}],
|
|
2321
|
-
outputs: [{
|
|
2322
|
-
name: "",
|
|
2323
|
-
type: "address",
|
|
2324
|
-
internalType: "contract FeeStrategy"
|
|
2325
|
-
}],
|
|
2326
|
-
stateMutability: "view"
|
|
2327
|
-
},
|
|
2328
|
-
{
|
|
2329
|
-
type: "function",
|
|
2330
|
-
name: "optionPricings",
|
|
2331
|
-
inputs: [{
|
|
2332
|
-
name: "",
|
|
2333
|
-
type: "bytes32",
|
|
2334
|
-
internalType: "bytes32"
|
|
2335
|
-
}],
|
|
2336
|
-
outputs: [{
|
|
2337
|
-
name: "",
|
|
2338
|
-
type: "address",
|
|
2339
|
-
internalType: "contract OptionPricing"
|
|
2340
|
-
}],
|
|
2341
|
-
stateMutability: "view"
|
|
2342
|
-
},
|
|
2343
|
-
{
|
|
2344
|
-
type: "function",
|
|
2345
|
-
name: "staticPerpsPricings",
|
|
2346
|
-
inputs: [{
|
|
2347
|
-
name: "",
|
|
2348
|
-
type: "bytes32",
|
|
2349
|
-
internalType: "bytes32"
|
|
2350
|
-
}],
|
|
2351
|
-
outputs: [{
|
|
2352
|
-
name: "",
|
|
2353
|
-
type: "address",
|
|
2354
|
-
internalType: "contract StaticPerpsPricing"
|
|
2355
|
-
}],
|
|
2356
|
-
stateMutability: "view"
|
|
2357
|
-
},
|
|
2358
|
-
{
|
|
2359
|
-
type: "event",
|
|
2360
|
-
name: "DeployFeeStrategy",
|
|
2361
|
-
inputs: [
|
|
2362
|
-
{
|
|
2363
|
-
name: "feeStrategy",
|
|
2364
|
-
type: "address",
|
|
2365
|
-
indexed: true,
|
|
2366
|
-
internalType: "contract FeeStrategy"
|
|
2367
|
-
},
|
|
2368
|
-
{
|
|
2369
|
-
name: "openingFeeRate",
|
|
2370
|
-
type: "uint32",
|
|
2371
|
-
indexed: false,
|
|
2372
|
-
internalType: "uint32"
|
|
2373
|
-
},
|
|
2374
|
-
{
|
|
2375
|
-
name: "baseFeeRate",
|
|
2376
|
-
type: "uint32",
|
|
2377
|
-
indexed: false,
|
|
2378
|
-
internalType: "uint32"
|
|
2379
|
-
},
|
|
2380
|
-
{
|
|
2381
|
-
name: "minOpeningFee",
|
|
2382
|
-
type: "uint128",
|
|
2383
|
-
indexed: false,
|
|
2384
|
-
internalType: "uint128"
|
|
2385
|
-
},
|
|
2386
|
-
{
|
|
2387
|
-
name: "minBaseFee",
|
|
2388
|
-
type: "uint128",
|
|
2389
|
-
indexed: false,
|
|
2390
|
-
internalType: "uint128"
|
|
2391
|
-
},
|
|
2392
|
-
{
|
|
2393
|
-
name: "feeRecipient",
|
|
2394
|
-
type: "address",
|
|
2395
|
-
indexed: false,
|
|
2396
|
-
internalType: "address"
|
|
2397
|
-
}
|
|
2398
|
-
],
|
|
2399
|
-
anonymous: false
|
|
2400
|
-
},
|
|
2401
|
-
{
|
|
2402
|
-
type: "event",
|
|
2403
|
-
name: "DeployOptionPricing",
|
|
2404
|
-
inputs: [
|
|
2405
|
-
{
|
|
2406
|
-
name: "pricing",
|
|
2407
|
-
type: "address",
|
|
2408
|
-
indexed: true,
|
|
2409
|
-
internalType: "contract OptionPricing"
|
|
2410
|
-
},
|
|
2411
|
-
{
|
|
2412
|
-
name: "statelessPricing",
|
|
2413
|
-
type: "address",
|
|
2414
|
-
indexed: false,
|
|
2415
|
-
internalType: "contract StatelessOptionPricing"
|
|
2416
|
-
},
|
|
2417
|
-
{
|
|
2418
|
-
name: "iv",
|
|
2419
|
-
type: "uint32",
|
|
2420
|
-
indexed: false,
|
|
2421
|
-
internalType: "uint32"
|
|
2422
|
-
},
|
|
2423
|
-
{
|
|
2424
|
-
name: "riskFreeRate",
|
|
2425
|
-
type: "uint32",
|
|
2426
|
-
indexed: false,
|
|
2427
|
-
internalType: "uint32"
|
|
2428
|
-
},
|
|
2429
|
-
{
|
|
2430
|
-
name: "minPremiumDailyRate",
|
|
2431
|
-
type: "uint32",
|
|
2432
|
-
indexed: false,
|
|
2433
|
-
internalType: "uint32"
|
|
2434
|
-
},
|
|
2435
|
-
{
|
|
2436
|
-
name: "minPremiumAmount",
|
|
2437
|
-
type: "uint256",
|
|
2438
|
-
indexed: false,
|
|
2439
|
-
internalType: "uint256"
|
|
2440
|
-
}
|
|
2441
|
-
],
|
|
2442
|
-
anonymous: false
|
|
2443
|
-
},
|
|
2444
|
-
{
|
|
2445
|
-
type: "event",
|
|
2446
|
-
name: "DeployStaticPerpsPricing",
|
|
2447
|
-
inputs: [
|
|
2448
|
-
{
|
|
2449
|
-
name: "pricing",
|
|
2450
|
-
type: "address",
|
|
2451
|
-
indexed: true,
|
|
2452
|
-
internalType: "contract StaticPerpsPricing"
|
|
2453
|
-
},
|
|
2454
|
-
{
|
|
2455
|
-
name: "dailyFundingRate",
|
|
2456
|
-
type: "uint32",
|
|
2457
|
-
indexed: false,
|
|
2458
|
-
internalType: "uint32"
|
|
2459
|
-
},
|
|
2460
|
-
{
|
|
2461
|
-
name: "minFundingAmount",
|
|
2462
|
-
type: "uint128",
|
|
2463
|
-
indexed: false,
|
|
2464
|
-
internalType: "uint128"
|
|
2465
|
-
}
|
|
2466
|
-
],
|
|
2467
|
-
anonymous: false
|
|
2468
|
-
}
|
|
2469
|
-
];
|
|
2470
|
-
|
|
2471
1621
|
//#endregion
|
|
2472
1622
|
//#region src/hooks/fees/useUpdateMarketFees.ts
|
|
2473
1623
|
const useUpdateMarketFees = (marketAddr) => {
|
|
@@ -2483,7 +1633,7 @@ const useUpdateMarketFees = (marketAddr) => {
|
|
|
2483
1633
|
const factoryAddr = require_optionUtils.timelockFactories[chainId].toLowerCase();
|
|
2484
1634
|
const hash = await writeContractAsync({
|
|
2485
1635
|
address: factoryAddr,
|
|
2486
|
-
abi: factoryAbi,
|
|
1636
|
+
abi: require_factory.factoryAbi,
|
|
2487
1637
|
functionName: "deployFeeStrategy",
|
|
2488
1638
|
args: [
|
|
2489
1639
|
rates.openingFeeRate ?? openingFeeRate,
|
|
@@ -2496,7 +1646,7 @@ const useUpdateMarketFees = (marketAddr) => {
|
|
|
2496
1646
|
const deployEvent = (await publicClient.waitForTransactionReceipt({ hash })).logs.find((log) => log.address.toLowerCase() === factoryAddr);
|
|
2497
1647
|
if (!deployEvent) throw new Error("DeployFeeStrategy event not found");
|
|
2498
1648
|
const decodedEvent = (0, viem.decodeEventLog)({
|
|
2499
|
-
abi: factoryAbi,
|
|
1649
|
+
abi: require_factory.factoryAbi,
|
|
2500
1650
|
data: deployEvent.data,
|
|
2501
1651
|
topics: deployEvent.topics
|
|
2502
1652
|
});
|
|
@@ -2506,7 +1656,7 @@ const useUpdateMarketFees = (marketAddr) => {
|
|
|
2506
1656
|
deployHash: hash,
|
|
2507
1657
|
updateHash: await writeContractAsync({
|
|
2508
1658
|
address: marketAddr,
|
|
2509
|
-
abi:
|
|
1659
|
+
abi: require_statelessStateView.optionsMarketAbi,
|
|
2510
1660
|
functionName: "updateAddresses",
|
|
2511
1661
|
args: [optionPricing, newFeeStrategy]
|
|
2512
1662
|
}),
|
|
@@ -2520,65 +1670,79 @@ const useUpdateMarketFees = (marketAddr) => {
|
|
|
2520
1670
|
};
|
|
2521
1671
|
|
|
2522
1672
|
//#endregion
|
|
2523
|
-
//#region src/hooks/pricing/
|
|
2524
|
-
const
|
|
2525
|
-
const { timelockLens } = useLens();
|
|
2526
|
-
const { data: { optionPricing } } = useMarketState(marketAddr);
|
|
1673
|
+
//#region src/hooks/pricing/usePricingParams.ts
|
|
1674
|
+
const usePricingParams = (pricingAddr) => {
|
|
2527
1675
|
return (0, wagmi.useReadContract)({
|
|
2528
|
-
address:
|
|
2529
|
-
abi:
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
logicContract,
|
|
2560
|
-
iv,
|
|
2561
|
-
riskFreeRate,
|
|
2562
|
-
minPremiumDailyRate,
|
|
2563
|
-
minPremiumAmount
|
|
2564
|
-
};
|
|
2565
|
-
} else if (pricingModel === 1) {
|
|
2566
|
-
const [dailyFundingRate, minFundingAmount] = (0, viem.decodeAbiParameters)([{
|
|
2567
|
-
name: "dailyFundingRate",
|
|
1676
|
+
address: pricingAddr,
|
|
1677
|
+
abi: [{
|
|
1678
|
+
type: "function",
|
|
1679
|
+
name: "readState",
|
|
1680
|
+
stateMutability: "view",
|
|
1681
|
+
inputs: [{
|
|
1682
|
+
name: "target",
|
|
1683
|
+
type: "address"
|
|
1684
|
+
}],
|
|
1685
|
+
outputs: [{
|
|
1686
|
+
name: "",
|
|
1687
|
+
type: "bytes"
|
|
1688
|
+
}]
|
|
1689
|
+
}],
|
|
1690
|
+
functionName: "readState",
|
|
1691
|
+
query: { select: (data) => {
|
|
1692
|
+
const [pricingModel, rawData] = (0, viem.decodeAbiParameters)([{
|
|
1693
|
+
name: "pricingModel",
|
|
1694
|
+
type: "uint8"
|
|
1695
|
+
}, {
|
|
1696
|
+
name: "rawData",
|
|
1697
|
+
type: "bytes"
|
|
1698
|
+
}], data);
|
|
1699
|
+
if (pricingModel === 0) {
|
|
1700
|
+
const [logicContract, iv, riskFreeRate, minPremiumDailyRate, minPremiumAmount] = (0, viem.decodeAbiParameters)([
|
|
1701
|
+
{
|
|
1702
|
+
name: "logicContract",
|
|
1703
|
+
type: "address"
|
|
1704
|
+
},
|
|
1705
|
+
{
|
|
1706
|
+
name: "iv",
|
|
2568
1707
|
type: "uint32"
|
|
2569
|
-
},
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
}
|
|
2578
|
-
|
|
2579
|
-
|
|
1708
|
+
},
|
|
1709
|
+
{
|
|
1710
|
+
name: "riskFreeRate",
|
|
1711
|
+
type: "uint32"
|
|
1712
|
+
},
|
|
1713
|
+
{
|
|
1714
|
+
name: "minPremiumDailyRate",
|
|
1715
|
+
type: "uint32"
|
|
1716
|
+
},
|
|
1717
|
+
{
|
|
1718
|
+
name: "minPremiumAmount",
|
|
1719
|
+
type: "uint256"
|
|
1720
|
+
}
|
|
1721
|
+
], rawData);
|
|
1722
|
+
return {
|
|
1723
|
+
model: "option",
|
|
1724
|
+
logicContract,
|
|
1725
|
+
iv,
|
|
1726
|
+
riskFreeRate,
|
|
1727
|
+
minPremiumDailyRate,
|
|
1728
|
+
minPremiumAmount
|
|
1729
|
+
};
|
|
1730
|
+
} else if (pricingModel === 1) {
|
|
1731
|
+
const [dailyFundingRate, minFundingAmount] = (0, viem.decodeAbiParameters)([{
|
|
1732
|
+
name: "dailyFundingRate",
|
|
1733
|
+
type: "uint32"
|
|
1734
|
+
}, {
|
|
1735
|
+
name: "minFundingAmount",
|
|
1736
|
+
type: "uint128"
|
|
1737
|
+
}], rawData);
|
|
1738
|
+
return {
|
|
1739
|
+
model: "static",
|
|
1740
|
+
dailyFundingRate,
|
|
1741
|
+
minFundingAmount
|
|
1742
|
+
};
|
|
2580
1743
|
}
|
|
2581
|
-
|
|
1744
|
+
throw new Error("Unknown pricing model");
|
|
1745
|
+
} }
|
|
2582
1746
|
});
|
|
2583
1747
|
};
|
|
2584
1748
|
|
|
@@ -2588,7 +1752,7 @@ const useOptionPricingParams = (pricingAddr) => {
|
|
|
2588
1752
|
const { timelockLens } = useLens();
|
|
2589
1753
|
const { data } = (0, wagmi.useReadContract)({
|
|
2590
1754
|
address: timelockLens === null || timelockLens === void 0 ? void 0 : timelockLens.address,
|
|
2591
|
-
abi:
|
|
1755
|
+
abi: require_statelessStateView.lensAbi,
|
|
2592
1756
|
args: pricingAddr ? [pricingAddr] : void 0,
|
|
2593
1757
|
functionName: "getOptionPricingParams"
|
|
2594
1758
|
});
|
|
@@ -2601,7 +1765,7 @@ const useStaticPricingParams = (pricingAddr) => {
|
|
|
2601
1765
|
const { timelockLens } = useLens();
|
|
2602
1766
|
const { data } = (0, wagmi.useReadContract)({
|
|
2603
1767
|
address: timelockLens === null || timelockLens === void 0 ? void 0 : timelockLens.address,
|
|
2604
|
-
abi:
|
|
1768
|
+
abi: require_statelessStateView.lensAbi,
|
|
2605
1769
|
args: pricingAddr ? [pricingAddr] : void 0,
|
|
2606
1770
|
functionName: "getStaticPricingParams"
|
|
2607
1771
|
});
|
|
@@ -2614,8 +1778,8 @@ const useUpdateMarketPricing = (marketAddr) => {
|
|
|
2614
1778
|
const { writeContractAsync, ...rest } = (0, wagmi.useWriteContract)();
|
|
2615
1779
|
const publicClient = (0, wagmi.usePublicClient)();
|
|
2616
1780
|
const chainId = (0, wagmi.useChainId)();
|
|
2617
|
-
const { data: { feeStrategy } } = useMarketState();
|
|
2618
|
-
const { data: pricingData } =
|
|
1781
|
+
const { data: { feeStrategy, optionPricing } } = useMarketState();
|
|
1782
|
+
const { data: pricingData } = usePricingParams(optionPricing);
|
|
2619
1783
|
const updateMarketPricing = async (data) => {
|
|
2620
1784
|
if (!pricingData) throw new Error("Market pricing data not available");
|
|
2621
1785
|
if (!publicClient) throw new Error("Public client not available");
|
|
@@ -2644,12 +1808,12 @@ const useUpdateMarketPricing = (marketAddr) => {
|
|
|
2644
1808
|
}
|
|
2645
1809
|
const hash = data.model === "static" ? await writeContractAsync({
|
|
2646
1810
|
address: factoryAddr,
|
|
2647
|
-
abi: factoryAbi,
|
|
1811
|
+
abi: require_factory.factoryAbi,
|
|
2648
1812
|
functionName: "deployStaticPerpsPricing",
|
|
2649
1813
|
args: [data.dailyFundingRate, data.minFundingAmount]
|
|
2650
1814
|
}) : await writeContractAsync({
|
|
2651
1815
|
address: factoryAddr,
|
|
2652
|
-
abi: factoryAbi,
|
|
1816
|
+
abi: require_factory.factoryAbi,
|
|
2653
1817
|
functionName: "deployOptionPricing",
|
|
2654
1818
|
args: [
|
|
2655
1819
|
data.logicContract,
|
|
@@ -2662,7 +1826,7 @@ const useUpdateMarketPricing = (marketAddr) => {
|
|
|
2662
1826
|
const deployEvent = (await publicClient.waitForTransactionReceipt({ hash })).logs.find((log) => log.address.toLowerCase() === factoryAddr);
|
|
2663
1827
|
if (!deployEvent) throw new Error("DeployFeeStrategy event not found");
|
|
2664
1828
|
const decodedEvent = (0, viem.decodeEventLog)({
|
|
2665
|
-
abi: factoryAbi,
|
|
1829
|
+
abi: require_factory.factoryAbi,
|
|
2666
1830
|
data: deployEvent.data,
|
|
2667
1831
|
topics: deployEvent.topics
|
|
2668
1832
|
});
|
|
@@ -2672,7 +1836,7 @@ const useUpdateMarketPricing = (marketAddr) => {
|
|
|
2672
1836
|
deployHash: hash,
|
|
2673
1837
|
updateHash: await writeContractAsync({
|
|
2674
1838
|
address: marketAddr,
|
|
2675
|
-
abi:
|
|
1839
|
+
abi: require_statelessStateView.optionsMarketAbi,
|
|
2676
1840
|
functionName: "updateAddresses",
|
|
2677
1841
|
args: [pricingAddr, feeStrategy]
|
|
2678
1842
|
}),
|
|
@@ -2706,7 +1870,6 @@ exports.useLens = useLens;
|
|
|
2706
1870
|
exports.useLiquidityBlocks = useLiquidityBlocks;
|
|
2707
1871
|
exports.useMarketData = useMarketData;
|
|
2708
1872
|
exports.useMarketPriceHistory = useMarketPriceHistory;
|
|
2709
|
-
exports.useMarketPricing = useMarketPricing;
|
|
2710
1873
|
exports.useMarketState = useMarketState;
|
|
2711
1874
|
exports.useMarketVolume = useMarketVolume;
|
|
2712
1875
|
exports.useMaxPositionSize = useMaxPositionSize;
|
|
@@ -2725,6 +1888,7 @@ exports.usePoolData = usePoolData;
|
|
|
2725
1888
|
exports.usePriceAtSqrtPriceX96 = usePriceAtSqrtPriceX96;
|
|
2726
1889
|
exports.usePriceAtTick = usePriceAtTick;
|
|
2727
1890
|
exports.usePriceHistory = usePriceHistory;
|
|
1891
|
+
exports.usePricingParams = usePricingParams;
|
|
2728
1892
|
exports.useSetOperatorPerms = useSetOperatorPerms;
|
|
2729
1893
|
exports.useStaticPricingParams = useStaticPricingParams;
|
|
2730
1894
|
exports.useTimelockConfig = useTimelockConfig;
|