Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
sisyphusSmiling committed Dec 7, 2023
1 parent c0fe291 commit b475584
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ advanced deployments are possible with support for multiple contract accounts an
1. We can see that the `Foo` has been deployed, and call its only contract method `foo()`, getting back `"foo"`:
```sh
flow scripts execute ./scripts/foo.cdc
flow scripts execute ./scripts/test/foo.cdc
```

1. Configure `StagedContractUpdates.Updater`, passing the block height, contract name, and contract code in hex form (see
Expand All @@ -44,7 +44,7 @@ advanced deployments are possible with support for multiple contract accounts an
1. `code: [String]`

```sh
flow transactions send ./transactions/setup_updater_single_account_and_contract.cdc \
flow transactions send ./transactions/updater/setup_updater_single_account_and_contract.cdc \
10 "Foo" 70756220636f6e747261637420466f6f207b0a202020207075622066756e20666f6f28293a20537472696e67207b0a202020202020202072657475726e2022626172220a202020207d0a7d \
--signer foo
```
Expand All @@ -58,14 +58,14 @@ advanced deployments are possible with support for multiple contract accounts an
1. We can get details from our `Updater` before updating:

```sh
flow scripts execute ./scripts/get_updater_info.cdc 0xe03daebed8ca0615
flow scripts execute ./scripts/updater/get_updater_info.cdc 0xe03daebed8ca0615
```

```sh
flow scripts execute ./scripts/get_updater_deployment.cdc 0xe03daebed8ca0615
flow scripts execute ./scripts/updater/get_updater_deployment.cdc 0xe03daebed8ca0615
```

1. Next, we'll delegate the `Updater` Capability as `DelegatedUpdater` to the `Delegatee` stored in the `StagedContractUpdates`'s account.
1. Next, we'll delegate the `Updater` Capability to the `Delegatee` stored in the `StagedContractUpdates`'s account.

```sh
flow transactions send ./transactions/delegate.cdc --signer foo
Expand All @@ -74,14 +74,14 @@ advanced deployments are possible with support for multiple contract accounts an
1. Lastly, we'll run the updating transaction as the `Delegatee`:
```sh
flow transactions send ./transactions/execute_delegated_updates.cdc
flow transactions send ./transactions/delegatee/execute_all_delegated_updates.cdc
```
1. And we can validate the update has taken place by calling `Foo.foo()` again and seeing the return value is now
`"bar"`
```sh
flow scripts execute ./scripts/foo.cdc
flow scripts execute ./scripts/test/foo.cdc
```
## Multi-Account Multi-Contract Deployment
Expand Down Expand Up @@ -138,18 +138,19 @@ account.
:information_source: If you haven't already, perform the [setup steps above](#setup)
1. Since we'll be configuring an update deployment across a number of contract accounts, we'll need to delegate access
to those accounts via AuthAccount Capabilities on each. Running the following transaction will link an AuthAccount
Capability on the signer's account and publish it for the account where our `Updater` will live.
to those accounts via AuthAccount Capabilities on each. Running the following transaction will link and encapsulate
an AuthAccount Capability in a `Host` within the signer's account and publish a Capability on it for the account
where our `Updater` will live.
```sh
flow transactions send ./transactions/publish_auth_account_capability.cdc \
0xf669cb8d41ce0c74 \
flow transactions send ./transactions/host/publish_host_capability.cdc \
0xe03daebed8ca0615 \
--signer a-account
```
```sh
flow transactions send ./transactions/publish_auth_account_capability.cdc \
0xf669cb8d41ce0c74 \
flow transactions send ./transactions/host/publish_host_capability.cdc \
0xe03daebed8ca0615 \
--signer bc-account
```
Expand All @@ -164,7 +165,7 @@ account.
1. `deploymentConfig: [[{Address: {String: String}}]]`
```sh
flow transactions send transactions/setup_updater_multi_account.cdc \
flow transactions send transactions/updater/setup_updater_multi_account.cdc \
--args-json "$(cat args.json)" \
--signer abc-updater
```
Expand All @@ -176,25 +177,25 @@ account.
resource was created, so let's query against the updater account to get its info.
```sh
flow scripts execute ./scripts/get_updater_info.cdc 0xf669cb8d41ce0c74
flow scripts execute ./scripts/updater/get_updater_info.cdc 0xe03daebed8ca0615
```
```sh
flow scripts execute ./scripts/get_updater_deployment.cdc 0xf669cb8d41ce0c74
flow scripts execute ./scripts/updater/get_updater_deployment.cdc 0xe03daebed8ca0615
```
1. Now we'll delegate a Capability on the `Updater` to the `Delegatee`:
```sh
flow transactions send ./transactions/delegate.cdc --signer abc-updater
flow transactions send ./transactions/updater/delegate.cdc --signer abc-updater
```
1. In the previous transaction we should see that the `UpdaterDelegationChanged` event includes the `Updater` UUID
previously emitted in the creation event and that the `delegated` value is `true`. Now, we'll act as the `Delegatee`
and execute the update.
```sh
flow transactions send ./transactions/execute_delegated_updates.cdc
flow transactions send ./transactions/delegatee/execute_all_delegated_updates.cdc
```
This transaction calls `Updater.update()`, executing the first staged deployment, and updating contract `A`. Note
Expand All @@ -203,13 +204,13 @@ account.
time updating `B`.
```sh
flow transactions send ./transactions/execute_delegated_updates.cdc
flow transactions send ./transactions/delegatee/execute_all_delegated_updates.cdc
```
Now we see `B` has been updated, but we still have one more stage to complete. Let's complete the staged update.
```sh
flow transactions send ./transactions/execute_delegated_updates.cdc
flow transactions send ./transactions/delegatee/execute_all_delegated_updates.cdc
```
And finally, we see that `C` was updated and `updateComplete` is now `true`.

0 comments on commit b475584

Please sign in to comment.