How Does The Ethereum Multisig Contract Wallet Execute Contract Functions?

In particular, how does the wallet execute(...) function call the functions in other contracts?

I’m trying to work out how contract wallets execute The DAO refund contract approve(...) and withdraw() functions, as this was asked by a user referencing the Q&A – How do I convert my The DAO tokens into ethers on the Ethereum Classic chain?.

The highlighted lines 344 and 349 in the source code below show the execute(...) function calling the _to.call.value(_value)(_data); for a single signature transaction.

The highlighted lines 364 and 366 in the source code below show the confirm(...) function calling the m_txs[_h].to.call.value(m_txs[_h].value)(m_txs[_h].data); for a multisig transaction.

For this to work, the Ethereum Wallet converts the function call into the data parameter sent above using the same procedure as show under the Use Your Contract Using curl And JSON-RPC section in How to call a contract method using the eth_call JSON-RPC API.

The Ethereum Wallet then converts the execute(...) with the data parameter, converted again using the same procedure as described in the previous paragraph.

From https://github.com/ethereum/dapp-bin/wallet/wallet.sol:

 

This entry was posted in Blog and tagged , . Bookmark the permalink.