mirror of
git://holbrook.no/erc20-demurrage-token
synced 2024-11-21 15:56:46 +01:00
Remove minter alias in contract
This commit is contained in:
parent
4e6e5300f7
commit
7982dbae97
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -146,9 +146,14 @@ class DemurrageToken(ERC20, SealedContract, ExpiryContract):
|
||||
return tx
|
||||
|
||||
|
||||
# backwards compatibility
|
||||
def add_minter(self, contract_address, sender_address, address, tx_format=TxFormat.JSONRPC):
|
||||
return self.add_writer(contract_address, sender_address, address, tx_format=tx_format)
|
||||
|
||||
|
||||
def add_writer(self, contract_address, sender_address, address, tx_format=TxFormat.JSONRPC):
|
||||
enc = ABIContractEncoder()
|
||||
enc.method('addMinter')
|
||||
enc.method('addWriter')
|
||||
enc.typ(ABIContractType.ADDRESS)
|
||||
enc.address(address)
|
||||
data = enc.get()
|
||||
@ -169,9 +174,15 @@ class DemurrageToken(ERC20, SealedContract, ExpiryContract):
|
||||
tx = self.finalize(tx, tx_format)
|
||||
return tx
|
||||
|
||||
|
||||
# backwards compatibility
|
||||
def remove_minter(self, contract_address, sender_address, address, tx_format=TxFormat.JSONRPC):
|
||||
return self.delete_writer(contract_address, sender_address, address, tx_format=tx_format)
|
||||
|
||||
|
||||
def delete_writer(self, contract_address, sender_address, address, tx_format=TxFormat.JSONRPC):
|
||||
enc = ABIContractEncoder()
|
||||
enc.method('removeMinter')
|
||||
enc.method('deleteWriter')
|
||||
enc.typ(ABIContractType.ADDRESS)
|
||||
enc.address(address)
|
||||
data = enc.get()
|
||||
|
@ -77,6 +77,12 @@ class TestTokenDeploy:
|
||||
r = rpc.do(o)
|
||||
self.start_time = r['timestamp']
|
||||
|
||||
(tx_hash, o) = interface.add_writer(self.address, deployer_address, deployer_address)
|
||||
r = rpc.do(o)
|
||||
o = receipt(tx_hash)
|
||||
r = rpc.do(o)
|
||||
assert r['status'] == 1
|
||||
|
||||
return self.address
|
||||
|
||||
|
||||
|
@ -27,6 +27,9 @@ class TestAmounts(TestDemurrageDefault):
|
||||
c = DemurrageToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
(tx_hash, o) = c.mint_to(self.address, self.accounts[0], self.accounts[1], 1000)
|
||||
r = self.rpc.do(o)
|
||||
o = receipt(tx_hash)
|
||||
r = self.rpc.do(o)
|
||||
self.assertEqual(r['status'], 1)
|
||||
|
||||
self.backend.time_travel(self.start_time + self.period_seconds)
|
||||
|
||||
|
@ -138,7 +138,6 @@ contract DemurrageTokenSingleNocap {
|
||||
|
||||
// ACL setup
|
||||
owner = msg.sender;
|
||||
// minter[owner] = true;
|
||||
|
||||
// ERC20 setup
|
||||
name = _name;
|
||||
@ -222,26 +221,20 @@ contract DemurrageTokenSingleNocap {
|
||||
}
|
||||
|
||||
// Given address will be allowed to call the mintTo() function
|
||||
function addMinter(address _minter) public returns (bool) {
|
||||
function addWriter(address _minter) public returns (bool) {
|
||||
require(!isSealed(MINTER_STATE));
|
||||
require(msg.sender == owner);
|
||||
minter[_minter] = true;
|
||||
return true;
|
||||
}
|
||||
function addWriter(address _minter) public returns (bool) {
|
||||
return addMinter(_minter);
|
||||
}
|
||||
|
||||
// Given address will no longer be allowed to call the mintTo() function
|
||||
function removeMinter(address _minter) public returns (bool) {
|
||||
function deleteWriter(address _minter) public returns (bool) {
|
||||
require(!isSealed(MINTER_STATE));
|
||||
require(msg.sender == owner || _minter == msg.sender);
|
||||
minter[_minter] = false;
|
||||
return true;
|
||||
}
|
||||
function deleteWriter(address _minter) public returns (bool) {
|
||||
return removeMinter(_minter);
|
||||
}
|
||||
|
||||
/// Implements ERC20
|
||||
function balanceOf(address _account) public view returns (uint256) {
|
||||
|
Loading…
Reference in New Issue
Block a user