问题描述
如何从 !ink 智能合约访问基板链中的存储或常量?例如,在链中,时间戳(在 Moment 中)设置为外部。如何访问时间戳并将变量放入智能合约中?
let timestamp_Now: u128: <access to chain when function is being called>
解决方法
您可以检查 https://paritytech.github.io/ink/ink_env/ 提供 block_number
和 block_timestamp
如何从 !ink 智能合约访问基板链中的存储或常量?例如,在链中,时间戳(在 Moment 中)设置为外部。如何访问时间戳并将变量放入智能合约中?
let timestamp_Now: u128: <access to chain when function is being called>
您可以检查 https://paritytech.github.io/ink/ink_env/ 提供 block_number
和 block_timestamp