Post
Share your knowledge.
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
Answers
2To address this concern, you can design functions within your smart contract that restrict access to only admin users. By using transfer::share_object
, your pool becomes a shared object accessible by everyone. However, you can implement access controls where only certain functions, like withdrawing or changing the balance, can be called by the admin. A shared object will allow you broad access, but with careful design of functions and permissions, you can ensure your pool remains secure.
The inclusion of capability-based permissions can help manage who can perform which actions on your shared object. Refer to resources like the official Move documentation or community guides such as the one found on move-book.com regarding programmability and capability handling.
Do you know the answer?
Please log in and share it.
Move is an executable bytecode language used to implement custom transactions and smart contracts.

- ... SUIderiss+5
- ... SUIRamirez+5
- ... SUIElvin CLONE +5
- ... SUI
- ... SUI
- ... SUI
- ... SUIBritain+2