Skip to content

Commit

Permalink
SLPx mint support commission id (#1261)
Browse files Browse the repository at this point in the history
  • Loading branch information
SunTiebing authored Jun 11, 2024
1 parent 08aa1c2 commit 5b892b4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions pallets/slpx/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ mod benchmarks {
KSM,
TargetChain::Astar(receiver),
BoundedVec::default(),
None,
);
}

Expand Down
6 changes: 5 additions & 1 deletion pallets/slpx/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ pub mod pallet {
currency_id: CurrencyIdOf<T>,
target_chain: TargetChain<AccountIdOf<T>>,
remark: BoundedVec<u8, ConstU32<32>>,
channel_id: Option<u32>,
) -> DispatchResultWithPostInfo {
let (source_chain_caller, derivative_account, bifrost_chain_caller) =
Self::ensure_singer_on_whitelist(origin.clone(), evm_caller, &target_chain)?;
Expand All @@ -456,6 +457,7 @@ pub mod pallet {
currency_id,
remark,
target_chain,
channel_id,
};

OrderQueue::<T>::mutate(|order_queue| -> DispatchResultWithPostInfo {
Expand Down Expand Up @@ -515,6 +517,7 @@ pub mod pallet {
bifrost_chain_caller,
derivative_account,
target_chain,
channel_id: None,
};

OrderQueue::<T>::mutate(|order_queue| -> DispatchResultWithPostInfo {
Expand Down Expand Up @@ -738,6 +741,7 @@ pub mod pallet {
currency_id,
remark,
target_chain,
channel_id: None,
};

OrderQueue::<T>::mutate(|order_queue| -> DispatchResultWithPostInfo {
Expand Down Expand Up @@ -1000,7 +1004,7 @@ impl<T: Config> Pallet<T> {
order.currency_id,
currency_amount,
order.remark.clone(),
None,
order.channel_id,
)
.map_err(|_| Error::<T>::ArgumentsError)?;
let vtoken_id = T::VtokenMintingInterface::vtoken_id(order.currency_id)
Expand Down
6 changes: 4 additions & 2 deletions pallets/slpx/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,8 @@ fn test_add_order() {
source_chain_caller,
DOT,
TargetChain::Astar(source_chain_caller),
BoundedVec::default()
BoundedVec::default(),
None
));
assert_eq!(OrderQueue::<Test>::get().len(), 1usize);
assert_ok!(Slpx::redeem(
Expand Down Expand Up @@ -389,7 +390,8 @@ fn test_hook() {
source_chain_caller,
DOT,
TargetChain::Astar(source_chain_caller),
BoundedVec::default()
BoundedVec::default(),
None
));
assert_eq!(OrderQueue::<Test>::get().len(), 1usize);
<frame_system::Pallet<Test>>::set_block_number(2u32.into());
Expand Down
1 change: 1 addition & 0 deletions pallets/slpx/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,5 @@ pub struct Order<AccountId, CurrencyId, Balance, BlockNumber> {
pub order_type: OrderType,
pub remark: BoundedVec<u8, ConstU32<32>>,
pub target_chain: TargetChain<AccountId>,
pub channel_id: Option<u32>,
}

0 comments on commit 5b892b4

Please sign in to comment.