# Contract Specs

## <mark style="color:purple;">Overview</mark>

Cluster is built with a modular architecture combining Compound-style market mechanics with cross-chain execution powered by [<mark style="color:purple;">**Stargate**</mark>](https://stargate.finance/). The protocol uses a custom-built smart contract called <mark style="color:purple;">**Cross-Chain Lending Gateway (CLG)**</mark> that manages secure and gas-efficient remote procedure calls between chains.

Cluster's lending logic relies on the Compound V2 model, including `Comptroller` and `Unitroller`, and employs a dynamic interest rate model called `JumpRateModelV2` to optimize capital efficiency.

### <mark style="color:purple;">Main components</mark>

1. **CLG (Cross-Chain Lending Gateway)**: Handles all cross-chain logic, translating user actions from one chain to another.
2. **Comptroller and Unitroller**: Core governance and risk management contracts adapted from Compound V2.
3. **cTokens**: Interest-bearing tokens representing user deposits.
4. **JumpRateModelV2**: Interest rate model that dynamically adjusts borrow and supply rates based on pool utilization.

### <mark style="color:purple;">Key user actions</mark>

* Supply assets on Chain A and borrow on Chain B.
* Repay a loan on Chain B from Chain A.
* Redeem supplied assets across chains.

These actions are routed through the CLG and Stargate to maintain atomicity and security.

{% content-ref url="contract-specs/cross-chain-logic" %}
[cross-chain-logic](https://cluster.gitbook.io/docs/dev-docs/contract-specs/cross-chain-logic)
{% endcontent-ref %}

{% content-ref url="contract-specs/interest-rate-model" %}
[interest-rate-model](https://cluster.gitbook.io/docs/dev-docs/contract-specs/interest-rate-model)
{% endcontent-ref %}
