Move.

Post

Share your knowledge.

Grizzly.
Mar 29, 2025
Expert Q&A

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
Share
Comments
.

Answers

2
BlueEyedCrypto.
Mar 30 2025, 02:40

To 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.

2
Best Answer
Comments
.
dudley_smith.
Mar 30 2025, 16:36

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.

2
Comments
.

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.

148Posts231Answers
Sui.X.Peera.

Earn Your Share of 1000 Sui

Gain Reputation Points & Get Rewards for Helping the Sui Community Grow.

Reward CampaignJune
We use cookies to ensure you get the best experience on our website.
More info