Raila Circles

Use Circles' trust graph to make peer-to-peer uncollateralized lending with relaying

Raila Circles

Created At

ETHGlobal Buenos Aires

Winner of

Circles

Circles - Build a P2P Loan Market based on Circles Network 1st place

Project Description

Two parts: A contract, as a Safe Module, and a Frontend to act as an alpha GUI to interact with the protocol. The Safe Module acts as a HUB in which Circle Accounts can enable to offer their liquidity to people they trust, within some limits and settings, such as a cap, minimum interest rate... It also allows the users to act as a Relayer: some users may be trusted by other users with no liquidity. The relayer can be made to autoborrow at a lower interest rate, so they autolend at a higher interest rate, closer to the original borrower. They can demand a borrowing cap, max IR, and a minimum margin of profit for this relaying risk.

The Frontend is a GUI to showcase the project. Ideally, this would be integrated within Metri, but since that's not possible, this Frontend explains to you how to setup an external account as controller in their Metri Safe Wallet. The user is expected to connect with something like Rabby as the Safe. Then they can (if they want to lend), enable the Safe module and choose their settings. Whatever USDC.e they have laying around in that wallet, will be used as liquidity. They also can check their immediate circle of trust, and borrow. (TODO: make multiple borrows, and use the pathing feature. Right now the frontend doesn't let you borrow along the path, but it's implemented and tested in the contract) They can also check all their loans and debts, and repay their debts.

Debts can also be paid along a path!

How it's Made

Foundry for the Raila Module. I also made some light tests with it. Contract verified on Gnosisscan. This module is deployed in Gnosis Chain, and is a Safe Module (connects and compatible with Safe{Wallet}) I got inspiration with how Aave needs to use linear interest with optional compounding whenever people update the value, had a similar issue. The frontend uses Vite, Tailwind, viem/wagmi. It uses the Circles SDK (confusingly in @aboutcircles/sdk, but there's a deprecated version flying around that tripped me off). Thanks to Rabby wallet I was able to not need to make this a Safe App, super convenient.

background image mobile

Join the mailing list

Get the latest news and updates