Skip to content

Commit 3e53c57

Browse files
authored
chore: Add prettier check to CI (#1303)
* add prettier to ci Signed-off-by: Taylor Webb <tbwebb22@gmail.com> * format contracts Signed-off-by: Taylor Webb <tbwebb22@gmail.com> * update prettier versions Signed-off-by: Taylor Webb <tbwebb22@gmail.com> * reformat ts and js files Signed-off-by: Taylor Webb <tbwebb22@gmail.com> * trailing comma --------- Signed-off-by: Taylor Webb <tbwebb22@gmail.com>
1 parent f3310b1 commit 3e53c57

28 files changed

+161
-265
lines changed

.github/workflows/pr.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ jobs:
9696
- name: Lint solidity
9797
shell: bash
9898
run: yarn lint-solidity
99+
- name: Check Solidity formatting
100+
shell: bash
101+
run: yarn check-format-contracts
99102
- name: Lint rust
100103
shell: bash
101104
run: yarn lint-rust

.prettierrc

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
{
22
"printWidth": 120,
33
"bracketSpacing": true,
4-
"explicitTypes": "preserve",
4+
"trailingComma": "es5",
55
"tabWidth": 2,
66
"overrides": [
77
{
88
"files": "*.sol",
99
"options": {
1010
"tabWidth": 4,
1111
"useTabs": false,
12-
"singleQuote": false,
13-
"explicitTypes": "always"
12+
"singleQuote": false
1413
}
1514
},
1615
{
@@ -29,8 +28,5 @@
2928
}
3029
}
3130
],
32-
"plugins": [
33-
"prettier-plugin-rust",
34-
"prettier-plugin-solidity"
35-
]
36-
}
31+
"plugins": ["prettier-plugin-rust", "prettier-plugin-solidity"]
32+
}

contracts/chain-adapters/Arbitrum_CustomGasToken_Adapter.sol

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ import { IERC20 } from "@openzeppelin/contracts-v4/token/ERC20/IERC20.sol";
77
import { SafeERC20 } from "@openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol";
88
import { ITokenMessenger as ICCTPTokenMessenger } from "../external/interfaces/CCTPInterfaces.sol";
99
import { CircleCCTPAdapter, CircleDomainIds } from "../libraries/CircleCCTPAdapter.sol";
10-
import { ArbitrumERC20Bridge as ArbitrumL1ERC20Bridge, ArbitrumCustomGasTokenInbox as ArbitrumL1InboxLike, ArbitrumL1ERC20GatewayLike } from "../interfaces/ArbitrumBridge.sol";
10+
import {
11+
ArbitrumERC20Bridge as ArbitrumL1ERC20Bridge,
12+
ArbitrumCustomGasTokenInbox as ArbitrumL1InboxLike,
13+
ArbitrumL1ERC20GatewayLike
14+
} from "../interfaces/ArbitrumBridge.sol";
1115

