Move.

Post

Share your knowledge.

Tawhid.
Jan 15, 2025
Expert Q&A

How to import a deployed package in Move contract?

I'm trying to import a deployed coin package into my Move smart contract for receiving payments, but I keep getting an 'Unbound module' error when I add the address in the Move.toml file. Can anyone provide a guide or examples on how to correctly set up imports for deployed packages?

  • Move CLI
  • Move
2
2
Share
Comments
.

Answers

2
YJS.
YJS94
Jan 16 2025, 01:12

Each Sui project has a Move.lock file, which contains the deployment address of your package. You need to use this address for your specific network to ensure your Move.toml file correctly references the deployed package . If you're dealing with a deployed coin, you could manually obtain the source code from a blockchain explorer to use locally if the repository isn't publicly available. This way, you point to the local code in your Move.toml and set the package's address as per its mainnet deployment .

1
Best Answer
Comments
.
LargeCappWithTwo.
Jan 16 2025, 18:32

To import a deployed package, you need to ensure that the package is properly specified as a dependency in your Move.toml file. This can involve adding a local path to where you have the package's code or a git repository link if it's available online. If the package is on-chain, you might need to have a local copy of the package's code since the Move compiler requires the source code to correctly compile and verify dependencies .

1
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 CampaignJuly