From 231f271b364160ee4813dfdcd5c9fcf58f3b0c25 Mon Sep 17 00:00:00 2001 From: count-sum Date: Wed, 23 Oct 2024 15:43:25 +0300 Subject: [PATCH] adjusting the TestERC20 contract and tests --- Makefile | 2 - .../contracts/tokenBridge/mocks/TestERC20.sol | 6 +- contracts/deploy/11_deploy_TestERC20.ts | 8 +- e2e/src/abi/TestERC20.json | 9 +-- e2e/src/bridge-tokens.spec.ts | 74 ++++++++++++------- 5 files changed, 53 insertions(+), 46 deletions(-) diff --git a/Makefile b/Makefile index f40294b6e..264b20be9 100644 --- a/Makefile +++ b/Makefile @@ -121,7 +121,6 @@ deploy-l1-test-erc20: TEST_ERC20_NAME=TestERC20 \ TEST_ERC20_SYMBOL=TERC20 \ TEST_ERC20_INITIAL_SUPPLY=100000 \ - TEST_ERC20_MINT_RECEIVER=0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65 \ npx hardhat deploy --network zkevm_dev --tags TestERC20 deploy-l2-test-erc20: @@ -132,7 +131,6 @@ deploy-l2-test-erc20: TEST_ERC20_NAME=TestERC20 \ TEST_ERC20_SYMBOL=TERC20 \ TEST_ERC20_INITIAL_SUPPLY=100000 \ - TEST_ERC20_MINT_RECEIVER=0xe00cad48944330a60bbaedfbf2e0ac97e9762a1e \ npx hardhat deploy --network zkevm_dev --tags TestERC20 upgrade-linea-rollup-on-uat: diff --git a/contracts/contracts/tokenBridge/mocks/TestERC20.sol b/contracts/contracts/tokenBridge/mocks/TestERC20.sol index 845190499..5e764284f 100644 --- a/contracts/contracts/tokenBridge/mocks/TestERC20.sol +++ b/contracts/contracts/tokenBridge/mocks/TestERC20.sol @@ -15,8 +15,8 @@ contract TestERC20 is ERC20, Ownable { * @dev Constructor that gives msg.sender all of existing tokens. */ - constructor(string memory _name, string memory _symbol, uint256 _initialSupply, address _mintReceiver) ERC20(_name, _symbol) { - _mint(_mintReceiver, _initialSupply); + constructor(string memory _name, string memory _symbol, uint256 _initialSupply) ERC20(_name, _symbol) { + _mint(msg.sender, _initialSupply); } /** @@ -25,7 +25,7 @@ contract TestERC20 is ERC20, Ownable { * @param _amount The amount of tokens to mint. */ - function mint(address _to, uint256 _amount) public onlyOwner { + function mint(address _to, uint256 _amount) public { _mint(_to, _amount); } diff --git a/contracts/deploy/11_deploy_TestERC20.ts b/contracts/deploy/11_deploy_TestERC20.ts index c17b4bf1d..d644f4c2d 100644 --- a/contracts/deploy/11_deploy_TestERC20.ts +++ b/contracts/deploy/11_deploy_TestERC20.ts @@ -19,7 +19,6 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const tokenName = getRequiredEnvVar("TEST_ERC20_NAME"); const tokenSymbol = getRequiredEnvVar("TEST_ERC20_SYMBOL"); const initialSupply = getRequiredEnvVar("TEST_ERC20_INITIAL_SUPPLY"); - const mintReceiver = getRequiredEnvVar("TEST_ERC20_MINT_RECEIVER"); if (!existingContractAddress) { console.log(`Deploying initial version, NB: the address will be saved if env SAVE_ADDRESS=true.`); @@ -28,12 +27,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { } const TestERC20Factory = await ethers.getContractFactory(contractName); - const contract = await TestERC20Factory.deploy( - tokenName, - tokenSymbol, - ethers.parseEther(initialSupply), - mintReceiver, - ); + const contract = await TestERC20Factory.deploy(tokenName, tokenSymbol, ethers.parseEther(initialSupply)); await contract.waitForDeployment(); const contractAddress = await contract.getAddress(); diff --git a/e2e/src/abi/TestERC20.json b/e2e/src/abi/TestERC20.json index 57f08b57d..3b9196191 100644 --- a/e2e/src/abi/TestERC20.json +++ b/e2e/src/abi/TestERC20.json @@ -19,11 +19,6 @@ "internalType": "uint256", "name": "_initialSupply", "type": "uint256" - }, - { - "internalType": "address", - "name": "_mintReceiver", - "type": "address" } ], "stateMutability": "nonpayable", @@ -383,8 +378,8 @@ "type": "function" } ], - "bytecode": "0x60806040523480156200001157600080fd5b50604051620014fc380380620014fc83398101604081905262000034916200026c565b838360036200004483826200038f565b5060046200005382826200038f565b505050620000706200006a6200008660201b60201c565b6200008a565b6200007c8183620000dc565b5050505062000483565b3390565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038216620001375760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640160405180910390fd5b80600260008282546200014b91906200045b565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b505050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620001cf57600080fd5b81516001600160401b0380821115620001ec57620001ec620001a7565b604051601f8301601f19908116603f01168101908282118183101715620002175762000217620001a7565b816040528381526020925086838588010111156200023457600080fd5b600091505b8382101562000258578582018301518183018401529082019062000239565b600093810190920192909252949350505050565b600080600080608085870312156200028357600080fd5b84516001600160401b03808211156200029b57600080fd5b620002a988838901620001bd565b95506020870151915080821115620002c057600080fd5b50620002cf87828801620001bd565b60408701516060880151919550935090506001600160a01b0381168114620002f657600080fd5b939692955090935050565b600181811c908216806200031657607f821691505b6020821081036200033757634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620001a257600081815260208120601f850160051c81016020861015620003665750805b601f850160051c820191505b81811015620003875782815560010162000372565b505050505050565b81516001600160401b03811115620003ab57620003ab620001a7565b620003c381620003bc845462000301565b846200033d565b602080601f831160018114620003fb5760008415620003e25750858301515b600019600386901b1c1916600185901b17855562000387565b600085815260208120601f198616915b828110156200042c578886015182559484019460019091019084016200040b565b50858210156200044b5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b808201808211156200047d57634e487b7160e01b600052601160045260246000fd5b92915050565b61106980620004936000396000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c806370a0823111610097578063a457c2d711610066578063a457c2d714610223578063a9059cbb14610236578063dd62ed3e14610249578063f2fde38b1461028f57600080fd5b806370a08231146101b5578063715018a6146101eb5780638da5cb5b146101f357806395d89b411461021b57600080fd5b8063313ce567116100d3578063313ce5671461016b578063395093511461017a57806340c10f191461018d57806342966c68146101a257600080fd5b806306fdde0314610105578063095ea7b31461012357806318160ddd1461014657806323b872dd14610158575b600080fd5b61010d6102a2565b60405161011a9190610e3d565b60405180910390f35b610136610131366004610ed2565b610334565b604051901515815260200161011a565b6002545b60405190815260200161011a565b610136610166366004610efc565b61034e565b6040516012815260200161011a565b610136610188366004610ed2565b610372565b6101a061019b366004610ed2565b6103be565b005b6101a06101b0366004610f38565b6103d4565b61014a6101c3366004610f51565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6101a06103e1565b60055460405173ffffffffffffffffffffffffffffffffffffffff909116815260200161011a565b61010d6103f5565b610136610231366004610ed2565b610404565b610136610244366004610ed2565b6104da565b61014a610257366004610f73565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b6101a061029d366004610f51565b6104e8565b6060600380546102b190610fa6565b80601f01602080910402602001604051908101604052809291908181526020018280546102dd90610fa6565b801561032a5780601f106102ff5761010080835404028352916020019161032a565b820191906000526020600020905b81548152906001019060200180831161030d57829003601f168201915b5050505050905090565b60003361034281858561059c565b60019150505b92915050565b60003361035c858285610750565b610367858585610827565b506001949350505050565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919061034290829086906103b9908790610ff9565b61059c565b6103c6610a96565b6103d08282610b17565b5050565b6103de3382610c0a565b50565b6103e9610a96565b6103f36000610dc6565b565b6060600480546102b190610fa6565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168452909152812054909190838110156104cd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610367828686840361059c565b600033610342818585610827565b6104f0610a96565b73ffffffffffffffffffffffffffffffffffffffff8116610593576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016104c4565b6103de81610dc6565b73ffffffffffffffffffffffffffffffffffffffff831661063e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016104c4565b73ffffffffffffffffffffffffffffffffffffffff82166106e1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f737300000000000000000000000000000000000000000000000000000000000060648201526084016104c4565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146108215781811015610814576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016104c4565b610821848484840361059c565b50505050565b73ffffffffffffffffffffffffffffffffffffffff83166108ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016104c4565b73ffffffffffffffffffffffffffffffffffffffff821661096d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016104c4565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205481811015610a23576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e6365000000000000000000000000000000000000000000000000000060648201526084016104c4565b73ffffffffffffffffffffffffffffffffffffffff848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610821565b60055473ffffffffffffffffffffffffffffffffffffffff1633146103f3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016104c4565b73ffffffffffffffffffffffffffffffffffffffff8216610b94576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016104c4565b8060026000828254610ba69190610ff9565b909155505073ffffffffffffffffffffffffffffffffffffffff8216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff8216610cad576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016104c4565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090205481811015610d63576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f636500000000000000000000000000000000000000000000000000000000000060648201526084016104c4565b73ffffffffffffffffffffffffffffffffffffffff83166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610743565b6005805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600060208083528351808285015260005b81811015610e6a57858101830151858201604001528201610e4e565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b803573ffffffffffffffffffffffffffffffffffffffff81168114610ecd57600080fd5b919050565b60008060408385031215610ee557600080fd5b610eee83610ea9565b946020939093013593505050565b600080600060608486031215610f1157600080fd5b610f1a84610ea9565b9250610f2860208501610ea9565b9150604084013590509250925092565b600060208284031215610f4a57600080fd5b5035919050565b600060208284031215610f6357600080fd5b610f6c82610ea9565b9392505050565b60008060408385031215610f8657600080fd5b610f8f83610ea9565b9150610f9d60208401610ea9565b90509250929050565b600181811c90821680610fba57607f821691505b602082108103610ff3577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b80820180821115610348577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea2646970667358221220efbe912a1b0db9bb6c705621976ddb080bc73eee2ab7f03090100ef1ded0996664736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101005760003560e01c806370a0823111610097578063a457c2d711610066578063a457c2d714610223578063a9059cbb14610236578063dd62ed3e14610249578063f2fde38b1461028f57600080fd5b806370a08231146101b5578063715018a6146101eb5780638da5cb5b146101f357806395d89b411461021b57600080fd5b8063313ce567116100d3578063313ce5671461016b578063395093511461017a57806340c10f191461018d57806342966c68146101a257600080fd5b806306fdde0314610105578063095ea7b31461012357806318160ddd1461014657806323b872dd14610158575b600080fd5b61010d6102a2565b60405161011a9190610e3d565b60405180910390f35b610136610131366004610ed2565b610334565b604051901515815260200161011a565b6002545b60405190815260200161011a565b610136610166366004610efc565b61034e565b6040516012815260200161011a565b610136610188366004610ed2565b610372565b6101a061019b366004610ed2565b6103be565b005b6101a06101b0366004610f38565b6103d4565b61014a6101c3366004610f51565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6101a06103e1565b60055460405173ffffffffffffffffffffffffffffffffffffffff909116815260200161011a565b61010d6103f5565b610136610231366004610ed2565b610404565b610136610244366004610ed2565b6104da565b61014a610257366004610f73565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b6101a061029d366004610f51565b6104e8565b6060600380546102b190610fa6565b80601f01602080910402602001604051908101604052809291908181526020018280546102dd90610fa6565b801561032a5780601f106102ff5761010080835404028352916020019161032a565b820191906000526020600020905b81548152906001019060200180831161030d57829003601f168201915b5050505050905090565b60003361034281858561059c565b60019150505b92915050565b60003361035c858285610750565b610367858585610827565b506001949350505050565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919061034290829086906103b9908790610ff9565b61059c565b6103c6610a96565b6103d08282610b17565b5050565b6103de3382610c0a565b50565b6103e9610a96565b6103f36000610dc6565b565b6060600480546102b190610fa6565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168452909152812054909190838110156104cd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610367828686840361059c565b600033610342818585610827565b6104f0610a96565b73ffffffffffffffffffffffffffffffffffffffff8116610593576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016104c4565b6103de81610dc6565b73ffffffffffffffffffffffffffffffffffffffff831661063e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016104c4565b73ffffffffffffffffffffffffffffffffffffffff82166106e1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f737300000000000000000000000000000000000000000000000000000000000060648201526084016104c4565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146108215781811015610814576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016104c4565b610821848484840361059c565b50505050565b73ffffffffffffffffffffffffffffffffffffffff83166108ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016104c4565b73ffffffffffffffffffffffffffffffffffffffff821661096d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016104c4565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205481811015610a23576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e6365000000000000000000000000000000000000000000000000000060648201526084016104c4565b73ffffffffffffffffffffffffffffffffffffffff848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610821565b60055473ffffffffffffffffffffffffffffffffffffffff1633146103f3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016104c4565b73ffffffffffffffffffffffffffffffffffffffff8216610b94576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016104c4565b8060026000828254610ba69190610ff9565b909155505073ffffffffffffffffffffffffffffffffffffffff8216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff8216610cad576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016104c4565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090205481811015610d63576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f636500000000000000000000000000000000000000000000000000000000000060648201526084016104c4565b73ffffffffffffffffffffffffffffffffffffffff83166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610743565b6005805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600060208083528351808285015260005b81811015610e6a57858101830151858201604001528201610e4e565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b803573ffffffffffffffffffffffffffffffffffffffff81168114610ecd57600080fd5b919050565b60008060408385031215610ee557600080fd5b610eee83610ea9565b946020939093013593505050565b600080600060608486031215610f1157600080fd5b610f1a84610ea9565b9250610f2860208501610ea9565b9150604084013590509250925092565b600060208284031215610f4a57600080fd5b5035919050565b600060208284031215610f6357600080fd5b610f6c82610ea9565b9392505050565b60008060408385031215610f8657600080fd5b610f8f83610ea9565b9150610f9d60208401610ea9565b90509250929050565b600181811c90821680610fba57607f821691505b602082108103610ff3577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b80820180821115610348577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea2646970667358221220efbe912a1b0db9bb6c705621976ddb080bc73eee2ab7f03090100ef1ded0996664736f6c63430008130033", + "bytecode": "0x60806040523480156200001157600080fd5b50604051620014d1380380620014d183398101604081905262000034916200026b565b828260036200004483826200036c565b5060046200005382826200036c565b505050620000706200006a6200008560201b60201c565b62000089565b6200007c3382620000db565b50505062000460565b3390565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038216620001365760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640160405180910390fd5b80600260008282546200014a919062000438565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b505050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620001ce57600080fd5b81516001600160401b0380821115620001eb57620001eb620001a6565b604051601f8301601f19908116603f01168101908282118183101715620002165762000216620001a6565b816040528381526020925086838588010111156200023357600080fd5b600091505b8382101562000257578582018301518183018401529082019062000238565b600093810190920192909252949350505050565b6000806000606084860312156200028157600080fd5b83516001600160401b03808211156200029957600080fd5b620002a787838801620001bc565b94506020860151915080821115620002be57600080fd5b50620002cd86828701620001bc565b925050604084015190509250925092565b600181811c90821680620002f357607f821691505b6020821081036200031457634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620001a157600081815260208120601f850160051c81016020861015620003435750805b601f850160051c820191505b8181101562000364578281556001016200034f565b505050505050565b81516001600160401b03811115620003885762000388620001a6565b620003a081620003998454620002de565b846200031a565b602080601f831160018114620003d85760008415620003bf5750858301515b600019600386901b1c1916600185901b17855562000364565b600085815260208120601f198616915b828110156200040957888601518255948401946001909101908401620003e8565b5085821015620004285787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b808201808211156200045a57634e487b7160e01b600052601160045260246000fd5b92915050565b61106180620004706000396000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c806370a0823111610097578063a457c2d711610066578063a457c2d714610223578063a9059cbb14610236578063dd62ed3e14610249578063f2fde38b1461028f57600080fd5b806370a08231146101b5578063715018a6146101eb5780638da5cb5b146101f357806395d89b411461021b57600080fd5b8063313ce567116100d3578063313ce5671461016b578063395093511461017a57806340c10f191461018d57806342966c68146101a257600080fd5b806306fdde0314610105578063095ea7b31461012357806318160ddd1461014657806323b872dd14610158575b600080fd5b61010d6102a2565b60405161011a9190610e35565b60405180910390f35b610136610131366004610eca565b610334565b604051901515815260200161011a565b6002545b60405190815260200161011a565b610136610166366004610ef4565b61034e565b6040516012815260200161011a565b610136610188366004610eca565b610372565b6101a061019b366004610eca565b6103be565b005b6101a06101b0366004610f30565b6103cc565b61014a6101c3366004610f49565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6101a06103d9565b60055460405173ffffffffffffffffffffffffffffffffffffffff909116815260200161011a565b61010d6103ed565b610136610231366004610eca565b6103fc565b610136610244366004610eca565b6104d2565b61014a610257366004610f6b565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b6101a061029d366004610f49565b6104e0565b6060600380546102b190610f9e565b80601f01602080910402602001604051908101604052809291908181526020018280546102dd90610f9e565b801561032a5780601f106102ff5761010080835404028352916020019161032a565b820191906000526020600020905b81548152906001019060200180831161030d57829003601f168201915b5050505050905090565b600033610342818585610594565b60019150505b92915050565b60003361035c858285610748565b61036785858561081f565b506001949350505050565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919061034290829086906103b9908790610ff1565b610594565b6103c88282610a8e565b5050565b6103d63382610b81565b50565b6103e1610d3d565b6103eb6000610dbe565b565b6060600480546102b190610f9e565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168452909152812054909190838110156104c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6103678286868403610594565b60003361034281858561081f565b6104e8610d3d565b73ffffffffffffffffffffffffffffffffffffffff811661058b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016104bc565b6103d681610dbe565b73ffffffffffffffffffffffffffffffffffffffff8316610636576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016104bc565b73ffffffffffffffffffffffffffffffffffffffff82166106d9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f737300000000000000000000000000000000000000000000000000000000000060648201526084016104bc565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610819578181101561080c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016104bc565b6108198484848403610594565b50505050565b73ffffffffffffffffffffffffffffffffffffffff83166108c2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016104bc565b73ffffffffffffffffffffffffffffffffffffffff8216610965576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016104bc565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205481811015610a1b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e6365000000000000000000000000000000000000000000000000000060648201526084016104bc565b73ffffffffffffffffffffffffffffffffffffffff848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610819565b73ffffffffffffffffffffffffffffffffffffffff8216610b0b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016104bc565b8060026000828254610b1d9190610ff1565b909155505073ffffffffffffffffffffffffffffffffffffffff8216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff8216610c24576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016104bc565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090205481811015610cda576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f636500000000000000000000000000000000000000000000000000000000000060648201526084016104bc565b73ffffffffffffffffffffffffffffffffffffffff83166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910161073b565b60055473ffffffffffffffffffffffffffffffffffffffff1633146103eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016104bc565b6005805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600060208083528351808285015260005b81811015610e6257858101830151858201604001528201610e46565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b803573ffffffffffffffffffffffffffffffffffffffff81168114610ec557600080fd5b919050565b60008060408385031215610edd57600080fd5b610ee683610ea1565b946020939093013593505050565b600080600060608486031215610f0957600080fd5b610f1284610ea1565b9250610f2060208501610ea1565b9150604084013590509250925092565b600060208284031215610f4257600080fd5b5035919050565b600060208284031215610f5b57600080fd5b610f6482610ea1565b9392505050565b60008060408385031215610f7e57600080fd5b610f8783610ea1565b9150610f9560208401610ea1565b90509250929050565b600181811c90821680610fb257607f821691505b602082108103610feb577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b80820180821115610348577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea26469706673582212204492a857249c95f2aaf7020dbd1bd99ac26cde6c4bc5ec1a51caa0e6462b02e864736f6c63430008130033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101005760003560e01c806370a0823111610097578063a457c2d711610066578063a457c2d714610223578063a9059cbb14610236578063dd62ed3e14610249578063f2fde38b1461028f57600080fd5b806370a08231146101b5578063715018a6146101eb5780638da5cb5b146101f357806395d89b411461021b57600080fd5b8063313ce567116100d3578063313ce5671461016b578063395093511461017a57806340c10f191461018d57806342966c68146101a257600080fd5b806306fdde0314610105578063095ea7b31461012357806318160ddd1461014657806323b872dd14610158575b600080fd5b61010d6102a2565b60405161011a9190610e35565b60405180910390f35b610136610131366004610eca565b610334565b604051901515815260200161011a565b6002545b60405190815260200161011a565b610136610166366004610ef4565b61034e565b6040516012815260200161011a565b610136610188366004610eca565b610372565b6101a061019b366004610eca565b6103be565b005b6101a06101b0366004610f30565b6103cc565b61014a6101c3366004610f49565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6101a06103d9565b60055460405173ffffffffffffffffffffffffffffffffffffffff909116815260200161011a565b61010d6103ed565b610136610231366004610eca565b6103fc565b610136610244366004610eca565b6104d2565b61014a610257366004610f6b565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b6101a061029d366004610f49565b6104e0565b6060600380546102b190610f9e565b80601f01602080910402602001604051908101604052809291908181526020018280546102dd90610f9e565b801561032a5780601f106102ff5761010080835404028352916020019161032a565b820191906000526020600020905b81548152906001019060200180831161030d57829003601f168201915b5050505050905090565b600033610342818585610594565b60019150505b92915050565b60003361035c858285610748565b61036785858561081f565b506001949350505050565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919061034290829086906103b9908790610ff1565b610594565b6103c88282610a8e565b5050565b6103d63382610b81565b50565b6103e1610d3d565b6103eb6000610dbe565b565b6060600480546102b190610f9e565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168452909152812054909190838110156104c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6103678286868403610594565b60003361034281858561081f565b6104e8610d3d565b73ffffffffffffffffffffffffffffffffffffffff811661058b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016104bc565b6103d681610dbe565b73ffffffffffffffffffffffffffffffffffffffff8316610636576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016104bc565b73ffffffffffffffffffffffffffffffffffffffff82166106d9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f737300000000000000000000000000000000000000000000000000000000000060648201526084016104bc565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610819578181101561080c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016104bc565b6108198484848403610594565b50505050565b73ffffffffffffffffffffffffffffffffffffffff83166108c2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016104bc565b73ffffffffffffffffffffffffffffffffffffffff8216610965576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016104bc565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205481811015610a1b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e6365000000000000000000000000000000000000000000000000000060648201526084016104bc565b73ffffffffffffffffffffffffffffffffffffffff848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610819565b73ffffffffffffffffffffffffffffffffffffffff8216610b0b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016104bc565b8060026000828254610b1d9190610ff1565b909155505073ffffffffffffffffffffffffffffffffffffffff8216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff8216610c24576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016104bc565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090205481811015610cda576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f636500000000000000000000000000000000000000000000000000000000000060648201526084016104bc565b73ffffffffffffffffffffffffffffffffffffffff83166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910161073b565b60055473ffffffffffffffffffffffffffffffffffffffff1633146103eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016104bc565b6005805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600060208083528351808285015260005b81811015610e6257858101830151858201604001528201610e46565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b803573ffffffffffffffffffffffffffffffffffffffff81168114610ec557600080fd5b919050565b60008060408385031215610edd57600080fd5b610ee683610ea1565b946020939093013593505050565b600080600060608486031215610f0957600080fd5b610f1284610ea1565b9250610f2060208501610ea1565b9150604084013590509250925092565b600060208284031215610f4257600080fd5b5035919050565b600060208284031215610f5b57600080fd5b610f6482610ea1565b9392505050565b60008060408385031215610f7e57600080fd5b610f8783610ea1565b9150610f9560208401610ea1565b90509250929050565b600181811c90821680610fb257607f821691505b602082108103610feb577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b80820180821115610348577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea26469706673582212204492a857249c95f2aaf7020dbd1bd99ac26cde6c4bc5ec1a51caa0e6462b02e864736f6c63430008130033", "linkReferences": {}, "deployedLinkReferences": {} } diff --git a/e2e/src/bridge-tokens.spec.ts b/e2e/src/bridge-tokens.spec.ts index f8ea0461f..b83cacb24 100644 --- a/e2e/src/bridge-tokens.spec.ts +++ b/e2e/src/bridge-tokens.spec.ts @@ -5,32 +5,42 @@ import { waitForEvents, etherToWei } from "./common/utils"; const l1AccountManager = config.getL1AccountManager(); const l2AccountManager = config.getL2AccountManager(); -const tokenTotalSuppy = ethers.parseEther("100000"); const bridgeAmount = ethers.parseEther("100"); describe("Bridge ERC20 Tokens L1 -> L2 and L2 -> L1", () => { it.concurrent("Bridge a token from L1 to L2", async () => { const [l1Account, l2Account] = await Promise.all([ - l1AccountManager.whaleAccount(4), - l2AccountManager.whaleAccount(4), + l1AccountManager.generateAccount(), + l2AccountManager.generateAccount(), ]); - const [lineaRollup, l2MessageService, l1TokenBridge, l2TokenBridge, l1Token] = await Promise.all([ - config.getLineaRollupContract(), - config.getL2MessageServiceContract(), - config.getL1TokenBridgeContract(), - config.getL2TokenBridgeContract(), - config.getL1TokenContract(), - ]); + const lineaRollup = config.getLineaRollupContract(); + const l2MessageService = config.getL2MessageServiceContract(); + const l1TokenBridge = config.getL1TokenBridgeContract(); + const l2TokenBridge = config.getL2TokenBridgeContract(); + const l1Token = config.getL1TokenContract(); + const l1Provider = config.getL1Provider(); - console.log("Approving tokens to L1 TokenBridge"); + console.log("Minting ERC20 tokens to L1 Account"); - const l1Provider = config.getL1Provider(); let { maxPriorityFeePerGas: l1MaxPriorityFeePerGas, maxFeePerGas: l1MaxFeePerGas } = await l1Provider.getFeeData(); - let nonce = await l1Provider.getTransactionCount(l1Account.address, "pending"); - const approveTx = await l1Token.connect(l1Account).approve(l1TokenBridge.getAddress(), ethers.parseEther("100"), { + const mintTx = await l1Token.connect(l1Account).mint(l1Account.address, bridgeAmount, { + nonce: nonce, + maxPriorityFeePerGas: l1MaxPriorityFeePerGas, + maxFeePerGas: l1MaxFeePerGas, + }); + + await mintTx.wait(); + + console.log("Approving tokens to L1 TokenBridge"); + + ({ maxPriorityFeePerGas: l1MaxPriorityFeePerGas, maxFeePerGas: l1MaxFeePerGas } = await l1Provider.getFeeData()); + + nonce = await l1Provider.getTransactionCount(l1Account.address, "pending"); + + const approveTx = await l1Token.connect(l1Account).approve(l1TokenBridge.getAddress(), bridgeAmount, { maxPriorityFeePerGas: l1MaxPriorityFeePerGas, maxFeePerGas: l1MaxFeePerGas, nonce: nonce, @@ -67,7 +77,7 @@ describe("Bridge ERC20 Tokens L1 -> L2 and L2 -> L1", () => { const l1TokenBalance = await l1Token.balanceOf(l1Account.address); console.log("Token balance of L1 account :", l1TokenBalance.toString()); - expect(l1TokenBalance).toEqual(tokenTotalSuppy - ethers.parseEther("100")); + expect(l1TokenBalance).toEqual(0n); console.log("Waiting for MessageSent event on L1."); @@ -123,25 +133,35 @@ describe("Bridge ERC20 Tokens L1 -> L2 and L2 -> L1", () => { it.concurrent("Bridge a token from L2 to L1", async () => { const [l1Account, l2Account] = await Promise.all([ - l1AccountManager.whaleAccount(5), - l2AccountManager.whaleAccount(5), + l1AccountManager.generateAccount(), + l2AccountManager.generateAccount(), ]); - const lineaRollup = config.getLineaRollupContract(l1Account); - const l2MessageService = config.getL2MessageServiceContract(l2Account); + const lineaRollup = config.getLineaRollupContract(); + const l2MessageService = config.getL2MessageServiceContract(); + const l1TokenBridge = config.getL1TokenBridgeContract(); + const l2TokenBridge = config.getL2TokenBridgeContract(); + const l2Token = config.getL2TokenContract(); + const l2Provider = config.getL2Provider(); + + console.log("Minting ERC20 tokens to L2 Account"); - const l1TokenBridge = config.getL1TokenBridgeContract(l1Account); - const l2TokenBridge = config.getL2TokenBridgeContract(l2Account); + let { maxPriorityFeePerGas: l2MaxPriorityFeePerGas, maxFeePerGas: l2MaxFeePerGas } = await l2Provider.getFeeData(); + let nonce = await l2Provider.getTransactionCount(l2Account.address, "pending"); + + const mintTx = await l2Token.connect(l2Account).mint(l2Account.address, bridgeAmount, { + nonce: nonce, + maxPriorityFeePerGas: l2MaxPriorityFeePerGas, + maxFeePerGas: l2MaxFeePerGas, + }); - const l2Token = config.getL2TokenContract(l2Account); + await mintTx.wait(); console.log("Approving tokens to L2 TokenBridge"); - const l2Provider = config.getL2Provider(); - const { maxPriorityFeePerGas: l2MaxPriorityFeePerGas, maxFeePerGas: l2MaxFeePerGas } = - await l2Provider.getFeeData(); + ({ maxPriorityFeePerGas: l2MaxPriorityFeePerGas, maxFeePerGas: l2MaxFeePerGas } = await l2Provider.getFeeData()); - let nonce = await l2Provider.getTransactionCount(l2Account.address, "pending"); + nonce = await l2Provider.getTransactionCount(l2Account.address, "pending"); const approveTx = await l2Token.connect(l2Account).approve(l2TokenBridge.getAddress(), ethers.parseEther("100"), { maxPriorityFeePerGas: l2MaxPriorityFeePerGas, @@ -154,7 +174,7 @@ describe("Bridge ERC20 Tokens L1 -> L2 and L2 -> L1", () => { console.log("Current allowance of L2 account to L2 TokenBridge is :", allowanceL2Account.toString()); console.log("Current balance of L2 account is :", await l2Token.balanceOf(l2Account)); - console.log("Calling the bridgeToken function on the L1 TokenBridge contract"); + console.log("Calling the bridgeToken function on the L2 TokenBridge contract"); nonce = await l2Provider.getTransactionCount(l2Account.address, "pending");