diff --git a/app/process/watcher/evm/watcher.go b/app/process/watcher/evm/watcher.go index 89ae4410a..918b86857 100644 --- a/app/process/watcher/evm/watcher.go +++ b/app/process/watcher/evm/watcher.go @@ -296,9 +296,9 @@ func (ew *Watcher) handleBurnLog(eventLog *router.RouterBurn, q qi.Queue) { properAmount := eventLog.Amount if eventLog.TargetChain.Int64() == 0 { - properAmount, err = ew.contracts.RemoveDecimals(eventLog.Amount, eventLog.Token.String()) + properAmount, err = ew.contracts.RemoveDecimals(properAmount, eventLog.Token.String()) if err != nil { - ew.logger.Errorf("[%s] - Failed to adjust [%s] amount [%s] decimals between chains.", eventLog.Raw.TxHash, eventLog.Token, eventLog.Amount) + ew.logger.Errorf("[%s] - Failed to adjust [%s] amount [%s] decimals between chains.", eventLog.Raw.TxHash, eventLog.Token, properAmount) return } } @@ -384,9 +384,9 @@ func (ew *Watcher) handleLockLog(eventLog *router.RouterLock, q qi.Queue) { properAmount := new(big.Int).Sub(eventLog.Amount, eventLog.ServiceFee) if eventLog.TargetChain.Int64() == 0 { - properAmount, err = ew.contracts.RemoveDecimals(eventLog.Amount, eventLog.Token.String()) + properAmount, err = ew.contracts.RemoveDecimals(properAmount, eventLog.Token.String()) if err != nil { - ew.logger.Errorf("[%s] - Failed to adjust [%s] amount [%s] decimals between chains.", eventLog.Raw.TxHash, eventLog.Token, eventLog.Amount) + ew.logger.Errorf("[%s] - Failed to adjust [%s] amount [%s] decimals between chains.", eventLog.Raw.TxHash, eventLog.Token, properAmount) return } } @@ -409,7 +409,7 @@ func (ew *Watcher) handleLockLog(eventLog *router.RouterLock, q qi.Queue) { ew.logger.Infof("[%s] - New Lock Event Log with Amount [%s], Receiver Address [%s], Source Chain [%d] and Target Chain [%d] has been found.", eventLog.Raw.TxHash.String(), - eventLog.Amount.String(), + properAmount, recipientAccount, chain.Int64(), eventLog.TargetChain.Int64()) diff --git a/e2e/e2e_test.go b/e2e/e2e_test.go index 785158671..3fbde47db 100644 --- a/e2e/e2e_test.go +++ b/e2e/e2e_test.go @@ -310,7 +310,7 @@ func Test_EVM_Hedera_Token(t *testing.T) { // Test_EVM_Hedera_Native_Token recreates a real life situation of a user who wants to bridge an EVM native token to the Hedera infrastructure. A new wrapped token (corresponding to the native EVM one) gets minted to the bridge account, then gets transferred to the recipient account. func Test_EVM_Hedera_Native_Token(t *testing.T) { - amount := int64(10000000000) + amount := int64(100000000000) // Step 1: Initialize setup, smart contracts, etc. setupEnv := setup.Load() @@ -330,7 +330,8 @@ func Test_EVM_Hedera_Native_Token(t *testing.T) { // Step 3: Validate Lock Event was emitted with correct data lockEventId := validateLockEvent(receipt, expectedLockEventLog, t) - expectedAmount, err := removeDecimals(amount, common.HexToAddress(setupEnv.NativeEvmToken), evm) + bridgedAmount := new(big.Int).Sub(expectedLockEventLog.Amount, expectedLockEventLog.ServiceFee) + expectedAmount, err := removeDecimals(bridgedAmount.Int64(), common.HexToAddress(setupEnv.NativeEvmToken), evm) if err != nil { t.Fatal(err) }