Skip to content

Require both owners confirmation using `msg.data`

Notifications You must be signed in to change notification settings

b9lab/both-needed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Both signatures needed

Demonstrates one way of implementing the constraint whereby 2 accounts are needed to validate the storage of a value. It makes use of msg.data and is implemented in a modifier.

modifier isConfirmed {
    bytes32 key = hashData(msg.data);
    if (confirmations[key].confirmed[msg.sender]) {
        return;
    }
    confirmations[key].count++;
    confirmations[key].confirmed[msg.sender] = true;
    if (confirmations[key].count < 2) {
        OnUnfinishedConfirmation(key);
        return;
    }
    delete confirmations[key];
    _;
}

Tests require 4 accounts with ether.

About

Require both owners confirmation using `msg.data`

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published