# Kodiak Island

The Kodiak Island contracts provide a framework for creating and managing concentrated liquidity positions on Kodiak V3. They enable users to deposit tokens into a managed Kodiak V3 position, receiving shares in return. They allow managers to rebalance the position, collect fees, and adjust the position and management parameters. The contracts support minting, burning, rebalancing, and integration with external routers for complex strategies.

## Adding/Removing Liquidity

These functions are used to mint/burn island shares resulting in adding/removing liquidity from the island's underlying v3 pool position. It is highly recommended to use the [Island Router](https://app.gitbook.com/o/XDFALXDrtEzw6m888LZh/s/OSwqNrRJ9Xh6jO57yoLm/~/changes/39/developers/kodiak-islands/smart-contract-reference/kodiak-island-router) to add/remove liquidity as it handles slippage settings.

#### Adding Liquidity

```solidity
function mint(
    uint256 mintAmount,
    address receiver
) external returns (
    uint256 amount0,
    uint256 amount1,
    uint128 liquidityMinted
)
```

Mints new Island tokens by providing liquidity to the underlying Kodiak V3 position.

* `mintAmount`: Number of Island tokens to mint
* `receiver`: Address to receive the minted tokens
* Returns amounts of token0/token1 used and liquidity added

#### Removing Liquidity

```solidity
function burn(
    uint256 burnAmount,
    address receiver
) external returns (
    uint256 amount0,
    uint256 amount1,
    uint128 liquidityBurned
)
```

Burns Island tokens to withdraw underlying assets.

* `burnAmount`: Number of Island tokens to burn
* `receiver`: Address to receive the underlying tokens
* Returns amounts of token0/token1 received and liquidity removed

#### Compounding collected fee

```solidity
function rebalance() external {}
```

Collects the fee earned by the island's position and reinvests as much of token0 and token1 into the position as possible after deducting the manager fee from the collected fee.

## View Functions

**Get Underlying Balances**

```solidity
function getUnderlyingBalances() external view returns (
    uint256 amount0Current,
    uint256 amount1Current
)
```

Returns:

* `amount0Current`: The total amounts of underlying tokens represented by the entire Island supply. This includes deployed liqudity (uni v3 pool tokens), any unclaimed earned fee, and any undeployed tokens
* `amount1Current`: The total amounts of underlying tokens represented by the entire Island supply. This includes deployed liqudity (uni v3 pool tokens), any unclaimed earned fee, and any undeployed tokens resulting from fee imbalance

**Get Mint Amounts**

```solidity
function getMintAmounts(
    uint256 amount0Max,
    uint256 amount1Max
) external view returns (
    uint256 amount0,
    uint256 amount1,
    uint256 mintAmount
)
```

This function allows you to find the optimal deposit amounts for token0 and token1 in correct ratio to deposit maximally into the underlying island position Arguments:

* `amount0Max`: Max amount of token0 the user is willing to deposit
* `amount1Max`: Max amount of token1 the user is willing to deposit Returns:
* `amount0`: The amount of token0 used from the max
* `amount1`: The amount of token1 used from the max
* `mintAmount`: The number of island tokens minted using amount0 and amount1

**Get Underlying Balances At Price**

```solidity
function getUnderlyingBalancesAtPrice(
    uint160 sqrtRatioX96
) external view returns (
    uint256 amount0Current,
    uint256 amount1Current
)
```

This function calculates the underlying token balances at a specific price point Arguments:

* `sqrtRatioX96`: The sqrt price to calculate balances at, in Q96 format Returns:
* `amount0Current`: Amount of token0 at the specified price
* `amount1Current`: Amount of token1 at the specified price

**Get Position ID**

```solidity
function getPositionID() external view returns (bytes32 positionID)
```

Returns the unique identifier for the current Kodiak V3 position Returns:

* `positionID`: Keccak256 hash of packed (island address, lowerTick, upperTick)

**Get Token0**

```solidity
function token0() external view returns (IERC20)
```

Returns the address of token0

**Get Token1**

```solidity
function token1() external view returns (IERC20)
```

Returns the address of token1

**Get Upper Tick**

```solidity
function upperTick() external view returns (int24)
```

Returns the upper tick of the island's position

**Get Lower Tick**

```solidity
function lowerTick() external view returns (int24)
```

Returns the lower tick of the island's position

**Get Pool**

```solidity
function pool() external view returns (IUniswapV3Pool)
```

Returns the address of the Kodiak V3 pool

**Get Total Supply**

```solidity
function totalSupply() external view returns (uint256)
```

Returns the total supply of the island tokens

**Get Balance Of**

```solidity
function balanceOf(address account) external view returns (uint256)
```

