Skip to content

bitclave/Multiownable

Repository files navigation

Multiownable

Build Status Coverage Status

BitClave implementation of Multiownable contract as improvement to OpenZeppelin Ownable contract

Installation

  1. Install truffle globally with npm install -g truffle
  2. Install ganache-cli globally with npm install -g ganache-cli
  3. Install local packages with npm install
  4. Run ganache in separate terminal scripts/rpc.sh
  5. Run tests with npm test

On macOS you also need to install watchman: brew install watchman

Features

  1. Supports up to 256 simultaneous owners
  2. Simple usage: add modifiers onlyAnyOwner, onlyManyOwners, onlyAllOwners and onlySomeOwners(howMany)
  3. Supports multiple pending operations
  4. Allows owners to cancel pending operations
  5. Reset all pending operations on ownership transfering

Example of multisig wallet

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;
    }

}

Example of multisig wallet with ERC20 tokens support

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;
    }

}

About

BitClave implementation of Multiownable contract

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •