Owner
It provides an Owner capability that stores the IDs of other objects, Modules can assert or check if a certain ID is stored in the Owner to prove its ownership. It is used to provide access control.
Structs
OwnerCap
of - A set of IDs to prove that the Owner Capability has privileged access to it.
Interface
new
It creates an OwnerCap capability.
@param _: A witness to link an OwnerCap with the module that owns the witness.
@param of: Vector of
sui::object::ID
that this capability owns.@return OwnerCap.
contains
It checks if an ID is stored in the Owner Capability.
@param self: An OwnerCap object.
@param x: The
sui::object::ID
of an object.@return bool. True if the
self
ownsx
.
of
Returns the vector of sui::object::ID
that the self
owns.
@param self: A {OwnerCap} object.
@return vector. The vector of
sui::object::ID
.
add
Assigns the self
OwnerCap as the owner of x
.
@param self: An OwnerCap object.
@param _: A witness to make sure only the allowed module can add
sui::object::ID
to the self.@param x: The
sui::object::ID
of the object, which theself
will have ownership rights to.
remove
Removes the self
OwnerCap as the owner of x
.
@param self: An OwnerCap object.
@param _: A witness to make sure only the right module can add the
sui::object::ID
to the self.@param x: The
sui::object::ID
of the object, which theself
will lose its ownership rights to.
destroy
Destroys an OwnerCap. It does not require the of vector to be empty.
@param self: An OwnerCap object.
destroy_empty
Destroys an OwnerCap. It requires the of vector to be empty.
@param self: A OwnerCap object.
Aborts
If
of
vector is not empty.
assert_ownership
Asserts that the self
owns x
.
@param self: An OwnerCap object.
@param x: The
sui::object::ID
of the object, which must belong to the capability.
Aborts
If the ID is not owned by the capability.
Last updated