Technical Integration Guide

Smart contract integration guide and examples

Overview

Kodiak Islands are concentrated liquidity management vaults built on top of Kodiak V3 pools. This guide covers the technical aspects of integrating with Kodiak Islands from a smart contract perspective.

1. Usage with existing/Deployed Islands

What can be achieved

  1. Depositing into existing Islands

  2. Withdrawing from existing Islands

  3. Checking current island position

  4. Checking current fee earned

  5. Calling rebalance to invest any pending fees

Prerequisites

Before integrating with Kodiak Islands, you should understand:

  1. Kodiak V3 concentrated liquidity concepts

  2. ERC20 token standards and approvals

  3. Basic understanding of what's slippage and slippage protection mechanisms

  4. Deployed contract addresses

  5. Understanding of token ratio that is needed to deposit tokens into the island.

  6. Finding the correct deposit params for double sided token deposits.

  7. Finding the correct deposit and swap params for single sided token deposits.

Refer the section on Understanding Token Deposit Ratio for in dept guide.

Core Contracts

The main contracts involved for integration with existing islands are:

  1. Island Router Contract: Handles complex operations like zaps and slippage protection

  2. Island Contract: The actual vault contract managing the Kodiak V3 position

Integration Examples

1. Basic Position Information

2. Depositing with Both Tokens

3. Single Token Deposits (Zaps)

For single token deposits, the swap calldata needs to be prepared off-chain using the Kodiak Quoter API. The process involves:

  1. Getting the optimal swap amount using the formula:

  1. Using the Kodiak Quoter API to get the swap calldata (refer to the Kodiak API Documentation)

  2. Implementing the deposit:

4. Withdrawing Liquidity

5. Rebalancing and Fee Collection

2. Deploying new Islands

What can be achieved

  1. Deploying new managed Islands

  2. Deploying new Permissionless Islands

  3. Enabling mint for everyone for deployed Islands

  4. Managing deployed Island parameters and position

  5. Collecting Fees

  6. Giving up ownership of deployed Islands

Prerequisites

Before deploying new Islands, you should understand:

  1. Kodiak V3 concentrated liquidity concepts

  2. Openzeppelin Minimal Proxy Contracts

  3. Island management parameters and fee structures

Core Contracts

The main contracts involved in deployment are:

  1. Island Factory Contract: Creates new Island instances

  2. Island Implementation Contract: The base contract that gets cloned

Deployment Examples

1. Deploying a Managed Island

2. Deploying a Permissionless Island

Important Notes

  1. Tick Spacing: Ensure ticks align with pool's tick spacing otherwise an error will be thrown

  2. Token Ordering: Factory handles token ordering internally

  3. Fee Limits: Manager fees cannot exceed 10000 BPS (100%)

  4. Permissionless vs Managed: Understand the differences in parameters to deploy managed vs permissionless islands

  5. Enabling Minting: You need to enable minting for everyone for managed islands

  6. Rebalance: You need to call rebalance on the island for compounding earned fee back into the position.

  7. Permissionless Islands Frontend listing: You need to contact the Kodiak team to get your permissionless island listed on the kodiak frontend.

Security Considerations

  1. Always use the router for deposits/withdrawals to ensure proper slippage protection

  2. Validate all parameters before deployment

  3. Test with small amounts first

  4. Be cautious with manager permissions, use islands only from trusted managers.

  5. Implement proper access control in integrating contracts

  6. Monitor gas costs, especially for operations involving swaps

Last updated