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

Native ERC20 token for ZK Stack #1

Draft
wants to merge 35 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
672a586
Update mailbox for erc20 withdraw
IAvecilla Nov 30, 2023
371b614
Update `totalDepositedAmountPerUser` type
ilitteri Dec 1, 2023
02683d5
Update Mailbox to compile succesfully
IAvecilla Dec 1, 2023
ad2f8da
Update withdraw function in mailbox contract
IAvecilla Dec 4, 2023
9d2c86e
Add logs when ERC20 token is deployed
IAvecilla Dec 4, 2023
d14f96a
Add token address parameter to
IAvecilla Dec 6, 2023
f5f3423
Delete L1token as parameter for requestl2transaction
IAvecilla Dec 7, 2023
d193477
Update requestL2transaction to subtract funds from ERC20 contract fro…
IAvecilla Dec 7, 2023
0458d5e
Remove unnecesary deposit function
IAvecilla Dec 11, 2023
5788e28
Add amount parameter to
IAvecilla Dec 13, 2023
42345b9
Fix require on `requestL2Transaction` to be consistent with the usage…
jrchatruc Dec 14, 2023
1e14877
fix weth deploy
Dec 15, 2023
0aceef7
use console.error to avoid stdout noise
juanbono Dec 15, 2023
52a1fb8
apply fmt
Dec 15, 2023
5e6ff98
Merge pull request #2 from lambdaclass/fix_weth_deploy
jrchatruc Dec 15, 2023
f1b0498
add _amount field to contracts
Dec 15, 2023
a472df8
Merge pull request #3 from lambdaclass/add-_amount-to-contracts
jrchatruc Dec 18, 2023
667dc88
add checks and transfer in Mailbox.sol
Dec 19, 2023
725e900
use define for l1 contract address
Dec 20, 2023
74b9287
Revert changes to withdraw, make solpp read the native erc20 address …
jrchatruc Dec 21, 2023
e19c6cf
add checks, add token address
Dec 21, 2023
204bf00
Merge branch 'erc20_base_token' into erc20-transferFrom-and-checks
Dec 21, 2023
090c1a8
update names
Dec 21, 2023
f90292a
Merge pull request #5 from lambdaclass/erc20-transferFrom-and-checks
jrchatruc Dec 21, 2023
161dc4b
Call approve on init
jrchatruc Dec 22, 2023
15e6273
Updates
jrchatruc Dec 22, 2023
803a32f
Updates
jrchatruc Dec 22, 2023
f97c03a
remove console.error
juanbono Dec 22, 2023
ac793e5
Short term fee model + 1.4.1 (#159)
StanislavBreadless Jan 12, 2024
f067290
Merge main into erc20 base token (#9)
fkrause98 Jan 16, 2024
97aa845
Merge branch 'main' into erc20_base_token
jrchatruc Jan 16, 2024
7386654
Add missing parameter for l2 tx (#10)
fkrause98 Jan 18, 2024
5f2dc1f
L1Messenger Tests (#150)
neotheprogramist Jan 23, 2024
79f4c20
Merge remote-tracking branch 'upstream/dev' into erc20_base_token
jrchatruc Jan 25, 2024
f4f28c8
Fix non native tokens updated (#15)
jrchatruc Feb 14, 2024
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
11 changes: 10 additions & 1 deletion .github/workflows/l2-contracts-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ jobs:
- name: Install dependencies
run: yarn

- name: Build artifacts
- name: Build L2 artifacts
run: yarn l2 build

- name: Build L1 artifacts
run: yarn l1 build

- name: Create cache
uses: actions/cache/save@v3
with:
Expand All @@ -31,6 +34,9 @@ jobs:
l2-contracts/artifacts-zk
l2-contracts/cache-zk
l2-contracts/typechain
l1-contracts/artifacts
l1-contracts/cache
l1-contracts/typechain

lint:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -79,6 +85,9 @@ jobs:
l2-contracts/artifacts-zk
l2-contracts/cache-zk
l2-contracts/typechain
l1-contracts/artifacts
l1-contracts/cache
l1-contracts/typechain

- name: Run Era test node
uses: dutterbutter/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/system-contracts-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jobs:
- name: Use era-test-node for testing
uses: dutterbutter/[email protected]
with:
releaseTag: v0.0.1-alpha.boojum
releaseTag: v0.0.1-vm1.4.1

- name: Install dependencies
run: yarn
Expand Down
1 change: 1 addition & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ l2-contracts/node_modules

# system-contracts
system-contracts/node_modules
system-contracts/bootloader/test_infra/target
22 changes: 14 additions & 8 deletions SystemConfig.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
{
"L2_TX_MAX_GAS_LIMIT": 80000000,
"MAX_PUBDATA_PER_BATCH": 110000,
"PRIORITY_TX_MAX_PUBDATA": 99000,
"FAIR_L2_GAS_PRICE": 500000000,
"GUARANTEED_PUBDATA_BYTES": 2500,
"MAX_TRANSACTIONS_IN_BATCH": 10000,
"REQUIRED_L2_GAS_PRICE_PER_PUBDATA": 800,
"L1_GAS_PER_PUBDATA_BYTE": 17,
"BATCH_OVERHEAD_L2_GAS": 1200000,
"PRIORITY_TX_MAX_PUBDATA": 99000,
"BATCH_OVERHEAD_L1_GAS": 1000000,
"MAX_TRANSACTIONS_IN_BATCH": 1024,
"BOOTLOADER_TX_ENCODING_SPACE": 8740224,
"L1_TX_INTRINSIC_L2_GAS": 167157,
"L1_TX_INTRINSIC_PUBDATA": 88,
"L1_TX_MIN_L2_GAS_BASE": 173484,
"L1_TX_DELTA_544_ENCODING_BYTES": 1656,
"L1_TX_DELTA_FACTORY_DEPS_L2_GAS": 2473,
"L1_TX_DELTA_FACTORY_DEPS_PUBDATA": 64,
"L2_TX_INTRINSIC_GAS": 14070,
"L2_TX_INTRINSIC_PUBDATA": 0,
"MAX_NEW_FACTORY_DEPS": 32,
"REQUIRED_L2_GAS_PRICE_PER_PUBDATA": 800
"MAX_GAS_PER_TRANSACTION": 80000000,
"KECCAK_ROUND_COST_GAS": 40,
"SHA256_ROUND_COST_GAS": 7,
"ECRECOVER_COST_GAS": 7000,
"PRIORITY_TX_MINIMAL_GAS_PRICE": 500000000,
"PRIORITY_TX_MAX_GAS_PER_BATCH": 80000000,
"PRIORITY_TX_PUBDATA_PER_BATCH": 100000,
"PRIORITY_TX_BATCH_OVERHEAD_L1_GAS": 1000000
}
2 changes: 1 addition & 1 deletion docs/Overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ data from L2 and to prove that they were sent on L1 using only `l2ToL1log`. To s
this trick:

- One of the system contracts accepts an arbitrary length message and sends a fixed length message with parameters
`senderAddress == this`, `marker == true`, `key == msg.sender`, `value == keccak256(message)`.
`senderAddress == this`, `isService == true`, `key == msg.sender`, `value == keccak256(message)`.
- The contract on L1 accepts all sent messages and if the message came from this system contract it requires that the
preimage of `value` be provided.

Expand Down
108 changes: 73 additions & 35 deletions l1-contracts/contracts/bridge/L1ERC20Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,24 @@

pragma solidity 0.8.20;

import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

import "./interfaces/IL1BridgeLegacy.sol";
import "./interfaces/IL1Bridge.sol";
import "./interfaces/IL2Bridge.sol";
import "./interfaces/IL2ERC20Bridge.sol";
import {IL1BridgeLegacy} from "./interfaces/IL1BridgeLegacy.sol";
import {IL1Bridge} from "./interfaces/IL1Bridge.sol";
import {IL2Bridge} from "./interfaces/IL2Bridge.sol";
import {IL2ERC20Bridge} from "./interfaces/IL2ERC20Bridge.sol";

import "./libraries/BridgeInitializationHelper.sol";
import {BridgeInitializationHelper} from "./libraries/BridgeInitializationHelper.sol";

import "../zksync/interfaces/IZkSync.sol";
import "../common/libraries/UnsafeBytes.sol";
import "../common/libraries/L2ContractHelper.sol";
import "../common/ReentrancyGuard.sol";
import "../vendor/AddressAliasHelper.sol";
import {IZkSync} from "../zksync/interfaces/IZkSync.sol";
import {TxStatus} from "../zksync/interfaces/IMailbox.sol";
import {L2Message} from "../zksync/Storage.sol";
import {UnsafeBytes} from "../common/libraries/UnsafeBytes.sol";
import {L2ContractHelper} from "../common/libraries/L2ContractHelper.sol";
import {ReentrancyGuard} from "../common/ReentrancyGuard.sol";
import {AddressAliasHelper} from "../vendor/AddressAliasHelper.sol";

/// @author Matter Labs
/// @custom:security-contact [email protected]
Expand All @@ -27,15 +30,17 @@
using SafeERC20 for IERC20;

/// @dev zkSync smart contract that is used to operate with L2 via asynchronous L2 <-> L1 communication
IZkSync internal immutable zkSync;

Check warning on line 33 in l1-contracts/contracts/bridge/L1ERC20Bridge.sol

View workflow job for this annotation

GitHub Actions / lint

Immutable variables name are set to be in capitalized SNAKE_CASE

Check warning on line 33 in l1-contracts/contracts/bridge/L1ERC20Bridge.sol

View workflow job for this annotation

GitHub Actions / lint

Immutable variables name are set to be in capitalized SNAKE_CASE

Check warning on line 33 in l1-contracts/contracts/bridge/L1ERC20Bridge.sol

View workflow job for this annotation

GitHub Actions / lint

Immutable variables name are set to be in capitalized SNAKE_CASE

/// @dev A mapping L2 batch number => message number => flag
/// @dev Used to indicate that zkSync L2 -> L1 message was already processed
mapping(uint256 => mapping(uint256 => bool)) public isWithdrawalFinalized;
mapping(uint256 l2BatchNumber => mapping(uint256 l2ToL1MessageNumber => bool isFinalized))
public isWithdrawalFinalized;

/// @dev A mapping account => L1 token address => L2 deposit transaction hash => amount
/// @dev Used for saving the number of deposited funds, to claim them in case the deposit transaction will fail
mapping(address => mapping(address => mapping(bytes32 => uint256))) internal depositAmount;
mapping(address account => mapping(address l1Token => mapping(bytes32 depositL2TxHash => uint256 amount)))
internal depositAmount;

/// @dev The address of deployed L2 bridge counterpart
address public l2Bridge;
Expand All @@ -46,14 +51,14 @@
/// @dev The bytecode hash of the L2 token contract
bytes32 public l2TokenProxyBytecodeHash;

mapping(address => uint256) public __DEPRECATED_lastWithdrawalLimitReset;
mapping(address => uint256) private __DEPRECATED_lastWithdrawalLimitReset;

/// @dev A mapping L1 token address => the accumulated withdrawn amount during the withdrawal limit window
mapping(address => uint256) public __DEPRECATED_withdrawnAmountInWindow;
mapping(address => uint256) private __DEPRECATED_withdrawnAmountInWindow;

/// @dev The accumulated deposited amount per user.
/// @dev A mapping L1 token address => user address => the total deposited amount by the user
mapping(address => mapping(address => uint256)) public totalDepositedAmountPerUser;
mapping(address => mapping(address => uint256)) private __DEPRECATED_totalDepositedAmountPerUser;

/// @dev Contract is expected to be used as proxy implementation.
/// @dev Initialize the implementation to prevent Parity hack.
Expand All @@ -79,14 +84,21 @@
address _l2TokenBeacon,
address _governor,
uint256 _deployBridgeImplementationFee,
uint256 _deployBridgeProxyFee
uint256 _deployBridgeProxyFee,
uint256 _amount
) external payable reentrancyGuardInitializer {
bool nativeErc20 = _amount != 0;

require(_l2TokenBeacon != address(0), "nf");

Check warning on line 92 in l1-contracts/contracts/bridge/L1ERC20Bridge.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements

Check warning on line 92 in l1-contracts/contracts/bridge/L1ERC20Bridge.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements

Check warning on line 92 in l1-contracts/contracts/bridge/L1ERC20Bridge.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements
require(_governor != address(0), "nh");

Check warning on line 93 in l1-contracts/contracts/bridge/L1ERC20Bridge.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements

Check warning on line 93 in l1-contracts/contracts/bridge/L1ERC20Bridge.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements

Check warning on line 93 in l1-contracts/contracts/bridge/L1ERC20Bridge.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements
// We are expecting to see the exact three bytecodes that are needed to initialize the bridge
require(_factoryDeps.length == 3, "mk");

Check warning on line 95 in l1-contracts/contracts/bridge/L1ERC20Bridge.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements

Check warning on line 95 in l1-contracts/contracts/bridge/L1ERC20Bridge.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements

Check warning on line 95 in l1-contracts/contracts/bridge/L1ERC20Bridge.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements
// The caller miscalculated deploy transactions fees
require(msg.value == _deployBridgeImplementationFee + _deployBridgeProxyFee, "fee");
if (nativeErc20) {
require(_amount == _deployBridgeImplementationFee + _deployBridgeProxyFee, "fee");

Check warning on line 98 in l1-contracts/contracts/bridge/L1ERC20Bridge.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements

Check warning on line 98 in l1-contracts/contracts/bridge/L1ERC20Bridge.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements

Check warning on line 98 in l1-contracts/contracts/bridge/L1ERC20Bridge.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements
} else {
require(msg.value == _deployBridgeImplementationFee + _deployBridgeProxyFee, "fee");

Check warning on line 100 in l1-contracts/contracts/bridge/L1ERC20Bridge.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements

Check warning on line 100 in l1-contracts/contracts/bridge/L1ERC20Bridge.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements

Check warning on line 100 in l1-contracts/contracts/bridge/L1ERC20Bridge.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements
}
l2TokenProxyBytecodeHash = L2ContractHelper.hashL2Bytecode(_factoryDeps[2]);
l2TokenBeacon = _l2TokenBeacon;

Expand All @@ -99,7 +111,8 @@
_deployBridgeImplementationFee,
l2BridgeImplementationBytecodeHash,
"", // Empty constructor data
_factoryDeps // All factory deps are needed for L2 bridge
_factoryDeps, // All factory deps are needed for L2 bridge
_amount
);

// Prepare the proxy constructor data
Expand All @@ -120,13 +133,16 @@
l2BridgeProxyBytecodeHash,
l2BridgeProxyConstructorData,
// No factory deps are needed for L2 bridge proxy, because it is already passed in previous step
new bytes[](0)
new bytes[](0),
_amount
);
}

/// @notice Legacy deposit method with refunding the fee to the caller, use another `deposit` method instead.
/// @dev Initiates a deposit by locking funds on the contract and sending the request
/// of processing an L2 transaction where tokens would be minted
/// of processing an L2 transaction where tokens would be minted.
/// @dev If the token is bridged for the first time, the L2 token contract will be deployed. Note however, that the
/// newly-deployed token does not support any custom logic, i.e. rebase tokens' functionality is not supported.
/// @param _l2Receiver The account address that should receive funds on L2
/// @param _l1Token The L1 token address which is deposited
/// @param _amount The total amount of tokens to be bridged
Expand All @@ -139,19 +155,31 @@
address _l1Token,
uint256 _amount,
uint256 _l2TxGasLimit,
uint256 _l2TxGasPerPubdataByte
uint256 _l2TxGasPerPubdataByte,
uint256 _l2MaxFee
) external payable returns (bytes32 l2TxHash) {
l2TxHash = deposit(_l2Receiver, _l1Token, _amount, _l2TxGasLimit, _l2TxGasPerPubdataByte, address(0));
l2TxHash = deposit(
_l2Receiver,
_l1Token,
_amount,
_l2TxGasLimit,
_l2TxGasPerPubdataByte,
address(0),
_l2MaxFee
);
}

/// @notice Initiates a deposit by locking funds on the contract and sending the request
/// of processing an L2 transaction where tokens would be minted
/// @dev If the token is bridged for the first time, the L2 token contract will be deployed. Note however, that the
/// newly-deployed token does not support any custom logic, i.e. rebase tokens' functionality is not supported.
/// @param _l2Receiver The account address that should receive funds on L2
/// @param _l1Token The L1 token address which is deposited
/// @param _amount The total amount of tokens to be bridged
/// @param _l2TxGasLimit The L2 gas limit to be used in the corresponding L2 transaction
/// @param _l2TxGasPerPubdataByte The gasPerPubdataByteLimit to be used in the corresponding L2 transaction
/// @param _refundRecipient The address on L2 that will receive the refund for the transaction.
/// @param _l2MaxFee The max fee to be paid in L2.
/// @dev If the L2 deposit finalization transaction fails, the `_refundRecipient` will receive the `_l2Value`.
/// Please note, the contract may change the refund recipient's address to eliminate sending funds to addresses
/// out of control.
Expand All @@ -172,34 +200,44 @@
uint256 _amount,
uint256 _l2TxGasLimit,
uint256 _l2TxGasPerPubdataByte,
address _refundRecipient
address _refundRecipient,
uint256 _l2MaxFee
) public payable nonReentrant returns (bytes32 l2TxHash) {
require(_amount != 0, "2T"); // empty deposit amount

Check warning on line 206 in l1-contracts/contracts/bridge/L1ERC20Bridge.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements

Check warning on line 206 in l1-contracts/contracts/bridge/L1ERC20Bridge.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements

Check warning on line 206 in l1-contracts/contracts/bridge/L1ERC20Bridge.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements
uint256 amount = _depositFunds(msg.sender, IERC20(_l1Token), _amount);
require(amount == _amount, "1T"); // The token has non-standard transfer logic

Check warning on line 208 in l1-contracts/contracts/bridge/L1ERC20Bridge.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements

Check warning on line 208 in l1-contracts/contracts/bridge/L1ERC20Bridge.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements

Check warning on line 208 in l1-contracts/contracts/bridge/L1ERC20Bridge.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements

l2TxHash = _getRefundRecipientAndRequestL2Transaction(_refundRecipient, _l2MaxFee, _l2Receiver, _l1Token, _l2TxGasLimit, _l2TxGasPerPubdataByte, amount);
// Save the deposited amount to claim funds on L1 if the deposit failed on L2
depositAmount[msg.sender][_l1Token][l2TxHash] = amount;
emit DepositInitiated(l2TxHash, msg.sender, _l2Receiver, _l1Token, amount);
}

