帖子
分享您的知识。
Grizzly67
Mar 29, 2025
专家问答
How to securely manage a coin swap pool with admin access?
I want to swap pair of coins, say COIN_A/COIN_B. I need to create a pool object containing the balances of COIN_A and COIN_B. My concern is about how to securely manage this pool. If I use transfer::transfer
, others won't access the pool, but if I use transfer::share_object
, I fear someone might withdraw all the funds. How can I ensure that only admin can access or modify this pool?
- Move CLI
- Move
1
2
分享
评论
答案
2Mar 30 2025, 02:40
为了解决这个问题,你可以在智能合约中设计仅限管理员用户访问的功能. 通过使用transfer::share_object
,您的池将成为所有人都可以访问的共享对象. 但是,您可以实现访问控制,管理员只能调用某些功能,例如提取或更改余额. 共享对象将允许您进行广泛的访问权限,但通过精心设计功能和权限,您可以确保池保持安全.
2
最佳答案
评论
dudley_smith124
Mar 30 2025, 16:36包含基于权限的权限可以帮助管理谁可以对您的共享对象执行哪些操作. 请参阅 Move 官方文档或社区指南等资源,例如在 move-book.com 上找到的有关可编程性和能力处理的指南.
2
评论
你知道答案吗?
请登录并分享。
Move is an executable bytecode language used to implement custom transactions and smart contracts.
148帖子231答案