Smart Contracts

Every contract in the system by area — core, clearing, system, token and locking, access control — and what the Full and Lite deployments each carry.

All contracts are written in Solidity 0.8.23, use OpenZeppelin v5 upgradeable proxies, and follow the TransparentUpgradeableProxy pattern (each proxy has its own ProxyAdmin).

Core Contracts#

ContractDescription
LendingPoolManager.solEntry point for all lending pool interactions (deposits, withdrawals, clearing, configuration)
LendingPoolFactory.solCreates new lending pools using the beacon proxy pattern
LendingPool.solLedger of pool balances. Also an ERC-20 token representing total pool value relative to USDC
PendingPool.solERC-721 contract managing pending deposit/withdrawal requests (D-NFTs and W-NFTs)
LendingPoolTranche.solERC-4626 vault for tranche shares. Also handles ERC-1155 unrealized loss tokens
LendingPoolTrancheLoss.solHandles loss reporting, ERC-1155 loss token minting, and loss recovery claims
FixedTermDeposit.solManages fixed-duration deposits with guaranteed interest rates

Clearing Contracts#

ContractDescription
ClearingCoordinator.solOrchestrates the 5-step clearing process for all lending pools
ClearingSteps.solAbstract contract extended by PendingPool for clearing execution
PendingRequestsPriorityCalculation.solStep 2: Calculates request priority by loyalty level
AcceptedRequestsCalculation.solStep 3: Calculates accepted deposit/withdrawal amounts
AcceptedRequestsExecution.solStep 4: Executes accepted requests

System Contracts#

ContractDescription
SystemVariables.solGlobal configuration: epoch timing, KSU price, performance fee, loyalty thresholds, fee rates
UserManager.solCalculates user loyalty levels based on rKSU-to-deposit ratio
UserLoyaltyRewards.solKSU token rewards for LPs based on active liquidity and loyalty level
FeeManager.solCollects and distributes performance fees (ecosystem fees to rKSU holders, protocol fees to claimers)
KasuAllowList.solKYC verification via TxAuthData signatures, manual allowlisting, and blocklisting
KasuKycSigner.solERC-1271 signer configured on each allow list; holds the address derived from Kasu's KMS signing key
KsuPrice.solFetches KSU token price from the Chainsight oracle
Swapper.solManages an allowlist of approved exchange addresses for token swaps
KasuPoolExternalTVL.solERC-1155 contract for tracking off-chain TVL per lending pool

Token & Locking Contracts#

ContractDescription
KSU.solERC-20 KSU token with permit and burn (symbol: KSU, supply: 1B)
rKSU.solNon-transferable receipt token for locked KSU
KSULocking.solKSU token locking with proportional fee distribution, extends rKSU
KSULockBonus.solHolds and distributes bonus KSU tokens for the locking program

Access Control#

ContractDescription
KasuController.solSystem administration, role management, pause/unpause
Roles.solRole constant definitions

Deployment Modes#

ModeNetworksToken ContractsLockingLoyalty
FullBaseAll contractsActiveActive
LiteXDC (AUDD), XDC (USDC)Lite variants (*Lite.sol)DisabledDisabled

Lite deployments use override contracts (KsuPriceLite, UserManagerLite, UserLoyaltyRewardsLite, ProtocolFeeManagerLite, KSULockingLite) that disable token-dependent functionality while maintaining the same interface for KYC, deposits, and clearing.