Package is a collection of modules published as an atomic unit under one account.

├── Move.toml (required)
├── sources\ (required, stores move modules)
│ └── aptogotchi.move
├── build\ (generated, build output)
├── scripts\ (optional, stores move scripts)
│ └── script_batch_create_gotchi.move
├── doc_templates\ (optional)
|── tests\ (optional, test mode)
└── examples\ (optional, test & dev mode)

The package manifest is defined by Move.toml

name = "aptogotchi"
version = "1.0.0"
upgrade_policy = "compatible"
aptogotchi = "_"
AptosFramework = {
git = "",
rev = "main",
subdir = "aptos-move/framework/aptos-framework"
AptosTokenObjects = {
git = "",
rev = "main",
subdir = "aptos-move/framework/aptos-token-objects"
# Mock address for unit test.
aptogotchi = "0x123"

Publishing a Package

Aptos CLI needs to be installed before publishing a package.

aptos move publish \
--assume-yes \
--profile $PROFILE \ # the aptos account you choose as deployer.
--named-addresses aptogotchi=$ADDR \ # the address you want to publish aptogotchi under

Upgrade Policy

There are two possible upgrade policies defined in Move.toml

name = "aptogotchi"
version = "1.0.0"
upgrade_policy = "compatible"

upgrade_policy = "immutable"

  • The package is not upgradeable.

upgrade_policy = "compatible"

  • All existing structs cannot be modified.
  • You can add new structs without restriction.
  • All public and entry functions cannot change their signatures (argument types, type argument, return types). However, argument names can change.
  • You can add new functions without restriction.
  • If you need to break above rules, you have to publish the module to a new address.

How to upgrade

To upgrade already published Move code, simply attempt to republish the code at the same address that it was previously published.