Move.

帖子

分享您的知识。

Tawhid.
Mar 26, 2025
专家问答

How to ensure a smart contract doesn't resend a capability?

I'm working on a smart contract and I want to ensure that it doesn't send a capability if the user already owns one. This is to avoid unwanted transactions. I am thinking about using an SDK to check all objects a user holds and perhaps using a sui::table::Table to keep a list of minted capabilities. Is this the right approach, or is there a better way to confirm if an address holds a certain object on-chain?

  • Move CLI
  • Move
0
3
分享
评论
.

答案

3
dudley_smith.
Mar 27 2025, 07:47

对于您的用例,建议保留一份已在共享对象中赋予功能的地址列表. 您可以使用 a 来管理对象大小限制sui::table::Table,这使您可以高效地维护列表/地图.

2
最佳答案
评论
.
cod.
cod95
Mar 27 2025, 02:05

你可以尝试使用SDK检查用户在链下持有的所有对象. 这可以帮助您在不影响链上合约流程的情况下验证所有权.

2
评论
.
Grizzly.
Mar 27 2025, 05:53

对于这个用例,你可能不需要进行链上检查. 如果您想让用户证明他们拥有某个对象,请要求他们输入所有权证明.

1
评论
.

你知道答案吗?

请登录并分享。

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

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

赚取你的 1000 Sui 份额

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

奖励活动七月