Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
61ee1c52
Unverified
Commit
61ee1c52
authored
Sep 13, 2021
by
elenadimitrova
Committed by
Kelvin Fichter
Nov 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename OVM_L1StandardBridge to L1StandardBridge
parent
b860fc66
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
62 additions
and
62 deletions
+62
-62
utils.ts
integration-tests/test/shared/utils.ts
+5
-5
deployer.sh
ops/scripts/deployer.sh
+2
-2
L1StandardBridge.sol
...ges/contracts/contracts/L1/messaging/L1StandardBridge.sol
+2
-2
009-Proxy__OVM_L1StandardBridge.deploy.ts
...ontracts/deploy/009-Proxy__OVM_L1StandardBridge.deploy.ts
+8
-8
011-fund-accounts.ts
packages/contracts/deploy/011-fund-accounts.ts
+4
-4
L1StandardBridge.spec.ts
...acts/test/contracts/L1/messaging/L1StandardBridge.spec.ts
+35
-35
OVM_L2StandardBridge.spec.ts
.../test/contracts/L2/messaging/OVM_L2StandardBridge.spec.ts
+6
-6
No files found.
integration-tests/test/shared/utils.ts
View file @
61ee1c52
...
...
@@ -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
)
=>
{
...
...
ops/scripts/deployer.sh
View file @
61ee1c52
...
...
@@ -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
...
...
packages/contracts/contracts/L1/messaging/
OVM_
L1StandardBridge.sol
→
packages/contracts/contracts/L1/messaging/L1StandardBridge.sol
View file @
61ee1c52
...
...
@@ -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;
...
...
packages/contracts/deploy/009-Proxy__OVM_L1StandardBridge.deploy.ts
View file @
61ee1c52
...
...
@@ -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
packages/contracts/deploy/011-fund-accounts.ts
View file @
61ee1c52
...
...
@@ -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.
})
...
...
packages/contracts/test/contracts/L1/messaging/
OVM_
L1StandardBridge.spec.ts
→
packages/contracts/test/contracts/L1/messaging/L1StandardBridge.spec.ts
View file @
61ee1c52
This diff is collapsed.
Click to expand it.
packages/contracts/test/contracts/L2/messaging/OVM_L2StandardBridge.spec.ts
View file @
61ee1c52
...
...
@@ -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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment