1

I have a smart contract with various owner functions such as these:

function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _setOwner(newOwner);
    }
function pause() public onlyOwner {_pause();}
  
function unpause() public onlyOwner {_unpause();}

...

What would be the cleanest way to convert all of my owner functions to multi sig? Are there any standard templates I should be using?

Do I need to create a multi sig factory and instantiate a new multi sig wallet for each of the functions?

2 Answers 2

1

I would suggest to use an onlyWallet() modifier, which controls how other signatory functions can only be executed if the sending address is the multisig contract itself.

See:

https://johannlilly.medium.com/how-to-execute-functions-from-other-contracts-with-a-multisig-wallet-8b9b5ab0f680 (access to onlyWallet() modifier discussed here)

https://github.com/gnosis/MultiSigWallet/blob/master/contracts/MultiSigWallet.sol

You can also use this example as a reference to create multi-sig wallets:

https://solidity-by-example.org/app/multi-sig-wallet/

1

You can leave your contract as-is. Set the address of your multisig as owner with transferOwnership, and then those methods with onlyOwner should be called via executeTransaction in your multisig (as by Gnosis Safe). You can do this as normal via Web/Etherscan with Rabby, or via CLI or via API with 0xweb

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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