diff --git a/core/payment-driver/erc20/src/driver.rs b/core/payment-driver/erc20/src/driver.rs index 1526bab709..166d170447 100644 --- a/core/payment-driver/erc20/src/driver.rs +++ b/core/payment-driver/erc20/src/driver.rs @@ -487,6 +487,16 @@ impl Erc20Driver { deposit_spender, ); + if allocation_address != deposit_spender { + log::debug!( + "Deposit validation failed, requested address [{}] doesn't match deposit spender [{}]", + allocation_address, + deposit_spender + ); + + return Ok(ValidateAllocationResult::DepositSpenderMismatch); + } + if msg.amount > deposit_balance { log::debug!( "Deposit validation failed: requested amount [{}] > deposit balance [{}]", @@ -516,16 +526,6 @@ impl Erc20Driver { return Ok(ValidateAllocationResult::TimeoutExceedsDeposit); }; - if allocation_address != deposit_spender { - log::debug!( - "Deposit validation failed, requested address [{}] doesn't match deposit spender [{}]", - allocation_address, - deposit_spender - ); - - return Ok(ValidateAllocationResult::DepositSpenderMismatch); - } - Ok(ValidateAllocationResult::Valid) } }