Preview
Flow
1
Connect wallet
The user connects with MetaMask or a Circle Modular Wallet (WebAuthn
passkey). A unified hook abstracts both wallet types for all contract
interactions.
2
Mint cirBTC from the UI faucet
The user mints cirBTC test tokens directly from the app to use as
collateral. USDC is used as native gas on Arc Testnet.
3
Approve and deposit collateral
The user grants an ERC-20 allowance to the
LendingBorrowing contract, then
deposits cirBTC. The contract locks the collateral for the duration of any
active loan.4
Borrow USDC
The protocol calculates the maximum amount the user can borrow at 50% of the
deposited collateral value. The user borrows USDC up to that limit from the
liquidity pool. Repayment equals the borrowed amount; this implementation
does not accrue interest.
5
Repay loan
The user repays the borrowed USDC in full. Only after full repayment can
collateral be withdrawn.
6
Withdraw collateral
With no active loan, the user withdraws their cirBTC collateral back to
their wallet.
This reference implementation omits two features common in production lending
protocols: liquidation (no mechanism removes positions with insufficient
collateral) and interest accrual (repayment equals the borrowed amount). Add
both before using this as a production foundation. The USDC liquidity pool
must also be funded before users can borrow; the deployment script seeds an
initial pool balance.