this post was submitted on 24 Aug 2023
1 points (100.0% liked)

Ethereum

1 readers
0 users here now

Next-generation platform for decentralised applications. Dive in at ethereum.org.

founded 1 year ago
MODERATORS
 
This is an automated archive.

The original was posted on /r/ethereum by /u/Dexaran on 2023-08-23 22:15:55+00:00.


Dex223

We are building a decentralized exchange for ERC-20 & ERC-223 tokens. The support of ERC-223 token standard will make swaps 15% cheaper compared to ERC-20 swaps and introduce the opportunity to mitigate some potential security risks. We will implement transparent auto-listing procedure so that in order to list a new token there will be no need to ask for exchange teams approval.

And a feature that I'm going to describe in more detail today: encapsulated margin trading.

Encapsulated Margin Trading

This feature will allow a fully decentralized exchange to let users "lend" and "borrow" assets at the platform.

Lenders will be allowed to create 'lending orders' where they put their funds and specify a desired interest rate.

Borrowers will be allowed to put a collateral to the 'lending order' which will give them a control over lenders funds. Borrowers will be allowed to make market trades with the funds as if they owned them. Borrowers will not be allowed to withdraw the funds from the platform.

Addressing a problem of liquidation engine in a decentralized system

It is technically impossible to implement a liquidation engine in Ethereum smart-contract.

However we address this problem by creating a system of incentives. The lenders will be allowed to manually liquidate their borrowers or delegate this responsibility to third party services (most likely off-chain ones) that will watch open orders and call liquidations in exchange for some reward.

Liquidation will be a function of time and expected balance. Example: a user creates a lending order and puts 15 ETH there with 20% monthly interest rate. This actually means that at 30th day the cumulative balance of the 'lending order' is expected to become 18 ETH. At 15th day however the expected cumulative balance of this lending order is expected to be 16.5 ETH.

A borrower is allowed to put a collateral in this order (the amount of collateral is configured by the lender) and then he will be allowed to perform market trades in a similar way as any user can trade with his own funds.

There will be a subjectToLiquidation(...) function that will check the cumulative balance of the borrowers positions for a given lending order and calculate how much ETH would be there if he market sold everything at the current conditions accounting for liquidity and slippage. Then this function compares the result to the expected balance at the time of execution and if the actual balance is less than expected balance then the borrower can be liquidated.

Liquidation will trigger market sell of all the borrowers positions.

Addressing the problem of price oracles

As the described method of margin trading implementation works within the scope of one platform it only makes sense to account for the liquidity and the market price at this exact platform therefore eliminating the need for price oracles.

Actual market price and actual liquidity will be the only data required for liquidation calculations.

no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here