Skip to content

Commit 4b41fec

Browse files
committed
Reorder variable, events and errors declarations in AxelarGatewayBase
1 parent dcebe28 commit 4b41fec

File tree

2 files changed

+15
-19
lines changed

2 files changed

+15
-19
lines changed

contracts/crosschain/axelar/AxelarGatewayBase.sol

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,17 @@ import {InteroperableAddress} from "@openzeppelin/contracts/utils/draft-Interope
1616
abstract contract AxelarGatewayBase is Ownable {
1717
using InteroperableAddress for bytes;
1818

19+
/// @dev Axelar's official gateway for the current chain.
20+
IAxelarGateway internal immutable _axelarGateway;
21+
22+
// Remote gateway.
23+
// `addr` is the isolated address part of ERC-7930. Its not a full ERC-7930 interoperable address.
24+
mapping(bytes2 chainType => mapping(bytes chainReference => bytes addr)) private _remoteGateways;
25+
26+
// chain equivalence ERC-7930 (no address) <> Axelar
27+
mapping(bytes erc7930 => string axelar) private _erc7930ToAxelar;
28+
mapping(string axelar => bytes erc7930) private _axelarToErc7930;
29+
1930
/// @dev A remote gateway has been registered for a chain.
2031
event RegisteredRemoteGateway(bytes remote);
2132

@@ -29,17 +40,6 @@ abstract contract AxelarGatewayBase is Ownable {
2940
error ChainEquivalenceAlreadyRegistered(bytes erc7930binary, string axelar);
3041
error RemoteGatewayAlreadyRegistered(bytes2 chainType, bytes chainReference);
3142

32-
/// @dev Axelar's official gateway for the current chain.
33-
IAxelarGateway internal immutable _axelarGateway;
34-
35-
// Remote gateway.
36-
// `addr` is the isolated address part of ERC-7930. Its not a full ERC-7930 interoperable address.
37-
mapping(bytes2 chainType => mapping(bytes chainReference => bytes addr)) private _remoteGateways;
38-
39-
// chain equivalence ERC-7930 (no address) <> Axelar
40-
mapping(bytes erc7930 => string axelar) private _erc7930ToAxelar;
41-
mapping(string axelar => bytes erc7930) private _axelarToErc7930;
42-
4343
/// @dev Sets the local gateway address (i.e. Axelar's official gateway for the current chain).
4444
constructor(IAxelarGateway _gateway) {
4545
_axelarGateway = _gateway;

contracts/crosschain/axelar/AxelarGatewayDestination.sol

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import {AxelarGatewayBase} from "./AxelarGatewayBase.sol";
1515
* workflow into the standard ERC-7786.
1616
*/
1717
abstract contract AxelarGatewayDestination is AxelarGatewayBase, AxelarExecutable {
18-
using Strings for *;
1918
using InteroperableAddress for bytes;
19+
using Strings for *;
2020

2121
error InvalidOriginGateway(string axelarSourceChain, string axelarSourceAddress);
2222
error ReceiverExecutionFailed();
@@ -43,6 +43,7 @@ abstract contract AxelarGatewayDestination is AxelarGatewayBase, AxelarExecutabl
4343
adapterPayload,
4444
(bytes, bytes, bytes, bytes[])
4545
);
46+
4647
// Axelar to ERC-7930 translation
4748
bytes memory addr = getRemoteGateway(getErc7930Chain(axelarSourceChain));
4849

@@ -53,13 +54,8 @@ abstract contract AxelarGatewayDestination is AxelarGatewayBase, AxelarExecutabl
5354
InvalidOriginGateway(axelarSourceChain, axelarSourceAddress)
5455
);
5556

56-
(, , bytes memory target) = recipient.parseV1();
57-
bytes4 result = IERC7786Receiver(address(bytes20(target))).executeMessage(
58-
commandId,
59-
sender,
60-
payload,
61-
attributes
62-
);
57+
(, address target) = recipient.parseEvmV1();
58+
bytes4 result = IERC7786Receiver(target).executeMessage(commandId, sender, payload, attributes);
6359
require(result == IERC7786Receiver.executeMessage.selector, ReceiverExecutionFailed());
6460
}
6561
}

0 commit comments

Comments
 (0)