Smart Contracts
Comprehensive documentation for Cylend's Solidity smart contracts
Overview
Cylend's smart contract architecture consists of two primary contracts deployed across two networks:
PrivateLendingIngress
Mantle Sepolia
Public settlement layer contract managing deposits and fund releases
- • Deposit creation (native & ERC20)
- • Action submission
- • Fund release handling
- • Liquidity tracking
LendingCore
Sapphire Testnet
Private computation contract handling encrypted lending operations
- • Encrypted action processing
- • Position management
- • Health factor calculations
- • Price oracle integration
Contract Addresses
Deployed contract addresses on testnet networks:
Mantle Sepolia Testnet
0xeee5Cbff1b1E41d98c5530296E9f0B079B38F7f10xeee5Cbff1b1E41d98c5530296E9f0B079B38F7f10x24B255dB2e2D227ceaf8E474f68e342A4Cd32cB2Sapphire Testnet
0x22BFa5A91CBE80C649f56cD423bF43847566b5Ba0xec9035501dfff50059bd1d512d8347d722f4ce95...These are testnet deployments. Production addresses will be different and will be updated here when available.
Development & Testing
The contracts are developed with Hardhat and include comprehensive test suites:
Local Development
Set up local Hardhat environment for contract development:
# Install dependencies
npm install
# Compile contracts
npx hardhat compile
# Run tests
npx hardhat test
# Run tests with coverage
npx hardhat coverageDeployment
Deploy contracts to testnets using Hardhat Ignition:
# Deploy to Mantle Sepolia
npx hardhat ignition deploy ./ignition/modules/Ingress.ts --network mantle-sepolia
# Deploy to Sapphire Testnet
npx hardhat ignition deploy ./ignition/modules/LendingCore.ts --network sapphire-testnet
# Verify contracts
npx hardhat verify --network mantle-sepolia <CONTRACT_ADDRESS>See the Deployment Guide for detailed deployment instructions and best practices.
Security Considerations
Key security features and access control mechanisms:
Owner-Only Functions
Critical functions like processAction() are protected with onlyOwner modifier
Deposit Ownership
Deposits can only be used by their creators, preventing unauthorized fund access
Health Factor Checks
All borrow and withdraw operations validate health factors to prevent under-collateralization
Price Staleness
Oracle prices are checked for staleness before processing actions
Trusted Hyperlane Messages
Only messages from trusted Hyperlane routers are accepted for cross-chain communication