Skip to content

Commit f07eaa8

Browse files
committed
Try to write a DMC release logic
1 parent be69d98 commit f07eaa8

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

contracts/exchange2.sol

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ contract Exchange2 {
3131
// 周期的最小时长
3232
uint256 min_circle_time = 100;
3333

34-
uint256 total_mine_period = 420;
34+
//uint256 total_mine_period = 420;
3535
uint256 adjust_period = 21;
36+
uint256 initial_dmc_balance=768242.27 ether;
3637

3738

3839
constructor(address _dmcToken, address _gwtToken, address _fundationIncome, uint256 _min_circle_time) {
@@ -44,9 +45,14 @@ contract Exchange2 {
4445
_newCycle();
4546
}
4647

47-
function getCircleBalance(uint256 circle_id) public view returns (uint256) {
48-
uint256 totalDMC = DMC2(dmcToken).totalSupply();
49-
return 210 ether;
48+
function getCircleBalance(uint256 circle) public view returns (uint256) {
49+
uint256 adjust_times = (circle-1) / adjust_period;
50+
uint256 balance = initial_dmc_balance;
51+
for (uint i = 0; i < adjust_times; i++) {
52+
balance = balance * 4 / 5;
53+
}
54+
return balance;
55+
//return 210 ether;
5056
}
5157

5258
function _newCycle() internal {

0 commit comments

Comments
 (0)