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