Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
gjermundgaraba committed Nov 22, 2024
1 parent 13d95a1 commit a61644d
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 33 deletions.
16 changes: 9 additions & 7 deletions src/utils/ICS20Lib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,15 @@ library ICS20Lib {
}

// We are encoding the payload in ABI format
bytes memory packetData = ICS20Lib.encodePayload(ICS20Lib.FungibleTokenPacketData({
denom: fullDenomPath,
sender: Strings.toHexString(sender),
receiver: msg_.receiver,
amount: msg_.amount,
memo: msg_.memo
}));
bytes memory packetData = ICS20Lib.encodePayload(
ICS20Lib.FungibleTokenPacketData({
denom: fullDenomPath,
sender: Strings.toHexString(sender),
receiver: msg_.receiver,
amount: msg_.amount,
memo: msg_.memo
})
);

IICS26RouterMsgs.Payload[] memory payloads = new IICS26RouterMsgs.Payload[](1);
payloads[0] = IICS26RouterMsgs.Payload({
Expand Down
1 change: 0 additions & 1 deletion test/ICS20LibTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ pragma solidity ^0.8.28;

import { Test } from "forge-std/Test.sol";
import { ICS20Lib } from "../src/utils/ICS20Lib.sol";
import { IICS20Errors } from "../src/errors/IICS20Errors.sol";

contract ICS20LibTest is Test {
struct IBCDenomTestCase {
Expand Down
5 changes: 1 addition & 4 deletions test/ICS20TransferTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,6 @@ contract ICS20TransferTest is Test {
defaultSendPacketData.amount = defaultAmount; // reset amount
packet.payloads[0].value = ICS20Lib.encodePayload(defaultSendPacketData);


// test invalid data
packet.payloads[0].value = bytes("invalid");
vm.expectRevert(); // Given the data is invalid, we expect the abi.decodePayload to fail with a generic revert
Expand Down Expand Up @@ -426,9 +425,7 @@ contract ICS20TransferTest is Test {
assertEq(contractBalanceAfterSend, defaultAmount);

vm.expectEmit();
emit IICS20Transfer.ICS20Acknowledgement(
defaultSendPacketData, ICS20Lib.SUCCESSFUL_ACKNOWLEDGEMENT_JSON
);
emit IICS20Transfer.ICS20Acknowledgement(defaultSendPacketData, ICS20Lib.SUCCESSFUL_ACKNOWLEDGEMENT_JSON);
ics20Transfer.onAcknowledgementPacket(
IIBCAppCallbacks.OnAcknowledgementPacketCallback({
sourceChannel: packet.sourceChannel,
Expand Down
48 changes: 27 additions & 21 deletions test/IntegrationTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,15 @@ contract IntegrationTest is Test {
uint32 sequence = ics20Transfer.sendTransfer(transferMsg);
assertEq(sequence, 1);

bytes memory value = ICS20Lib.encodePayload(ICS20Lib.FungibleTokenPacketData({
denom: erc20AddressStr,
sender: senderStr,
receiver: receiverStr,
amount: transferAmount,
memo: "memo"
}));
bytes memory value = ICS20Lib.encodePayload(
ICS20Lib.FungibleTokenPacketData({
denom: erc20AddressStr,
sender: senderStr,
receiver: receiverStr,
amount: transferAmount,
memo: "memo"
})
);

IICS26RouterMsgs.Payload[] memory packetPayloads = new IICS26RouterMsgs.Payload[](1);
packetPayloads[0] = IICS26RouterMsgs.Payload({
Expand Down Expand Up @@ -455,13 +457,15 @@ contract IntegrationTest is Test {
destPort: ICS20Lib.DEFAULT_PORT_ID,
version: ICS20Lib.ICS20_VERSION,
encoding: ICS20Lib.ICS20_ENCODING,
value: ICS20Lib.encodePayload(ICS20Lib.FungibleTokenPacketData({
denom: receivedDenom,
sender: senderStr,
receiver: receiverStr,
amount: transferAmount,
memo: "backmemo"
}))
value: ICS20Lib.encodePayload(
ICS20Lib.FungibleTokenPacketData({
denom: receivedDenom,
sender: senderStr,
receiver: receiverStr,
amount: transferAmount,
memo: "backmemo"
})
)
});
packet = IICS26RouterMsgs.Packet({
sequence: 1,
Expand Down Expand Up @@ -529,13 +533,15 @@ contract IntegrationTest is Test {
destPort: ICS20Lib.DEFAULT_PORT_ID,
version: ICS20Lib.ICS20_VERSION,
encoding: ICS20Lib.ICS20_ENCODING,
value: ICS20Lib.encodePayload(ICS20Lib.FungibleTokenPacketData({
denom: receivedDenom,
sender: senderStr,
receiver: receiverStr,
amount: transferAmount,
memo: "backmemo"
}))
value: ICS20Lib.encodePayload(
ICS20Lib.FungibleTokenPacketData({
denom: receivedDenom,
sender: senderStr,
receiver: receiverStr,
amount: transferAmount,
memo: "backmemo"
})
)
});
packet = IICS26RouterMsgs.Packet({
sequence: 1,
Expand Down

0 comments on commit a61644d

Please sign in to comment.