Skip to content

Latest commit

 

History

History
139 lines (101 loc) · 7.53 KB

documentation.md

File metadata and controls

139 lines (101 loc) · 7.53 KB

Multisig wallet

BRLC-multisig is a multi-signature wallet used to ensure the decentralization and security of any processes performed through interaction with smart contracts. Only owners of the multisig wallet can submit, approve, execute and revoke transactions. All transactions have a cooldown period and expiration time. Transactions cannot be executed before the end of the cooldown period and cannot be executed after the expiration. The default cooldown period is zero seconds. The default expiration time is 365 days. Both values can be changed after multisig is deployed.


Smart contracts

IMultiSigWallet - An interface of multisig wallet contracts.

MultiSigWalletBase - An abstract contract that contains the core logic for transactions processing and wallet configuration. This contract is used through inheritance as a base contract for upgradable and non-upgradable versions of the multisig wallet.

MultisigWalletStorage A storage contract with all the variables used by a multisig wallet. It is divided into different file versions. When we need to add new storage variables, we create a new version of the MultiSigWalletStorage contract.

MultiSigWalletUpgradeable - Upgradeable version of multisig wallet. Inherited from MultiSigWalletBase contract and initialized with OpenZeppelin initialize function.

MultiSigWallet - Non-upgradeable version of multisig wallet, inherited from MultisigWalletBase contract and initialized with a constructor.

MultiSigWalletFactory - The factory contract used to deploy new multisig wallets.


Functionality

Function submit - submits new transaction and adds it to transactions array. Emits a Submit event. Can be called only by the owner.

Function submitAndApprove - submits new transaction and adds it to transactions array. Emits a Submit event. Approves submitted transaction. Emits anApprove event. Can be called only by the owner.

  • Reverts if the selected transaction does not exist.
  • Reverts if the selected transaction is expired.
  • Reverts if the selected transaction is executed.
  • Reverts if the selected transaction is already approved by the caller.

Function approve - approves selected transaction. Emits an Approve event. Can be called only by the owner.

  • Reverts if the selected transaction does not exist.
  • Reverts if the selected transaction is expired.
  • Reverts if the selected transaction is executed.
  • Reverts if the selected transaction is already approved by the caller.

Function approveAndExecute - approves and executes the selected transaction. Emits an Approve event. Executes transaction. Emits an Execute event. Can be called only by the owner.

  • Reverts if the selected transaction does not exist.
  • Reverts if the selected transaction is expired.
  • Reverts if the selected transaction is executed.
  • Reverts if the selected transaction is already approved by the caller.
  • Reverts if the selected transaction is executed.
  • Reverts if the selected transaction is on cooldown.
  • Reverts if the approvals amount is less than the amount of required approvals.

Function execute - executes the selected transaction. Emits an Execute event. Can be called only by the owner. Allows repeating execution attempt if previous execution failed. Owners are able to choose the order of the execution of approved transactions.

  • Reverts if the selected transaction does not exist.
  • Reverts if the selected transaction is expired.
  • Reverts if the selected transaction is executed.
  • Reverts if the selected transaction is on cooldown.
  • Reverts if the approvals amount is less than the amount of required approvals.
  • Reverts if the transaction execution fails.

Function revoke - revokes approval from the selected transaction. Emits a Revoke event. Can be called only by the owner.

  • Reverts if the selected transaction does not exist.
  • Reverts if the selected transaction is expired.
  • Reverts if the selected transaction is executed.
  • Reverts if the selected transaction is not approved by the caller.

Function configureOwners - changes owners array and amount of required approvals. Emits a ConfigureOwners event. Function execution does not change the state of submitted transactions, the amount of approvals made by previous owners will stay the same.

  • Reverts if the caller is not a multisig itself.
  • Reverts if the array of owners is empty.
  • Reverts if one of the owners is zero address.
  • Reverts if the owner address is duplicated.
  • Reverts if the number of required approvals is bigger than the amount of owners.
  • Reverts if the number of required approvals is zero.

Function configureExpirationTime - changes default expiration time of transactions. Emits a ConfigureExpirationTime event. Can be any amount of time bigger than the allowed minimum.

  • Reverts if the caller is not a multisig itself.
  • Reverts if the passed expiration time is less than the minimum allowed

Function configureCooldownTime - changes default cooldown time of transactions. Emits a ConfigureCooldownTime event.

  • Reverts if the caller is not a multisig itself.

constructor - sets the owners of the multisig, number of required approvals and the expiration time (365 days by default).

  • Reverts if the array of owners is empty.
  • Reverts if one of the owners is zero address.
  • Reverts if the owner address is duplicated.
  • Reverts if the number of required approvals is bigger than the amount of owners.
  • Reverts if the number of required approvals is zero.

Function initialize - initializes the contract with the selected parameters. Sets the owners of the multisig, number of required approvals and the expiration time (365 days by default).

  • Upgrade can be called only by multisig itself.
  • Reverts if the array of owners is empty.
  • Reverts if one of the owners is zero address.
  • Reverts if the owner address is duplicated.
  • Reverts if the number of required approvals is bigger than the amount of owners.
  • Reverts if the number of required approvals is zero.
  • Reverts if the number of required approvals is zero.

Function deployNewWallet - creates new non-upgradeable instance of multisig wallet. Emits a NewWallet event.

  • Reverts if the array of owners is empty.
  • Reverts if one of the owners is zero address.
  • Reverts if the owner address is duplicated.
  • Reverts if the number of required approvals is zero.
  • Reverts if the number of required approvals is bigger than the amount of owners.