From 36d3d19a13651a828f7707c495fbf8d008861322 Mon Sep 17 00:00:00 2001 From: Igor Papandinas Date: Sun, 29 Oct 2023 19:32:22 +0100 Subject: [PATCH] modular file structure for smart contracts templates --- contracts/src/token/single-token/Cargo.toml | 2 +- contracts/src/token/single-token/lib.rs | 1 + contracts/src/traits/mod.rs | 1 + contracts/src/traits/types.rs | 1 + contracts/src/traits/workflow.rs | 4 +--- 5 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 contracts/src/traits/types.rs diff --git a/contracts/src/token/single-token/Cargo.toml b/contracts/src/token/single-token/Cargo.toml index 76f6d45..12e22d8 100755 --- a/contracts/src/token/single-token/Cargo.toml +++ b/contracts/src/token/single-token/Cargo.toml @@ -13,7 +13,7 @@ scale-info = { version = "2.6", default-features = false, features = ["derive"], openbrush = { git = "https://github.com/Brushfam/openbrush-contracts", version = "4.0.0-beta", default-features = false, features = ["ownable"] } # These dependencies -kudos_ink_contracts = { git = "https://github.com/kudos-ink/contracts", branch = "next" } +kudos_ink_contracts = { git = "https://github.com/kudos-ink/contracts" } [lib] name = "single_token_contract" diff --git a/contracts/src/token/single-token/lib.rs b/contracts/src/token/single-token/lib.rs index 340bf29..9c14957 100755 --- a/contracts/src/token/single-token/lib.rs +++ b/contracts/src/token/single-token/lib.rs @@ -4,6 +4,7 @@ #[openbrush::contract] pub mod single_token { use kudos_ink_contracts::traits::workflow::{WorkflowError, *}; + use kudos_ink_contracts::traits::types::HashValue; use openbrush::{modifiers, traits::Storage}; use ink::env::hash::{HashOutput, Sha2x256}; diff --git a/contracts/src/traits/mod.rs b/contracts/src/traits/mod.rs index a4283a6..2f9f572 100644 --- a/contracts/src/traits/mod.rs +++ b/contracts/src/traits/mod.rs @@ -1 +1,2 @@ pub mod workflow; +pub mod types; \ No newline at end of file diff --git a/contracts/src/traits/types.rs b/contracts/src/traits/types.rs new file mode 100644 index 0000000..22dee8c --- /dev/null +++ b/contracts/src/traits/types.rs @@ -0,0 +1 @@ +pub type HashValue = [u8; 32]; \ No newline at end of file diff --git a/contracts/src/traits/workflow.rs b/contracts/src/traits/workflow.rs index f66d21b..2746106 100644 --- a/contracts/src/traits/workflow.rs +++ b/contracts/src/traits/workflow.rs @@ -1,7 +1,5 @@ use openbrush::{contracts::traits::ownable::*, modifiers}; - -/// Type alias for hashes. -pub type HashValue = [u8; 32]; +use super::types::HashValue; #[openbrush::wrapper] pub type WorkflowdRef = dyn Workflow + Ownable;