From f5da3d6333e347561116b950725e191439c61062 Mon Sep 17 00:00:00 2001 From: luhrhenz Date: Fri, 20 Feb 2026 09:57:22 +0100 Subject: [PATCH] feat: implement get_contract_version for issue #100 --- contract/contract/src/crowdfunding.rs | 4 ++++ contract/contract/src/interfaces/crowdfunding.rs | 2 ++ contract/contract/test/crowdfunding_test.rs | 9 +++++++++ 3 files changed, 15 insertions(+) diff --git a/contract/contract/src/crowdfunding.rs b/contract/contract/src/crowdfunding.rs index 78120df..40aed44 100644 --- a/contract/contract/src/crowdfunding.rs +++ b/contract/contract/src/crowdfunding.rs @@ -1089,4 +1089,8 @@ impl CrowdfundingTrait for CrowdfundingContract { Ok(()) } + + fn get_contract_version(env: Env) -> String { + String::from_str(&env, "1.2.0") + } } diff --git a/contract/contract/src/interfaces/crowdfunding.rs b/contract/contract/src/interfaces/crowdfunding.rs index 0accbcc..8634f85 100644 --- a/contract/contract/src/interfaces/crowdfunding.rs +++ b/contract/contract/src/interfaces/crowdfunding.rs @@ -127,4 +127,6 @@ pub trait CrowdfundingTrait { admin: Address, amount: i128, ) -> Result<(), CrowdfundingError>; + + fn get_contract_version(env: Env) -> String; } diff --git a/contract/contract/test/crowdfunding_test.rs b/contract/contract/test/crowdfunding_test.rs index 91d57df..caa1b96 100644 --- a/contract/contract/test/crowdfunding_test.rs +++ b/contract/contract/test/crowdfunding_test.rs @@ -2754,3 +2754,12 @@ fn test_withdraw_platform_fees_insufficient_fees() { let res = client.try_withdraw_platform_fees(&admin, &100); assert_eq!(res, Err(Ok(CrowdfundingError::InsufficientFees))); } + +#[test] +fn test_get_contract_version() { + let env = Env::default(); + let (client, _, _) = setup_test(&env); + + let version = client.get_contract_version(); + assert_eq!(version, String::from_str(&env, "1.2.0")); +}