◆ Purpose

To measure whether the time limit has been exceeded

◆ Input & Return value

(uint deadline) ⇒ true or false

◆ Example

deadline = 946684800

Screen Shot 2022-06-29 at 13.30.12.png

block.timestamp = 1656477111

block.timestamp (uint): current block timestamp in seconds since Unix epoch

Screen Shot 2022-06-29 at 13.32.04.png

⇒ reverted false

◆ Code and Explain

modifier ensure(uint deadline) {
        require(deadline >= block.timestamp, 'UniswapV2Router: EXPIRED');
        _; // execute function 
    }

◆ Resources

https://github.com/Uniswap/v2-periphery/blob/master/contracts/UniswapV2Router02.sol#L18

https://solidity-by-example.org/function-modifier

https://www.vultr.com/resources/unix-time-calculator/