Returns the balance of the specified account

**Get Manager Fee BPS**

```solidity
function managerFeeBPS() external view returns (uint16)
```

Returns the manager fee in basis points

**Get Manager Treasury**

```solidity
function managerTreasury() external view returns (address)
```

Returns the manager treasury address

**Get Manager Balance 0**

```solidity
function managerBalance0() external view returns (uint256)
```

Returns the manager balance of token0

**Get Manager Balance 1**

```solidity
function managerBalance1() external view returns (uint256)
```

Returns the manager balance of token1

**Get Manager**

```solidity
function manager() external view returns (address)
```

Returns the current manager address. Should be address(0) for unmanaged islands

## Island Management

This is applicable only for managed islands. Permissionless islands only expose the functionality to compound the fee collected.

### Admin roles involved

* `manager` - can alter island position bounds to manage liquidity optimally
* `pauser` - can pause operations in case of a security breach

### Island Configuration Parameters

**Manager Parameters**

* `manager`: The address authorized to perform management operations like rebalancing
* `managerTreasury`: Address where manager fees are sent
* `managerFeeBPS`: Percentage of earned fees that go to the manager (in basis points, max 10000)
* `restrictedMint`: When true, only the manager can mint new Island tokens
* `compounderSlippageBPS`: Maximum allowed slippage for rebalance operations (in basis points)
* `compounderSlippageInterval`: Time window for TWAP price calculation using kodiak pool observations (in seconds)

**Island Position Parameters**

* `lowerTick`: Lower price bound of the Kodiak V3 position
* `upperTick`: Upper price bound of the Kodiak V3 position
* `pool`: The underlying Kodiak V3 pool address
* `token0`: First token in the uni pool pair
* `token1`: Second token in the uni pool pair

**Manager Fee**

For active management of the island, the manager fee is collected from the UniV3 earned fees. For Kodiak team managed islands the manager fee is 0.

* Fee = (Total Fees Earned \* managerFeeBPS) / 10000
* Unmanaged/Permissionless Islands use the Island factory's default fee settings

**Restricted Minting**

When `restrictedMint` is enabled:

* Only the manager can mint new Island tokens
* The first mint needs to atleast add INITIAL\_MINT amount of liquidity.After the first mint this liquidity is burned.

### Manager Functions

**Update Manager Parameters**

```solidity
function updateManagerParams(
    int16 newManagerFeeBPS,
    address newManagerTreasury,
    int16 newSlippageBPS,
    int32 newSlippageInterval
) external
```

Updates the manager configuration parameters for the island Arguments:

* `newManagerFeeBPS`: New manager fee in basis points (-1 to keep current)
* `newManagerTreasury`: New treasury address (address(0) to keep current)
* `newSlippageBPS`: New slippage tolerance in basis points (-1 to keep current)
* `newSlippageInterval`: New TWAP interval in seconds (-1 to keep current)

**Executive Rebalance**

```solidity
function executiveRebalance(
    int24 newLowerTick,
    int24 newUpperTick,
    uint160 swapThresholdPrice,
    uint256 swapAmountBPS,
    bool zeroForOne
) external
```

Rebalances the position by changing price range and optionally performing underlying pool swaps Arguments:

* `newLowerTick`: New lower price bound of the position
* `newUpperTick`: New upper price bound of the position
* `swapThresholdPrice`: Maximum/minimum price for the swap in sqrtPriceX96 for uni v3 slippage protection
* `swapAmountBPS`: Percentage of excess available tokens to swap in BPS
* `zeroForOne`: True to swap token0 for token1, false for opposite

Notes: In order to generate the parameters for an executive rebalance one has to understand the flow of this operation. First, the Kodiak island removes all the liquidity and fees earned. Then, it tries to deposit as much liquidity as possible around the new price range. Next, whatever is leftover is then swapped based on the swap parameters. Finally, another deposit of maximal liquidity to the position is attempted and any leftover sits in the contract balance waiting to be reinvested.

1. Call getUnderlyingBalances on the ArrakisVault to obtain amount0Current and amount1Current
2. Compute amount0Liquidity and amount1Liquidity using LiquidityAmounts.sol library, the new position bounds, the current price and the current amounts from step 1.
3. Compute amount0Leftover and amount1Leftover with formula amount0Leftover = amount0Current - amount0Liquidity. In most cases one of these values will be 0 (or very close to 0).
4. Use amount0Liquidity and amount1Liquidity to compute the current proportion of each asset needed.
5. Use the amount0Leftover and amount1Leftover and the proportion from previous step to compute which token to swap and the swapAmount.
6. Convert swapAmount to swapAmountBPS by doing swapAmount \* 10000 / amountLeftover for the token being swapped.

