Skip to content
This repository has been archived by the owner on Jan 14, 2025. It is now read-only.

Commit

Permalink
Add multisig support for data in transactions or if destination addre…
Browse files Browse the repository at this point in the history
…ss has code
  • Loading branch information
bencxr committed Aug 29, 2016
1 parent 0aeff24 commit 19862a3
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions wallet/wallet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -330,14 +330,16 @@ contract Wallet is multisig, multiowned, daylimit {
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
// Outside-visible transact entry point. Executes transacion immediately if below daily spend limit.

// Outside-visible transact entry point. Executes transaction immediately if below daily spend limit.
// If not, goes into multisig process. We provide a hash on return to allow the sender to provide
// shortcuts for the other confirmations (allowing them to avoid replicating the _to, _value
// and _data arguments). They still get the option of using them if they want, anyways.
function execute(address _to, uint _value, bytes _data) external onlyowner returns (bytes32 _r) {
// first, take the opportunity to check that we're under the daily limit.
if (underLimit(_value)) {
// we also must check that there is no data (this is not a contract invocation),
// since we are unable to determine the value outcome of it.
if (underLimit(_value) && !hasCode(_to)) {
SingleTransact(msg.sender, _value, _to, _data);
// yes - just execute the call.
_to.call.value(_value)(_data);
Expand Down Expand Up @@ -373,6 +375,13 @@ contract Wallet is multisig, multiowned, daylimit {
super.clearPending();
}

// Used to determine if an address may execute code
function hasCode(address _addr) internal constant returns (bool) {
uint size;
assembly { size := extcodesize(_addr) }
return size > 0;
}

// FIELDS

// pending transactions we have at present.
Expand Down

0 comments on commit 19862a3

Please sign in to comment.