Remove dead contract code in default distribution (single)
This commit is contained in:
parent
fb8d1e548c
commit
32ae98d581
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -166,8 +166,6 @@ class DemurrageTokenSimulation:
|
|||||||
return v * (10 ** self.decimals)
|
return v * (10 ** self.decimals)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def mint(self, recipient, value):
|
def mint(self, recipient, value):
|
||||||
self.__check_limit()
|
self.__check_limit()
|
||||||
nonce_oracle = RPCNonceOracle(self.accounts[0], conn=self.rpc)
|
nonce_oracle = RPCNonceOracle(self.accounts[0], conn=self.rpc)
|
||||||
|
@ -18,6 +18,7 @@ done
|
|||||||
modes=(SingleCap SingleNocap)
|
modes=(SingleCap SingleNocap)
|
||||||
for m in ${modes[@]}; do
|
for m in ${modes[@]}; do
|
||||||
ERC20_DEMURRAGE_TOKEN_TEST_MODE=$m python tests/test_single.py
|
ERC20_DEMURRAGE_TOKEN_TEST_MODE=$m python tests/test_single.py
|
||||||
|
ERC20_DEMURRAGE_TOKEN_TEST_MODE=$m python tests/test_redistribution_unit.py
|
||||||
done
|
done
|
||||||
|
|
||||||
modes=(MultiCap MultiNocap)
|
modes=(MultiCap MultiNocap)
|
||||||
|
@ -127,11 +127,13 @@ class TestRedistribution(TestDemurrageUnit):
|
|||||||
supply = c.parse_total_supply(r)
|
supply = c.parse_total_supply(r)
|
||||||
|
|
||||||
expected_balance = int(supply * (self.tax_level / 1000000))
|
expected_balance = int(supply * (self.tax_level / 1000000))
|
||||||
|
expected_balance_tolerance = 1
|
||||||
|
|
||||||
o = c.balance_of(self.address, self.sink_address, sender_address=self.accounts[0])
|
o = c.balance_of(self.address, self.sink_address, sender_address=self.accounts[0])
|
||||||
r = self.rpc.do(o)
|
r = self.rpc.do(o)
|
||||||
balance = c.parse_balance_of(r)
|
balance = c.parse_balance_of(r)
|
||||||
self.assertEqual(balance, expected_balance)
|
self.assertGreaterEqual(balance, expected_balance - expected_balance_tolerance)
|
||||||
|
self.assertLessEqual(balance, expected_balance)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -267,18 +267,11 @@ contract DemurrageTokenSingleCap {
|
|||||||
// Returns the amount sent to the sink address
|
// Returns the amount sent to the sink address
|
||||||
function applyDefaultRedistribution(bytes32 _redistribution) private returns (uint256) {
|
function applyDefaultRedistribution(bytes32 _redistribution) private returns (uint256) {
|
||||||
uint256 redistributionSupply;
|
uint256 redistributionSupply;
|
||||||
uint256 redistributionPeriod;
|
|
||||||
uint256 unit;
|
uint256 unit;
|
||||||
uint256 truncatedResult;
|
|
||||||
|
|
||||||
redistributionSupply = toRedistributionSupply(_redistribution);
|
redistributionSupply = toRedistributionSupply(_redistribution);
|
||||||
|
|
||||||
unit = (redistributionSupply * taxLevel) / 1000000;
|
unit = (redistributionSupply * taxLevel) / 1000000;
|
||||||
truncatedResult = (unit * 1000000) / taxLevel;
|
|
||||||
|
|
||||||
if (truncatedResult < redistributionSupply) {
|
|
||||||
redistributionPeriod = toRedistributionPeriod(_redistribution); // since we reuse period here, can possibly be optimized by passing period instead
|
|
||||||
}
|
|
||||||
|
|
||||||
increaseBaseBalance(sinkAddress, unit / ppmDivider);
|
increaseBaseBalance(sinkAddress, unit / ppmDivider);
|
||||||
return unit;
|
return unit;
|
||||||
|
@ -262,18 +262,11 @@ contract DemurrageTokenSingleNocap {
|
|||||||
// Returns the amount sent to the sink address
|
// Returns the amount sent to the sink address
|
||||||
function applyDefaultRedistribution(bytes32 _redistribution) private returns (uint256) {
|
function applyDefaultRedistribution(bytes32 _redistribution) private returns (uint256) {
|
||||||
uint256 redistributionSupply;
|
uint256 redistributionSupply;
|
||||||
uint256 redistributionPeriod;
|
|
||||||
uint256 unit;
|
uint256 unit;
|
||||||
uint256 truncatedResult;
|
|
||||||
|
|
||||||
redistributionSupply = toRedistributionSupply(_redistribution);
|
redistributionSupply = toRedistributionSupply(_redistribution);
|
||||||
|
|
||||||
unit = (redistributionSupply * taxLevel) / 1000000;
|
unit = (redistributionSupply * taxLevel) / 1000000;
|
||||||
truncatedResult = (unit * 1000000) / taxLevel;
|
|
||||||
|
|
||||||
if (truncatedResult < redistributionSupply) {
|
|
||||||
redistributionPeriod = toRedistributionPeriod(_redistribution); // since we reuse period here, can possibly be optimized by passing period instead
|
|
||||||
}
|
|
||||||
|
|
||||||
increaseBaseBalance(sinkAddress, unit / ppmDivider);
|
increaseBaseBalance(sinkAddress, unit / ppmDivider);
|
||||||
return unit;
|
return unit;
|
||||||
|
Reference in New Issue
Block a user