-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MoveosStd] Refactor ObjectRef, allow ObjectRef as transaction argument #1026
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
1dfa618
to
05e9994
Compare
let obj = storage_context::remove<T>(&mut self.storage_context, object_id); | ||
object::unpack_internal(obj) | ||
/// The module of T can borrow mut Object from object store with any object_id | ||
public fun borrow_object_mut_extend<T: key>(self: &mut Context, object_id: ObjectID) : &mut ObjectRef<T> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If an object is transferred to another address, the module where the object is defined can still get the write reference of the object through borrow_object_mut_extend
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
Summary
Part of #1001
&ObjectRef<T>
by ObjectID, and then get&T
. This can be achieved through theentry
function arguments orcontext::borrow_object(ctx, ObjectID)
.&mut ObjectRef<T>
byObjectID
, and then get&mut T
. This can be achieved through theentry
function arguments orcontext::borrow_mut_object(ctx,signer,ObjectID)
.T
has bothkey
andstore
ability, anyone can transfer ownership byobject_ref::transfer(&mut Object<T>, address)
.T
is defined can usecontext::borrow_mut_object_extend
to obtain any&mut ObjectRef<T>
, and can transfer ownership by usingobject_ref::transfer_extend(&mut Object<T>, address)
.T
is defined can call theobject_ref::remove(ObjectRef<T>)
method to remove the Object.object_ref::to_permanent
method is provided to dropObjectRef<T>
, but onceObjectRef<T>
is dropped, the Object cannot be removed from object storage.to_shared
,to_frozen
function.TODO in next PR
Object
toObjectEntity
andobject.move
toobject_entity.move
.ObjectRef
toObject
andobject_ref.move
toobject.move
shared
andfrozen