Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove-unnecessary-events #126

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 0 additions & 38 deletions abi/IBCStore.json
Original file line number Diff line number Diff line change
Expand Up @@ -360,25 +360,6 @@
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "event",
"name": "AckCommitted",
"inputs": [
{
"name": "path",
"type": "bytes32",
"indexed": false,
"internalType": "bytes32"
},
{
"name": "commitment",
"type": "bytes32",
"indexed": false,
"internalType": "bytes32"
}
],
"anonymous": false
},
{
"type": "event",
"name": "OwnershipTransferred",
Expand All @@ -398,25 +379,6 @@
],
"anonymous": false
},
{
"type": "event",
"name": "PacketCommitted",
"inputs": [
{
"name": "path",
"type": "bytes32",
"indexed": false,
"internalType": "bytes32"
},
{
"name": "commitment",
"type": "bytes32",
"indexed": false,
"internalType": "bytes32"
}
],
"anonymous": false
},
{
"type": "error",
"name": "IBCMultiPayloadPacketNotSupported",
Expand Down
249 changes: 71 additions & 178 deletions abi/ICS20Transfer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,77 @@
],
"stateMutability": "view"
},
{
"type": "function",
"name": "getReceiveERC20AddressAndSource",
"inputs": [
{
"name": "sourcePort",
"type": "string",
"internalType": "string"
},
{
"name": "sourceChannel",
"type": "string",
"internalType": "string"
},
{
"name": "destPort",
"type": "string",
"internalType": "string"
},
{
"name": "destChannel",
"type": "string",
"internalType": "string"
},
{
"name": "packetData",
"type": "tuple",
"internalType": "struct ICS20Lib.FungibleTokenPacketData",
"components": [
{
"name": "denom",
"type": "string",
"internalType": "string"
},
{
"name": "sender",
"type": "string",
"internalType": "string"
},
{
"name": "receiver",
"type": "string",
"internalType": "string"
},
{
"name": "amount",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "memo",
"type": "string",
"internalType": "string"
}
]
}
],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "address"
},
{
"name": "",
"type": "bool",
"internalType": "bool"
}
],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "multicall",
Expand Down Expand Up @@ -515,184 +586,6 @@
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "event",
"name": "ICS20Acknowledgement",
"inputs": [
{
"name": "packetData",
"type": "tuple",
"indexed": false,
"internalType": "struct ICS20Lib.FungibleTokenPacketData",
"components": [
{
"name": "denom",
"type": "string",
"internalType": "string"
},
{
"name": "sender",
"type": "string",
"internalType": "string"
},
{
"name": "receiver",
"type": "string",
"internalType": "string"
},
{
"name": "amount",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "memo",
"type": "string",
"internalType": "string"
}
]
},
{
"name": "acknowledgement",
"type": "bytes",
"indexed": false,
"internalType": "bytes"
}
],
"anonymous": false
},
{
"type": "event",
"name": "ICS20ReceiveTransfer",
"inputs": [
{
"name": "packetData",
"type": "tuple",
"indexed": false,
"internalType": "struct ICS20Lib.FungibleTokenPacketData",
"components": [
{
"name": "denom",
"type": "string",
"internalType": "string"
},
{
"name": "sender",
"type": "string",
"internalType": "string"
},
{
"name": "receiver",
"type": "string",
"internalType": "string"
},
{
"name": "amount",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "memo",
"type": "string",
"internalType": "string"
}
]
},
{
"name": "erc20Address",
"type": "address",
"indexed": false,
"internalType": "address"
}
],
"anonymous": false
},
{
"type": "event",
"name": "ICS20Timeout",
"inputs": [
{
"name": "packetData",
"type": "tuple",
"indexed": false,
"internalType": "struct ICS20Lib.FungibleTokenPacketData",
"components": [
{
"name": "denom",
"type": "string",
"internalType": "string"
},
{
"name": "sender",
"type": "string",
"internalType": "string"
},
{
"name": "receiver",
"type": "string",
"internalType": "string"
},
{
"name": "amount",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "memo",
"type": "string",
"internalType": "string"
}
]
}
],
"anonymous": false
},
{
"type": "event",
"name": "ICS20Transfer",
"inputs": [
{
"name": "packetData",
"type": "tuple",
"indexed": false,
"internalType": "struct ICS20Lib.FungibleTokenPacketData",
"components": [
{
"name": "denom",
"type": "string",
"internalType": "string"
},
{
"name": "sender",
"type": "string",
"internalType": "string"
},
{
"name": "receiver",
"type": "string",
"internalType": "string"
},
{
"name": "amount",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "memo",
"type": "string",
"internalType": "string"
}
]
},
{
"name": "erc20Address",
"type": "address",
"indexed": false,
"internalType": "address"
}
],
"anonymous": false
},
{
"type": "event",
"name": "OwnershipTransferred",
Expand Down
562 changes: 22 additions & 540 deletions abigen/ics20transfer/contract.go

Large diffs are not rendered by default.

12 changes: 1 addition & 11 deletions src/ICS20Transfer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ contract ICS20Transfer is IIBCApp, IICS20Transfer, IICS20Errors, Ownable, Reentr
IBCERC20 ibcERC20Contract = IBCERC20(erc20Address);
ibcERC20Contract.burn(packetData.amount);
}

