Contracts
Solidity 0.8.28, Foundry, OpenZeppelin v5.1.0. None of these are deployed.
RobinLendP2P
The peer to peer core. One lender, one borrower, one loan.
| Entry point | Who | What it does |
|---|---|---|
take(offer, signature) |
borrower | Verifies the EIP-712 offer, pulls collateral, moves USDG lender to borrower |
repay(loanId, to) |
borrower | Pays principal plus interest, releases collateral to any address |
liquidate(loanId) |
anyone | Pays the lender, takes collateral plus bonus, returns the surplus |
burnNonce(nonce) |
lender | Cancels an unsigned-away offer |
setMaxPrincipal(token, cap) |
owner | The measured venue cap. Zero delists |
Bounds the owner cannot cross: liquidation LTV between 20% and 90%, borrow rate at most 100% APR, liquidation bonus at most 15%, protocol fee at most 30% of interest.
RobinLendMarket and RobinLendSwapper
A pooled market with a one-transaction leverage loop, written before the money side was settled as peer to peer. It is kept because its venue cap, its staleness policy and its loop all carry over, and because the loop is what turns a lender into a margin product.
The loop's security is an ordering: the USDG leaves before anything is checked, the collateral has to come back, and the health check at the end is what makes the swap honest. Collateral is measured as the market's own balance delta, never taken from what the swapper claims, so a swapper that lies produces nothing. Four dishonest swappers are in the test suite: one that steals, one that lies, and two that skim.
Tests
| Suite | Tests |
|---|---|
| Peer to peer core | 22 |
| Pooled market | 27 |
| Leverage loop | 12 |
| Position maths (TypeScript) | 33 |
| Total | 94 |
They run on the real decimal shape of this chain: collateral at 18 decimals, USDG at 6, the price feed at 8, and NVDA's real price.
Addresses on Robinhood Chain, 4663
| RPC | https://rpc.mainnet.chain.robinhood.com |
| USDG | 0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168, 6 decimals |
| Uniswap V3 factory | 0x1f7d7550b1b028f7571e69a784071f0205fd2efa |
| Multicall3 | 0xcA11bde05977b3631167028862bE2a173976CA11 |