Object

Object is a container for resources that are stored within a single address.

It includes a resource ObjectCore which stores both the address of the current owner and the appropriate data for creating event streams.


Ownership

In object, we separate the concept of ownership and the data location. An object has its own address and ownership is indicated as a reference. All objects are globally addressable and queryable


Capabilities

The object creation functions all return a transient ConstructorRef that cannot be stored. ConstructorRef can also be used to generate the other capabilities (or "refs") that are used to manage the object. Capabilities are like permissions that allow to manage the object. With capabilities, we can have more granular control of each object


/// remove Object from global storage.
public fun generate_delete_ref(ref: &ConstructorRef): DeleteRef;
/// add new events and resources to the object.
public fun generate_extend_ref(ref: &ConstructorRef): ExtendRef;
/// Generates the TransferRef, which can be used to manage object transfers.
public fun generate_transfer_ref(ref: &ConstructorRef): TransferRef;
/// Create a signer for the ConstructorRef
public fun generate_signer(ref: &ConstructorRef): signer;

  • DeleteRef - can be used to delete the object. The object can be fully deleted or not depends on how we created it
  • ExtendRef - can be used to add more resources to the object after its initial creation.
  • TransferRef - can be used to transfer the object without the owner being involved. It can also disable the owner-transfer feature. Soul-bound token can be created in this way.
  • Signer - can be used to represent to do any customized action on behalf of the object.

Composability

An object can be an owner of another object. That makes on-chain composition of objects possible. In implementation, it means we can store a native, typed object within one another, can create meaningful structure under an object.