How can I import a library to my smart contract?

I need to use height() and timestamp() in my contract.

5 Likes

There are two methods for doing that.

  1. Import the two functions using use std::block::(height, timestamp};. You can then use height() and timestamp() in your code as needed.
  2. Use call paths in your code when using those function. E.g. let h = std::block::height();.
3 Likes