Struct dao::voting_contracts::OnboardingRequestContract
source · pub struct OnboardingRequestContract { /* private fields */ }
Expand description
Onboarding Request Contract.
Implementations§
source§impl OnboardingRequestContract
impl OnboardingRequestContract
sourcepub fn init(
&mut self,
variable_repository: Address,
reputation_token: Address,
kyc_token: Address,
va_token: Address
)
pub fn init( &mut self, variable_repository: Address, reputation_token: Address, kyc_token: Address, va_token: Address )
Constructor function.
§Note
Initializes contract elements:
- Sets up the contract by writing addresses of
Variable Repository
,Reputation Token
,VA Token
,KYC Token
. - Sets [
caller
] as the owner of the contract. - Adds [
caller
] to the whitelist.
§Events
sourcepub fn create_voting(&mut self, reason: DocumentHash)
pub fn create_voting(&mut self, reason: DocumentHash)
Submits an onboarding request. If the request is valid voting starts.
§Events
sourcepub fn get_cspr_balance(&self) -> Balance
pub fn get_cspr_balance(&self) -> Balance
Gets the CSPR balance of the contract.
sourcepub fn slash_voter(&mut self, voter: Address) -> SlashedVotings
pub fn slash_voter(&mut self, voter: Address) -> SlashedVotings
Erases the voter from voting with the given id. Read more.
sourcepub fn cancel_finished_voting(&mut self, voting_id: VotingId)
pub fn cancel_finished_voting(&mut self, voting_id: VotingId)
Cancels a voting that has not been finished in defined time
§Errors
sourcepub fn voting_exists(
&self,
voting_id: VotingId,
voting_type: VotingType
) -> bool
pub fn voting_exists( &self, voting_id: VotingId, voting_type: VotingType ) -> bool
Checks if voting of a given type and id exists.
sourcepub fn get_ballot(
&self,
voting_id: VotingId,
voting_type: VotingType,
address: Address
) -> Option<Ballot>
pub fn get_ballot( &self, voting_id: VotingId, voting_type: VotingType, address: Address ) -> Option<Ballot>
Returns the Voter’s Ballot
.
sourcepub fn get_voter(
&self,
voting_id: VotingId,
voting_type: VotingType,
at: u32
) -> Option<Address>
pub fn get_voter( &self, voting_id: VotingId, voting_type: VotingType, at: u32 ) -> Option<Address>
Gets the address of nth voter who voted on Voting with voting_id
.
sourcepub fn get_voting(&self, voting_id: VotingId) -> Option<VotingStateMachine>
pub fn get_voting(&self, voting_id: VotingId) -> Option<VotingStateMachine>
Returns Voting for given id.
sourcepub fn propose_new_owner(&mut self, owner: Address)
pub fn propose_new_owner(&mut self, owner: Address)
Changes the ownership of the contract. Transfers ownership to the owner
.
Only the current owner is permitted to call this method.
Read more
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.
Read more
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.
Read more
sourcepub fn remove_from_whitelist(&mut self, address: Address)
pub fn remove_from_whitelist(&mut self, address: Address)
Remove address from the whitelist.
Read more
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.
Read more
.
sourcepub fn get_owner(&self) -> Option<Address>
pub fn get_owner(&self) -> Option<Address>
Returns the address of the current owner.
Read more
.
sourcepub fn finish_voting(
&mut self,
voting_id: VotingId,
voting_type: VotingType
) -> VotingSummary
pub fn finish_voting( &mut self, voting_id: VotingId, voting_type: VotingType ) -> VotingSummary
Finishes voting stage. Depending on stage, the voting can be converted to a formal one, end with a refund or convert the requester to a VA.
sourcepub fn vote(
&mut self,
voting_id: VotingId,
voting_type: VotingType,
choice: Choice,
stake: Balance
)
pub fn vote( &mut self, voting_id: VotingId, voting_type: VotingType, choice: Choice, stake: Balance )
Casts a vote. Read more
sourcepub fn variable_repository_address(&self) -> Address
pub fn variable_repository_address(&self) -> Address
Returns the address of Variable Repository contract.
sourcepub fn reputation_token_address(&self) -> Address
pub fn reputation_token_address(&self) -> Address
Returns the address of Reputation Token contract.
Trait Implementations§
source§impl Clone for OnboardingRequestContract
impl Clone for OnboardingRequestContract
source§fn clone(&self) -> OnboardingRequestContract
fn clone(&self) -> OnboardingRequestContract
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more