Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Adding inflation reduction timeline #165

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/dist
build

# Logs
logs
Expand All @@ -18,4 +19,4 @@ artifacts/
keystore/

.yalc
yalc.lock
yalc.lock
6 changes: 6 additions & 0 deletions contracts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"BlockReward": "0x85810Cb3C4097DcA9D50E0C1A0818745e07407B5",
"Consensus": "0x94B83a97e1dd42E936C8A403C98CbE56d9461CdE",
"ProxyStorage": "0x21920ab220BED44ffeF37B7034953cE50AFBDe24",
"Voting": "0x593A4B48aAE47776815601e6D8Ac993A9F7f7c13"
}
21 changes: 17 additions & 4 deletions contracts/BlockReward.sol
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,21 @@ contract BlockReward is EternalStorage, BlockRewardBase {
/**
* returns yearly inflation rate (percentage)
*/
function getInflation() public pure returns(uint256) {
return INFLATION;
function getInflation() public view returns(uint256) {
uint256 yearNumber = block.number.div(getBlocksPerYear());
if (yearNumber < 5) {
return 500;
} else if (yearNumber == 5) {
return 300;
} else if (yearNumber == 6) {
return 150;
} else if (yearNumber == 7) {
return 100;
} else if (yearNumber == 8) {
return 75;
} else {
return 50;
}
}

/**
Expand All @@ -174,9 +187,9 @@ contract BlockReward is EternalStorage, BlockRewardBase {
function getBlocksPerYear() public pure returns(uint256) {
return BLOCKS_PER_YEAR;
}

function _setBlockRewardAmount() private {
uintStorage[BLOCK_REWARD_AMOUNT] = (getTotalSupply().mul(getInflation().mul(DECIMALS).div(100))).div(getBlocksPerYear()).div(DECIMALS);
uintStorage[BLOCK_REWARD_AMOUNT] = (getTotalSupply().mul(getInflation().mul(DECIMALS).div(10000))).div(getBlocksPerYear()).div(DECIMALS);
}

function getBlockRewardAmount() public view returns(uint256) {
Expand Down
Loading