BitClave implementation of Multiownable contract as improvement to OpenZeppelin Ownable contract
- Install truffle globally with
npm install -g truffle
- Install ganache-cli globally with
npm install -g ganache-cli
- Install local packages with
npm install
- Run ganache in separate terminal
scripts/rpc.sh
- Run tests with
npm test
On macOS you also need to install watchman: brew install watchman
- Supports up to 256 simultaneous owners
- Simple usage: add modifiers
onlyAnyOwner
,onlyManyOwners
,onlyAllOwners
andonlySomeOwners(howMany)
- 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;
}
}