timelock-sdk 0.0.191 → 0.0.193
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 +2 -2
- package/dist/abis.d.cts +364 -79
- package/dist/abis.d.ts +364 -79
- package/dist/abis.js +2 -2
- package/dist/{client-CEtNglT8.d.cts → client-BOnQ_PaH.d.ts} +378 -150
- package/dist/{client-9wbQVrDG.d.ts → client-djFGt-F6.d.cts} +378 -150
- package/dist/client.cjs +26 -13
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +27 -14
- package/dist/client.js.map +1 -1
- package/dist/{factory-DitVXzjQ.cjs → factory-BieDxxUI.cjs} +435 -103
- package/dist/factory-BieDxxUI.cjs.map +1 -0
- package/dist/{factory-y-iVl_er.js → factory-DvHmRBSB.js} +435 -103
- package/dist/factory-DvHmRBSB.js.map +1 -0
- package/dist/{optionUtils-96oUNrzV.js → optionUtils-Bx5iAwn6.js} +9 -28
- package/dist/optionUtils-Bx5iAwn6.js.map +1 -0
- package/dist/{optionUtils-DsqMIDm1.cjs → optionUtils-Cj8yps5O.cjs} +8 -27
- package/dist/optionUtils-Cj8yps5O.cjs.map +1 -0
- package/dist/{optionsMarket-B_dYiAnm.d.ts → optionsMarket-BVrCBIJQ.d.cts} +135 -2
- package/dist/{optionsMarket-B0Om62Sk.d.cts → optionsMarket-MkvkHTLL.d.ts} +135 -2
- package/dist/package.cjs +1 -1
- package/dist/package.d.cts +1 -1
- package/dist/package.d.ts +1 -1
- package/dist/package.js +1 -1
- package/dist/{statelessStateView-Cp4eOQME.js → statelessStateView-DW9FOpWt.js} +159 -2
- package/dist/statelessStateView-DW9FOpWt.js.map +1 -0
- package/dist/{statelessStateView-Dl3QIl1g.cjs → statelessStateView-WNW62g3Q.cjs} +159 -2
- package/dist/statelessStateView-WNW62g3Q.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/factory-DitVXzjQ.cjs.map +0 -1
- package/dist/factory-y-iVl_er.js.map +0 -1
- package/dist/optionUtils-96oUNrzV.js.map +0 -1
- package/dist/optionUtils-DsqMIDm1.cjs.map +0 -1
- package/dist/statelessStateView-Cp4eOQME.js.map +0 -1
- package/dist/statelessStateView-Dl3QIl1g.cjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory-DvHmRBSB.js","names":[],"sources":["../src/abis/singleOwnerVault.ts","../src/abis/guardian.ts","../src/abis/factory.ts"],"sourcesContent":["export const singleOwnerVaultAbi = [\n {\n type: 'constructor',\n inputs: [\n {\n name: 'poolManager_',\n type: 'address',\n internalType: 'contract IPoolManager',\n },\n {\n name: 'token0_',\n type: 'address',\n internalType: 'contract IERC20',\n },\n {\n name: 'token1_',\n type: 'address',\n internalType: 'contract IERC20',\n },\n {name: 'poolFee_', type: 'uint24', internalType: 'uint24'},\n {name: 'tickSpacing_', type: 'int24', internalType: 'int24'},\n {\n name: 'hooks_',\n type: 'address',\n internalType: 'contract IHooks',\n },\n {name: 'owner_', type: 'address', internalType: 'address'},\n ],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n name: 'ADMIN_ROLE',\n inputs: [],\n outputs: [{name: '', type: 'bytes32', internalType: 'bytes32'}],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'BORROW',\n inputs: [],\n outputs: [{name: '', type: 'uint8', internalType: 'uint8'}],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'BORROWER_ROLE',\n inputs: [],\n outputs: [{name: '', type: 'bytes32', internalType: 'bytes32'}],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'BURN',\n inputs: [],\n outputs: [{name: '', type: 'uint8', internalType: 'uint8'}],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'DEFAULT_ADMIN_ROLE',\n inputs: [],\n outputs: [{name: '', type: 'bytes32', internalType: 'bytes32'}],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'MINT',\n inputs: [],\n outputs: [{name: '', type: 'uint8', internalType: 'uint8'}],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'REPAY',\n inputs: [],\n outputs: [{name: '', type: 'uint8', internalType: 'uint8'}],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'RESERVE',\n inputs: [],\n outputs: [{name: '', type: 'uint8', internalType: 'uint8'}],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'blocks',\n inputs: [{name: '', type: 'int24', internalType: 'int24'}],\n outputs: [\n {name: 'tickLower', type: 'int24', internalType: 'int24'},\n {name: 'tickUpper', type: 'int24', internalType: 'int24'},\n {name: 'prevTickLower', type: 'int24', internalType: 'int24'},\n {\n name: 'totalLiquidity',\n type: 'uint128',\n internalType: 'uint128',\n },\n {\n name: 'borrowedLiquidity',\n type: 'uint128',\n internalType: 'uint128',\n },\n {\n name: 'reservedLiquidity',\n type: 'uint128',\n internalType: 'uint128',\n },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'blocksCount',\n inputs: [],\n outputs: [{name: '', type: 'uint256', internalType: 'uint256'}],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'borrow',\n inputs: [\n {name: 'tickLower', type: 'int24', internalType: 'int24'},\n {name: 'tickUpper', type: 'int24', internalType: 'int24'},\n {name: 'liquidity', type: 'uint128', internalType: 'uint128'},\n {name: 'refTick', type: 'int24', internalType: 'int24'},\n ],\n outputs: [\n {name: 'delta0', type: 'int256', internalType: 'int256'},\n {name: 'delta1', type: 'int256', internalType: 'int256'},\n ],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n name: 'burn',\n inputs: [\n {name: 'tickLower', type: 'int24', internalType: 'int24'},\n {name: 'tickUpper', type: 'int24', internalType: 'int24'},\n {name: 'liquidity', type: 'uint128', internalType: 'uint128'},\n {name: 'refTick', type: 'int24', internalType: 'int24'},\n {name: 'amount0Min', type: 'int256', internalType: 'int256'},\n {name: 'amount1Min', type: 'int256', internalType: 'int256'},\n {name: 'deadline', type: 'uint256', internalType: 'uint256'},\n ],\n outputs: [\n {name: 'amount0', type: 'int256', internalType: 'int256'},\n {name: 'amount1', type: 'int256', internalType: 'int256'},\n {name: 'fees0', type: 'uint256', internalType: 'uint256'},\n {name: 'fees1', type: 'uint256', internalType: 'uint256'},\n ],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n name: 'getBlock',\n inputs: [\n {name: 'tickLower', type: 'int24', internalType: 'int24'},\n {name: 'refTick', type: 'int24', internalType: 'int24'},\n ],\n outputs: [\n {\n name: '',\n type: 'tuple',\n internalType: 'struct TimelockVaultCore.LiquidityBlock',\n components: [\n {name: 'tickLower', type: 'int24', internalType: 'int24'},\n {name: 'tickUpper', type: 'int24', internalType: 'int24'},\n {\n name: 'prevTickLower',\n type: 'int24',\n internalType: 'int24',\n },\n {\n name: 'totalLiquidity',\n type: 'uint128',\n internalType: 'uint128',\n },\n {\n name: 'borrowedLiquidity',\n type: 'uint128',\n internalType: 'uint128',\n },\n {\n name: 'reservedLiquidity',\n type: 'uint128',\n internalType: 'uint128',\n },\n ],\n },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'getRoleAdmin',\n inputs: [{name: 'role', type: 'bytes32', internalType: 'bytes32'}],\n outputs: [{name: '', type: 'bytes32', internalType: 'bytes32'}],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'grantRole',\n inputs: [\n {name: 'role', type: 'bytes32', internalType: 'bytes32'},\n {name: 'account', type: 'address', internalType: 'address'},\n ],\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n name: 'hasRole',\n inputs: [\n {name: 'role', type: 'bytes32', internalType: 'bytes32'},\n {name: 'account', type: 'address', internalType: 'address'},\n ],\n outputs: [{name: '', type: 'bool', internalType: 'bool'}],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'highestTick',\n inputs: [],\n outputs: [{name: '', type: 'int24', internalType: 'int24'}],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'hooks',\n inputs: [],\n outputs: [{name: '', type: 'address', internalType: 'contract IHooks'}],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'lowestTick',\n inputs: [],\n outputs: [{name: '', type: 'int24', internalType: 'int24'}],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'mint',\n inputs: [\n {name: 'tickLower', type: 'int24', internalType: 'int24'},\n {name: 'tickUpper', type: 'int24', internalType: 'int24'},\n {name: 'liquidity', type: 'uint128', internalType: 'uint128'},\n {name: 'refTick', type: 'int24', internalType: 'int24'},\n {name: 'amount0Max', type: 'int256', internalType: 'int256'},\n {name: 'amount1Max', type: 'int256', internalType: 'int256'},\n {name: 'deadline', type: 'uint256', internalType: 'uint256'},\n ],\n outputs: [\n {name: 'amount0', type: 'int256', internalType: 'int256'},\n {name: 'amount1', type: 'int256', internalType: 'int256'},\n {name: 'fees0', type: 'uint256', internalType: 'uint256'},\n {name: 'fees1', type: 'uint256', internalType: 'uint256'},\n ],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n name: 'multicall',\n inputs: [{name: 'data', type: 'bytes[]', internalType: 'bytes[]'}],\n outputs: [{name: 'results', type: 'bytes[]', internalType: 'bytes[]'}],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n name: 'poolFee',\n inputs: [],\n outputs: [{name: '', type: 'uint24', internalType: 'uint24'}],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'poolKey',\n inputs: [],\n outputs: [\n {\n name: '',\n type: 'tuple',\n internalType: 'struct PoolKey',\n components: [\n {\n name: 'currency0',\n type: 'address',\n internalType: 'Currency',\n },\n {\n name: 'currency1',\n type: 'address',\n internalType: 'Currency',\n },\n {name: 'fee', type: 'uint24', internalType: 'uint24'},\n {name: 'tickSpacing', type: 'int24', internalType: 'int24'},\n {\n name: 'hooks',\n type: 'address',\n internalType: 'contract IHooks',\n },\n ],\n },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'poolManager',\n inputs: [],\n outputs: [\n {\n name: '',\n type: 'address',\n internalType: 'contract IPoolManager',\n },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'renounceRole',\n inputs: [\n {name: 'role', type: 'bytes32', internalType: 'bytes32'},\n {\n name: 'callerConfirmation',\n type: 'address',\n internalType: 'address',\n },\n ],\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n name: 'repay',\n inputs: [\n {name: 'tickLower', type: 'int24', internalType: 'int24'},\n {name: 'tickUpper', type: 'int24', internalType: 'int24'},\n {name: 'liquidity', type: 'uint128', internalType: 'uint128'},\n {name: 'refTick', type: 'int24', internalType: 'int24'},\n ],\n outputs: [\n {name: 'delta0', type: 'int256', internalType: 'int256'},\n {name: 'delta1', type: 'int256', internalType: 'int256'},\n ],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n name: 'reserve',\n inputs: [\n {name: 'tickLower', type: 'int24', internalType: 'int24'},\n {name: 'tickUpper', type: 'int24', internalType: 'int24'},\n {\n name: 'reservedLiquidity',\n type: 'uint128',\n internalType: 'uint128',\n },\n {name: 'refTick', type: 'int24', internalType: 'int24'},\n ],\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n name: 'revokeRole',\n inputs: [\n {name: 'role', type: 'bytes32', internalType: 'bytes32'},\n {name: 'account', type: 'address', internalType: 'address'},\n ],\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n name: 'settleAndTake',\n inputs: [],\n outputs: [\n {name: 'delta0', type: 'int256', internalType: 'int256'},\n {name: 'delta1', type: 'int256', internalType: 'int256'},\n ],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n name: 'supportsInterface',\n inputs: [{name: 'interfaceId', type: 'bytes4', internalType: 'bytes4'}],\n outputs: [{name: '', type: 'bool', internalType: 'bool'}],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'tickSpacing',\n inputs: [],\n outputs: [{name: '', type: 'int24', internalType: 'int24'}],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'token0',\n inputs: [],\n outputs: [{name: '', type: 'address', internalType: 'contract IERC20'}],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'token1',\n inputs: [],\n outputs: [{name: '', type: 'address', internalType: 'contract IERC20'}],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'unlockCallback',\n inputs: [{name: 'rawData', type: 'bytes', internalType: 'bytes'}],\n outputs: [{name: '', type: 'bytes', internalType: 'bytes'}],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n name: 'whitelistBorrower',\n inputs: [\n {name: 'borrower', type: 'address', internalType: 'address'},\n {name: 'status', type: 'bool', internalType: 'bool'},\n ],\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n name: 'withdrawTokens',\n inputs: [\n {\n name: 'tokens',\n type: 'address[]',\n internalType: 'contract IERC20[]',\n },\n ],\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'event',\n name: 'Borrow',\n inputs: [\n {\n name: 'user',\n type: 'address',\n indexed: false,\n internalType: 'address',\n },\n {\n name: 'tickLower',\n type: 'int24',\n indexed: false,\n internalType: 'int24',\n },\n {\n name: 'tickUpper',\n type: 'int24',\n indexed: false,\n internalType: 'int24',\n },\n {\n name: 'liquidity',\n type: 'uint128',\n indexed: false,\n internalType: 'uint128',\n },\n ],\n anonymous: false,\n },\n {\n type: 'event',\n name: 'BorrowerWhitelisted',\n inputs: [\n {\n name: 'borrower',\n type: 'address',\n indexed: true,\n internalType: 'address',\n },\n {\n name: 'status',\n type: 'bool',\n indexed: false,\n internalType: 'bool',\n },\n ],\n anonymous: false,\n },\n {\n type: 'event',\n name: 'Burn',\n inputs: [\n {\n name: 'user',\n type: 'address',\n indexed: false,\n internalType: 'address',\n },\n {\n name: 'tickLower',\n type: 'int24',\n indexed: false,\n internalType: 'int24',\n },\n {\n name: 'tickUpper',\n type: 'int24',\n indexed: false,\n internalType: 'int24',\n },\n {\n name: 'liquidity',\n type: 'uint128',\n indexed: false,\n internalType: 'uint128',\n },\n ],\n anonymous: false,\n },\n {\n type: 'event',\n name: 'Mint',\n inputs: [\n {\n name: 'user',\n type: 'address',\n indexed: false,\n internalType: 'address',\n },\n {\n name: 'tickLower',\n type: 'int24',\n indexed: false,\n internalType: 'int24',\n },\n {\n name: 'tickUpper',\n type: 'int24',\n indexed: false,\n internalType: 'int24',\n },\n {\n name: 'liquidity',\n type: 'uint128',\n indexed: false,\n internalType: 'uint128',\n },\n ],\n anonymous: false,\n },\n {\n type: 'event',\n name: 'Repay',\n inputs: [\n {\n name: 'user',\n type: 'address',\n indexed: false,\n internalType: 'address',\n },\n {\n name: 'tickLower',\n type: 'int24',\n indexed: false,\n internalType: 'int24',\n },\n {\n name: 'tickUpper',\n type: 'int24',\n indexed: false,\n internalType: 'int24',\n },\n {\n name: 'liquidity',\n type: 'uint128',\n indexed: false,\n internalType: 'uint128',\n },\n ],\n anonymous: false,\n },\n {\n type: 'event',\n name: 'Reserve',\n inputs: [\n {\n name: 'user',\n type: 'address',\n indexed: false,\n internalType: 'address',\n },\n {\n name: 'tickLower',\n type: 'int24',\n indexed: false,\n internalType: 'int24',\n },\n {\n name: 'tickUpper',\n type: 'int24',\n indexed: false,\n internalType: 'int24',\n },\n {\n name: 'liquidity',\n type: 'uint128',\n indexed: false,\n internalType: 'uint128',\n },\n ],\n anonymous: false,\n },\n {\n type: 'event',\n name: 'RoleAdminChanged',\n inputs: [\n {\n name: 'role',\n type: 'bytes32',\n indexed: true,\n internalType: 'bytes32',\n },\n {\n name: 'previousAdminRole',\n type: 'bytes32',\n indexed: true,\n internalType: 'bytes32',\n },\n {\n name: 'newAdminRole',\n type: 'bytes32',\n indexed: true,\n internalType: 'bytes32',\n },\n ],\n anonymous: false,\n },\n {\n type: 'event',\n name: 'RoleGranted',\n inputs: [\n {\n name: 'role',\n type: 'bytes32',\n indexed: true,\n internalType: 'bytes32',\n },\n {\n name: 'account',\n type: 'address',\n indexed: true,\n internalType: 'address',\n },\n {\n name: 'sender',\n type: 'address',\n indexed: true,\n internalType: 'address',\n },\n ],\n anonymous: false,\n },\n {\n type: 'event',\n name: 'RoleRevoked',\n inputs: [\n {\n name: 'role',\n type: 'bytes32',\n indexed: true,\n internalType: 'bytes32',\n },\n {\n name: 'account',\n type: 'address',\n indexed: true,\n internalType: 'address',\n },\n {\n name: 'sender',\n type: 'address',\n indexed: true,\n internalType: 'address',\n },\n ],\n anonymous: false,\n },\n {\n type: 'event',\n name: 'TokenWithdrawn',\n inputs: [\n {\n name: 'token',\n type: 'address',\n indexed: true,\n internalType: 'address',\n },\n {\n name: 'to',\n type: 'address',\n indexed: true,\n internalType: 'address',\n },\n {\n name: 'amount',\n type: 'uint256',\n indexed: false,\n internalType: 'uint256',\n },\n ],\n anonymous: false,\n },\n {type: 'error', name: 'AccessControlBadConfirmation', inputs: []},\n {\n type: 'error',\n name: 'AccessControlUnauthorizedAccount',\n inputs: [\n {name: 'account', type: 'address', internalType: 'address'},\n {name: 'neededRole', type: 'bytes32', internalType: 'bytes32'},\n ],\n },\n {\n type: 'error',\n name: 'AddressEmptyCode',\n inputs: [{name: 'target', type: 'address', internalType: 'address'}],\n },\n {\n type: 'error',\n name: 'BorrowerNotWhitelisted',\n inputs: [{name: 'borrower', type: 'address', internalType: 'address'}],\n },\n {\n type: 'error',\n name: 'DeadlinePassed',\n inputs: [{name: 'deadline', type: 'uint256', internalType: 'uint256'}],\n },\n {type: 'error', name: 'FailedCall', inputs: []},\n {\n type: 'error',\n name: 'InsufficientLiquidity',\n inputs: [\n {name: 'blockTickLower', type: 'int24', internalType: 'int24'},\n {name: 'required', type: 'uint128', internalType: 'uint128'},\n ],\n },\n {\n type: 'error',\n name: 'InvalidActionType',\n inputs: [{name: 'actionType', type: 'uint8', internalType: 'uint8'}],\n },\n {\n type: 'error',\n name: 'InvalidRefTick',\n inputs: [{name: 'tickLower', type: 'int24', internalType: 'int24'}],\n },\n {\n type: 'error',\n name: 'InvalidTickRange',\n inputs: [\n {name: 'tickLower', type: 'int24', internalType: 'int24'},\n {name: 'tickUpper', type: 'int24', internalType: 'int24'},\n ],\n },\n {type: 'error', name: 'InvalidTickSpacing', inputs: []},\n {\n type: 'error',\n name: 'MintTooLarge',\n inputs: [\n {\n name: 'existingLiquidity',\n type: 'uint128',\n internalType: 'uint128',\n },\n {\n name: 'addedLiquidity',\n type: 'uint128',\n internalType: 'uint128',\n },\n ],\n },\n {type: 'error', name: 'ReentrancyGuardReentrantCall', inputs: []},\n {\n type: 'error',\n name: 'SafeERC20FailedOperation',\n inputs: [{name: 'token', type: 'address', internalType: 'address'}],\n },\n {\n type: 'error',\n name: 'SlippageExceeded',\n inputs: [\n {name: 'actual', type: 'int256', internalType: 'int256'},\n {name: 'limit', type: 'int256', internalType: 'int256'},\n ],\n },\n {type: 'error', name: 'UnauthorizedCaller', inputs: []},\n {type: 'error', name: 'ZeroAddress', inputs: []},\n] as const;\n","export const guardianAbi = [\n {type: 'constructor', inputs: [], stateMutability: 'nonpayable'},\n {\n type: 'function',\n name: 'DEFAULT_ADMIN_ROLE',\n inputs: [],\n outputs: [{name: '', type: 'bytes32', internalType: 'bytes32'}],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'MIN_WITHDRAW_INTERVAL',\n inputs: [],\n outputs: [{name: '', type: 'uint256', internalType: 'uint256'}],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'PAUSER_ROLE',\n inputs: [],\n outputs: [{name: '', type: 'bytes32', internalType: 'bytes32'}],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'allowBurn',\n inputs: [{name: 'vault', type: 'address', internalType: 'address'}],\n outputs: [{name: '', type: 'bool', internalType: 'bool'}],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'allowEmergencyMarketWithdraw',\n inputs: [{name: 'market', type: 'address', internalType: 'address'}],\n outputs: [{name: '', type: 'bool', internalType: 'bool'}],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'allowEmergencyVaultWithdraw',\n inputs: [{name: 'vault', type: 'address', internalType: 'address'}],\n outputs: [{name: '', type: 'bool', internalType: 'bool'}],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'allowMint',\n inputs: [{name: 'vault', type: 'address', internalType: 'address'}],\n outputs: [{name: '', type: 'bool', internalType: 'bool'}],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'allowTrade',\n inputs: [\n {name: 'market', type: 'address', internalType: 'address'},\n {name: 'owner', type: 'address', internalType: 'address'},\n {name: 'sender', type: 'address', internalType: 'address'},\n ],\n outputs: [{name: '', type: 'bool', internalType: 'bool'}],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'getRoleAdmin',\n inputs: [{name: 'role', type: 'bytes32', internalType: 'bytes32'}],\n outputs: [{name: '', type: 'bytes32', internalType: 'bytes32'}],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'globalBurnPaused',\n inputs: [],\n outputs: [\n {name: 'paused', type: 'bool', internalType: 'bool'},\n {name: 'updatedAt', type: 'uint64', internalType: 'uint64'},\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'globalMintPaused',\n inputs: [],\n outputs: [\n {name: 'paused', type: 'bool', internalType: 'bool'},\n {name: 'updatedAt', type: 'uint64', internalType: 'uint64'},\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'globalTradingPaused',\n inputs: [],\n outputs: [\n {name: 'paused', type: 'bool', internalType: 'bool'},\n {name: 'updatedAt', type: 'uint64', internalType: 'uint64'},\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'grantRole',\n inputs: [\n {name: 'role', type: 'bytes32', internalType: 'bytes32'},\n {name: 'account', type: 'address', internalType: 'address'},\n ],\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n name: 'hasRole',\n inputs: [\n {name: 'role', type: 'bytes32', internalType: 'bytes32'},\n {name: 'account', type: 'address', internalType: 'address'},\n ],\n outputs: [{name: '', type: 'bool', internalType: 'bool'}],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'marketTradingPaused',\n inputs: [{name: '', type: 'address', internalType: 'address'}],\n outputs: [\n {name: 'paused', type: 'bool', internalType: 'bool'},\n {name: 'updatedAt', type: 'uint64', internalType: 'uint64'},\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'operatorsPaused',\n inputs: [{name: '', type: 'address', internalType: 'address'}],\n outputs: [\n {name: 'paused', type: 'bool', internalType: 'bool'},\n {name: 'updatedAt', type: 'uint64', internalType: 'uint64'},\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'pauseGlobal',\n inputs: [\n {name: 'mintPaused', type: 'bool', internalType: 'bool'},\n {name: 'burnPaused', type: 'bool', internalType: 'bool'},\n {name: 'TradingPaused', type: 'bool', internalType: 'bool'},\n ],\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n name: 'pauseMarket',\n inputs: [\n {name: 'market', type: 'address', internalType: 'address'},\n {name: 'TradingPaused', type: 'bool', internalType: 'bool'},\n ],\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n name: 'pauseOperator',\n inputs: [\n {name: 'operator', type: 'address', internalType: 'address'},\n {name: 'paused', type: 'bool', internalType: 'bool'},\n ],\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n name: 'pauseVault',\n inputs: [\n {name: 'vault', type: 'address', internalType: 'address'},\n {name: 'mintPaused', type: 'bool', internalType: 'bool'},\n {name: 'burnPaused', type: 'bool', internalType: 'bool'},\n ],\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n name: 'renounceRole',\n inputs: [\n {name: 'role', type: 'bytes32', internalType: 'bytes32'},\n {\n name: 'callerConfirmation',\n type: 'address',\n internalType: 'address',\n },\n ],\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n name: 'revokeRole',\n inputs: [\n {name: 'role', type: 'bytes32', internalType: 'bytes32'},\n {name: 'account', type: 'address', internalType: 'address'},\n ],\n outputs: [],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n name: 'supportsInterface',\n inputs: [{name: 'interfaceId', type: 'bytes4', internalType: 'bytes4'}],\n outputs: [{name: '', type: 'bool', internalType: 'bool'}],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'vaultBurnPaused',\n inputs: [{name: '', type: 'address', internalType: 'address'}],\n outputs: [\n {name: 'paused', type: 'bool', internalType: 'bool'},\n {name: 'updatedAt', type: 'uint64', internalType: 'uint64'},\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'vaultMintPaused',\n inputs: [{name: '', type: 'address', internalType: 'address'}],\n outputs: [\n {name: 'paused', type: 'bool', internalType: 'bool'},\n {name: 'updatedAt', type: 'uint64', internalType: 'uint64'},\n ],\n stateMutability: 'view',\n },\n {\n type: 'event',\n name: 'PauseGlobal',\n inputs: [\n {\n name: 'mintPaused',\n type: 'bool',\n indexed: false,\n internalType: 'bool',\n },\n {\n name: 'burnPaused',\n type: 'bool',\n indexed: false,\n internalType: 'bool',\n },\n {\n name: 'TradingPaused',\n type: 'bool',\n indexed: false,\n internalType: 'bool',\n },\n ],\n anonymous: false,\n },\n {\n type: 'event',\n name: 'PauseMarket',\n inputs: [\n {\n name: 'market',\n type: 'address',\n indexed: true,\n internalType: 'address',\n },\n {\n name: 'paused',\n type: 'bool',\n indexed: false,\n internalType: 'bool',\n },\n ],\n anonymous: false,\n },\n {\n type: 'event',\n name: 'PauseOperator',\n inputs: [\n {\n name: 'operator',\n type: 'address',\n indexed: true,\n internalType: 'address',\n },\n {\n name: 'paused',\n type: 'bool',\n indexed: false,\n internalType: 'bool',\n },\n ],\n anonymous: false,\n },\n {\n type: 'event',\n name: 'PauseVault',\n inputs: [\n {\n name: 'vault',\n type: 'address',\n indexed: true,\n internalType: 'address',\n },\n {\n name: 'mintPaused',\n type: 'bool',\n indexed: false,\n internalType: 'bool',\n },\n {\n name: 'burnPaused',\n type: 'bool',\n indexed: false,\n internalType: 'bool',\n },\n ],\n anonymous: false,\n },\n {\n type: 'event',\n name: 'RoleAdminChanged',\n inputs: [\n {\n name: 'role',\n type: 'bytes32',\n indexed: true,\n internalType: 'bytes32',\n },\n {\n name: 'previousAdminRole',\n type: 'bytes32',\n indexed: true,\n internalType: 'bytes32',\n },\n {\n name: 'newAdminRole',\n type: 'bytes32',\n indexed: true,\n internalType: 'bytes32',\n },\n ],\n anonymous: false,\n },\n {\n type: 'event',\n name: 'RoleGranted',\n inputs: [\n {\n name: 'role',\n type: 'bytes32',\n indexed: true,\n internalType: 'bytes32',\n },\n {\n name: 'account',\n type: 'address',\n indexed: true,\n internalType: 'address',\n },\n {\n name: 'sender',\n type: 'address',\n indexed: true,\n internalType: 'address',\n },\n ],\n anonymous: false,\n },\n {\n type: 'event',\n name: 'RoleRevoked',\n inputs: [\n {\n name: 'role',\n type: 'bytes32',\n indexed: true,\n internalType: 'bytes32',\n },\n {\n name: 'account',\n type: 'address',\n indexed: true,\n internalType: 'address',\n },\n {\n name: 'sender',\n type: 'address',\n indexed: true,\n internalType: 'address',\n },\n ],\n anonymous: false,\n },\n {type: 'error', name: 'AccessControlBadConfirmation', inputs: []},\n {\n type: 'error',\n name: 'AccessControlUnauthorizedAccount',\n inputs: [\n {name: 'account', type: 'address', internalType: 'address'},\n {name: 'neededRole', type: 'bytes32', internalType: 'bytes32'},\n ],\n },\n] as const;\n","export const factoryAbi = [\n {\n type: 'function',\n name: 'deployFeeStrategy',\n inputs: [\n {\n name: '_openingFeeRate',\n type: 'uint32',\n internalType: 'uint32',\n },\n {name: '_baseFeeRate', type: 'uint32', internalType: 'uint32'},\n {\n name: '_minOpeningFee',\n type: 'uint128',\n internalType: 'uint128',\n },\n {name: '_minBaseFee', type: 'uint128', internalType: 'uint128'},\n {\n name: '_feeRecipient',\n type: 'address',\n internalType: 'address',\n },\n ],\n outputs: [\n {\n name: '',\n type: 'address',\n internalType: 'contract FeeStrategy',\n },\n ],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n name: 'deployOptionPricing',\n inputs: [\n {\n name: '_logicContract',\n type: 'address',\n internalType: 'contract StatelessOptionPricing',\n },\n {name: '_iv', type: 'uint32', internalType: 'uint32'},\n {name: '_riskFreeRate', type: 'uint32', internalType: 'uint32'},\n {\n name: '_minPremiumDailyRate',\n type: 'uint32',\n internalType: 'uint32',\n },\n {\n name: '_minPremiumAmount',\n type: 'uint256',\n internalType: 'uint256',\n },\n ],\n outputs: [\n {\n name: '',\n type: 'address',\n internalType: 'contract OptionPricing',\n },\n ],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n name: 'deployStaticPerpsPricing',\n inputs: [\n {\n name: '_dailyFundingRate',\n type: 'uint32',\n internalType: 'uint32',\n },\n {\n name: '_minFundingAmount',\n type: 'uint128',\n internalType: 'uint128',\n },\n ],\n outputs: [\n {\n name: '',\n type: 'address',\n internalType: 'contract StaticPerpsPricing',\n },\n ],\n stateMutability: 'nonpayable',\n },\n {\n type: 'function',\n name: 'feeStrategies',\n inputs: [{name: '', type: 'bytes32', internalType: 'bytes32'}],\n outputs: [\n {\n name: '',\n type: 'address',\n internalType: 'contract FeeStrategy',\n },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'optionPricings',\n inputs: [{name: '', type: 'bytes32', internalType: 'bytes32'}],\n outputs: [\n {\n name: '',\n type: 'address',\n internalType: 'contract OptionPricing',\n },\n ],\n stateMutability: 'view',\n },\n {\n type: 'function',\n name: 'staticPerpsPricings',\n inputs: [{name: '', type: 'bytes32', internalType: 'bytes32'}],\n outputs: [\n {\n name: '',\n type: 'address',\n internalType: 'contract StaticPerpsPricing',\n },\n ],\n stateMutability: 'view',\n },\n {\n type: 'event',\n name: 'DeployFeeStrategy',\n inputs: [\n {\n name: 'feeStrategy',\n type: 'address',\n indexed: true,\n internalType: 'contract FeeStrategy',\n },\n {\n name: 'openingFeeRate',\n type: 'uint32',\n indexed: false,\n internalType: 'uint32',\n },\n {\n name: 'baseFeeRate',\n type: 'uint32',\n indexed: false,\n internalType: 'uint32',\n },\n {\n name: 'minOpeningFee',\n type: 'uint128',\n indexed: false,\n internalType: 'uint128',\n },\n {\n name: 'minBaseFee',\n type: 'uint128',\n indexed: false,\n internalType: 'uint128',\n },\n {\n name: 'feeRecipient',\n type: 'address',\n indexed: false,\n internalType: 'address',\n },\n ],\n anonymous: false,\n },\n {\n type: 'event',\n name: 'DeployOptionPricing',\n inputs: [\n {\n name: 'pricing',\n type: 'address',\n indexed: true,\n internalType: 'contract OptionPricing',\n },\n {\n name: 'statelessPricing',\n type: 'address',\n indexed: false,\n internalType: 'contract StatelessOptionPricing',\n },\n {\n name: 'iv',\n type: 'uint32',\n indexed: false,\n internalType: 'uint32',\n },\n {\n name: 'riskFreeRate',\n type: 'uint32',\n indexed: false,\n internalType: 'uint32',\n },\n {\n name: 'minPremiumDailyRate',\n type: 'uint32',\n indexed: false,\n internalType: 'uint32',\n },\n {\n name: 'minPremiumAmount',\n type: 'uint256',\n indexed: false,\n internalType: 'uint256',\n },\n ],\n anonymous: false,\n },\n {\n type: 'event',\n name: 'DeployStaticPerpsPricing',\n inputs: [\n {\n name: 'pricing',\n type: 'address',\n indexed: true,\n internalType: 'contract StaticPerpsPricing',\n },\n {\n name: 'dailyFundingRate',\n type: 'uint32',\n indexed: false,\n internalType: 'uint32',\n },\n {\n name: 'minFundingAmount',\n type: 'uint128',\n indexed: false,\n internalType: 'uint128',\n },\n ],\n anonymous: false,\n },\n] as const;\n"],"mappings":";AAAA,MAAa,sBAAsB;CACjC;EACE,MAAM;EACN,QAAQ;GACN;IACE,MAAM;IACN,MAAM;IACN,cAAc;IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,cAAc;IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,cAAc;IACf;GACD;IAAC,MAAM;IAAY,MAAM;IAAU,cAAc;IAAS;GAC1D;IAAC,MAAM;IAAgB,MAAM;IAAS,cAAc;IA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IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACF;EACD,WAAW;EACZ;CACD;EACE,MAAM;EACN,MAAM;EACN,QAAQ;GACN;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACF;EACD,WAAW;EACZ;CACD;EACE,MAAM;EACN,MAAM;EACN,QAAQ;GACN;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACF;EACD,WAAW;EACZ;CACD;EACE,MAAM;EACN,MAAM;EACN,QAAQ;GACN;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACF;EACD,WAAW;EACZ;CACD;EACE,MAAM;EACN,MAAM;EACN,QAAQ;GACN;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACF;EACD,WAAW;EACZ;CACD;EACE,MAAM;EACN,MAAM;EACN,QAAQ;GACN;IACE,MAAM;IACN,MAAM;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,SAAS;GACT,cAAc;GACf,CACF;EACD,WAAW;EACZ;CACD;EACE,MAAM;EACN,MAAM;EACN,QAAQ;GACN;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACF;EACD,WAAW;EACZ;CACD;EACE,MAAM;EACN,MAAM;EACN,QAAQ;GACN;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACF;EACD,WAAW;EACZ;CACD;EACE,MAAM;EACN,MAAM;EACN,QAAQ;GACN;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACF;EACD,WAAW;EACZ;CACD;EACE,MAAM;EACN,MAAM;EACN,QAAQ;GACN;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACF;EACD,WAAW;EACZ;CACD;EAAC,MAAM;EAAS,MAAM;EAAgC,QAAQ,EAAE;EAAC;CACjE;EACE,MAAM;EACN,MAAM;EACN,QAAQ,CACN;GAAC,MAAM;GAAW,MAAM;GAAW,cAAc;GAAU,EAC3D;GAAC,MAAM;GAAc,MAAM;GAAW,cAAc;GAAU,CAC/D;EACF;CACF;;;;ACpZD,MAAa,aAAa;CACxB;EACE,MAAM;EACN,MAAM;EACN,QAAQ;GACN;IACE,MAAM;IACN,MAAM;IACN,cAAc;IACf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AW,cAAc;GAAU,CAAC;EAC9D,SAAS,CACP;GACE,MAAM;GACN,MAAM;GACN,cAAc;GACf,CACF;EACD,iBAAiB;EAClB;CACD;EACE,MAAM;EACN,MAAM;EACN,QAAQ;GACN;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACF;EACD,WAAW;EACZ;CACD;EACE,MAAM;EACN,MAAM;EACN,QAAQ;GACN;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACF;EACD,WAAW;EACZ;CACD;EACE,MAAM;EACN,MAAM;EACN,QAAQ;GACN;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACD;IACE,MAAM;IACN,MAAM;IACN,SAAS;IACT,cAAc;IACf;GACF;EACD,WAAW;EACZ;CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as erc20Abi$1, n as optionsMarketAbi, r as lensAbi, t as statelessStateViewAbi } from "./statelessStateView-
|
|
1
|
+
import { i as erc20Abi$1, n as optionsMarketAbi, r as lensAbi, t as statelessStateViewAbi } from "./statelessStateView-DW9FOpWt.js";
|
|
2
2
|
import { getContract } from "viem";
|
|
3
|
-
import { baseSepolia
|
|
3
|
+
import { baseSepolia } from "viem/chains";
|
|
4
4
|
import { SqrtPriceMath, TickMath } from "@uniswap/v3-sdk";
|
|
5
5
|
import Big from "big.js";
|
|
6
6
|
import JSBI from "jsbi";
|
|
@@ -42,30 +42,11 @@ const getTimelockLens = async (client, address) => {
|
|
|
42
42
|
client
|
|
43
43
|
});
|
|
44
44
|
};
|
|
45
|
-
const swappers = {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
};
|
|
50
|
-
const timelockLenses = {
|
|
51
|
-
[monadTestnet.id]: "0x22745deD5F51A2F33D98c5682048f5d10baE3b92",
|
|
52
|
-
[unichainSepolia.id]: "0xDA3e5Fc02E885D73271B500403C2DC02E7A394E7",
|
|
53
|
-
[baseSepolia.id]: "0xB5ABc500f54a798E20ae8f91e21DBa29B1CE3F5a"
|
|
54
|
-
};
|
|
55
|
-
const timelockFactories = {
|
|
56
|
-
[unichainSepolia.id]: "0x8790e55d165591C082D3CBb811b36c9C893530DF",
|
|
57
|
-
[baseSepolia.id]: "0x7C9fBd739cb0e09657B7c6aB4eFc37bEe80820B0"
|
|
58
|
-
};
|
|
59
|
-
const swapRouters = {
|
|
60
|
-
[monadTestnet.id]: "0xEd8a7Ca09c6Db6F4b9FAcB8De7e9A5449B1D21a4",
|
|
61
|
-
[unichainSepolia.id]: "0x7C9fBd739cb0e09657B7c6aB4eFc37bEe80820B0",
|
|
62
|
-
[baseSepolia.id]: "0x62408e89d44b70AbB65A01253fB879e28Ca81051"
|
|
63
|
-
};
|
|
64
|
-
const stateViews = {
|
|
65
|
-
[monadTestnet.id]: "0xB85e32Ff9b08Be61cD888e5D997E51951BCA1A69",
|
|
66
|
-
[unichainSepolia.id]: "0x1B69d7338F027deB8Cc78a4085BC7087B251C049",
|
|
67
|
-
[baseSepolia.id]: "0xB368014D394015F90a1F27D522F6a5d56BE9255c"
|
|
68
|
-
};
|
|
45
|
+
const swappers = { [baseSepolia.id]: "0xA16412db5c1Fc7e81574077913f5760d6c368Bd9" };
|
|
46
|
+
const timelockLenses = { [baseSepolia.id]: "0x3B8edE9d261505134A5D8D8C853e158066D13e6d" };
|
|
47
|
+
const timelockFactories = { [baseSepolia.id]: "0xea78d1869f78e301A18ab064b4287563974ab977" };
|
|
48
|
+
const swapRouters = { [baseSepolia.id]: "0x1a005FE3C05F076983F0d66a5F80CB9C61561a5b" };
|
|
49
|
+
const stateViews = { [baseSepolia.id]: "0x5ACfab19418451ba37A0E1717f2C91253d7e7248" };
|
|
69
50
|
|
|
70
51
|
//#endregion
|
|
71
52
|
//#region src/lib/price.ts
|
|
@@ -173,7 +154,7 @@ const getCurrentPrice = async (poolAddr, tokenAddr) => {
|
|
|
173
154
|
|
|
174
155
|
//#endregion
|
|
175
156
|
//#region src/lib/liquidityUtils.ts
|
|
176
|
-
const PRICE_PRECISION = BigInt(
|
|
157
|
+
const PRICE_PRECISION = BigInt(2) ** BigInt(128);
|
|
177
158
|
const getPriceAtSqrtPriceX96 = (sqrtPriceX96) => {
|
|
178
159
|
return sqrtPriceX96 * sqrtPriceX96 * PRICE_PRECISION / BigInt(2 ** 192);
|
|
179
160
|
};
|
|
@@ -395,4 +376,4 @@ const getPayoutAtPrice = (option, liquidities, price, tickSpacing, optionAssetIs
|
|
|
395
376
|
|
|
396
377
|
//#endregion
|
|
397
378
|
export { token1ToToken0AtTick as A, timelockFactories as B, liquiditiesToAmount0 as C, token0ToToken1 as D, roundTick as E, getTimelockLens as F, getTimelockMarket as I, stateViews as L, getPriceHistory as M, getErc20 as N, token0ToToken1AtTick as O, getStateView as P, swapRouters as R, getTickAtPrice as S, liquiditiesToAmounts as T, timelockLenses as V, getAmountsFromLiquidity as _, formatUSD as a, getPriceAtTick as b, scalePrice as c, wrapAmount as d, wrapAmountUnscaled as f, PRICE_PRECISION as g, zero as h, formatCondensed as i, getCurrentPrice as j, token1ToToken0 as k, unscaleAmount as l, wrapPriceUnscaled as m, getPayoutAtTick as n, formatVagueAmount as o, wrapPrice as p, formatAmount as r, scaleAmount as s, getPayoutAtPrice as t, unscalePrice as u, getNearestValidStrikeTick as v, liquiditiesToAmount1 as w, getSqrtPriceX96AtPrice as x, getPriceAtSqrtPriceX96 as y, swappers as z };
|
|
398
|
-
//# sourceMappingURL=optionUtils-
|
|
379
|
+
//# sourceMappingURL=optionUtils-Bx5iAwn6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optionUtils-Bx5iAwn6.js","names":["erc20Abi","swappers: Record<number, Address>","timelockLenses: Record<number, Address>","timelockFactories: Record<number, Address>","swapRouters: Record<number, Address>","stateViews: Record<number, Address>","filled: PriceDataPoint[]","lastKnownPrice: PriceDataPoint | null","zero: Amount"],"sources":["../src/lib/contracts.ts","../src/lib/price.ts","../src/lib/liquidityUtils.ts","../src/lib/numberUtils.ts","../src/lib/optionUtils.ts"],"sourcesContent":["import type {Address, Client, PublicClient, GetContractReturnType} from 'viem';\nimport {getContract} from 'viem';\nimport {baseSepolia} from 'viem/chains';\n\nimport {erc20Abi} from '~/abis/erc20';\nimport {lensAbi} from '~/abis/lens';\nimport {optionsMarketAbi} from '~/abis/optionsMarket';\nimport {statelessStateViewAbi} from '~/abis/statelessStateView';\n\nexport type TimelockMarket = GetContractReturnType<\n typeof optionsMarketAbi,\n Client,\n Address\n>;\nexport type TimelockLens = GetContractReturnType<\n typeof lensAbi,\n Client,\n Address\n>;\n\nexport type TimelockMarketData = Awaited<\n ReturnType<TimelockLens['read']['getMarketData']>\n> & {address: Address};\n\nexport const getErc20 = (address: Address, client: Client) =>\n getContract({abi: erc20Abi, address, client});\n\nexport const getTimelockMarket = (\n address: Address,\n client: Client,\n): TimelockMarket => {\n return getContract({abi: optionsMarketAbi, address, client});\n};\n\nexport const getStateView = async (client: PublicClient, address?: Address) => {\n if (!address) {\n const chainId = await client.getChainId();\n address = stateViews[chainId];\n if (!address) throw new Error(`No state view found for ${chainId}`);\n }\n return getContract({abi: statelessStateViewAbi, address, client});\n};\n\nexport const getTimelockLens = async (\n client: PublicClient,\n address?: Address,\n) => {\n if (!address) {\n const chainId = await client.getChainId();\n address = timelockLenses[chainId];\n if (!address) throw new Error(`No timelock lens found for ${chainId}`);\n }\n return getContract({abi: lensAbi, address, client});\n};\n\nexport const swappers: Record<number, Address> = {\n [baseSepolia.id]: '0xA16412db5c1Fc7e81574077913f5760d6c368Bd9',\n};\nexport const timelockLenses: Record<number, Address> = {\n [baseSepolia.id]: '0x3B8edE9d261505134A5D8D8C853e158066D13e6d',\n};\nexport const timelockFactories: Record<number, Address> = {\n [baseSepolia.id]: '0xea78d1869f78e301A18ab064b4287563974ab977',\n};\nexport const swapRouters: Record<number, Address> = {\n [baseSepolia.id]: '0x1a005FE3C05F076983F0d66a5F80CB9C61561a5b',\n};\nexport const stateViews: Record<number, Address> = {\n [baseSepolia.id]: '0x5ACfab19418451ba37A0E1717f2C91253d7e7248',\n};\n","import type {Address} from 'viem';\n\nexport interface PriceData {\n currentPrice: number;\n percentChange: number;\n poolAddr: string;\n timestamp: number;\n}\n\nexport interface PriceDataPoint {\n timestamp: Date;\n price: number;\n}\n\nexport type PriceResolution = '1m' | '5m' | '15m' | '1h' | '4h' | '1d';\n\nconst getResolutionConfig = (resolution: PriceResolution) => {\n const resolutionMap = {\n '1m': {timeframe: 'minute', aggregate: '1', seconds: 60},\n '5m': {timeframe: 'minute', aggregate: '5', seconds: 300},\n '15m': {timeframe: 'minute', aggregate: '15', seconds: 900},\n '1h': {timeframe: 'hour', aggregate: '1', seconds: 3600},\n '4h': {timeframe: 'hour', aggregate: '4', seconds: 14400},\n '1d': {timeframe: 'day', aggregate: '1', seconds: 86400},\n };\n return resolutionMap[resolution];\n};\n\nconst fillGaps = (\n prices: PriceDataPoint[],\n start: Date,\n end: Date,\n intervalMs: number,\n): PriceDataPoint[] => {\n if (prices.length === 0) return [];\n\n const priceMap = new Map<number, PriceDataPoint>();\n\n for (const point of prices) {\n const alignedTime =\n Math.floor(point.timestamp.getTime() / intervalMs) * intervalMs;\n priceMap.set(alignedTime, point);\n }\n const filled: PriceDataPoint[] = [];\n\n const actualStart =\n Math.floor(prices[0].timestamp.getTime() / intervalMs) * intervalMs;\n\n let currentTime = actualStart;\n let lastKnownPrice: PriceDataPoint | null = null;\n\n while (currentTime <= end.getTime()) {\n const existing = priceMap.get(currentTime);\n\n if (existing) {\n filled.push(existing);\n lastKnownPrice = existing;\n } else if (lastKnownPrice) {\n filled.push({\n timestamp: new Date(currentTime),\n price: lastKnownPrice.price,\n });\n }\n currentTime += intervalMs;\n }\n return filled;\n};\n\nexport const getPriceHistory = async (\n pool: Address,\n token: 0 | 1,\n resolution: PriceResolution,\n start: Date,\n end: Date,\n): Promise<PriceDataPoint[]> => {\n const network = 'monad-testnet';\n const {timeframe, aggregate, seconds} = getResolutionConfig(resolution);\n\n if (end.getTime() > Date.now()) {\n end = new Date(Date.now());\n }\n const startSecs = Math.floor(start.getTime() / 1000);\n const endSecs = Math.floor(end.getTime() / 1000);\n const diffSeconds = endSecs - startSecs;\n\n const limit = Math.min(Math.ceil(diffSeconds / seconds), 1000);\n\n const url =\n `https://api.geckoterminal.com/api/v2/networks/${network}/pools/${pool}/ohlcv/${timeframe}` +\n `?aggregate=${aggregate}` +\n `&limit=${limit}` +\n `&token=${token === 0 ? 'base' : 'quote'}` +\n '¤cy=usd' +\n `&before_timestamp=${endSecs}`;\n\n const res = await fetch(url, {headers: {Accept: 'application/json'}});\n\n if (!res.ok) {\n throw new Error(`Failed to fetch price history: ${res.statusText}`);\n }\n const data = (await res.json()) as {\n data: {\n attributes: {\n ohlcv_list: [number, number, number, number, number, number][];\n };\n };\n };\n const prices: PriceDataPoint[] = data.data.attributes.ohlcv_list\n .map(([timestamp, , , , close]) => ({\n timestamp: new Date(timestamp * 1000),\n price: close,\n }))\n .sort((a, b) => a.timestamp.getTime() - b.timestamp.getTime());\n\n return fillGaps(prices, start, end, seconds * 1000).filter(\n point =>\n point.timestamp.getTime() / 1000 >= startSecs &&\n point.timestamp.getTime() / 1000 <= endSecs,\n );\n};\n\nexport const getCurrentPrice = async (\n poolAddr: Address,\n tokenAddr: Address,\n): Promise<PriceData> => {\n const network = 'monad-testnet';\n const geckoUrl = `https://api.geckoterminal.com/api/v2/networks/${network}/pools/${poolAddr.toLowerCase()}`;\n\n const response = await fetch(geckoUrl, {\n method: 'GET',\n headers: {Accept: 'application/json', 'User-Agent': 'TimelockTrade/1.0'},\n cache: 'no-store', // Keep no-store for real-time data\n });\n if (!response.ok) {\n throw new Error(`Failed to fetch price data for pool ${poolAddr}`);\n }\n const data = (await response.json()) as {\n data: {\n attributes: {\n base_token_price_quote_token: string;\n quote_token_price_base_token: string;\n price_change_percentage: {h24: string};\n };\n relationships: {\n base_token: {data: {id: string; type: string}};\n quote_token: {data: {id: string; type: string}};\n };\n };\n };\n const pool = data.data.attributes;\n const relationships = data.data.relationships;\n\n const baseTokenAddr = relationships.base_token.data.id\n .split('_')[1]\n .toLowerCase();\n const quoteTokenAddr = relationships.quote_token.data.id\n .split('_')[1]\n .toLowerCase();\n\n const isBaseToken = tokenAddr.toLowerCase() === baseTokenAddr.toLowerCase();\n const isQuoteToken = tokenAddr.toLowerCase() === quoteTokenAddr.toLowerCase();\n\n if (!isBaseToken && !isQuoteToken) {\n throw new Error(`Token ${tokenAddr} is not part of pool ${poolAddr}`);\n }\n const price = isBaseToken\n ? pool.base_token_price_quote_token\n : pool.quote_token_price_base_token;\n const priceChange = pool.price_change_percentage?.h24;\n\n return {\n currentPrice: parseFloat(price || '0'),\n percentChange: parseFloat(priceChange || '0'),\n poolAddr: poolAddr,\n timestamp: Date.now(),\n };\n};\n","import {SqrtPriceMath, TickMath} from '@uniswap/v3-sdk';\nimport Big from 'big.js';\nimport JSBI from 'jsbi';\nimport type {Amount} from './numberUtils';\n\nexport const PRICE_PRECISION = BigInt(2) ** BigInt(128);\n\nexport const getPriceAtSqrtPriceX96 = (sqrtPriceX96: bigint) => {\n const priceX192 = sqrtPriceX96 * sqrtPriceX96;\n const price = (priceX192 * PRICE_PRECISION) / BigInt(2 ** 192);\n\n return price;\n};\n\nexport const getSqrtPriceX96AtPrice = (price: bigint) => {\n const sqrtPriceX96 = JSBI.BigInt(\n new Big(price.toString())\n .mul(2 ** 192)\n .div(PRICE_PRECISION.toString())\n .sqrt()\n .toFixed(0),\n );\n return sqrtPriceX96;\n};\n\nexport const getPriceAtTick = (tick: number) => {\n const sqrtRatioX96 = BigInt(TickMath.getSqrtRatioAtTick(tick).toString());\n\n const priceX192 = sqrtRatioX96 * sqrtRatioX96;\n const price = (priceX192 * PRICE_PRECISION) / BigInt(2 ** 192);\n\n return price;\n};\n\nexport const getTickAtPrice = (price: bigint) => {\n const priceX192 = (price * BigInt(2 ** 192)) / PRICE_PRECISION;\n const sqrtPriceX96 = JSBI.BigInt(\n new Big(priceX192.toString()).sqrt().toFixed(0),\n );\n return TickMath.getTickAtSqrtRatio(sqrtPriceX96);\n};\n\nexport const getNearestValidStrikeTick = (\n optionType: 'CALL' | 'PUT',\n optionAssetIsToken0: boolean,\n tickSpacing: number,\n currentTick: number,\n strikeTick?: number,\n) => {\n strikeTick = roundTick(strikeTick ?? currentTick, tickSpacing);\n\n if (\n (optionType === 'CALL' && optionAssetIsToken0) ||\n (optionType === 'PUT' && !optionAssetIsToken0)\n ) {\n strikeTick += tickSpacing;\n }\n return strikeTick;\n};\n\nexport const roundTick = (tick: number, spacing: number) => {\n const rem = tick % spacing;\n if (rem >= 0) return tick - rem;\n return tick - rem - spacing;\n};\n\nexport const token0ToToken1 = (amount0: bigint, price: bigint | Amount) => {\n price = typeof price === 'bigint' ? price : price.scaled;\n return (amount0 * price) / PRICE_PRECISION;\n};\nexport const token1ToToken0 = (amount1: bigint, price: bigint | Amount) => {\n price = typeof price === 'bigint' ? price : price.scaled;\n return (amount1 * PRICE_PRECISION) / price;\n};\n\nexport const token0ToToken1AtTick = (amount0: bigint, tick: number) => {\n const price = getPriceAtTick(tick);\n return (amount0 * price) / PRICE_PRECISION;\n};\nexport const token1ToToken0AtTick = (amount1: bigint, tick: number) => {\n const price = getPriceAtTick(tick);\n return (amount1 * PRICE_PRECISION) / price;\n};\n\nexport const getAmountsFromLiquidity = (\n tickLower: number,\n tickUpper: number,\n liquidity: bigint,\n currentTick: number,\n): [bigint, bigint] => {\n const sqrtRatioX96 = TickMath.getSqrtRatioAtTick(currentTick);\n const sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(tickLower);\n const sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(tickUpper);\n const liquidityJSBI = JSBI.BigInt(liquidity.toString());\n\n let delta0 = JSBI.BigInt(0);\n let delta1 = JSBI.BigInt(0);\n\n if (currentTick < tickLower) {\n delta0 = SqrtPriceMath.getAmount0Delta(\n sqrtRatioAX96,\n sqrtRatioBX96,\n liquidityJSBI,\n false,\n );\n } else if (currentTick >= tickUpper) {\n delta1 = SqrtPriceMath.getAmount1Delta(\n sqrtRatioAX96,\n sqrtRatioBX96,\n liquidityJSBI,\n false,\n );\n } else {\n delta0 = SqrtPriceMath.getAmount0Delta(\n sqrtRatioX96,\n sqrtRatioBX96,\n liquidityJSBI,\n false,\n );\n delta1 = SqrtPriceMath.getAmount1Delta(\n sqrtRatioAX96,\n sqrtRatioX96,\n liquidityJSBI,\n false,\n );\n }\n return [BigInt(delta0.toString()), BigInt(delta1.toString())];\n};\n\nexport const liquiditiesToAmount0 = (\n liquidities: bigint[],\n startTick: number,\n tickSpacing: number,\n) => {\n let amount0 = BigInt(0);\n\n for (let i = 0; i < liquidities.length; i++) {\n const liquidity = liquidities[i];\n if (liquidity === BigInt(0)) continue;\n\n const tickLower = startTick + tickSpacing * i;\n const tickUpper = tickLower + tickSpacing;\n\n const sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(tickLower);\n const sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(tickUpper);\n const liquidityJSBI = JSBI.BigInt(liquidity.toString());\n\n const amount0Delta = SqrtPriceMath.getAmount0Delta(\n sqrtRatioAX96,\n sqrtRatioBX96,\n liquidityJSBI,\n false,\n );\n amount0 += BigInt(amount0Delta.toString());\n }\n return amount0;\n};\n\nexport const liquiditiesToAmount1 = (\n liquidities: bigint[],\n startTick: number,\n tickSpacing: number,\n) => {\n let amount1 = BigInt(0);\n\n for (let i = 0; i < liquidities.length; i++) {\n const liquidity = liquidities[i];\n if (liquidity === BigInt(0)) continue;\n\n const tickLower = startTick + tickSpacing * i;\n const tickUpper = tickLower + tickSpacing;\n\n const sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(tickLower);\n const sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(tickUpper);\n const liquidityJSBI = JSBI.BigInt(liquidity.toString());\n\n const amount1Delta = SqrtPriceMath.getAmount1Delta(\n sqrtRatioAX96,\n sqrtRatioBX96,\n liquidityJSBI,\n false,\n );\n amount1 += BigInt(amount1Delta.toString());\n }\n return amount1;\n};\n\nexport const liquiditiesToAmounts = (\n liquidities: bigint[],\n startTick: number,\n price: bigint,\n tickSpacing: number,\n) => {\n let amount0 = 0n;\n let amount1 = 0n;\n\n const sqrtRatioX96 = getSqrtPriceX96AtPrice(price);\n\n for (let i = 0; i < liquidities.length; i++) {\n const liquidity = liquidities[i];\n if (liquidity === BigInt(0)) continue;\n\n const tickLower = startTick + tickSpacing * i;\n const tickUpper = tickLower + tickSpacing;\n\n const sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(tickLower);\n const sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(tickUpper);\n const liquidityJSBI = JSBI.BigInt(liquidity.toString());\n\n if (JSBI.lessThanOrEqual(sqrtRatioX96, sqrtRatioAX96)) {\n const delta0 = SqrtPriceMath.getAmount0Delta(\n sqrtRatioAX96,\n sqrtRatioBX96,\n liquidityJSBI,\n false,\n );\n amount0 += BigInt(delta0.toString());\n } else if (JSBI.lessThan(sqrtRatioX96, sqrtRatioBX96)) {\n const delta0 = SqrtPriceMath.getAmount0Delta(\n sqrtRatioX96,\n sqrtRatioBX96,\n liquidityJSBI,\n false,\n );\n const delta1 = SqrtPriceMath.getAmount1Delta(\n sqrtRatioAX96,\n sqrtRatioX96,\n liquidityJSBI,\n false,\n );\n amount0 += BigInt(delta0.toString());\n amount1 += BigInt(delta1.toString());\n } else {\n const delta1 = SqrtPriceMath.getAmount1Delta(\n sqrtRatioAX96,\n sqrtRatioBX96,\n liquidityJSBI,\n false,\n );\n amount1 += BigInt(delta1.toString());\n }\n }\n return [amount0, amount1];\n};\n","import Big from 'big.js';\n\nexport type Amount = {\n scaled: bigint;\n unscaled: Big;\n decimals: number;\n formatted: string;\n};\n\nexport const zero: Amount = {\n scaled: 0n,\n unscaled: Big(0),\n decimals: 18,\n formatted: '0',\n};\n\nexport const wrapAmount = (scaled: bigint, decimals: number): Amount => {\n const unscaled = unscaleAmount(scaled, decimals);\n const formatted = formatAmount(unscaled);\n return {scaled, unscaled, decimals, formatted};\n};\n\nexport const wrapAmountUnscaled = (\n unscaled: Big | number | string,\n decimals: number,\n): Amount => {\n unscaled = Big(unscaled);\n const scaled = scaleAmount(unscaled, decimals);\n const formatted = formatAmount(unscaled);\n return {scaled, unscaled, decimals, formatted};\n};\n\nexport const wrapPrice = (\n scaled: bigint,\n decimals0: number,\n decimals1: number,\n): Amount => {\n const unscaled = unscalePrice(scaled, decimals0, decimals1);\n const formatted = formatAmount(unscaled);\n return {scaled, unscaled, decimals: 36 + decimals1 - decimals0, formatted};\n};\n\nexport const wrapPriceUnscaled = (\n unscaled: Big | number | string,\n decimals0: number,\n decimals1: number,\n): Amount => {\n unscaled = Big(unscaled);\n const scaled = scalePrice(unscaled, decimals0, decimals1);\n const formatted = formatAmount(unscaled);\n return {scaled, unscaled, decimals: 36 + decimals1 - decimals0, formatted};\n};\n\nexport const unscaleAmount = (scaled: bigint, decimals: number) => {\n return new Big(scaled.toString()).div(new Big(10).pow(decimals));\n};\n\nexport const scaleAmount = (\n unscaled: Big | number | string,\n decimals: number,\n) => {\n return BigInt(\n Big(unscaled).mul(new Big(10).pow(decimals)).round().toFixed(0),\n );\n};\n\nexport const unscalePrice = (\n scaled: bigint,\n decimals0: number,\n decimals1: number,\n precision = 18,\n) => {\n return new Big(scaled.toString())\n .mul(new Big(10).pow(decimals0))\n .div(new Big(10).pow(decimals1))\n .div(new Big(10).pow(precision));\n};\n\nexport const scalePrice = (\n unscaled: Big | number | string,\n decimals0: number,\n decimals1: number,\n precision = 18,\n) => {\n return BigInt(\n Big(unscaled)\n .mul(new Big(10).pow(precision))\n .mul(new Big(10).pow(decimals1))\n .div(new Big(10).pow(decimals0))\n .round()\n .toFixed(0),\n );\n};\n\nexport const formatAmount = (value?: Big | number | string) => {\n if (!value) return '-';\n value = new Big(value);\n\n if (value.gte(1e8)) return formatVagueAmount(value, 2);\n return formatCondensed(Big(value).toFixed(100));\n};\n\nexport const formatVagueAmount = (\n value: Big | number | bigint | string,\n fractionDigits = 2,\n) => {\n value = Number(value);\n if (value === 0) return '0';\n\n const formatted = value.toExponential(fractionDigits);\n return formatted.replace(/\\.?0+e/, 'e').replace(/e\\+/, 'e');\n};\n\nexport const formatCondensed = (\n input: string | number,\n decimals = 2,\n): string => {\n const str = (typeof input === 'number' ? input.toFixed(20) : input)\n .replace(/(\\.\\d*?)0+$/, '$1')\n .replace(/\\.$/, '');\n\n const [whole, decimal] = str.split('.');\n\n const formattedWhole = whole.replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',');\n if (!decimal) return formattedWhole;\n\n const leadingZeroMatch = decimal.match(/^(0{3,})/);\n\n if (leadingZeroMatch) {\n const zeroCount = leadingZeroMatch[1].length;\n const subscript = toSubscript(zeroCount.toString());\n const remaining = decimal.slice(zeroCount);\n\n const twoDigits = remaining.slice(0, decimals);\n return `${formattedWhole}.0${subscript}${twoDigits}`;\n } else {\n // No subscript needed, find first 2 significant digits\n const nonZeroStart = decimal.search(/[1-9]/); // Find first non-zero digit\n\n if (nonZeroStart === -1) {\n return formattedWhole; // All zeros\n }\n const significantPart = decimal.slice(nonZeroStart);\n const twoDigits = significantPart.slice(0, decimals);\n const leadingZeros = decimal.slice(0, nonZeroStart);\n\n return `${formattedWhole}.${leadingZeros}${twoDigits}`;\n }\n};\n\nconst toSubscript = (input: string) => {\n return input.replace(/[0-9]/g, m => '₀₁₂₃₄₅₆₇₈₉'[+m]);\n};\n\nexport const formatUSD = (value: Big | string | number): string => {\n return '$' + formatAmount(value);\n};\n","import type {OptionData} from '~/package/client';\nimport {\n getPriceAtTick,\n liquiditiesToAmounts,\n token0ToToken1,\n token1ToToken0,\n} from './liquidityUtils';\n\nexport const getPayoutAtTick = (\n option: OptionData,\n liquidities: bigint[],\n tick: number,\n tickSpacing: number,\n optionAssetIsToken0: boolean,\n) => {\n return getPayoutAtPrice(\n option,\n liquidities,\n getPriceAtTick(tick),\n tickSpacing,\n optionAssetIsToken0,\n );\n};\n\nexport const getPayoutAtPrice = (\n option: OptionData,\n liquidities: bigint[],\n price: bigint,\n tickSpacing: number,\n optionAssetIsToken0: boolean,\n) => {\n const [borrowedAmount0, borrowedAmount1] = liquiditiesToAmounts(\n liquidities,\n option.startTick,\n option.entryPrice,\n tickSpacing,\n );\n const [repayAmount0, repayAmount1] = liquiditiesToAmounts(\n liquidities,\n option.startTick,\n price,\n tickSpacing,\n );\n const totalAmount = optionAssetIsToken0\n ? borrowedAmount1 + token0ToToken1(borrowedAmount0, price)\n : borrowedAmount0 + token1ToToken0(borrowedAmount1, price);\n\n const repayAmount = optionAssetIsToken0\n ? repayAmount1 + token0ToToken1(repayAmount0, price)\n : repayAmount0 + token1ToToken0(repayAmount1, price);\n\n const delta = totalAmount - repayAmount;\n const payout = delta < 0n ? 0n : delta;\n\n return payout;\n};\n"],"mappings":";;;;;;;;AAwBA,MAAa,YAAY,SAAkB,WACzC,YAAY;CAAC,KAAKA;CAAU;CAAS;CAAO,CAAC;AAE/C,MAAa,qBACX,SACA,WACmB;AACnB,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AM,aAAa,CACjB,MAAM,GAAG,SAAS;AAGpD,SAAO,GAAG,eAAe,GAFJ,QAAQ,MAAM,GAAG,aAAa,GAER;;;AAI/C,MAAM,eAAe,UAAkB;AACrC,QAAO,MAAM,QAAQ,WAAU,MAAK,aAAa,CAAC,GAAG;;AAGvD,MAAa,aAAa,UAAyC;AACjE,QAAO,MAAM,aAAa,MAAM;;;;;ACnJlC,MAAa,mBACX,QACA,aACA,MACA,aACA,wBACG;AACH,QAAO,iBACL,QACA,aACA,eAAe,KAAK,EACpB,aACA,oBACD;;AAGH,MAAa,oBACX,QACA,aACA,OACA,aACA,wBACG;CACH,MAAM,CAAC,iBAAiB,mBAAmB,qBACzC,aACA,OAAO,WACP,OAAO,YACP,YACD;CACD,MAAM,CAAC,cAAc,gBAAgB,qBACnC,aACA,OAAO,WACP,OACA,YACD;CASD,MAAM,SARc,sBAChB,kBAAkB,eAAe,iBAAiB,MAAM,GACxD,kBAAkB,eAAe,iBAAiB,MAAM,KAExC,sBAChB,eAAe,eAAe,cAAc,MAAM,GAClD,eAAe,eAAe,cAAc,MAAM;AAKtD,QAFe,QAAQ,KAAK,KAAK"}
|
|
@@ -25,7 +25,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
25
|
}) : target, mod));
|
|
26
26
|
|
|
27
27
|
//#endregion
|
|
28
|
-
const require_statelessStateView = require('./statelessStateView-
|
|
28
|
+
const require_statelessStateView = require('./statelessStateView-WNW62g3Q.cjs');
|
|
29
29
|
let viem = require("viem");
|
|
30
30
|
let viem_chains = require("viem/chains");
|
|
31
31
|
let __uniswap_v3_sdk = require("@uniswap/v3-sdk");
|
|
@@ -71,30 +71,11 @@ const getTimelockLens = async (client, address) => {
|
|
|
71
71
|
client
|
|
72
72
|
});
|
|
73
73
|
};
|
|
74
|
-
const swappers = {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
};
|
|
79
|
-
const timelockLenses = {
|
|
80
|
-
[viem_chains.monadTestnet.id]: "0x22745deD5F51A2F33D98c5682048f5d10baE3b92",
|
|
81
|
-
[viem_chains.unichainSepolia.id]: "0xDA3e5Fc02E885D73271B500403C2DC02E7A394E7",
|
|
82
|
-
[viem_chains.baseSepolia.id]: "0xB5ABc500f54a798E20ae8f91e21DBa29B1CE3F5a"
|
|
83
|
-
};
|
|
84
|
-
const timelockFactories = {
|
|
85
|
-
[viem_chains.unichainSepolia.id]: "0x8790e55d165591C082D3CBb811b36c9C893530DF",
|
|
86
|
-
[viem_chains.baseSepolia.id]: "0x7C9fBd739cb0e09657B7c6aB4eFc37bEe80820B0"
|
|
87
|
-
};
|
|
88
|
-
const swapRouters = {
|
|
89
|
-
[viem_chains.monadTestnet.id]: "0xEd8a7Ca09c6Db6F4b9FAcB8De7e9A5449B1D21a4",
|
|
90
|
-
[viem_chains.unichainSepolia.id]: "0x7C9fBd739cb0e09657B7c6aB4eFc37bEe80820B0",
|
|
91
|
-
[viem_chains.baseSepolia.id]: "0x62408e89d44b70AbB65A01253fB879e28Ca81051"
|
|
92
|
-
};
|
|
93
|
-
const stateViews = {
|
|
94
|
-
[viem_chains.monadTestnet.id]: "0xB85e32Ff9b08Be61cD888e5D997E51951BCA1A69",
|
|
95
|
-
[viem_chains.unichainSepolia.id]: "0x1B69d7338F027deB8Cc78a4085BC7087B251C049",
|
|
96
|
-
[viem_chains.baseSepolia.id]: "0xB368014D394015F90a1F27D522F6a5d56BE9255c"
|
|
97
|
-
};
|
|
74
|
+
const swappers = { [viem_chains.baseSepolia.id]: "0xA16412db5c1Fc7e81574077913f5760d6c368Bd9" };
|
|
75
|
+
const timelockLenses = { [viem_chains.baseSepolia.id]: "0x3B8edE9d261505134A5D8D8C853e158066D13e6d" };
|
|
76
|
+
const timelockFactories = { [viem_chains.baseSepolia.id]: "0xea78d1869f78e301A18ab064b4287563974ab977" };
|
|
77
|
+
const swapRouters = { [viem_chains.baseSepolia.id]: "0x1a005FE3C05F076983F0d66a5F80CB9C61561a5b" };
|
|
78
|
+
const stateViews = { [viem_chains.baseSepolia.id]: "0x5ACfab19418451ba37A0E1717f2C91253d7e7248" };
|
|
98
79
|
|
|
99
80
|
//#endregion
|
|
100
81
|
//#region src/lib/price.ts
|
|
@@ -202,7 +183,7 @@ const getCurrentPrice = async (poolAddr, tokenAddr) => {
|
|
|
202
183
|
|
|
203
184
|
//#endregion
|
|
204
185
|
//#region src/lib/liquidityUtils.ts
|
|
205
|
-
const PRICE_PRECISION = BigInt(
|
|
186
|
+
const PRICE_PRECISION = BigInt(2) ** BigInt(128);
|
|
206
187
|
const getPriceAtSqrtPriceX96 = (sqrtPriceX96) => {
|
|
207
188
|
return sqrtPriceX96 * sqrtPriceX96 * PRICE_PRECISION / BigInt(2 ** 192);
|
|
208
189
|
};
|
|
@@ -675,4 +656,4 @@ Object.defineProperty(exports, 'zero', {
|
|
|
675
656
|
return zero;
|
|
676
657
|
}
|
|
677
658
|
});
|
|
678
|
-
//# sourceMappingURL=optionUtils-
|
|
659
|
+
//# sourceMappingURL=optionUtils-Cj8yps5O.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optionUtils-Cj8yps5O.cjs","names":["erc20Abi","optionsMarketAbi","statelessStateViewAbi","lensAbi","swappers: Record<number, Address>","baseSepolia","timelockLenses: Record<number, Address>","timelockFactories: Record<number, Address>","swapRouters: Record<number, Address>","stateViews: Record<number, Address>","filled: PriceDataPoint[]","lastKnownPrice: PriceDataPoint | null","JSBI","Big","TickMath","SqrtPriceMath","zero: Amount","Big"],"sources":["../src/lib/contracts.ts","../src/lib/price.ts","../src/lib/liquidityUtils.ts","../src/lib/numberUtils.ts","../src/lib/optionUtils.ts"],"sourcesContent":["import type {Address, Client, PublicClient, GetContractReturnType} from 'viem';\nimport {getContract} from 'viem';\nimport {baseSepolia} from 'viem/chains';\n\nimport {erc20Abi} from '~/abis/erc20';\nimport {lensAbi} from '~/abis/lens';\nimport {optionsMarketAbi} from '~/abis/optionsMarket';\nimport {statelessStateViewAbi} from '~/abis/statelessStateView';\n\nexport type TimelockMarket = GetContractReturnType<\n typeof optionsMarketAbi,\n Client,\n Address\n>;\nexport type TimelockLens = GetContractReturnType<\n typeof lensAbi,\n Client,\n Address\n>;\n\nexport type TimelockMarketData = Awaited<\n ReturnType<TimelockLens['read']['getMarketData']>\n> & {address: Address};\n\nexport const getErc20 = (address: Address, client: Client) =>\n getContract({abi: erc20Abi, address, client});\n\nexport const getTimelockMarket = (\n address: Address,\n client: Client,\n): TimelockMarket => {\n return getContract({abi: optionsMarketAbi, address, client});\n};\n\nexport const getStateView = async (client: PublicClient, address?: Address) => {\n if (!address) {\n const chainId = await client.getChainId();\n address = stateViews[chainId];\n if (!address) throw new Error(`No state view found for ${chainId}`);\n }\n return getContract({abi: statelessStateViewAbi, address, client});\n};\n\nexport const getTimelockLens = async (\n client: PublicClient,\n address?: Address,\n) => {\n if (!address) {\n const chainId = await client.getChainId();\n address = timelockLenses[chainId];\n if (!address) throw new Error(`No timelock lens found for ${chainId}`);\n }\n return getContract({abi: lensAbi, address, client});\n};\n\nexport const swappers: Record<number, Address> = {\n [baseSepolia.id]: '0xA16412db5c1Fc7e81574077913f5760d6c368Bd9',\n};\nexport const timelockLenses: Record<number, Address> = {\n [baseSepolia.id]: '0x3B8edE9d261505134A5D8D8C853e158066D13e6d',\n};\nexport const timelockFactories: Record<number, Address> = {\n [baseSepolia.id]: '0xea78d1869f78e301A18ab064b4287563974ab977',\n};\nexport const swapRouters: Record<number, Address> = {\n [baseSepolia.id]: '0x1a005FE3C05F076983F0d66a5F80CB9C61561a5b',\n};\nexport const stateViews: Record<number, Address> = {\n [baseSepolia.id]: '0x5ACfab19418451ba37A0E1717f2C91253d7e7248',\n};\n","import type {Address} from 'viem';\n\nexport interface PriceData {\n currentPrice: number;\n percentChange: number;\n poolAddr: string;\n timestamp: number;\n}\n\nexport interface PriceDataPoint {\n timestamp: Date;\n price: number;\n}\n\nexport type PriceResolution = '1m' | '5m' | '15m' | '1h' | '4h' | '1d';\n\nconst getResolutionConfig = (resolution: PriceResolution) => {\n const resolutionMap = {\n '1m': {timeframe: 'minute', aggregate: '1', seconds: 60},\n '5m': {timeframe: 'minute', aggregate: '5', seconds: 300},\n '15m': {timeframe: 'minute', aggregate: '15', seconds: 900},\n '1h': {timeframe: 'hour', aggregate: '1', seconds: 3600},\n '4h': {timeframe: 'hour', aggregate: '4', seconds: 14400},\n '1d': {timeframe: 'day', aggregate: '1', seconds: 86400},\n };\n return resolutionMap[resolution];\n};\n\nconst fillGaps = (\n prices: PriceDataPoint[],\n start: Date,\n end: Date,\n intervalMs: number,\n): PriceDataPoint[] => {\n if (prices.length === 0) return [];\n\n const priceMap = new Map<number, PriceDataPoint>();\n\n for (const point of prices) {\n const alignedTime =\n Math.floor(point.timestamp.getTime() / intervalMs) * intervalMs;\n priceMap.set(alignedTime, point);\n }\n const filled: PriceDataPoint[] = [];\n\n const actualStart =\n Math.floor(prices[0].timestamp.getTime() / intervalMs) * intervalMs;\n\n let currentTime = actualStart;\n let lastKnownPrice: PriceDataPoint | null = null;\n\n while (currentTime <= end.getTime()) {\n const existing = priceMap.get(currentTime);\n\n if (existing) {\n filled.push(existing);\n lastKnownPrice = existing;\n } else if (lastKnownPrice) {\n filled.push({\n timestamp: new Date(currentTime),\n price: lastKnownPrice.price,\n });\n }\n currentTime += intervalMs;\n }\n return filled;\n};\n\nexport const getPriceHistory = async (\n pool: Address,\n token: 0 | 1,\n resolution: PriceResolution,\n start: Date,\n end: Date,\n): Promise<PriceDataPoint[]> => {\n const network = 'monad-testnet';\n const {timeframe, aggregate, seconds} = getResolutionConfig(resolution);\n\n if (end.getTime() > Date.now()) {\n end = new Date(Date.now());\n }\n const startSecs = Math.floor(start.getTime() / 1000);\n const endSecs = Math.floor(end.getTime() / 1000);\n const diffSeconds = endSecs - startSecs;\n\n const limit = Math.min(Math.ceil(diffSeconds / seconds), 1000);\n\n const url =\n `https://api.geckoterminal.com/api/v2/networks/${network}/pools/${pool}/ohlcv/${timeframe}` +\n `?aggregate=${aggregate}` +\n `&limit=${limit}` +\n `&token=${token === 0 ? 'base' : 'quote'}` +\n '¤cy=usd' +\n `&before_timestamp=${endSecs}`;\n\n const res = await fetch(url, {headers: {Accept: 'application/json'}});\n\n if (!res.ok) {\n throw new Error(`Failed to fetch price history: ${res.statusText}`);\n }\n const data = (await res.json()) as {\n data: {\n attributes: {\n ohlcv_list: [number, number, number, number, number, number][];\n };\n };\n };\n const prices: PriceDataPoint[] = data.data.attributes.ohlcv_list\n .map(([timestamp, , , , close]) => ({\n timestamp: new Date(timestamp * 1000),\n price: close,\n }))\n .sort((a, b) => a.timestamp.getTime() - b.timestamp.getTime());\n\n return fillGaps(prices, start, end, seconds * 1000).filter(\n point =>\n point.timestamp.getTime() / 1000 >= startSecs &&\n point.timestamp.getTime() / 1000 <= endSecs,\n );\n};\n\nexport const getCurrentPrice = async (\n poolAddr: Address,\n tokenAddr: Address,\n): Promise<PriceData> => {\n const network = 'monad-testnet';\n const geckoUrl = `https://api.geckoterminal.com/api/v2/networks/${network}/pools/${poolAddr.toLowerCase()}`;\n\n const response = await fetch(geckoUrl, {\n method: 'GET',\n headers: {Accept: 'application/json', 'User-Agent': 'TimelockTrade/1.0'},\n cache: 'no-store', // Keep no-store for real-time data\n });\n if (!response.ok) {\n throw new Error(`Failed to fetch price data for pool ${poolAddr}`);\n }\n const data = (await response.json()) as {\n data: {\n attributes: {\n base_token_price_quote_token: string;\n quote_token_price_base_token: string;\n price_change_percentage: {h24: string};\n };\n relationships: {\n base_token: {data: {id: string; type: string}};\n quote_token: {data: {id: string; type: string}};\n };\n };\n };\n const pool = data.data.attributes;\n const relationships = data.data.relationships;\n\n const baseTokenAddr = relationships.base_token.data.id\n .split('_')[1]\n .toLowerCase();\n const quoteTokenAddr = relationships.quote_token.data.id\n .split('_')[1]\n .toLowerCase();\n\n const isBaseToken = tokenAddr.toLowerCase() === baseTokenAddr.toLowerCase();\n const isQuoteToken = tokenAddr.toLowerCase() === quoteTokenAddr.toLowerCase();\n\n if (!isBaseToken && !isQuoteToken) {\n throw new Error(`Token ${tokenAddr} is not part of pool ${poolAddr}`);\n }\n const price = isBaseToken\n ? pool.base_token_price_quote_token\n : pool.quote_token_price_base_token;\n const priceChange = pool.price_change_percentage?.h24;\n\n return {\n currentPrice: parseFloat(price || '0'),\n percentChange: parseFloat(priceChange || '0'),\n poolAddr: poolAddr,\n timestamp: Date.now(),\n };\n};\n","import {SqrtPriceMath, TickMath} from '@uniswap/v3-sdk';\nimport Big from 'big.js';\nimport JSBI from 'jsbi';\nimport type {Amount} from './numberUtils';\n\nexport const PRICE_PRECISION = BigInt(2) ** BigInt(128);\n\nexport const getPriceAtSqrtPriceX96 = (sqrtPriceX96: bigint) => {\n const priceX192 = sqrtPriceX96 * sqrtPriceX96;\n const price = (priceX192 * PRICE_PRECISION) / BigInt(2 ** 192);\n\n return price;\n};\n\nexport const getSqrtPriceX96AtPrice = (price: bigint) => {\n const sqrtPriceX96 = JSBI.BigInt(\n new Big(price.toString())\n .mul(2 ** 192)\n .div(PRICE_PRECISION.toString())\n .sqrt()\n .toFixed(0),\n );\n return sqrtPriceX96;\n};\n\nexport const getPriceAtTick = (tick: number) => {\n const sqrtRatioX96 = BigInt(TickMath.getSqrtRatioAtTick(tick).toString());\n\n const priceX192 = sqrtRatioX96 * sqrtRatioX96;\n const price = (priceX192 * PRICE_PRECISION) / BigInt(2 ** 192);\n\n return price;\n};\n\nexport const getTickAtPrice = (price: bigint) => {\n const priceX192 = (price * BigInt(2 ** 192)) / PRICE_PRECISION;\n const sqrtPriceX96 = JSBI.BigInt(\n new Big(priceX192.toString()).sqrt().toFixed(0),\n );\n return TickMath.getTickAtSqrtRatio(sqrtPriceX96);\n};\n\nexport const getNearestValidStrikeTick = (\n optionType: 'CALL' | 'PUT',\n optionAssetIsToken0: boolean,\n tickSpacing: number,\n currentTick: number,\n strikeTick?: number,\n) => {\n strikeTick = roundTick(strikeTick ?? currentTick, tickSpacing);\n\n if (\n (optionType === 'CALL' && optionAssetIsToken0) ||\n (optionType === 'PUT' && !optionAssetIsToken0)\n ) {\n strikeTick += tickSpacing;\n }\n return strikeTick;\n};\n\nexport const roundTick = (tick: number, spacing: number) => {\n const rem = tick % spacing;\n if (rem >= 0) return tick - rem;\n return tick - rem - spacing;\n};\n\nexport const token0ToToken1 = (amount0: bigint, price: bigint | Amount) => {\n price = typeof price === 'bigint' ? price : price.scaled;\n return (amount0 * price) / PRICE_PRECISION;\n};\nexport const token1ToToken0 = (amount1: bigint, price: bigint | Amount) => {\n price = typeof price === 'bigint' ? price : price.scaled;\n return (amount1 * PRICE_PRECISION) / price;\n};\n\nexport const token0ToToken1AtTick = (amount0: bigint, tick: number) => {\n const price = getPriceAtTick(tick);\n return (amount0 * price) / PRICE_PRECISION;\n};\nexport const token1ToToken0AtTick = (amount1: bigint, tick: number) => {\n const price = getPriceAtTick(tick);\n return (amount1 * PRICE_PRECISION) / price;\n};\n\nexport const getAmountsFromLiquidity = (\n tickLower: number,\n tickUpper: number,\n liquidity: bigint,\n currentTick: number,\n): [bigint, bigint] => {\n const sqrtRatioX96 = TickMath.getSqrtRatioAtTick(currentTick);\n const sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(tickLower);\n const sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(tickUpper);\n const liquidityJSBI = JSBI.BigInt(liquidity.toString());\n\n let delta0 = JSBI.BigInt(0);\n let delta1 = JSBI.BigInt(0);\n\n if (currentTick < tickLower) {\n delta0 = SqrtPriceMath.getAmount0Delta(\n sqrtRatioAX96,\n sqrtRatioBX96,\n liquidityJSBI,\n false,\n );\n } else if (currentTick >= tickUpper) {\n delta1 = SqrtPriceMath.getAmount1Delta(\n sqrtRatioAX96,\n sqrtRatioBX96,\n liquidityJSBI,\n false,\n );\n } else {\n delta0 = SqrtPriceMath.getAmount0Delta(\n sqrtRatioX96,\n sqrtRatioBX96,\n liquidityJSBI,\n false,\n );\n delta1 = SqrtPriceMath.getAmount1Delta(\n sqrtRatioAX96,\n sqrtRatioX96,\n liquidityJSBI,\n false,\n );\n }\n return [BigInt(delta0.toString()), BigInt(delta1.toString())];\n};\n\nexport const liquiditiesToAmount0 = (\n liquidities: bigint[],\n startTick: number,\n tickSpacing: number,\n) => {\n let amount0 = BigInt(0);\n\n for (let i = 0; i < liquidities.length; i++) {\n const liquidity = liquidities[i];\n if (liquidity === BigInt(0)) continue;\n\n const tickLower = startTick + tickSpacing * i;\n const tickUpper = tickLower + tickSpacing;\n\n const sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(tickLower);\n const sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(tickUpper);\n const liquidityJSBI = JSBI.BigInt(liquidity.toString());\n\n const amount0Delta = SqrtPriceMath.getAmount0Delta(\n sqrtRatioAX96,\n sqrtRatioBX96,\n liquidityJSBI,\n false,\n );\n amount0 += BigInt(amount0Delta.toString());\n }\n return amount0;\n};\n\nexport const liquiditiesToAmount1 = (\n liquidities: bigint[],\n startTick: number,\n tickSpacing: number,\n) => {\n let amount1 = BigInt(0);\n\n for (let i = 0; i < liquidities.length; i++) {\n const liquidity = liquidities[i];\n if (liquidity === BigInt(0)) continue;\n\n const tickLower = startTick + tickSpacing * i;\n const tickUpper = tickLower + tickSpacing;\n\n const sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(tickLower);\n const sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(tickUpper);\n const liquidityJSBI = JSBI.BigInt(liquidity.toString());\n\n const amount1Delta = SqrtPriceMath.getAmount1Delta(\n sqrtRatioAX96,\n sqrtRatioBX96,\n liquidityJSBI,\n false,\n );\n amount1 += BigInt(amount1Delta.toString());\n }\n return amount1;\n};\n\nexport const liquiditiesToAmounts = (\n liquidities: bigint[],\n startTick: number,\n price: bigint,\n tickSpacing: number,\n) => {\n let amount0 = 0n;\n let amount1 = 0n;\n\n const sqrtRatioX96 = getSqrtPriceX96AtPrice(price);\n\n for (let i = 0; i < liquidities.length; i++) {\n const liquidity = liquidities[i];\n if (liquidity === BigInt(0)) continue;\n\n const tickLower = startTick + tickSpacing * i;\n const tickUpper = tickLower + tickSpacing;\n\n const sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(tickLower);\n const sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(tickUpper);\n const liquidityJSBI = JSBI.BigInt(liquidity.toString());\n\n if (JSBI.lessThanOrEqual(sqrtRatioX96, sqrtRatioAX96)) {\n const delta0 = SqrtPriceMath.getAmount0Delta(\n sqrtRatioAX96,\n sqrtRatioBX96,\n liquidityJSBI,\n false,\n );\n amount0 += BigInt(delta0.toString());\n } else if (JSBI.lessThan(sqrtRatioX96, sqrtRatioBX96)) {\n const delta0 = SqrtPriceMath.getAmount0Delta(\n sqrtRatioX96,\n sqrtRatioBX96,\n liquidityJSBI,\n false,\n );\n const delta1 = SqrtPriceMath.getAmount1Delta(\n sqrtRatioAX96,\n sqrtRatioX96,\n liquidityJSBI,\n false,\n );\n amount0 += BigInt(delta0.toString());\n amount1 += BigInt(delta1.toString());\n } else {\n const delta1 = SqrtPriceMath.getAmount1Delta(\n sqrtRatioAX96,\n sqrtRatioBX96,\n liquidityJSBI,\n false,\n );\n amount1 += BigInt(delta1.toString());\n }\n }\n return [amount0, amount1];\n};\n","import Big from 'big.js';\n\nexport type Amount = {\n scaled: bigint;\n unscaled: Big;\n decimals: number;\n formatted: string;\n};\n\nexport const zero: Amount = {\n scaled: 0n,\n unscaled: Big(0),\n decimals: 18,\n formatted: '0',\n};\n\nexport const wrapAmount = (scaled: bigint, decimals: number): Amount => {\n const unscaled = unscaleAmount(scaled, decimals);\n const formatted = formatAmount(unscaled);\n return {scaled, unscaled, decimals, formatted};\n};\n\nexport const wrapAmountUnscaled = (\n unscaled: Big | number | string,\n decimals: number,\n): Amount => {\n unscaled = Big(unscaled);\n const scaled = scaleAmount(unscaled, decimals);\n const formatted = formatAmount(unscaled);\n return {scaled, unscaled, decimals, formatted};\n};\n\nexport const wrapPrice = (\n scaled: bigint,\n decimals0: number,\n decimals1: number,\n): Amount => {\n const unscaled = unscalePrice(scaled, decimals0, decimals1);\n const formatted = formatAmount(unscaled);\n return {scaled, unscaled, decimals: 36 + decimals1 - decimals0, formatted};\n};\n\nexport const wrapPriceUnscaled = (\n unscaled: Big | number | string,\n decimals0: number,\n decimals1: number,\n): Amount => {\n unscaled = Big(unscaled);\n const scaled = scalePrice(unscaled, decimals0, decimals1);\n const formatted = formatAmount(unscaled);\n return {scaled, unscaled, decimals: 36 + decimals1 - decimals0, formatted};\n};\n\nexport const unscaleAmount = (scaled: bigint, decimals: number) => {\n return new Big(scaled.toString()).div(new Big(10).pow(decimals));\n};\n\nexport const scaleAmount = (\n unscaled: Big | number | string,\n decimals: number,\n) => {\n return BigInt(\n Big(unscaled).mul(new Big(10).pow(decimals)).round().toFixed(0),\n );\n};\n\nexport const unscalePrice = (\n scaled: bigint,\n decimals0: number,\n decimals1: number,\n precision = 18,\n) => {\n return new Big(scaled.toString())\n .mul(new Big(10).pow(decimals0))\n .div(new Big(10).pow(decimals1))\n .div(new Big(10).pow(precision));\n};\n\nexport const scalePrice = (\n unscaled: Big | number | string,\n decimals0: number,\n decimals1: number,\n precision = 18,\n) => {\n return BigInt(\n Big(unscaled)\n .mul(new Big(10).pow(precision))\n .mul(new Big(10).pow(decimals1))\n .div(new Big(10).pow(decimals0))\n .round()\n .toFixed(0),\n );\n};\n\nexport const formatAmount = (value?: Big | number | string) => {\n if (!value) return '-';\n value = new Big(value);\n\n if (value.gte(1e8)) return formatVagueAmount(value, 2);\n return formatCondensed(Big(value).toFixed(100));\n};\n\nexport const formatVagueAmount = (\n value: Big | number | bigint | string,\n fractionDigits = 2,\n) => {\n value = Number(value);\n if (value === 0) return '0';\n\n const formatted = value.toExponential(fractionDigits);\n return formatted.replace(/\\.?0+e/, 'e').replace(/e\\+/, 'e');\n};\n\nexport const formatCondensed = (\n input: string | number,\n decimals = 2,\n): string => {\n const str = (typeof input === 'number' ? input.toFixed(20) : input)\n .replace(/(\\.\\d*?)0+$/, '$1')\n .replace(/\\.$/, '');\n\n const [whole, decimal] = str.split('.');\n\n const formattedWhole = whole.replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',');\n if (!decimal) return formattedWhole;\n\n const leadingZeroMatch = decimal.match(/^(0{3,})/);\n\n if (leadingZeroMatch) {\n const zeroCount = leadingZeroMatch[1].length;\n const subscript = toSubscript(zeroCount.toString());\n const remaining = decimal.slice(zeroCount);\n\n const twoDigits = remaining.slice(0, decimals);\n return `${formattedWhole}.0${subscript}${twoDigits}`;\n } else {\n // No subscript needed, find first 2 significant digits\n const nonZeroStart = decimal.search(/[1-9]/); // Find first non-zero digit\n\n if (nonZeroStart === -1) {\n return formattedWhole; // All zeros\n }\n const significantPart = decimal.slice(nonZeroStart);\n const twoDigits = significantPart.slice(0, decimals);\n const leadingZeros = decimal.slice(0, nonZeroStart);\n\n return `${formattedWhole}.${leadingZeros}${twoDigits}`;\n }\n};\n\nconst toSubscript = (input: string) => {\n return input.replace(/[0-9]/g, m => '₀₁₂₃₄₅₆₇₈₉'[+m]);\n};\n\nexport const formatUSD = (value: Big | string | number): string => {\n return '$' + formatAmount(value);\n};\n","import type {OptionData} from '~/package/client';\nimport {\n getPriceAtTick,\n liquiditiesToAmounts,\n token0ToToken1,\n token1ToToken0,\n} from './liquidityUtils';\n\nexport const getPayoutAtTick = (\n option: OptionData,\n liquidities: bigint[],\n tick: number,\n tickSpacing: number,\n optionAssetIsToken0: boolean,\n) => {\n return getPayoutAtPrice(\n option,\n liquidities,\n getPriceAtTick(tick),\n tickSpacing,\n optionAssetIsToken0,\n );\n};\n\nexport const getPayoutAtPrice = (\n option: OptionData,\n liquidities: bigint[],\n price: bigint,\n tickSpacing: number,\n optionAssetIsToken0: boolean,\n) => {\n const [borrowedAmount0, borrowedAmount1] = liquiditiesToAmounts(\n liquidities,\n option.startTick,\n option.entryPrice,\n tickSpacing,\n );\n const [repayAmount0, repayAmount1] = liquiditiesToAmounts(\n liquidities,\n option.startTick,\n price,\n tickSpacing,\n );\n const totalAmount = optionAssetIsToken0\n ? borrowedAmount1 + token0ToToken1(borrowedAmount0, price)\n : borrowedAmount0 + token1ToToken0(borrowedAmount1, price);\n\n const repayAmount = optionAssetIsToken0\n ? repayAmount1 + token0ToToken1(repayAmount0, price)\n : repayAmount0 + token1ToToken0(repayAmount1, price);\n\n const delta = totalAmount - repayAmount;\n const payout = delta < 0n ? 0n : delta;\n\n return payout;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAa,YAAY,SAAkB,iCAC7B;CAAC,KAAKA;CAAU;CAAS;CAAO,CAAC;AAE/C,MAAa,qBACX,SACA,WACmB;AACnB,8BAAmB;EAAC,KAAKC;EAAkB;EAAS;EAAO,CAAC;;AAG9D,MAAa,eAAe,OAAO,QAAsB,YAAsB;AAC7E,KAAI,CAAC,SAAS;EACZ,MAAM,UAAU,MAAM,OAAO,YAAY;AACzC,YAAU,WAAW;AACrB,MAAI,CAAC,QAAS,OAAM,IAAI,MAAM,2BAA2B,UAAU;;AAErE,8BAAmB;EAAC,KAAKC;EAAuB;EAAS;EAAO,CAAC;;AAGnE,MAAa,kBAAkB,OAC7B,QACA,YACG;AACH,KAAI,CAAC,SAAS;EACZ,MAAM,UAAU,MAAM,OAAO,YAAY;AACzC,YAAU,eAAe;AACzB,MAAI,CAAC,QAAS,OAAM,IAAI,MAAM,8BAA8B,UAAU;;AAExE,8BAAmB;EAAC,KAAKC;EAAS;EAAS;EAAO,CAAC;;AAGrD,MAAaC,WAAoC,GAC9CC,wBAAY,KAAK,8CACnB;AACD,MAAaC,iBAA0C,GACpDD,wBAAY,KAAK,8CACnB;AACD,MAAaE,oBAA6C,GACvDF,wBAAY,KAAK,8CACnB;AACD,MAAaG,cAAuC,GACjDH,wBAAY,KAAK,8CACnB;AACD,MAAaI,aAAsC,GAChDJ,wBAAY,KAAK,8CACnB;;;;ACrDD,MAAM,uBAAuB,eAAg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@ declare const lensAbi: readonly [{
|
|
|
54
54
|
readonly type: "uint128";
|
|
55
55
|
readonly internalType: "uint128";
|
|
56
56
|
}, {
|
|
57
|
-
readonly name: "
|
|
57
|
+
readonly name: "borrowableLiquidity";
|
|
58
|
+
readonly type: "uint128";
|
|
59
|
+
readonly internalType: "uint128";
|
|
60
|
+
}, {
|
|
61
|
+
readonly name: "withdrawableLiquidity";
|
|
58
62
|
readonly type: "uint128";
|
|
59
63
|
readonly internalType: "uint128";
|
|
60
64
|
}, {
|
|
@@ -972,6 +976,16 @@ declare const optionsMarketAbi: readonly [{
|
|
|
972
976
|
readonly internalType: "address";
|
|
973
977
|
}];
|
|
974
978
|
readonly stateMutability: "nonpayable";
|
|
979
|
+
}, {
|
|
980
|
+
readonly type: "function";
|
|
981
|
+
readonly name: "MAX_OPTION_STEPS";
|
|
982
|
+
readonly inputs: readonly [];
|
|
983
|
+
readonly outputs: readonly [{
|
|
984
|
+
readonly name: "";
|
|
985
|
+
readonly type: "uint24";
|
|
986
|
+
readonly internalType: "uint24";
|
|
987
|
+
}];
|
|
988
|
+
readonly stateMutability: "view";
|
|
975
989
|
}, {
|
|
976
990
|
readonly type: "function";
|
|
977
991
|
readonly name: "calculatePremium";
|
|
@@ -1157,6 +1171,46 @@ declare const optionsMarketAbi: readonly [{
|
|
|
1157
1171
|
readonly internalType: "contract TimelockGuardian";
|
|
1158
1172
|
}];
|
|
1159
1173
|
readonly stateMutability: "view";
|
|
1174
|
+
}, {
|
|
1175
|
+
readonly type: "function";
|
|
1176
|
+
readonly name: "maxDuration";
|
|
1177
|
+
readonly inputs: readonly [];
|
|
1178
|
+
readonly outputs: readonly [{
|
|
1179
|
+
readonly name: "";
|
|
1180
|
+
readonly type: "uint32";
|
|
1181
|
+
readonly internalType: "uint32";
|
|
1182
|
+
}];
|
|
1183
|
+
readonly stateMutability: "view";
|
|
1184
|
+
}, {
|
|
1185
|
+
readonly type: "function";
|
|
1186
|
+
readonly name: "maxPositionSize";
|
|
1187
|
+
readonly inputs: readonly [];
|
|
1188
|
+
readonly outputs: readonly [{
|
|
1189
|
+
readonly name: "";
|
|
1190
|
+
readonly type: "uint256";
|
|
1191
|
+
readonly internalType: "uint256";
|
|
1192
|
+
}];
|
|
1193
|
+
readonly stateMutability: "view";
|
|
1194
|
+
}, {
|
|
1195
|
+
readonly type: "function";
|
|
1196
|
+
readonly name: "minDuration";
|
|
1197
|
+
readonly inputs: readonly [];
|
|
1198
|
+
readonly outputs: readonly [{
|
|
1199
|
+
readonly name: "";
|
|
1200
|
+
readonly type: "uint32";
|
|
1201
|
+
readonly internalType: "uint32";
|
|
1202
|
+
}];
|
|
1203
|
+
readonly stateMutability: "view";
|
|
1204
|
+
}, {
|
|
1205
|
+
readonly type: "function";
|
|
1206
|
+
readonly name: "minPositionSize";
|
|
1207
|
+
readonly inputs: readonly [];
|
|
1208
|
+
readonly outputs: readonly [{
|
|
1209
|
+
readonly name: "";
|
|
1210
|
+
readonly type: "uint256";
|
|
1211
|
+
readonly internalType: "uint256";
|
|
1212
|
+
}];
|
|
1213
|
+
readonly stateMutability: "view";
|
|
1160
1214
|
}, {
|
|
1161
1215
|
readonly type: "function";
|
|
1162
1216
|
readonly name: "mintOption";
|
|
@@ -1488,6 +1542,28 @@ declare const optionsMarketAbi: readonly [{
|
|
|
1488
1542
|
}];
|
|
1489
1543
|
readonly outputs: readonly [];
|
|
1490
1544
|
readonly stateMutability: "nonpayable";
|
|
1545
|
+
}, {
|
|
1546
|
+
readonly type: "function";
|
|
1547
|
+
readonly name: "updatePositionBounds";
|
|
1548
|
+
readonly inputs: readonly [{
|
|
1549
|
+
readonly name: "_minDuration";
|
|
1550
|
+
readonly type: "uint32";
|
|
1551
|
+
readonly internalType: "uint32";
|
|
1552
|
+
}, {
|
|
1553
|
+
readonly name: "_maxDuration";
|
|
1554
|
+
readonly type: "uint32";
|
|
1555
|
+
readonly internalType: "uint32";
|
|
1556
|
+
}, {
|
|
1557
|
+
readonly name: "_minPositionSize";
|
|
1558
|
+
readonly type: "uint256";
|
|
1559
|
+
readonly internalType: "uint256";
|
|
1560
|
+
}, {
|
|
1561
|
+
readonly name: "_maxPositionSize";
|
|
1562
|
+
readonly type: "uint256";
|
|
1563
|
+
readonly internalType: "uint256";
|
|
1564
|
+
}];
|
|
1565
|
+
readonly outputs: readonly [];
|
|
1566
|
+
readonly stateMutability: "nonpayable";
|
|
1491
1567
|
}, {
|
|
1492
1568
|
readonly type: "function";
|
|
1493
1569
|
readonly name: "vault";
|
|
@@ -1717,6 +1793,31 @@ declare const optionsMarketAbi: readonly [{
|
|
|
1717
1793
|
readonly internalType: "uint256";
|
|
1718
1794
|
}];
|
|
1719
1795
|
readonly anonymous: false;
|
|
1796
|
+
}, {
|
|
1797
|
+
readonly type: "event";
|
|
1798
|
+
readonly name: "UpdatePositionBounds";
|
|
1799
|
+
readonly inputs: readonly [{
|
|
1800
|
+
readonly name: "minDuration";
|
|
1801
|
+
readonly type: "uint32";
|
|
1802
|
+
readonly indexed: false;
|
|
1803
|
+
readonly internalType: "uint32";
|
|
1804
|
+
}, {
|
|
1805
|
+
readonly name: "maxDuration";
|
|
1806
|
+
readonly type: "uint32";
|
|
1807
|
+
readonly indexed: false;
|
|
1808
|
+
readonly internalType: "uint32";
|
|
1809
|
+
}, {
|
|
1810
|
+
readonly name: "minPositionSize";
|
|
1811
|
+
readonly type: "uint256";
|
|
1812
|
+
readonly indexed: false;
|
|
1813
|
+
readonly internalType: "uint256";
|
|
1814
|
+
}, {
|
|
1815
|
+
readonly name: "maxPositionSize";
|
|
1816
|
+
readonly type: "uint256";
|
|
1817
|
+
readonly indexed: false;
|
|
1818
|
+
readonly internalType: "uint256";
|
|
1819
|
+
}];
|
|
1820
|
+
readonly anonymous: false;
|
|
1720
1821
|
}, {
|
|
1721
1822
|
readonly type: "event";
|
|
1722
1823
|
readonly name: "WhitelistSwapper";
|
|
@@ -1740,6 +1841,14 @@ declare const optionsMarketAbi: readonly [{
|
|
|
1740
1841
|
readonly type: "address";
|
|
1741
1842
|
readonly internalType: "address";
|
|
1742
1843
|
}];
|
|
1844
|
+
}, {
|
|
1845
|
+
readonly type: "error";
|
|
1846
|
+
readonly name: "DurationTooHigh";
|
|
1847
|
+
readonly inputs: readonly [];
|
|
1848
|
+
}, {
|
|
1849
|
+
readonly type: "error";
|
|
1850
|
+
readonly name: "DurationTooLow";
|
|
1851
|
+
readonly inputs: readonly [];
|
|
1743
1852
|
}, {
|
|
1744
1853
|
readonly type: "error";
|
|
1745
1854
|
readonly name: "FailedCall";
|
|
@@ -1820,10 +1929,22 @@ declare const optionsMarketAbi: readonly [{
|
|
|
1820
1929
|
readonly type: "error";
|
|
1821
1930
|
readonly name: "PoolNotSupported";
|
|
1822
1931
|
readonly inputs: readonly [];
|
|
1932
|
+
}, {
|
|
1933
|
+
readonly type: "error";
|
|
1934
|
+
readonly name: "PositionSizeTooHigh";
|
|
1935
|
+
readonly inputs: readonly [];
|
|
1936
|
+
}, {
|
|
1937
|
+
readonly type: "error";
|
|
1938
|
+
readonly name: "PositionSizeTooLow";
|
|
1939
|
+
readonly inputs: readonly [];
|
|
1823
1940
|
}, {
|
|
1824
1941
|
readonly type: "error";
|
|
1825
1942
|
readonly name: "PremiumTooHigh";
|
|
1826
1943
|
readonly inputs: readonly [];
|
|
1944
|
+
}, {
|
|
1945
|
+
readonly type: "error";
|
|
1946
|
+
readonly name: "PriceTooLow";
|
|
1947
|
+
readonly inputs: readonly [];
|
|
1827
1948
|
}, {
|
|
1828
1949
|
readonly type: "error";
|
|
1829
1950
|
readonly name: "ReentrancyGuardReentrantCall";
|
|
@@ -1852,6 +1973,18 @@ declare const optionsMarketAbi: readonly [{
|
|
|
1852
1973
|
readonly type: "error";
|
|
1853
1974
|
readonly name: "SwapperNotWhitelisted";
|
|
1854
1975
|
readonly inputs: readonly [];
|
|
1976
|
+
}, {
|
|
1977
|
+
readonly type: "error";
|
|
1978
|
+
readonly name: "TooManySteps";
|
|
1979
|
+
readonly inputs: readonly [{
|
|
1980
|
+
readonly name: "steps";
|
|
1981
|
+
readonly type: "uint256";
|
|
1982
|
+
readonly internalType: "uint256";
|
|
1983
|
+
}, {
|
|
1984
|
+
readonly name: "maxSteps";
|
|
1985
|
+
readonly type: "uint256";
|
|
1986
|
+
readonly internalType: "uint256";
|
|
1987
|
+
}];
|
|
1855
1988
|
}, {
|
|
1856
1989
|
readonly type: "error";
|
|
1857
1990
|
readonly name: "TradingPaused";
|
|
@@ -1871,4 +2004,4 @@ declare const optionsMarketAbi: readonly [{
|
|
|
1871
2004
|
}];
|
|
1872
2005
|
//#endregion
|
|
1873
2006
|
export { lensAbi as n, optionsMarketAbi as t };
|
|
1874
|
-
//# sourceMappingURL=optionsMarket-
|
|
2007
|
+
//# sourceMappingURL=optionsMarket-BVrCBIJQ.d.cts.map
|