Skip to content

Commit fd63123

Browse files
committed
fix(lint): resolving or suppressing all Solhint lint issues
• Add comprehensive NatSpec documentation to all contract interfaces and functions • Suppress unavoidable lint warnings with inline comments where appropriate • Fix visibility and naming convention issues across all contract files • Add missing SPDX license identifiers and pragma statements • Resolve import ordering and unused variable warnings • Update function parameter and return value documentation • Fix modifier and event documentation formatting
1 parent 0429dcb commit fd63123

File tree

260 files changed

+5131
-1571
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

260 files changed

+5131
-1571
lines changed

packages/contracts/contracts/arbitrum/AddressAliasHelper.sol

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,15 @@
2525

2626
pragma solidity ^0.7.6;
2727

28+
/**
29+
* @title Address Alias Helper Library
30+
* @author Edge & Node
31+
* @notice Utility library for converting addresses between L1 and L2 in Arbitrum
32+
*/
2833
library AddressAliasHelper {
29-
uint160 constant offset = uint160(0x1111000000000000000000000000000000001111);
34+
/// @dev Offset used for L1 to L2 address aliasing
35+
// solhint-disable-next-line const-name-snakecase
36+
uint160 internal constant offset = uint160(0x1111000000000000000000000000000000001111);
3037

3138
/// @notice Utility function that converts the address in the L1 that submitted a tx to
3239
/// the inbox to the msg.sender viewed in the L2

packages/contracts/contracts/arbitrum/IArbToken.sol

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,28 @@
2929
*/
3030
pragma solidity ^0.7.6;
3131

32+
/**
33+
* @title Arbitrum Token Interface
34+
* @author Edge & Node
35+
* @notice Interface for tokens that can be minted and burned on Arbitrum L2
36+
*/
3237
interface IArbToken {
3338
/**
3439
* @notice should increase token supply by amount, and should (probably) only be callable by the L1 bridge.
40+
* @param account Account to mint tokens to
41+
* @param amount Amount of tokens to mint
3542
*/
3643
function bridgeMint(address account, uint256 amount) external;
3744

3845
/**
3946
* @notice should decrease token supply by amount, and should (probably) only be callable by the L1 bridge.
47+
* @param account Account to burn tokens from
48+
* @param amount Amount of tokens to burn
4049
*/
4150
function bridgeBurn(address account, uint256 amount) external;
4251

4352
/**
53+
* @notice Get the L1 token address
4454
* @return address of layer 1 token
4555
*/
4656
function l1Address() external view returns (address);

packages/contracts/contracts/arbitrum/IBridge.sol

Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,24 @@
2525

2626
pragma solidity ^0.7.6;
2727

28+
// TODO: Re-enable and fix issues when publishing a new version
29+
// solhint-disable gas-indexed-events
30+
31+
/**
32+
* @title Bridge Interface
33+
* @author Edge & Node
34+
* @notice Interface for the Arbitrum Bridge contract
35+
*/
2836
interface IBridge {
37+
/**
38+
* @notice Emitted when a message is delivered to the inbox
39+
* @param messageIndex Index of the message
40+
* @param beforeInboxAcc Inbox accumulator before this message
41+
* @param inbox Address of the inbox
42+
* @param kind Type of the message
43+
* @param sender Address that sent the message
44+
* @param messageDataHash Hash of the message data
45+
*/
2946
event MessageDelivered(
3047
uint256 indexed messageIndex,
3148
bytes32 indexed beforeInboxAcc,
@@ -35,38 +52,102 @@ interface IBridge {
3552
bytes32 messageDataHash
3653
);
3754

55+
/**
56+
* @notice Emitted when a bridge call is triggered
57+
* @param outbox Address of the outbox
58+
* @param destAddr Destination address for the call
59+
* @param amount ETH amount sent with the call
60+
* @param data Calldata for the function call
61+
*/
3862
event BridgeCallTriggered(address indexed outbox, address indexed destAddr, uint256 amount, bytes data);
3963

64+
/**
65+
* @notice Emitted when an inbox is enabled or disabled
66+
* @param inbox Address of the inbox
67+
* @param enabled Whether the inbox is enabled
68+
*/
4069
event InboxToggle(address indexed inbox, bool enabled);
4170

71+
/**
72+
* @notice Emitted when an outbox is enabled or disabled
73+
* @param outbox Address of the outbox
74+
* @param enabled Whether the outbox is enabled
75+
*/
4276
event OutboxToggle(address indexed outbox, bool enabled);
4377

78+
/**
79+
* @notice Deliver a message to the inbox
80+
* @param kind Type of the message
81+
* @param sender Address that is sending the message
82+
* @param messageDataHash keccak256 hash of the message data
83+
* @return The message index
84+
*/
4485
function deliverMessageToInbox(
4586
uint8 kind,
4687
address sender,
4788
bytes32 messageDataHash
4889
) external payable returns (uint256);
4990

91+
/**
92+
* @notice Execute a call from L2 to L1
93+
* @param destAddr Contract to call
94+
* @param amount ETH value to send
95+
* @param data Calldata for the function call
96+
* @return success True if the call was successful, false otherwise
97+
* @return returnData Return data from the call
98+
*/
5099
function executeCall(
51100
address destAddr,
52101
uint256 amount,
53102
bytes calldata data
54103
) external returns (bool success, bytes memory returnData);
55104

56-
// These are only callable by the admin
105+
/**
106+
* @notice Set the address of an inbox
107+
* @param inbox Address of the inbox
108+
* @param enabled Whether to enable the inbox
109+
*/
57110
function setInbox(address inbox, bool enabled) external;
58111

112+
/**
113+
* @notice Set the address of an outbox
114+
* @param inbox Address of the outbox
115+
* @param enabled Whether to enable the outbox
116+
*/
59117
function setOutbox(address inbox, bool enabled) external;
60118

61119
// View functions
62120

121+
/**
122+
* @notice Get the active outbox address
123+
* @return The active outbox address
124+
*/
63125
function activeOutbox() external view returns (address);
64126

127+
/**
128+
* @notice Check if an address is an allowed inbox
129+
* @param inbox Address to check
130+
* @return True if the address is an allowed inbox, false otherwise
131+
*/
65132
function allowedInboxes(address inbox) external view returns (bool);
66133

134+
/**
135+
* @notice Check if an address is an allowed outbox
136+
* @param outbox Address to check
137+
* @return True if the address is an allowed outbox, false otherwise
138+
*/
67139
function allowedOutboxes(address outbox) external view returns (bool);
68140

141+
/**
142+
* @notice Get the inbox accumulator at a specific index
143+
* @param index Index to query
144+
* @return The inbox accumulator at the given index
145+
*/
69146
function inboxAccs(uint256 index) external view returns (bytes32);
70147

148+
/**
149+
* @notice Get the count of messages in the inbox
150+
* @return Number of messages in the inbox
151+
*/
71152
function messageCount() external view returns (uint256);
72153
}

packages/contracts/contracts/arbitrum/IInbox.sol

Lines changed: 81 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,32 @@
2525

2626
pragma solidity ^0.7.6;
2727

28-
import "./IBridge.sol";
29-
import "./IMessageProvider.sol";
28+
import { IBridge } from "./IBridge.sol";
29+
import { IMessageProvider } from "./IMessageProvider.sol";
3030

31+
/**
32+
* @title Inbox Interface
33+
* @author Edge & Node
34+
* @notice Interface for the Arbitrum Inbox contract
35+
*/
3136
interface IInbox is IMessageProvider {
37+
/**
38+
* @notice Send a message to L2
39+
* @param messageData Encoded data to send in the message
40+
* @return Message number returned by the inbox
41+
*/
3242
function sendL2Message(bytes calldata messageData) external returns (uint256);
3343

44+
/**
45+
* @notice Send an unsigned transaction to L2
46+
* @param maxGas Maximum gas for the L2 transaction
47+
* @param gasPriceBid Gas price bid for the L2 transaction
48+
* @param nonce Nonce for the transaction
49+
* @param destAddr Destination address on L2
50+
* @param amount Amount of ETH to send
51+
* @param data Transaction data
52+
* @return Message number returned by the inbox
53+
*/
3454
function sendUnsignedTransaction(
3555
uint256 maxGas,
3656
uint256 gasPriceBid,
@@ -40,6 +60,15 @@ interface IInbox is IMessageProvider {
4060
bytes calldata data
4161
) external returns (uint256);
4262

63+
/**
64+
* @notice Send a contract transaction to L2
65+
* @param maxGas Maximum gas for the L2 transaction
66+
* @param gasPriceBid Gas price bid for the L2 transaction
67+
* @param destAddr Destination address on L2
68+
* @param amount Amount of ETH to send
69+
* @param data Transaction data
70+
* @return Message number returned by the inbox
71+
*/
4372
function sendContractTransaction(
4473
uint256 maxGas,
4574
uint256 gasPriceBid,
@@ -48,6 +77,15 @@ interface IInbox is IMessageProvider {
4877
bytes calldata data
4978
) external returns (uint256);
5079

80+
/**
81+
* @notice Send an L1-funded unsigned transaction to L2
82+
* @param maxGas Maximum gas for the L2 transaction
83+
* @param gasPriceBid Gas price bid for the L2 transaction
84+
* @param nonce Nonce for the transaction
85+
* @param destAddr Destination address on L2
86+
* @param data Transaction data
87+
* @return Message number returned by the inbox
88+
*/
5189
function sendL1FundedUnsignedTransaction(
5290
uint256 maxGas,
5391
uint256 gasPriceBid,
@@ -56,13 +94,33 @@ interface IInbox is IMessageProvider {
5694
bytes calldata data
5795
) external payable returns (uint256);
5896

97+
/**
98+
* @notice Send an L1-funded contract transaction to L2
99+
* @param maxGas Maximum gas for the L2 transaction
100+
* @param gasPriceBid Gas price bid for the L2 transaction
101+
* @param destAddr Destination address on L2
102+
* @param data Transaction data
103+
* @return Message number returned by the inbox
104+
*/
59105
function sendL1FundedContractTransaction(
60106
uint256 maxGas,
61107
uint256 gasPriceBid,
62108
address destAddr,
63109
bytes calldata data
64110
) external payable returns (uint256);
65111

112+
/**
113+
* @notice Create a retryable ticket for an L2 transaction
114+
* @param destAddr Destination address on L2
115+
* @param arbTxCallValue Call value for the L2 transaction
116+
* @param maxSubmissionCost Maximum cost for submitting the ticket
117+
* @param submissionRefundAddress Address to refund submission cost to
118+
* @param valueRefundAddress Address to refund excess value to
119+
* @param maxGas Maximum gas for the L2 transaction
120+
* @param gasPriceBid Gas price bid for the L2 transaction
121+
* @param data Transaction data
122+
* @return Message number returned by the inbox
123+
*/
66124
function createRetryableTicket(
67125
address destAddr,
68126
uint256 arbTxCallValue,
@@ -74,15 +132,36 @@ interface IInbox is IMessageProvider {
74132
bytes calldata data
75133
) external payable returns (uint256);
76134

135+
/**
136+
* @notice Deposit ETH to L2
137+
* @param maxSubmissionCost Maximum cost for submitting the deposit
138+
* @return Message number returned by the inbox
139+
*/
77140
function depositEth(uint256 maxSubmissionCost) external payable returns (uint256);
78141

142+
/**
143+
* @notice Get the bridge contract
144+
* @return The bridge contract address
145+
*/
79146
function bridge() external view returns (IBridge);
80147

148+
/**
149+
* @notice Pause the creation of retryable tickets
150+
*/
81151
function pauseCreateRetryables() external;
82152

153+
/**
154+
* @notice Unpause the creation of retryable tickets
155+
*/
83156
function unpauseCreateRetryables() external;
84157

158+
/**
159+
* @notice Start rewriting addresses
160+
*/
85161
function startRewriteAddress() external;
86162

163+
/**
164+
* @notice Stop rewriting addresses
165+
*/
87166
function stopRewriteAddress() external;
88167
}

packages/contracts/contracts/arbitrum/IMessageProvider.sol

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,22 @@
2525

2626
pragma solidity ^0.7.6;
2727

28+
/**
29+
* @title Message Provider Interface
30+
* @author Edge & Node
31+
* @notice Interface for Arbitrum message providers
32+
*/
2833
interface IMessageProvider {
34+
/**
35+
* @notice Emitted when a message is delivered to the inbox
36+
* @param messageNum Message number
37+
* @param data Message data
38+
*/
2939
event InboxMessageDelivered(uint256 indexed messageNum, bytes data);
3040

41+
/**
42+
* @notice Emitted when a message is delivered from origin
43+
* @param messageNum Message number
44+
*/
3145
event InboxMessageDeliveredFromOrigin(uint256 indexed messageNum);
3246
}

0 commit comments

Comments
 (0)