/khalani-core

Primary LanguageSolidityMIT LicenseMIT

Khalani Core

Khalani is the first Universal Liquidity Protocol designed from the ground up for the interoperable blockchains. Built to scale permissionlessly with high capital efficiency and security, Khalani is ready to serve as the liquidity foundation for the next 10,000 modular blockchains.

Useful Links


Khalani Architecture

Architecture

img.png

  • Khalani uses Asset Reserves on every connected blockchain to keep custody of provided liquidity. Liquidity Providers can supply single or multiple sided liquidity and expect to withdraw their funds on the same blockchain.
  • A Liquidity Projector monitors the balances of all asset reserves on a connected blockchain and issues mirror tokens as depository receipts for liquidity providers. These depository receipts can be used to redeem against the reserves on the original chain, allowing the assets to stay on the original chain, while the claims against them can be traded outside of it. The functioning of a Liquidity Projector relies on cross-chain messaging and it's tightly coupled with a specific ISM. As such, a projected liquidity token can also be viewed as a mirror token that's bundled with the infrastructure risks associated with the external blockchain and the cross-chain messaging mechanisms, as surfaced by the ISMs deployed on the connected blockchain and the Khalani Chain.
  • The Liquidity Aggregator enables Khalani to aggregate multiple chain-specific asset liquidity into chain-agnostic and fungible liquidity. The protocol can then utilize this aggregated fungible liquidity to enable inter-chain value transfers, essentially operating as a cross-chain market maker.

Inter-chain Liquidty Hub

  • Cross-chain Liquidity Pools (CCLPs) CCLPs are engineered to price inter-chain, same-asset liquidity. Chain-specific, same-asset liquidity (for instance, USDCs from multiple blockchains) are paired with a chain-agnostic Khalani native asset (in this case, klnUSDC). Using a forgiving bonding curve for pricing, these pools allow efficient cross-chain value transfers and incentivize arbitrageurs to maintain equilibrium across various blockchains.
  • Cross-asset Liquidity Pools (CALPs) CALPs bridge similar but different assets, such as USDC, USDT, and other USD-pegged stablecoins. CALPs are paired with Kai, Khalani's native USD-paired stablecoin, allowing liquidity providers to clearly understand their risk exposures.
  • Interchain Liquidity Hub Wrapper This contract functions as both a helper and a wrapper, designed to facilitate a swap within the CCLP and CALP. Its purpose is to assist and complete requests originating from other blockchains. Additionally, it provides functions to streamline the process of liquidity withdrawal and transitioning to another chain through a singular request.

Setup

Dependecies

  • Foundry
$ curl -L https://foundry.paradigm.xyz | bash
$ source ~/.bashrc # or open a new terminal
$ foundryup

Clone

$ git clone --recurse-submodules https://github.com/tvl-labs/khalani-core.git

First time build

$ forge install
$ forge build

Regular Build

$ forge build

In order to run all test

$ forge test