Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Macro Q2 audit finding #16

Merged
merged 2 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified bun.lockb
Binary file not shown.
18 changes: 4 additions & 14 deletions src/L2XERC20Gateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -125,40 +125,30 @@ contract L2XERC20Gateway is XERC20BaseGateway, L2CustomGateway {

/**
* @notice Mint on L2 upon L1 deposit.
* If token not yet deployed and symbol/name/decimal data is included, deploys StandardArbERC20
* @dev Callable only by the L1ERC20Gateway.outboundTransfer method. For initial deployments of a token the L1
* L1ERC20Gateway
* is expected to include the deployData. If not a L1 withdrawal is automatically triggered for the user
* @dev Callable only by the L1ERC20Gateway.outboundTransfer method. If L2Token is not yet deployed a L1 withdrawal
* is automatically triggered for the user.
* @param _token L1 address of ERC20
* @param _from account that initiated the deposit in the L1
* @param _to account to be credited with the tokens in the L2 (can be the user's L2 account or a contract)
* @param _amount token amount to be minted to the user
* @param _data encoded symbol/name/decimal data for deploy, in addition to any additional callhook data
*/
function finalizeInboundTransfer(
address _token,
address _from,
address _to,
uint256 _amount,
bytes calldata _data
bytes calldata
)
external
payable
virtual
override
onlyCounterpartGateway
{
(bytes memory gatewayData, bytes memory callHookData) = GatewayMessageHandler.parseFromL1GatewayMsg(_data);

if (callHookData.length != 0) {
// callHookData should always be 0 since inboundEscrowAndCall is disabled
callHookData = bytes("");
}

address expectedAddress = calculateL2TokenAddress(_token);

if (!expectedAddress.isContract()) {
bool shouldHalt = handleNoContract(_token, expectedAddress, _from, _to, _amount, gatewayData);
bool shouldHalt = handleNoContract(_token, expectedAddress, _from, _to, _amount, bytes(""));
if (shouldHalt) return;
}
// ignores gatewayData if token already deployed
Expand Down