1216
/**
1317
* @notice Interface for funder contract that this contract pulls from to pay for relayMessage()/relayTokens()

contracts/chain-adapters/CrossDomainEnabled.sol

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,7 @@ contract CrossDomainEnabled {
3838
* @param _message The data to send to the target (usually calldata to a function with
3939
* onlyFromCrossDomainAccount())
4040
*/
41-
function sendCrossDomainMessage(
42-
address _crossDomainTarget,
43-
uint32 _gasLimit,
44-
bytes calldata _message
45-
) internal {
41+
function sendCrossDomainMessage(address _crossDomainTarget, uint32 _gasLimit, bytes calldata _message) internal {
4642
// slither-disable-next-line reentrancy-events, reentrancy-benign
4743
getCrossDomainMessenger().sendMessage(_crossDomainTarget, _message, _gasLimit);
4844
}

contracts/chain-adapters/Router_Adapter.sol

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,7 @@ contract Router_Adapter is AdapterInterface {
9393
* @dev When sending tokens, we follow-up with a message describing the amount of tokens we wish to continue bridging.
9494
* This allows forwarders to know how much of some token to allocate to a certain target.
9595
*/
96-
function relayTokens(
97-
address l1Token,
98-
address l3Token,
99-
uint256 amount,
100-
address target
101-
) external payable override {
96+
function relayTokens(address l1Token, address l3Token, uint256 amount, address target) external payable override {
10297
// Fetch the address of the L2 token, as defined in the Hub Pool. This is to complete a proper token bridge from L1 to L2.
10398
address l2Token = HUB_POOL.poolRebalanceRoute(L2_CHAIN_ID, l1Token);
10499
// If l2Token is the zero address, then this means that the L2 token is not enabled as a pool rebalance route. This is similar

contracts/chain-adapters/Universal_Adapter.sol

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,7 @@ contract Universal_Adapter is AdapterInterface, CircleCCTPAdapter, OFTTransportA
7878
* @param amount Amount of tokens to relay.
7979
* @param to Address to receive the tokens on L2. Should be SpokePool address.
8080
*/
81-
function relayTokens(
82-
address l1Token,
83-
address l2Token,
84-
uint256 amount,
85-
address to
86-
) external payable override {
81+
function relayTokens(address l1Token, address l2Token, uint256 amount, address to) external payable override {
8782
address oftMessenger = _getOftMessenger(l1Token);
8883
if (_isCCTPEnabled() && l1Token == address(usdcToken)) {
8984
_transferUsdc(to, amount);

contracts/chain-adapters/interfaces/AdapterInterface.sol

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,5 @@ interface AdapterInterface {
3131
* @param amount Amount of `l1Token` to bridge.
3232
* @param to Bridge recipient.
3333
*/
34-
function relayTokens(
35-
address l1Token,
36-
address l2Token,
37-
uint256 amount,
38-
address to
39-
) external payable;
34+
function relayTokens(address l1Token, address l2Token, uint256 amount, address to) external payable;
4035
}

contracts/chain-adapters/interfaces/ForwarderInterface.sol

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,7 @@ interface ForwarderInterface {
3636
* @param destinationChainId Chain ID of the L3 network.
3737
* @param message Message to send to `target`.
3838
*/
39-
function relayMessage(
40-
address target,
41-
uint256 destinationChainId,
42-
bytes calldata message
43-
) external payable;
39+
function relayMessage(address target, uint256 destinationChainId, bytes calldata message) external payable;
4440

4541
/**
4642
* @notice Send `amount` of `l2Token` to `to` on L3. `l3oken` is the L3 address equivalent of `l2Token`.

contracts/chain-adapters/utilities/HubPoolStore.sol

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,7 @@ contract HubPoolStore {
5252
* @param data Data to send to Universal SpokePool.
5353
* @param isAdminSender True if the data is an admin function call, false otherwise.
5454
*/
55-
function storeRelayMessageCalldata(
56-
address target,
57-
bytes calldata data,
58-
bool isAdminSender
59-
) external onlyHubPool {
55+
function storeRelayMessageCalldata(address target, bytes calldata data, bool isAdminSender) external onlyHubPool {
6056
if (isAdminSender) {
6157
_storeData(target, dataUuid++, data);
6258
} else {
@@ -73,11 +69,7 @@ contract HubPoolStore {
7369
_storeData(address(0), IHubPool(hubPool).rootBundleProposal().challengePeriodEndTimestamp, data);
7470
}
7571

76-
function _storeData(
77-
address target,
78-
uint256 nonce,
79-
bytes calldata data
80-
) internal {
72+
function _storeData(address target, uint256 nonce, bytes calldata data) internal {
8173
if (relayMessageCallData[nonce] != bytes32(0)) {
8274
// Data is already stored, do nothing.
8375
return;

contracts/erc7683/ERC7683.sol

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,10 @@ interface IOriginSettler {
122122
/// @param order The GaslessCrossChainOrder definition
123123
/// @param originFillerData Any filler-defined data required by the settler
124124
/// @return ResolvedCrossChainOrder hydrated order data including the inputs and outputs of the order
125-
function resolveFor(GaslessCrossChainOrder calldata order, bytes calldata originFillerData)
126-
external
127-
view
128-
returns (ResolvedCrossChainOrder memory);
125+
function resolveFor(
126+
GaslessCrossChainOrder calldata order,
127+
bytes calldata originFillerData
128+
) external view returns (ResolvedCrossChainOrder memory);
129129

130130
/// @notice Resolves a specific OnchainCrossChainOrder into a generic ResolvedCrossChainOrder
131131
/// @dev Intended to improve standardized integration of various order types and settlement contracts
@@ -141,9 +141,5 @@ interface IDestinationSettler {
141141
/// @param orderId Unique order identifier for this order
142142
/// @param originData Data emitted on the origin to parameterize the fill
143143
/// @param fillerData Data provided by the filler to inform the fill or express their preferences
144-
function fill(
145-
bytes32 orderId,
146-
bytes calldata originData,
147-
bytes calldata fillerData
148-
) external;
144+
function fill(bytes32 orderId, bytes calldata originData, bytes calldata fillerData) external;
149145
}

0 commit comments

Comments
 (0)