-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a2e4697
commit 7760c3c
Showing
13 changed files
with
387 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,220 @@ | ||
// Code generated by the multiversx-sc proxy generator. DO NOT EDIT. | ||
|
||
//////////////////////////////////////////////////// | ||
////////////////// AUTO-GENERATED ////////////////// | ||
//////////////////////////////////////////////////// | ||
|
||
#![allow(dead_code)] | ||
#![allow(clippy::all)] | ||
|
||
use multiversx_sc::proxy_imports::*; | ||
|
||
pub struct MultisigProxy; | ||
|
||
impl<Env, From, To, Gas> TxProxyTrait<Env, From, To, Gas> for MultisigProxy | ||
where | ||
Env: TxEnv, | ||
From: TxFrom<Env>, | ||
To: TxTo<Env>, | ||
Gas: TxGas<Env>, | ||
{ | ||
type TxProxyMethods = MultisigProxyMethods<Env, From, To, Gas>; | ||
|
||
fn proxy_methods(self, tx: Tx<Env, From, To, (), Gas, (), ()>) -> Self::TxProxyMethods { | ||
MultisigProxyMethods { wrapped_tx: tx } | ||
} | ||
} | ||
|
||
pub struct MultisigProxyMethods<Env, From, To, Gas> | ||
where | ||
Env: TxEnv, | ||
From: TxFrom<Env>, | ||
To: TxTo<Env>, | ||
Gas: TxGas<Env>, | ||
{ | ||
wrapped_tx: Tx<Env, From, To, (), Gas, (), ()>, | ||
} | ||
|
||
#[rustfmt::skip] | ||
impl<Env, From, To, Gas> MultisigProxyMethods<Env, From, To, Gas> | ||
where | ||
Env: TxEnv, | ||
Env::Api: VMApi, | ||
From: TxFrom<Env>, | ||
To: TxTo<Env>, | ||
Gas: TxGas<Env>, | ||
{ | ||
/// Iterates through all actions and retrieves those that are still pending. | ||
/// Serialized full action data: | ||
/// - the action id | ||
/// - the serialized action data | ||
/// - (number of signers followed by) list of signer addresses. | ||
pub fn get_pending_action_full_info( | ||
self, | ||
) -> TxTypedCall<Env, From, To, NotPayable, Gas, MultiValueEncoded<Env::Api, ActionFullInfo<Env::Api>>> { | ||
self.wrapped_tx | ||
.payment(NotPayable) | ||
.raw_call("getPendingActionFullInfo") | ||
.original_result() | ||
} | ||
|
||
/// Indicates user rights. | ||
/// `0` = no rights, | ||
/// `1` = can propose, but not sign, | ||
/// `2` = can propose and sign. | ||
pub fn user_role< | ||
Arg0: ProxyArg<ManagedAddress<Env::Api>>, | ||
>( | ||
self, | ||
user: Arg0, | ||
) -> TxTypedCall<Env, From, To, NotPayable, Gas, UserRole> { | ||
self.wrapped_tx | ||
.payment(NotPayable) | ||
.raw_call("userRole") | ||
.argument(&user) | ||
.original_result() | ||
} | ||
|
||
/// Lists all users that can sign actions. | ||
pub fn get_all_board_members( | ||
self, | ||
) -> TxTypedCall<Env, From, To, NotPayable, Gas, MultiValueEncoded<Env::Api, ManagedAddress<Env::Api>>> { | ||
self.wrapped_tx | ||
.payment(NotPayable) | ||
.raw_call("getAllBoardMembers") | ||
.original_result() | ||
} | ||
|
||
/// Lists all proposers that are not board members. | ||
pub fn get_all_proposers( | ||
self, | ||
) -> TxTypedCall<Env, From, To, NotPayable, Gas, MultiValueEncoded<Env::Api, ManagedAddress<Env::Api>>> { | ||
self.wrapped_tx | ||
.payment(NotPayable) | ||
.raw_call("getAllProposers") | ||
.original_result() | ||
} | ||
|
||
/// Serialized action data of an action with index. | ||
pub fn get_action_data< | ||
Arg0: ProxyArg<usize>, | ||
>( | ||
self, | ||
action_id: Arg0, | ||
) -> TxTypedCall<Env, From, To, NotPayable, Gas, Action<Env::Api>> { | ||
self.wrapped_tx | ||
.payment(NotPayable) | ||
.raw_call("getActionData") | ||
.argument(&action_id) | ||
.original_result() | ||
} | ||
|
||
/// Gets addresses of all users who signed an action. | ||
/// Does not check if those users are still board members or not, | ||
/// so the result may contain invalid signers. | ||
pub fn get_action_signers< | ||
Arg0: ProxyArg<usize>, | ||
>( | ||
self, | ||
action_id: Arg0, | ||
) -> TxTypedCall<Env, From, To, NotPayable, Gas, ManagedVec<Env::Api, ManagedAddress<Env::Api>>> { | ||
self.wrapped_tx | ||
.payment(NotPayable) | ||
.raw_call("getActionSigners") | ||
.argument(&action_id) | ||
.original_result() | ||
} | ||
|
||
/// Gets addresses of all users who signed an action and are still board members. | ||
/// All these signatures are currently valid. | ||
pub fn get_action_signer_count< | ||
Arg0: ProxyArg<usize>, | ||
>( | ||
self, | ||
action_id: Arg0, | ||
) -> TxTypedCall<Env, From, To, NotPayable, Gas, usize> { | ||
self.wrapped_tx | ||
.payment(NotPayable) | ||
.raw_call("getActionSignerCount") | ||
.argument(&action_id) | ||
.original_result() | ||
} | ||
|
||
/// It is possible for board members to lose their role. | ||
/// They are not automatically removed from all actions when doing so, | ||
/// therefore the contract needs to re-check every time when actions are performed. | ||
/// This function is used to validate the signers before performing an action. | ||
/// It also makes it easy to check before performing an action. | ||
pub fn get_action_valid_signer_count< | ||
Arg0: ProxyArg<usize>, | ||
>( | ||
self, | ||
action_id: Arg0, | ||
) -> TxTypedCall<Env, From, To, NotPayable, Gas, usize> { | ||
self.wrapped_tx | ||
.payment(NotPayable) | ||
.raw_call("getActionValidSignerCount") | ||
.argument(&action_id) | ||
.original_result() | ||
} | ||
} | ||
|
||
#[type_abi] | ||
#[derive(TopEncode)] | ||
pub struct ActionFullInfo<Api> | ||
where | ||
Api: ManagedTypeApi, | ||
{ | ||
pub action_id: usize, | ||
pub action_data: Action<Api>, | ||
pub signers: ManagedVec<Api, ManagedAddress<Api>>, | ||
} | ||
|
||
#[rustfmt::skip] | ||
#[type_abi] | ||
#[derive(NestedEncode, NestedDecode, TopEncode, TopDecode, Clone)] | ||
pub enum Action<Api> | ||
where | ||
Api: ManagedTypeApi, | ||
{ | ||
Nothing, | ||
AddBoardMember(ManagedAddress<Api>), | ||
AddProposer(ManagedAddress<Api>), | ||
RemoveUser(ManagedAddress<Api>), | ||
ChangeQuorum(usize), | ||
SendTransferExecute(CallActionData<Api>), | ||
SendAsyncCall(CallActionData<Api>), | ||
SCDeployFromSource { | ||
amount: BigUint<Api>, | ||
source: ManagedAddress<Api>, | ||
code_metadata: CodeMetadata, | ||
arguments: ManagedVec<Api, ManagedBuffer<Api>>, | ||
}, | ||
SCUpgradeFromSource { | ||
sc_address: ManagedAddress<Api>, | ||
amount: BigUint<Api>, | ||
source: ManagedAddress<Api>, | ||
code_metadata: CodeMetadata, | ||
arguments: ManagedVec<Api, ManagedBuffer<Api>>, | ||
}, | ||
} | ||
|
||
#[type_abi] | ||
#[derive(NestedEncode, NestedDecode, Clone)] | ||
pub struct CallActionData<Api> | ||
where | ||
Api: ManagedTypeApi, | ||
{ | ||
pub to: ManagedAddress<Api>, | ||
pub egld_amount: BigUint<Api>, | ||
pub endpoint_name: ManagedBuffer<Api>, | ||
pub arguments: ManagedVec<Api, ManagedBuffer<Api>>, | ||
} | ||
|
||
#[type_abi] | ||
#[derive(TopEncode, TopDecode)] | ||
pub enum UserRole { | ||
None, | ||
Proposer, | ||
BoardMember, | ||
} |
Oops, something went wrong.