pub trait UsersModule: ContractBase + Sizedwhere
for<'b> Self::BigUint: BigUintApi + AddAssign<&'b Self::BigUint> + SubAssign<&'b Self::BigUint> + MulAssign<&'b Self::BigUint> + DivAssign<&'b Self::BigUint> + RemAssign<&'b Self::BigUint> + BitAndAssign<&'b Self::BigUint> + BitOrAssign<&'b Self::BigUint> + BitXorAssign<&'b Self::BigUint>,
for<'a, 'b> &'a Self::BigUint: Add<&'b Self::BigUint, Output = Self::BigUint> + Sub<&'b Self::BigUint, Output = Self::BigUint> + Mul<&'b Self::BigUint, Output = Self::BigUint> + Div<&'b Self::BigUint, Output = Self::BigUint> + Rem<&'b Self::BigUint, Output = Self::BigUint> + BitAnd<&'b Self::BigUint, Output = Self::BigUint> + BitOr<&'b Self::BigUint, Output = Self::BigUint> + BitXor<&'b Self::BigUint, Output = Self::BigUint> + Shr<usize, Output = Self::BigUint> + Shl<usize, Output = Self::BigUint>,
for<'b> Self::BigInt: BigIntApi + AddAssign<&'b Self::BigInt> + SubAssign<&'b Self::BigInt> + MulAssign<&'b Self::BigInt> + DivAssign<&'b Self::BigInt> + RemAssign<&'b Self::BigInt>,
for<'a, 'b> &'a Self::BigInt: Add<&'b Self::BigInt, Output = Self::BigInt> + Sub<&'b Self::BigInt, Output = Self::BigInt> + Mul<&'b Self::BigInt, Output = Self::BigInt> + Div<&'b Self::BigInt, Output = Self::BigInt> + Rem<&'b Self::BigInt, Output = Self::BigInt>,{
// Required methods
fn get_user_id(&self, address: &Address) -> usize;
fn set_user_id(&self, address: &Address, user_id: usize);
fn get_user_address(&self, user_id: usize) -> Address;
fn set_user_address(&self, user_id: usize, address: &Address);
fn get_num_users(&self) -> usize;
fn set_num_users(&self, num_users: usize);
// Provided methods
fn get_or_create_user(&self, address: &Address) -> usize { ... }
fn update_user_address(&self, addresses: VarArgs<Address>) -> SCResult<()> { ... }
}Expand description
The module deals with temporarily pausing contract operations. It provides a flag that contracts can use to check if owner decided to users the entire contract. Use the features module for more granular on/off switches.
Required Methods§
sourcefn get_user_id(&self, address: &Address) -> usize
fn get_user_id(&self, address: &Address) -> usize
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.
fn set_user_id(&self, address: &Address, user_id: usize)
fn get_user_address(&self, user_id: usize) -> Address
fn set_user_address(&self, user_id: usize, address: &Address)
sourcefn get_num_users(&self) -> usize
fn get_num_users(&self) -> usize
Retrieves the number of delegtors, including the owner, even if they no longer have anything in the contract.
sourcefn set_num_users(&self, num_users: usize)
fn set_num_users(&self, num_users: usize)
Yields how accounts are registered in the contract. Note that not all of them must have stakes greater than zero.
Provided Methods§
fn get_or_create_user(&self, address: &Address) -> usize
fn update_user_address(&self, addresses: VarArgs<Address>) -> SCResult<()>
Object Safety§
This trait is not object safe.