Skip to content
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

release: 1.1.0 with solidity 0.8 bump #33

Merged
merged 236 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
236 commits
Select commit Hold shift + click to select a range
32d00e7
Add foundry config
gvladika Apr 3, 2023
694f54a
forge install: forge-std
gvladika Apr 3, 2023
80b5713
Add 1st Foundry testcase
gvladika Apr 4, 2023
20d53a9
Add eth/erc20 inbox mock
gvladika Apr 5, 2023
265aa2e
Implement token deposit for ERC20-based rollup, include Foundry test …
gvladika Apr 5, 2023
98cbd9f
Add missing param
gvladika Apr 5, 2023
cccd156
Run tests as Github actions
gvladika Apr 5, 2023
33e395c
Remove circleci config
gvladika Apr 5, 2023
72e3626
Put workflow file in the right place
gvladika Apr 5, 2023
d5f916e
Reconfigure CI triggers
gvladika Apr 5, 2023
792483c
Check DepositInitiated is correctly emitted
gvladika Apr 6, 2023
92a6810
Add more event checks
gvladika Apr 6, 2023
8354537
Use IL1ArbitrumGateway interface where possible
gvladika Apr 6, 2023
bbdbda1
Test outboundTransferCustomRefund
gvladika Apr 6, 2023
2c1a092
Test finalizeInboundTransfer
gvladika Apr 6, 2023
26d4cc8
Make L1OrbitERC20GatewayTest inherit from L1ERC20GatewayTest to avoid…
gvladika Apr 11, 2023
9fb72cd
Test failure conditions of outboundTransferCustomRefund
gvladika Apr 11, 2023
b9a819c
Dummy commit to trigger CI
gvladika Apr 11, 2023
f94013b
Add tests for L1NotContract
gvladika Apr 11, 2023
82361a5
Another one
gvladika Apr 11, 2023
b928f79
Add missing steps
gvladika Apr 11, 2023
025ee91
Merge branch 'erc20-based-bridge' into erc20-based-bridge-2
gvladika Apr 11, 2023
5281ee4
Reuse buildRouterEncodedData function in test to avoid test duplication
gvladika Apr 12, 2023
54cb935
Test getOutboundCalldata
gvladika Apr 12, 2023
0f3f56e
Test supportsInterface
gvladika Apr 12, 2023
fb97ab5
test encodeWithdrawal
gvladika Apr 12, 2023
ef122bf
Test reverts in initializer
gvladika Apr 12, 2023
ae2517e
Encode native token fee to the end of the user encoded message
gvladika Apr 13, 2023
60f0340
Merge branch 'erc20-based-bridge' into erc20-based-bridge-2
gvladika Apr 13, 2023
8182569
Test calculateL2TokenAddress
gvladika Apr 13, 2023
e8df968
Test postUpgradeInit reverts
gvladika Apr 13, 2023
0c5b797
Test finalizeInboundTransfer revert if invalid sender
gvladika Apr 13, 2023
9e155f1
Add missing event checks
gvladika Apr 13, 2023
a337acf
Test functions in extended gateway
gvladika Apr 13, 2023
5b0d2d5
Add test cases for transferExitAndCall
gvladika Apr 14, 2023
3a8482f
Add more transferExitAndCall tests
gvladika Apr 14, 2023
552cbf1
Cover more branches
gvladika Apr 14, 2023
fab2260
Add test cases for router init
gvladika Apr 17, 2023
8cb573a
Move all sol files to Solidity 0.8, fix compiler errors
gvladika Apr 20, 2023
20db956
Test setting the default gateway
gvladika Apr 21, 2023
3a0c1d8
Add storage layout check to CI
gvladika Apr 21, 2023
4a61929
Update yarn.lock
gvladika Apr 21, 2023
cf54c0b
Fix workflow
gvladika Apr 21, 2023
5e08af4
Merge branch 'solidity-0.8' into move-to-solidity-0.8
gvladika Apr 21, 2023
128a164
Remove visibility from constructors
gvladika Apr 24, 2023
c099733
Use custom ERC20Upgradeablei implementation to avoid changes in stora…
gvladika Apr 24, 2023
9834a35
Remove SafeMath as we're using Solidity 0.8
gvladika Apr 24, 2023
eaf7dcb
Remove unused import
gvladika Apr 24, 2023
368ffcc
Don't run jobs on every push
gvladika Apr 24, 2023
cf6151b
Merge branch 'move-to-solidity-0.8' into erc20-based-bridge
gvladika Apr 24, 2023
423684a
Switch to SOlidity 0.8
gvladika Apr 24, 2023
1d5a15f
Merge branch 'erc20-based-bridge' into erc20-based-bridge-2
gvladika Apr 24, 2023
a86a493
Adjust expected revert msg
gvladika Apr 24, 2023
5474126
Merge branch 'erc20-based-bridge-2' into orbit-extended-gw-test
gvladika Apr 24, 2023
02f5485
Update to 0.8
gvladika Apr 24, 2023
a907de0
Merge branch 'orbit-extended-gw-test' into orbit-router-test
gvladika Apr 24, 2023
f3d259d
Switch to solidity 0.8
gvladika Apr 24, 2023
e2e5ddb
Test setOwner
gvladika Apr 24, 2023
31f5184
Add library to contract
gvladika Apr 25, 2023
1e6542d
Add test for setGateway
gvladika Apr 26, 2023
c24e7f7
Add revert test cases for setGateway
gvladika Apr 26, 2023
82acd24
More test for setGateway
gvladika Apr 26, 2023
a8e2f1f
Test supportsInterface
gvladika Apr 27, 2023
fc11760
Test router's outboundTransfer
gvladika Apr 28, 2023
6598054
Add more coverage
gvladika Apr 28, 2023
8e75c92
Test getGateway
gvladika May 2, 2023
a6520af
Add @dev comment for isArbitrumEnabled
gvladika May 2, 2023
be2975e
Implement L1OrbitGatewayRouter and its test cases
gvladika May 2, 2023
d78c56a
Add L1OrbitCustomGateway implementation
gvladika May 3, 2023
982518a
Implement test cases for L1CustomGateway
gvladika May 4, 2023
25ce3ab
Implement test cases for L1OrbitCustomGatewayTest
gvladika May 4, 2023
d109210
Implement missing TCs
gvladika May 5, 2023
8b8645f
Check functions without nativeTokenFee are reverting
gvladika May 5, 2023
5a4a199
Add natspec
gvladika May 5, 2023
96fa019
Add comments for missing params
gvladika May 5, 2023
0638a23
Add L1ReverseCustomGateway test cases
gvladika May 8, 2023
bd9250d
Implement and test L1OrbitReverseCustomGateway
gvladika May 8, 2023
64cfba6
Revert if token being deposited is native fee token
gvladika May 10, 2023
571eead
Add script for connecting to local network
gvladika May 11, 2023
03fecc0
Add native token transfers from user to the inbox
gvladika May 18, 2023
40c2d7a
Refactor native token flow
gvladika May 19, 2023
bdb6d59
Use isRouter()
gvladika May 19, 2023
981bd97
Fuzz constraints
gvladika May 19, 2023
1264253
Add setup for integration tests
gvladika May 16, 2023
ba6306d
Merge branch 'orbit-token-flow' into orbit-deployer
gvladika May 22, 2023
decaefa
Add integration tests for L1 Orbit
gvladika May 23, 2023
9b1371c
Finish orbit token bridge deployer scripts
gvladika May 24, 2023
03424af
Add end2end test for token deposit
gvladika May 25, 2023
16f6575
Add withdrawal e2e test
gvladika May 25, 2023
44ec120
Decrease retry period
gvladika May 25, 2023
fe612be
Merge pull request #9 from OffchainLabs/orbit-token-flow
gvladika May 29, 2023
16b4af5
Merge pull request #8 from OffchainLabs/orbit-reverse-gateways
gvladika May 29, 2023
7c05a54
Merge pull request #7 from OffchainLabs/orbit-router-test
gvladika May 29, 2023
71ebece
Merge pull request #5 from OffchainLabs/orbit-extended-gw-test
gvladika May 29, 2023
432957d
Merge pull request #4 from OffchainLabs/erc20-based-bridge-2
gvladika May 29, 2023
b661def
Merge branch 'orbit' into erc20-based-bridge
gvladika May 29, 2023
feda0f7
Use library, formatting
gvladika May 29, 2023
f0f78ff
Use feature-orbit-bridge branch of nitro-contracts
gvladika Jun 1, 2023
77dfa6f
Update path
gvladika Jun 1, 2023
a071786
Update submodule commits
gvladika Jun 1, 2023
ac2fad1
Merge pull request #6 from OffchainLabs/move-to-solidity-0.8
gvladika Jun 4, 2023
63f3bb1
Add yarn action for running e2e Orbit test in local test env
gvladika Jun 4, 2023
1fd99ff
Merge branch 'erc20-based-bridge' into orbit-deployer
gvladika Jun 4, 2023
5e98fa6
Add TypeScript deployer for token bridge
gvladika Jun 26, 2023
51f1995
In test token implementation, re-set native token allowance to 0
gvladika Jun 27, 2023
63270b0
Merge pull request #35 from OffchainLabs/orbit-deployer
gvladika Jun 27, 2023
4c42008
Add Hardhat test which checks token bridge is properly deployed
gvladika Jun 27, 2023
eb3cfb3
Add 1st implementation of token bridge L1&L2 factories
gvladika Jun 29, 2023
34e6fe2
Deploy and init L2 token bridge contracts in the same TX
gvladika Jun 29, 2023
033c233
Add plugin for checking contract sizes
gvladika Jul 3, 2023
26d02bb
Add 1st phase of atomic token bridge cross-chain deployer
gvladika Jul 3, 2023
80075af
Deploy L2 router using retryable
gvladika Jul 3, 2023
95c1431
Deploy L2 standard gateway using retryable
gvladika Jul 3, 2023
5e2954f
Deploy L2 custom gateway via retryable
gvladika Jul 3, 2023
82fa746
Use create2 instead of create3
gvladika Jul 3, 2023
fb444a6
Compute expected L2 addresses from L1 creator
gvladika Jul 4, 2023
94da561
Use computed L2 addresses to init everything properly
gvladika Jul 4, 2023
a9e9d56
Use library for L2 salts
gvladika Jul 4, 2023
093b26b
Use 2 retryables instead of 4
gvladika Jul 4, 2023
097c526
Estimate gas for retryables instead of hard-coding it
gvladika Jul 5, 2023
2ddc38a
deployL2Contracts can only be executed once
gvladika Jul 5, 2023
2e51766
Use L1Factory's address as part of salt calculation
gvladika Jul 5, 2023
bd7c8c9
Formatting, add some docs
gvladika Jul 5, 2023
5535694
Remove comment
gvladika Jul 5, 2023
30c233e
Deploy L2 Weth and WethGateway
gvladika Jul 5, 2023
ccf17c9
Update tests and fix weth bugs
gvladika Jul 5, 2023
f935423
Use CREATE2 on L1 as well, using inbox address in the salt
gvladika Jul 6, 2023
eca0062
Set rollup owner to own token bridge
gvladika Jul 6, 2023
d9bc08d
Add registry for non-canonical routers
gvladika Jul 6, 2023
9bacef0
Rename computeExpected -> getCanonical
gvladika Jul 6, 2023
5b50028
Use encodeCall, update event
gvladika Jul 6, 2023
b68888a
Use struct for L2 bytecode
gvladika Jul 6, 2023
b5275ba
Calculate maxSubmissionCost dynamically and refund the excess
gvladika Jul 6, 2023
a922cae
Make L1 creator upgradeable
gvladika Jul 7, 2023
29f119d
Use dummy logic as create2 address seed
gvladika Jul 8, 2023
267e19f
Add token bridge deployment test to CI
gvladika Jul 10, 2023
5d451b2
Match sequencer container using regex
gvladika Jul 10, 2023
522223a
Fix CI
gvladika Jul 10, 2023
a00f269
Remove factories that use 3-TX deployment of token bridge
gvladika Jul 10, 2023
1dac98a
Use pre-set gas limit for deploying L2 factory
gvladika Jul 11, 2023
22545ce
Separate L2 deployment to different contract
gvladika Jul 11, 2023
dc4ca51
Do runtime to creation code conversion on L2
gvladika Jul 11, 2023
5e130e5
Add more code comments
gvladika Jul 12, 2023
66292b2
Add comment that only 1 token bridge can be deployed per inbox
gvladika Jul 12, 2023
96fe4ca
Move logic for creating L2 side of token bridge to retryable sender c…
gvladika Jul 12, 2023
25ee719
Merge branch 'token-bridge-factory' into erc20-based-bridge
gvladika Jul 13, 2023
060c7d3
Remove unused non-atomic deployers
gvladika Jul 14, 2023
c99d9bb
Separate deployment of token bridge creator from chain specific setup
gvladika Jul 14, 2023
2f21679
Add script that deploys token bridge creator to ArbGoerli
gvladika Jul 14, 2023
33fb2c1
Add script for creating token bridge for Orbit rollup
gvladika Jul 14, 2023
8bb7316
Polish up script for creating new token bridge on Goerli
gvladika Jul 17, 2023
c00bdbd
Only L1 creator can call sendRetryable of L1TokenBridgeRetryableSender
gvladika Jul 17, 2023
33cc402
Update L1Creator Goerli address
gvladika Jul 17, 2023
d0dba75
Support testing both local and goerli deployment
gvladika Jul 18, 2023
f371c57
Merge branch 'token-bridge-factory' into erc20-based-bridge
gvladika Jul 25, 2023
902206e
Set correct templates if fee token is used
gvladika Jul 27, 2023
adf7f4b
Add support for fee token based retryables
gvladika Jul 27, 2023
db4a222
Move fee tokens to inbox to pay for retryables
gvladika Jul 27, 2023
a0029a8
Move getter for canonical L1 router address to L1 creator
gvladika Jul 27, 2023
f399dfa
Init retryable sender from init of L1 creator
gvladika Jul 27, 2023
c6ba878
Adjust script for deploying creator
gvladika Jul 27, 2023
9f0ca76
Fix L1 router address calculation
gvladika Jul 28, 2023
43542bb
Send correct bytecode to L2
gvladika Jul 28, 2023
0e9cc76
Update test script
gvladika Jul 28, 2023
46647a9
Remove unnecessary scripts
gvladika Jul 28, 2023
79bf267
Use existing proxy admin
gvladika Aug 4, 2023
b0edcfd
Do not use IEthInbox interface
gvladika Aug 4, 2023
f52ae5b
Merge branch 'erc20-based-bridge' into fee-token-deployer
gvladika Aug 4, 2023
cd35fef
Deploy UpgradeExecutor to L2
gvladika Aug 6, 2023
ab468c1
Refactor upgrade executor flow
gvladika Aug 6, 2023
18ec4b6
Rename env vars
gvladika Aug 6, 2023
6f7ad28
Make verifivier script more complete
gvladika Aug 6, 2023
c4c517d
Fix deployment test
gvladika Aug 7, 2023
38083c7
Use lower case in tests
gvladika Aug 7, 2023
3ca96b2
Don't check weth stuff in case of fee token
gvladika Aug 7, 2023
d5998c2
Use upgrade executor from npm package
gvladika Aug 18, 2023
d6b7ff6
Deploy Multicall on L3
gvladika Aug 19, 2023
30cdd75
Decrease contract size by not hashing the salt prefix
gvladika Aug 19, 2023
eeac040
Prepare crosschain hardhat tests for CI
gvladika Aug 25, 2023
d803053
Add comments
gvladika Aug 25, 2023
db20781
Merge branch 'erc20-based-bridge' into fee-token-deployer
gvladika Aug 25, 2023
14a2311
Merge branch 'fee-token-deployer' into use-executor
gvladika Aug 25, 2023
864fa61
Update address
gvladika Aug 25, 2023
9d8cc95
Revert with custom error if deployment already exists
gvladika Aug 31, 2023
e773cc2
Extract proxy deployments to _deploySeedProxy
gvladika Aug 31, 2023
b157eb9
Add function descriptions
gvladika Aug 31, 2023
a93fef9
Extract L2 proxy address calculation
gvladika Aug 31, 2023
2ebf605
Merge branch 'token-bridge-factory' into erc20-based-bridge
gvladika Aug 31, 2023
2d77950
Merge branch 'erc20-based-bridge' into fee-token-deployer
gvladika Aug 31, 2023
1525d26
Merge branch 'fee-token-deployer' into use-executor
gvladika Aug 31, 2023
2ecec9a
Update smart contracts and script to reflect latest rollup ownership …
gvladika Sep 1, 2023
8aca119
Add docs for computeAddress function
gvladika Sep 7, 2023
07234a0
Merge branch 'token-bridge-factory' into erc20-based-bridge
gvladika Sep 7, 2023
09c9715
Merge pull request #38 from OffchainLabs/use-executor
gvladika Sep 7, 2023
1f2121f
Add docs for computeAddress function
gvladika Sep 7, 2023
6396a17
Merge branch 'add-storage-check' into solidity-0.8
gzeoneth Sep 7, 2023
6cb2060
Verify retyrable sender was not frontrun
gvladika Sep 7, 2023
7606ab6
Use chainId in salt for L2 contracts.
gvladika Sep 8, 2023
ee8c5aa
Merge pull request #41 from OffchainLabs/use-chain-id
gvladika Sep 11, 2023
b408bcf
Merge branch 'erc20-based-bridge' into fee-token-deployer
gvladika Sep 11, 2023
ce11f80
Merge pull request #37 from OffchainLabs/fee-token-deployer
gvladika Sep 11, 2023
9503d3c
Verify all contracts after deployment
gvladika Sep 12, 2023
02fc940
chore: bumps hardhat to v2.17.3
douglance Sep 19, 2023
e580b98
setGateways() in OrbitGatewayRouter should not be payable
tsite Oct 3, 2023
82c5375
Require there is ether sent in erc20 token bridge
gvladika Oct 5, 2023
044d8d2
Make forceRegisterTokenToL2 in L1OrbitCustomGateway non payable
gvladika Oct 5, 2023
04aa5e6
Merge pull request #44 from OffchainLabs/audit-updates
gvladika Oct 9, 2023
95b2c40
Merge pull request #43 from tsite/erc20-based-bridge
gvladika Oct 9, 2023
c68b22b
Merge pull request #34 from OffchainLabs/erc20-based-bridge
gvladika Oct 9, 2023
cf0be18
Merge pull request #36 from OffchainLabs/token-bridge-factory
gvladika Oct 9, 2023
fc6838a
Merge branch 'solidity-0.8' into dl/bump-hardhat
gvladika Oct 11, 2023
e74dea7
Add missing package
gvladika Oct 11, 2023
109288b
Move dependency
gvladika Oct 11, 2023
45c1cca
Merge pull request #42 from OffchainLabs/dl/bump-hardhat
gvladika Oct 11, 2023
b2770ba
Make verification configurable
gvladika Oct 11, 2023
6264c2b
Adjust local token bridge deployment to use L2+L3
gvladika Oct 11, 2023
5184d9f
Merge branch 'main' into solidity-0.8
gvladika Oct 11, 2023
cd57cc6
Temporary remove test of TokenBridgeCreator from CI until fee token i…
gvladika Oct 11, 2023
707ae56
chore: release only token bridge contracts
gzeoneth Oct 11, 2023
8667fb0
v1.1.0-beta.0
gzeoneth Oct 11, 2023
c04d6ea
Bump executor to support CALL
gvladika Oct 12, 2023
6e348a8
Merge pull request #45 from OffchainLabs/bump-executor
gzeoneth Oct 12, 2023
ae6e365
v1.1.0-beta.1
gzeoneth Oct 12, 2023
cdfff8e
Hard-code random address for L1Weth
gvladika Oct 13, 2023
5426001
Merge branch 'solidity-0.8' into adjust-scripts
gvladika Oct 13, 2023
84d3593
Use specific user account for dpeloying token bridge
gvladika Oct 20, 2023
2cdfd07
Add getter for L2 multicall address
gvladika Oct 20, 2023
8d006e6
Store ref to L1 multicall in token bridge cretor for convenience
gvladika Oct 20, 2023
c331f28
Move l2MulticallTemplate to constructor
gvladika Oct 20, 2023
b693824
Update contracts/tokenbridge/ethereum/L1AtomicTokenBridgeCreator.sol
gvladika Oct 20, 2023
9c9ae67
Merge pull request #47 from OffchainLabs/add-multicall-getters
gvladika Oct 20, 2023
ee67a82
Merge pull request #46 from OffchainLabs/adjust-scripts
gvladika Oct 20, 2023
ca105d9
v1.1.0-beta.2
gzeoneth Oct 20, 2023
74eb6e0
Update depluyer script to provide multicall
gvladika Oct 20, 2023
b5b64b0
Merge pull request #48 from OffchainLabs/update-deployer-script
gvladika Oct 21, 2023
f6de91d
v1.1.0
gzeoneth Oct 26, 2023
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
23 changes: 0 additions & 23 deletions .circleci/config.yml

