Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions substrate-node/pallets/pallet-tft-bridge/src/tft_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ impl<T: Config> Pallet<T> {

// transfer new amount to target
let amount_as_balance = BalanceOf::<T>::saturated_from(new_amount);
T::Currency::deposit_creating(&tx.target, amount_as_balance);
let _ = T::Currency::deposit_creating(&tx.target, amount_as_balance);
// transfer deposit fee to fee wallet
let deposit_fee_b = BalanceOf::<T>::saturated_from(deposit_fee);

if let Some(fee_account) = FeeAccount::<T>::get() {
T::Currency::deposit_creating(&fee_account, deposit_fee_b);
let _ = T::Currency::deposit_creating(&fee_account, deposit_fee_b);
}

// Remove tx from storage
Expand Down Expand Up @@ -78,7 +78,7 @@ impl<T: Config> Pallet<T> {

// transfer withdraw fee to fee wallet
if let Some(fee_account) = FeeAccount::<T>::get() {
T::Currency::deposit_creating(&fee_account, withdraw_fee_b);
let _ = T::Currency::deposit_creating(&fee_account, withdraw_fee_b);
}

// increment burn transaction id
Expand Down Expand Up @@ -240,9 +240,11 @@ impl<T: Config> Pallet<T> {
Error::<T>::BurnTransactionAlreadyExecuted
);

let Some(mut burn_tx) = BurnTransactions::<T>::get(tx_id) else {return Err(DispatchErrorWithPostInfo::from(
Error::<T>::BurnTransactionNotExists,
));};
let Some(mut burn_tx) = BurnTransactions::<T>::get(tx_id) else {
return Err(DispatchErrorWithPostInfo::from(
Error::<T>::BurnTransactionNotExists,
));
};

ensure!(
BurnTransactions::<T>::contains_key(tx_id),
Expand Down Expand Up @@ -286,9 +288,11 @@ impl<T: Config> Pallet<T> {
stellar_pub_key: Vec<u8>,
sequence_number: u64,
) -> DispatchResultWithPostInfo {
let Some(mut tx) = BurnTransactions::<T>::get(&tx_id) else {return Err(DispatchErrorWithPostInfo::from(
Error::<T>::BurnTransactionNotExists,
));};
let Some(mut tx) = BurnTransactions::<T>::get(&tx_id) else {
return Err(DispatchErrorWithPostInfo::from(
Error::<T>::BurnTransactionNotExists,
));
};

let validators = Validators::<T>::get();
if tx.signatures.len() == (validators.len() / 2) + 1 {
Expand Down Expand Up @@ -346,9 +350,11 @@ impl<T: Config> Pallet<T> {
Error::<T>::BurnTransactionNotExists
);

let Some(tx) = BurnTransactions::<T>::get(tx_id) else {return Err(DispatchErrorWithPostInfo::from(
Error::<T>::BurnTransactionNotExists,
));};
let Some(tx) = BurnTransactions::<T>::get(tx_id) else {
return Err(DispatchErrorWithPostInfo::from(
Error::<T>::BurnTransactionNotExists,
));
};

BurnTransactions::<T>::remove(tx_id);
ExecutedBurnTransactions::<T>::insert(tx_id, &tx);
Expand Down
Loading