0

To preface, I'm super new to Solidity, so the answer might be super simple.

I've created a gnosis safe where 2/3 owners need to approve. I have a basic smart contract where I want to call a function I've defined called sendToUser... this function should propose a safe transaction ... do I just need to inherit the execTransaction here then I can use the function in my smart contract? https://github.com/gnosis/safe-contracts/blob/main/contracts/GnosisSafe.sol

2 Answers2

0
  1. To interact with another smart contract you need to declare an interface:
interface ICounter {
    function count() external view returns (uint);
function increment() external;

}

contract MyContract { function incrementCounter(address _counter) external { ICounter(_counter).increment(); }

function getCount(address _counter) external view returns (uint) {
    return ICounter(_counter).count();
}

}

  1. Proposing a Safe transaction. I assume that by proposing, you mean signing a transaction and sending it to the Safe Transaction service. To propose a safe transaction, your contract needs to implement the signature validation function defined in EIP-1271. How to generate a smart contract signature for Gnosis Safe contract is described here: How to sign a Gnosis-Safe transaction via Argent wallet + Wallet-Connect
mikheevm
  • 1,075
  • 1
  • 5
  • 11
0

I found this material very helpful

https://medium.com/gauntlet-networks/multisig-transactions-with-gnosis-safe-f5dbe67c1c2d

The idea is roughly as follows:

  • Setup a gnosis-safe and add signers
  • Create your custom contract. Decorate any function that needs to be only executable by the multisig with onlyOwner ( you can use openzepellin's Ownable.sol)
  • Deploy your custom smart-contract, transfer its ownership to the multisig address.
  • Execute the function calls via gnosis-safe ui, or directly against the deployed multisig onchain via smartcontract calls.
Edwin O.
  • 111
  • 3