what does an action called my multisig contract looks like?
can an action called by multisig contract have multiple require_auth() asking distinct participant's authority?
The contract code handling an action can call require_auth multiple times with different accounts required. That means that the authorizations for that action need to include all of the required accounts (at appropriate permission levels) necessary to satisfy the require_auths of that action handler.
That is completely separate from the purpose of the eosio.msig contract, which I will get to momentarily.
With one important exception, all transactions must satisfy the permissions mapped to by the authorizations included in a transaction. The typical way of satisfying these authorizations is through signatures attached to the signed transaction. Users can create a transaction and add signatures to it as necessary until the required signatures are achieved, at which point the fully signed transaction can be broadcast into the network and eventually (assuming the signatures are valid and sufficient) be included into the blockchain.
The eosio.msig contract provides a more convenient way of doing this on-chain rather than requiring coordination among the various signers off-chain. I mentioned earlier that there is one important exception to the need for a transaction to satisfy the permissions mapped to by the authorizations included in a transaction. That exception is when a contract deployed on a privileged account (and the eosio.msig account is privileged on recommended deployments of EOSIO chains along with eosio) sends the transaction as a deferred transaction, which is exactly what the eosio.msig::exec action does with proposed transactions. However, prior to sending the transaction it ensures that all the provided approvals of the proposes transaction satisfy the required authorizations of the transaction (not because it needs to, but because this self-imposed restriction makes the contract safe to allow anyone to use).
So if you want to use the eosio.msig to propose, approve, and ultimately execute a transaction containing an action that when executed requires several authorizations to be satisfied, you can do so by:
- ensuring that the transaction to be proposed has the required authorizations included in the
authorizationfield of the action; - using the
eosio.msig::proposeaction to propose that transaction along with all the relevantpermission_levels that can satisfy the included authorizations of the transaction; - waiting until all required actors approve the proposed transaction using the
eosio.msig::approveaction; - and finally, executing the proposed transaction using
eosio.msig::execonce all the necessary approvals have been collected.
thx for the prompt reply!
@arhag i want to implement an action to do trading between virtual items in dApp and SYS coin. so i need authorities of both buyer and seller. is the right way to do it creating a new authority with threshold of 2? so that any transaction will ask both involver to give authority to fulfill the requirement. If that is right, how can i call the action? shall call it through multisig in this case?