Skip to content

Commit

Permalink
fix for normal token
Browse files Browse the repository at this point in the history
  • Loading branch information
yito88 committed Jul 24, 2023
1 parent 4f42ecf commit a452f53
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions shared/src/ledger/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1198,16 +1198,6 @@ pub async fn build_ibc_transfer<
.await?;
// We cannot check the receiver

let token_hash = match &args.token {
Address::Internal(InternalAddress::IbcToken(hash)) => hash.clone(),
_ => return Err(Error::TokenDoesNotExist(args.token)),
};
let ibc_denom_key = ibc_denom_key(token_hash);
let ibc_denom =
rpc::query_storage_value::<C, String>(client, &ibc_denom_key)
.await
.ok_or_else(|| Error::TokenDoesNotExist(args.token.clone()))?;

// Check source balance
let balance_key = token::balance_key(&args.token, &source);

Expand All @@ -1226,6 +1216,15 @@ pub async fn build_ibc_transfer<
.await
.unwrap();

let ibc_denom = match &args.token {
Address::Internal(InternalAddress::IbcToken(hash)) => {
let ibc_denom_key = ibc_denom_key(hash);
rpc::query_storage_value::<C, String>(client, &ibc_denom_key)
.await
.ok_or_else(|| Error::TokenDoesNotExist(args.token.clone()))?
}
_ => args.token.to_string(),
};
let amount = args
.amount
.to_string_native()
Expand Down

0 comments on commit a452f53

Please sign in to comment.