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

Pool Stable: replaces Decimal with Decimal256 #377

Open
wants to merge 29 commits into
base: main
Choose a base branch
from

Conversation

gangov
Copy link
Collaborator

@gangov gangov commented Aug 5, 2024

No description provided.

@gangov gangov requested a review from ueco-jb August 5, 2024 09:16
@gangov gangov self-assigned this Aug 5, 2024
@gangov gangov force-pushed the feature/stable-pool-to-use-decimal256 branch from 8018e66 to 58a4802 Compare August 5, 2024 15:36
),
],
)
.to_u128()
.expect("Pool stable: provide_liquidity: conversion to u128 failed");
.to_u128_with_precision(DECIMAL_PRECISION as i32);
Copy link
Member

Choose a reason for hiding this comment

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

Remove this

.expect("Pool stable: provide_liquidity: conversion to u128 failed")
- initial_invariant,
);
let invariant_delta = new_invariant - initial_invariant;
Copy link
Member

Choose a reason for hiding this comment

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

Those should stay decimals

Comment on lines 387 to 392
(Decimal256::raw(U256::from_u128(&env, invariant_delta)).div(
&env,
Decimal256::raw(U256::from_u128(&env, initial_invariant)),
))
.mul_u128(&env, convert_i128_to_u128(total_shares))
.to_u128()
Copy link
Member

Choose a reason for hiding this comment

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

And this should later be converted to u128_with_precision (greatest_precision)

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

Successfully merging this pull request may close these issues.

2 participants