Closed jolestar closed 7 months ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
ObjectRef is a way to divide Object permissions. ObjectRef allows anyone to operate on the Object body. Should we abstract the permissions of sending and extending Objects, so that Objects are more flexible?
ObjectRef is a way to divide Object permissions. ObjectRef allows anyone to operate on the Object body. Should we abstract the permissions of sending and extending Objects, so that Objects are more flexible?
Do you have some ideas about this?
ObjectRef is a way to divide Object permissions. ObjectRef allows anyone to operate on the Object body. Should we abstract the permissions of sending and extending Objects, so that Objects are more flexible?
Do you have some ideas about this?
Here, we limit the sending of Objects of type
We can limit the sending permissions of Objects by adding some fields. Only users who have TransferRef can send this Object.
struct Object {
allow_ungated_transfer: bool,
}
As a result, all Objects can be sent arbitrarily, and the creator can close the sending of some Objects. Here is the implementation of Aptos, which I think is very good.
Here, we limit the sending of Objects of type to the module of T. We can modify Objects so that they can be sent anywhere.
We can limit the sending permissions of Objects by adding some fields. Only users who have TransferRef can send this Object.
struct Object { allow_ungated_transfer: bool, }
As a result, all Objects can be sent arbitrarily, and the creator can close the sending of some Objects. Here is the implementation of Aptos, which I think is very good.
We can provide a public_transfer
to Object
, if needed. The public_transfer
requires the T
has key + store ability but does not require private_generics(T)
like Sui.
Here, we limit the sending of Objects of type to the module of T. We can modify Objects so that they can be sent anywhere. https://github.com/rooch-network/rooch/blob/aa85fd70355e8b9ad77a2004f22301185fe74489/moveos/moveos-stdlib/moveos-stdlib/sources/object.move#L56-#L60 We can limit the sending permissions of Objects by adding some fields. Only users who have TransferRef can send this Object.
struct Object { allow_ungated_transfer: bool, }
As a result, all Objects can be sent arbitrarily, and the creator can close the sending of some Objects. Here is the implementation of Aptos, which I think is very good. https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/framework/aptos-framework/sources/object.move#L400-L410
We can provide a
public_transfer
toObject
, if needed. Thepublic_transfer
requires theT
has key + store ability but does not requireprivate_generics(T)
like Sui.
I believe it is necessary, As a special type, Object should have some differences from ordinary structs, such as inheritance, polymorphism, and extensibility. And I think it is essential that Object be extensible. A built-in typetable or other extension mechanism would increase Object's flexibility.
Summary
[MoveosStd] Refactor ObjectRef, context:new_object and context::remove_object
ObjectRef
can notcopy
.context::new_object<T>
auto add Object to storage, and return ObjectRefcontext::remove_object<T>
auto unpack the Object, and return(id, owner, T)
Continue #935
Part of #901
@geometryolife Some documents and example readme need to be updated. @wubuku the code generator needs to be updated with new Object and ObjectRef API.