Commit 61ee1c52 authored by elenadimitrova's avatar elenadimitrova Committed by Kelvin Fichter

Rename OVM_L1StandardBridge to L1StandardBridge

parent b860fc66
...@@ -84,24 +84,24 @@ export const getAddressManager = (provider: any) => { ...@@ -84,24 +84,24 @@ export const getAddressManager = (provider: any) => {
// Gets the bridge contract // Gets the bridge contract
export const getL1Bridge = async (wallet: Wallet, AddressManager: Contract) => { export const getL1Bridge = async (wallet: Wallet, AddressManager: Contract) => {
const l1BridgeInterface = getContractInterface('OVM_L1StandardBridge') const l1BridgeInterface = getContractInterface('L1StandardBridge')
const ProxyBridgeAddress = await AddressManager.getAddress( const ProxyBridgeAddress = await AddressManager.getAddress(
'Proxy__OVM_L1StandardBridge' 'Proxy__L1StandardBridge'
) )
if ( if (
!utils.isAddress(ProxyBridgeAddress) || !utils.isAddress(ProxyBridgeAddress) ||
ProxyBridgeAddress === constants.AddressZero ProxyBridgeAddress === constants.AddressZero
) { ) {
throw new Error('Proxy__OVM_L1StandardBridge not found') throw new Error('Proxy__L1StandardBridge not found')
} }
const OVM_L1StandardBridge = new Contract( const L1StandardBridge = new Contract(
ProxyBridgeAddress, ProxyBridgeAddress,
l1BridgeInterface, l1BridgeInterface,
wallet wallet
) )
return OVM_L1StandardBridge return L1StandardBridge
} }
export const getL2Bridge = async (wallet: Wallet) => { export const getL2Bridge = async (wallet: Wallet) => {
......
...@@ -24,9 +24,9 @@ function envSet() { ...@@ -24,9 +24,9 @@ function envSet() {
} }
# set the address to the proxy gateway if possible # set the address to the proxy gateway if possible
envSet L1_STANDARD_BRIDGE_ADDRESS Proxy__OVM_L1StandardBridge envSet L1_STANDARD_BRIDGE_ADDRESS Proxy__L1StandardBridge
if [ $L1_STANDARD_BRIDGE_ADDRESS == null ]; then if [ $L1_STANDARD_BRIDGE_ADDRESS == null ]; then
envSet L1_STANDARD_BRIDGE_ADDRESS OVM_L1StandardBridge envSet L1_STANDARD_BRIDGE_ADDRESS L1StandardBridge
fi fi
envSet L1_CROSS_DOMAIN_MESSENGER_ADDRESS Proxy__OVM_L1CrossDomainMessenger envSet L1_CROSS_DOMAIN_MESSENGER_ADDRESS Proxy__OVM_L1CrossDomainMessenger
......
...@@ -17,14 +17,14 @@ import { Address } from "@openzeppelin/contracts/utils/Address.sol"; ...@@ -17,14 +17,14 @@ import { Address } from "@openzeppelin/contracts/utils/Address.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
/** /**
* @title OVM_L1StandardBridge * @title L1StandardBridge
* @dev The L1 ETH and ERC20 Bridge is a contract which stores deposited L1 funds and standard * @dev The L1 ETH and ERC20 Bridge is a contract which stores deposited L1 funds and standard
* tokens that are in use on L2. It synchronizes a corresponding L2 Bridge, informing it of deposits * tokens that are in use on L2. It synchronizes a corresponding L2 Bridge, informing it of deposits
* and listening to it for newly finalized withdrawals. * and listening to it for newly finalized withdrawals.
* *
* Runtime target: EVM * Runtime target: EVM
*/ */
contract OVM_L1StandardBridge is IL1StandardBridge, OVM_CrossDomainEnabled { contract L1StandardBridge is IL1StandardBridge, OVM_CrossDomainEnabled {
using SafeMath for uint; using SafeMath for uint;
using SafeERC20 for IERC20; using SafeERC20 for IERC20;
......
...@@ -7,7 +7,7 @@ import { predeploys } from '../src/predeploys' ...@@ -7,7 +7,7 @@ import { predeploys } from '../src/predeploys'
import { NON_ZERO_ADDRESS } from '../test/helpers/constants' import { NON_ZERO_ADDRESS } from '../test/helpers/constants'
import { getContractFactory } from '../src/contract-defs' import { getContractFactory } from '../src/contract-defs'
import l1StandardBridgeJson from '../artifacts/contracts/L1/messaging/OVM_L1StandardBridge.sol/OVM_L1StandardBridge.json' import l1StandardBridgeJson from '../artifacts/contracts/L1/messaging/L1StandardBridge.sol/L1StandardBridge.json'
const deployFn: DeployFunction = async (hre) => { const deployFn: DeployFunction = async (hre) => {
const { deploy } = hre.deployments const { deploy } = hre.deployments
...@@ -21,7 +21,7 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -21,7 +21,7 @@ const deployFn: DeployFunction = async (hre) => {
} }
) )
const result = await deploy('Proxy__OVM_L1StandardBridge', { const result = await deploy('Proxy__L1StandardBridge', {
contract: 'L1ChugSplashProxy', contract: 'L1ChugSplashProxy',
from: deployer, from: deployer,
args: [deployer], args: [deployer],
...@@ -35,7 +35,7 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -35,7 +35,7 @@ const deployFn: DeployFunction = async (hre) => {
// Create a contract object at the Proxy address with the proxy interface. // Create a contract object at the Proxy address with the proxy interface.
const Proxy__WithChugSplashInterface = await getDeployedContract( const Proxy__WithChugSplashInterface = await getDeployedContract(
hre, hre,
'Proxy__OVM_L1StandardBridge', 'Proxy__L1StandardBridge',
{ {
signerOrProvider: deployer, signerOrProvider: deployer,
iface: 'L1ChugSplashProxy', iface: 'L1ChugSplashProxy',
...@@ -45,10 +45,10 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -45,10 +45,10 @@ const deployFn: DeployFunction = async (hre) => {
// Create a contract object at the Proxy address with the brige implementation interface. // Create a contract object at the Proxy address with the brige implementation interface.
const Proxy__WithBridgeInterface = await getDeployedContract( const Proxy__WithBridgeInterface = await getDeployedContract(
hre, hre,
'Proxy__OVM_L1StandardBridge', 'Proxy__L1StandardBridge',
{ {
signerOrProvider: deployer, signerOrProvider: deployer,
iface: 'OVM_L1StandardBridge', iface: 'L1StandardBridge',
} }
) )
...@@ -95,12 +95,12 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -95,12 +95,12 @@ const deployFn: DeployFunction = async (hre) => {
// Todo: remove this after adding chugsplash proxy // Todo: remove this after adding chugsplash proxy
await Lib_AddressManager.setAddress( await Lib_AddressManager.setAddress(
'Proxy__OVM_L1StandardBridge', 'Proxy__L1StandardBridge',
result.address result.address
) )
} }
deployFn.dependencies = ['Lib_AddressManager', 'OVM_L1StandardBridge'] deployFn.dependencies = ['Lib_AddressManager', 'L1StandardBridge']
deployFn.tags = ['Proxy__OVM_L1StandardBridge'] deployFn.tags = ['Proxy__L1StandardBridge']
export default deployFn export default deployFn
...@@ -17,11 +17,11 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -17,11 +17,11 @@ const deployFn: DeployFunction = async (hre) => {
// Only execute this step if we're on the hardhat chain ID. // Only execute this step if we're on the hardhat chain ID.
const { chainId } = await hre.ethers.provider.getNetwork() const { chainId } = await hre.ethers.provider.getNetwork()
if (chainId === defaultHardhatNetworkParams.chainId) { if (chainId === defaultHardhatNetworkParams.chainId) {
const OVM_L1StandardBridge = await getDeployedContract( const L1StandardBridge = await getDeployedContract(
hre, hre,
'Proxy__OVM_L1StandardBridge', 'Proxy__L1StandardBridge',
{ {
iface: 'OVM_L1StandardBridge', iface: 'L1StandardBridge',
} }
) )
...@@ -44,7 +44,7 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -44,7 +44,7 @@ const deployFn: DeployFunction = async (hre) => {
) )
const balance = await wallet.getBalance() const balance = await wallet.getBalance()
const depositAmount = balance.div(2) // Deposit half of the wallet's balance into L2. const depositAmount = balance.div(2) // Deposit half of the wallet's balance into L2.
await OVM_L1StandardBridge.connect(wallet).depositETH(8_000_000, '0x', { await L1StandardBridge.connect(wallet).depositETH(8_000_000, '0x', {
value: depositAmount, value: depositAmount,
gasLimit: 2_000_000, // Idk, gas estimation was broken and this fixes it. gasLimit: 2_000_000, // Idk, gas estimation was broken and this fixes it.
}) })
......
...@@ -22,7 +22,7 @@ const DUMMY_L2_BRIDGE_ADDRESS = ethers.utils.getAddress( ...@@ -22,7 +22,7 @@ const DUMMY_L2_BRIDGE_ADDRESS = ethers.utils.getAddress(
const INITIAL_TOTAL_L1_SUPPLY = 5000 const INITIAL_TOTAL_L1_SUPPLY = 5000
const FINALIZATION_GAS = 1_200_000 const FINALIZATION_GAS = 1_200_000
describe('OVM_L1StandardBridge', () => { describe('L1StandardBridge', () => {
// init signers // init signers
let l1MessengerImpersonator: Signer let l1MessengerImpersonator: Signer
let alice: Signer let alice: Signer
...@@ -52,7 +52,7 @@ describe('OVM_L1StandardBridge', () => { ...@@ -52,7 +52,7 @@ describe('OVM_L1StandardBridge', () => {
}) })
let L1ERC20: Contract let L1ERC20: Contract
let OVM_L1StandardBridge: Contract let L1StandardBridge: Contract
let Mock__OVM_L1CrossDomainMessenger: MockContract let Mock__OVM_L1CrossDomainMessenger: MockContract
beforeEach(async () => { beforeEach(async () => {
// Get a new mock L1 messenger // Get a new mock L1 messenger
...@@ -62,10 +62,10 @@ describe('OVM_L1StandardBridge', () => { ...@@ -62,10 +62,10 @@ describe('OVM_L1StandardBridge', () => {
) )
// Deploy the contract under test // Deploy the contract under test
OVM_L1StandardBridge = await ( L1StandardBridge = await (
await ethers.getContractFactory('OVM_L1StandardBridge') await ethers.getContractFactory('L1StandardBridge')
).deploy() ).deploy()
await OVM_L1StandardBridge.initialize( await L1StandardBridge.initialize(
Mock__OVM_L1CrossDomainMessenger.address, Mock__OVM_L1CrossDomainMessenger.address,
DUMMY_L2_BRIDGE_ADDRESS DUMMY_L2_BRIDGE_ADDRESS
) )
...@@ -82,7 +82,7 @@ describe('OVM_L1StandardBridge', () => { ...@@ -82,7 +82,7 @@ describe('OVM_L1StandardBridge', () => {
describe('initialize', () => { describe('initialize', () => {
it('Should only be callable once', async () => { it('Should only be callable once', async () => {
await expect( await expect(
OVM_L1StandardBridge.initialize( L1StandardBridge.initialize(
ethers.constants.AddressZero, ethers.constants.AddressZero,
DUMMY_L2_BRIDGE_ADDRESS DUMMY_L2_BRIDGE_ADDRESS
) )
...@@ -98,7 +98,7 @@ describe('OVM_L1StandardBridge', () => { ...@@ -98,7 +98,7 @@ describe('OVM_L1StandardBridge', () => {
const initialBalance = await ethers.provider.getBalance(depositer) const initialBalance = await ethers.provider.getBalance(depositer)
// alice calls deposit on the bridge and the L1 bridge calls transferFrom on the token // alice calls deposit on the bridge and the L1 bridge calls transferFrom on the token
await OVM_L1StandardBridge.connect(alice).depositETH( await L1StandardBridge.connect(alice).depositETH(
FINALIZATION_GAS, FINALIZATION_GAS,
NON_NULL_BYTES32, NON_NULL_BYTES32,
{ {
...@@ -116,7 +116,7 @@ describe('OVM_L1StandardBridge', () => { ...@@ -116,7 +116,7 @@ describe('OVM_L1StandardBridge', () => {
// bridge's balance is increased // bridge's balance is increased
const bridgeBalance = await ethers.provider.getBalance( const bridgeBalance = await ethers.provider.getBalance(
OVM_L1StandardBridge.address L1StandardBridge.address
) )
expect(bridgeBalance).to.equal(depositAmount) expect(bridgeBalance).to.equal(depositAmount)
...@@ -143,7 +143,7 @@ describe('OVM_L1StandardBridge', () => { ...@@ -143,7 +143,7 @@ describe('OVM_L1StandardBridge', () => {
// depositor calls deposit on the bridge and the L1 bridge calls transferFrom on the token // depositor calls deposit on the bridge and the L1 bridge calls transferFrom on the token
const initialBalance = await ethers.provider.getBalance(aliceAddress) const initialBalance = await ethers.provider.getBalance(aliceAddress)
await OVM_L1StandardBridge.connect(alice).depositETHTo( await L1StandardBridge.connect(alice).depositETHTo(
bobsAddress, bobsAddress,
FINALIZATION_GAS, FINALIZATION_GAS,
NON_NULL_BYTES32, NON_NULL_BYTES32,
...@@ -160,7 +160,7 @@ describe('OVM_L1StandardBridge', () => { ...@@ -160,7 +160,7 @@ describe('OVM_L1StandardBridge', () => {
// bridge's balance is increased // bridge's balance is increased
const bridgeBalance = await ethers.provider.getBalance( const bridgeBalance = await ethers.provider.getBalance(
OVM_L1StandardBridge.address L1StandardBridge.address
) )
expect(bridgeBalance).to.equal(depositAmount) expect(bridgeBalance).to.equal(depositAmount)
...@@ -185,7 +185,7 @@ describe('OVM_L1StandardBridge', () => { ...@@ -185,7 +185,7 @@ describe('OVM_L1StandardBridge', () => {
it('cannot depositETH from a contract account', async () => { it('cannot depositETH from a contract account', async () => {
expect( expect(
OVM_L1StandardBridge.depositETH(FINALIZATION_GAS, NON_NULL_BYTES32, { L1StandardBridge.depositETH(FINALIZATION_GAS, NON_NULL_BYTES32, {
value: depositAmount, value: depositAmount,
gasPrice: 0, gasPrice: 0,
}) })
...@@ -197,7 +197,7 @@ describe('OVM_L1StandardBridge', () => { ...@@ -197,7 +197,7 @@ describe('OVM_L1StandardBridge', () => {
it('onlyFromCrossDomainAccount: should revert on calls from a non-crossDomainMessenger L1 account', async () => { it('onlyFromCrossDomainAccount: should revert on calls from a non-crossDomainMessenger L1 account', async () => {
// Deploy new bridge, initialize with random messenger // Deploy new bridge, initialize with random messenger
await expect( await expect(
OVM_L1StandardBridge.connect(alice).finalizeETHWithdrawal( L1StandardBridge.connect(alice).finalizeETHWithdrawal(
constants.AddressZero, constants.AddressZero,
constants.AddressZero, constants.AddressZero,
1, 1,
...@@ -210,10 +210,10 @@ describe('OVM_L1StandardBridge', () => { ...@@ -210,10 +210,10 @@ describe('OVM_L1StandardBridge', () => {
}) })
it('onlyFromCrossDomainAccount: should revert on calls from the right crossDomainMessenger, but wrong xDomainMessageSender (ie. not the L2ETHToken)', async () => { it('onlyFromCrossDomainAccount: should revert on calls from the right crossDomainMessenger, but wrong xDomainMessageSender (ie. not the L2ETHToken)', async () => {
OVM_L1StandardBridge = await ( L1StandardBridge = await (
await ethers.getContractFactory('OVM_L1StandardBridge') await ethers.getContractFactory('L1StandardBridge')
).deploy() ).deploy()
await OVM_L1StandardBridge.initialize( await L1StandardBridge.initialize(
Mock__OVM_L1CrossDomainMessenger.address, Mock__OVM_L1CrossDomainMessenger.address,
DUMMY_L2_BRIDGE_ADDRESS DUMMY_L2_BRIDGE_ADDRESS
) )
...@@ -223,7 +223,7 @@ describe('OVM_L1StandardBridge', () => { ...@@ -223,7 +223,7 @@ describe('OVM_L1StandardBridge', () => {
) )
await expect( await expect(
OVM_L1StandardBridge.finalizeETHWithdrawal( L1StandardBridge.finalizeETHWithdrawal(
constants.AddressZero, constants.AddressZero,
constants.AddressZero, constants.AddressZero,
1, 1,
...@@ -245,7 +245,7 @@ describe('OVM_L1StandardBridge', () => { ...@@ -245,7 +245,7 @@ describe('OVM_L1StandardBridge', () => {
) )
// thanks Alice // thanks Alice
await OVM_L1StandardBridge.connect(alice).depositETH( await L1StandardBridge.connect(alice).depositETH(
FINALIZATION_GAS, FINALIZATION_GAS,
NON_NULL_BYTES32, NON_NULL_BYTES32,
{ {
...@@ -254,7 +254,7 @@ describe('OVM_L1StandardBridge', () => { ...@@ -254,7 +254,7 @@ describe('OVM_L1StandardBridge', () => {
} }
) )
await OVM_L1StandardBridge.finalizeETHWithdrawal( await L1StandardBridge.finalizeETHWithdrawal(
NON_ZERO_ADDRESS, NON_ZERO_ADDRESS,
NON_ZERO_ADDRESS, NON_ZERO_ADDRESS,
withdrawalAmount, withdrawalAmount,
...@@ -275,14 +275,14 @@ describe('OVM_L1StandardBridge', () => { ...@@ -275,14 +275,14 @@ describe('OVM_L1StandardBridge', () => {
beforeEach(async () => { beforeEach(async () => {
await L1ERC20.connect(alice).approve( await L1ERC20.connect(alice).approve(
OVM_L1StandardBridge.address, L1StandardBridge.address,
depositAmount depositAmount
) )
}) })
it('depositERC20() escrows the deposit amount and sends the correct deposit message', async () => { it('depositERC20() escrows the deposit amount and sends the correct deposit message', async () => {
// alice calls deposit on the bridge and the L1 bridge calls transferFrom on the token // alice calls deposit on the bridge and the L1 bridge calls transferFrom on the token
await OVM_L1StandardBridge.connect(alice).depositERC20( await L1StandardBridge.connect(alice).depositERC20(
L1ERC20.address, L1ERC20.address,
DUMMY_L2_ERC20_ADDRESS, DUMMY_L2_ERC20_ADDRESS,
depositAmount, depositAmount,
...@@ -299,7 +299,7 @@ describe('OVM_L1StandardBridge', () => { ...@@ -299,7 +299,7 @@ describe('OVM_L1StandardBridge', () => {
// bridge's balance is increased // bridge's balance is increased
const bridgeBalance = await L1ERC20.balanceOf( const bridgeBalance = await L1ERC20.balanceOf(
OVM_L1StandardBridge.address L1StandardBridge.address
) )
expect(bridgeBalance).to.equal(depositAmount) expect(bridgeBalance).to.equal(depositAmount)
...@@ -324,7 +324,7 @@ describe('OVM_L1StandardBridge', () => { ...@@ -324,7 +324,7 @@ describe('OVM_L1StandardBridge', () => {
it('depositERC20To() escrows the deposit amount and sends the correct deposit message', async () => { it('depositERC20To() escrows the deposit amount and sends the correct deposit message', async () => {
// depositor calls deposit on the bridge and the L1 bridge calls transferFrom on the token // depositor calls deposit on the bridge and the L1 bridge calls transferFrom on the token
await OVM_L1StandardBridge.connect(alice).depositERC20To( await L1StandardBridge.connect(alice).depositERC20To(
L1ERC20.address, L1ERC20.address,
DUMMY_L2_ERC20_ADDRESS, DUMMY_L2_ERC20_ADDRESS,
bobsAddress, bobsAddress,
...@@ -340,7 +340,7 @@ describe('OVM_L1StandardBridge', () => { ...@@ -340,7 +340,7 @@ describe('OVM_L1StandardBridge', () => {
// bridge's balance is increased // bridge's balance is increased
const bridgeBalance = await L1ERC20.balanceOf( const bridgeBalance = await L1ERC20.balanceOf(
OVM_L1StandardBridge.address L1StandardBridge.address
) )
expect(bridgeBalance).to.equal(depositAmount) expect(bridgeBalance).to.equal(depositAmount)
...@@ -365,7 +365,7 @@ describe('OVM_L1StandardBridge', () => { ...@@ -365,7 +365,7 @@ describe('OVM_L1StandardBridge', () => {
it('cannot depositERC20 from a contract account', async () => { it('cannot depositERC20 from a contract account', async () => {
expect( expect(
OVM_L1StandardBridge.depositERC20( L1StandardBridge.depositERC20(
L1ERC20.address, L1ERC20.address,
DUMMY_L2_ERC20_ADDRESS, DUMMY_L2_ERC20_ADDRESS,
depositAmount, depositAmount,
...@@ -388,7 +388,7 @@ describe('OVM_L1StandardBridge', () => { ...@@ -388,7 +388,7 @@ describe('OVM_L1StandardBridge', () => {
it('depositERC20(): will revert if ERC20.transferFrom() reverts', async () => { it('depositERC20(): will revert if ERC20.transferFrom() reverts', async () => {
await expect( await expect(
OVM_L1StandardBridge.connect(alice).depositERC20( L1StandardBridge.connect(alice).depositERC20(
MOCK__L1ERC20.address, MOCK__L1ERC20.address,
DUMMY_L2_ERC20_ADDRESS, DUMMY_L2_ERC20_ADDRESS,
depositAmount, depositAmount,
...@@ -400,7 +400,7 @@ describe('OVM_L1StandardBridge', () => { ...@@ -400,7 +400,7 @@ describe('OVM_L1StandardBridge', () => {
it('depositERC20To(): will revert if ERC20.transferFrom() reverts', async () => { it('depositERC20To(): will revert if ERC20.transferFrom() reverts', async () => {
await expect( await expect(
OVM_L1StandardBridge.connect(alice).depositERC20To( L1StandardBridge.connect(alice).depositERC20To(
MOCK__L1ERC20.address, MOCK__L1ERC20.address,
DUMMY_L2_ERC20_ADDRESS, DUMMY_L2_ERC20_ADDRESS,
bobsAddress, bobsAddress,
...@@ -413,7 +413,7 @@ describe('OVM_L1StandardBridge', () => { ...@@ -413,7 +413,7 @@ describe('OVM_L1StandardBridge', () => {
it('depositERC20To(): will revert if the L1 ERC20 has no code or is zero address', async () => { it('depositERC20To(): will revert if the L1 ERC20 has no code or is zero address', async () => {
await expect( await expect(
OVM_L1StandardBridge.connect(alice).depositERC20To( L1StandardBridge.connect(alice).depositERC20To(
ethers.constants.AddressZero, ethers.constants.AddressZero,
DUMMY_L2_ERC20_ADDRESS, DUMMY_L2_ERC20_ADDRESS,
bobsAddress, bobsAddress,
...@@ -436,7 +436,7 @@ describe('OVM_L1StandardBridge', () => { ...@@ -436,7 +436,7 @@ describe('OVM_L1StandardBridge', () => {
it('deposit(): will revert if ERC20.transferFrom() returns false', async () => { it('deposit(): will revert if ERC20.transferFrom() returns false', async () => {
await expect( await expect(
OVM_L1StandardBridge.connect(alice).depositERC20( L1StandardBridge.connect(alice).depositERC20(
MOCK__L1ERC20.address, MOCK__L1ERC20.address,
DUMMY_L2_ERC20_ADDRESS, DUMMY_L2_ERC20_ADDRESS,
depositAmount, depositAmount,
...@@ -448,7 +448,7 @@ describe('OVM_L1StandardBridge', () => { ...@@ -448,7 +448,7 @@ describe('OVM_L1StandardBridge', () => {
it('depositTo(): will revert if ERC20.transferFrom() returns false', async () => { it('depositTo(): will revert if ERC20.transferFrom() returns false', async () => {
await expect( await expect(
OVM_L1StandardBridge.depositERC20To( L1StandardBridge.depositERC20To(
MOCK__L1ERC20.address, MOCK__L1ERC20.address,
DUMMY_L2_ERC20_ADDRESS, DUMMY_L2_ERC20_ADDRESS,
bobsAddress, bobsAddress,
...@@ -464,7 +464,7 @@ describe('OVM_L1StandardBridge', () => { ...@@ -464,7 +464,7 @@ describe('OVM_L1StandardBridge', () => {
describe('ERC20 withdrawals', () => { describe('ERC20 withdrawals', () => {
it('onlyFromCrossDomainAccount: should revert on calls from a non-crossDomainMessenger L1 account', async () => { it('onlyFromCrossDomainAccount: should revert on calls from a non-crossDomainMessenger L1 account', async () => {
await expect( await expect(
OVM_L1StandardBridge.connect(alice).finalizeERC20Withdrawal( L1StandardBridge.connect(alice).finalizeERC20Withdrawal(
L1ERC20.address, L1ERC20.address,
DUMMY_L2_ERC20_ADDRESS, DUMMY_L2_ERC20_ADDRESS,
constants.AddressZero, constants.AddressZero,
...@@ -481,7 +481,7 @@ describe('OVM_L1StandardBridge', () => { ...@@ -481,7 +481,7 @@ describe('OVM_L1StandardBridge', () => {
) )
await expect( await expect(
OVM_L1StandardBridge.finalizeERC20Withdrawal( L1StandardBridge.finalizeERC20Withdrawal(
L1ERC20.address, L1ERC20.address,
DUMMY_L2_ERC20_ADDRESS, DUMMY_L2_ERC20_ADDRESS,
constants.AddressZero, constants.AddressZero,
...@@ -499,11 +499,11 @@ describe('OVM_L1StandardBridge', () => { ...@@ -499,11 +499,11 @@ describe('OVM_L1StandardBridge', () => {
// First Alice will 'donate' some tokens so that there's a balance to be withdrawn // First Alice will 'donate' some tokens so that there's a balance to be withdrawn
const withdrawalAmount = 10 const withdrawalAmount = 10
await L1ERC20.connect(alice).approve( await L1ERC20.connect(alice).approve(
OVM_L1StandardBridge.address, L1StandardBridge.address,
withdrawalAmount withdrawalAmount
) )
await OVM_L1StandardBridge.connect(alice).depositERC20( await L1StandardBridge.connect(alice).depositERC20(
L1ERC20.address, L1ERC20.address,
DUMMY_L2_ERC20_ADDRESS, DUMMY_L2_ERC20_ADDRESS,
withdrawalAmount, withdrawalAmount,
...@@ -511,7 +511,7 @@ describe('OVM_L1StandardBridge', () => { ...@@ -511,7 +511,7 @@ describe('OVM_L1StandardBridge', () => {
NON_NULL_BYTES32 NON_NULL_BYTES32
) )
expect(await L1ERC20.balanceOf(OVM_L1StandardBridge.address)).to.be.equal( expect(await L1ERC20.balanceOf(L1StandardBridge.address)).to.be.equal(
withdrawalAmount withdrawalAmount
) )
...@@ -522,7 +522,7 @@ describe('OVM_L1StandardBridge', () => { ...@@ -522,7 +522,7 @@ describe('OVM_L1StandardBridge', () => {
() => DUMMY_L2_BRIDGE_ADDRESS () => DUMMY_L2_BRIDGE_ADDRESS
) )
await OVM_L1StandardBridge.finalizeERC20Withdrawal( await L1StandardBridge.finalizeERC20Withdrawal(
L1ERC20.address, L1ERC20.address,
DUMMY_L2_ERC20_ADDRESS, DUMMY_L2_ERC20_ADDRESS,
NON_ZERO_ADDRESS, NON_ZERO_ADDRESS,
......
...@@ -30,7 +30,7 @@ describe('OVM_L2StandardBridge', () => { ...@@ -30,7 +30,7 @@ describe('OVM_L2StandardBridge', () => {
let bob: Signer let bob: Signer
let bobsAddress: string let bobsAddress: string
let l2MessengerImpersonator: Signer let l2MessengerImpersonator: Signer
let Factory__OVM_L1StandardBridge: ContractFactory let Factory__L1StandardBridge: ContractFactory
let IL2ERC20Bridge: Interface let IL2ERC20Bridge: Interface
const INITIAL_TOTAL_SUPPLY = 100_000 const INITIAL_TOTAL_SUPPLY = 100_000
const ALICE_INITIAL_BALANCE = 50_000 const ALICE_INITIAL_BALANCE = 50_000
...@@ -39,8 +39,8 @@ describe('OVM_L2StandardBridge', () => { ...@@ -39,8 +39,8 @@ describe('OVM_L2StandardBridge', () => {
;[alice, bob, l2MessengerImpersonator] = await ethers.getSigners() ;[alice, bob, l2MessengerImpersonator] = await ethers.getSigners()
aliceAddress = await alice.getAddress() aliceAddress = await alice.getAddress()
bobsAddress = await bob.getAddress() bobsAddress = await bob.getAddress()
Factory__OVM_L1StandardBridge = await ethers.getContractFactory( Factory__L1StandardBridge = await ethers.getContractFactory(
'OVM_L1StandardBridge' 'L1StandardBridge'
) )
// get an L2ER20Bridge Interface // get an L2ER20Bridge Interface
...@@ -152,7 +152,7 @@ describe('OVM_L2StandardBridge', () => { ...@@ -152,7 +152,7 @@ describe('OVM_L2StandardBridge', () => {
expect(withdrawalCallToMessenger._target).to.equal(DUMMY_L1BRIDGE_ADDRESS) expect(withdrawalCallToMessenger._target).to.equal(DUMMY_L1BRIDGE_ADDRESS)
expect(withdrawalCallToMessenger._message).to.equal( expect(withdrawalCallToMessenger._message).to.equal(
Factory__OVM_L1StandardBridge.interface.encodeFunctionData( Factory__L1StandardBridge.interface.encodeFunctionData(
'finalizeERC20Withdrawal', 'finalizeERC20Withdrawal',
[ [
DUMMY_L1TOKEN_ADDRESS, DUMMY_L1TOKEN_ADDRESS,
...@@ -245,7 +245,7 @@ describe('OVM_L2StandardBridge', () => { ...@@ -245,7 +245,7 @@ describe('OVM_L2StandardBridge', () => {
expect(withdrawalCallToMessenger._target).to.equal(DUMMY_L1BRIDGE_ADDRESS) expect(withdrawalCallToMessenger._target).to.equal(DUMMY_L1BRIDGE_ADDRESS)
// Message data should be a call telling the L1L1StandardBridge to finalize the withdrawal // Message data should be a call telling the L1L1StandardBridge to finalize the withdrawal
expect(withdrawalCallToMessenger._message).to.equal( expect(withdrawalCallToMessenger._message).to.equal(
Factory__OVM_L1StandardBridge.interface.encodeFunctionData( Factory__L1StandardBridge.interface.encodeFunctionData(
'finalizeERC20Withdrawal', 'finalizeERC20Withdrawal',
[ [
DUMMY_L1TOKEN_ADDRESS, DUMMY_L1TOKEN_ADDRESS,
...@@ -291,7 +291,7 @@ describe('OVM_L2StandardBridge', () => { ...@@ -291,7 +291,7 @@ describe('OVM_L2StandardBridge', () => {
expect(withdrawalCallToMessenger._target).to.equal(DUMMY_L1BRIDGE_ADDRESS) expect(withdrawalCallToMessenger._target).to.equal(DUMMY_L1BRIDGE_ADDRESS)
// The message data should be a call telling the L1L1StandardBridge to finalize the withdrawal // The message data should be a call telling the L1L1StandardBridge to finalize the withdrawal
expect(withdrawalCallToMessenger._message).to.equal( expect(withdrawalCallToMessenger._message).to.equal(
Factory__OVM_L1StandardBridge.interface.encodeFunctionData( Factory__L1StandardBridge.interface.encodeFunctionData(
'finalizeERC20Withdrawal', 'finalizeERC20Withdrawal',
[ [
DUMMY_L1TOKEN_ADDRESS, DUMMY_L1TOKEN_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