Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: deposit collateral - allow users to hold in the currency of the loan #346

Open
tjcloa opened this issue Jul 29, 2021 · 1 comment
Open
Assignees
Labels
enhancement New feature or request high priority

Comments

@tjcloa
Copy link
Contributor

tjcloa commented Jul 29, 2021

the users' collateral for a margin trade is currently always held in the collateral currency
we need to allow collateral to be held in the currency of the loan
e.g. go rBTC long (trade on iSUSD loan token) but have your collateral held in sUSD (now it is converted to the collateral token - rBTC)
this leads to changing the leverage computation
now, it's clear that the collateral will be converted to rBTC, so if i go rBTC long 3x, i just need to borrow 2x the amount i'm providing, because my collateral is in rBTC (counting towards the position size)
and the collateral would not count towards the position size if the collateral held in the loan token currency - sUSD in the provided example

that's the way many exchanges have it, so some users are used to it
also they're liquidated less quickly
because their collateral doesn't decrease in value if the market is moving against them

@tjcloa tjcloa added enhancement New feature or request high priority labels Jul 29, 2021
@jjmr007
Copy link
Contributor

jjmr007 commented Jul 31, 2021

Just to make sure I am understanding this proposal:

1.- Let's say I have opened a LONG margin position with a leverage of 3x and with a collateral of 1 rBTC, just when Bitcoin price is $40k. So in rounded figures, I'll have a position of 3 rBTC, and a debt of 80k XUSD. Position net worth = $120k.

2.- Let's suppose that Bitcoin price falls into $30k. Now my whole position worths $90k. THEN, if this feature is available, I as user can now swap my position into 90.000 XUSD. So, if the price of Bitcoin keeps falling, I will be always over the net debt (which is $80k), so I can easily avoid liquidation. If I TOP-UP my position under this "Borrowed Assets State", regardless the asset I supply to the position, the funds are converted into XUSD. <-- Am I correct here?

3.- Let's suppose that Bitcoin price goes up again to $40k. THEN, with this feature available I can swap my position into 2,25 rBTC = 90.000 XUSD ÷ 40.000 XUSD/rBTC, with the hope it will keep going up. (I'm exaggerating with numbers here). If bitcoin price keeps going up, eventually I'll start to earn again. <-- Am I correct here?

4.- If I'm right, it will be convenient and eventually needed to develop a watcher Bot, carefully designed to help users:

N°1: Avoiding liquidation.
N° 2: Avoiding loses in the margin trade.

5.- Even when this new feature offers a stronger margin psitions, there still be some risks, one of the most important ones: the risk of iliquidity in the moment we need to swap the position to the borrowed asset (everybody will try to get this convertion and the AMM can incurr in IL or iliquidity).

6.- Finnally, it will be convenient for the user to be able (at the contract's logic level) to supply the payment of interest without any impact on the position value. (It is something some users has asked for as well). But this additional feature may be better include in another proposal. <-- This feature: supply interest payment without impacts on the position, may require an escrow mechanism, coz we don't have an exact foreknowledge of the interest rate for the loan, for the next rollover.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request high priority
Projects
None yet
Development

No branches or pull requests

3 participants