What’s the point of having getApprovers() in our MultiSig wallet.We never use it in our contract. If we don’t use something in the contract and it’s only to inform the front end,can we use an event instead. Same goes for getTransfers().
So, we define an event something like this:
event contractConstructed(address approvers, uint quorum);
And then emit the event in the constructor function like so:
In the front-end, we can use a web3.js function like getPastEvents(), subscribe(“logs”), or myContract.events.MyEvent() to get those emitted events and do whatever you need.
We can still pass in the array of approvers to the constructor, but we will have to use a loop in the constructor to populate the mapping. This is a one-off loop instead of having to loop through the approver array every time you use the onlyApprover modifier. And we can get rid of getApprovers(), the approvers, and getTransfers() although you we have to add a mapping for the approver.
I would note two other things. The first is your use of .transfer. Check out the link below as it explains why .send and .transfer are no longer recommended and how to use .call safely.
The second is that I don’t see how we transfer ether into the wallet contract. I can see how it is transferred out when enough participants sign off on a transfer, but I don’t see how ether gets into the contract in the first place.
Please let me know if I’m wrong about any of this .It’s a bit confusing