Commit 204ca2be authored by elenadimitrova's avatar elenadimitrova Committed by Kelvin Fichter

Rename OVM_L2StandardBridge to L2StandardBridge

parent c627cc85
...@@ -105,14 +105,14 @@ export const getL1Bridge = async (wallet: Wallet, AddressManager: Contract) => { ...@@ -105,14 +105,14 @@ export const getL1Bridge = async (wallet: Wallet, AddressManager: Contract) => {
} }
export const getL2Bridge = async (wallet: Wallet) => { export const getL2Bridge = async (wallet: Wallet) => {
const L2BridgeInterface = getContractInterface('OVM_L2StandardBridge') const L2BridgeInterface = getContractInterface('L2StandardBridge')
const OVM_L2StandardBridge = new Contract( const L2StandardBridge = new Contract(
predeploys.OVM_L2StandardBridge, predeploys.L2StandardBridge,
L2BridgeInterface, L2BridgeInterface,
wallet wallet
) )
return OVM_L2StandardBridge return L2StandardBridge
} }
export const getOvmEth = (wallet: Wallet) => { export const getOvmEth = (wallet: Wallet) => {
......
...@@ -16,7 +16,7 @@ import { Lib_PredeployAddresses } from "../../libraries/constants/Lib_PredeployA ...@@ -16,7 +16,7 @@ import { Lib_PredeployAddresses } from "../../libraries/constants/Lib_PredeployA
import { IL2StandardERC20 } from "../../libraries/standards/IL2StandardERC20.sol"; import { IL2StandardERC20 } from "../../libraries/standards/IL2StandardERC20.sol";
/** /**
* @title OVM_L2StandardBridge * @title L2StandardBridge
* @dev The L2 Standard bridge is a contract which works together with the L1 Standard bridge to * @dev The L2 Standard bridge is a contract which works together with the L1 Standard bridge to
* enable ETH and ERC20 transitions between L1 and L2. * enable ETH and ERC20 transitions between L1 and L2.
* This contract acts as a minter for new tokens when it hears about deposits into the L1 Standard * This contract acts as a minter for new tokens when it hears about deposits into the L1 Standard
...@@ -26,7 +26,7 @@ import { IL2StandardERC20 } from "../../libraries/standards/IL2StandardERC20.sol ...@@ -26,7 +26,7 @@ import { IL2StandardERC20 } from "../../libraries/standards/IL2StandardERC20.sol
* *
* Runtime target: OVM * Runtime target: OVM
*/ */
contract OVM_L2StandardBridge is IL2ERC20Bridge, OVM_CrossDomainEnabled { contract L2StandardBridge is IL2ERC20Bridge, OVM_CrossDomainEnabled {
/******************************** /********************************
* External Contract References * * External Contract References *
......
...@@ -5,7 +5,7 @@ pragma solidity >0.5.0 <0.8.0; ...@@ -5,7 +5,7 @@ pragma solidity >0.5.0 <0.8.0;
import { Lib_PredeployAddresses } from "../../libraries/constants/Lib_PredeployAddresses.sol"; import { Lib_PredeployAddresses } from "../../libraries/constants/Lib_PredeployAddresses.sol";
/* Contract Imports */ /* Contract Imports */
import { OVM_L2StandardBridge } from "../messaging/OVM_L2StandardBridge.sol"; import { L2StandardBridge } from "../messaging/L2StandardBridge.sol";
/** /**
* @title OVM_SequencerFeeVault * @title OVM_SequencerFeeVault
...@@ -68,7 +68,7 @@ contract OVM_SequencerFeeVault { ...@@ -68,7 +68,7 @@ contract OVM_SequencerFeeVault {
"OVM_SequencerFeeVault: withdrawal amount must be greater than minimum withdrawal amount" "OVM_SequencerFeeVault: withdrawal amount must be greater than minimum withdrawal amount"
); );
OVM_L2StandardBridge(Lib_PredeployAddresses.L2_STANDARD_BRIDGE).withdrawTo( L2StandardBridge(Lib_PredeployAddresses.L2_STANDARD_BRIDGE).withdrawTo(
Lib_PredeployAddresses.OVM_ETH, Lib_PredeployAddresses.OVM_ETH,
l1FeeWallet, l1FeeWallet,
address(this).balance, address(this).balance,
......
...@@ -77,13 +77,13 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -77,13 +77,13 @@ const deployFn: DeployFunction = async (hre) => {
// Set Slot 1 to the L2 Standard Bridge Address // Set Slot 1 to the L2 Standard Bridge Address
await Proxy__WithChugSplashInterface.setStorage( await Proxy__WithChugSplashInterface.setStorage(
hre.ethers.utils.hexZeroPad('0x01', 32), hre.ethers.utils.hexZeroPad('0x01', 32),
hre.ethers.utils.hexZeroPad(predeploys.OVM_L2StandardBridge, 32) hre.ethers.utils.hexZeroPad(predeploys.L2StandardBridge, 32)
) )
// Verify that the slot was set correctly // Verify that the slot was set correctly
const l2TokenBridgeStored = const l2TokenBridgeStored =
await Proxy__WithBridgeInterface.callStatic.l2TokenBridge() await Proxy__WithBridgeInterface.callStatic.l2TokenBridge()
console.log('l2TokenBridgeStored:', l2TokenBridgeStored) console.log('l2TokenBridgeStored:', l2TokenBridgeStored)
if (l2TokenBridgeStored !== predeploys.OVM_L2StandardBridge) { if (l2TokenBridgeStored !== predeploys.L2StandardBridge) {
throw new Error( throw new Error(
'L2 bridge address was not correctly set, check the key value used in setStorage' 'L2 bridge address was not correctly set, check the key value used in setStorage'
) )
......
...@@ -54,7 +54,7 @@ export const makeL2GenesisFile = async ( ...@@ -54,7 +54,7 @@ export const makeL2GenesisFile = async (
_owner: cfg.gasPriceOracleOwner, _owner: cfg.gasPriceOracleOwner,
gasPrice: cfg.initialGasPrice, gasPrice: cfg.initialGasPrice,
}, },
OVM_L2StandardBridge: { L2StandardBridge: {
l1TokenBridge: cfg.l1StandardBridgeAddress, l1TokenBridge: cfg.l1StandardBridgeAddress,
messenger: predeploys.L2CrossDomainMessenger, messenger: predeploys.L2CrossDomainMessenger,
}, },
...@@ -62,7 +62,7 @@ export const makeL2GenesisFile = async ( ...@@ -62,7 +62,7 @@ export const makeL2GenesisFile = async (
l1FeeWallet: cfg.l1FeeWalletAddress, l1FeeWallet: cfg.l1FeeWalletAddress,
}, },
OVM_ETH: { OVM_ETH: {
l2Bridge: predeploys.OVM_L2StandardBridge, l2Bridge: predeploys.L2StandardBridge,
_name: 'Ether', _name: 'Ether',
_symbol: 'ETH', _symbol: 'ETH',
_decimals: 18, _decimals: 18,
......
...@@ -13,7 +13,7 @@ export const predeploys = { ...@@ -13,7 +13,7 @@ export const predeploys = {
OVM_DeployerWhitelist: '0x4200000000000000000000000000000000000002', OVM_DeployerWhitelist: '0x4200000000000000000000000000000000000002',
L2CrossDomainMessenger: '0x4200000000000000000000000000000000000007', L2CrossDomainMessenger: '0x4200000000000000000000000000000000000007',
OVM_GasPriceOracle: '0x420000000000000000000000000000000000000F', OVM_GasPriceOracle: '0x420000000000000000000000000000000000000F',
OVM_L2StandardBridge: '0x4200000000000000000000000000000000000010', L2StandardBridge: '0x4200000000000000000000000000000000000010',
OVM_SequencerFeeVault: '0x4200000000000000000000000000000000000011', OVM_SequencerFeeVault: '0x4200000000000000000000000000000000000011',
OVM_L2StandardTokenFactory: '0x4200000000000000000000000000000000000012', OVM_L2StandardTokenFactory: '0x4200000000000000000000000000000000000012',
OVM_L1BlockNumber: '0x4200000000000000000000000000000000000013', OVM_L1BlockNumber: '0x4200000000000000000000000000000000000013',
......
...@@ -24,7 +24,7 @@ const DUMMY_L1BRIDGE_ADDRESS: string = ...@@ -24,7 +24,7 @@ const DUMMY_L1BRIDGE_ADDRESS: string =
const DUMMY_L1TOKEN_ADDRESS: string = const DUMMY_L1TOKEN_ADDRESS: string =
'0x2234223412342234223422342234223422342234' '0x2234223412342234223422342234223422342234'
describe('OVM_L2StandardBridge', () => { describe('L2StandardBridge', () => {
let alice: Signer let alice: Signer
let aliceAddress: string let aliceAddress: string
let bob: Signer let bob: Signer
...@@ -47,7 +47,7 @@ describe('OVM_L2StandardBridge', () => { ...@@ -47,7 +47,7 @@ describe('OVM_L2StandardBridge', () => {
IL2ERC20Bridge = getContractInterface('IL2ERC20Bridge') IL2ERC20Bridge = getContractInterface('IL2ERC20Bridge')
}) })
let OVM_L2StandardBridge: Contract let L2StandardBridge: Contract
let L2ERC20: Contract let L2ERC20: Contract
let Mock__L2CrossDomainMessenger: MockContract let Mock__L2CrossDomainMessenger: MockContract
beforeEach(async () => { beforeEach(async () => {
...@@ -59,15 +59,15 @@ describe('OVM_L2StandardBridge', () => { ...@@ -59,15 +59,15 @@ describe('OVM_L2StandardBridge', () => {
) )
// Deploy the contract under test // Deploy the contract under test
OVM_L2StandardBridge = await ( L2StandardBridge = await (
await ethers.getContractFactory('OVM_L2StandardBridge') await ethers.getContractFactory('L2StandardBridge')
).deploy(Mock__L2CrossDomainMessenger.address, DUMMY_L1BRIDGE_ADDRESS) ).deploy(Mock__L2CrossDomainMessenger.address, DUMMY_L1BRIDGE_ADDRESS)
// Deploy an L2 ERC20 // Deploy an L2 ERC20
L2ERC20 = await ( L2ERC20 = await (
await ethers.getContractFactory('L2StandardERC20', alice) await ethers.getContractFactory('L2StandardERC20', alice)
).deploy( ).deploy(
OVM_L2StandardBridge.address, L2StandardBridge.address,
DUMMY_L1TOKEN_ADDRESS, DUMMY_L1TOKEN_ADDRESS,
'L2Token', 'L2Token',
'L2T' 'L2T'
...@@ -78,7 +78,7 @@ describe('OVM_L2StandardBridge', () => { ...@@ -78,7 +78,7 @@ describe('OVM_L2StandardBridge', () => {
describe('finalizeDeposit', () => { describe('finalizeDeposit', () => {
it('onlyFromCrossDomainAccount: should revert on calls from a non-crossDomainMessenger L2 account', async () => { it('onlyFromCrossDomainAccount: should revert on calls from a non-crossDomainMessenger L2 account', async () => {
await expect( await expect(
OVM_L2StandardBridge.finalizeDeposit( L2StandardBridge.finalizeDeposit(
DUMMY_L1TOKEN_ADDRESS, DUMMY_L1TOKEN_ADDRESS,
NON_ZERO_ADDRESS, NON_ZERO_ADDRESS,
NON_ZERO_ADDRESS, NON_ZERO_ADDRESS,
...@@ -95,7 +95,7 @@ describe('OVM_L2StandardBridge', () => { ...@@ -95,7 +95,7 @@ describe('OVM_L2StandardBridge', () => {
) )
await expect( await expect(
OVM_L2StandardBridge.connect(l2MessengerImpersonator).finalizeDeposit( L2StandardBridge.connect(l2MessengerImpersonator).finalizeDeposit(
DUMMY_L1TOKEN_ADDRESS, DUMMY_L1TOKEN_ADDRESS,
NON_ZERO_ADDRESS, NON_ZERO_ADDRESS,
NON_ZERO_ADDRESS, NON_ZERO_ADDRESS,
...@@ -117,7 +117,7 @@ describe('OVM_L2StandardBridge', () => { ...@@ -117,7 +117,7 @@ describe('OVM_L2StandardBridge', () => {
) )
).deploy('L2Token', 'L2T') ).deploy('L2Token', 'L2T')
OVM_L2StandardBridge.connect(l2MessengerImpersonator).finalizeDeposit( L2StandardBridge.connect(l2MessengerImpersonator).finalizeDeposit(
DUMMY_L1TOKEN_ADDRESS, DUMMY_L1TOKEN_ADDRESS,
NON_ZERO_ADDRESS, NON_ZERO_ADDRESS,
NON_ZERO_ADDRESS, NON_ZERO_ADDRESS,
...@@ -133,7 +133,7 @@ describe('OVM_L2StandardBridge', () => { ...@@ -133,7 +133,7 @@ describe('OVM_L2StandardBridge', () => {
() => DUMMY_L1BRIDGE_ADDRESS () => DUMMY_L1BRIDGE_ADDRESS
) )
await OVM_L2StandardBridge.connect( await L2StandardBridge.connect(
l2MessengerImpersonator l2MessengerImpersonator
).finalizeDeposit( ).finalizeDeposit(
DUMMY_L1TOKEN_ADDRESS, DUMMY_L1TOKEN_ADDRESS,
...@@ -173,7 +173,7 @@ describe('OVM_L2StandardBridge', () => { ...@@ -173,7 +173,7 @@ describe('OVM_L2StandardBridge', () => {
() => DUMMY_L1BRIDGE_ADDRESS () => DUMMY_L1BRIDGE_ADDRESS
) )
await OVM_L2StandardBridge.connect( await L2StandardBridge.connect(
l2MessengerImpersonator l2MessengerImpersonator
).finalizeDeposit( ).finalizeDeposit(
DUMMY_L1TOKEN_ADDRESS, DUMMY_L1TOKEN_ADDRESS,
...@@ -200,7 +200,7 @@ describe('OVM_L2StandardBridge', () => { ...@@ -200,7 +200,7 @@ describe('OVM_L2StandardBridge', () => {
SmoddedL2Token = await ( SmoddedL2Token = await (
await smoddit('L2StandardERC20', alice) await smoddit('L2StandardERC20', alice)
).deploy( ).deploy(
OVM_L2StandardBridge.address, L2StandardBridge.address,
DUMMY_L1TOKEN_ADDRESS, DUMMY_L1TOKEN_ADDRESS,
'L2Token', 'L2Token',
'L2T' 'L2T'
...@@ -212,12 +212,12 @@ describe('OVM_L2StandardBridge', () => { ...@@ -212,12 +212,12 @@ describe('OVM_L2StandardBridge', () => {
_balances: { _balances: {
[aliceAddress]: ALICE_INITIAL_BALANCE, [aliceAddress]: ALICE_INITIAL_BALANCE,
}, },
l2Bridge: OVM_L2StandardBridge.address, l2Bridge: L2StandardBridge.address,
}) })
}) })
it('withdraw() burns and sends the correct withdrawal message', async () => { it('withdraw() burns and sends the correct withdrawal message', async () => {
await OVM_L2StandardBridge.withdraw( await L2StandardBridge.withdraw(
SmoddedL2Token.address, SmoddedL2Token.address,
withdrawAmount, withdrawAmount,
0, 0,
...@@ -262,7 +262,7 @@ describe('OVM_L2StandardBridge', () => { ...@@ -262,7 +262,7 @@ describe('OVM_L2StandardBridge', () => {
}) })
it('withdrawTo() burns and sends the correct withdrawal message', async () => { it('withdrawTo() burns and sends the correct withdrawal message', async () => {
await OVM_L2StandardBridge.withdrawTo( await L2StandardBridge.withdrawTo(
SmoddedL2Token.address, SmoddedL2Token.address,
await bob.getAddress(), await bob.getAddress(),
withdrawAmount, withdrawAmount,
......
...@@ -47,7 +47,7 @@ describe('OVM_L2StandardTokenFactory', () => { ...@@ -47,7 +47,7 @@ describe('OVM_L2StandardTokenFactory', () => {
signer signer
) )
expect(await l2Token.l2Bridge()).to.equal(predeploys.OVM_L2StandardBridge) expect(await l2Token.l2Bridge()).to.equal(predeploys.L2StandardBridge)
expect(await l2Token.l1Token()).to.equal(L1ERC20.address) expect(await l2Token.l1Token()).to.equal(L1ERC20.address)
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')
......
...@@ -14,10 +14,10 @@ describe('OVM_SequencerFeeVault', () => { ...@@ -14,10 +14,10 @@ describe('OVM_SequencerFeeVault', () => {
;[signer1] = await hre.ethers.getSigners() ;[signer1] = await hre.ethers.getSigners()
}) })
let Mock__OVM_L2StandardBridge: MockContract let Mock__L2StandardBridge: MockContract
before(async () => { before(async () => {
Mock__OVM_L2StandardBridge = await smockit('OVM_L2StandardBridge', { Mock__L2StandardBridge = await smockit('OVM_L2StandardBridge', {
address: predeploys.OVM_L2StandardBridge, address: predeploys.L2StandardBridge,
}) })
}) })
...@@ -44,7 +44,7 @@ describe('OVM_SequencerFeeVault', () => { ...@@ -44,7 +44,7 @@ describe('OVM_SequencerFeeVault', () => {
await expect(OVM_SequencerFeeVault.withdraw()).to.not.be.reverted await expect(OVM_SequencerFeeVault.withdraw()).to.not.be.reverted
expect( expect(
Mock__OVM_L2StandardBridge.smocked.withdrawTo.calls[0] Mock__L2StandardBridge.smocked.withdrawTo.calls[0]
).to.deep.equal([ ).to.deep.equal([
predeploys.OVM_ETH, predeploys.OVM_ETH,
await signer1.getAddress(), await signer1.getAddress(),
...@@ -67,7 +67,7 @@ describe('OVM_SequencerFeeVault', () => { ...@@ -67,7 +67,7 @@ describe('OVM_SequencerFeeVault', () => {
await expect(OVM_SequencerFeeVault.withdraw()).to.not.be.reverted await expect(OVM_SequencerFeeVault.withdraw()).to.not.be.reverted
expect( expect(
Mock__OVM_L2StandardBridge.smocked.withdrawTo.calls[0] Mock__L2StandardBridge.smocked.withdrawTo.calls[0]
).to.deep.equal([ ).to.deep.equal([
predeploys.OVM_ETH, predeploys.OVM_ETH,
await signer1.getAddress(), await signer1.getAddress(),
......
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