Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions protocol/sources/bottle.move
Original file line number Diff line number Diff line change
Expand Up @@ -142,23 +142,23 @@ module bucket_protocol::bottle {
}

fun compute_buck_value_to_collateral(
buck_amount: u64,
collateral_decimal: u8,
price: u64,
buck_amount: u64,
collateral_decimal: u8,
price: u64,
denominator: u64
): u64 {

let buck_raw_value =
let buck_raw_value =
mul_factor(
buck_amount,
denominator,
buck_amount,
denominator,
price
);

if (constants::buck_decimal() >= collateral_decimal) {
buck_raw_value / pow(10, constants::buck_decimal() - collateral_decimal)
} else {
buck_raw_value * pow(10, collateral_decimal - constants::buck_decimal())
(((buck_raw_value as u128) * (pow(10, collateral_decimal - constants::buck_decimal()) as u128)) as u64)
}
}

Expand Down
4 changes: 2 additions & 2 deletions protocol/sources/bucket.move
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ module bucket_protocol::bucket {
): u64 {
let collateral_raw_value = mul_factor(collateral_amount, price, denominator);
if (constants::buck_decimal() >= collateral_decimal) {
collateral_raw_value * pow(10, constants::buck_decimal() - collateral_decimal)
(((collateral_raw_value as u128) * (pow(10, constants::buck_decimal() - collateral_decimal) as u128)) as u64)
} else {
collateral_raw_value / pow(10, collateral_decimal - constants::buck_decimal())
}
Expand All @@ -712,7 +712,7 @@ module bucket_protocol::bucket {
if (constants::buck_decimal() >= collateral_decimal) {
buck_raw_value / pow(10, constants::buck_decimal() - collateral_decimal)
} else {
buck_raw_value * pow(10, collateral_decimal - constants::buck_decimal())
(((buck_raw_value as u128) * (pow(10, collateral_decimal - constants::buck_decimal()) as u128)) as u64)
}
}

Expand Down