From 0eda47f0fc1fcc4edd9c5724acfb9d32d76dc152 Mon Sep 17 00:00:00 2001 From: Dkwcs Date: Tue, 26 Nov 2024 14:25:03 +0200 Subject: [PATCH] ETotalPriceOverflow check moved to list method from the rent --- .../move/nft_marketplace/sources/rental_extension.move | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/examples/move/nft_marketplace/sources/rental_extension.move b/docs/examples/move/nft_marketplace/sources/rental_extension.move index 7599f9be54b..4db493e356f 100644 --- a/docs/examples/move/nft_marketplace/sources/rental_extension.move +++ b/docs/examples/move/nft_marketplace/sources/rental_extension.move @@ -156,6 +156,7 @@ module nft_marketplace::rental_extension { ) { assert!(kiosk_extension::is_installed(kiosk), EExtensionNotInstalled); + assert!(price_per_day * duration <= MAX_VALUE_U64, ETotalPriceOverflow); kiosk.set_owner(cap, ctx); kiosk.list(cap, item_id, 0); @@ -226,8 +227,6 @@ module nft_marketplace::rental_extension { let mut rentable = take_from_bag(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();