pub struct ContractObj<A>(/* private fields */)
where
A: VMApi;
Trait Implementations§
Source§impl<A> CallableContract for ContractObj<A>
impl<A> CallableContract for ContractObj<A>
Source§impl<A> ContractBase for ContractObj<A>where
A: VMApi,
impl<A> ContractBase for ContractObj<A>where
A: VMApi,
type Api = A
Source§fn call_value(&self) -> CallValueWrapper<Self::Api>
fn call_value(&self) -> CallValueWrapper<Self::Api>
Gateway into the call value retrieval functionality.
The payment annotations should normally be the ones to handle this,
but the developer is also given direct access to the API.
Source§fn send(&self) -> SendWrapper<Self::Api>
fn send(&self) -> SendWrapper<Self::Api>
Gateway to the functionality related to sending transactions from the current contract.
Source§fn tx(&self) -> Tx<TxScEnv<Self::Api>, (), (), (), (), (), ()>
fn tx(&self) -> Tx<TxScEnv<Self::Api>, (), (), (), (), (), ()>
Starts the declaration of a new transaction.
Source§fn send_raw(&self) -> SendRawWrapper<Self::Api>
fn send_raw(&self) -> SendRawWrapper<Self::Api>
Low-level functionality related to sending transactions from the current contract. Read more
Source§fn blockchain(&self) -> BlockchainWrapper<Self::Api>
fn blockchain(&self) -> BlockchainWrapper<Self::Api>
Gateway blockchain info related to the current transaction and to accounts.
Source§fn crypto(&self) -> CryptoWrapper<Self::Api>
fn crypto(&self) -> CryptoWrapper<Self::Api>
Stateless crypto functions provided by the Arwen VM.
Source§fn serializer(&self) -> ManagedSerializer<Self::Api>
fn serializer(&self) -> ManagedSerializer<Self::Api>
Component that provides contract developers access
to highly optimized manual serialization and deserialization.
fn error(&self) -> ErrorHelper<Self::Api>
fn storage_raw(&self) -> StorageRawWrapper<Self::Api>
Source§impl<A> EndpointWrappers for ContractObj<A>where
A: VMApi,
impl<A> EndpointWrappers for ContractObj<A>where
A: VMApi,
fn call_change_quorum(&mut self)
fn call_change_min_token_balance_for_proposing(&mut self)
fn call_change_voting_delay_in_blocks(&mut self)
fn call_change_voting_period_in_blocks(&mut self)
fn call_change_lock_time_after_voting_ends_in_blocks(&mut self)
fn call_governance_token_id(&mut self)
fn call_quorum(&mut self)
fn call_min_fee_for_propose(&mut self)
fn call_min_token_balance_for_proposing(&mut self)
fn call_voting_delay_in_blocks(&mut self)
fn call_voting_period_in_blocks(&mut self)
fn call_lock_time_after_voting_ends_in_blocks(&mut self)
fn call(&mut self, fn_name: &str) -> bool
fn callback_selector( &mut self, ___cb_closure___: &CallbackClosureForDeser<Self::Api>, ) -> CallbackSelectorResult
fn callback(&mut self)
Source§impl<A> EndpointWrappers for ContractObj<A>where
A: VMApi,
impl<A> EndpointWrappers for ContractObj<A>where
A: VMApi,
fn call(&mut self, fn_name: &str) -> bool
fn callback_selector( &mut self, ___cb_closure___: &CallbackClosureForDeser<Self::Api>, ) -> CallbackSelectorResult
fn callback(&mut self)
Source§impl<A> EndpointWrappers for ContractObj<A>where
A: VMApi,
impl<A> EndpointWrappers for ContractObj<A>where
A: VMApi,
fn call_deposit_tokens_for_proposal(&mut self)
fn call_claim_deposited_tokens(&mut self)
fn call_propose(&mut self)
fn call_vote(&mut self)
fn call_queue(&mut self)
fn call_execute(&mut self)
fn call_cancel(&mut self)
fn call_get_proposal_status(&mut self)
fn call_get_proposer(&mut self)
fn call_get_proposal_description(&mut self)
fn call_get_proposal_actions(&mut self)
fn call_proposal_votes(&mut self)
fn call_total_votes(&mut self)
fn call_total_downvotes(&mut self)
fn call(&mut self, fn_name: &str) -> bool
fn callback_selector( &mut self, ___cb_closure___: &CallbackClosureForDeser<Self::Api>, ) -> CallbackSelectorResult
fn callback(&mut self)
impl<A> AutoImpl for ContractObj<A>where
A: VMApi,
impl<A> AutoImpl for ContractObj<A>where
A: VMApi,
impl<A> AutoImpl for ContractObj<A>where
A: VMApi,
Auto Trait Implementations§
impl<A> Freeze for ContractObj<A>
impl<A> RefUnwindSafe for ContractObj<A>where
A: RefUnwindSafe,
impl<A> Send for ContractObj<A>
impl<A> Sync for ContractObj<A>
impl<A> Unpin for ContractObj<A>where
A: Unpin,
impl<A> UnwindSafe for ContractObj<A>where
A: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<C> GovernanceConfigurablePropertiesModule for Cwhere
C: AutoImpl,
impl<C> GovernanceConfigurablePropertiesModule for Cwhere
C: AutoImpl,
fn governance_token_id( &self, ) -> SingleValueMapper<<C as ContractBase>::Api, TokenIdentifier<<C as ContractBase>::Api>>
fn quorum( &self, ) -> SingleValueMapper<<C as ContractBase>::Api, BigUint<<C as ContractBase>::Api>>
fn min_fee_for_propose( &self, ) -> SingleValueMapper<<C as ContractBase>::Api, BigUint<<C as ContractBase>::Api>>
fn min_token_balance_for_proposing( &self, ) -> SingleValueMapper<<C as ContractBase>::Api, BigUint<<C as ContractBase>::Api>>
fn voting_delay_in_blocks( &self, ) -> SingleValueMapper<<C as ContractBase>::Api, u64>
fn voting_period_in_blocks( &self, ) -> SingleValueMapper<<C as ContractBase>::Api, u64>
fn lock_time_after_voting_ends_in_blocks( &self, ) -> SingleValueMapper<<C as ContractBase>::Api, u64>
Source§fn init_governance_module(
&self,
governance_token_id: TokenIdentifier<Self::Api>,
quorum: BigUint<Self::Api>,
min_token_balance_for_proposal: BigUint<Self::Api>,
voting_delay_in_blocks: u64,
voting_period_in_blocks: u64,
lock_time_after_voting_ends_in_blocks: u64,
)
fn init_governance_module( &self, governance_token_id: TokenIdentifier<Self::Api>, quorum: BigUint<Self::Api>, min_token_balance_for_proposal: BigUint<Self::Api>, voting_delay_in_blocks: u64, voting_period_in_blocks: u64, lock_time_after_voting_ends_in_blocks: u64, )
The module can’t protect its storage from the main SC, so it’s the developers responsibility
to not modify parameters manually
fn change_quorum(&self, new_value: BigUint<Self::Api>)
fn change_min_token_balance_for_proposing(&self, new_value: BigUint<Self::Api>)
fn change_voting_delay_in_blocks(&self, new_value: u64)
fn change_voting_period_in_blocks(&self, new_value: u64)
fn change_lock_time_after_voting_ends_in_blocks(&self, new_value: u64)
fn require_caller_self(&self)
fn try_change_quorum(&self, new_value: BigUint<Self::Api>)
fn try_change_min_token_balance_for_proposing( &self, new_value: BigUint<Self::Api>, )
fn try_change_voting_delay_in_blocks(&self, new_value: u64)
fn try_change_voting_period_in_blocks(&self, new_value: u64)
fn try_change_lock_time_after_voting_ends_in_blocks(&self, new_value: u64)
Source§impl<C> GovernanceEventsModule for Cwhere
C: AutoImpl,
impl<C> GovernanceEventsModule for Cwhere
C: AutoImpl,
fn proposal_created_event( &self, proposal_id: usize, proposer: &ManagedAddress<<C as ContractBase>::Api>, start_block: u64, proposal: &GovernanceProposal<<C as ContractBase>::Api>, )
fn up_vote_cast_event( &self, up_voter: &ManagedAddress<<C as ContractBase>::Api>, proposal_id: usize, nr_votes: &BigUint<<C as ContractBase>::Api>, )
fn down_vote_cast_event( &self, down_voter: &ManagedAddress<<C as ContractBase>::Api>, proposal_id: usize, nr_downvotes: &BigUint<<C as ContractBase>::Api>, )
fn down_veto_vote_cast_event( &self, down_veto_voter: &ManagedAddress<<C as ContractBase>::Api>, proposal_id: usize, nr_downvotes: &BigUint<<C as ContractBase>::Api>, )
fn abstain_vote_cast_event( &self, abstain_voter: &ManagedAddress<<C as ContractBase>::Api>, proposal_id: usize, nr_downvotes: &BigUint<<C as ContractBase>::Api>, )
fn proposal_canceled_event(&self, proposal_id: usize)
fn proposal_queued_event(&self, proposal_id: usize, queued_block: u64)
fn proposal_executed_event(&self, proposal_id: usize)
fn user_deposit_event( &self, address: &ManagedAddress<<C as ContractBase>::Api>, proposal_id: usize, payment: &EsdtTokenPayment<<C as ContractBase>::Api>, )
fn user_claim_event( &self, address: &ManagedAddress<<C as ContractBase>::Api>, proposal_id: usize, payment: &EsdtTokenPayment<<C as ContractBase>::Api>, )
Source§impl<C> GovernanceModule for C
impl<C> GovernanceModule for C
Source§fn proposal_start_block(
&self,
proposal_id: usize,
) -> SingleValueMapper<<C as ContractBase>::Api, u64>
fn proposal_start_block( &self, proposal_id: usize, ) -> SingleValueMapper<<C as ContractBase>::Api, u64>
Not stored under “proposals”, as that would require deserializing the whole struct
fn proposals( &self, ) -> VecMapper<<C as ContractBase>::Api, GovernanceProposal<<C as ContractBase>::Api>>
fn proposal_queue_block( &self, proposal_id: usize, ) -> SingleValueMapper<<C as ContractBase>::Api, u64>
fn user_voted_proposals( &self, user: &ManagedAddress<<C as ContractBase>::Api>, ) -> UnorderedSetMapper<<C as ContractBase>::Api, usize>
fn proposal_votes( &self, proposal_id: usize, ) -> SingleValueMapper<<C as ContractBase>::Api, ProposalVotes<<C as ContractBase>::Api>>
fn total_votes( &self, proposal_id: usize, ) -> SingleValueMapper<<C as ContractBase>::Api, BigUint<<C as ContractBase>::Api>>
fn total_downvotes( &self, proposal_id: usize, ) -> SingleValueMapper<<C as ContractBase>::Api, BigUint<<C as ContractBase>::Api>>
Source§fn deposit_tokens_for_proposal(&self, proposal_id: ProposalId)
fn deposit_tokens_for_proposal(&self, proposal_id: ProposalId)
Used to deposit tokens for “payable” actions.
Funds will be returned if the proposal is defeated.
To keep the logic simple, all tokens have to be deposited at once
fn claim_deposited_tokens(&self, proposal_id: usize)
Source§fn propose(
&self,
description: ManagedBuffer<Self::Api>,
actions: MultiValueEncoded<Self::Api, GovernanceActionAsMultiArg<Self::Api>>,
) -> usize
fn propose( &self, description: ManagedBuffer<Self::Api>, actions: MultiValueEncoded<Self::Api, GovernanceActionAsMultiArg<Self::Api>>, ) -> usize
Propose a list of actions.
A maximum of MAX_GOVERNANCE_PROPOSAL_ACTIONS can be proposed at a time. Read more
Source§fn vote(&self, proposal_id: usize, vote: VoteType)
fn vote(&self, proposal_id: usize, vote: VoteType)
Vote on a proposal by depositing any amount of governance tokens
These tokens will be locked until the proposal is executed or cancelled.
Source§fn queue(&self, proposal_id: usize)
fn queue(&self, proposal_id: usize)
Queue a proposal for execution.
This can be done only if the proposal has reached the quorum.
A proposal is considered successful and ready for queing if
total_votes - total_downvotes >= quorum
Source§fn execute(&self, proposal_id: usize)
fn execute(&self, proposal_id: usize)
Execute a previously queued proposal.
This will clear the proposal and unlock the governance tokens.
Said tokens can then be withdrawn and used to vote/downvote other proposals.
fn get_proposal_status(&self, proposal_id: usize) -> GovernanceProposalStatus
fn quorum_and_vote_reached(&self, proposal_id: ProposalId) -> bool
fn get_proposer( &self, proposal_id: usize, ) -> OptionalValue<ManagedAddress<Self::Api>>
fn get_proposal_description( &self, proposal_id: usize, ) -> OptionalValue<ManagedBuffer<Self::Api>>
fn get_proposal_actions( &self, proposal_id: usize, ) -> MultiValueEncoded<Self::Api, GovernanceActionAsMultiArg<Self::Api>>
fn refund_payments(&self, proposal_id: ProposalId)
fn require_payment_token_governance_token(&self) -> EsdtTokenPayment<Self::Api>
fn require_valid_proposal_id(&self, proposal_id: usize)
fn require_caller_not_self(&self)
fn is_valid_proposal_id(&self, proposal_id: usize) -> bool
fn proposal_reached_min_fees(&self, proposal_id: ProposalId) -> bool
fn proposal_exists(&self, proposal_id: usize) -> bool
fn total_gas_needed( &self, actions: &ArrayVec<GovernanceAction<Self::Api>, MAX_GOVERNANCE_PROPOSAL_ACTIONS>, ) -> u64
Source§fn clear_proposal(&self, proposal_id: usize)
fn clear_proposal(&self, proposal_id: usize)
specific votes/downvotes are not cleared,
as they’re used for reclaim tokens logic and cleared one by one