Struct dao::core_contracts::ReputationContractRef
source · pub struct ReputationContractRef { /* private fields */ }
Expand description
Reference to the ReputationContract contract instance.
Implementations§
source§impl ReputationContractRef
impl ReputationContractRef
sourcepub fn mint_passive(&mut self, recipient: Address, amount: Balance)
pub fn mint_passive(&mut self, recipient: Address, amount: Balance)
Increases the balance of the passive reputation of the given address.
§Errors
NotWhitelisted
if caller is not whitelisted.
sourcepub fn burn_passive(&mut self, owner: Address, amount: Balance)
pub fn burn_passive(&mut self, owner: Address, amount: Balance)
Decreases the balance of the passive reputation of the given address.
§Errors
NotWhitelisted
if caller is not whitelisted.InsufficientBalance
if the passed amount exceeds the balance of the passive reputation of the given address.
sourcepub fn passive_balance_of(&self, address: Address) -> Balance
pub fn passive_balance_of(&self, address: Address) -> Balance
Returns the current passive balance of the given address.
sourcepub fn propose_new_owner(&mut self, owner: Address)
pub fn propose_new_owner(&mut self, owner: Address)
Changes ownership of the contract. Transfer the ownership to the owner
. Only the current owner
is permitted to call this method.
See AccessControl
sourcepub fn accept_new_owner(&mut self)
pub fn accept_new_owner(&mut self)
Accepts the new owner proposition. This can be called only by the proposed owner. See AccessControl
sourcepub fn add_to_whitelist(&mut self, address: Address)
pub fn add_to_whitelist(&mut self, address: Address)
Adds a new address to the whitelist.
See AccessControl
sourcepub fn remove_from_whitelist(&mut self, address: Address)
pub fn remove_from_whitelist(&mut self, address: Address)
Removes address from the whitelist.
See AccessControl
sourcepub fn is_whitelisted(&self, address: Address) -> bool
pub fn is_whitelisted(&self, address: Address) -> bool
Checks whether the given address is added to the whitelist.
sourcepub fn mint(&mut self, recipient: Address, amount: Balance)
pub fn mint(&mut self, recipient: Address, amount: Balance)
Mints new tokens. Adds amount
of new tokens to the balance of the recipient
and
increments the total supply. Only whitelisted addresses are permitted to call this method.
§Errors
NotWhitelisted
if caller is not whitelisted.
§Events
Mint
.
sourcepub fn burn(&mut self, owner: Address, amount: Balance)
pub fn burn(&mut self, owner: Address, amount: Balance)
Burns existing tokens. Removes amount
of existing tokens from the balance of the owner
and decrements the total supply. Only whitelisted addresses are permitted to call this
method.
§Errors
NotWhitelisted
if caller is not whitelisted.
§Events
Burn
event.
sourcepub fn total_supply(&self) -> Balance
pub fn total_supply(&self) -> Balance
Returns the total token supply.
sourcepub fn balance_of(&self, address: Address) -> Balance
pub fn balance_of(&self, address: Address) -> Balance
Returns the current token balance of the given address.
sourcepub fn bulk_mint_burn(
&mut self,
mints: BTreeMap<Address, Balance>,
burns: BTreeMap<Address, Balance>
)
pub fn bulk_mint_burn( &mut self, mints: BTreeMap<Address, Balance>, burns: BTreeMap<Address, Balance> )
Redistributes the reputation based on the voting summary
pub fn stake(&mut self, voter: Address, stake: Balance)
pub fn unstake(&mut self, voter: Address, stake: Balance)
pub fn bulk_unstake(&mut self, stakes: Vec<(Address, Balance)>)
pub fn get_stake(&self, address: Address) -> Balance
sourcepub fn all_balances(&self) -> AggregatedBalance
pub fn all_balances(&self) -> AggregatedBalance
Gets balances of all the token holders.
sourcepub fn partial_balances(&self, addresses: Vec<Address>) -> AggregatedBalance
pub fn partial_balances(&self, addresses: Vec<Address>) -> AggregatedBalance
Gets balances of the given account addresses.
sourcepub fn init(&mut self)
pub fn init(&mut self)
Constructor method.
It initializes contract elements:
- Events dictionary.
- Named keys of
AccessControl
. - Set
caller
as the owner of the contract. - Add
caller
to the whitelist.
§Events
Trait Implementations§
source§impl Clone for ReputationContractRef
impl Clone for ReputationContractRef
source§fn clone(&self) -> ReputationContractRef
fn clone(&self) -> ReputationContractRef
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more