Skip to content

Radiance Protocol is a permissionless lending market that offers a unique solution to the problems of impermanent loss and lost collateral opportunity in the DeFi space

Notifications You must be signed in to change notification settings

avour/raydiance-core

Repository files navigation


Radiance

Radiance Protocol is a permissionless lending market that offers a unique solution to the problems of impermanent loss and lost collateral opportunity in the DeFi space. Radiance supports markets available on OpenBook https://www.openbook-solana.com/

Why Radiance

Impermanent loss is a major concern in the DeFi lending market, deterring many risk-averse investors from entering the market.

Lending markets do not generally accept LP tokens to be used as collateral, even if they are backed by acceptable assets. Tokenized asset loans can serve various purposes such as boosting leverage, reducing risk through hedging, and deferring capital gains. As a result, holding funds in LP tokens incurs an opportunity cost.

Radiance solves this problem by offering a platform where LP tokens can be used as collateral to borrow other tokens, reducing the risk of impermanent loss and earning yield in the process. Borrowers can also leverage their LP tokens to lock up assets and increase their yield.

Features

  • Use LP tokens as collateral to borrow other tokens

Product Name Screen Shot

  • Earn yield by lending tokens to borrowers

Product Name Screen Shot

  • Reduce risk of impermanent loss

Product Name Screen Shot

  • Borrowers can leverage their LP tokens to lock up assets and increase their yield

Product Name Screen Shot

Vision

Radiance aims to become the world's top lending marketplace based on LP tokens, solving the problems of lost collateral opportunity and impermanent loss in the current LP market. Join us on our mission to revolutionize the DeFi lending market.

(back to top)

Rust API Reference

Create a pool

create_pool(ctx: Context<CreatePool>, input: CreatePoolInput) -> Result<()>

This function allows the caller to create a new pool in the Radiance lending market.

Deposit collateral

deposit_collateral(ctx: Context<DepositCollateral>, input: DepositCollateralInput) -> Result<()>

This function allows the caller to deposit collateral to an existing pool in the Radiance lending market.

Withdraw collateral

withdraw_collateral(ctx: Context<WithdrawCollateral>, input: WithdrawCollateralInput) -> Result<()>

This function allows the caller to withdraw collateral from an existing pool in the Radiance lending market.

Borrow tokens

borrow(ctx: Context<Borrow>, input: BorrowInput) -> Result<()>

This function allows the caller to borrow tokens from an existing pool in the Radiance lending market.

Repay loan

repay_loan(ctx: Context<RepayLoan>, input: RepayLoanInput) -> Result<()>

This function allows the caller to repay a loan that was previously taken from an existing pool in the Radiance lending market.

Supply borrowable tokens

supply_borrowable(ctx: Context<SupplyBorrowable>, input: SupplyBorrowableInput) -> Result<()>

This function allows the caller to add to the supply of borrowable tokens in an existing pool in the Radiance lending market.

Withdraw borrowable tokens

withdraw_borrowable(ctx: Context<WithdrawBorrowable>, input: WithdrawBorrowableInput) -> Result<()>

This function allows the caller to withdraw borrowable tokens from an existing pool in the Radiance lending market.

Calculation of Collateral Needed

Given:

  • amount0, amount1: number of Token0 and Token1 borrowed
  • price0, price1: how many LP Tokens are worth one Token0 and one Token1

We can calculate the value of the loan in LP Tokens:

value0 = amount0 * price0

value1 = amount1 * price1

And finally, calculate the amount of Collateral needed:

if value0 >= value1

counterAllNeeded = (value0 * sqrt(safetyMargin) + value1 * sqrt(safetyMargin)) * liquidityIncrease

if value0 < value1

counterAllNeeded = (value0 * sqrt(safetyMargin) + value1 * sqrt(safetyMargin)) * liquidityIncrease

where safetyMargin and liquidationIncentive are constants in the system.

(back to top)

About

Radiance Protocol is a permissionless lending market that offers a unique solution to the problems of impermanent loss and lost collateral opportunity in the DeFi space

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published