Afeez Aziz
Afeez Aziz

Reputation: 1386

How do I access chain state data from a contract?

Ho do I access storages or constants in a substrate chain from !ink smart contract? For example, in the chain, the timestamp(in Moment) is set as an extrinsic. How do I access the timestamp and put the variable in the smart contract?

let timestamp_now: u128: <access to chain when function is being called>

Image of the timestamp

Upvotes: 1

Views: 322

Answers (1)

You can check https://paritytech.github.io/ink/ink_env/ Which provides functions as block_number and block_timestamp

ink! documentation in https://github.com/paritytech/ink#table-of-contents

Upvotes: 2

Related Questions