1

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

Michael
  • 41,989
  • 11
  • 82
  • 128
Afeez Aziz
  • 1,337
  • 2
  • 12
  • 26
  • Other than timestamp(https://paritytech.github.io/ink/ink_env/fn.block_timestamp.html) and block number(https://paritytech.github.io/ink/ink_env/fn.block_number.html) I am unable to find in the documentation on how to get storage/constant from chain. – Afeez Aziz Jan 23 '21 at 08:40

1 Answers1

2

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

  • As per my first comment in the question, the only items that can be queried from chain are timestamp and block number. I am interested to know on how can I access other chain data or storage that are made available through the pallets. – Afeez Aziz Jan 27 '21 at 12:18
  • Still, other than block_number and timestamp which I have mentioned in my comments, there is no way to get the chain state data. – Afeez Aziz Feb 10 '21 at 04:09