From c3146eb00ac61495facbd954d5ed281d0bf15e97 Mon Sep 17 00:00:00 2001 From: 0xDiscotech <131301107+0xDiscotech@users.noreply.github.com> Date: Thu, 1 Aug 2024 12:45:43 -0300 Subject: [PATCH] fix: natspec and comments typos * chore: move l2 adapter event to the l2 adapter interface --- src/contracts/L1OpUSDCBridgeAdapter.sol | 18 +++++++++--------- src/contracts/L1OpUSDCFactory.sol | 2 +- src/contracts/L2OpUSDCBridgeAdapter.sol | 10 +++++----- .../universal/OpUSDCBridgeAdapter.sol | 4 ++-- src/interfaces/IL1OpUSDCBridgeAdapter.sol | 4 ++-- src/interfaces/IL2OpUSDCBridgeAdapter.sol | 13 ++++++++++--- src/interfaces/IOpUSDCBridgeAdapter.sol | 19 ++++++------------- test/unit/L1OpUSDCBridgeAdapter.t.sol | 2 +- 8 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/contracts/L1OpUSDCBridgeAdapter.sol b/src/contracts/L1OpUSDCBridgeAdapter.sol index 8dbd584a..50d05984 100644 --- a/src/contracts/L1OpUSDCBridgeAdapter.sol +++ b/src/contracts/L1OpUSDCBridgeAdapter.sol @@ -71,7 +71,7 @@ contract L1OpUSDCBridgeAdapter is IL1OpUSDCBridgeAdapter, OpUSDCBridgeAdapter { uint32 _minGasLimitReceiveOnL2, uint32 _minGasLimitSetBurnAmount ) external onlyOwner { - // Leave this flow open to resend upgrading flow incase message fails on L2 + // Leave this flow open to resend upgrading flow in case message fails on L2 // Circle's USDC implementation of `transferOwnership` reverts on address(0) if (_roleCaller == address(0) || _burnCaller == address(0)) revert IOpUSDCBridgeAdapter_InvalidAddress(); @@ -118,7 +118,7 @@ contract L1OpUSDCBridgeAdapter is IL1OpUSDCBridgeAdapter, OpUSDCBridgeAdapter { // NOTE: This is a very edge case and will only happen if the chain operator adds a second minter on L2 // So now this adapter doesnt have the full backing supply locked in this contract - // Incase the bridged usdc token has other minters and the supply sent is greater then what we have + // in case the bridged usdc token has other minters and the supply sent is greater then what we have // We need to burn the full amount stored in this contract // This could also cause in-flight messages to fail because of the multiple supply sources uint256 _burnAmount = burnAmount; @@ -147,7 +147,7 @@ contract L1OpUSDCBridgeAdapter is IL1OpUSDCBridgeAdapter, OpUSDCBridgeAdapter { */ function stopMessaging(uint32 _minGasLimit) external onlyOwner { // Ensure messaging is enabled - // If its paused we still leave this function open to be called incase the message fails on L2 + // If its paused we still leave this function open to be called in case the message fails on L2 if (messengerStatus != Status.Active && messengerStatus != Status.Paused) { revert IOpUSDCBridgeAdapter_MessagingDisabled(); } @@ -164,12 +164,12 @@ contract L1OpUSDCBridgeAdapter is IL1OpUSDCBridgeAdapter, OpUSDCBridgeAdapter { /** * @notice Resume messaging on the messenger * @dev Only callable by the owner - * @dev Cant resume deprecated or upgrading messengers + * @dev Can't resume deprecated or upgrading messengers * @param _minGasLimit Minimum gas limit that the message can be executed with */ function resumeMessaging(uint32 _minGasLimit) external onlyOwner { // Ensure messaging is disabled - // If its active we still leave this function open to be called incase the message fails on L2 + // If its active we still leave this function open to be called in case the message fails on L2 if (messengerStatus != Status.Paused && messengerStatus != Status.Active) { revert IOpUSDCBridgeAdapter_MessagingEnabled(); } @@ -188,7 +188,7 @@ contract L1OpUSDCBridgeAdapter is IL1OpUSDCBridgeAdapter, OpUSDCBridgeAdapter { ///////////////////////////////////////////////////////////////*/ /** - * @notice Send tokens to other chain through the linked adapter + * @notice Send tokens to another chain through the linked adapter * @param _to The target address on the destination chain * @param _amount The amount of tokens to send * @param _minGasLimit Minimum gas limit that the message can be executed with @@ -206,7 +206,7 @@ contract L1OpUSDCBridgeAdapter is IL1OpUSDCBridgeAdapter, OpUSDCBridgeAdapter { } /** - * @notice Send signer tokens to other chain through the linked adapter + * @notice Send signer tokens to another chain through the linked adapter * @param _signer The address of the user sending the message * @param _to The target address on the destination chain * @param _amount The amount of tokens to send @@ -270,7 +270,7 @@ contract L1OpUSDCBridgeAdapter is IL1OpUSDCBridgeAdapter, OpUSDCBridgeAdapter { /** * @notice Receives a message from L2 if the adapter is deprecated and a user is withdrawing blacklisted funds * @dev If the _spender is still blacklisted, the user will be forced to replay this message - * @param _spender The user that initialy provided the tokens + * @param _spender The user that initially provided the tokens * @param _amount The amount of tokens to withdraw */ function receiveWithdrawBlacklistedFundsPostMigration(address _spender, uint256 _amount) external onlyLinkedAdapter { @@ -283,7 +283,7 @@ contract L1OpUSDCBridgeAdapter is IL1OpUSDCBridgeAdapter, OpUSDCBridgeAdapter { } /** - * @notice Withdraws the blacklisted funds from the contract incase they get unblacklisted + * @notice Withdraws the blacklisted funds from the contract in case they get unblacklisted * @param _spender The address that provided the tokens * @param _user The user to withdraw the funds for */ diff --git a/src/contracts/L1OpUSDCFactory.sol b/src/contracts/L1OpUSDCFactory.sol index 1ec1efe4..c1298e26 100644 --- a/src/contracts/L1OpUSDCFactory.sol +++ b/src/contracts/L1OpUSDCFactory.sol @@ -82,7 +82,7 @@ contract L1OpUSDCFactory is IL1OpUSDCFactory { L2Deployments calldata _l2Deployments ) external returns (address _l1Adapter, address _l2Factory, address _l2Adapter) { // Checks that the first init tx selector is not equal to the `initialize()` function since we manually - // construct this function on the L2 factory contract + // Construct this function on the L2 factory contract if (bytes4(_l2Deployments.usdcInitTxs[0]) == _INITIALIZE_SELECTOR) revert IL1OpUSDCFactory_NoInitializeTx(); // Update the salt counter so the L2 factory is deployed with a different salt to a different address and get it diff --git a/src/contracts/L2OpUSDCBridgeAdapter.sol b/src/contracts/L2OpUSDCBridgeAdapter.sol index 14b3b64a..19e0fcb7 100644 --- a/src/contracts/L2OpUSDCBridgeAdapter.sol +++ b/src/contracts/L2OpUSDCBridgeAdapter.sol @@ -76,7 +76,7 @@ contract L2OpUSDCBridgeAdapter is IL2OpUSDCBridgeAdapter, OpUSDCBridgeAdapter { /** * @notice Initiates the process to migrate the bridged USDC to native USDC - * @dev Full migration cant finish until L1 receives the message for setting the burn amount + * @dev Full migration can't finish until L1 receives the message for setting the burn amount * @param _roleCaller The address that will be allowed to transfer the USDC roles * @param _setBurnAmountMinGasLimit Minimum gas limit that the setBurnAmount message can be executed on L1 */ @@ -142,7 +142,7 @@ contract L2OpUSDCBridgeAdapter is IL2OpUSDCBridgeAdapter, OpUSDCBridgeAdapter { ///////////////////////////////////////////////////////////////*/ /** - * @notice Send tokens to other chain through the linked adapter + * @notice Send tokens to another chain through the linked adapter * @param _to The target address on the destination chain * @param _amount The amount of tokens to send * @param _minGasLimit Minimum gas limit that the message can be executed with @@ -159,7 +159,7 @@ contract L2OpUSDCBridgeAdapter is IL2OpUSDCBridgeAdapter, OpUSDCBridgeAdapter { } /** - * @notice Send signer tokens to other chain through the linked adapter + * @notice Send signer tokens to another chain through the linked adapter * @param _signer The address of the user sending the message * @param _to The target address on the destination chain * @param _amount The amount of tokens to send @@ -212,7 +212,7 @@ contract L2OpUSDCBridgeAdapter is IL2OpUSDCBridgeAdapter, OpUSDCBridgeAdapter { function receiveMessage(address _user, address _spender, uint256 _amount) external override onlyLinkedAdapter { if (messengerStatus == Status.Deprecated) { uint32 _minGasLimit = 150_000; - // Return the funds to the spender incase the target on L2 is a contract that can´t handle the funds on L1 + // Return the funds to the spender in case the target on L2 is a contract that can´t handle the funds on L1 ICrossDomainMessenger(MESSENGER).sendMessage( LINKED_ADAPTER, abi.encodeCall(IOpUSDCBridgeAdapter.receiveMessage, (_spender, _spender, _amount)), _minGasLimit ); @@ -230,7 +230,7 @@ contract L2OpUSDCBridgeAdapter is IL2OpUSDCBridgeAdapter, OpUSDCBridgeAdapter { } /** - * @notice Mints the blacklisted funds from the contract incase they get unblacklisted + * @notice Mints the blacklisted funds from the contract in case they get unblacklisted * @dev Returns the funds to the spender through a message to L1 if the contract is deprecated * @param _spender The address that provided the tokens * @param _user The user to withdraw the funds for diff --git a/src/contracts/universal/OpUSDCBridgeAdapter.sol b/src/contracts/universal/OpUSDCBridgeAdapter.sol index 0d43446b..5e3177ce 100644 --- a/src/contracts/universal/OpUSDCBridgeAdapter.sol +++ b/src/contracts/universal/OpUSDCBridgeAdapter.sol @@ -73,7 +73,7 @@ abstract contract OpUSDCBridgeAdapter is UUPSUpgradeable, OwnableUpgradeable, EI ///////////////////////////////////////////////////////////////*/ /** - * @notice Send tokens to other chain through the linked adapter + * @notice Send tokens to another chain through the linked adapter * @param _to The target address on the destination chain * @param _amount The amount of tokens to send * @param _minGasLimit Minimum gas limit that the message can be executed with @@ -81,7 +81,7 @@ abstract contract OpUSDCBridgeAdapter is UUPSUpgradeable, OwnableUpgradeable, EI function sendMessage(address _to, uint256 _amount, uint32 _minGasLimit) external virtual; /** - * @notice Send signer tokens to other chain through the linked adapter + * @notice Send signer tokens to another chain through the linked adapter * @param _signer The address of the user sending the message * @param _to The target address on the destination chain * @param _amount The amount of tokens to send diff --git a/src/interfaces/IL1OpUSDCBridgeAdapter.sol b/src/interfaces/IL1OpUSDCBridgeAdapter.sol index 9951ce1a..a8c40745 100644 --- a/src/interfaces/IL1OpUSDCBridgeAdapter.sol +++ b/src/interfaces/IL1OpUSDCBridgeAdapter.sol @@ -60,7 +60,7 @@ interface IL1OpUSDCBridgeAdapter { /** * @notice Resume messaging on the messenger * @dev Only callable by the owner - * @dev Cant resume deprecated messengers + * @dev Can't resume deprecated messengers * @param _minGasLimit Minimum gas limit that the message can be executed with */ function resumeMessaging(uint32 _minGasLimit) external; @@ -68,7 +68,7 @@ interface IL1OpUSDCBridgeAdapter { /** * @notice Receives a message from L2 if the adapter is deprecated and a user is withdrawing blacklisted funds * @dev If the _spender is still blacklisted, the user will be forced to replay this message - * @param _spender The user that initialy provided the tokens + * @param _spender The user that initially provided the tokens * @param _amount The amount of tokens to withdraw */ function receiveWithdrawBlacklistedFundsPostMigration(address _spender, uint256 _amount) external; diff --git a/src/interfaces/IL2OpUSDCBridgeAdapter.sol b/src/interfaces/IL2OpUSDCBridgeAdapter.sol index a762f400..8475320b 100644 --- a/src/interfaces/IL2OpUSDCBridgeAdapter.sol +++ b/src/interfaces/IL2OpUSDCBridgeAdapter.sol @@ -21,13 +21,20 @@ interface IL2OpUSDCBridgeAdapter { */ event ReplayedFundsSentBackToL1(address _spender, uint256 _amount); + /** + * @notice Emitted when the blacklisted funds are sent back to L1 + * @param _spender The address that provided the tokens + * @param _amountSent The amount of tokens that were withdrawn + */ + event BlacklistedFundsSentBackToL1(address indexed _spender, uint256 _amountSent); + /*/////////////////////////////////////////////////////////////// LOGIC ///////////////////////////////////////////////////////////////*/ /** * @notice Initiates the process to migrate the bridged USDC to native USDC - * @dev Full migration cant finish until L1 receives the message for setting the burn amount + * @dev Full migration can't finish until L1 receives the message for setting the burn amount * @param _roleCaller The address that will be allowed to transfer the USDC roles * @param _setBurnAmountMinGasLimit Minimum gas limit that the setBurnAmount message can be executed on L1 */ @@ -35,7 +42,7 @@ interface IL2OpUSDCBridgeAdapter { /** * @notice Transfer the USDC roles to the new owner - * @param _owner The address to transfer ownerships to + * @param _owner The address to transfer ownership to * @dev Can only be called by the role caller set in the migration process */ function transferUSDCRoles(address _owner) external; @@ -51,7 +58,7 @@ interface IL2OpUSDCBridgeAdapter { function receiveResumeMessaging() external; /** - * @notice Call with abitrary calldata on USDC contract. + * @notice Call with arbitrary calldata on USDC contract. * @dev can't execute the following list of transactions: * • transferOwnership (0xf2fde38b) * • changeAdmin (0x8f283970) diff --git a/src/interfaces/IOpUSDCBridgeAdapter.sol b/src/interfaces/IOpUSDCBridgeAdapter.sol index 6c75f8b2..d7dc993c 100644 --- a/src/interfaces/IOpUSDCBridgeAdapter.sol +++ b/src/interfaces/IOpUSDCBridgeAdapter.sol @@ -63,11 +63,11 @@ interface IOpUSDCBridgeAdapter { ); /** - * @notice Emitted when a message as recieved + * @notice Emitted when a message as received * @param _spender The address that provided the tokens - * @param _user The user that recieved the message - * @param _amount The amount of tokens recieved - * @param _messenger The address of the messenger contract that was recieved through + * @param _user The user that received the message + * @param _amount The amount of tokens received + * @param _messenger The address of the messenger contract that was received through */ event MessageReceived(address indexed _spender, address indexed _user, uint256 _amount, address indexed _messenger); @@ -102,13 +102,6 @@ interface IOpUSDCBridgeAdapter { */ event BlacklistedFundsWithdrawn(address indexed _user, uint256 _amountWithdrawn); - /** - * @notice Emitted when the blacklisted funds are sent back to L1 - * @param _spender The address that provided the tokens - * @param _amountSent The amount of tokens that were withdrawn - */ - event BlacklistedFundsSentBackToL1(address indexed _spender, uint256 _amountSent); - /*/////////////////////////////////////////////////////////////// ERRORS ///////////////////////////////////////////////////////////////*/ @@ -196,7 +189,7 @@ interface IOpUSDCBridgeAdapter { function initialize(address _owner) external; /** - * @notice Send tokens to other chain through the linked adapter + * @notice Send tokens to another chain through the linked adapter * @param _to The target address on the destination chain * @param _amount The amount of tokens to send * @param _minGasLimit Minimum gas limit that the message can be executed with @@ -204,7 +197,7 @@ interface IOpUSDCBridgeAdapter { function sendMessage(address _to, uint256 _amount, uint32 _minGasLimit) external; /** - * @notice Send signer tokens to other chain through the linked adapter + * @notice Send signer tokens to another chain through the linked adapter * @param _signer The address of the user sending the message * @param _to The target address on the destination chain * @param _amount The amount of tokens to send diff --git a/test/unit/L1OpUSDCBridgeAdapter.t.sol b/test/unit/L1OpUSDCBridgeAdapter.t.sol index 91107c1e..ab752dac 100644 --- a/test/unit/L1OpUSDCBridgeAdapter.t.sol +++ b/test/unit/L1OpUSDCBridgeAdapter.t.sol @@ -51,7 +51,7 @@ abstract contract Base is Helpers { address internal _signerAd; uint256 internal _signerPk; - // cant fuzz this because of foundry's VM + // can't fuzz this because of foundry's VM address internal _messenger = makeAddr('messenger'); event MigratingToNative(address _messenger, address _newOwner);