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.
}) })
......
...@@ -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