From 9100f943904fdba979c49039689adb5086370fe2 Mon Sep 17 00:00:00 2001 From: beer-1 <147697694+beer-1@users.noreply.github.com> Date: Mon, 26 Aug 2024 21:26:53 +0900 Subject: [PATCH] add missing object function (#118) --- precompile/binaries/minlib/object.mv | Bin 4422 -> 4468 bytes precompile/binaries/stdlib/object.mv | Bin 4422 -> 4468 bytes .../modules/initia_stdlib/sources/object.move | 5 +++++ .../minitia_stdlib/sources/object.move | 5 +++++ 4 files changed, 10 insertions(+) diff --git a/precompile/binaries/minlib/object.mv b/precompile/binaries/minlib/object.mv index 9a7cf03bfbfa9ead53653bb9098998472eb91051..e98c8212f5b4c0e2a08372444d95cc66952eeea2 100644 GIT binary patch delta 321 zcmXwxJ4?e*7>2+1(k=OwX3kIg%t@Svq1y|&cXeIQVwM1t<_#8cLBw3lMg>c{PSnWpC^Yk& zXgS8pXoS@wXQoMOrRZ*{E{0I--(bKKiNmdf_I78peX@Vl>0cN#W);$=F~NnT8adD{ z%Yg*Tfr#spe3q&Smj5>`wsH08ZlItV-tbfr9D*zt)0A>FNm7$6Sz_fl$9suCFM%Km n8A(aoMzW&Ly)vrm!3!{<2Hq|vRnyO+qK^HY=<%b!$JXf=3IjKb delta 311 zcmXYqze>YU6vodv_a?c$x8^321X~o^xJ23}O%>b0rJMh?cJKuReFq(Uhk%2dgAX8e zaS)tbd;rl!=paZ37Y7Filj`zuejneD^A$dZ{j2$jG6BFw2q@^V^-JPo3XE@hL+hE3 zOXAM1IWP9TDKGq?`tYed@junfYdy4o>Rg}S^dlUYgaS6KA~z#Mfm?n>X#44?L^nmYtbZf4O3O5uu2+1(k=OwX3kIg%t@Svq1y|&cXeIQVwM1t<_#8cLBw3lMg>c{PSnWpC^Yk& zXgS8pXoS@wXQoMOrRZ*{E{0I--(bKKiNmdf_I78peX@Vl>0cN#W);$=F~NnT8adD{ z%Yg*Tfr#spe3q&Smj5>`wsH08ZlItV-tbfr9D*zt)0A>FNm7$6Sz_fl$9suCFM%Km n8A(aoMzW&Ly)vrm!3!{<2Hq|vRnyO+qK^HY=<%b!$JXf=3IjKb delta 311 zcmXYqze>YU6vodv_a?c$x8^321X~o^xJ23}O%>b0rJMh?cJKuReFq(Uhk%2dgAX8e zaS)tbd;rl!=paZ37Y7Filj`zuejneD^A$dZ{j2$jG6BFw2q@^V^-JPo3XE@hL+hE3 zOXAM1IWP9TDKGq?`tYed@junfYdy4o>Rg}S^dlUYgaS6KA~z#Mfm?n>X#44?L^nmYtbZf4O3O5uu(object) } + /// Returns true if there exists an object with resource T. + public fun object_exists(object: address): bool { + exists(object) && exists_at(object) + } + /// Derives an object address from source material: sha3_256([creator address | seed | 0xFE]). public fun create_object_address(source: &address, seed: vector): address { let bytes = bcs::to_bytes(source); diff --git a/precompile/modules/minitia_stdlib/sources/object.move b/precompile/modules/minitia_stdlib/sources/object.move index cc708a45..dcbbdd21 100644 --- a/precompile/modules/minitia_stdlib/sources/object.move +++ b/precompile/modules/minitia_stdlib/sources/object.move @@ -178,6 +178,11 @@ module minitia_std::object { exists(object) } + /// Returns true if there exists an object with resource T. + public fun object_exists(object: address): bool { + exists(object) && exists_at(object) + } + /// Derives an object address from source material: sha3_256([creator address | seed | 0xFE]). public fun create_object_address(source: &address, seed: vector): address { let bytes = bcs::to_bytes(source);