loom_defi_abi/maverick/
quoter.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
use alloy_sol_macro::sol;

sol! {

    #[derive(Debug, PartialEq, Eq)]
    struct BinInfo {
        uint128 id;
        uint8 kind;
        int32 lowerTick;
        uint128 reserveA;
        uint128 reserveB;
        uint128 mergeId;
    }

    #[derive(Debug, PartialEq, Eq)]
    struct BinState {
        uint128 reserveA;
        uint128 reserveB;
        uint128 mergeBinBalance;
        uint128 mergeId;
        uint128 totalSupply;
        uint8 kind;
        int32 lowerTick;
    }


    #[sol(abi=true,rpc)]
    #[derive(Debug, PartialEq, Eq)]
    interface IMaverickQuoter {
        function calculateSwap(address pool, uint128 amount, bool tokenAIn, bool exactOutput, uint256 sqrtPriceLimit) external returns (uint256 returnAmount);
        function calculateMultihopSwap(bytes memory path, uint256 amount, bool exactOutput) external returns (uint256 returnAmount);

        function getActiveBins(address pool, uint128 startBinIndex, uint128 endBinIndex) external view returns (BinInfo[] memory bins);

        function getBinDepth(address pool, uint128 binId) external view returns (uint256 depth);

        function getSqrtPrice(address pool) external view returns (uint256 sqrtPrice);

        function getBinsAtTick(address pool, int32 tick) external view returns (BinState[] memory bins);

        function activeTickLiquidity(address pool) external view returns (uint256 sqrtPrice, uint256 liquidity, uint256 reserveA, uint256 reserveB);

        function tickLiquidity(address pool, int32 tick) external view returns (uint256 sqrtPrice, uint256 liquidity, uint256 reserveA, uint256 reserveB);

    }
}