Skip to content

fix(L1GraphTokenGateway): add a counterpartGateway getter for Router compatibility #748

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions contracts/gateway/L1GraphTokenGateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,16 @@ contract L1GraphTokenGateway is Initializable, GraphTokenGateway, L1ArbitrumMess
return l2GRT;
}

/**
* @notice Get the address of the L2GraphTokenGateway
* @dev This is added for compatibility with the Arbitrum Router's
* gateway registration process.
* @return Address of the L2 gateway connected to this gateway
*/
function counterpartGateway() external view returns (address) {
return l2Counterpart;
}

/**
* @notice Creates calldata required to create a retryable ticket
* @dev encodes the target function with its params which
Expand Down
3 changes: 2 additions & 1 deletion test/gateway/l1GraphTokenGateway.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,15 @@ describe('L1GraphTokenGateway', () => {
.setL2CounterpartAddress(mockL2Gateway.address)
await expect(tx).revertedWith('Only Controller governor')
})
it('sets L2Counterpart', async function () {
it('sets l2Counterpart which can be queried with counterpartGateway()', async function () {
const tx = l1GraphTokenGateway
.connect(governor.signer)
.setL2CounterpartAddress(mockL2Gateway.address)
await expect(tx)
.emit(l1GraphTokenGateway, 'L2CounterpartAddressSet')
.withArgs(mockL2Gateway.address)
expect(await l1GraphTokenGateway.l2Counterpart()).eq(mockL2Gateway.address)
expect(await l1GraphTokenGateway.counterpartGateway()).eq(mockL2Gateway.address)
})
})
describe('setEscrowAddress', function () {
Expand Down