Skip to content

Commit cc39dd4

Browse files
committed
🔧 chore(types.rs): remove duplicate CreateAsset enum definition to improve code readability
✨ feat(types.rs): add InitialSetupArgs enum to handle initial setup arguments for asset creation and role assignment
1 parent a9f61c2 commit cc39dd4

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

‎pallets/afloat/src/types.rs‎

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ impl<T: Config> Offer<T> {
143143
}
144144
}
145145

146+
// ! Arguments
147+
146148
#[derive(Encode, Decode, Clone, Eq, PartialEq, RuntimeDebugNoBound, TypeInfo)]
147149
#[scale_info(skip_type_params(T))]
148150
#[codec(mel_bound())]
@@ -172,6 +174,29 @@ pub enum KillStorageArgs {
172174
AfloatTransactions,
173175
}
174176

177+
#[derive(CloneNoBound, Encode, Decode, RuntimeDebugNoBound, TypeInfo, MaxEncodedLen, PartialEq)]
178+
#[scale_info(skip_type_params(T))]
179+
#[codec(mel_bound())]
180+
pub enum CreateAsset<T: Config> {
181+
New { asset_id: T::AssetId, min_balance: T::Balance },
182+
Existing { asset_id: T::AssetId },
183+
}
184+
185+
#[derive(Encode, Decode, Clone, PartialEq, RuntimeDebugNoBound, TypeInfo)]
186+
#[scale_info(skip_type_params(T))]
187+
#[codec(mel_bound())]
188+
pub enum InitialSetupArgs<T: Config> {
189+
All {
190+
creator: T::AccountId,
191+
admin: T::AccountId,
192+
asset: CreateAsset<T>,
193+
},
194+
Roles {
195+
creator: T::AccountId,
196+
admin: T::AccountId,
197+
},
198+
}
199+
175200
// ! Transaction structures
176201

177202
#[derive(CloneNoBound, Encode, Decode, RuntimeDebugNoBound, TypeInfo, MaxEncodedLen, PartialEq)]
@@ -195,13 +220,6 @@ pub struct Transaction<T: Config> {
195220
pub completed: bool,
196221
}
197222

198-
#[derive(CloneNoBound, Encode, Decode, RuntimeDebugNoBound, TypeInfo, MaxEncodedLen, PartialEq)]
199-
#[scale_info(skip_type_params(T))]
200-
#[codec(mel_bound())]
201-
pub enum CreateAsset<T: Config> {
202-
New { asset_id: T::AssetId, min_balance: T::Balance },
203-
Existing { asset_id: T::AssetId },
204-
}
205223

206224
// ! Roles structures
207225

0 commit comments

Comments
 (0)