-
Notifications
You must be signed in to change notification settings - Fork 72
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
Pools: use Rate
represented as 18 decimals
#1520
Changes from 9 commits
33a935e
6e28d72
cd24d27
168c250
8dba68a
84ac3ef
82d4838
aeb117f
a7ec39d
4ef0443
c59091c
eb1be39
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -153,7 +153,7 @@ fn core_constraints_currency_available_cant_cover_redemptions() { | |
.zip(vec![80, 20, 5, 5]) // no IntoIterator for arrays, so we use a vec here. Meh. | ||
.map(|(_tranche, value)| EpochExecutionTranche { | ||
supply: value, | ||
price: One::one(), | ||
price: Quantity::one(), | ||
redeem: 10, | ||
..Default::default() | ||
}) | ||
|
@@ -502,7 +502,7 @@ fn pool_constraints_pass() { | |
assert_ok!(PoolSystem::inspect_solution(pool, &epoch, &full_solution)); | ||
|
||
assert_eq!( | ||
calculate_risk_buffers::<u128, Rate>(&vec![3, 1], &vec![One::one(), One::one()]) | ||
calculate_risk_buffers::<u128, Quantity>(&vec![3, 1], &vec![One::one(), One::one()]) | ||
.unwrap(), | ||
vec![Perquintill::zero(), Perquintill::from_float(0.75),] | ||
); | ||
|
@@ -577,7 +577,7 @@ fn epoch() { | |
>>::get(0, SeniorTrancheId::get()) | ||
.unwrap() | ||
.price, | ||
Rate::one() | ||
Quantity::one() | ||
); | ||
|
||
assert_err!( | ||
|
@@ -725,14 +725,14 @@ fn epoch() { | |
0 | ||
); | ||
assert_eq!(pool.reserve.available, pool.reserve.total); | ||
assert_eq!(pool.reserve.total, 758968368969420653370); | ||
assert_eq!(pool.reserve.total, 758968368969420653250); | ||
assert_eq!( | ||
pool.tranches.residual_top_slice()[SENIOR_TRANCHE_INDEX as usize].reserve, | ||
251031631030579346631 | ||
251031631030579346511 | ||
); | ||
assert_eq!( | ||
pool.reserve.total + senior_price.saturating_mul_int(250 * CURRENCY), | ||
1010 * CURRENCY + 1 // TODO: Fix rounding issue with FixedPointNumberExtension | ||
1009999999999999999750 // TODO: Fix rounding issue with FixedPointNumberExtension | ||
); | ||
Comment on lines
+728
to
736
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After separating the pool rate into 18 and 27 decimals, I found these tests magic values has changed. I do not know where they come from (probably from calculating prices in tranches), but I'm not able to answer why they change in that way. It changes in the last decimals, so it probably is an accumulated rounding issue with some |
||
|
||
assert_eq!( | ||
|
@@ -742,7 +742,7 @@ fn epoch() { | |
>>::get(0, SeniorTrancheId::get()) | ||
.unwrap() | ||
.price, | ||
Rate::from_inner(1004126524122317386524000000) | ||
Quantity::from_inner(1004126524122317386) | ||
); | ||
}); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also rename taht
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!