BitClave implementation of TokenWrapper contract to upgrade any existing pausable OpenZeppelin token
- 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-cli in separate terminal
scripts/rpc.sh
- Run tests with
npm test
On macOS you also need to install watchman: brew install watchman
- Add any functionality to your token without migrating any holders
- Requires token to be at least
Pausable
- Supports a lot of OpenZeppelin tokens:
BasicTokenWrapper
forBasicToken
StandardTokenWrapper
forStandardToken
BurnableTokenWrapper
forBurnableToken
MintableToken
itself- More coming soon ...
contract MyToken is StandardToken, PausableToken {
string public constant symbol = "MYT";
string public constant name = "MyToken";
uint8 public constant decimals = 18;
string public constant version = "1.0";
function MyToken() public {
totalSupply_ = 1000000 * 10**decimals;
balances[msg.sender] = totalSupply_;
}
}
You just need to pause()
it and create new upgraded token, based on the previous one:
contract MyToken2 is StandardTokenWrapper, PausableToken {
string public constant symbol = "MYT";
string public constant name = "MyToken";
uint8 public constant decimals = 18;
string public constant version = "2.0";
function MyToken2(address _token) public StandardTokenWrapper(_token) {
}
// Modern approve method from ERC827
function approve(address _spender, uint256 _value, bytes _data) public returns(bool) {
require(_spender != address(this));
super.approve(_spender, _value);
require(_spender.call(_data));
return true;
}
}