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

Support for geometric price books with r = 1.01 #23

Closed
onemonster opened this issue Mar 29, 2023 · 0 comments
Closed

Support for geometric price books with r = 1.01 #23

onemonster opened this issue Mar 29, 2023 · 0 comments

Comments

@onemonster
Copy link
Contributor

Currently, the geometric price book does not support cases where the common ratio is bigger than 1.002. This is due to the unnecessary constraint that every possible value within uint16 be supported when creating price books.

In the case of arithmetic price books,

if (d == 0 || type(uint16).max * d > type(uint128).max - a) {
    revert Errors.CloberError(Errors.INVALID_COEFFICIENTS);
}

In the case of geometric price books.

if (_r16 * _a >= 1 << 192) {
    revert Errors.CloberError(Errors.INVALID_COEFFICIENTS);
}

Price books with 1.01 as the common ratio are needed for markets with lower liquidity. To support this, I propose we remove this constraint and allow price books that don't cover the full extent of the numbers possible within uint16.

detectivekim added a commit that referenced this issue Apr 4, 2023
graykode added a commit that referenced this issue Apr 7, 2023
@graykode graykode closed this as completed Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants