Skip to content

Commit 9e01eae

Browse files
committed
forge fmt
1 parent 6fa2b6c commit 9e01eae

19 files changed

+168
-93
lines changed

contracts/evm/Registry.sol

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,14 @@ contract Registry is BaseRegistry, IRegistry {
176176
/// @param chainId The ID of the chain where the contract is deployed
177177
/// @param contractType The type of the contract
178178
/// @param active Whether the contract should be active
179-
function setContractActive(uint256 chainId, string calldata contractType, bool active) external onlyRegistry {
179+
function setContractActive(
180+
uint256 chainId,
181+
string calldata contractType,
182+
bool active
183+
)
184+
external
185+
onlyRegistry
186+
{
180187
_setContractActive(chainId, contractType, active);
181188
emit ContractStatusChanged(_contracts[chainId][contractType].addressBytes);
182189
}

contracts/evm/interfaces/IGatewayEVM.sol

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,13 @@ interface IGatewayEVM is IGatewayEVMErrors, IGatewayEVMEvents {
183183
/// @param amount Amount of tokens to deposit.
184184
/// @param asset Address of the ERC20 token.
185185
/// @param revertOptions Revert options.
186-
function deposit(address receiver, uint256 amount, address asset, RevertOptions calldata revertOptions) external;
186+
function deposit(
187+
address receiver,
188+
uint256 amount,
189+
address asset,
190+
RevertOptions calldata revertOptions
191+
)
192+
external;
187193

188194
/// @notice Deposits ETH to the TSS address and calls an omnichain smart contract.
189195
/// @param receiver Address of the receiver.
@@ -227,5 +233,11 @@ struct MessageContext {
227233

228234
/// @notice Interface implemented by contracts receiving authenticated calls.
229235
interface Callable {
230-
function onCall(MessageContext calldata context, bytes calldata message) external payable returns (bytes memory);
236+
function onCall(
237+
MessageContext calldata context,
238+
bytes calldata message
239+
)
240+
external
241+
payable
242+
returns (bytes memory);
231243
}

contracts/evm/legacy/ZetaConnector.base.sol

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,7 @@ contract ZetaConnectorBase is ConnectorErrors, Pausable {
174174
bytes32 internalSendHash
175175
)
176176
external
177-
virtual
178-
{ }
177+
virtual { }
179178

180179
/**
181180
* @dev Handler to receive errors from other chain.
@@ -191,6 +190,5 @@ contract ZetaConnectorBase is ConnectorErrors, Pausable {
191190
bytes32 internalSendHash
192191
)
193192
external
194-
virtual
195-
{ }
193+
virtual { }
196194
}

contracts/evm/legacy/ZetaConnector.eth.sol

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,12 @@ contract ZetaConnectorEth is ZetaConnectorBase {
6868
if (!success) revert ZetaTransferError();
6969

7070
if (message.length > 0) {
71-
ZetaReceiver(destinationAddress).onZetaMessage(
72-
ZetaInterfaces.ZetaMessage(zetaTxSenderAddress, sourceChainId, destinationAddress, zetaValue, message)
73-
);
71+
ZetaReceiver(destinationAddress)
72+
.onZetaMessage(
73+
ZetaInterfaces.ZetaMessage(
74+
zetaTxSenderAddress, sourceChainId, destinationAddress, zetaValue, message
75+
)
76+
);
7477
}
7578

7679
emit ZetaReceived(zetaTxSenderAddress, sourceChainId, destinationAddress, zetaValue, message, internalSendHash);
@@ -99,16 +102,17 @@ contract ZetaConnectorEth is ZetaConnectorBase {
99102
if (!success) revert ZetaTransferError();
100103

101104
if (message.length > 0) {
102-
ZetaReceiver(zetaTxSenderAddress).onZetaRevert(
103-
ZetaInterfaces.ZetaRevert(
104-
zetaTxSenderAddress,
105-
sourceChainId,
106-
destinationAddress,
107-
destinationChainId,
108-
remainingZetaValue,
109-
message
110-
)
111-
);
105+
ZetaReceiver(zetaTxSenderAddress)
106+
.onZetaRevert(
107+
ZetaInterfaces.ZetaRevert(
108+
zetaTxSenderAddress,
109+
sourceChainId,
110+
destinationAddress,
111+
destinationChainId,
112+
remainingZetaValue,
113+
message
114+
)
115+
);
112116
}
113117

114118
emit ZetaReverted(

contracts/evm/legacy/ZetaConnector.non-eth.sol

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,12 @@ contract ZetaConnectorNonEth is ZetaConnectorBase {
7777
IZetaNonEthInterface(zetaToken).mint(destinationAddress, zetaValue, internalSendHash);
7878

7979
if (message.length > 0) {
80-
ZetaReceiver(destinationAddress).onZetaMessage(
81-
ZetaInterfaces.ZetaMessage(zetaTxSenderAddress, sourceChainId, destinationAddress, zetaValue, message)
82-
);
80+
ZetaReceiver(destinationAddress)
81+
.onZetaMessage(
82+
ZetaInterfaces.ZetaMessage(
83+
zetaTxSenderAddress, sourceChainId, destinationAddress, zetaValue, message
84+
)
85+
);
8386
}
8487

8588
emit ZetaReceived(zetaTxSenderAddress, sourceChainId, destinationAddress, zetaValue, message, internalSendHash);
@@ -111,16 +114,17 @@ contract ZetaConnectorNonEth is ZetaConnectorBase {
111114
IZetaNonEthInterface(zetaToken).mint(zetaTxSenderAddress, remainingZetaValue, internalSendHash);
112115

113116
if (message.length > 0) {
114-
ZetaReceiver(zetaTxSenderAddress).onZetaRevert(
115-
ZetaInterfaces.ZetaRevert(
116-
zetaTxSenderAddress,
117-
sourceChainId,
118-
destinationAddress,
119-
destinationChainId,
120-
remainingZetaValue,
121-
message
122-
)
123-
);
117+
ZetaReceiver(zetaTxSenderAddress)
118+
.onZetaRevert(
119+
ZetaInterfaces.ZetaRevert(
120+
zetaTxSenderAddress,
121+
sourceChainId,
122+
destinationAddress,
123+
destinationChainId,
124+
remainingZetaValue,
125+
message
126+
)
127+
);
124128
}
125129

126130
emit ZetaReverted(

contracts/helpers/BaseRegistry.sol

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,14 @@ abstract contract BaseRegistry is
101101
/// @param gasZRC20 The address of the ZRC20 token that represents gas token for the chain.
102102
/// @param registry Address of the Registry contract on the connected chain.
103103
/// @param activation Whether activate or deactivate the chain
104-
function _changeChainStatus(uint256 chainId, address gasZRC20, bytes calldata registry, bool activation) internal {
104+
function _changeChainStatus(
105+
uint256 chainId,
106+
address gasZRC20,
107+
bytes calldata registry,
108+
bool activation
109+
)
110+
internal
111+
{
105112
// In the case chain is already activated
106113
if (_chains[chainId].active && activation) revert ChainActive(chainId);
107114
// In the case chain is inactive
@@ -140,7 +147,13 @@ abstract contract BaseRegistry is
140147
/// @param chainId The ID of the chain where the contract is deployed.
141148
/// @param contractType The type of the contract (e.g., "connector", "gateway").
142149
/// @param addressBytes The bytes representation of the non-EVM address.
143-
function _registerContract(uint256 chainId, string calldata contractType, bytes calldata addressBytes) internal {
150+
function _registerContract(
151+
uint256 chainId,
152+
string calldata contractType,
153+
bytes calldata addressBytes
154+
)
155+
internal
156+
{
144157
// Validate inputs
145158
if (!_chains[chainId].active) revert ChainNonActive(chainId);
146159
if (bytes(contractType).length == 0) revert InvalidContractType(contractType);

contracts/helpers/interfaces/IBaseRegistry.sol

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,13 @@ interface IBaseRegistry is IBaseRegistryErrors, IBaseRegistryEvents {
193193
/// @param chainId The ID of the chain to activate.
194194
/// @param gasZRC20 The address of the ZRC20 token that represents gas token for the chain.
195195
/// @param activation Whether activate or deactivate a chain
196-
function changeChainStatus(uint256 chainId, address gasZRC20, bytes calldata registry, bool activation) external;
196+
function changeChainStatus(
197+
uint256 chainId,
198+
address gasZRC20,
199+
bytes calldata registry,
200+
bool activation
201+
)
202+
external;
197203

198204
/// @notice Updates chain metadata.
199205
/// @param chainId The ID of the chain.
@@ -209,7 +215,12 @@ interface IBaseRegistry is IBaseRegistryErrors, IBaseRegistryEvents {
209215
/// @param chainId The ID of the chain where the contract is deployed.
210216
/// @param contractType The type of the contract (e.g., "connector", "gateway").
211217
/// @param addressBytes The bytes representation of the non-EVM address.
212-
function registerContract(uint256 chainId, string calldata contractType, bytes calldata addressBytes) external;
218+
function registerContract(
219+
uint256 chainId,
220+
string calldata contractType,
221+
bytes calldata addressBytes
222+
)
223+
external;
213224

214225
/// @notice Updates contract configuration.
215226
/// @param chainId The ID of the chain where the contract is deployed.

contracts/zevm/CoreRegistry.sol

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,13 @@ contract CoreRegistry is BaseRegistry {
259259
/// @param chainId The ID of the chain where the contract is deployed
260260
/// @notice contractType The type of the contract
261261
/// @notice active Whether the contract should be active
262-
function _broadcastContractStatusUpdate(uint256 chainId, string calldata contractType, bool active) private {
262+
function _broadcastContractStatusUpdate(
263+
uint256 chainId,
264+
string calldata contractType,
265+
bool active
266+
)
267+
private
268+
{
263269
// Encode the function call for the Registry contract on the target chain
264270
bytes memory message =
265271
abi.encodeWithSignature("setContractActive(uint256,string,bool)", chainId, contractType, active);

contracts/zevm/GatewayZEVM.sol

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,14 @@ contract GatewayZEVM is
107107
/// @param zrc20 The address of the ZRC20 token.
108108
/// @param gasLimit Gas limit.
109109
/// @return The gas fee for the withdrawal.
110-
function _withdrawZRC20WithGasLimit(uint256 amount, address zrc20, uint256 gasLimit) private returns (uint256) {
110+
function _withdrawZRC20WithGasLimit(
111+
uint256 amount,
112+
address zrc20,
113+
uint256 gasLimit
114+
)
115+
private
116+
returns (uint256)
117+
{
111118
(address gasZRC20, uint256 gasFee) = IZRC20(zrc20).withdrawGasFeeWithGasLimit(gasLimit);
112119
if (!IZRC20(gasZRC20).transferFrom(msg.sender, PROTOCOL_ADDRESS, gasFee)) {
113120
revert GasFeeTransferFailed();

contracts/zevm/legacy/ZetaConnectorZEVM.sol

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,9 @@ contract ZetaConnectorZEVM {
137137
*/
138138
function send(ZetaInterfaces.SendInput calldata input) external {
139139
// Transfer wzeta to "fungible" module, which will be burnt by the protocol post processing via hooks.
140-
if (!IWETH9(wzeta).transferFrom(msg.sender, address(this), input.zetaValueAndGas)) revert WZETATransferFailed();
140+
if (!IWETH9(wzeta).transferFrom(msg.sender, address(this), input.zetaValueAndGas)) {
141+
revert WZETATransferFailed();
142+
}
141143
IWETH9(wzeta).withdraw(input.zetaValueAndGas);
142144
(bool sent,) = FUNGIBLE_MODULE_ADDRESS.call{ value: input.zetaValueAndGas }("");
143145
if (!sent) revert FailedZetaSent();
@@ -176,9 +178,12 @@ contract ZetaConnectorZEVM {
176178
if (!IWETH9(wzeta).transferFrom(address(this), destinationAddress, zetaValue)) revert WZETATransferFailed();
177179

178180
if (message.length > 0) {
179-
ZetaReceiver(destinationAddress).onZetaMessage(
180-
ZetaInterfaces.ZetaMessage(zetaTxSenderAddress, sourceChainId, destinationAddress, zetaValue, message)
181-
);
181+
ZetaReceiver(destinationAddress)
182+
.onZetaMessage(
183+
ZetaInterfaces.ZetaMessage(
184+
zetaTxSenderAddress, sourceChainId, destinationAddress, zetaValue, message
185+
)
186+
);
182187
}
183188

184189
emit ZetaReceived(zetaTxSenderAddress, sourceChainId, destinationAddress, zetaValue, message, internalSendHash);
@@ -209,16 +214,17 @@ contract ZetaConnectorZEVM {
209214
}
210215

211216
if (message.length > 0) {
212-
ZetaReceiver(zetaTxSenderAddress).onZetaRevert(
213-
ZetaInterfaces.ZetaRevert(
214-
zetaTxSenderAddress,
215-
sourceChainId,
216-
destinationAddress,
217-
destinationChainId,
218-
remainingZetaValue,
219-
message
220-
)
221-
);
217+
ZetaReceiver(zetaTxSenderAddress)
218+
.onZetaRevert(
219+
ZetaInterfaces.ZetaRevert(
220+
zetaTxSenderAddress,
221+
sourceChainId,
222+
destinationAddress,
223+
destinationChainId,
224+
remainingZetaValue,
225+
message
226+
)
227+
);
222228
}
223229

224230
emit ZetaReverted(

0 commit comments

Comments
 (0)