**Executive Rebalance With Router**

```solidity
function executiveRebalanceWithRouter(
    int24 newLowerTick,
    int24 newUpperTick,
    SwapData calldata swapData
) external
```

Rebalances using an external router for optimized swaps across all available liquidity. Arguments:

* `newLowerTick`: New lower price bound of the position
* `newUpperTick`: New upper price bound of the position
* `swapData`: Struct containing:
  * `router`: Address of whitelisted router to use
  * `amountIn`: Amount of tokens to swap
  * `minAmountOut`: Minimum tokens to receive
  * `zeroForOne`: Swap direction
  * `routeData`: Encoded swap route data

**Set Restricted Mint**

```solidity
function setRestrictedMint(bool _status) external
```

Restricts minting to only the manager address Arguments:

* `_status`: True to restrict minting, false to allow public minting

**Set Pauser**

```solidity
function setPauser(address _pauser, bool _status) external
```

Adds or removes an address from the pauser role Arguments:

* `_pauser`: Address to modify pauser status for
* `_status`: True to add as pauser, false to remove

**Pause/Unpause**

```solidity
function pause() external
function unpause() external
```

Emergency functions to pause/unpause all island operations

* `pause`: Can be called by manager or pauser
* `unpause`: Can only be called by manager

#### Fee Management

**Withdraw Manager Balance**

```solidity
function withdrawManagerBalance() external
```

Withdraws accumulated manager fees to the manager treasury

* Transfers all accumulated token0 and token1 fees
* Resets manager balance tracking to zero

**Sync To Factory**

```solidity
function syncToFactory() public
```

Updates unmanaged island parameters to match factory settings when updated.

* Updates manager treasury to factory treasury
* Updates manager fee to factory default fee
* Only affects islands with no active manager

## ABI

