Skip to content

Commit

Permalink
Allow cargo generate version 0.22
Browse files Browse the repository at this point in the history
  • Loading branch information
DOBEN committed Sep 8, 2024
1 parent 27f89fb commit 4e6bfa8
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion templates/cis2-nft/cargo-generate.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[template]
cargo_generate_version = ">= 0.17.0, < 0.22.0"
cargo_generate_version = ">= 0.17.0, < 0.23.0"

[placeholders]
description = { type="string", prompt="Description for the project?" }
Expand Down
2 changes: 1 addition & 1 deletion templates/credential-registry/cargo-generate.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[template]
cargo_generate_version = ">= 0.17.0, < 0.22.0"
cargo_generate_version = ">= 0.17.0, < 0.23.0"

[hooks]
pre = ["pre-script.rhai"] # a script for setting default values for the variables when `template_type = default`
Expand Down
2 changes: 1 addition & 1 deletion templates/default/cargo-generate.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[template]
cargo_generate_version = ">= 0.17.0, < 0.22.0"
cargo_generate_version = ">= 0.17.0, < 0.23.0"
2 changes: 1 addition & 1 deletion templates/default/deploy-scripts/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ async fn main() -> Result<(), Error> {
// here.

// You can easily import a type from the smart contract like so:
use default::CustomInputParameter; // Example
use {{crate_name}}::CustomInputParameter; // Example

let param = OwnedParameter::from_serial(&CustomInputParameter { num: 42 })?; // Example

Expand Down
19 changes: 13 additions & 6 deletions templates/default/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,21 @@ fn initialize() -> (Chain, ContractInitSuccess) {
// Deploy the module.
let deployment = chain.module_deploy_v1(SIGNER, ALICE, module).expect("Deploy valid module");

let parameter = CustomInputParameter { num: 0 };

// Initialize the contract.
let init = chain
.contract_init(SIGNER, ALICE, Energy::from(10_000), InitContractPayload {
amount: Amount::zero(),
mod_ref: deployment.module_reference,
init_name: OwnedContractName::new_unchecked("init_{{crate_name}}".to_string()),
param: OwnedParameter::empty(),
})
.contract_init(
SIGNER,
ALICE,
Energy::from(10_000),
InitContractPayload {
amount: Amount::zero(),
mod_ref: deployment.module_reference,
init_name: OwnedContractName::new_unchecked("init_{{crate_name}}".to_string()),
param: OwnedParameter::from_serial(&parameter).expect("Parameter has valid size."),
},
)
.expect("Initializing contract");

(chain, init)
Expand Down

0 comments on commit 4e6bfa8

Please sign in to comment.