function _getRefundRecipientAndRequestL2Transaction(address _refundRecipient, uint256 _l2MaxFee, address _l2Receiver, address _l1Token, uint256 _l2TxGasLimit, uint256 _l2TxGasPerPubdataByte, uint256 amount) internal returns (bytes32) {
bytes memory l2TxCalldata = _getDepositL2Calldata(msg.sender, _l2Receiver, _l1Token, amount);
// If the refund recipient is not specified, the refund will be sent to the sender of the transaction.
// Otherwise, the refund will be sent to the specified address.
// If the recipient is a contract on L1, the address alias will be applied.
address refundRecipient = _refundRecipient;
if (_refundRecipient == address(0)) {
refundRecipient = msg.sender != tx.origin ? AddressAliasHelper.applyL1ToL2Alias(msg.sender) : msg.sender;
}
l2TxHash = zkSync.requestL2Transaction{value: msg.value}(
address refundRecipient = _getRefundRecipient(_refundRecipient);

return zkSync.requestL2Transaction{value: msg.value}(
l2Bridge,
0, // L2 msg.value
_l2MaxFee,
l2TxCalldata,
_l2TxGasLimit,
_l2TxGasPerPubdataByte,
new bytes[](0),
refundRecipient
);
}

// Save the deposited amount to claim funds on L1 if the deposit failed on L2
depositAmount[msg.sender][_l1Token][l2TxHash] = amount;

emit DepositInitiated(l2TxHash, msg.sender, _l2Receiver, _l1Token, amount);
// Refund recipient logic
function _getRefundRecipient(address _refundRecipient) internal view returns (address) {
return
_refundRecipient == address(0)
? (msg.sender != tx.origin ? AddressAliasHelper.applyL1ToL2Alias(msg.sender) : msg.sender)

Check warning on line 239 in l1-contracts/contracts/bridge/L1ERC20Bridge.sol

View workflow job for this annotation

GitHub Actions / lint

Avoid to use tx.origin

Check warning on line 239 in l1-contracts/contracts/bridge/L1ERC20Bridge.sol

View workflow job for this annotation

GitHub Actions / lint

Avoid to use tx.origin

Check warning on line 239 in l1-contracts/contracts/bridge/L1ERC20Bridge.sol

View workflow job for this annotation

GitHub Actions / lint

Avoid to use tx.origin
: _refundRecipient;
}

/// @dev Transfers tokens from the depositor address to the smart contract address
Expand Down Expand Up @@ -260,7 +298,7 @@
_merkleProof,
TxStatus.Failure
);
require(proofValid, "yn");

Check warning on line 301 in l1-contracts/contracts/bridge/L1ERC20Bridge.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements

Check warning on line 301 in l1-contracts/contracts/bridge/L1ERC20Bridge.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements

Check warning on line 301 in l1-contracts/contracts/bridge/L1ERC20Bridge.sol

View workflow job for this annotation

GitHub Actions / lint

Use Custom Errors instead of require statements

uint256 amount = depositAmount[_depositSender][_l1Token][_l2TxHash];
require(amount > 0, "y1");
Expand Down Expand Up @@ -326,7 +364,7 @@

/// @return The L2 token address that would be minted for deposit of the given L1 token
function l2TokenAddress(address _l1Token) public view returns (address) {
bytes32 constructorInputHash = keccak256(abi.encode(address(l2TokenBeacon), ""));
bytes32 constructorInputHash = keccak256(abi.encode(l2TokenBeacon, ""));
bytes32 salt = bytes32(uint256(uint160(_l1Token)));

return L2ContractHelper.computeCreate2Address(l2Bridge, salt, l2TokenProxyBytecodeHash, constructorInputHash);
Expand Down
Loading
Loading