Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into fix_upgrade_polkadot_1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
renauter committed Oct 7, 2024
2 parents d5a1afb + 5e76664 commit d38120d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
1 change: 1 addition & 0 deletions .github/workflows/030_create_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
workdir: '${{ github.workspace }}/substrate-node'
package: tfchain-runtime
runtime_dir: runtime
tag: "1.77.0"

- name: Summary
run: |
Expand Down
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

0 comments on commit d38120d

Please sign in to comment.