emit ICS20Transfer(packetData, erc20Address);
}

/// @inheritdoc IIBCApp
Expand Down Expand Up @@ -123,9 +121,6 @@ contract ICS20Transfer is IIBCApp, IICS20Transfer, IICS20Errors, Ownable, Reentr
// transfer the tokens to the receiver
ESCROW.send(IERC20(erc20Address), receiver, packetData.amount);

// Note the event don't take into account the conversion
emit ICS20ReceiveTransfer(packetData, erc20Address);

return ICS20Lib.SUCCESSFUL_ACKNOWLEDGEMENT_JSON;
}

Expand All @@ -139,9 +134,6 @@ contract ICS20Transfer is IIBCApp, IICS20Transfer, IICS20Errors, Ownable, Reentr
getSendERC20AddressAndSource(msg_.payload.sourcePort, msg_.sourceChannel, packetData);
_refundTokens(packetData, erc20Address);
}

// Nothing needed to be done if the acknowledgement was successful, tokens are already in escrow or burnt
emit ICS20Acknowledgement(packetData, msg_.acknowledgement);
}

/// @inheritdoc IIBCApp
Expand All @@ -150,8 +142,6 @@ contract ICS20Transfer is IIBCApp, IICS20Transfer, IICS20Errors, Ownable, Reentr
abi.decode(msg_.payload.value, (ICS20Lib.FungibleTokenPacketData));
(address erc20Address,) = getSendERC20AddressAndSource(msg_.payload.sourcePort, msg_.sourceChannel, packetData);
_refundTokens(packetData, erc20Address);

emit ICS20Timeout(packetData);
}

/// @notice Refund the tokens to the sender
Expand Down Expand Up @@ -233,7 +223,7 @@ contract ICS20Transfer is IIBCApp, IICS20Transfer, IICS20Errors, Ownable, Reentr
string calldata destChannel,
ICS20Lib.FungibleTokenPacketData memory packetData
)
private
public
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note this, I changed the visibility here to have access to this function to properly test the logic of the foreignDenoms test without relying on the events. However it may not be the ideal solutions.

returns (address, bool)
{
bytes memory denomBz = bytes(packetData.denom);
Expand Down
12 changes: 0 additions & 12 deletions src/interfaces/IIBCStore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,4 @@ interface IIBCStore {
/// @param packet The packet to commit the acknowledgement for
/// @param acks The list of acknowledgements (one for each payload) to commit
function commitPacketAcknowledgement(IICS26RouterMsgs.Packet memory packet, bytes[] memory acks) external;

// --------------------- Events --------------------- //

/// @notice Emitted when a packet is committed
/// @param path The commitment path
/// @param commitment The commitment data
event PacketCommitted(bytes32 path, bytes32 commitment);

/// @notice Emitted when an ack is commmitted
/// @param path The commitment path
/// @param commitment The commitment data
event AckCommitted(bytes32 path, bytes32 commitment);
}
Loading
Loading