Skip to content

Commit

Permalink
fix: natspec and comments typos
Browse files Browse the repository at this point in the history
* chore: move l2 adapter event to the l2 adapter interface
  • Loading branch information
0xDiscotech committed Aug 1, 2024
1 parent f8423b2 commit c3146eb
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 36 deletions.
18 changes: 9 additions & 9 deletions src/contracts/L1OpUSDCBridgeAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
Expand All @@ -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();
}
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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 {
Expand All @@ -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
*/
Expand Down
2 changes: 1 addition & 1 deletion src/contracts/L1OpUSDCFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions src/contracts/L2OpUSDCBridgeAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
);
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/contracts/universal/OpUSDCBridgeAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ 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
*/
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
Expand Down
4 changes: 2 additions & 2 deletions src/interfaces/IL1OpUSDCBridgeAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ 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;

/**
* @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;
Expand Down
13 changes: 10 additions & 3 deletions src/interfaces/IL2OpUSDCBridgeAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,28 @@ 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
*/
function receiveMigrateToNative(address _roleCaller, uint32 _setBurnAmountMinGasLimit) external;

/**
* @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;
Expand All @@ -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)
Expand Down
19 changes: 6 additions & 13 deletions src/interfaces/IOpUSDCBridgeAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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
///////////////////////////////////////////////////////////////*/
Expand Down Expand Up @@ -196,15 +189,15 @@ 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
*/
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
Expand Down
2 changes: 1 addition & 1 deletion test/unit/L1OpUSDCBridgeAdapter.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c3146eb

Please sign in to comment.