Batch settlement orchestration contract for the KAM (Keyrock Asset Management) protocol. The kSettler contract manages complex batch settlement processes including rebalancing, fee calculations, asset netting, and profit distribution for delta-neutral vaults.
For detailed technical documentation including architecture, settlement flows, and fee models, see docs/architecture.md.
git clone https://github.com/turingcapitalgroup/kam-settler.git
cd kam-settler
forge installmake build
# or
forge buildmake test
# or
forge testmake format
# or
forge fmtmake coverageNetwork configurations are stored in deployments/config/:
mainnet.json- Ethereum mainnet settingssepolia.json- Sepolia testnet settingslocalhost.json- Local development settings
Each config specifies:
- KAM registry address
- Role addresses (owner, admin, relayer)
Create a .env file:
RPC_MAINNET=<mainnet-rpc-url>
RPC_SEPOLIA=<sepolia-rpc-url>
DEPLOYER_ADDRESS=<deployer-address>
ETHERSCAN_MAINNET_KEY=<etherscan-api-key>
ETHERSCAN_SEPOLIA_KEY=<etherscan-api-key># Mainnet
make deploy-mainnet
make deploy-mainnet-dry-run # Simulate without broadcasting
# Sepolia
make deploy-sepolia
make deploy-sepolia-dry-run
# Localhost (full stack: KAM + kSettler)
make deploy-localhost
# Localhost (kSettler only, requires existing KAM deployment)
make deploy-settler-localhostmake verify-mainnet
make verify-sepoliaThe contract uses role-based access control:
- Owner - Contract owner, can grant roles
- Admin - Administrative operations, can grant relayer role
- Relayer - Executes settlement operations (main operator role)
- forge-std v1.10.0
- KAM v1
- minimal-smart-account v1.0
- Solidity: 0.8.30
- Framework: Foundry
- Optimizer: Enabled with 10,000 runs
- Via IR: Enabled
MIT