This file was deleted.

30 changes: 30 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build and test

on:
workflow_dispatch:
pull_request:

jobs:
test-unit:
name: Test storage layout
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Setup node/yarn
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'

- name: Install packages
run: yarn

- name: Build
run: yarn build

- name: Test Storage Layouts
run: yarn run test:storage
2 changes: 1 addition & 1 deletion contracts/rpc-utils/NodeInterface.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// solhint-disable-next-line compiler-version
pragma solidity >=0.4.21 <0.7.0;
pragma solidity >=0.4.21 <0.9.0;

/** @title Interface for providing Outbox proof data
* @notice This contract doesn't exist on-chain. Instead it is a virtual interface accessible at 0x00000000000000000000000000000000000000C8
Expand Down
2 changes: 1 addition & 1 deletion contracts/rpc-utils/RetryableTicketCreator.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// solhint-disable-next-line compiler-version
pragma solidity >=0.4.21 <0.7.0;
pragma solidity >=0.4.21 <0.9.0;

interface RetryableTicketCreator {
/**
Expand Down
2 changes: 1 addition & 1 deletion contracts/tokenbridge/arbitrum/L2ArbitrumMessenger.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

pragma solidity ^0.6.11;
pragma solidity ^0.8.0;

import "@arbitrum/nitro-contracts/src/precompiles/ArbSys.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/tokenbridge/arbitrum/StandardArbERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

pragma solidity ^0.6.11;
pragma solidity ^0.8.0;

import "../libraries/Cloneable.sol";
import "../libraries/L2GatewayToken.sol";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

pragma solidity ^0.6.11;
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/utils/Address.sol";
import "../../libraries/AddressAliasHelper.sol";
Expand Down
4 changes: 1 addition & 3 deletions contracts/tokenbridge/arbitrum/gateway/L2CustomGateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@
* limitations under the License.
*/

pragma solidity ^0.6.11;
pragma solidity ^0.8.0;

import "./L2ArbitrumGateway.sol";
import "../../libraries/gateway/ICustomGateway.sol";

import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract L2CustomGateway is L2ArbitrumGateway, ICustomGateway {
Expand Down
4 changes: 2 additions & 2 deletions contracts/tokenbridge/arbitrum/gateway/L2ERC20Gateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
* limitations under the License.
*/

pragma solidity ^0.6.11;
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/proxy/UpgradeableBeacon.sol";
import "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol";
import "@openzeppelin/contracts/utils/Create2.sol";
import "./L2ArbitrumGateway.sol";
import "../StandardArbERC20.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/tokenbridge/arbitrum/gateway/L2GatewayRouter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

pragma solidity ^0.6.11;
pragma solidity ^0.8.0;

import "../../libraries/gateway/GatewayRouter.sol";
import "../../ethereum/gateway/L1GatewayRouter.sol";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@
* limitations under the License.
*/

pragma solidity ^0.6.11;
pragma solidity ^0.8.0;

import "./L2CustomGateway.sol";

import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

/**
* @title L2 Gateway for reverse "custom" bridging functionality
Expand Down Expand Up @@ -58,6 +56,6 @@ contract L2ReverseCustomGateway is L2CustomGateway {
// and after to calculate the amount of tokens that were transferred
IERC20(_l2Token).safeTransferFrom(_from, address(this), _amount);
uint256 postBalance = IERC20(_l2Token).balanceOf(address(this));
return SafeMath.sub(postBalance, prevBalance);
return postBalance - prevBalance;
}
}
4 changes: 2 additions & 2 deletions contracts/tokenbridge/arbitrum/gateway/L2WethGateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
* limitations under the License.
*/

pragma solidity ^0.6.11;
pragma solidity ^0.8.0;

import "./L2ArbitrumGateway.sol";
import "../../libraries/IWETH9.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

contract L2WethGateway is L2ArbitrumGateway {
using SafeERC20 for IERC20;
Expand Down
4 changes: 3 additions & 1 deletion contracts/tokenbridge/ethereum/ICustomToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
pragma solidity >=0.6.9 <0.9.0;

interface ArbitrumEnabledToken {
/// @notice should return `0xa4b1` if token is enabled for arbitrum gateways
/// @notice should return `0xb1` if token is enabled for arbitrum gateways
/// @dev Previous implmentation used to return `uint8(0xa4b1)`, however that causes compile time error in Solidity 0.8. due to type mismatch.
/// In current version `uint8(0xb1)` shall be returned, which results in no change as that's the same value as truncated `uint8(0xa4b1)`.
function isArbitrumEnabled() external view returns (uint8);
}

Expand Down
2 changes: 1 addition & 1 deletion contracts/tokenbridge/ethereum/L1ArbitrumMessenger.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

pragma solidity ^0.6.11;
pragma solidity ^0.8.0;

import "@arbitrum/nitro-contracts/src/bridge/IInbox.sol";
import "@arbitrum/nitro-contracts/src/bridge/IOutbox.sol";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

pragma solidity ^0.6.11;
pragma solidity ^0.8.0;

import "../../libraries/ITransferAndCall.sol";

Expand All @@ -31,6 +31,8 @@ interface ITradeableExitReceiver {
}

abstract contract L1ArbitrumExtendedGateway is L1ArbitrumGateway {
using Address for address;

struct ExitData {
bool isExit;
address _newTo;
Expand Down
7 changes: 3 additions & 4 deletions contracts/tokenbridge/ethereum/gateway/L1ArbitrumGateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@
* limitations under the License.
*/

pragma solidity ^0.6.11;
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Create2.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../L1ArbitrumMessenger.sol";
import "./IL1ArbitrumGateway.sol";
import "../../libraries/ProxyUtil.sol";
Expand Down Expand Up @@ -298,7 +297,7 @@ abstract contract L1ArbitrumGateway is
uint256 prevBalance = IERC20(_l1Token).balanceOf(address(this));
IERC20(_l1Token).safeTransferFrom(_from, address(this), _amount);
uint256 postBalance = IERC20(_l1Token).balanceOf(address(this));
return SafeMath.sub(postBalance, prevBalance);
return postBalance - prevBalance;
}

function getOutboundCalldata(
Expand Down
6 changes: 3 additions & 3 deletions contracts/tokenbridge/ethereum/gateway/L1CustomGateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

pragma solidity ^0.6.11;
pragma solidity ^0.8.0;

import { ArbitrumEnabledToken } from "../ICustomToken.sol";
import "./L1ArbitrumExtendedGateway.sol";
Expand Down Expand Up @@ -113,7 +113,7 @@ contract L1CustomGateway is L1ArbitrumExtendedGateway, ICustomGateway {
* @param l1ERC20 address of L1 token
* @return L2 address of a bridged ERC20 token
*/
function calculateL2TokenAddress(address l1ERC20) public view override returns (address) {
function calculateL2TokenAddress(address l1ERC20) public view override(ITokenGateway, TokenGateway) returns (address) {
return l1ToL2Token[l1ERC20];
}

Expand Down Expand Up @@ -151,7 +151,7 @@ contract L1CustomGateway is L1ArbitrumExtendedGateway, ICustomGateway {
address _creditBackAddress
) public payable virtual returns (uint256) {
require(
ArbitrumEnabledToken(msg.sender).isArbitrumEnabled() == uint8(0xa4b1),
ArbitrumEnabledToken(msg.sender).isArbitrumEnabled() == uint8(0xb1),
"NOT_ARB_ENABLED"
);

Expand Down
4 changes: 2 additions & 2 deletions contracts/tokenbridge/ethereum/gateway/L1ERC20Gateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

pragma solidity ^0.6.11;
pragma solidity ^0.8.0;

import "./L1ArbitrumExtendedGateway.sol";
import "@openzeppelin/contracts/utils/Create2.sol";
Expand Down Expand Up @@ -149,7 +149,7 @@ contract L1ERC20Gateway is L1ArbitrumExtendedGateway {
return outboundCalldata;
}

function calculateL2TokenAddress(address l1ERC20) public view override returns (address) {
function calculateL2TokenAddress(address l1ERC20) public view override(ITokenGateway, TokenGateway) returns (address) {
bytes32 salt = getSalt(l1ERC20);
return Create2.computeAddress(salt, cloneableProxyHash, l2BeaconProxyFactory);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

pragma solidity ^0.6.11;
pragma solidity ^0.8.0;

import "./L1ReverseCustomGateway.sol";

Expand Down
7 changes: 5 additions & 2 deletions contracts/tokenbridge/ethereum/gateway/L1GatewayRouter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

pragma solidity ^0.6.11;
pragma solidity ^0.8.0;

import "../../libraries/Whitelist.sol";

Expand All @@ -39,6 +39,8 @@ contract L1GatewayRouter is
ERC165,
IL1GatewayRouter
{
using Address for address;

address public override owner;
address public override inbox;

Expand Down Expand Up @@ -185,9 +187,10 @@ contract L1GatewayRouter is
address _creditBackAddress
) public payable override returns (uint256) {
require(
ArbitrumEnabledToken(msg.sender).isArbitrumEnabled() == uint8(0xa4b1),
ArbitrumEnabledToken(msg.sender).isArbitrumEnabled() == uint8(0xb1),
"NOT_ARB_ENABLED"
);

require(_gateway.isContract(), "NOT_TO_CONTRACT");

address currGateway = getGateway(msg.sender);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@
* limitations under the License.
*/

pragma solidity ^0.6.11;
pragma solidity ^0.8.0;

import "./L1CustomGateway.sol";

import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

/**
Expand Down
6 changes: 3 additions & 3 deletions contracts/tokenbridge/ethereum/gateway/L1WethGateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
* limitations under the License.
*/

pragma solidity ^0.6.11;
pragma solidity ^0.8.0;

import "@arbitrum/nitro-contracts/src/bridge/IInbox.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../../libraries/IWETH9.sol";
import "../../test/TestWETH9.sol";
Expand Down Expand Up @@ -101,7 +101,7 @@ contract L1WethGateway is L1ArbitrumExtendedGateway {
* @param l1ERC20 address of L1 token
* @return L2 address of a bridged ERC20 token
*/
function calculateL2TokenAddress(address l1ERC20) public view override returns (address) {
function calculateL2TokenAddress(address l1ERC20) public view override(ITokenGateway, TokenGateway) returns (address) {
if (l1ERC20 != l1Weth) {
// invalid L1 weth address
return address(0);
Expand Down
10 changes: 7 additions & 3 deletions contracts/tokenbridge/libraries/AddressAliasHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

pragma solidity ^0.6.11;
pragma solidity ^0.8.0;

library AddressAliasHelper {
uint160 constant offset = uint160(0x1111000000000000000000000000000000001111);
Expand All @@ -26,14 +26,18 @@ library AddressAliasHelper {
/// @param l1Address the address in the L1 that triggered the tx to L2
/// @return l2Address L2 address as viewed in msg.sender
function applyL1ToL2Alias(address l1Address) internal pure returns (address l2Address) {
l2Address = address(uint160(l1Address) + offset);
unchecked {
l2Address = address(uint160(l1Address) + offset);
}
}

/// @notice Utility function that converts the msg.sender viewed in the L2 to the
/// address in the L1 that submitted a tx to the inbox
/// @param l2Address L2 address as viewed in msg.sender
/// @return l1Address the address in the L1 that triggered the tx to L2
function undoL1ToL2Alias(address l2Address) internal pure returns (address l1Address) {
l1Address = address(uint160(l2Address) - offset);
unchecked {
l1Address = address(uint160(l2Address) - offset);
}
}
}
2 changes: 1 addition & 1 deletion contracts/tokenbridge/libraries/BytesLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* The library lets you concatenate, slice and type cast bytes arrays both in memory and storage.
*/

pragma solidity ^0.6.11;
pragma solidity ^0.8.0;

/* solhint-disable no-inline-assembly */
library BytesLib {
Expand Down
Loading