project screenshot 1
project screenshot 2
project screenshot 3
project screenshot 4
project screenshot 5
project screenshot 6

PERP-GHO

PERP-GHO is an on-chain perpetual protocol, that gives Traders and Liquidity providers, the opportunity to trade Crypto, Forex, Metals and any Asset pair, using GHO token and Chainlink price oracle, traders can trade pairs like BTC/ETH, BTC/LINK, EUR/BTC, BTC/XAU etc.

PERP-GHO

Created At

LFGHO

Winner of

Family - Pool Prize

Prize Pool

Project Description

PERP-GHO creates a new use case for GHO tokens as it only accepts liquidity and collateral in GHO tokens, the protocol is primarily made up of two types of users.

  • The Liquidity Providers
  • The Traders

The Liquidity Providers deposit GHO tokens into the protocol, these tokens are held in a Vault (ERC4646), Liquidity providers are issued an ERC20 token representing their share of the Vault, so profit and losses are shared equally among the Liquidity Providers. Liquidity Providers facilitate trades within the protocol by taking the opposite sides of every position opened by the trader, so they earn when traders lose and lose when traders win, and they also earn interest on every position opened by the trader.

The Traders deposit GHO tokens as Collateral, needed for opening Long or Short positions, their collateral needs to be large enough for the positions they are opening, Traders can open many positions with a single collateral as long as it is below the maximum Leverage.

This is where the concept of Leverage comes in. For example; Leverage = 500

A Trader can open a maximum position size worth about 5000GHO, if they provide a collateral of about 10 GHO.

Leverage = Total Position Size / (Collateral + TotalPnL)

TotalPnL = Total Profit and Loss of all positions opened by trader minus interest.

Traders can increase, decrease, and close positions when a Trader closes a position in profit, the profit gets added to their collateral balance, to support other positions, they can also withdraw the profit later on, but for losing positions the loss gets subtracted from their collateral.

Increasing Position Size: when a trader increases position size, they pay the interest for the period their position has been open, and the increase in position size gets reflected.

Decreasing Position Size: when a trader decreases position size, they pay the interest for the period that their position has been open, they also pay a percent of the loss or receive a percent of the profits of that position, and the decrease in position size gets reflected.

Liquidation If a Trader goes above the Leverage (500), they become due for Liquidation, this means that anyone can call the Liquidation function on the user and close their positions until their leverage falls below 500. The Person who calls this liquidation function gets a fee.

How it's Made

This project is made up of basically a React Frontend and two Smart Contracts:

React Frontend: On our React Frontend, we use connect-kit for managing wallet connection within our DAPP

Smart Contract

  • PerpTrades.sol: This is the main contract where everything happens

  • CollateralBank.sol: Just a simple smart contract that stores traders collateral in GHO

  • Liquidity Providers deposit GHO into the ````PerpTrades.sol, the funds get stored in a smart vault and they receive a share of the vault representing the amount of GHO they have deposited 1:1.

  • Trader deposits Collateral in GHO into PerpTrades.sol this collateral gets recorded for the user and the funds get transferred to the ```CollateralBank.sol.

  • After Depositing Collateral Traders can open either long or short positions for any given pair, with any size amount as long as it is below their Leverage. Their position remains open as long as they there are within the maximum leverage, once the trader's leverage goes above this maximum leverage the trader becomes due for liquidation and anyone is incentivized to close the trader's position for a fee of about 5% of the trader's collateral.

  • Traders can close this position at any time and the profit or loss from this trade will be added to their collateral records, which they can withdrawn anytime.

background image mobile

Join the mailing list

Get the latest news and updates