@@ -78,7 +78,6 @@ abstract contract IBCChannelImpl is IBCStore, IIBCChannel {
7878        channel.connectionId =  msg_.connectionId;
7979        channel.ordering =  msg_.ordering;
8080        channel.version =  msg_.version;
81-         channel.portId =  msg_.portId.toHexString ();
8281        channel.counterpartyPortId =  msg_.counterpartyPortId;
8382        initializeChannelSequences (channelId);
8483        commitChannel (channelId, channel);
@@ -91,7 +90,7 @@ abstract contract IBCChannelImpl is IBCStore, IIBCChannel {
9190            msg_.relayer
9291        );
9392        emit  IBCChannelLib.ChannelOpenInit (
94-             channel .portId,
93+             msg_ .portId. toHexString () ,
9594            channelId,
9695            channel.counterpartyPortId,
9796            msg_.connectionId,
@@ -121,8 +120,7 @@ abstract contract IBCChannelImpl is IBCStore, IIBCChannel {
121120            ordering: msg_.channel.ordering,
122121            counterpartyChannelId: 0 ,
123122            connectionId: getCounterpartyConnection (msg_.channel.connectionId),
124-             portId: msg_.channel.counterpartyPortId,
125-             counterpartyPortId: msg_.channel.portId,
123+             counterpartyPortId: msg_.portId.toHexString (),
126124            version: msg_.counterpartyVersion
127125        });
128126        if  (
@@ -140,9 +138,8 @@ abstract contract IBCChannelImpl is IBCStore, IIBCChannel {
140138        channels[channelId] =  msg_.channel;
141139        initializeChannelSequences (channelId);
142140        commitChannelCalldata (channelId, msg_.channel);
143-         address  portId =  Hex.hexToAddress (msg_.channel.portId);
144-         claimChannel (portId, channelId);
145-         IIBCModule (portId).onChanOpenTry (
141+         claimChannel (msg_.portId, channelId);
142+         IIBCModule (msg_.portId).onChanOpenTry (
146143            msg_.channel.ordering,
147144            msg_.channel.connectionId,
148145            channelId,
@@ -152,7 +149,7 @@ abstract contract IBCChannelImpl is IBCStore, IIBCChannel {
152149            msg_.relayer
153150        );
154151        emit  IBCChannelLib.ChannelOpenTry (
155-             msg_.channel. portId,
152+             msg_.portId. toHexString () ,
156153            channelId,
157154            msg_.channel.counterpartyPortId,
158155            msg_.channel.counterpartyChannelId,
@@ -173,13 +170,13 @@ abstract contract IBCChannelImpl is IBCStore, IIBCChannel {
173170            revert  IBCErrors.ErrInvalidChannelState ();
174171        }
175172        uint32  clientId =  ensureConnectionState (channel.connectionId);
173+         address  portId =  channelOwner[msg_.channelId];
176174        IBCChannel memory  expectedChannel =  IBCChannel ({
177175            state: IBCChannelState.TryOpen,
178176            ordering: channel.ordering,
179177            counterpartyChannelId: msg_.channelId,
180178            connectionId: getCounterpartyConnection (channel.connectionId),
181-             portId: channel.counterpartyPortId,
182-             counterpartyPortId: channel.portId,
179+             counterpartyPortId: portId.toHexString (),
183180            version: msg_.counterpartyVersion
184181        });
185182        if  (
@@ -197,14 +194,14 @@ abstract contract IBCChannelImpl is IBCStore, IIBCChannel {
197194        channel.version =  msg_.counterpartyVersion;
198195        channel.counterpartyChannelId =  msg_.counterpartyChannelId;
199196        commitChannel (msg_.channelId, channel);
200-         IIBCModule (Hex. hexToAddress (channel. portId) ).onChanOpenAck (
197+         IIBCModule (portId).onChanOpenAck (
201198            msg_.channelId,
202199            msg_.counterpartyChannelId,
203200            msg_.counterpartyVersion,
204201            msg_.relayer
205202        );
206203        emit  IBCChannelLib.ChannelOpenAck (
207-             channel. portId,
204+             portId. toHexString () ,
208205            msg_.channelId,
209206            channel.counterpartyPortId,
210207            msg_.counterpartyChannelId,
@@ -223,13 +220,13 @@ abstract contract IBCChannelImpl is IBCStore, IIBCChannel {
223220            revert  IBCErrors.ErrInvalidChannelState ();
224221        }
225222        uint32  clientId =  ensureConnectionState (channel.connectionId);
223+         address  portId =  channelOwner[msg_.channelId];
226224        IBCChannel memory  expectedChannel =  IBCChannel ({
227225            state: IBCChannelState.Open,
228226            ordering: channel.ordering,
229227            counterpartyChannelId: msg_.channelId,
230228            connectionId: getCounterpartyConnection (channel.connectionId),
231-             portId: channel.counterpartyPortId,
232-             counterpartyPortId: channel.portId,
229+             counterpartyPortId: portId.toHexString (),
233230            version: channel.version
234231        });
235232        if  (
@@ -245,11 +242,9 @@ abstract contract IBCChannelImpl is IBCStore, IIBCChannel {
245242        }
246243        channel.state =  IBCChannelState.Open;
247244        commitChannel (msg_.channelId, channel);
248-         IIBCModule (Hex.hexToAddress (channel.portId)).onChanOpenConfirm (
249-             msg_.channelId, msg_.relayer
250-         );
245+         IIBCModule (portId).onChanOpenConfirm (msg_.channelId, msg_.relayer);
251246        emit  IBCChannelLib.ChannelOpenConfirm (
252-             channel. portId,
247+             portId. toHexString () ,
253248            msg_.channelId,
254249            channel.counterpartyPortId,
255250            channel.counterpartyChannelId,
@@ -270,11 +265,10 @@ abstract contract IBCChannelImpl is IBCStore, IIBCChannel {
270265        ensureConnectionState (channel.connectionId);
271266        channel.state =  IBCChannelState.Closed;
272267        commitChannel (msg_.channelId, channel);
273-         IIBCModule (Hex.hexToAddress (channel.portId)).onChanCloseInit (
274-             msg_.channelId, msg_.relayer
275-         );
268+         address  portId =  channelOwner[msg_.channelId];
269+         IIBCModule (portId).onChanCloseInit (msg_.channelId, msg_.relayer);
276270        emit  IBCChannelLib.ChannelCloseInit (
277-             channel. portId,
271+             portId. toHexString () ,
278272            msg_.channelId,
279273            channel.counterpartyPortId,
280274            channel.counterpartyChannelId
@@ -293,13 +287,13 @@ abstract contract IBCChannelImpl is IBCStore, IIBCChannel {
293287            revert  IBCErrors.ErrInvalidChannelState ();
294288        }
295289        uint32  clientId =  ensureConnectionState (channel.connectionId);
290+         address  portId =  channelOwner[msg_.channelId];
296291        IBCChannel memory  expectedChannel =  IBCChannel ({
297292            state: IBCChannelState.Closed,
298293            ordering: channel.ordering,
299294            counterpartyChannelId: msg_.channelId,
300295            connectionId: getCounterpartyConnection (channel.connectionId),
301-             portId: channel.counterpartyPortId,
302-             counterpartyPortId: channel.portId,
296+             counterpartyPortId: portId.toHexString (),
303297            version: channel.version
304298        });
305299        if  (
@@ -315,11 +309,9 @@ abstract contract IBCChannelImpl is IBCStore, IIBCChannel {
315309        }
316310        channel.state =  IBCChannelState.Closed;
317311        commitChannel (msg_.channelId, channel);
318-         IIBCModule (Hex.hexToAddress (channel.portId)).onChanCloseConfirm (
319-             msg_.channelId, msg_.relayer
320-         );
312+         IIBCModule (portId).onChanCloseConfirm (msg_.channelId, msg_.relayer);
321313        emit  IBCChannelLib.ChannelCloseConfirm (
322-             channel. portId,
314+             portId. toHexString () ,
323315            msg_.channelId,
324316            channel.counterpartyPortId,
325317            channel.counterpartyChannelId
0 commit comments