I need to use height() and timestamp() in my contract.
5 Likes
There are two methods for doing that.
- Import the two functions using
use std::block::(height, timestamp};
. You can then useheight()
andtimestamp()
in your code as needed. - Use call paths in your code when using those function. E.g.
let h = std::block::height();
.
3 Likes