```json
[
    {
        "type": "function",
        "name": "DOMAIN_SEPARATOR",
        "inputs": [],
        "outputs": [
            {
                "name": "result",
                "type": "bytes32",
                "internalType": "bytes32"
            }
        ],
        "stateMutability": "view"
    },
    {
        "type": "function",
        "name": "allowance",
        "inputs": [
            {
                "name": "owner",
                "type": "address",
                "internalType": "address"
            },
            {
                "name": "spender",
                "type": "address",
                "internalType": "address"
            }
        ],
        "outputs": [
            {
                "name": "result",
                "type": "uint256",
                "internalType": "uint256"
            }
        ],
        "stateMutability": "view"
    },
    {
        "type": "function",
        "name": "approve",
        "inputs": [
            {
                "name": "spender",
                "type": "address",
                "internalType": "address"
            },
            {
                "name": "amount",
                "type": "uint256",
                "internalType": "uint256"
            }
        ],
        "outputs": [
            {
                "name": "",
                "type": "bool",
                "internalType": "bool"
            }
        ],
        "stateMutability": "nonpayable"
    },
    {
        "type": "function",
        "name": "balanceOf",
        "inputs": [
            {
                "name": "owner",
                "type": "address",
                "internalType": "address"
            }
        ],
        "outputs": [
            {
                "name": "result",
                "type": "uint256",
                "internalType": "uint256"
            }
        ],
        "stateMutability": "view"
    },
    {
        "type": "function",
        "name": "burn",
        "inputs": [
            {
                "name": "burnAmount",
                "type": "uint256",
                "internalType": "uint256"
            },
            {
                "name": "receiver",
                "type": "address",
                "internalType": "address"
            }
        ],
        "outputs": [
            {
                "name": "amount0",
                "type": "uint256",
                "internalType": "uint256"
            },
            {
                "name": "amount1",
                "type": "uint256",
                "internalType": "uint256"
            },
            {
                "name": "liquidityBurned",
                "type": "uint128",
                "internalType": "uint128"
            }
        ],
        "stateMutability": "nonpayable"
    },
    {
        "type": "function",
        "name": "compounderSlippageBPS",
        "inputs": [],
        "outputs": [
            {
                "name": "",
                "type": "uint16",
                "internalType": "uint16"
            }
        ],
        "stateMutability": "view"
    },
    {
        "type": "function",
        "name": "compounderSlippageInterval",
        "inputs": [],
        "outputs": [
            {
                "name": "",
                "type": "uint32",
                "internalType": "uint32"
            }
        ],
        "stateMutability": "view"
    },
    {
        "type": "function",
        "name": "decimals",
        "inputs": [],
        "outputs": [
            {
                "name": "",
                "type": "uint8",
                "internalType": "uint8"
            }
        ],
        "stateMutability": "view"
    },
    {
        "type": "function",
        "name": "executiveRebalance",
        "inputs": [
            {
                "name": "newLowerTick",
                "type": "int24",
                "internalType": "int24"
            },
            {
                "name": "newUpperTick",
                "type": "int24",
                "internalType": "int24"
            },
            {
                "name": "swapThresholdPrice",
                "type": "uint160",
                "internalType": "uint160"
            },
            {
                "name": "swapAmountBPS",
                "type": "uint256",
                "internalType": "uint256"
            },
            {
                "name": "zeroForOne",
                "type": "bool",
                "internalType": "bool"
            }
        ],
        "outputs": [],
        "stateMutability": "nonpayable"
    },
    {
        "type": "function",
        "name": "executiveRebalanceWithRouter",
        "inputs": [
            {
                "name": "newLowerTick",
                "type": "int24",
                "internalType": "int24"
            },
            {
                "name": "newUpperTick",
                "type": "int24",
                "internalType": "int24"
            },
            {
                "name": "swapData",
                "type": "tuple",
                "internalType": "struct SwapData",
                "components": [
                    {
                        "name": "router",
                        "type": "address",
                        "internalType": "address"
                    },
                    {
                        "name": "amountIn",
                        "type": "uint256",
                        "internalType": "uint256"
                    },
                    {
                        "name": "minAmountOut",
                        "type": "uint256",
                        "internalType": "uint256"
                    },
                    {
                        "name": "zeroForOne",
                        "type": "bool",
                        "internalType": "bool"
                    },
                    {
                        "name": "routeData",
                        "type": "bytes",
                        "internalType": "bytes"
                    }
                ]
            }
        ],
        "outputs": [],
        "stateMutability": "nonpayable"
    },
    {
        "type": "function",
        "name": "getAvgPrice",
        "inputs": [
            {
                "name": "interval",
                "type": "uint32",
                "internalType": "uint32"
            }
        ],
        "outputs": [
            {
                "name": "avgSqrtPriceX96",
                "type": "uint160",
                "internalType": "uint160"
            }
        ],
        "stateMutability": "view"
    },
    {
        "type": "function",
        "name": "getMintAmounts",
        "inputs": [
            {
                "name": "amount0Max",
                "type": "uint256",
                "internalType": "uint256"
            },
            {
                "name": "amount1Max",
                "type": "uint256",
                "internalType": "uint256"
            }
        ],
        "outputs": [
            {
                "name": "amount0",
                "type": "uint256",
                "internalType": "uint256"
            },
            {
                "name": "amount1",
                "type": "uint256",
                "internalType": "uint256"
            },
            {
                "name": "mintAmount",
                "type": "uint256",
                "internalType": "uint256"
            }
        ],
        "stateMutability": "view"
    },
    {
        "type": "function",
        "name": "getPositionID",
        "inputs": [],
        "outputs": [
            {
                "name": "positionID",
                "type": "bytes32",
                "internalType": "bytes32"
            }
        ],
        "stateMutability": "view"
    },
    {
        "type": "function",
        "name": "getUnderlyingBalances",
        "inputs": [],
        "outputs": [
            {
                "name": "amount0Current",
                "type": "uint256",
                "internalType": "uint256"
            },
            {
                "name": "amount1Current",
                "type": "uint256",
                "internalType": "uint256"
            }
        ],
        "stateMutability": "view"
    },
    {
        "type": "function",
        "name": "getUnderlyingBalancesAtPrice",
        "inputs": [
            {
                "name": "sqrtRatioX96",
                "type": "uint160",
                "internalType": "uint160"
            }
        ],
        "outputs": [
            {
                "name": "amount0Current",
                "type": "uint256",
                "internalType": "uint256"
            },
            {
                "name": "amount1Current",
                "type": "uint256",
                "internalType": "uint256"
            }
        ],
        "stateMutability": "view"
    },
    {
        "type": "function",
        "name": "initialize",
        "inputs": [
            {
                "name": "_name",
                "type": "string",
                "internalType": "string"
            },
            {
                "name": "_symbol",
                "type": "string",
                "internalType": "string"
            },
            {
                "name": "_pool",
                "type": "address",
                "internalType": "address"
            },
            {
                "name": "_managerFeeBPS",
                "type": "uint16",
                "internalType": "uint16"
            },
            {
                "name": "_lowerTick",
                "type": "int24",
                "internalType": "int24"
            },
            {
                "name": "_upperTick",
                "type": "int24",
                "internalType": "int24"
            },
            {
                "name": "_manager_",
                "type": "address",
                "internalType": "address"
            },
            {
                "name": "_managerTreasury",
                "type": "address",
                "internalType": "address"
            }
        ],
        "outputs": [],
        "stateMutability": "nonpayable"
    },
    {
        "type": "function",
        "name": "isManaged",
        "inputs": [],
        "outputs": [
            {
                "name": "",
                "type": "bool",
                "internalType": "bool"
            }
        ],
        "stateMutability": "view"
    },
    {
        "type": "function",
        "name": "islandFactory",
        "inputs": [],
        "outputs": [
            {
                "name": "",
                "type": "address",
                "internalType": "contract IKodiakIslandFactory"
            }
        ],
        "stateMutability": "view"
    },
    {
        "type": "function",
        "name": "lowerTick",
        "inputs": [],
        "outputs": [
            {
                "name": "",
                "type": "int24",
                "internalType": "int24"
            }
        ],
        "stateMutability": "view"
    },
    {
        "type": "function",
        "name": "manager",
        "inputs": [],
        "outputs": [
            {
                "name": "",
                "type": "address",
                "internalType": "address"
            }
        ],
        "stateMutability": "view"
    },
    {
        "type": "function",
        "name": "managerBalance0",
        "inputs": [],
        "outputs": [
            {
                "name": "",
                "type": "uint256",
                "internalType": "uint256"
            }
        ],
        "stateMutability": "view"
    },
    {
        "type": "function",
        "name": "managerBalance1",
        "inputs": [],
        "outputs": [
            {
                "name": "",
                "type": "uint256",
                "internalType": "uint256"
            }
        ],
        "stateMutability": "view"
    },
    {
        "type": "function",
        "name": "managerFeeBPS",
        "inputs": [],
        "outputs": [
            {
                "name": "",
                "type": "uint16",
                "internalType": "uint16"
            }
        ],
        "stateMutability": "view"
    },
    {
        "type": "function",
        "name": "managerTreasury",
        "inputs": [],
        "outputs": [
            {
                "name": "",
                "type": "address",
                "internalType": "address"
            }
        ],
        "stateMutability": "view"
    },
    {
        "type": "function",
        "name": "mint",
        "inputs": [
            {
                "name": "mintAmount",
                "type": "uint256",
                "internalType": "uint256"
            },
            {
                "name": "receiver",
                "type": "address",
                "internalType": "address"
            }
        ],
        "outputs": [
            {
                "name": "amount0",
                "type": "uint256",
                "internalType": "uint256"
            },
            {
                "name": "amount1",
                "type": "uint256",
                "internalType": "uint256"
            },
            {
                "name": "liquidityMinted",
                "type": "uint128",
                "internalType": "uint128"
            }
        ],
        "stateMutability": "nonpayable"
    },
    {
        "type": "function",
        "name": "name",
        "inputs": [],
        "outputs": [
            {
                "name": "",
                "type": "string",
                "internalType": "string"
            }
        ],
        "stateMutability": "view"
    },
    {
        "type": "function",
        "name": "nonces",
        "inputs": [
            {
                "name": "owner",
                "type": "address",
                "internalType": "address"
            }
        ],
        "outputs": [
            {
                "name": "result",
                "type": "uint256",
                "internalType": "uint256"
            }
        ],
        "stateMutability": "view"
    },
    {
        "type": "function",
        "name": "pause",
        "inputs": [],
        "outputs": [],
        "stateMutability": "nonpayable"
    },
    {
        "type": "function",
        "name": "paused",
        "inputs": [],
        "outputs": [
            {
                "name": "",
                "type": "bool",
                "internalType": "bool"
            }
        ],
        "stateMutability": "view"
    },
    {
        "type": "function",
        "name": "pauser",
        "inputs": [
            {
                "name": "",
                "type": "address",
                "internalType": "address"
            }
        ],
        "outputs": [
            {
                "name": "",
                "type": "bool",
                "internalType": "bool"
            }
        ],
        "stateMutability": "view"
    },
    {
        "type": "function",
        "name": "permit",
        "inputs": [
            {
                "name": "owner",
                "type": "address",
                "internalType": "address"
            },
            {
                "name": "spender",
                "type": "address",
                "internalType": "address"
            },
            {
                "name": "value",
                "type": "uint256",
                "internalType": "uint256"
            },
            {
                "name": "deadline",
                "type": "uint256",
                "internalType": "uint256"
            },
            {
                "name": "v",
                "type": "uint8",
                "internalType": "uint8"
            },
            {
                "name": "r",
                "type": "bytes32",
                "internalType": "bytes32"
            },
            {
                "name": "s",
                "type": "bytes32",
                "internalType": "bytes32"
            }
        ],
        "outputs": [],
        "stateMutability": "nonpayable"
    },
    {
        "type": "function",
        "name": "pool",
        "inputs": [],
        "outputs": [
            {
                "name": "",
                "type": "address",
                "internalType": "contract IUniswapV3Pool"
            }
        ],
        "stateMutability": "view"
    },
    {
        "type": "function",
        "name": "rebalance",
        "inputs": [],
        "outputs": [],
        "stateMutability": "nonpayable"
    },
    {
        "type": "function",
        "name": "renounceOwnership",
        "inputs": [],
        "outputs": [],
        "stateMutability": "nonpayable"
    },
    {
        "type": "function",
        "name": "restrictedMint",
        "inputs": [],
        "outputs": [
            {
                "name": "",
                "type": "bool",
                "internalType": "bool"
            }
        ],
        "stateMutability": "view"
    },
    {
        "type": "function",
        "name": "setPauser",
        "inputs": [
            {
                "name": "_pauser",
                "type": "address",
                "internalType": "address"
            },
            {
                "name": "_status",
                "type": "bool",
                "internalType": "bool"
            }
        ],
        "outputs": [],
        "stateMutability": "nonpayable"
    },
    {
        "type": "function",
        "name": "setRestrictedMint",
        "inputs": [
            {
                "name": "_status",
                "type": "bool",
                "internalType": "bool"
            }
        ],
        "outputs": [],
        "stateMutability": "nonpayable"
    },
    {
        "type": "function",
        "name": "setRouter",
        "inputs": [
            {
                "name": "_router",
                "type": "address",
                "internalType": "address"
            },
            {
                "name": "_status",
                "type": "bool",
                "internalType": "bool"
            }
        ],
        "outputs": [],
        "stateMutability": "nonpayable"
    },
    {
        "type": "function",
        "name": "swapRouter",
        "inputs": [
            {
                "name": "",
                "type": "address",
                "internalType": "address"
            }
        ],
        "outputs": [
            {
                "name": "",
                "type": "bool",
                "internalType": "bool"
            }
        ],
        "stateMutability": "view"
    },
    {
        "type": "function",
        "name": "symbol",
        "inputs": [],
        "outputs": [
            {
                "name": "",
                "type": "string",
                "internalType": "string"
            }
        ],
        "stateMutability": "view"
    },
    {
        "type": "function",
        "name": "syncToFactory",
        "inputs": [],
        "outputs": [],
        "stateMutability": "nonpayable"
    },
    {
        "type": "function",
        "name": "token0",
        "inputs": [],
        "outputs": [
            {
                "name": "",
                "type": "address",
                "internalType": "contract IERC20"
            }
        ],
        "stateMutability": "view"
    },
    {
        "type": "function",
        "name": "token1",
        "inputs": [],
        "outputs": [
            {
                "name": "",
                "type": "address",
                "internalType": "contract IERC20"
            }
        ],
        "stateMutability": "view"
    },
    {
        "type": "function",
        "name": "totalSupply",
        "inputs": [],
        "outputs": [
            {
                "name": "result",
                "type": "uint256",
                "internalType": "uint256"
            }
        ],
        "stateMutability": "view"
    },
    {
        "type": "function",
        "name": "transfer",
        "inputs": [
            {
                "name": "to",
                "type": "address",
                "internalType": "address"
            },
            {
                "name": "amount",
                "type": "uint256",
                "internalType": "uint256"
            }
        ],
        "outputs": [
            {
                "name": "",
                "type": "bool",
                "internalType": "bool"
            }
        ],
        "stateMutability": "nonpayable"
    },
    {
        "type": "function",
        "name": "transferFrom",
        "inputs": [
            {
                "name": "from",
                "type": "address",
                "internalType": "address"
            },
            {
                "name": "to",
                "type": "address",
                "internalType": "address"
            },
            {
                "name": "amount",
                "type": "uint256",
                "internalType": "uint256"
            }
        ],
        "outputs": [
            {
                "name": "",
                "type": "bool",
                "internalType": "bool"
            }
        ],
        "stateMutability": "nonpayable"
    },
    {
        "type": "function",
        "name": "transferOwnership",
        "inputs": [
            {
                "name": "newOwner",
                "type": "address",
                "internalType": "address"
            }
        ],
        "outputs": [],
        "stateMutability": "nonpayable"
    },
    {
        "type": "function",
        "name": "uniswapV3MintCallback",
        "inputs": [
            {
                "name": "amount0Owed",
                "type": "uint256",
                "internalType": "uint256"
            },
            {
                "name": "amount1Owed",
                "type": "uint256",
                "internalType": "uint256"
            },
            {
                "name": "",
                "type": "bytes",
                "internalType": "bytes"
            }
        ],
        "outputs": [],
        "stateMutability": "nonpayable"
    },
    {
        "type": "function",
        "name": "uniswapV3SwapCallback",
        "inputs": [
            {
                "name": "amount0Delta",
                "type": "int256",
                "internalType": "int256"
            },
            {
                "name": "amount1Delta",
                "type": "int256",
                "internalType": "int256"
            },
            {
                "name": "",
                "type": "bytes",
                "internalType": "bytes"
            }
        ],
        "outputs": [],
        "stateMutability": "nonpayable"
    },
    {
        "type": "function",
        "name": "unpause",
        "inputs": [],
        "outputs": [],
        "stateMutability": "nonpayable"
    },
    {
        "type": "function",
        "name": "updateManagerParams",
        "inputs": [
            {
                "name": "newManagerFeeBPS",
                "type": "int16",
                "internalType": "int16"
            },
            {
                "name": "newManagerTreasury",
                "type": "address",
                "internalType": "address"
            },
            {
                "name": "newSlippageBPS",
                "type": "int16",
                "internalType": "int16"
            },
            {
                "name": "newSlippageInterval",
                "type": "int32",
                "internalType": "int32"
            }
        ],
        "outputs": [],
        "stateMutability": "nonpayable"
    },
    {
        "type": "function",
        "name": "upperTick",
        "inputs": [],
        "outputs": [
            {
                "name": "",
                "type": "int24",
                "internalType": "int24"
            }
        ],
        "stateMutability": "view"
    },
    {
        "type": "function",
        "name": "version",
        "inputs": [],
        "outputs": [
            {
                "name": "",
                "type": "string",
                "internalType": "string"
            }
        ],
        "stateMutability": "view"
    },
    {
        "type": "function",
        "name": "withdrawManagerBalance",
        "inputs": [],
        "outputs": [],
        "stateMutability": "nonpayable"
    },
    {
        "type": "function",
        "name": "worstAmountOut",
        "inputs": [
            {
                "name": "amountIn",
                "type": "uint256",
                "internalType": "uint256"
            },
            {
                "name": "slippageBPS",
                "type": "uint16",
                "internalType": "uint16"
            },
            {
                "name": "avgSqrtPriceX96",
                "type": "uint160",
                "internalType": "uint160"
            },
            {
                "name": "zeroForOne",
                "type": "bool",
                "internalType": "bool"
            }
        ],
        "outputs": [
            {
                "name": "",
                "type": "uint256",
                "internalType": "uint256"
            }
        ],
        "stateMutability": "pure"
    },
    {
        "type": "event",
        "name": "Approval",
        "inputs": [
            {
                "name": "owner",
                "type": "address",
                "indexed": true,
                "internalType": "address"
            },
            {
                "name": "spender",
                "type": "address",
                "indexed": true,
                "internalType": "address"
            },
            {
                "name": "amount",
                "type": "uint256",
                "indexed": false,
                "internalType": "uint256"
            }
        ],
        "anonymous": false
    },
    {
        "type": "event",
        "name": "Burned",
        "inputs": [
            {
                "name": "receiver",
                "type": "address",
                "indexed": false,
                "internalType": "address"
            },
            {
                "name": "burnAmount",
                "type": "uint256",
                "indexed": false,
                "internalType": "uint256"
            },
            {
                "name": "amount0Out",
                "type": "uint256",
                "indexed": false,
                "internalType": "uint256"
            },
            {
                "name": "amount1Out",
                "type": "uint256",
                "indexed": false,
                "internalType": "uint256"
            },
            {
                "name": "liquidityBurned",
                "type": "uint128",
                "indexed": false,
                "internalType": "uint128"
            }
        ],
        "anonymous": false
    },
    {
        "type": "event",
        "name": "FeesEarned",
        "inputs": [
            {
                "name": "feesEarned0",
                "type": "uint256",
                "indexed": false,
                "internalType": "uint256"
            },
            {
                "name": "feesEarned1",
                "type": "uint256",
                "indexed": false,
                "internalType": "uint256"
            }
        ],
        "anonymous": false
    },
    {
        "type": "event",
        "name": "Minted",
        "inputs": [
            {
                "name": "receiver",
                "type": "address",
                "indexed": false,
                "internalType": "address"
            },
            {
                "name": "mintAmount",
                "type": "uint256",
                "indexed": false,
                "internalType": "uint256"
            },
            {
                "name": "amount0In",
                "type": "uint256",
                "indexed": false,
                "internalType": "uint256"
            },
            {
                "name": "amount1In",
                "type": "uint256",
                "indexed": false,
                "internalType": "uint256"
            },
            {
                "name": "liquidityMinted",
                "type": "uint128",
                "indexed": false,
                "internalType": "uint128"
            }
        ],
        "anonymous": false
    },
    {
        "type": "event",
        "name": "OwnershipTransferred",
        "inputs": [
            {
                "name": "previousManager",
                "type": "address",
                "indexed": true,
                "internalType": "address"
            },
            {
                "name": "newManager",
                "type": "address",
                "indexed": true,
                "internalType": "address"
            }
        ],
        "anonymous": false
    },
    {
        "type": "event",
        "name": "Paused",
        "inputs": [
            {
                "name": "account",
                "type": "address",
                "indexed": false,
                "internalType": "address"
            }
        ],
        "anonymous": false
    },
    {
        "type": "event",
        "name": "PauserSet",
        "inputs": [
            {
                "name": "pauser",
                "type": "address",
                "indexed": true,
                "internalType": "address"
            },
            {
                "name": "status",
                "type": "bool",
                "indexed": false,
                "internalType": "bool"
            }
        ],
        "anonymous": false
    },
    {
        "type": "event",
        "name": "Rebalance",
        "inputs": [
            {
                "name": "compounder",
                "type": "address",
                "indexed": true,
                "internalType": "address"
            },
            {
                "name": "lowerTick_",
                "type": "int24",
                "indexed": false,
                "internalType": "int24"
            },
            {
                "name": "upperTick_",
                "type": "int24",
                "indexed": false,
                "internalType": "int24"
            },
            {
                "name": "liquidityBefore",
                "type": "uint128",
                "indexed": false,
                "internalType": "uint128"
            },
            {
                "name": "liquidityAfter",
                "type": "uint128",
                "indexed": false,
                "internalType": "uint128"
            }
        ],
        "anonymous": false
    },
    {
        "type": "event",
        "name": "RestrictedMintSet",
        "inputs": [
            {
                "name": "status",
                "type": "bool",
                "indexed": false,
                "internalType": "bool"
            }
        ],
        "anonymous": false
    },
    {
        "type": "event",
        "name": "RouterSet",
        "inputs": [
            {
                "name": "router",
                "type": "address",
                "indexed": true,
                "internalType": "address"
            },
            {
                "name": "status",
                "type": "bool",
                "indexed": false,
                "internalType": "bool"
            }
        ],
        "anonymous": false
    },
    {
        "type": "event",
        "name": "Transfer",
        "inputs": [
            {
                "name": "from",
                "type": "address",
                "indexed": true,
                "internalType": "address"
            },
            {
                "name": "to",
                "type": "address",
                "indexed": true,
                "internalType": "address"
            },
            {
                "name": "amount",
                "type": "uint256",
                "indexed": false,
                "internalType": "uint256"
            }
        ],
        "anonymous": false
    },
    {
        "type": "event",
        "name": "Unpaused",
        "inputs": [
            {
                "name": "account",
                "type": "address",
                "indexed": false,
                "internalType": "address"
            }
        ],
        "anonymous": false
    },
    {
        "type": "event",
        "name": "UpdateManagerParams",
        "inputs": [
            {
                "name": "managerFeeBPS",
                "type": "uint16",
                "indexed": false,
                "internalType": "uint16"
            },
            {
                "name": "managerTreasury",
                "type": "address",
                "indexed": false,
                "internalType": "address"
            },
            {
                "name": "compounderSlippageBPS",
                "type": "uint16",
                "indexed": false,
                "internalType": "uint16"
            },
            {
                "name": "compounderSlippageInterval",
                "type": "uint32",
                "indexed": false,
                "internalType": "uint32"
            }
        ],
        "anonymous": false
    },
    {
        "type": "error",
        "name": "AllowanceOverflow",
        "inputs": []
    },
    {
        "type": "error",
        "name": "AllowanceUnderflow",
        "inputs": []
    },
    {
        "type": "error",
        "name": "InsufficientAllowance",
        "inputs": []
    },
    {
        "type": "error",
        "name": "InsufficientBalance",
        "inputs": []
    },
    {
        "type": "error",
        "name": "InvalidPermit",
        "inputs": []
    },
    {
        "type": "error",
        "name": "Permit2AllowanceIsFixedAtInfinity",
        "inputs": []
    },
    {
        "type": "error",
        "name": "PermitExpired",
        "inputs": []
    },
    {
        "type": "error",
        "name": "Reentrancy",
        "inputs": []
    },
    {
        "type": "error",
        "name": "TotalSupplyOverflow",
        "inputs": []
        }
]
```
