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
0c3b866b
Unverified
Commit
0c3b866b
authored
Apr 04, 2023
by
Madhur Shrimal
Committed by
GitHub
Apr 04, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ethereum-optimism:develop' into madhur/tx-metrics
parents
7c2dfa62
44eec0de
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
516 additions
and
159 deletions
+516
-159
.gitmodules
.gitmodules
+5
-0
main.go
op-chain-ops/cmd/rollover/main.go
+22
-8
util.go
op-chain-ops/util/util.go
+4
-4
.gitmodules
packages/contracts-periphery/.gitmodules
+0
-0
MulticallContractCompiler.t.sol
...y/contracts/foundry-tests/MulticallContractCompiler.t.sol
+11
-0
Optimist.t.sol
...ontracts-periphery/contracts/foundry-tests/Optimist.t.sol
+440
-130
Optimist.sol
...ntracts-periphery/contracts/universal/op-nft/Optimist.sol
+29
-17
foundry.toml
packages/contracts-periphery/foundry.toml
+4
-0
multicall
packages/contracts-periphery/lib/multicall
+1
-0
No files found.
.gitmodules
View file @
0c3b866b
[submodule "tests"]
[submodule "tests"]
path = l2geth/tests/testdata
path = l2geth/tests/testdata
url = https://github.com/ethereum/tests
url = https://github.com/ethereum/tests
[submodule "packages/contracts-periphery/lib/multicall"]
path = packages/contracts-periphery/lib/multicall
url = https://github.com/mds1/multicall
[submodule "lib/multicall"]
branch = v3.1.0
op-chain-ops/cmd/rollover/main.go
View file @
0c3b866b
...
@@ -9,21 +9,25 @@ import (
...
@@ -9,21 +9,25 @@ import (
"sync"
"sync"
"time"
"time"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/mattn/go-isatty"
"github.com/urfave/cli/v2"
"github.com/ethereum-optimism/optimism/op-chain-ops/util"
"github.com/ethereum-optimism/optimism/op-bindings/bindings"
"github.com/ethereum-optimism/optimism/op-bindings/bindings"
legacy_bindings
"github.com/ethereum-optimism/optimism/op-bindings/legacy-bindings"
legacy_bindings
"github.com/ethereum-optimism/optimism/op-bindings/legacy-bindings"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum-optimism/optimism/op-chain-ops/util"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/rpc"
"github.com/urfave/cli/v2"
)
)
func
main
()
{
func
main
()
{
log
.
Root
()
.
SetHandler
(
log
.
StreamHandler
(
os
.
Stderr
,
log
.
TerminalFormat
(
isatty
.
IsTerminal
(
os
.
Stderr
.
Fd
()))))
app
:=
cli
.
NewApp
()
app
:=
cli
.
NewApp
()
app
.
Name
=
"rollover"
app
.
Name
=
"rollover"
app
.
Usage
=
"Commands for assisting in the rollover of the system"
app
.
Usage
=
"Commands for assisting in the rollover of the system"
...
@@ -149,6 +153,9 @@ func main() {
...
@@ -149,6 +153,9 @@ func main() {
return
err
return
err
}
}
log
.
Info
(
"Remaining deposits that must be submitted"
,
"count"
,
finalPending
)
log
.
Info
(
"Remaining deposits that must be submitted"
,
"count"
,
finalPending
)
if
finalPending
.
Cmp
(
common
.
Big0
)
==
0
{
log
.
Info
(
"All deposits have been batch submitted"
)
}
return
nil
return
nil
},
},
},
},
...
@@ -183,11 +190,11 @@ func main() {
...
@@ -183,11 +190,11 @@ func main() {
log
.
Info
(
"Waiting for CanonicalTransactionChain"
)
log
.
Info
(
"Waiting for CanonicalTransactionChain"
)
wg
.
Add
(
1
)
wg
.
Add
(
1
)
go
waitForTotalElements
(
&
wg
,
ctc
,
clients
.
L2Client
)
go
waitForTotalElements
(
&
wg
,
ctc
,
clients
.
L2Client
,
"CanonicalTransactionChain"
)
log
.
Info
(
"Waiting for StateCommitmentChain"
)
log
.
Info
(
"Waiting for StateCommitmentChain"
)
wg
.
Add
(
1
)
wg
.
Add
(
1
)
go
waitForTotalElements
(
&
wg
,
scc
,
clients
.
L2Client
)
go
waitForTotalElements
(
&
wg
,
scc
,
clients
.
L2Client
,
"StateCommitmentChain"
)
wg
.
Wait
()
wg
.
Wait
()
log
.
Info
(
"All batches have been submitted"
)
log
.
Info
(
"All batches have been submitted"
)
...
@@ -210,7 +217,7 @@ type RollupContract interface {
...
@@ -210,7 +217,7 @@ type RollupContract interface {
}
}
// waitForTotalElements will poll to see
// waitForTotalElements will poll to see
func
waitForTotalElements
(
wg
*
sync
.
WaitGroup
,
contract
RollupContract
,
client
*
ethclient
.
Client
)
{
func
waitForTotalElements
(
wg
*
sync
.
WaitGroup
,
contract
RollupContract
,
client
*
ethclient
.
Client
,
name
string
)
{
defer
wg
.
Done
()
defer
wg
.
Done
()
for
{
for
{
...
@@ -228,9 +235,16 @@ func waitForTotalElements(wg *sync.WaitGroup, contract RollupContract, client *e
...
@@ -228,9 +235,16 @@ func waitForTotalElements(wg *sync.WaitGroup, contract RollupContract, client *e
}
}
if
totalElements
.
Uint64
()
==
bn
{
if
totalElements
.
Uint64
()
==
bn
{
log
.
Info
(
"Total elements matches block number"
,
"name"
,
name
,
"count"
,
bn
)
return
return
}
}
log
.
Info
(
"Waiting for elements to be submitted"
,
"count"
,
totalElements
.
Uint64
()
-
bn
,
"height"
,
bn
,
"total-elements"
,
totalElements
.
Uint64
())
log
.
Info
(
"Waiting for elements to be submitted"
,
"name"
,
name
,
"count"
,
totalElements
.
Uint64
()
-
bn
,
"height"
,
bn
,
"total-elements"
,
totalElements
.
Uint64
(),
)
time
.
Sleep
(
3
*
time
.
Second
)
time
.
Sleep
(
3
*
time
.
Second
)
}
}
...
...
op-chain-ops/util/util.go
View file @
0c3b866b
...
@@ -39,21 +39,21 @@ func NewClients(ctx *cli.Context) (*Clients, error) {
...
@@ -39,21 +39,21 @@ func NewClients(ctx *cli.Context) (*Clients, error) {
l1RpcURL
:=
ctx
.
String
(
"l1-rpc-url"
)
l1RpcURL
:=
ctx
.
String
(
"l1-rpc-url"
)
l1Client
,
err
:=
ethclient
.
Dial
(
l1RpcURL
)
l1Client
,
err
:=
ethclient
.
Dial
(
l1RpcURL
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
fmt
.
Errorf
(
"cannot dial L1: %w"
,
err
)
}
}
l1ChainID
,
err
:=
l1Client
.
ChainID
(
context
.
Background
())
l1ChainID
,
err
:=
l1Client
.
ChainID
(
context
.
Background
())
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
fmt
.
Errorf
(
"cannot fetch L1 chainid: %w"
,
err
)
}
}
l2RpcURL
:=
ctx
.
String
(
"l2-rpc-url"
)
l2RpcURL
:=
ctx
.
String
(
"l2-rpc-url"
)
l2Client
,
err
:=
ethclient
.
Dial
(
l2RpcURL
)
l2Client
,
err
:=
ethclient
.
Dial
(
l2RpcURL
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
fmt
.
Errorf
(
"cannot dial L2: %w"
,
err
)
}
}
l2ChainID
,
err
:=
l2Client
.
ChainID
(
context
.
Background
())
l2ChainID
,
err
:=
l2Client
.
ChainID
(
context
.
Background
())
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
fmt
.
Errorf
(
"cannot fetch L2 chainid: %w"
,
err
)
}
}
l1RpcClient
,
err
:=
rpc
.
DialContext
(
context
.
Background
(),
l1RpcURL
)
l1RpcClient
,
err
:=
rpc
.
DialContext
(
context
.
Background
(),
l1RpcURL
)
...
...
packages/contracts-periphery/.gitmodules
0 → 100644
View file @
0c3b866b
packages/contracts-periphery/contracts/foundry-tests/MulticallContractCompiler.t.sol
0 → 100644
View file @
0c3b866b
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { Multicall3 } from "multicall/src/Multicall3.sol";
/**
* Just exists so we can compile this contract.
*/
contract MulticallContractCompiler {
}
packages/contracts-periphery/contracts/foundry-tests/Optimist.t.sol
View file @
0c3b866b
This diff is collapsed.
Click to expand it.
packages/contracts-periphery/contracts/universal/op-nft/Optimist.sol
View file @
0c3b866b
...
@@ -6,40 +6,54 @@ import {
...
@@ -6,40 +6,54 @@ import {
ERC721BurnableUpgradeable
ERC721BurnableUpgradeable
} from "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721BurnableUpgradeable.sol";
} from "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721BurnableUpgradeable.sol";
import { AttestationStation } from "./AttestationStation.sol";
import { AttestationStation } from "./AttestationStation.sol";
import { OptimistAllowlist } from "./OptimistAllowlist.sol";
import { Strings } from "@openzeppelin/contracts/utils/Strings.sol";
import { Strings } from "@openzeppelin/contracts/utils/Strings.sol";
/**
/**
* @author Optimism Collective
* @author Optimism Collective
* @author Gitcoin
* @author Gitcoin
* @title Optimist
* @title
Optimist
* @notice A Soul Bound Token for real humans only(tm).
* @notice A Soul Bound Token for real humans only(tm).
*/
*/
contract Optimist is ERC721BurnableUpgradeable, Semver {
contract Optimist is ERC721BurnableUpgradeable, Semver {
/**
* @notice Attestation key used by the attestor to attest the baseURI.
*/
bytes32 public constant BASE_URI_ATTESTATION_KEY = bytes32("optimist.base-uri");
/**
* @notice Attestor who attests to baseURI.
*/
address public immutable BASE_URI_ATTESTOR;
/**
/**
* @notice Address of the AttestationStation contract.
* @notice Address of the AttestationStation contract.
*/
*/
AttestationStation public immutable ATTESTATION_STATION;
AttestationStation public immutable ATTESTATION_STATION;
/**
/**
* @notice A
ttestor who attests to baseURI and allowlis
t.
* @notice A
ddress of the OptimistAllowlist contrac
t.
*/
*/
address public immutable ATTESTOR
;
OptimistAllowlist public immutable OPTIMIST_ALLOWLIST
;
/**
/**
* @custom:semver
1
.0.0
* @custom:semver
2
.0.0
* @param _name Token name.
* @param _name Token name.
* @param _symbol Token symbol.
* @param _symbol Token symbol.
* @param _
attestor Address of the
attestor.
* @param _
baseURIAttestor Address of the baseURI
attestor.
* @param _attestationStation Address of the AttestationStation contract.
* @param _attestationStation Address of the AttestationStation contract.
* @param _optimistAllowlist Address of the OptimistAllowlist contract
*/
*/
constructor(
constructor(
string memory _name,
string memory _name,
string memory _symbol,
string memory _symbol,
address _attestor,
address _baseURIAttestor,
AttestationStation _attestationStation
AttestationStation _attestationStation,
) Semver(1, 0, 0) {
OptimistAllowlist _optimistAllowlist
ATTESTOR = _attestor;
) Semver(2, 0, 0) {
BASE_URI_ATTESTOR = _baseURIAttestor;
ATTESTATION_STATION = _attestationStation;
ATTESTATION_STATION = _attestationStation;
OPTIMIST_ALLOWLIST = _optimistAllowlist;
initialize(_name, _symbol);
initialize(_name, _symbol);
}
}
...
@@ -76,7 +90,7 @@ contract Optimist is ERC721BurnableUpgradeable, Semver {
...
@@ -76,7 +90,7 @@ contract Optimist is ERC721BurnableUpgradeable, Semver {
string(
string(
abi.encodePacked(
abi.encodePacked(
ATTESTATION_STATION.attestations(
ATTESTATION_STATION.attestations(
ATTESTOR,
BASE_URI_
ATTESTOR,
address(this),
address(this),
bytes32("optimist.base-uri")
bytes32("optimist.base-uri")
)
)
...
@@ -105,17 +119,15 @@ contract Optimist is ERC721BurnableUpgradeable, Semver {
...
@@ -105,17 +119,15 @@ contract Optimist is ERC721BurnableUpgradeable, Semver {
}
}
/**
/**
* @notice Checks whether a given address is allowed to mint the Optimist NFT yet. Since the
* @notice Checks OptimistAllowlist to determine whether a given address is allowed to mint
* Optimist NFT will also be used as part of the Citizens House, mints are currently
* the Optimist NFT. Since the Optimist NFT will also be used as part of the
* restricted. Eventually anyone will be able to mint.
* Citizens House, mints are currently restricted. Eventually anyone will be able
* to mint.
*
*
* @return Whether or not the address is allowed to mint yet.
* @return Whether or not the address is allowed to mint yet.
*/
*/
function isOnAllowList(address _recipient) public view returns (bool) {
function isOnAllowList(address _recipient) public view returns (bool) {
return
return OPTIMIST_ALLOWLIST.isAllowedToMint(_recipient);
ATTESTATION_STATION
.attestations(ATTESTOR, _recipient, bytes32("optimist.can-mint"))
.length > 0;
}
}
/**
/**
...
...
packages/contracts-periphery/foundry.toml
View file @
0c3b866b
...
@@ -16,9 +16,13 @@ remappings = [
...
@@ -16,9 +16,13 @@ remappings = [
'@rari-capital/solmate/=node_modules/@rari-capital/solmate'
,
'@rari-capital/solmate/=node_modules/@rari-capital/solmate'
,
'forge-std/=node_modules/forge-std/src'
,
'forge-std/=node_modules/forge-std/src'
,
'ds-test/=node_modules/ds-test/src'
,
'ds-test/=node_modules/ds-test/src'
,
'multicall/=lib/multicall'
,
'@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/'
,
'@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/'
,
'@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/'
,
'@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/'
,
'@eth-optimism/contracts-bedrock/=../../node_modules/@eth-optimism/contracts-bedrock'
,
'@eth-optimism/contracts-bedrock/=../../node_modules/@eth-optimism/contracts-bedrock'
,
]
]
# The metadata hash can be removed from the bytecode by setting "none"
# The metadata hash can be removed from the bytecode by setting "none"
bytecode_hash
=
"none"
bytecode_hash
=
"none"
libs
=
[
"node_modules"
,
"lib"
]
# Required to use `deployCode` to deploy the multicall contract which has incompatible version
fs_permissions
=
[
{
access
=
"read"
,
path
=
"./forge-artifacts/Multicall3.sol/Multicall3.json"
}
]
multicall
@
a1fa0644
Subproject commit a1fa0644fa412cd3237ef7081458ecb2ffad7dbe
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