From 859b4cde79d2f7d94d03c6a2c1e14f80ea3e1898 Mon Sep 17 00:00:00 2001 From: akildemir Date: Sat, 23 Sep 2023 17:06:00 +0300 Subject: [PATCH] use transfer_allow_death instead of kee_alive --- Cargo.lock | 8 ++++---- substrate/in-instructions/pallet/src/lib.rs | 13 ++++--------- substrate/tokens/pallet/src/lib.rs | 9 --------- 3 files changed, 8 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6be0d9114..7a037435d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4384,7 +4384,7 @@ dependencies = [ "rcgen", "ring", "rustls", - "rustls-webpki 0.101.5", + "rustls-webpki 0.101.6", "thiserror", "x509-parser", "yasna", @@ -6795,7 +6795,7 @@ checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" dependencies = [ "log", "ring", - "rustls-webpki 0.101.5", + "rustls-webpki 0.101.6", "sct", ] @@ -6832,9 +6832,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.101.5" +version = "0.101.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45a27e3b59326c16e23d30aeb7a36a24cc0d29e71d68ff611cdfb4a01d013bed" +checksum = "3c7d5dece342910d9ba34d259310cae3e0154b873b35408b787b59bce53d34fe" dependencies = [ "ring", "untrusted", diff --git a/substrate/in-instructions/pallet/src/lib.rs b/substrate/in-instructions/pallet/src/lib.rs index 0979046e9..6367e1333 100644 --- a/substrate/in-instructions/pallet/src/lib.rs +++ b/substrate/in-instructions/pallet/src/lib.rs @@ -124,7 +124,7 @@ pub mod pallet { half, 1, // minimum out, so we accept whatever we get. IN_INSTRUCTION_EXECUTOR.into(), - true, + false, )?; // get how much we got for our swap @@ -152,17 +152,12 @@ pub mod pallet { BalancesPallet::::free_balance(PublicKey::from(IN_INSTRUCTION_EXECUTOR)); if coin_balance != 0 { - Tokens::::transfer_keep_alive( - origin.clone().into(), - coin, - address, - coin_balance, - )?; + Tokens::::transfer(origin.clone().into(), coin, address, coin_balance)?; } if sri_balance != 0 { // unwrap here. First, it doesn't panic for full amount, // second we should empty IIE account anyway. - BalancesPallet::::transfer_keep_alive(origin.into(), address, sri_balance) + BalancesPallet::::transfer_allow_death(origin.into(), address, sri_balance) .unwrap(); } } @@ -202,7 +197,7 @@ pub mod pallet { instruction.balance.amount.0, out_balance.amount.0, send_to.into(), - true, + false, )?; // burn the received coins so that they sent back to the user diff --git a/substrate/tokens/pallet/src/lib.rs b/substrate/tokens/pallet/src/lib.rs index 41e5f2d4c..22e92dcf9 100644 --- a/substrate/tokens/pallet/src/lib.rs +++ b/substrate/tokens/pallet/src/lib.rs @@ -76,15 +76,6 @@ pub mod pallet { ) -> DispatchResult { AssetsPallet::::transfer(origin, coin, target, amount) } - - pub fn transfer_keep_alive( - origin: OriginFor, - coin: Coin, - target: SeraiAddress, - amount: SubstrateAmount, - ) -> DispatchResult { - AssetsPallet::::transfer_keep_alive(origin, coin, target, amount) - } } #[pallet::call]