Remove commented code

This commit is contained in:
nolash 2021-06-05 12:05:38 +02:00
parent 5dcf728701
commit f338510a1d
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
2 changed files with 8 additions and 64 deletions

View File

@ -2,7 +2,7 @@ pragma solidity > 0.6.11;
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
contract DemurrageTokenSingleNocap { contract DemurrageTokenSingleCap {
// Redistribution bit field, with associated shifts and masks // Redistribution bit field, with associated shifts and masks
// (Uses sub-byte boundaries) // (Uses sub-byte boundaries)
@ -437,13 +437,7 @@ contract DemurrageTokenSingleNocap {
nextRedistribution = toRedistribution(0, nextRedistributionDemurrage, totalSupply, nextPeriod); nextRedistribution = toRedistribution(0, nextRedistributionDemurrage, totalSupply, nextPeriod);
redistributions.push(nextRedistribution); redistributions.push(nextRedistribution);
//currentParticipants = toRedistributionParticipants(currentRedistribution);
//if (currentParticipants == 0) {
currentRemainder = applyDefaultRedistribution(currentRedistribution); currentRemainder = applyDefaultRedistribution(currentRedistribution);
//} else {
// currentRemainder = remainder(currentParticipants, totalSupply); // we can use totalSupply directly because it will always be the same as the recorded supply on the current redistribution
// applyRemainderOnPeriod(currentRemainder, currentPeriod);
//}
emit Period(nextPeriod); emit Period(nextPeriod);
return true; return true;
} }
@ -480,40 +474,21 @@ contract DemurrageTokenSingleNocap {
// If the given account is participating in a period and that period has been crossed // If the given account is participating in a period and that period has been crossed
// THEN increase the base value of the account with its share of the value reduction of the period // THEN increase the base value of the account with its share of the value reduction of the period
function applyRedistributionOnAccount(address _account) public returns (bool) { function applyRedistributionOnAccount(address _account) public returns (bool) {
// bytes32 periodRedistribution;
// uint256 supply;
// uint256 participants;
// uint256 baseValue;
// uint256 value;
uint256 period; uint256 period;
// uint256 demurrage;
//
period = accountPeriod(_account); period = accountPeriod(_account);
if (period == 0 || period >= actualPeriod()) { if (period == 0 || period >= actualPeriod()) {
return false; return false;
} }
// periodRedistribution = redistributions[period-1];
// participants = toRedistributionParticipants(periodRedistribution); // zero out period for the account
// if (participants == 0) {
// return false;
// }
//
// supply = toRedistributionSupply(periodRedistribution);
// demurrage = toRedistributionDemurrageModifier(periodRedistribution);
// baseValue = ((supply / participants) * (taxLevel / 1000000)) / ppmDivider;
// value = (baseValue * demurrage) / 1000000;
//
// // zero out period for the account
account[_account] &= bytes32(~maskAccountPeriod); account[_account] &= bytes32(~maskAccountPeriod);
// increaseBaseBalance(_account, value);
//
// emit Redistribution(_account, period, value);
return true; return true;
} }
// Inflates the given amount according to the current demurrage modifier // Inflates the given amount according to the current demurrage modifier
function toBaseAmount(uint256 _value) public view returns (uint256) { function toBaseAmount(uint256 _value) public view returns (uint256) {
//return (_value * ppmDivider * 1000000) / toDemurrageAmount(demurrageModifier);
return (_value * ppmDivider * 1000000) / demurrageAmount; return (_value * ppmDivider * 1000000) / demurrageAmount;
} }
@ -522,7 +497,6 @@ contract DemurrageTokenSingleNocap {
uint256 baseValue; uint256 baseValue;
changePeriod(); changePeriod();
//applyRedistributionOnAccount(msg.sender);
baseValue = toBaseAmount(_value); baseValue = toBaseAmount(_value);
allowance[msg.sender][_spender] += baseValue; allowance[msg.sender][_spender] += baseValue;
@ -536,7 +510,6 @@ contract DemurrageTokenSingleNocap {
bool result; bool result;
changePeriod(); changePeriod();
//applyRedistributionOnAccount(msg.sender);
baseValue = toBaseAmount(_value); baseValue = toBaseAmount(_value);
result = transferBase(msg.sender, _to, baseValue); result = transferBase(msg.sender, _to, baseValue);
@ -551,7 +524,6 @@ contract DemurrageTokenSingleNocap {
bool result; bool result;
changePeriod(); changePeriod();
//applyRedistributionOnAccount(msg.sender);
baseValue = toBaseAmount(_value); baseValue = toBaseAmount(_value);
require(allowance[_from][msg.sender] >= baseValue); require(allowance[_from][msg.sender] >= baseValue);

View File

@ -432,13 +432,7 @@ contract DemurrageTokenSingleNocap {
nextRedistribution = toRedistribution(0, nextRedistributionDemurrage, totalSupply, nextPeriod); nextRedistribution = toRedistribution(0, nextRedistributionDemurrage, totalSupply, nextPeriod);
redistributions.push(nextRedistribution); redistributions.push(nextRedistribution);
//currentParticipants = toRedistributionParticipants(currentRedistribution);
//if (currentParticipants == 0) {
currentRemainder = applyDefaultRedistribution(currentRedistribution); currentRemainder = applyDefaultRedistribution(currentRedistribution);
//} else {
// currentRemainder = remainder(currentParticipants, totalSupply); // we can use totalSupply directly because it will always be the same as the recorded supply on the current redistribution
// applyRemainderOnPeriod(currentRemainder, currentPeriod);
//}
emit Period(nextPeriod); emit Period(nextPeriod);
return true; return true;
} }
@ -475,34 +469,15 @@ contract DemurrageTokenSingleNocap {
// If the given account is participating in a period and that period has been crossed // If the given account is participating in a period and that period has been crossed
// THEN increase the base value of the account with its share of the value reduction of the period // THEN increase the base value of the account with its share of the value reduction of the period
function applyRedistributionOnAccount(address _account) public returns (bool) { function applyRedistributionOnAccount(address _account) public returns (bool) {
// bytes32 periodRedistribution;
// uint256 supply;
// uint256 participants;
// uint256 baseValue;
// uint256 value;
uint256 period; uint256 period;
// uint256 demurrage;
//
period = accountPeriod(_account); period = accountPeriod(_account);
if (period == 0 || period >= actualPeriod()) { if (period == 0 || period >= actualPeriod()) {
return false; return false;
} }
// periodRedistribution = redistributions[period-1]; // zero out period for the account
// participants = toRedistributionParticipants(periodRedistribution);
// if (participants == 0) {
// return false;
// }
//
// supply = toRedistributionSupply(periodRedistribution);
// demurrage = toRedistributionDemurrageModifier(periodRedistribution);
// baseValue = ((supply / participants) * (taxLevel / 1000000)) / ppmDivider;
// value = (baseValue * demurrage) / 1000000;
//
// // zero out period for the account
account[_account] &= bytes32(~maskAccountPeriod); account[_account] &= bytes32(~maskAccountPeriod);
// increaseBaseBalance(_account, value);
//
// emit Redistribution(_account, period, value);
return true; return true;
} }
@ -517,7 +492,6 @@ contract DemurrageTokenSingleNocap {
uint256 baseValue; uint256 baseValue;
changePeriod(); changePeriod();
//applyRedistributionOnAccount(msg.sender);
baseValue = toBaseAmount(_value); baseValue = toBaseAmount(_value);
allowance[msg.sender][_spender] += baseValue; allowance[msg.sender][_spender] += baseValue;
@ -531,7 +505,6 @@ contract DemurrageTokenSingleNocap {
bool result; bool result;
changePeriod(); changePeriod();
//applyRedistributionOnAccount(msg.sender);
baseValue = toBaseAmount(_value); baseValue = toBaseAmount(_value);
result = transferBase(msg.sender, _to, baseValue); result = transferBase(msg.sender, _to, baseValue);
@ -546,7 +519,6 @@ contract DemurrageTokenSingleNocap {
bool result; bool result;
changePeriod(); changePeriod();
//applyRedistributionOnAccount(msg.sender);
baseValue = toBaseAmount(_value); baseValue = toBaseAmount(_value);
require(allowance[_from][msg.sender] >= baseValue); require(allowance[_from][msg.sender] >= baseValue);