Documentation

Configuration

Set up environment variables for all Cylend components

Caution

Never commit private keys or sensitive credentials to version control! Use .env.local for local development and secure environment variable management in production.

Frontend Configuration

Create a .env file in the root directory:

.env
# Frontend Configuration
NEXT_PUBLIC_API_URL=
NEXT_PUBLIC_ENABLE_ANALYTICS=false
NEXT_PUBLIC_ENABLE_DEBUG=false

# Contract Addresses
NEXT_PUBLIC_INGRESS_ADDRESS=0xeee5Cbff1b1E41d98c5530296E9f0B079B38F7f1
NEXT_PUBLIC_CORE_ADDRESS=0x22BFa5A91CBE80C649f56cD423bF43847566b5Ba
NEXT_PUBLIC_ROUTER_ADDRESS=0xeee5Cbff1b1E41d98c5530296E9f0B079B38F7f1
NEXT_PUBLIC_ISM_ADDRESS=0x24B255dB2e2D227ceaf8E474f68e342A4Cd32cB2

# Sapphire Public Key for Encryption
NEXT_PUBLIC_LENDING_PUBLIC_KEY=0xec9035501dfff50059bd1d512d8347d722f4ce950667b1abd6fc3a202a231c37

# Token Addresses
NEXT_PUBLIC_WMNT_ADDRESS=0x67A1f4A939b477A6b7c5BF94D97E45dE87E608eF
NEXT_PUBLIC_USDC_ADDRESS=0xAcab8129E2cE587fD203FD770ec9ECAFA2C88080
NEXT_PUBLIC_USDT_ADDRESS=0xcC4Ac915857532ADa58D69493554C6d869932Fe6

# WalletConnect Project ID
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=your_project_id_here

# Ponder GraphQL API
NEXT_PUBLIC_PONDER_API_URL=http://localhost:42069/graphql

# Sapphire RPC (Optional)
NEXT_PUBLIC_SAPPHIRE_RPC_URL=https://testnet.sapphire.oasis.io

Key Variables Explained

NEXT_PUBLIC_INGRESS_ADDRESS

Address of the PrivateLendingIngress contract deployed on Mantle Sepolia

NEXT_PUBLIC_CORE_ADDRESS

Address of the LendingCore contract deployed on Sapphire Testnet

NEXT_PUBLIC_LENDING_PUBLIC_KEY

Public key from Sapphire used for client-side encryption of action payloads

NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID

Get your free project ID from WalletConnect Cloud

Ponder Indexer Configuration

Create a .env file in the cylend-indexer/ directory:

cylend-indexer/.env
# Ponder Indexer Configuration
PONDER_RPC_URL_MANTLE_SEPOLIA=https://rpc.sepolia.mantle.xyz
PONDER_RPC_URL_SAPPHIRE_TESTNET=https://testnet.sapphire.oasis.io

# Contract Addresses (Optional, defaults from ponder.config.ts)
INGRESS_ADDRESS=0xeee5Cbff1b1E41d98c5530296E9f0B079B38F7f1
CORE_ADDRESS=0x22BFa5A91CBE80C649f56cD423bF43847566b5Ba
Note

Ponder uses these RPC URLs to fetch blockchain events. For production, consider using dedicated RPC providers like Alchemy, Infura, or QuickNode for better reliability and rate limits.

Backend Service Configuration

Create a .env file in the cylend-service/ directory:

cylend-service/.env
# Backend Service Configuration
PONDER_API_URL=http://localhost:42069/graphql
SAPPHIRE_RPC_URL=https://testnet.sapphire.oasis.io

# LendingCore Contract Address
CORE_ADDRESS=0x22BFa5A91CBE80C649f56cD423bF43847566b5Ba

# Owner Private Key (KEEP SECRET!)
OWNER_PRIVATE_KEY=0x...

# Optional Settings
POLL_INTERVAL=10000          # Polling interval in ms (default: 10000)
MAX_RETRIES=3                # Max retries for failed transactions (default: 3)
RETRY_DELAY=5000             # Delay between retries in ms (default: 5000)
LOG_LEVEL=info               # Log level: debug, info, warn, error (default: info)
Caution

Security Warning: The OWNER_PRIVATE_KEY must be the private key of the deployer address with permissions to call processAction() on LendingCore. Store this securely using environment variable managers or secret vaults in production.

Network Configuration

Ensure your wallet is configured for the following networks:

Mantle Sepolia Testnet

Network Name: Mantle Sepolia
RPC URL: https://rpc.sepolia.mantle.xyz
Chain ID: 5003
Currency: MNT
Explorer: mantlescan.xyz

Sapphire Testnet

Network Name: Sapphire Testnet
RPC URL: https://testnet.sapphire.oasis.io
Chain ID: 23295
Currency: TEST

Verify Configuration

After setting up all environment variables, verify your configuration:

1

Check that all .env files are created

Root, cylend-indexer/, and cylend-service/

2

Verify contract addresses are correct

Match with deployment receipts or block explorers

3

Test RPC connectivity

Ensure RPCs are accessible and responsive

4

Add .env files to .gitignore

Prevent accidental commits of secrets

Next Steps

Configuration complete! Now you're ready to run the project: