Skip to content

Commit

Permalink
Update aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
Ifropc committed Dec 20, 2024
1 parent 60eed8a commit 614f6ad
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions docs/build/guides/conventions/workspace.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -176,25 +176,12 @@ STELLAR_SOURCE_ACCOUNT=alice
Second is to deploy the contracts:

```bash
ADD_CONTRACT=`stellar contract deploy --network testnet --wasm target/wasm32-unknown-unknown/release/add_contract.wasm`
MAIN_CONTRACT=`stellar contract deploy --network testnet --wasm target/wasm32-unknown-unknown/release/main_contract.wasm`
```

This contracts can also be referenced using aliases after running following command:

```bash
stellar contract alias add --id $ADD_CONTRACT add_contract
stellar contract alias add --id MAIN_CONTRACT main_contract
stellar contract deploy --network testnet --wasm target/wasm32-unknown-unknown/release/add_contract.wasm --alias add_contract
stellar contract deploy --network testnet --wasm target/wasm32-unknown-unknown/release/main_contract.wasm --alias main_contract
```

And finally call the main contract:

:::info

Referencing contract arguments by aliases is not supported in the latest stable version yet, but it's still possible to use a corresponding environmental variable instead

:::

```
$ stellar contract invoke --id main_contract --network testnet -- add_with --contract add_contract --x 9 --y 10
ℹ️ Send skipped because simulation identified as read-only. Send by rerunning with `--send=yes`.
Expand Down Expand Up @@ -353,9 +340,9 @@ We can now deploy this contracts and test the new behavior:

```bash
stellar contract build
stellar contract alias add --id `stellar contract deploy --network testnet --wasm target/wasm32-unknown-unknown/release/add_contract.wasm` add_contract
stellar contract alias add --id `stellar contract deploy --network testnet --wasm target/wasm32-unknown-unknown/release/add_extra_contract.wasm` wrong_math_contract
stellar contract alias add --id `stellar contract deploy --network testnet --wasm target/wasm32-unknown-unknown/release/main_contract.wasm` main_contract
stellar contract deploy --network testnet --wasm target/wasm32-unknown-unknown/release/add_contract.wasm --alias add_contract
stellar contract deploy --network testnet --wasm target/wasm32-unknown-unknown/release/add_extra_contract.wasm --alias wrong_math_contract
stellar contract deploy --network testnet --wasm target/wasm32-unknown-unknown/release/main_contract.wasm --alias main_contract
```

Now let's try to do sum 2 unsigned integers causing an overflow:
Expand Down

0 comments on commit 614f6ad

Please sign in to comment.