我目前正在学习稳健,并在玩现在的关键字。这个函数被认为是以每年0.05%的通货膨胀率来制造新的货币。我只是不确定现在的关键字是否可靠,因为,据我所知,它是基于矿工的信息,这可能是错误的。有什么想法吗?这段代码有效吗?它可靠吗?
`uint256 public deploymentTime = now; uint256 public year = 0; uint256 public supply = 90000000;`function checkInflation() returns (bool success)
{
if(year >= 5) {
return false;
}
else if (now >= deploymentTime + 31557600) { //31557600 seconds per year
uint256 supplyIncrease = (supply*5) / 100;
mintToken(0x8E73AEF2448068d4e31F86Aa08279465339fF601, supplyIncrease);
year+=1; // increase the current year count
supply += supplyIncrease; // increase supply count
deploymentTime += 31557600; // increase the time since deployment
return true;
}
else {
return false;
}
}发布于 2018-06-08 08:44:06
我认为这是你最好的选择,我不会期望它有什么问题。除此之外,您还可以使用像泰普斯这样的服务在您所要求的特定时间调用您的合同。可以在测试网中免费使用.
https://ethereum.stackexchange.com/questions/50624
复制相似问题