是否可以使用openzeppelins Safemath库和now关键字进行时间计算?
contract MyContract {
using SafeMath for uint256;
uint dayInSec = 86400;
function calc() public returns(uint) {
return now.add(dayInSec);
}
}发布于 2020-05-31 06:17:15
是的,你为什么不这么认为呢?now只是block.timestamp的一种简短形式,也就是uint256。
https://solidity.readthedocs.io/en/v0.6.8/cheatsheet.html?highlight=timestamp#global-variables
https://ethereum.stackexchange.com/questions/83856
复制相似问题