0

Suppose I have a multisig wallet like a Gnosis Safe, which requires (say) two or three signers to approve any given transaction. In other words, the multisig wallet has its own wallet address, and 2 or 3 other wallet addresses must approve any transaction that is made.

What I want is for one of these "other" wallets to actually be a smart contract. There will be an owner of that contract who of course launches the contract and puts it into an active state. In the active state, it automatically approves any transaction that is launched by the other wallet owner for this multisig wallet. The smart contract also has a function where the contract owner can take it out of the active state so that no transactions are approved.

The flow would be as follows: Let's say we have a multisig wallet (eg Gnosis Safe) with two owners: 1. "John" and 2. "Smart Contract". John decides to send 1 Eth to another wallet, so John uses his Metamask, which is connected to the Gnosis Safe multisig wallet, to create and sign this transaction. Next, John uses some other pieces of software (say a simple web3 script in Javascript or python) that calls a function in Smart Contract requesting approval for this transaction. Smart Contract verifies that the request is from John and verifies that Smart Contract is in the active state. So, it gets the transaction and signs it. Now the transaction has gone through.

If the owner of Smart Contract ever decides that they don't want John making any more transactions then they can set the contract into the inactive state, and now John cannot make any more transactions.

Is this possible in a smart contract? For the function that John calls to request an approval, how is the transaction information passed, or is there some other way that Smart Contract can use to get access to this pending transaction? How can Smart Contract approve this transaction?

Finally, suppose I want to have this capability of the Eth, BSC, Avax and Polygon chains. I assume this means I have to have a version of this smart contract running on each of these chains?

Yes I have a good reason for asking if this is possible. It has to do with regulatory and taxation issues.

1 Answer 1

1

I can only answer very specific to the Safe, as this highly depends on the smart contract wallet.

With the Safe there are 2 possible approaches.

Starting with version 1.3.0 of the Safe it is possible to add a Guard. This guard could be controlled to prevent any transactions while it is in the "inactive" state.

Another solution would be to implement EIP-1271 (the legacy version) on a contract that controls the active or inactive state. That contract would revert when isValidSignature is called in the inactive state and the expected value otherwise.

Here an example how this can be done either with the Guard approach or with EIP-1271 signatures: https://gist.github.com/rmeissner/26bae7deaac62db764abc9a03902094e

4
  • Richard, thanks! This may be a different solution to my problem. Is it possible to allow some external "custodian" to control the Guard? That's really what I am after - I need to give a trusted other party the ability to turn access off an on to the Gnosis safe. When access is on, only my signature is needed for a trx. When it is off, no traxs are allowed. Can this be done?
    – Marc
    Jan 19 at 21:19
  • Yes this is possible with both approaches described. I can try to get you some example code tomorrow.
    – Richard
    Jan 19 at 22:53
  • I added an example to the answer
    – Richard
    Jan 20 at 14:17
  • This is awesome, thanks! Two quick questions: If I use this approach for a Gnosis Safe wallet and want to store coins on Eth, BSC, Phantom and Avalanche chains, does this mean I need to launch a version of the guard contract on each of the 4 chains? So each contract will have its own address on its own chain? How would I specify the guard contract on each chain when setting up the Gnosis Safe?
    – Marc
    Jan 21 at 0:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.