Skip to content

Commit

Permalink
Can reset or inhert test gwt ratio when set prod mode
Browse files Browse the repository at this point in the history
  • Loading branch information
weiqiushi committed Aug 7, 2024
1 parent 9106090 commit 943157a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions contracts/exchange.sol
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,17 @@ contract Exchange is Initializable, UUPSUpgradeable, OwnableUpgradeable {
test_mode = true;
}

function enableProdMode() public onlyOwner testEnabled {
function enableProdMode(bool isResetRatio) public onlyOwner testEnabled {
test_mode = false;

// return remaining DMCs to owner, those DMCs comes from owner called addFreeDMCTestMintBalance in test mode.
DMC(dmcToken).transfer(msg.sender, DMC(dmcToken).balanceOf(address(this)));

// 如果是首次开启生产模式,初始化第一个周期
if (!isResetRatio) {
dmc2gwt_rate = test_gwt_ratio;
}

// if its the first time to enable prod mode, we need to init a new cycle
if (current_circle == 0) {
_newCycle();
}
Expand Down

0 comments on commit 943157a

Please sign in to comment.