Skip to content

Commit

Permalink
add more comments
Browse files Browse the repository at this point in the history
  • Loading branch information
cgorenflo committed Jan 9, 2025
1 parent b55af11 commit a484247
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions stellar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ node stellar/deploy-contract.js deploy axelar_gas_service --chain-name <CHAIN_NA
### Interchain Token Service

Deploy Interchain Token wasm first.

```bash
node stellar/deploy-contract.js deploy interchain_token --chain-name <CHAIN_NAME> --wasm-path ../axelar-cgp-soroban/target/wasm32-unknown-unknown/release/interchain_token.optimized.wasm
node stellar/deploy-contract.js deploy interchain_token_service --chain-name <CHAIN_NAME> --wasm-path ../axelar-cgp-soroban/target/wasm32-unknown-unknown/release/interchain_token_service.optimized.wasm
Expand All @@ -100,6 +101,7 @@ node stellar/deploy-contract.js deploy example --chain-name <CHAIN_NAME> --wasm-
```

### Contract upgrades

To facilitate contract upgrades, the `upgrader` contract needs to be deployed first.

```bash
Expand All @@ -112,8 +114,7 @@ After the `upgrader` is deployed, any other instantiated contract can be upgrade
node stellar/deploy-contract.js upgrade <CONTRACT_NAME> --chain-name <CHAIN_NAME> --wasm-path ../axelar-cgp-soroban/target/wasm32-unknown-unknown/release/<CONTRACT_NAME>.optimized.wasm --new-version <NEW_VERSION> --migration-data <MIGRATION_DATA>
```

where `<CONTRACT_NAME>` is the name of the contract to be upgraded and `--wasm-path` points to the upgraded bytecode. As a sanity check, `<NEW_VERSION>` must match the version number defined by the provided bytecode, so upgrading to the wrong version can be prevented. `<MIGRATION_DATA>` is the json encoded data that will be passed to the contract's `migrate` function.

where `<CONTRACT_NAME>` is the name of the contract to be upgraded and `--wasm-path` points to the upgraded bytecode. As a sanity check, `<NEW_VERSION>` must match the version number defined by the provided bytecode, so upgrading to the wrong version can be prevented. `<MIGRATION_DATA>` is the json encoded data that will be passed to the contract's `migrate` function. If the flag is not provided, the default value `()` will be used, meaning that the migration data is of type `void`. The easiest way to generate the json data for complex types is to instantiate the rust type the contract expects and then use `serde_json::to_string` to convert it to json.

## Generate bindings

Expand Down
2 changes: 1 addition & 1 deletion stellar/deploy-contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ function main() {
.argument('<contract-name>', 'contract name to deploy')
.addOption(new Option('--wasm-path <wasmPath>', 'path to the WASM file'))
.addOption(new Option('--new-version <newVersion>', 'new version of the contract'))
.addOption(new Option('--migration-data <migrationData>', 'migration data'))
.addOption(new Option('--migration-data <migrationData>', 'migration data').default('()'))
.action((contractName, options) => {
mainProcessor(options, upgrade, contractName);
});
Expand Down

0 comments on commit a484247

Please sign in to comment.