Commit 6c5c3195 authored by elenadimitrova's avatar elenadimitrova Committed by Elena Gesheva

Disallow 0 address for l1 token when creating l2 standard token

parent 8708ef22
...@@ -30,6 +30,8 @@ contract OVM_L2StandardTokenFactory { ...@@ -30,6 +30,8 @@ contract OVM_L2StandardTokenFactory {
) )
external external
{ {
require (_l1Token != address(0), "Must provide L1 token address");
L2StandardERC20 l2Token = new L2StandardERC20( L2StandardERC20 l2Token = new L2StandardERC20(
Lib_PredeployAddresses.L2_STANDARD_BRIDGE, Lib_PredeployAddresses.L2_STANDARD_BRIDGE,
_l1Token, _l1Token,
......
...@@ -7,7 +7,6 @@ import { smoddit } from '@eth-optimism/smock' ...@@ -7,7 +7,6 @@ import { smoddit } from '@eth-optimism/smock'
import { getContractInterface } from '@eth-optimism/contracts' import { getContractInterface } from '@eth-optimism/contracts'
/* Internal Imports */ /* Internal Imports */
import { NON_NULL_BYTES32, NON_ZERO_ADDRESS } from '../../../../helpers'
import { predeploys } from '../../../../../src' import { predeploys } from '../../../../../src'
describe('OVM_L2StandardTokenFactory', () => { describe('OVM_L2StandardTokenFactory', () => {
...@@ -54,5 +53,13 @@ describe('OVM_L2StandardTokenFactory', () => { ...@@ -54,5 +53,13 @@ describe('OVM_L2StandardTokenFactory', () => {
expect(await l2Token.name()).to.equal('L2ERC20') expect(await l2Token.name()).to.equal('L2ERC20')
expect(await l2Token.symbol()).to.equal('ERC') expect(await l2Token.symbol()).to.equal('ERC')
}) })
it('should not be able to create a standard token with a 0 address for l1 token', async () => {
await expect(OVM_L2StandardTokenFactory.createStandardL2Token(
ethers.constants.AddressZero,
'L2ERC20',
'ERC'
)).to.be.revertedWith('Must provide L1 token address')
})
}) })
}) })
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment