diff --git a/aptos-move/framework/aptos-framework/doc/object.md b/aptos-move/framework/aptos-framework/doc/object.md index cb633a173bf6c..7ae33a425ee25 100644 --- a/aptos-move/framework/aptos-framework/doc/object.md +++ b/aptos-move/framework/aptos-framework/doc/object.md @@ -2301,15 +2301,16 @@ Return true if the provided address has indirect or direct ownership of the prov
public fun owns<T: key>(object: Object<T>, owner: address): bool acquires ObjectCore {
let current_address = object_address(&object);
- if (current_address == owner) {
- return true
- };
assert!(
exists<ObjectCore>(current_address),
error::not_found(EOBJECT_DOES_NOT_EXIST),
);
+ if (current_address == owner) {
+ return true
+ };
+
let object = borrow_global<ObjectCore>(current_address);
let current_address = object.owner;
diff --git a/aptos-move/framework/aptos-framework/sources/object.move b/aptos-move/framework/aptos-framework/sources/object.move
index abca67bb2451a..bb6684ff6f430 100644
--- a/aptos-move/framework/aptos-framework/sources/object.move
+++ b/aptos-move/framework/aptos-framework/sources/object.move
@@ -662,15 +662,16 @@ module aptos_framework::object {
/// Return true if the provided address has indirect or direct ownership of the provided object.
public fun owns(object: Object, owner: address): bool acquires ObjectCore {
let current_address = object_address(&object);
- if (current_address == owner) {
- return true
- };
assert!(
exists(current_address),
error::not_found(EOBJECT_DOES_NOT_EXIST),
);
+ if (current_address == owner) {
+ return true
+ };
+
let object = borrow_global(current_address);
let current_address = object.owner;