diff --git a/moveos/moveos-stdlib/moveos-stdlib/doc/context.md b/moveos/moveos-stdlib/moveos-stdlib/doc/context.md index cd87f6f9c2..e68c5c58ed 100644 --- a/moveos/moveos-stdlib/moveos-stdlib/doc/context.md +++ b/moveos/moveos-stdlib/moveos-stdlib/doc/context.md @@ -432,10 +432,10 @@ Borrow mut Object from object store with object_id ## Function `remove_object` -Remove object from object store +Remove object from object store, and unpack the Object -
public fun remove_object<T: key>(self: &mut context::Context, object_id: object_id::ObjectID): object::Object<T>
+public fun remove_object<T: key>(self: &mut context::Context, object_id: object_id::ObjectID): (object_id::ObjectID, address, T)
@@ -444,8 +444,9 @@ Remove object from object store
Implementation
-public fun remove_object<T: key>(self: &mut Context, object_id: ObjectID): Object<T> {
- storage_context::remove<T>(&mut self.storage_context, object_id)
+public fun remove_object<T: key>(self: &mut Context, object_id: ObjectID): (ObjectID, address, T) {
+ let obj = storage_context::remove<T>(&mut self.storage_context, object_id);
+ object::unpack_internal(obj)
}
diff --git a/moveos/moveos-stdlib/moveos-stdlib/sources/context.move b/moveos/moveos-stdlib/moveos-stdlib/sources/context.move
index cb4f03d36a..9bd3f4a641 100644
--- a/moveos/moveos-stdlib/moveos-stdlib/sources/context.move
+++ b/moveos/moveos-stdlib/moveos-stdlib/sources/context.move
@@ -107,9 +107,10 @@ module moveos_std::context {
}
#[private_generics(T)]
- /// Remove object from object store
- public fun remove_object(self: &mut Context, object_id: ObjectID): Object {
- storage_context::remove(&mut self.storage_context, object_id)
+ /// Remove object from object store, and unpack the Object
+ public fun remove_object(self: &mut Context, object_id: ObjectID): (ObjectID, address, T) {
+ let obj = storage_context::remove(&mut self.storage_context, object_id);
+ object::unpack_internal(obj)
}
public fun contains_object(self: &Context, object_id: ObjectID): bool {