Skip to content

Commit

Permalink
chore: add Clone to Contract (#1362)
Browse files Browse the repository at this point in the history
  • Loading branch information
hal3e authored May 8, 2024
1 parent 00f31e3 commit 7f3de2d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion docs/src/deploying/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ Alternatively, you can use `LoadConfiguration` to configure how the contract is
- Load the same contract binary with `Salt` to get a new `contract_id`
- Change the contract's storage slots
- Update the contract's configurables
> Note: The next section will give more information on how `configurables` can be used.

> Note: The next section will give more information on how `configurables` can be used.
Additionally, you can set custom `TxParameters` when deploying the loaded contract.

Expand All @@ -39,3 +40,5 @@ After the contract is deployed, you can use the contract's methods like this:
```rust,ignore
{{#include ../../../examples/contracts/src/lib.rs:use_deployed_contract}}
```

> Note: When redeploying an existing `Contract`, ensure that you initialize it with a unique salt to prevent deployment failures caused by a contract ID collision. To accomplish this, utilize the `with_salt` method to clone the existing `Contract` with a new salt.
2 changes: 1 addition & 1 deletion packages/fuels-programs/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ impl LoadConfiguration {

/// [`Contract`] is a struct to interface with a contract. That includes things such as
/// compiling, deploying, and running transactions against a contract.
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct Contract {
binary: Vec<u8>,
salt: Salt,
Expand Down

0 comments on commit 7f3de2d

Please sign in to comment.