Remove magic numbers
0xKitsune opened this issue · 0 comments
0xKitsune commented
A contant value should be used anywhere there is a U256 value that never changes.
For example:
//Set sqrt_price_limit_x_96 to the max or min sqrt price in the pool depending on zero_for_one
let sqrt_price_limit_x_96 = if zero_for_one {
U256::from("4295128739") + 1
} else {
U256::from("0xFFFD8963EFD1FC6A506488495D951D5263988D26") - 1
};
All of these values should be changed to match this format:
pub const MIN_SQRT_RATIO: U256 = U256([285968860985, 0, 0, 0]);
pub const MAX_SQRT_RATIO: U256 = U256([
9809463991923573570,
227557619515130776,
5049738529920590081,
1,
]);