How to understand the meaning of a part of this contract

Viewed 54

I have this command, I don't know what it means:

startUNIX = block.timestamp.add(365 days);

Full code:

enter image description here

1 Answers

block.timestamp is a read-only global variable returning the datetime of when the block exeucting this function was mined.

The add() function is most likely from the SafeMath library added through the "using for" expression. Example:

library Safemath {
    function add(uint256 a, uint256 b) public pure returns (uint256) {
        // ...
    }
}

contract MyContract {
    using SafeMath for uint256;
}

days is a Solidity unit, effectively just calculating the amount of seconds from the number of days, so it's easier to calculate time difference.

Related