Skip to content

Commit

Permalink
Merge pull request #1330 from ACStoneCL/1325_Enable_Contracts
Browse files Browse the repository at this point in the history
1325 Adding information about enabling contracts.
  • Loading branch information
ACStone-MTS authored Nov 27, 2023
2 parents f63446f + 60b4347 commit 81e97db
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Our smart contract packaging tools enable you to:

## The Contract Package

When you upgrade a contract, you add a new contract version in a contract package. The versioning process is additive rather than an in-place replacement of an existing contract. The original version of the contract is still there, and you can enable certain versions for specific clients. You can also disable a contract version if needed.
When you upgrade a contract, you add a new contract version in a contract package. The versioning process is additive rather than an in-place replacement of an existing contract. The original version of the contract is still there, and you can enable certain versions for specific clients. You can also disable a contract version if needed. If you find that you need to use a disabled contract version, you may also re-enable it.

<p align="center"><img src={useBaseUrl("/image/package-representation.png")} alt="package-representation" width="400"/></p>

Expand Down
15 changes: 13 additions & 2 deletions source/docs/casper/resources/beginner/upgrade-contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,20 @@ There are two ways to call versioned contracts:
After calling the entry point, the count value should be decremented. You can verify it by querying the network again using the new state root hash.


## Disabling a Contract Version
## Disabling and Enabling Contract Versions

You can disable the indicated contract version of the indicated contract package by using the [disable_contract_version](https://docs.rs/casper-contract/latest/casper_contract/contract_api/storage/fn.disable_contract_version.html) function. Disabled contract versions can no longer be executed.
You can disable a contract version within a contract package by using the [disable_contract_version](https://docs.rs/casper-contract/latest/casper_contract/contract_api/storage/fn.disable_contract_version.html) function.

Disabled contract versions can no longer be executed. As such, if there is only a single contract version within the package, you will no longer be able to use the contract.

<!--TODO This link is only a guess until 1.5.4 releases and the auto-docs populate.-->
[Enable_contract_version](https://docs.rs/casper-contract/latest/casper_contract/contract_api/storage/fn.enable_contract_version.html) allows you to re-enable a previously disabled contract version.

::note

Be aware that calling a contract package will use the most recent contract version. It is not necessary to disable a previous contract version, unless you have a specific need to do so.

:::

## Creating a Locked Contract Package {#locked-contract-package}

Expand Down

0 comments on commit 81e97db

Please sign in to comment.