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

Remove artificial REX lower limit #369

Open
wants to merge 6 commits into
base: master
from

Conversation

@jafri
Copy link

jafri commented Nov 5, 2019

Removes REX lower unlent limit from 20% to 0%

jafri added 2 commits Nov 5, 2019
@jafri jafri changed the title Remove artificial limit Remove artificial REX lower limit Nov 5, 2019
jafri added 3 commits Nov 5, 2019
Copy link
Contributor

DenisCarriere left a comment

👍 looks good, this change does remove the artificial REX lower limit of 20%

This unlocks the full REX liquidity available to borrowers

REX rental prices are still computed using the Bancor formula, however now has access to the full 100% liquidity of REX

Before

// variables
total_lent = 818945770886 // 81.8mm
total_unlent = 163789519271 // 16.3mm

// calculations
unlent_lower_bound = 2 * total_lent / 10
//=> 163789154177
available_unlent = total_unlent - unlent_lower_bound
//=> 365094

After

// variables
total_lent = 818945770886 // 81.8mm
total_unlent = 163789519271 // 16.3mm

// calculations
unlent_lower_bound = 0;
available_unlent = total_unlent - unlent_lower_bound
//=> 163789519271
Copy link

UMU618 left a comment

This is a fairer measure.

@sergioyuhjtman

This comment has been minimized.

Copy link

sergioyuhjtman commented Nov 7, 2019

Have you considered what would happen if total_unlent becomes small? Apparently the rental fee might fall drastically for subsequent loans.
In the case where total_unlent equals 0 the rental fee becomes 0 after the expiration of a loan.
See https://medium.com/eosio/analysis-of-bancor-equations-supporting-rex-74ef4aaeca1c (sections "Loan Expiration" and "Unlent Balance Lower Bound").

@jafri

This comment has been minimized.

Copy link
Author

jafri commented Nov 8, 2019

@sergioyuhjtman When a loan expires, the rented resources are moved from total_lent to total_unlent, so it could not be 0. Even if the user has auto_renew enabled, remove_loan_from_rex_pool would move total_lent->total_unlent first.

The amount of CPU one gets per EOS is determined by total_unlent / (total_rent + 1). As total_unlent goes down, you get less and less CPU for every EOS.

e.g. if total_unlent was 10,000 EOS and total_rent was 99,990,000 EOS, you would get 0.0001 EOS of CPU/EOS

@andybets

This comment has been minimized.

Copy link

andybets commented Nov 8, 2019

@jafri it does seem that if there are loans outstanding and rex holders pull out all the unlent rex, total_unlent can go to zero, and thus total_rent is set to 0 (at loan expiration). When that happens, REX is unstable and a future rental paying 1 EOS would get the full unlent amount.

So there is a reason for the buffer. We need to set it above zero.

@jafri

This comment has been minimized.

Copy link
Author

jafri commented Nov 8, 2019

Fair enough @andybets

That edge case would only apply to the first loan after it hits 0 and requires a full exodus of all tokens.

The minimum unlent lower bound value can be set to 1 instead of 0

@jafri jafri dismissed stale reviews from UMU618 and DenisCarriere via c4e7072 Nov 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.