Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.

Remove artificial REX lower limit #369

Closed
wants to merge 6 commits into from
Closed

Conversation

jafri
Copy link

@jafri jafri commented Nov 5, 2019

Removes REX lower unlent limit from 20% to 0%

@jafri jafri changed the title Remove artificial limit Remove artificial REX lower limit Nov 5, 2019
DenisCarriere
DenisCarriere previously approved these changes Nov 5, 2019
Copy link
Contributor

@DenisCarriere DenisCarriere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 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

UMU618
UMU618 previously approved these changes Nov 6, 2019
Copy link

@UMU618 UMU618 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a fairer measure.

@sergioyuhjtman
Copy link

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
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
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
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 November 8, 2019 09:23
@jafri jafri closed this Dec 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants