Skip to content

Commit

Permalink
feat: add asset_type for buyOrder (#258)
Browse files Browse the repository at this point in the history
  • Loading branch information
abhath-labs committed Mar 31, 2024
1 parent e546b15 commit ae25813
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion pallets/dex/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ pub mod pallet {
T::AssetValidator::get_project_details(&asset_id)
.ok_or(Error::<T>::AssetNotPermitted)?;

Self::check_kyc_approval(&buyer, asset_type)?;
Self::check_kyc_approval(&buyer, asset_type.clone())?;

// reduce the buy_order units from total volume
order.units =
Expand Down Expand Up @@ -646,6 +646,7 @@ pub mod pallet {
asset_id,
total_fee: total_fee.into(),
total_amount: total_amount.into(),
asset_type,
expiry_time,
payment_info: None,
},
Expand Down
1 change: 1 addition & 0 deletions pallets/dex/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ pub struct BuyOrderInfo<
pub total_fee: TokenBalance,
pub total_amount: TokenBalance,
pub expiry_time: Time,
pub asset_type: CarbonAssetType,
pub payment_info: Option<PaymentInfo<AccountId, TxProofLen, MaxValidators>>,
}

Expand Down
3 changes: 2 additions & 1 deletion primitives/src/carbon_assets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,10 @@ pub struct BatchRetireData<StringType, Balance> {
}

/// The types of carbon assets
#[derive(Clone, Encode, Decode, Eq, PartialEq, TypeInfo, Debug, MaxEncodedLen)]
#[derive(Clone, Encode, Decode, Eq, PartialEq, TypeInfo, Debug, MaxEncodedLen, Default)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum CarbonAssetType {
#[default]
Credits,
Forwards,
Shares,
Expand Down
2 changes: 1 addition & 1 deletion runtime/bitgreen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("bitgreen-parachain"),
impl_name: create_runtime_str!("bitgreen-parachain"),
authoring_version: 1,
spec_version: 1303, // v1.3.3
spec_version: 1304, // v1.3.4
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 2,
Expand Down
2 changes: 1 addition & 1 deletion runtime/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("bitgreen-rococo"),
impl_name: create_runtime_str!("bitgreen-rococo"),
authoring_version: 1,
spec_version: 1303, // v1.3.3
spec_version: 1304, // v1.3.4
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 2,
Expand Down

0 comments on commit ae25813

Please sign in to comment.