如何从合约访问链状态数据?

问题描述

如何从 !ink 智能合约访问基板链中的存储或常量?例如,在链中,时间戳(在 Moment 中)设置为外部。如何访问时间戳并将变量放入智能合约中?

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

Image of the timestamp

解决方法

您可以检查 https://paritytech.github.io/ink/ink_env/ 提供 block_numberblock_timestamp

墨水! https://github.com/paritytech/ink#table-of-contents

中的文档