BitClave implementation of Multiownable contract as improvement to OpenZeppelin Ownable contract
- Install truffle globally with
npm install -g truffle
- Install testrpc globally with
npm install -g ethereumjs-testrpc
- Install local packages with
npm install
- Run tests with
killall -9 node; npm test; killall -9 node;
On macOS you also need to install watchman: brew install watchman
- Supports up to 256 simultaneous owners
- Simple usage: add modifiers
onlyAnyOwner
andonlyManyOwners
- Supports multiple pending operations
- Allows owners to cancel pending operations
- Reset all pending operations on ownership transfering
contract SimplestMultiWallet is Multiownable {
bool avoidReentrancy = false;
function () public payable {
}
function transferTo(address to, uint256 amount) public onlyManyOwners {
require(!avoidReentrancy);
avoidReentrancy = true;
to.transfer(amount);
avoidReentrancy = false;
}
}
contract SimplestTokensMultiWallet is Multiownable {
bool avoidReentrancy = false;
function () public payable {
}
function transferTo(address to, uint256 amount) public onlyManyOwners {
require(!avoidReentrancy);
avoidReentrancy = true;
to.transfer(amount);
avoidReentrancy = false;
}
function transferTokensTo(address token, address to, uint256 amount) public onlyManyOwners {
require(!avoidReentrancy);
avoidReentrancy = true;
ERC20(token).transfer(to, amount);
avoidReentrancy = false;
}
}