From 4ebe3d225ef34be5f3040193601e588ecb306512 Mon Sep 17 00:00:00 2001 From: Arome8240 Date: Tue, 24 Mar 2026 10:52:04 +0100 Subject: [PATCH 1/3] feat: define FactoryError variants #103 --- .../contracts/factory_contract/src/errors.rs | 15 +++++++++++++++ .../contracts/factory_contract/src/lib.rs | 3 +++ 2 files changed, 18 insertions(+) diff --git a/gateway-contract/contracts/factory_contract/src/errors.rs b/gateway-contract/contracts/factory_contract/src/errors.rs index e69de29b..3af23fe8 100644 --- a/gateway-contract/contracts/factory_contract/src/errors.rs +++ b/gateway-contract/contracts/factory_contract/src/errors.rs @@ -0,0 +1,15 @@ +use soroban_sdk::contracterror; + +#[contracterror] +#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord)] +#[repr(u32)] +pub enum FactoryError { + /// The contract has already been initialized and cannot be initialized again. + AlreadyInitialized = 1, + /// The caller is not authorized to perform this operation. + Unauthorized = 2, + /// The provided contract hash is invalid or not found. + InvalidContractHash = 3, + /// Contract deployment failed. + DeploymentFailed = 4, +} diff --git a/gateway-contract/contracts/factory_contract/src/lib.rs b/gateway-contract/contracts/factory_contract/src/lib.rs index 6c72d263..4a82b61e 100644 --- a/gateway-contract/contracts/factory_contract/src/lib.rs +++ b/gateway-contract/contracts/factory_contract/src/lib.rs @@ -1,6 +1,9 @@ #![no_std] use soroban_sdk::{contract, contractimpl}; +mod errors; +pub use errors::FactoryError; + #[contract] pub struct FactoryContract; From 4476fc9de5d80f6ed717ae74e7b0d184f73a56d6 Mon Sep 17 00:00:00 2001 From: Arome8240 Date: Wed, 25 Mar 2026 13:54:07 +0100 Subject: [PATCH 2/3] fix bugs --- .../contracts/factory_contract/src/errors.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/gateway-contract/contracts/factory_contract/src/errors.rs b/gateway-contract/contracts/factory_contract/src/errors.rs index 3af23fe8..c81408cb 100644 --- a/gateway-contract/contracts/factory_contract/src/errors.rs +++ b/gateway-contract/contracts/factory_contract/src/errors.rs @@ -4,12 +4,7 @@ use soroban_sdk::contracterror; #[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord)] #[repr(u32)] pub enum FactoryError { - /// The contract has already been initialized and cannot be initialized again. - AlreadyInitialized = 1, - /// The caller is not authorized to perform this operation. - Unauthorized = 2, - /// The provided contract hash is invalid or not found. - InvalidContractHash = 3, - /// Contract deployment failed. - DeploymentFailed = 4, + Unauthorized = 1, + AlreadyDeployed = 2, + CoreContractNotConfigured = 3, } From 438236b63973dc511ff35f640a3e9dda0ef4b3c1 Mon Sep 17 00:00:00 2001 From: Arome8240 Date: Wed, 25 Mar 2026 13:54:48 +0100 Subject: [PATCH 3/3] fix(factory): remove unnecessary trait derives from FactoryError - Remove PartialOrd and Ord derives from FactoryError enum - Simplify error type to only include necessary comparison traits - Reduces unnecessary trait implementations for error handling --- gateway-contract/contracts/factory_contract/src/errors.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gateway-contract/contracts/factory_contract/src/errors.rs b/gateway-contract/contracts/factory_contract/src/errors.rs index c81408cb..5c369783 100644 --- a/gateway-contract/contracts/factory_contract/src/errors.rs +++ b/gateway-contract/contracts/factory_contract/src/errors.rs @@ -1,7 +1,7 @@ use soroban_sdk::contracterror; #[contracterror] -#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord)] +#[derive(Copy, Clone, Debug, Eq, PartialEq)] #[repr(u32)] pub enum FactoryError { Unauthorized = 1,