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
96043725
Unverified
Commit
96043725
authored
Dec 01, 2023
by
Mark Tyneway
Committed by
Maurelian
Dec 05, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
contracts-bedrock: more cleanup
parent
fbc474f7
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
102 additions
and
64 deletions
+102
-64
l1erc721bridge.go
op-bindings/bindings/l1erc721bridge.go
+47
-16
l1erc721bridge_more.go
op-bindings/bindings/l1erc721bridge_more.go
+2
-2
l2erc721bridge.go
op-bindings/bindings/l2erc721bridge.go
+18
-18
l2erc721bridge_more.go
op-bindings/bindings/l2erc721bridge_more.go
+2
-2
config.go
op-chain-ops/genesis/config.go
+2
-2
immutables.go
op-chain-ops/immutables/immutables.go
+3
-7
immutables_test.go
op-chain-ops/immutables/immutables_test.go
+2
-2
ChainAssertions.sol
packages/contracts-bedrock/scripts/ChainAssertions.sol
+2
-2
Deploy.s.sol
packages/contracts-bedrock/scripts/Deploy.s.sol
+1
-2
L1ERC721Bridge.sol
packages/contracts-bedrock/src/L1/L1ERC721Bridge.sol
+11
-3
L2ERC721Bridge.sol
packages/contracts-bedrock/src/L2/L2ERC721Bridge.sol
+1
-2
ERC721Bridge.sol
packages/contracts-bedrock/src/universal/ERC721Bridge.sol
+9
-4
ExtendedPause.t.sol
packages/contracts-bedrock/test/ExtendedPause.t.sol
+2
-2
No files found.
op-bindings/bindings/l1erc721bridge.go
View file @
96043725
This diff is collapsed.
Click to expand it.
op-bindings/bindings/l1erc721bridge_more.go
View file @
96043725
This diff is collapsed.
Click to expand it.
op-bindings/bindings/l2erc721bridge.go
View file @
96043725
This diff is collapsed.
Click to expand it.
op-bindings/bindings/l2erc721bridge_more.go
View file @
96043725
This diff is collapsed.
Click to expand it.
op-chain-ops/genesis/config.go
View file @
96043725
...
...
@@ -757,11 +757,11 @@ func NewL2ImmutableConfig(config *DeployConfig, block *types.Block) (*immutables
GovernanceToken
:
struct
{}{},
LegacyMessagePasser
:
struct
{}{},
L2ERC721Bridge
:
struct
{
Messenger
common
.
Address
OtherBridge
common
.
Address
Messenger
common
.
Address
}{
Messenger
:
predeploys
.
L2CrossDomainMessengerAddr
,
OtherBridge
:
config
.
L1ERC721BridgeProxy
,
Messenger
:
predeploys
.
L2CrossDomainMessengerAddr
,
},
OptimismMintableERC721Factory
:
struct
{
Bridge
common
.
Address
...
...
op-chain-ops/immutables/immutables.go
View file @
96043725
...
...
@@ -45,8 +45,8 @@ type PredeploysImmutableConfig struct {
GovernanceToken
struct
{}
LegacyMessagePasser
struct
{}
L2ERC721Bridge
struct
{
Messenger
common
.
Address
OtherBridge
common
.
Address
Messenger
common
.
Address
}
OptimismMintableERC721Factory
struct
{
Bridge
common
.
Address
...
...
@@ -230,15 +230,11 @@ func l2ImmutableDeployer(backend *backends.SimulatedBackend, opts *bind.Transact
}
_
,
tx
,
_
,
err
=
bindings
.
DeployOptimismMintableERC20Factory
(
opts
,
backend
,
bridge
)
case
"L2ERC721Bridge"
:
messenger
,
ok
:=
deployment
.
Args
[
0
]
.
(
common
.
Address
)
if
!
ok
{
return
nil
,
fmt
.
Errorf
(
"invalid type for messenger"
)
}
otherBridge
,
ok
:=
deployment
.
Args
[
1
]
.
(
common
.
Address
)
otherBridge
,
ok
:=
deployment
.
Args
[
0
]
.
(
common
.
Address
)
if
!
ok
{
return
nil
,
fmt
.
Errorf
(
"invalid type for otherBridge"
)
}
_
,
tx
,
_
,
err
=
bindings
.
DeployL2ERC721Bridge
(
opts
,
backend
,
messenger
,
otherBridge
)
_
,
tx
,
_
,
err
=
bindings
.
DeployL2ERC721Bridge
(
opts
,
backend
,
otherBridge
)
case
"OptimismMintableERC721Factory"
:
bridge
,
ok
:=
deployment
.
Args
[
0
]
.
(
common
.
Address
)
if
!
ok
{
...
...
op-chain-ops/immutables/immutables_test.go
View file @
96043725
...
...
@@ -43,11 +43,11 @@ func TestBuildOptimism(t *testing.T) {
GovernanceToken
:
struct
{}{},
LegacyMessagePasser
:
struct
{}{},
L2ERC721Bridge
:
struct
{
Messenger
common
.
Address
OtherBridge
common
.
Address
Messenger
common
.
Address
}{
Messenger
:
common
.
HexToAddress
(
"0x1234567890123456789012345678901234567890"
),
OtherBridge
:
common
.
HexToAddress
(
"0x1234567890123456789012345678901234567890"
),
Messenger
:
predeploys
.
L2CrossDomainMessengerAddr
,
},
OptimismMintableERC721Factory
:
struct
{
Bridge
common
.
Address
...
...
packages/contracts-bedrock/scripts/ChainAssertions.sol
View file @
96043725
...
...
@@ -144,9 +144,9 @@ library ChainAssertions {
require(bridge.OTHER_BRIDGE() == Predeploys.L2_ERC721_BRIDGE);
require(bridge.otherBridge() == Predeploys.L2_ERC721_BRIDGE);
if (_isProxy) {
require(address(bridge.super
C
hainConfig()) == _contracts.SuperchainConfig);
require(address(bridge.super
c
hainConfig()) == _contracts.SuperchainConfig);
} else {
require(address(bridge.super
C
hainConfig()) == address(0));
require(address(bridge.super
c
hainConfig()) == address(0));
}
}
...
...
packages/contracts-bedrock/scripts/Deploy.s.sol
View file @
96043725
...
...
@@ -678,8 +678,7 @@ contract Deploy is Deployer {
console.log("Deploying L1ERC721Bridge implementation");
address l1CrossDomainMessengerProxy = mustGetAddress("L1CrossDomainMessengerProxy");
L1ERC721Bridge bridge = new L1ERC721Bridge{ salt: _implSalt() }({
_messenger: l1CrossDomainMessengerProxy,
_otherBridge: Predeploys.L2_ERC721_BRIDGE
_messenger: l1CrossDomainMessengerProxy
});
save("L1ERC721Bridge", address(bridge));
...
...
packages/contracts-bedrock/src/L1/L1ERC721Bridge.sol
View file @
96043725
...
...
@@ -19,21 +19,28 @@ contract L1ERC721Bridge is ERC721Bridge, ISemver {
/// by ID was deposited for a given L2 token.
mapping(address => mapping(address => mapping(uint256 => bool))) public deposits;
/// @notice Address of the SuperchainConfig contract.
SuperchainConfig public superchainConfig;
/// @notice Semantic version.
/// @custom:semver 1.5.0
string public constant version = "1.5.0";
/// @notice Constructs the L1ERC721Bridge contract.
/// @param _messenger Address of the CrossDomainMessenger on this network.
/// @param _otherBridge Address of the ERC721 bridge on the other network.
constructor(address _messenger, address _otherBridge) ERC721Bridge(_messenger, _otherBridge) {
constructor(address _messenger) ERC721Bridge(_messenger, Predeploys.L2_ERC721_BRIDGE) {
initialize(SuperchainConfig(address(0)));
}
/// @notice Initializes the contract.
/// @param _superchainConfig Address of the SuperchainConfig contract on this network.
function initialize(SuperchainConfig _superchainConfig) public initializer {
superChainConfig = _superchainConfig;
superchainConfig = _superchainConfig;
}
/// @inheritdoc ERC721Bridge
function paused() public view override returns (bool) {
return superchainConfig.paused();
}
/// @notice Completes an ERC721 bridge from the other domain and sends the ERC721 token to the
...
...
@@ -57,6 +64,7 @@ contract L1ERC721Bridge is ERC721Bridge, ISemver {
external
onlyOtherBridge
{
require(paused() == false, "L1ERC721Bridge: paused");
require(_localToken != address(this), "L1ERC721Bridge: local token cannot be self");
// Checks that the L1/L2 NFT pair has a token ID that is escrowed in the L1 Bridge.
...
...
packages/contracts-bedrock/src/L2/L2ERC721Bridge.sol
View file @
96043725
...
...
@@ -24,9 +24,8 @@ contract L2ERC721Bridge is ERC721Bridge, ISemver {
string public constant version = "1.5.0";
/// @notice Constructs the L2ERC721Bridge contract.
/// @param _messenger Address of the CrossDomainMessenger on this network.
/// @param _otherBridge Address of the ERC721 bridge on the other network.
constructor(address _
messenger, address _otherBridge) ERC721Bridge(_messenger
, _otherBridge) {
constructor(address _
otherBridge) ERC721Bridge(Predeploys.L2_CROSS_DOMAIN_MESSENGER
, _otherBridge) {
initialize();
}
...
...
packages/contracts-bedrock/src/universal/ERC721Bridge.sol
View file @
96043725
...
...
@@ -9,9 +9,6 @@ import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable
/// @title ERC721Bridge
/// @notice ERC721Bridge is a base contract for the L1 and L2 ERC721 bridges.
abstract contract ERC721Bridge is Initializable {
/// @notice
SuperchainConfig public superChainConfig;
/// @notice Messenger contract on this domain. This will be removed in the
/// future, use `messenger` instead.
/// @custom:legacy
...
...
@@ -23,7 +20,7 @@ abstract contract ERC721Bridge is Initializable {
address public immutable OTHER_BRIDGE;
/// @notice Reserve extra slots (to a total of 50) in the storage layout for future upgrades.
uint256[4
8
] private __gap;
uint256[4
9
] private __gap;
/// @notice Emitted when an ERC721 bridge to the other network is initiated.
/// @param localToken Address of the token on this domain.
...
...
@@ -88,6 +85,14 @@ abstract contract ERC721Bridge is Initializable {
return OTHER_BRIDGE;
}
/// @notice This function should return true if the contract is paused.
/// On L1 this function will check the SuperchainConfig for its paused status.
/// On L2 this function should be a no-op.
/// @return Whether or not the contract is paused.
function paused() public view virtual returns (bool) {
return false;
}
/// @notice Initiates a bridge of an NFT to the caller's account on the other chain. Note that
/// this function can only be called by EOAs. Smart contract wallets should use the
/// `bridgeERC721To` function after ensuring that the recipient address on the remote
...
...
packages/contracts-bedrock/test/ExtendedPause.t.sol
View file @
96043725
...
...
@@ -21,7 +21,7 @@ contract ExtendedPause_Test is CommonTest {
assertTrue(l1StandardBridge.paused());
assertEq(l1StandardBridge.paused(), superchainConfig.paused());
//
assertTrue(l1ERC721Bridge.paused());
//
assertEq(l1ERC721Bridge.paused(), superchainConfig.paused());
assertTrue(l1ERC721Bridge.paused());
assertEq(l1ERC721Bridge.paused(), superchainConfig.paused());
}
}
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