Skip to content

Commit

Permalink
ETotalPriceOverflow check moved to list method from the rent
Browse files Browse the repository at this point in the history
  • Loading branch information
Dkwcs committed Nov 26, 2024
1 parent 17b6582 commit 0eda47f
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ module nft_marketplace::rental_extension {
) {
assert!(kiosk_extension::is_installed<Rental>(kiosk), EExtensionNotInstalled);

assert!(price_per_day * duration <= MAX_VALUE_U64, ETotalPriceOverflow);
kiosk.set_owner(cap, ctx);
kiosk.list<T>(cap, item_id, 0);

Expand Down Expand Up @@ -226,8 +227,6 @@ module nft_marketplace::rental_extension {

let mut rentable = take_from_bag<T, Listed>(renter_kiosk, Listed { id: item_id });

let max_price_per_day = MAX_VALUE_U64 / rentable.duration;
assert!(rentable.price_per_day <= max_price_per_day, ETotalPriceOverflow);
let total_price = rentable.price_per_day * rentable.duration;

let coin_value = coin.value();
Expand Down

0 comments on commit 0eda47f

Please sign in to comment.