Trait elrond_wasm_module_users::UsersModule[][src]

pub trait UsersModule: ContractBase {
    fn get_user_id(&self, address: &ManagedAddress<Self::Api>) -> usize;
fn set_user_id(&self, address: &ManagedAddress<Self::Api>, user_id: usize);
fn get_user_address(&self, user_id: usize) -> ManagedAddress<Self::Api>;
fn set_user_address(
        &self,
        user_id: usize,
        address: &ManagedAddress<Self::Api>
    );
fn get_num_users(&self) -> usize;
fn set_num_users(&self, num_users: usize); fn get_or_create_user(&self, address: &ManagedAddress<Self::Api>) -> usize { ... }
fn update_user_address(
        &self,
        addresses: MultiArgVec<ManagedAddress<Self::Api>>
    ) -> SCResult<(), StaticSCError> { ... } }
Expand description

Standard smart contract module that when added to a smart contract manages a list of users.

It was created before there was such a thing as storage mappers. The UserMapper is a more elegant solution nowadays that solves the same problem.

It provides a bi-directional map:

  • from user address to a unique user id
  • from user id to address

Required methods

Each user gets a user id. This is in order to be able to iterate over their data. This is a mapping from user address to user id. The key is the bytes “user_id” concatenated with their public key. The value is the user id.

Retrieves the number of delegtors, including the owner, even if they no longer have anything in the contract.

Yields how accounts are registered in the contract. Note that not all of them must have stakes greater than zero.

Provided methods

Implementors