contracts
contracts copied to clipboard
Smart contracts for the Raft protocol
Raft: Smart Contracts
Raft is an immutable, decentralized lending protocol that allows people to take out stablecoin loans against capital-efficient collateral.
R is the first Ethereum USD stablecoin solely backed by stETH (Lido Staked Ether). R provides the most capital-efficient way to borrow using your stETH. R aims to be the stablecoin of choice within the decentralized ecosystem, with deep liquidity across many trading pairs and a stable peg.
This repository contains the Raft smart contracts written in Solidity. To learn more about Raft, please visit our website and docs.
Getting Started
Prerequisites
To build and test the Raft smart contracts, you will need the following:
Installation
Clone the repository with its submodules, set up Foundry, and install the dependencies via Yarn:
yarn install
Testing
To run the tests, run the following command:
forge test
Static Analysis
To run the Slither static analysis tool, run the following command:
slither .
Contracts
Core Contracts
Contract | Description |
---|---|
PositionManager |
The entry point for managing positions. It also handles the logic for borrowing R tokens and repayment of the debt, as well as liquidations and redemptions. |
RToken |
An ERC-20 token designed to retain a value of 1 USD. R can be minted and burnt only by PositionManager . |
ERC20Indexable |
Rebase token which is used as the debt token implementation. |
SplitLiquidationCollateral |
Used by PositionManager to calculate how liquidated collateral should be split between the liquidator and the protocol. |
PriceFeed |
Retrieves asset prices from a primary oracle, using a secondary oracle as a fallback when the primary is unavailable or compromised |
ChainlinkPriceOracleWstETH |
Chainlink oracle integration contract. |
TellorPriceOracleWstETH |
Tellor oracle integration contract. |
Periphery Contracts
Contract | Description |
---|---|
PositionManagerStETH |
Allows managing positions with ETH or stETH collateral. Responsible for wrapping/unwrapping ETH and stETH into/from wstETH. It has to be whitelisted by a user in PositionManager . |
OneStepLeverage |
Facilitates opening, closing, or adjusting leverage on wstETH positions with a single transaction, employing flash mint to streamline the process and reduce transaction complexity. |
OneStepLeverageStETH |
Extends the functionality of OneStepLeverage to allow using ETH and stETH. |
FlashMintLiquidator |
Facilitates the liquidation of undercollateralized positions in a single transaction, employing flash loans to streamline the process. |
ParaSwapAMM |
ParaSwap integration contract. Can be used by OneStepLeverage , OneStepLeverageStETH and FlashMintLiquidator . |
BalancerAMM |
Balancer integration contract. Can be used by OneStepLeverage , OneStepLeverageStETH and FlashMintLiquidator . |