From e632f3a5a5fd5b2fa155926fcfc560222ba9fa2c Mon Sep 17 00:00:00 2001 From: gcranju Date: Thu, 4 Apr 2024 12:01:01 +0545 Subject: [PATCH 1/2] fix: acknowledgement compare issue fixed --- .../javascore/ics20/src/main/java/ibc/ics20/ICS20Transfer.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contracts/javascore/ics20/src/main/java/ibc/ics20/ICS20Transfer.java b/contracts/javascore/ics20/src/main/java/ibc/ics20/ICS20Transfer.java index 5363f34d1..6f520341c 100644 --- a/contracts/javascore/ics20/src/main/java/ibc/ics20/ICS20Transfer.java +++ b/contracts/javascore/ics20/src/main/java/ibc/ics20/ICS20Transfer.java @@ -16,6 +16,7 @@ import score.annotation.Optional; import score.annotation.Payable; import icon.ibc.interfaces.IIBCModule; +import java.util.Arrays; import java.math.BigInteger; @@ -332,7 +333,7 @@ public byte[] onRecvPacket(byte[] packet, Address relayer) { @External public void onAcknowledgementPacket(byte[] packet, byte[] acknowledgement, Address relayer) { onlyIBC(); - if (!acknowledgement.equals(ICS20Lib.SUCCESSFUL_ACKNOWLEDGEMENT_JSON)) { + if (!Arrays.equals(acknowledgement,ICS20Lib.SUCCESSFUL_ACKNOWLEDGEMENT_JSON)) { Packet packetDb = Packet.decode(packet); refundTokens(packetDb); } From a8f2f956fb634cf3a26b84957fa1f4d0998e39c6 Mon Sep 17 00:00:00 2001 From: gcranju Date: Fri, 5 Apr 2024 09:32:43 +0545 Subject: [PATCH 2/2] fix: address comparision in tokenFallback --- .../ics20/src/main/java/ibc/ics20/ICS20Transfer.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/contracts/javascore/ics20/src/main/java/ibc/ics20/ICS20Transfer.java b/contracts/javascore/ics20/src/main/java/ibc/ics20/ICS20Transfer.java index 6f520341c..a57b26164 100644 --- a/contracts/javascore/ics20/src/main/java/ibc/ics20/ICS20Transfer.java +++ b/contracts/javascore/ics20/src/main/java/ibc/ics20/ICS20Transfer.java @@ -191,7 +191,10 @@ public void tokenFallback(Address from, BigInteger value, byte[] _data) { Context.require(amount.equals(value), TAG + " : Mismatched amount"); Context.require(sender.equals(from.toString()), TAG + " : Sender address mismatched"); - Context.require(tokenContracts.get(denomination) == Context.getCaller(), + + Address tokenAddress = tokenContracts.get(denomination); + + Context.require(tokenAddress!=null && tokenAddress.equals(Context.getCaller()), TAG + " : Sender Token Contract not registered"); sendFungibleToken(denomination, amount, sender, receiver, sourcePort, sourceChannel, height,