-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add function to obtain eth bridge contracts (#260)
Co-authored-by: spsjvc <[email protected]>
- Loading branch information
1 parent
2c5504c
commit ef76725
Showing
4 changed files
with
83 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { JsonRpcProvider } from '@ethersproject/providers' | ||
import { expect } from 'chai' | ||
import { | ||
EthBridge, | ||
getEthBridgeInformation, | ||
getL2Network, | ||
} from '../../src/lib/dataEntities/networks' | ||
import dotenv from 'dotenv' | ||
dotenv.config() | ||
|
||
/** | ||
* Tests the getEthBridgeInformation function against the information | ||
* of Arbitrum One network (42161) | ||
*/ | ||
describe('Obtain deployed bridge addresses', () => { | ||
it('obtains deployed ETH Bridge addresses', async () => { | ||
const arbOneL2Network = await getL2Network(42161) | ||
const ethProvider = new JsonRpcProvider( | ||
process.env['MAINNET_RPC'] as string | ||
) | ||
|
||
// Obtain on-chain information | ||
const ethBridge: EthBridge = await getEthBridgeInformation( | ||
arbOneL2Network.ethBridge.rollup, | ||
ethProvider | ||
) | ||
|
||
// Obtained addresses should equal the addresses | ||
// available in Arbitrum One's l2Network configuration | ||
expect( | ||
arbOneL2Network.ethBridge.bridge, | ||
'Bridge contract is not correct' | ||
).to.eq(ethBridge.bridge) | ||
expect( | ||
arbOneL2Network.ethBridge.inbox, | ||
'Inbox contract is not correct' | ||
).to.eq(ethBridge.inbox) | ||
expect( | ||
arbOneL2Network.ethBridge.sequencerInbox, | ||
'SequencerInbox contract is not correct' | ||
).to.eq(ethBridge.sequencerInbox) | ||
expect( | ||
arbOneL2Network.ethBridge.outbox, | ||
'Outbox contract is not correct' | ||
).to.eq(ethBridge.outbox) | ||
}) | ||
}) |