diff --git a/gear-programs/vft-manager/app/src/services/submit_receipt/mod.rs b/gear-programs/vft-manager/app/src/services/submit_receipt/mod.rs index b8f7a26f..ec2c959b 100644 --- a/gear-programs/vft-manager/app/src/services/submit_receipt/mod.rs +++ b/gear-programs/vft-manager/app/src/services/submit_receipt/mod.rs @@ -47,13 +47,6 @@ pub async fn submit_receipt( return Err(Error::NotEthClient); } - let config = service.config(); - if gstd::exec::gas_available() - < config.gas_for_token_ops + config.gas_for_submit_receipt + config.gas_for_reply_deposit - { - return Err(Error::NotEnoughGas); - } - let receipt = ReceiptEnvelope::decode(&mut &receipt_rlp[..]).map_err(|_| Error::NotSupportedEvent)?; @@ -119,16 +112,16 @@ pub async fn submit_receipt( match supply_type { TokenSupply::Ethereum => { - token_operations::mint(vara_token_id, receiver, amount, config, msg_id).await?; + token_operations::mint(vara_token_id, receiver, amount, service.config(), msg_id) + .await?; } TokenSupply::Gear => { - token_operations::unlock(vara_token_id, receiver, amount, config, msg_id).await?; + token_operations::unlock(vara_token_id, receiver, amount, service.config(), msg_id) + .await?; } } - msg_tracker_mut().check_withdraw_result(&msg_id)?; - - Ok(()) + msg_tracker_mut().check_withdraw_result(&msg_id) } pub async fn handle_interrupted_transfer( diff --git a/gear-programs/vft-manager/app/src/services/submit_receipt/msg_tracker.rs b/gear-programs/vft-manager/app/src/services/submit_receipt/msg_tracker.rs index 973b7dcc..cac9b4b1 100644 --- a/gear-programs/vft-manager/app/src/services/submit_receipt/msg_tracker.rs +++ b/gear-programs/vft-manager/app/src/services/submit_receipt/msg_tracker.rs @@ -4,6 +4,7 @@ use sails_rs::prelude::*; static mut MSG_TRACKER: Option = None; +// TODO: Itr doesn't cleaned up. #[derive(Default, Debug)] pub struct MessageTracker { pub message_info: HashMap, diff --git a/gear-programs/vft-manager/app/src/services/submit_receipt/token_operations.rs b/gear-programs/vft-manager/app/src/services/submit_receipt/token_operations.rs index 6ae8c345..aaaf1ea8 100644 --- a/gear-programs/vft-manager/app/src/services/submit_receipt/token_operations.rs +++ b/gear-programs/vft-manager/app/src/services/submit_receipt/token_operations.rs @@ -77,7 +77,8 @@ fn handle_reply_hook(msg_id: MessageId) { let reply_bytes = msg::load_bytes().expect("Unable to load bytes"); match msg_info.status { - MessageStatus::SendingMessageToWithdrawTokens => { + MessageStatus::SendingMessageToWithdrawTokens + | MessageStatus::WaitingReplyFromTokenWithdrawMessage => { let reply = match msg_info.details.token_supply { TokenSupply::Ethereum => decode_mint_reply(&reply_bytes), TokenSupply::Gear => decode_unlock_reply(&reply_bytes),