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
Show 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"]
path = l2geth/tests/testdata
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 (
"sync"
"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"
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/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/rpc"
"github.com/urfave/cli/v2"
)
func
main
()
{
log
.
Root
()
.
SetHandler
(
log
.
StreamHandler
(
os
.
Stderr
,
log
.
TerminalFormat
(
isatty
.
IsTerminal
(
os
.
Stderr
.
Fd
()))))
app
:=
cli
.
NewApp
()
app
.
Name
=
"rollover"
app
.
Usage
=
"Commands for assisting in the rollover of the system"
...
...
@@ -149,6 +153,9 @@ func main() {
return
err
}
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
},
},
...
...
@@ -183,11 +190,11 @@ func main() {
log
.
Info
(
"Waiting for CanonicalTransactionChain"
)
wg
.
Add
(
1
)
go
waitForTotalElements
(
&
wg
,
ctc
,
clients
.
L2Client
)
go
waitForTotalElements
(
&
wg
,
ctc
,
clients
.
L2Client
,
"CanonicalTransactionChain"
)
log
.
Info
(
"Waiting for StateCommitmentChain"
)
wg
.
Add
(
1
)
go
waitForTotalElements
(
&
wg
,
scc
,
clients
.
L2Client
)
go
waitForTotalElements
(
&
wg
,
scc
,
clients
.
L2Client
,
"StateCommitmentChain"
)
wg
.
Wait
()
log
.
Info
(
"All batches have been submitted"
)
...
...
@@ -210,7 +217,7 @@ type RollupContract interface {
}
// 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
()
for
{
...
...
@@ -228,9 +235,16 @@ func waitForTotalElements(wg *sync.WaitGroup, contract RollupContract, client *e
}
if
totalElements
.
Uint64
()
==
bn
{
log
.
Info
(
"Total elements matches block number"
,
"name"
,
name
,
"count"
,
bn
)
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
)
}
...
...
op-chain-ops/util/util.go
View file @
0c3b866b
...
...
@@ -39,21 +39,21 @@ func NewClients(ctx *cli.Context) (*Clients, error) {
l1RpcURL
:=
ctx
.
String
(
"l1-rpc-url"
)
l1Client
,
err
:=
ethclient
.
Dial
(
l1RpcURL
)
if
err
!=
nil
{
return
nil
,
err
return
nil
,
fmt
.
Errorf
(
"cannot dial L1: %w"
,
err
)
}
l1ChainID
,
err
:=
l1Client
.
ChainID
(
context
.
Background
())
if
err
!=
nil
{
return
nil
,
err
return
nil
,
fmt
.
Errorf
(
"cannot fetch L1 chainid: %w"
,
err
)
}
l2RpcURL
:=
ctx
.
String
(
"l2-rpc-url"
)
l2Client
,
err
:=
ethclient
.
Dial
(
l2RpcURL
)
if
err
!=
nil
{
return
nil
,
err
return
nil
,
fmt
.
Errorf
(
"cannot dial L2: %w"
,
err
)
}
l2ChainID
,
err
:=
l2Client
.
ChainID
(
context
.
Background
())
if
err
!=
nil
{
return
nil
,
err
return
nil
,
fmt
.
Errorf
(
"cannot fetch L2 chainid: %w"
,
err
)
}
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,6 +6,7 @@ import {
ERC721BurnableUpgradeable
} from "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721BurnableUpgradeable.sol";
import { AttestationStation } from "./AttestationStation.sol";
import { OptimistAllowlist } from "./OptimistAllowlist.sol";
import { Strings } from "@openzeppelin/contracts/utils/Strings.sol";
/**
...
...
@@ -15,31 +16,44 @@ import { Strings } from "@openzeppelin/contracts/utils/Strings.sol";
* @notice A Soul Bound Token for real humans only(tm).
*/
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.
*/
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 _symbol Token symbol.
* @param _
attestor Address of the
attestor.
* @param _
baseURIAttestor Address of the baseURI
attestor.
* @param _attestationStation Address of the AttestationStation contract.
* @param _optimistAllowlist Address of the OptimistAllowlist contract
*/
constructor(
string memory _name,
string memory _symbol,
address _attestor,
AttestationStation _attestationStation
) Semver(1, 0, 0) {
ATTESTOR = _attestor;
address _baseURIAttestor,
AttestationStation _attestationStation,
OptimistAllowlist _optimistAllowlist
) Semver(2, 0, 0) {
BASE_URI_ATTESTOR = _baseURIAttestor;
ATTESTATION_STATION = _attestationStation;
OPTIMIST_ALLOWLIST = _optimistAllowlist;
initialize(_name, _symbol);
}
...
...
@@ -76,7 +90,7 @@ contract Optimist is ERC721BurnableUpgradeable, Semver {
string(
abi.encodePacked(
ATTESTATION_STATION.attestations(
ATTESTOR,
BASE_URI_
ATTESTOR,
address(this),
bytes32("optimist.base-uri")
)
...
...
@@ -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
* Optimist NFT will also be used as part of the Citizens House, mints are currently
* restricted. Eventually anyone will be able to mint.
* @notice Checks OptimistAllowlist to determine whether a given address is allowed to mint
* the Optimist NFT. Since the Optimist NFT will also be used as part of the
* Citizens House, mints are currently restricted. Eventually anyone will be able
* to mint.
*
* @return Whether or not the address is allowed to mint yet.
*/
function isOnAllowList(address _recipient) public view returns (bool) {
return
ATTESTATION_STATION
.attestations(ATTESTOR, _recipient, bytes32("optimist.can-mint"))
.length > 0;
return OPTIMIST_ALLOWLIST.isAllowedToMint(_recipient);
}
/**
...
...
packages/contracts-periphery/foundry.toml
View file @
0c3b866b
...
...
@@ -16,9 +16,13 @@ remappings = [
'@rari-capital/solmate/=node_modules/@rari-capital/solmate'
,
'forge-std/=node_modules/forge-std/src'
,
'ds-test/=node_modules/ds-test/src'
,
'multicall/=lib/multicall'
,
'@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/'
,
'@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/'
,
'@eth-optimism/contracts-bedrock/=../../node_modules/@eth-optimism/contracts-bedrock'
,
]
# The metadata hash can be removed from the bytecode by setting "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