Skip to content

Commit

Permalink
fix: accept transfers from contract as valid transfers
Browse files Browse the repository at this point in the history
  • Loading branch information
scx1332 committed Apr 18, 2024
1 parent eb3119b commit 9ea62ee
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions crates/erc20_payment_lib/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1047,24 +1047,9 @@ pub async fn find_receipt_extended(
}

if from == tx_to {
if Some(log.address) != transfered_to_contract_token {
if transfered_to_contract_token.is_none() {
return Ok(FindReceiptParseResult::Failure(
"Transfer from contract without contract from".to_string(),
));
}
return Err(err_custom_create!(
"Transfer from contract different token {:#x} != {:#x}",
log.address,
transfered_to_contract_token.unwrap()
));
}
let contract_from_addr = transfered_to_contract_from.ok_or(err_custom_create!(
"Transfer from contract without contract from"
))?;
transfers.push(ChainTransferDbObj {
id: 0,
from_addr: format!("{contract_from_addr:#x}"),
from_addr: format!("{from:#x}"),
receiver_addr: format!("{to:#x}"),
chain_id,
token_addr: Some(format!("{:#x}", log.address)),
Expand Down

0 comments on commit 9ea62ee

Please sign in to comment.