Move.

帖子

分享您的知识。

Tawhid.
Jan 10, 2025
专家问答

Store global variables in Move smart contract with shared objects

I'm working on a Move smart contract and struggling to store a global variable using a struct. I've been trying for hours but can't get it to work. Any tips or solutions?

  • Move CLI
1
1
分享
评论
.

答案

1
Pluto Dev👽.
Jan 10 2025, 18:13

在Move中,没有像其他智能合约语言那样直截了当的全局存储概念. 相反,你可以使用共享对象来存储类似于全局数据的内容. 您可以将 “全局变量” 存储在共享对象中. 只要您知道它们的唯一标识符,就可以全局访问这些对象. 你可以查看 Sui 文档,获取有关如何设置的更多指导. 以下是示例和进一步的解释:共享对象文档.

0
评论
.

你知道答案吗?

请登录并分享。

Move is an executable bytecode language used to implement custom transactions and smart contracts.

148帖子231答案
Sui.X.Peera.

赚取你的 1000 Sui 份额

获取声誉积分,并因帮助 Sui 社区成长而获得奖励。

奖励活动七月