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
92bc1b4f
Commit
92bc1b4f
authored
Jun 23, 2023
by
Andreas Bigger
Committed by
asnared
Jun 23, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Port legacy contracts to triple slash natspec style
parent
f5bdbf00
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
257 additions
and
389 deletions
+257
-389
deployerwhitelist.go
op-bindings/bindings/deployerwhitelist.go
+1
-1
l1blocknumber.go
op-bindings/bindings/l1blocknumber.go
+1
-1
legacymessagepasser.go
op-bindings/bindings/legacymessagepasser.go
+1
-1
AddressManager.sol
...ges/contracts-bedrock/contracts/legacy/AddressManager.sol
+20
-38
DeployerWhitelist.sol
.../contracts-bedrock/contracts/legacy/DeployerWhitelist.sol
+32
-63
L1BlockNumber.sol
...ages/contracts-bedrock/contracts/legacy/L1BlockNumber.sol
+14
-25
L1ChugSplashProxy.sol
.../contracts-bedrock/contracts/legacy/L1ChugSplashProxy.sol
+60
-112
LegacyERC20ETH.sol
...ges/contracts-bedrock/contracts/legacy/LegacyERC20ETH.sol
+28
-50
LegacyMessagePasser.sol
...ontracts-bedrock/contracts/legacy/LegacyMessagePasser.sol
+11
-20
LegacyMintableERC20.sol
...ontracts-bedrock/contracts/legacy/LegacyMintableERC20.sol
+19
-39
ResolvedDelegateProxy.sol
...tracts-bedrock/contracts/legacy/ResolvedDelegateProxy.sol
+17
-27
DeployerWhitelist.t.sol
.../contracts-bedrock/contracts/test/DeployerWhitelist.t.sol
+6
-2
L1BlockNumber.t.sol
...ages/contracts-bedrock/contracts/test/L1BlockNumber.t.sol
+10
-1
LegacyERC20ETH.t.sol
...ges/contracts-bedrock/contracts/test/LegacyERC20ETH.t.sol
+16
-1
LegacyMessagePasser.t.sol
...ontracts-bedrock/contracts/test/LegacyMessagePasser.t.sol
+8
-1
ResolvedDelegateProxy.t.sol
...tracts-bedrock/contracts/test/ResolvedDelegateProxy.t.sol
+10
-4
check-l2.ts
packages/contracts-bedrock/tasks/check-l2.ts
+3
-3
No files found.
op-bindings/bindings/deployerwhitelist.go
View file @
92bc1b4f
...
@@ -31,7 +31,7 @@ var (
...
@@ -31,7 +31,7 @@ var (
// DeployerWhitelistMetaData contains all meta data concerning the DeployerWhitelist contract.
// DeployerWhitelistMetaData contains all meta data concerning the DeployerWhitelist contract.
var
DeployerWhitelistMetaData
=
&
bind
.
MetaData
{
var
DeployerWhitelistMetaData
=
&
bind
.
MetaData
{
ABI
:
"[{
\"
inputs
\"
:[],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
constructor
\"
},{
\"
anonymous
\"
:false,
\"
inputs
\"
:[{
\"
indexed
\"
:false,
\"
internalType
\"
:
\"
address
\"
,
\"
name
\"
:
\"
oldOwner
\"
,
\"
type
\"
:
\"
address
\"
},{
\"
indexed
\"
:false,
\"
internalType
\"
:
\"
address
\"
,
\"
name
\"
:
\"
newOwner
\"
,
\"
type
\"
:
\"
address
\"
}],
\"
name
\"
:
\"
OwnerChanged
\"
,
\"
type
\"
:
\"
event
\"
},{
\"
anonymous
\"
:false,
\"
inputs
\"
:[{
\"
indexed
\"
:false,
\"
internalType
\"
:
\"
address
\"
,
\"
name
\"
:
\"
oldOwner
\"
,
\"
type
\"
:
\"
address
\"
}],
\"
name
\"
:
\"
WhitelistDisabled
\"
,
\"
type
\"
:
\"
event
\"
},{
\"
anonymous
\"
:false,
\"
inputs
\"
:[{
\"
indexed
\"
:false,
\"
internalType
\"
:
\"
address
\"
,
\"
name
\"
:
\"
deployer
\"
,
\"
type
\"
:
\"
address
\"
},{
\"
indexed
\"
:false,
\"
internalType
\"
:
\"
bool
\"
,
\"
name
\"
:
\"
whitelisted
\"
,
\"
type
\"
:
\"
bool
\"
}],
\"
name
\"
:
\"
WhitelistStatusChanged
\"
,
\"
type
\"
:
\"
event
\"
},{
\"
inputs
\"
:[],
\"
name
\"
:
\"
enableArbitraryContractDeployment
\"
,
\"
outputs
\"
:[],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
address
\"
,
\"
name
\"
:
\"
_deployer
\"
,
\"
type
\"
:
\"
address
\"
}],
\"
name
\"
:
\"
isDeployerAllowed
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
bool
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
bool
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[],
\"
name
\"
:
\"
owner
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
address
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
address
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
address
\"
,
\"
name
\"
:
\"
_owner
\"
,
\"
type
\"
:
\"
address
\"
}],
\"
name
\"
:
\"
setOwner
\"
,
\"
outputs
\"
:[],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
address
\"
,
\"
name
\"
:
\"
_deployer
\"
,
\"
type
\"
:
\"
address
\"
},{
\"
internalType
\"
:
\"
bool
\"
,
\"
name
\"
:
\"
_isWhitelisted
\"
,
\"
type
\"
:
\"
bool
\"
}],
\"
name
\"
:
\"
setWhitelistedDeployer
\"
,
\"
outputs
\"
:[],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[],
\"
name
\"
:
\"
version
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
string
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
string
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
address
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
address
\"
}],
\"
name
\"
:
\"
whitelist
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
bool
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
bool
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
}]"
,
ABI
:
"[{
\"
inputs
\"
:[],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
constructor
\"
},{
\"
anonymous
\"
:false,
\"
inputs
\"
:[{
\"
indexed
\"
:false,
\"
internalType
\"
:
\"
address
\"
,
\"
name
\"
:
\"
oldOwner
\"
,
\"
type
\"
:
\"
address
\"
},{
\"
indexed
\"
:false,
\"
internalType
\"
:
\"
address
\"
,
\"
name
\"
:
\"
newOwner
\"
,
\"
type
\"
:
\"
address
\"
}],
\"
name
\"
:
\"
OwnerChanged
\"
,
\"
type
\"
:
\"
event
\"
},{
\"
anonymous
\"
:false,
\"
inputs
\"
:[{
\"
indexed
\"
:false,
\"
internalType
\"
:
\"
address
\"
,
\"
name
\"
:
\"
oldOwner
\"
,
\"
type
\"
:
\"
address
\"
}],
\"
name
\"
:
\"
WhitelistDisabled
\"
,
\"
type
\"
:
\"
event
\"
},{
\"
anonymous
\"
:false,
\"
inputs
\"
:[{
\"
indexed
\"
:false,
\"
internalType
\"
:
\"
address
\"
,
\"
name
\"
:
\"
deployer
\"
,
\"
type
\"
:
\"
address
\"
},{
\"
indexed
\"
:false,
\"
internalType
\"
:
\"
bool
\"
,
\"
name
\"
:
\"
whitelisted
\"
,
\"
type
\"
:
\"
bool
\"
}],
\"
name
\"
:
\"
WhitelistStatusChanged
\"
,
\"
type
\"
:
\"
event
\"
},{
\"
inputs
\"
:[],
\"
name
\"
:
\"
enableArbitraryContractDeployment
\"
,
\"
outputs
\"
:[],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
address
\"
,
\"
name
\"
:
\"
_deployer
\"
,
\"
type
\"
:
\"
address
\"
}],
\"
name
\"
:
\"
isDeployerAllowed
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
bool
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
bool
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[],
\"
name
\"
:
\"
owner
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
address
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
address
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
address
\"
,
\"
name
\"
:
\"
_owner
\"
,
\"
type
\"
:
\"
address
\"
}],
\"
name
\"
:
\"
setOwner
\"
,
\"
outputs
\"
:[],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
address
\"
,
\"
name
\"
:
\"
_deployer
\"
,
\"
type
\"
:
\"
address
\"
},{
\"
internalType
\"
:
\"
bool
\"
,
\"
name
\"
:
\"
_isWhitelisted
\"
,
\"
type
\"
:
\"
bool
\"
}],
\"
name
\"
:
\"
setWhitelistedDeployer
\"
,
\"
outputs
\"
:[],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[],
\"
name
\"
:
\"
version
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
string
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
string
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
address
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
address
\"
}],
\"
name
\"
:
\"
whitelist
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
bool
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
bool
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
}]"
,
Bin
:
"0x60e060405234801561001057600080fd5b5060016080819052600060a081905260c08
1905280610b3761004a82
3960006105450152600061051c015260006104f30152610b376000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80638da5cb5b1161005b5780638da5cb5b146100c85780639b19251a1461010d578063b1540a0114610140578063bdc7b54f1461015357600080fd5b806308fd63221461008257806313af40351461009757806354fd4d50146100aa575b600080fd5b61009561009036600461088a565b61015b565b005b6100956100a53660046108c6565b6102bb565b6100b26104ec565b6040516100bf9190610918565b60405180910390f35b6000546100e89073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100bf565b61013061011b3660046108c6565b60016020526000908152604090205460ff1681565b60405190151581526020016100bf565b61013061014e3660046108c6565b61058f565b6100956105e0565b60005473ffffffffffffffffffffffffffffffffffffffff16331461022d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604c60248201527f4465706c6f79657257686974656c6973743a2066756e6374696f6e2063616e2060448201527f6f6e6c792062652063616c6c656420627920746865206f776e6572206f66207460648201527f68697320636f6e74726163740000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff821660008181526001602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168515159081179091558251938452908301527f8daaf060c3306c38e068a75c054bf96ecd85a3db1252712c4d93632744c42e0d910160405180910390a15050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610388576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604c60248201527f4465706c6f79657257686974656c6973743a2066756e6374696f6e2063616e2060448201527f6f6e6c792062652063616c6c656420627920746865206f776e6572206f66207460648201527f68697320636f6e74726163740000000000000000000000000000000000000000608482015260a401610224565b73ffffffffffffffffffffffffffffffffffffffff8116610451576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604d60248201527f4465706c6f79657257686974656c6973743a2063616e206f6e6c79206265206460448201527f697361626c65642076696120656e61626c65417262697472617279436f6e747260648201527f6163744465706c6f796d656e7400000000000000000000000000000000000000608482015260a401610224565b6000546040805173ffffffffffffffffffffffffffffffffffffffff928316815291831660208301527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a1600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60606105177f0000000000000000000000000000000000000000000000000000000000000000610724565b6105407f0000000000000000000000000000000000000000000000000000000000000000610724565b6105697f0000000000000000000000000000000000000000000000000000000000000000610724565b60405160200161057b93929190610969565b604051602081830303815290604052905090565b6000805473ffffffffffffffffffffffffffffffffffffffff1615806105da575073ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205460ff165b92915050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146106ad576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604c60248201527f4465706c6f79657257686974656c6973743a2066756e6374696f6e2063616e2060448201527f6f6e6c792062652063616c6c656420627920746865206f776e6572206f66207460648201527f68697320636f6e74726163740000000000000000000000000000000000000000608482015260a401610224565b60005460405173ffffffffffffffffffffffffffffffffffffffff90911681527fc0e106cf568e50698fdbde1eff56f5a5c966cc7958e37e276918e9e4ccdf8cd49060200160405180910390a1600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b60608160000361076757505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115610791578061077b81610a0e565b915061078a9050600a83610a75565b915061076b565b60008167ffffffffffffffff8111156107ac576107ac610a89565b6040519080825280601f01601f1916602001820160405280156107d6576020820181803683370190505b5090505b8415610859576107eb600183610ab8565b91506107f8600a86610acf565b610803906030610ae3565b60f81b81838151811061081857610818610afb565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350610852600a86610a75565b94506107da565b949350505050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461088557600080fd5b919050565b6000806040838503121561089d57600080fd5b6108a683610861565b9150602083013580151581146108bb57600080fd5b809150509250929050565b6000602082840312156108d857600080fd5b6108e182610861565b9392505050565b60005b838110156109035781810151838201526020016108eb565b83811115610912576000848401525b50505050565b60208152600082518060208401526109378160408501602087016108e8565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b6000845161097b8184602089016108e8565b80830190507f2e0000000000000000000000000000000000000000000000000000000000000080825285516109b7816001850160208a016108e8565b600192019182015283516109d28160028401602088016108e8565b0160020195945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610a3f57610a3f6109df565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082610a8457610a84610a46565b500490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082821015610aca57610aca6109df565b500390565b600082610ade57610ade610a46565b500690565b60008219821115610af657610af66109df565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfea164736f6c634300080f000a"
,
Bin
:
"0x60e060405234801561001057600080fd5b5060016080819052600060a081905260c08
2905281610b3761004a83
3960006105450152600061051c015260006104f30152610b376000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80638da5cb5b1161005b5780638da5cb5b146100c85780639b19251a1461010d578063b1540a0114610140578063bdc7b54f1461015357600080fd5b806308fd63221461008257806313af40351461009757806354fd4d50146100aa575b600080fd5b61009561009036600461088a565b61015b565b005b6100956100a53660046108c6565b6102bb565b6100b26104ec565b6040516100bf9190610918565b60405180910390f35b6000546100e89073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100bf565b61013061011b3660046108c6565b60016020526000908152604090205460ff1681565b60405190151581526020016100bf565b61013061014e3660046108c6565b61058f565b6100956105e0565b60005473ffffffffffffffffffffffffffffffffffffffff16331461022d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604c60248201527f4465706c6f79657257686974656c6973743a2066756e6374696f6e2063616e2060448201527f6f6e6c792062652063616c6c656420627920746865206f776e6572206f66207460648201527f68697320636f6e74726163740000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff821660008181526001602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168515159081179091558251938452908301527f8daaf060c3306c38e068a75c054bf96ecd85a3db1252712c4d93632744c42e0d910160405180910390a15050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610388576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604c60248201527f4465706c6f79657257686974656c6973743a2066756e6374696f6e2063616e2060448201527f6f6e6c792062652063616c6c656420627920746865206f776e6572206f66207460648201527f68697320636f6e74726163740000000000000000000000000000000000000000608482015260a401610224565b73ffffffffffffffffffffffffffffffffffffffff8116610451576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604d60248201527f4465706c6f79657257686974656c6973743a2063616e206f6e6c79206265206460448201527f697361626c65642076696120656e61626c65417262697472617279436f6e747260648201527f6163744465706c6f796d656e7400000000000000000000000000000000000000608482015260a401610224565b6000546040805173ffffffffffffffffffffffffffffffffffffffff928316815291831660208301527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a1600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60606105177f0000000000000000000000000000000000000000000000000000000000000000610724565b6105407f0000000000000000000000000000000000000000000000000000000000000000610724565b6105697f0000000000000000000000000000000000000000000000000000000000000000610724565b60405160200161057b93929190610969565b604051602081830303815290604052905090565b6000805473ffffffffffffffffffffffffffffffffffffffff1615806105da575073ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205460ff165b92915050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146106ad576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604c60248201527f4465706c6f79657257686974656c6973743a2066756e6374696f6e2063616e2060448201527f6f6e6c792062652063616c6c656420627920746865206f776e6572206f66207460648201527f68697320636f6e74726163740000000000000000000000000000000000000000608482015260a401610224565b60005460405173ffffffffffffffffffffffffffffffffffffffff90911681527fc0e106cf568e50698fdbde1eff56f5a5c966cc7958e37e276918e9e4ccdf8cd49060200160405180910390a1600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b60608160000361076757505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115610791578061077b81610a0e565b915061078a9050600a83610a75565b915061076b565b60008167ffffffffffffffff8111156107ac576107ac610a89565b6040519080825280601f01601f1916602001820160405280156107d6576020820181803683370190505b5090505b8415610859576107eb600183610ab8565b91506107f8600a86610acf565b610803906030610ae3565b60f81b81838151811061081857610818610afb565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350610852600a86610a75565b94506107da565b949350505050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461088557600080fd5b919050565b6000806040838503121561089d57600080fd5b6108a683610861565b9150602083013580151581146108bb57600080fd5b809150509250929050565b6000602082840312156108d857600080fd5b6108e182610861565b9392505050565b60005b838110156109035781810151838201526020016108eb565b83811115610912576000848401525b50505050565b60208152600082518060208401526109378160408501602087016108e8565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b6000845161097b8184602089016108e8565b80830190507f2e0000000000000000000000000000000000000000000000000000000000000080825285516109b7816001850160208a016108e8565b600192019182015283516109d28160028401602088016108e8565b0160020195945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610a3f57610a3f6109df565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082610a8457610a84610a46565b500490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082821015610aca57610aca6109df565b500390565b600082610ade57610ade610a46565b500690565b60008219821115610af657610af66109df565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfea164736f6c634300080f000a"
,
}
}
// DeployerWhitelistABI is the input ABI used to generate the binding from.
// DeployerWhitelistABI is the input ABI used to generate the binding from.
...
...
op-bindings/bindings/l1blocknumber.go
View file @
92bc1b4f
...
@@ -31,7 +31,7 @@ var (
...
@@ -31,7 +31,7 @@ var (
// L1BlockNumberMetaData contains all meta data concerning the L1BlockNumber contract.
// L1BlockNumberMetaData contains all meta data concerning the L1BlockNumber contract.
var
L1BlockNumberMetaData
=
&
bind
.
MetaData
{
var
L1BlockNumberMetaData
=
&
bind
.
MetaData
{
ABI
:
"[{
\"
inputs
\"
:[],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
constructor
\"
},{
\"
stateMutability
\"
:
\"
payable
\"
,
\"
type
\"
:
\"
fallback
\"
},{
\"
inputs
\"
:[],
\"
name
\"
:
\"
getL1BlockNumber
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
uint256
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
uint256
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[],
\"
name
\"
:
\"
version
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
string
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
string
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
stateMutability
\"
:
\"
payable
\"
,
\"
type
\"
:
\"
receive
\"
}]"
,
ABI
:
"[{
\"
inputs
\"
:[],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
constructor
\"
},{
\"
stateMutability
\"
:
\"
payable
\"
,
\"
type
\"
:
\"
fallback
\"
},{
\"
inputs
\"
:[],
\"
name
\"
:
\"
getL1BlockNumber
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
uint256
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
uint256
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[],
\"
name
\"
:
\"
version
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
string
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
string
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
stateMutability
\"
:
\"
payable
\"
,
\"
type
\"
:
\"
receive
\"
}]"
,
Bin
:
"0x60e060405234801561001057600080fd5b5060016080819052600060a081905260c08
190528061059461004a82
39600061018d015260006101640152600061013b01526105946000f3fe60806040526004361061002d5760003560e01c806354fd4d5014610052578063b9b3efe91461007d57610048565b3661004857600061003c6100a0565b90508060005260206000f35b600061003c6100a0565b34801561005e57600080fd5b50610067610134565b6040516100749190610344565b60405180910390f35b34801561008957600080fd5b506100926100a0565b604051908152602001610074565b600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16638381f58a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610101573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101259190610395565b67ffffffffffffffff16905090565b606061015f7f00000000000000000000000000000000000000000000000000000000000000006101d7565b6101887f00000000000000000000000000000000000000000000000000000000000000006101d7565b6101b17f00000000000000000000000000000000000000000000000000000000000000006101d7565b6040516020016101c3939291906103c6565b604051602081830303815290604052905090565b60608160000361021a57505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115610244578061022e8161046b565b915061023d9050600a836104d2565b915061021e565b60008167ffffffffffffffff81111561025f5761025f6104e6565b6040519080825280601f01601f191660200182016040528015610289576020820181803683370190505b5090505b841561030c5761029e600183610515565b91506102ab600a8661052c565b6102b6906030610540565b60f81b8183815181106102cb576102cb610558565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350610305600a866104d2565b945061028d565b949350505050565b60005b8381101561032f578181015183820152602001610317565b8381111561033e576000848401525b50505050565b6020815260008251806020840152610363816040850160208701610314565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b6000602082840312156103a757600080fd5b815167ffffffffffffffff811681146103bf57600080fd5b9392505050565b600084516103d8818460208901610314565b80830190507f2e000000000000000000000000000000000000000000000000000000000000008082528551610414816001850160208a01610314565b6001920191820152835161042f816002840160208801610314565b0160020195945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361049c5761049c61043c565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000826104e1576104e16104a3565b500490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000828210156105275761052761043c565b500390565b60008261053b5761053b6104a3565b500690565b600082198211156105535761055361043c565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfea164736f6c634300080f000a"
,
Bin
:
"0x60e060405234801561001057600080fd5b5060016080819052600060a081905260c08
290528161059461004a83
39600061018d015260006101640152600061013b01526105946000f3fe60806040526004361061002d5760003560e01c806354fd4d5014610052578063b9b3efe91461007d57610048565b3661004857600061003c6100a0565b90508060005260206000f35b600061003c6100a0565b34801561005e57600080fd5b50610067610134565b6040516100749190610344565b60405180910390f35b34801561008957600080fd5b506100926100a0565b604051908152602001610074565b600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16638381f58a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610101573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101259190610395565b67ffffffffffffffff16905090565b606061015f7f00000000000000000000000000000000000000000000000000000000000000006101d7565b6101887f00000000000000000000000000000000000000000000000000000000000000006101d7565b6101b17f00000000000000000000000000000000000000000000000000000000000000006101d7565b6040516020016101c3939291906103c6565b604051602081830303815290604052905090565b60608160000361021a57505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115610244578061022e8161046b565b915061023d9050600a836104d2565b915061021e565b60008167ffffffffffffffff81111561025f5761025f6104e6565b6040519080825280601f01601f191660200182016040528015610289576020820181803683370190505b5090505b841561030c5761029e600183610515565b91506102ab600a8661052c565b6102b6906030610540565b60f81b8183815181106102cb576102cb610558565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350610305600a866104d2565b945061028d565b949350505050565b60005b8381101561032f578181015183820152602001610317565b8381111561033e576000848401525b50505050565b6020815260008251806020840152610363816040850160208701610314565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b6000602082840312156103a757600080fd5b815167ffffffffffffffff811681146103bf57600080fd5b9392505050565b600084516103d8818460208901610314565b80830190507f2e000000000000000000000000000000000000000000000000000000000000008082528551610414816001850160208a01610314565b6001920191820152835161042f816002840160208801610314565b0160020195945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361049c5761049c61043c565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000826104e1576104e16104a3565b500490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000828210156105275761052761043c565b500390565b60008261053b5761053b6104a3565b500690565b600082198211156105535761055361043c565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfea164736f6c634300080f000a"
,
}
}
// L1BlockNumberABI is the input ABI used to generate the binding from.
// L1BlockNumberABI is the input ABI used to generate the binding from.
...
...
op-bindings/bindings/legacymessagepasser.go
View file @
92bc1b4f
...
@@ -31,7 +31,7 @@ var (
...
@@ -31,7 +31,7 @@ var (
// LegacyMessagePasserMetaData contains all meta data concerning the LegacyMessagePasser contract.
// LegacyMessagePasserMetaData contains all meta data concerning the LegacyMessagePasser contract.
var
LegacyMessagePasserMetaData
=
&
bind
.
MetaData
{
var
LegacyMessagePasserMetaData
=
&
bind
.
MetaData
{
ABI
:
"[{
\"
inputs
\"
:[],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
constructor
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
bytes
\"
,
\"
name
\"
:
\"
_message
\"
,
\"
type
\"
:
\"
bytes
\"
}],
\"
name
\"
:
\"
passMessageToL1
\"
,
\"
outputs
\"
:[],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
bytes32
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
bytes32
\"
}],
\"
name
\"
:
\"
sentMessages
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
bool
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
bool
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[],
\"
name
\"
:
\"
version
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
string
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
string
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
}]"
,
ABI
:
"[{
\"
inputs
\"
:[],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
constructor
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
bytes
\"
,
\"
name
\"
:
\"
_message
\"
,
\"
type
\"
:
\"
bytes
\"
}],
\"
name
\"
:
\"
passMessageToL1
\"
,
\"
outputs
\"
:[],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
bytes32
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
bytes32
\"
}],
\"
name
\"
:
\"
sentMessages
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
bool
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
bool
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[],
\"
name
\"
:
\"
version
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
string
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
string
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
}]"
,
Bin
:
"0x60e060405234801561001057600080fd5b5060016080819052600060a081905260c08
190528061069861004882
3960006101050152600060dc0152600060b301526106986000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806354fd4d501461004657806382e3702d14610064578063cafa81dc14610097575b600080fd5b61004e6100ac565b60405161005b9190610347565b60405180910390f35b610087610072366004610398565b60006020819052908152604090205460ff1681565b604051901515815260200161005b565b6100aa6100a53660046103e0565b61014f565b005b60606100d77f00000000000000000000000000000000000000000000000000000000000000006101da565b6101007f00000000000000000000000000000000000000000000000000000000000000006101da565b6101297f00000000000000000000000000000000000000000000000000000000000000006101da565b60405160200161013b939291906104af565b604051602081830303815290604052905090565b60016000808333604051602001610167929190610525565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001815291815281516020928301208352908201929092520160002080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001691151591909117905550565b60608160000361021d57505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b811561024757806102318161059e565b91506102409050600a83610605565b9150610221565b60008167ffffffffffffffff811115610262576102626103b1565b6040519080825280601f01601f19166020018201604052801561028c576020820181803683370190505b5090505b841561030f576102a1600183610619565b91506102ae600a86610630565b6102b9906030610644565b60f81b8183815181106102ce576102ce61065c565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350610308600a86610605565b9450610290565b949350505050565b60005b8381101561033257818101518382015260200161031a565b83811115610341576000848401525b50505050565b6020815260008251806020840152610366816040850160208701610317565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b6000602082840312156103aa57600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000602082840312156103f257600080fd5b813567ffffffffffffffff8082111561040a57600080fd5b818401915084601f83011261041e57600080fd5b813581811115610430576104306103b1565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715610476576104766103b1565b8160405282815287602084870101111561048f57600080fd5b826020860160208301376000928101602001929092525095945050505050565b600084516104c1818460208901610317565b80830190507f2e0000000000000000000000000000000000000000000000000000000000000080825285516104fd816001850160208a01610317565b60019201918201528351610518816002840160208801610317565b0160020195945050505050565b60008351610537818460208801610317565b60609390931b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000169190920190815260140192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036105cf576105cf61056f565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082610614576106146105d6565b500490565b60008282101561062b5761062b61056f565b500390565b60008261063f5761063f6105d6565b500690565b600082198211156106575761065761056f565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfea164736f6c634300080f000a"
,
Bin
:
"0x60e060405234801561001057600080fd5b5060016080819052600060a081905260c08
290528161069861004883
3960006101050152600060dc0152600060b301526106986000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806354fd4d501461004657806382e3702d14610064578063cafa81dc14610097575b600080fd5b61004e6100ac565b60405161005b9190610347565b60405180910390f35b610087610072366004610398565b60006020819052908152604090205460ff1681565b604051901515815260200161005b565b6100aa6100a53660046103e0565b61014f565b005b60606100d77f00000000000000000000000000000000000000000000000000000000000000006101da565b6101007f00000000000000000000000000000000000000000000000000000000000000006101da565b6101297f00000000000000000000000000000000000000000000000000000000000000006101da565b60405160200161013b939291906104af565b604051602081830303815290604052905090565b60016000808333604051602001610167929190610525565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001815291815281516020928301208352908201929092520160002080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001691151591909117905550565b60608160000361021d57505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b811561024757806102318161059e565b91506102409050600a83610605565b9150610221565b60008167ffffffffffffffff811115610262576102626103b1565b6040519080825280601f01601f19166020018201604052801561028c576020820181803683370190505b5090505b841561030f576102a1600183610619565b91506102ae600a86610630565b6102b9906030610644565b60f81b8183815181106102ce576102ce61065c565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350610308600a86610605565b9450610290565b949350505050565b60005b8381101561033257818101518382015260200161031a565b83811115610341576000848401525b50505050565b6020815260008251806020840152610366816040850160208701610317565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b6000602082840312156103aa57600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000602082840312156103f257600080fd5b813567ffffffffffffffff8082111561040a57600080fd5b818401915084601f83011261041e57600080fd5b813581811115610430576104306103b1565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715610476576104766103b1565b8160405282815287602084870101111561048f57600080fd5b826020860160208301376000928101602001929092525095945050505050565b600084516104c1818460208901610317565b80830190507f2e0000000000000000000000000000000000000000000000000000000000000080825285516104fd816001850160208a01610317565b60019201918201528351610518816002840160208801610317565b0160020195945050505050565b60008351610537818460208801610317565b60609390931b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000169190920190815260140192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036105cf576105cf61056f565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082610614576106146105d6565b500490565b60008282101561062b5761062b61056f565b500390565b60008261063f5761063f6105d6565b500690565b600082198211156106575761065761056f565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfea164736f6c634300080f000a"
,
}
}
// LegacyMessagePasserABI is the input ABI used to generate the binding from.
// LegacyMessagePasserABI is the input ABI used to generate the binding from.
...
...
packages/contracts-bedrock/contracts/legacy/AddressManager.sol
View file @
92bc1b4f
...
@@ -3,35 +3,25 @@ pragma solidity 0.8.15;
...
@@ -3,35 +3,25 @@ pragma solidity 0.8.15;
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
/**
/// @custom:legacy
* @custom:legacy
/// @title AddressManager
* @title AddressManager
/// @notice AddressManager is a legacy contract that was used in the old version of the Optimism
* @notice AddressManager is a legacy contract that was used in the old version of the Optimism
/// system to manage a registry of string names to addresses. We now use a more standard
* system to manage a registry of string names to addresses. We now use a more standard
/// proxy system instead, but this contract is still necessary for backwards compatibility
* proxy system instead, but this contract is still necessary for backwards compatibility
/// with several older contracts.
* with several older contracts.
*/
contract AddressManager is Ownable {
contract AddressManager is Ownable {
/**
/// @notice Mapping of the hashes of string names to addresses.
* @notice Mapping of the hashes of string names to addresses.
*/
mapping(bytes32 => address) private addresses;
mapping(bytes32 => address) private addresses;
/**
/// @notice Emitted when an address is modified in the registry.
* @notice Emitted when an address is modified in the registry.
/// @param name String name being set in the registry.
*
/// @param newAddress Address set for the given name.
* @param name String name being set in the registry.
/// @param oldAddress Address that was previously set for the given name.
* @param newAddress Address set for the given name.
* @param oldAddress Address that was previously set for the given name.
*/
event AddressSet(string indexed name, address newAddress, address oldAddress);
event AddressSet(string indexed name, address newAddress, address oldAddress);
/**
/// @notice Changes the address associated with a particular name.
* @notice Changes the address associated with a particular name.
/// @param _name String name to associate an address with.
*
/// @param _address Address to associate with the name.
* @param _name String name to associate an address with.
* @param _address Address to associate with the name.
*/
function setAddress(string memory _name, address _address) external onlyOwner {
function setAddress(string memory _name, address _address) external onlyOwner {
bytes32 nameHash = _getNameHash(_name);
bytes32 nameHash = _getNameHash(_name);
address oldAddress = addresses[nameHash];
address oldAddress = addresses[nameHash];
...
@@ -40,24 +30,16 @@ contract AddressManager is Ownable {
...
@@ -40,24 +30,16 @@ contract AddressManager is Ownable {
emit AddressSet(_name, _address, oldAddress);
emit AddressSet(_name, _address, oldAddress);
}
}
/**
/// @notice Retrieves the address associated with a given name.
* @notice Retrieves the address associated with a given name.
/// @param _name Name to retrieve an address for.
*
/// @return Address associated with the given name.
* @param _name Name to retrieve an address for.
*
* @return Address associated with the given name.
*/
function getAddress(string memory _name) external view returns (address) {
function getAddress(string memory _name) external view returns (address) {
return addresses[_getNameHash(_name)];
return addresses[_getNameHash(_name)];
}
}
/**
/// @notice Computes the hash of a name.
* @notice Computes the hash of a name.
/// @param _name Name to compute a hash for.
*
/// @return Hash of the given name.
* @param _name Name to compute a hash for.
*
* @return Hash of the given name.
*/
function _getNameHash(string memory _name) internal pure returns (bytes32) {
function _getNameHash(string memory _name) internal pure returns (bytes32) {
return keccak256(abi.encodePacked(_name));
return keccak256(abi.encodePacked(_name));
}
}
...
...
packages/contracts-bedrock/contracts/legacy/DeployerWhitelist.sol
View file @
92bc1b4f
...
@@ -3,55 +3,38 @@ pragma solidity 0.8.15;
...
@@ -3,55 +3,38 @@ pragma solidity 0.8.15;
import { Semver } from "../universal/Semver.sol";
import { Semver } from "../universal/Semver.sol";
/**
/// @custom:legacy
* @custom:legacy
/// @custom:proxied
* @custom:proxied
/// @custom:predeployed 0x4200000000000000000000000000000000000002
* @custom:predeployed 0x4200000000000000000000000000000000000002
/// @title DeployerWhitelist
* @title DeployerWhitelist
/// @notice DeployerWhitelist is a legacy contract that was originally used to act as a whitelist of
* @notice DeployerWhitelist is a legacy contract that was originally used to act as a whitelist of
/// addresses allowed to the Optimism network. The DeployerWhitelist has since been
* addresses allowed to the Optimism network. The DeployerWhitelist has since been
/// disabled, but the code is kept in state for the sake of full backwards compatibility.
* disabled, but the code is kept in state for the sake of full backwards compatibility.
/// As of the Bedrock upgrade, the DeployerWhitelist is completely unused by the Optimism
* As of the Bedrock upgrade, the DeployerWhitelist is completely unused by the Optimism
/// system and could, in theory, be removed entirely.
* system and could, in theory, be removed entirely.
*/
contract DeployerWhitelist is Semver {
contract DeployerWhitelist is Semver {
/**
/// @notice Address of the owner of this contract. Note that when this address is set to
* @notice Address of the owner of this contract. Note that when this address is set to
/// address(0), the whitelist is disabled.
* address(0), the whitelist is disabled.
*/
address public owner;
address public owner;
/**
/// @notice Mapping of deployer addresses to boolean whitelist status.
* @notice Mapping of deployer addresses to boolean whitelist status.
*/
mapping(address => bool) public whitelist;
mapping(address => bool) public whitelist;
/**
/// @notice Emitted when the owner of this contract changes.
* @notice Emitted when the owner of this contract changes.
/// @param oldOwner Address of the previous owner.
*
/// @param newOwner Address of the new owner.
* @param oldOwner Address of the previous owner.
* @param newOwner Address of the new owner.
*/
event OwnerChanged(address oldOwner, address newOwner);
event OwnerChanged(address oldOwner, address newOwner);
/**
/// @notice Emitted when the whitelist status of a deployer changes.
* @notice Emitted when the whitelist status of a deployer changes.
/// @param deployer Address of the deployer.
*
/// @param whitelisted Boolean indicating whether the deployer is whitelisted.
* @param deployer Address of the deployer.
* @param whitelisted Boolean indicating whether the deployer is whitelisted.
*/
event WhitelistStatusChanged(address deployer, bool whitelisted);
event WhitelistStatusChanged(address deployer, bool whitelisted);
/**
/// @notice Emitted when the whitelist is disabled.
* @notice Emitted when the whitelist is disabled.
/// @param oldOwner Address of the final owner of the whitelist.
*
* @param oldOwner Address of the final owner of the whitelist.
*/
event WhitelistDisabled(address oldOwner);
event WhitelistDisabled(address oldOwner);
/**
/// @notice Blocks functions to anyone except the contract owner.
* @notice Blocks functions to anyone except the contract owner.
*/
modifier onlyOwner() {
modifier onlyOwner() {
require(
require(
msg.sender == owner,
msg.sender == owner,
...
@@ -60,27 +43,19 @@ contract DeployerWhitelist is Semver {
...
@@ -60,27 +43,19 @@ contract DeployerWhitelist is Semver {
_;
_;
}
}
/**
/// @custom:semver 1.0.1
* @custom:semver 1.0.0
constructor() Semver(1, 0, 1) {}
*/
constructor() Semver(1, 0, 0) {}
/**
/// @notice Adds or removes an address from the deployment whitelist.
* @notice Adds or removes an address from the deployment whitelist.
/// @param _deployer Address to update permissions for.
*
/// @param _isWhitelisted Whether or not the address is whitelisted.
* @param _deployer Address to update permissions for.
* @param _isWhitelisted Whether or not the address is whitelisted.
*/
function setWhitelistedDeployer(address _deployer, bool _isWhitelisted) external onlyOwner {
function setWhitelistedDeployer(address _deployer, bool _isWhitelisted) external onlyOwner {
whitelist[_deployer] = _isWhitelisted;
whitelist[_deployer] = _isWhitelisted;
emit WhitelistStatusChanged(_deployer, _isWhitelisted);
emit WhitelistStatusChanged(_deployer, _isWhitelisted);
}
}
/**
/// @notice Updates the owner of this contract.
* @notice Updates the owner of this contract.
/// @param _owner Address of the new owner.
*
* @param _owner Address of the new owner.
*/
function setOwner(address _owner) external onlyOwner {
function setOwner(address _owner) external onlyOwner {
// Prevent users from setting the whitelist owner to address(0) except via
// Prevent users from setting the whitelist owner to address(0) except via
// enableArbitraryContractDeployment. If you want to burn the whitelist owner, send it to
// enableArbitraryContractDeployment. If you want to burn the whitelist owner, send it to
...
@@ -94,21 +69,15 @@ contract DeployerWhitelist is Semver {
...
@@ -94,21 +69,15 @@ contract DeployerWhitelist is Semver {
owner = _owner;
owner = _owner;
}
}
/**
/// @notice Permanently enables arbitrary contract deployment and deletes the owner.
* @notice Permanently enables arbitrary contract deployment and deletes the owner.
*/
function enableArbitraryContractDeployment() external onlyOwner {
function enableArbitraryContractDeployment() external onlyOwner {
emit WhitelistDisabled(owner);
emit WhitelistDisabled(owner);
owner = address(0);
owner = address(0);
}
}
/**
/// @notice Checks whether an address is allowed to deploy contracts.
* @notice Checks whether an address is allowed to deploy contracts.
/// @param _deployer Address to check.
*
/// @return Whether or not the address can deploy contracts.
* @param _deployer Address to check.
*
* @return Whether or not the address can deploy contracts.
*/
function isDeployerAllowed(address _deployer) external view returns (bool) {
function isDeployerAllowed(address _deployer) external view returns (bool) {
return (owner == address(0) || whitelist[_deployer]);
return (owner == address(0) || whitelist[_deployer]);
}
}
...
...
packages/contracts-bedrock/contracts/legacy/L1BlockNumber.sol
View file @
92bc1b4f
...
@@ -5,25 +5,19 @@ import { L1Block } from "../L2/L1Block.sol";
...
@@ -5,25 +5,19 @@ import { L1Block } from "../L2/L1Block.sol";
import { Predeploys } from "../libraries/Predeploys.sol";
import { Predeploys } from "../libraries/Predeploys.sol";
import { Semver } from "../universal/Semver.sol";
import { Semver } from "../universal/Semver.sol";
/**
/// @custom:legacy
* @custom:legacy
/// @custom:proxied
* @custom:proxied
/// @custom:predeploy 0x4200000000000000000000000000000000000013
* @custom:predeploy 0x4200000000000000000000000000000000000013
/// @title L1BlockNumber
* @title L1BlockNumber
/// @notice L1BlockNumber is a legacy contract that fills the roll of the OVM_L1BlockNumber contract
* @notice L1BlockNumber is a legacy contract that fills the roll of the OVM_L1BlockNumber contract
/// in the old version of the Optimism system. Only necessary for backwards compatibility.
* in the old version of the Optimism system. Only necessary for backwards compatibility.
/// If you want to access the L1 block number going forward, you should use the L1Block
* If you want to access the L1 block number going forward, you should use the L1Block
/// contract instead.
* contract instead.
*/
contract L1BlockNumber is Semver {
contract L1BlockNumber is Semver {
/**
/// @custom:semver 1.0.1
* @custom:semver 1.0.0
constructor() Semver(1, 0, 1) {}
*/
constructor() Semver(1, 0, 0) {}
/**
/// @notice Returns the L1 block number.
* @notice Returns the L1 block number.
*/
receive() external payable {
receive() external payable {
uint256 l1BlockNumber = getL1BlockNumber();
uint256 l1BlockNumber = getL1BlockNumber();
assembly {
assembly {
...
@@ -32,9 +26,7 @@ contract L1BlockNumber is Semver {
...
@@ -32,9 +26,7 @@ contract L1BlockNumber is Semver {
}
}
}
}
/**
/// @notice Returns the L1 block number.
* @notice Returns the L1 block number.
*/
// solhint-disable-next-line no-complex-fallback
// solhint-disable-next-line no-complex-fallback
fallback() external payable {
fallback() external payable {
uint256 l1BlockNumber = getL1BlockNumber();
uint256 l1BlockNumber = getL1BlockNumber();
...
@@ -44,11 +36,8 @@ contract L1BlockNumber is Semver {
...
@@ -44,11 +36,8 @@ contract L1BlockNumber is Semver {
}
}
}
}
/**
/// @notice Retrieves the latest L1 block number.
* @notice Retrieves the latest L1 block number.
/// @return Latest L1 block number.
*
* @return Latest L1 block number.
*/
function getL1BlockNumber() public view returns (uint256) {
function getL1BlockNumber() public view returns (uint256) {
return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).number();
return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).number();
}
}
...
...
packages/contracts-bedrock/contracts/legacy/L1ChugSplashProxy.sol
View file @
92bc1b4f
// SPDX-License-Identifier: MIT
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
pragma solidity 0.8.15;
/**
/// @title IL1ChugSplashDeployer
* @title IL1ChugSplashDeployer
*/
interface IL1ChugSplashDeployer {
interface IL1ChugSplashDeployer {
function isUpgrading() external view returns (bool);
function isUpgrading() external view returns (bool);
}
}
/**
/// @custom:legacy
* @custom:legacy
/// @title L1ChugSplashProxy
* @title L1ChugSplashProxy
/// @notice Basic ChugSplash proxy contract for L1. Very close to being a normal proxy but has added
* @notice Basic ChugSplash proxy contract for L1. Very close to being a normal proxy but has added
/// functions `setCode` and `setStorage` for changing the code or storage of the contract.
* functions `setCode` and `setStorage` for changing the code or storage of the contract.
/// Note for future developers: do NOT make anything in this contract 'public' unless you
*
/// know what you're doing. Anything public can potentially have a function signature that
* Note for future developers: do NOT make anything in this contract 'public' unless you
/// conflicts with a signature attached to the implementation contract. Public functions
* know what you're doing. Anything public can potentially have a function signature that
/// SHOULD always have the `proxyCallIfNotOwner` modifier unless there's some *really* good
* conflicts with a signature attached to the implementation contract. Public functions
/// reason not to have that modifier. And there almost certainly is not a good reason to not
* SHOULD always have the `proxyCallIfNotOwner` modifier unless there's some *really* good
/// have that modifier. Beware!
* reason not to have that modifier. And there almost certainly is not a good reason to not
* have that modifier. Beware!
*/
contract L1ChugSplashProxy {
contract L1ChugSplashProxy {
/**
/// @notice "Magic" prefix. When prepended to some arbitrary bytecode and used to create a
* @notice "Magic" prefix. When prepended to some arbitrary bytecode and used to create a
/// contract, the appended bytecode will be deployed as given.
* contract, the appended bytecode will be deployed as given.
*/
bytes13 internal constant DEPLOY_CODE_PREFIX = 0x600D380380600D6000396000f3;
bytes13 internal constant DEPLOY_CODE_PREFIX = 0x600D380380600D6000396000f3;
/**
/// @notice bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)
* @notice bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)
*/
bytes32 internal constant IMPLEMENTATION_KEY =
bytes32 internal constant IMPLEMENTATION_KEY =
0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
/// @notice bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1)
* @notice bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1)
*/
bytes32 internal constant OWNER_KEY =
bytes32 internal constant OWNER_KEY =
0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
/// @notice Blocks a function from being called when the parent signals that the system should
* @notice Blocks a function from being called when the parent signals that the system should
/// be paused via an isUpgrading function.
* be paused via an isUpgrading function.
*/
modifier onlyWhenNotPaused() {
modifier onlyWhenNotPaused() {
address owner = _getOwner();
address owner = _getOwner();
...
@@ -68,21 +55,18 @@ contract L1ChugSplashProxy {
...
@@ -68,21 +55,18 @@ contract L1ChugSplashProxy {
_;
_;
}
}
/**
/// @notice Makes a proxy call instead of triggering the given function when the caller is
* @notice Makes a proxy call instead of triggering the given function when the caller is
/// either the owner or the zero address. Caller can only ever be the zero address if
* either the owner or the zero address. Caller can only ever be the zero address if
/// this function is being called off-chain via eth_call, which is totally fine and can
* this function is being called off-chain via eth_call, which is totally fine and can
/// be convenient for client-side tooling. Avoids situations where the proxy and
* be convenient for client-side tooling. Avoids situations where the proxy and
/// implementation share a sighash and the proxy function ends up being called instead
* implementation share a sighash and the proxy function ends up being called instead
/// of the implementation one.
* of the implementation one.
/// Note: msg.sender == address(0) can ONLY be triggered off-chain via eth_call. If
*
/// there's a way for someone to send a transaction with msg.sender == address(0) in any
* Note: msg.sender == address(0) can ONLY be triggered off-chain via eth_call. If
/// real context then we have much bigger problems. Primary reason to include this
* there's a way for someone to send a transaction with msg.sender == address(0) in any
/// additional allowed sender is because the owner address can be changed dynamically
* real context then we have much bigger problems. Primary reason to include this
/// and we do not want clients to have to keep track of the current owner in order to
* additional allowed sender is because the owner address can be changed dynamically
/// make an eth_call that doesn't trigger the proxied contract.
* and we do not want clients to have to keep track of the current owner in order to
* make an eth_call that doesn't trigger the proxied contract.
*/
// slither-disable-next-line incorrect-modifier
// slither-disable-next-line incorrect-modifier
modifier proxyCallIfNotOwner() {
modifier proxyCallIfNotOwner() {
if (msg.sender == _getOwner() || msg.sender == address(0)) {
if (msg.sender == _getOwner() || msg.sender == address(0)) {
...
@@ -93,9 +77,7 @@ contract L1ChugSplashProxy {
...
@@ -93,9 +77,7 @@ contract L1ChugSplashProxy {
}
}
}
}
/**
/// @param _owner Address of the initial contract owner.
* @param _owner Address of the initial contract owner.
*/
constructor(address _owner) {
constructor(address _owner) {
_setOwner(_owner);
_setOwner(_owner);
}
}
...
@@ -112,16 +94,12 @@ contract L1ChugSplashProxy {
...
@@ -112,16 +94,12 @@ contract L1ChugSplashProxy {
_doProxyCall();
_doProxyCall();
}
}
/**
/// @notice Sets the code that should be running behind this proxy.
* @notice Sets the code that should be running behind this proxy.
/// Note: This scheme is a bit different from the standard proxy scheme where one would
*
/// typically deploy the code separately and then set the implementation address. We're
* Note: This scheme is a bit different from the standard proxy scheme where one would
/// doing it this way because it gives us a lot more freedom on the client side. Can
* typically deploy the code separately and then set the implementation address. We're
/// only be triggered by the contract owner.
* doing it this way because it gives us a lot more freedom on the client side. Can
/// @param _code New contract code to run inside this contract.
* only be triggered by the contract owner.
*
* @param _code New contract code to run inside this contract.
*/
function setCode(bytes memory _code) external proxyCallIfNotOwner {
function setCode(bytes memory _code) external proxyCallIfNotOwner {
// Get the code hash of the current implementation.
// Get the code hash of the current implementation.
address implementation = _getImplementation();
address implementation = _getImplementation();
...
@@ -152,73 +130,53 @@ contract L1ChugSplashProxy {
...
@@ -152,73 +130,53 @@ contract L1ChugSplashProxy {
_setImplementation(newImplementation);
_setImplementation(newImplementation);
}
}
/**
/// @notice Modifies some storage slot within the proxy contract. Gives us a lot of power to
* @notice Modifies some storage slot within the proxy contract. Gives us a lot of power to
/// perform upgrades in a more transparent way. Only callable by the owner.
* perform upgrades in a more transparent way. Only callable by the owner.
/// @param _key Storage key to modify.
*
/// @param _value New value for the storage key.
* @param _key Storage key to modify.
* @param _value New value for the storage key.
*/
function setStorage(bytes32 _key, bytes32 _value) external proxyCallIfNotOwner {
function setStorage(bytes32 _key, bytes32 _value) external proxyCallIfNotOwner {
assembly {
assembly {
sstore(_key, _value)
sstore(_key, _value)
}
}
}
}
/**
/// @notice Changes the owner of the proxy contract. Only callable by the owner.
* @notice Changes the owner of the proxy contract. Only callable by the owner.
/// @param _owner New owner of the proxy contract.
*
* @param _owner New owner of the proxy contract.
*/
function setOwner(address _owner) external proxyCallIfNotOwner {
function setOwner(address _owner) external proxyCallIfNotOwner {
_setOwner(_owner);
_setOwner(_owner);
}
}
/**
/// @notice Queries the owner of the proxy contract. Can only be called by the owner OR by
* @notice Queries the owner of the proxy contract. Can only be called by the owner OR by
/// making an eth_call and setting the "from" address to address(0).
* making an eth_call and setting the "from" address to address(0).
/// @return Owner address.
*
* @return Owner address.
*/
function getOwner() external proxyCallIfNotOwner returns (address) {
function getOwner() external proxyCallIfNotOwner returns (address) {
return _getOwner();
return _getOwner();
}
}
/**
/// @notice Queries the implementation address. Can only be called by the owner OR by making an
* @notice Queries the implementation address. Can only be called by the owner OR by making an
/// eth_call and setting the "from" address to address(0).
* eth_call and setting the "from" address to address(0).
/// @return Implementation address.
*
* @return Implementation address.
*/
function getImplementation() external proxyCallIfNotOwner returns (address) {
function getImplementation() external proxyCallIfNotOwner returns (address) {
return _getImplementation();
return _getImplementation();
}
}
/**
/// @notice Sets the implementation address.
* @notice Sets the implementation address.
/// @param _implementation New implementation address.
*
* @param _implementation New implementation address.
*/
function _setImplementation(address _implementation) internal {
function _setImplementation(address _implementation) internal {
assembly {
assembly {
sstore(IMPLEMENTATION_KEY, _implementation)
sstore(IMPLEMENTATION_KEY, _implementation)
}
}
}
}
/**
/// @notice Changes the owner of the proxy contract.
* @notice Changes the owner of the proxy contract.
/// @param _owner New owner of the proxy contract.
*
* @param _owner New owner of the proxy contract.
*/
function _setOwner(address _owner) internal {
function _setOwner(address _owner) internal {
assembly {
assembly {
sstore(OWNER_KEY, _owner)
sstore(OWNER_KEY, _owner)
}
}
}
}
/**
/// @notice Performs the proxy call via a delegatecall.
* @notice Performs the proxy call via a delegatecall.
*/
function _doProxyCall() internal onlyWhenNotPaused {
function _doProxyCall() internal onlyWhenNotPaused {
address implementation = _getImplementation();
address implementation = _getImplementation();
...
@@ -246,11 +204,8 @@ contract L1ChugSplashProxy {
...
@@ -246,11 +204,8 @@ contract L1ChugSplashProxy {
}
}
}
}
/**
/// @notice Queries the implementation address.
* @notice Queries the implementation address.
/// @return Implementation address.
*
* @return Implementation address.
*/
function _getImplementation() internal view returns (address) {
function _getImplementation() internal view returns (address) {
address implementation;
address implementation;
assembly {
assembly {
...
@@ -259,11 +214,8 @@ contract L1ChugSplashProxy {
...
@@ -259,11 +214,8 @@ contract L1ChugSplashProxy {
return implementation;
return implementation;
}
}
/**
/// @notice Queries the owner of the proxy contract.
* @notice Queries the owner of the proxy contract.
/// @return Owner address.
*
* @return Owner address.
*/
function _getOwner() internal view returns (address) {
function _getOwner() internal view returns (address) {
address owner;
address owner;
assembly {
assembly {
...
@@ -272,13 +224,9 @@ contract L1ChugSplashProxy {
...
@@ -272,13 +224,9 @@ contract L1ChugSplashProxy {
return owner;
return owner;
}
}
/**
/// @notice Gets the code hash for a given account.
* @notice Gets the code hash for a given account.
/// @param _account Address of the account to get a code hash for.
*
/// @return Code hash for the account.
* @param _account Address of the account to get a code hash for.
*
* @return Code hash for the account.
*/
function _getAccountCodeHash(address _account) internal view returns (bytes32) {
function _getAccountCodeHash(address _account) internal view returns (bytes32) {
bytes32 codeHash;
bytes32 codeHash;
assembly {
assembly {
...
...
packages/contracts-bedrock/contracts/legacy/LegacyERC20ETH.sol
View file @
92bc1b4f
...
@@ -4,73 +4,55 @@ pragma solidity 0.8.15;
...
@@ -4,73 +4,55 @@ pragma solidity 0.8.15;
import { Predeploys } from "../libraries/Predeploys.sol";
import { Predeploys } from "../libraries/Predeploys.sol";
import { OptimismMintableERC20 } from "../universal/OptimismMintableERC20.sol";
import { OptimismMintableERC20 } from "../universal/OptimismMintableERC20.sol";
/**
/// @custom:legacy
* @custom:legacy
/// @custom:proxied
* @custom:proxied
/// @custom:predeploy 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000
* @custom:predeploy 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000
/// @title LegacyERC20ETH
* @title LegacyERC20ETH
/// @notice LegacyERC20ETH is a legacy contract that held ETH balances before the Bedrock upgrade.
* @notice LegacyERC20ETH is a legacy contract that held ETH balances before the Bedrock upgrade.
/// All ETH balances held within this contract were migrated to the state trie as part of
* All ETH balances held within this contract were migrated to the state trie as part of
/// the Bedrock upgrade. Functions within this contract that mutate state were already
* the Bedrock upgrade. Functions within this contract that mutate state were already
/// disabled as part of the EVM equivalence upgrade.
* disabled as part of the EVM equivalence upgrade.
*/
contract LegacyERC20ETH is OptimismMintableERC20 {
contract LegacyERC20ETH is OptimismMintableERC20 {
/**
/// @notice Initializes the contract as an Optimism Mintable ERC20.
* @notice Initializes the contract as an Optimism Mintable ERC20.
*/
constructor()
constructor()
OptimismMintableERC20(Predeploys.L2_STANDARD_BRIDGE, address(0), "Ether", "ETH")
OptimismMintableERC20(Predeploys.L2_STANDARD_BRIDGE, address(0), "Ether", "ETH")
{}
{}
/**
/// @notice Returns the ETH balance of the target account. Overrides the base behavior of the
* @notice Returns the ETH balance of the target account. Overrides the base behavior of the
/// contract to preserve the invariant that the balance within this contract always
* contract to preserve the invariant that the balance within this contract always
/// matches the balance in the state trie.
* matches the balance in the state trie.
/// @param _who Address of the account to query.
*
/// @return The ETH balance of the target account.
* @param _who Address of the account to query.
*
* @return The ETH balance of the target account.
*/
function balanceOf(address _who) public view virtual override returns (uint256) {
function balanceOf(address _who) public view virtual override returns (uint256) {
return address(_who).balance;
return address(_who).balance;
}
}
/**
/// @custom:blocked
* @custom:blocked
/// @notice Mints some amount of ETH.
* @notice Mints some amount of ETH.
*/
function mint(address, uint256) public virtual override {
function mint(address, uint256) public virtual override {
revert("LegacyERC20ETH: mint is disabled");
revert("LegacyERC20ETH: mint is disabled");
}
}
/**
/// @custom:blocked
* @custom:blocked
/// @notice Burns some amount of ETH.
* @notice Burns some amount of ETH.
*/
function burn(address, uint256) public virtual override {
function burn(address, uint256) public virtual override {
revert("LegacyERC20ETH: burn is disabled");
revert("LegacyERC20ETH: burn is disabled");
}
}
/**
/// @custom:blocked
* @custom:blocked
/// @notice Transfers some amount of ETH.
* @notice Transfers some amount of ETH.
*/
function transfer(address, uint256) public virtual override returns (bool) {
function transfer(address, uint256) public virtual override returns (bool) {
revert("LegacyERC20ETH: transfer is disabled");
revert("LegacyERC20ETH: transfer is disabled");
}
}
/**
/// @custom:blocked
* @custom:blocked
/// @notice Approves a spender to spend some amount of ETH.
* @notice Approves a spender to spend some amount of ETH.
*/
function approve(address, uint256) public virtual override returns (bool) {
function approve(address, uint256) public virtual override returns (bool) {
revert("LegacyERC20ETH: approve is disabled");
revert("LegacyERC20ETH: approve is disabled");
}
}
/**
/// @custom:blocked
* @custom:blocked
/// @notice Transfers funds from some sender account.
* @notice Transfers funds from some sender account.
*/
function transferFrom(
function transferFrom(
address,
address,
address,
address,
...
@@ -79,18 +61,14 @@ contract LegacyERC20ETH is OptimismMintableERC20 {
...
@@ -79,18 +61,14 @@ contract LegacyERC20ETH is OptimismMintableERC20 {
revert("LegacyERC20ETH: transferFrom is disabled");
revert("LegacyERC20ETH: transferFrom is disabled");
}
}
/**
/// @custom:blocked
* @custom:blocked
/// @notice Increases the allowance of a spender.
* @notice Increases the allowance of a spender.
*/
function increaseAllowance(address, uint256) public virtual override returns (bool) {
function increaseAllowance(address, uint256) public virtual override returns (bool) {
revert("LegacyERC20ETH: increaseAllowance is disabled");
revert("LegacyERC20ETH: increaseAllowance is disabled");
}
}
/**
/// @custom:blocked
* @custom:blocked
/// @notice Decreases the allowance of a spender.
* @notice Decreases the allowance of a spender.
*/
function decreaseAllowance(address, uint256) public virtual override returns (bool) {
function decreaseAllowance(address, uint256) public virtual override returns (bool) {
revert("LegacyERC20ETH: decreaseAllowance is disabled");
revert("LegacyERC20ETH: decreaseAllowance is disabled");
}
}
...
...
packages/contracts-bedrock/contracts/legacy/LegacyMessagePasser.sol
View file @
92bc1b4f
...
@@ -3,30 +3,21 @@ pragma solidity 0.8.15;
...
@@ -3,30 +3,21 @@ pragma solidity 0.8.15;
import { Semver } from "../universal/Semver.sol";
import { Semver } from "../universal/Semver.sol";
/**
/// @custom:legacy
* @custom:legacy
/// @custom:proxied
* @custom:proxied
/// @custom:predeploy 0x4200000000000000000000000000000000000000
* @custom:predeploy 0x4200000000000000000000000000000000000000
/// @title LegacyMessagePasser
* @title LegacyMessagePasser
/// @notice The LegacyMessagePasser was the low-level mechanism used to send messages from L2 to L1
* @notice The LegacyMessagePasser was the low-level mechanism used to send messages from L2 to L1
/// before the Bedrock upgrade. It is now deprecated in favor of the new MessagePasser.
* before the Bedrock upgrade. It is now deprecated in favor of the new MessagePasser.
*/
contract LegacyMessagePasser is Semver {
contract LegacyMessagePasser is Semver {
/**
/// @notice Mapping of sent message hashes to boolean status.
* @notice Mapping of sent message hashes to boolean status.
*/
mapping(bytes32 => bool) public sentMessages;
mapping(bytes32 => bool) public sentMessages;
/**
/// @custom:semver 1.0.1
* @custom:semver 1.0.0
constructor() Semver(1, 0, 1) {}
*/
constructor() Semver(1, 0, 0) {}
/**
/// @notice Passes a message to L1.
* @notice Passes a message to L1.
/// @param _message Message to pass to L1.
*
* @param _message Message to pass to L1.
*/
function passMessageToL1(bytes memory _message) external {
function passMessageToL1(bytes memory _message) external {
sentMessages[keccak256(abi.encodePacked(_message, msg.sender))] = true;
sentMessages[keccak256(abi.encodePacked(_message, msg.sender))] = true;
}
}
...
...
packages/contracts-bedrock/contracts/legacy/LegacyMintableERC20.sol
View file @
92bc1b4f
...
@@ -4,38 +4,26 @@ pragma solidity 0.8.15;
...
@@ -4,38 +4,26 @@ pragma solidity 0.8.15;
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { ILegacyMintableERC20 } from "../universal/OptimismMintableERC20.sol";
import { ILegacyMintableERC20 } from "../universal/OptimismMintableERC20.sol";
/**
/// @title LegacyMintableERC20
* @title LegacyMintableERC20
/// @notice The legacy implementation of the OptimismMintableERC20. This
* @notice The legacy implementation of the OptimismMintableERC20. This
/// contract is deprecated and should no longer be used.
* contract is deprecated and should no longer be used.
*/
contract LegacyMintableERC20 is ILegacyMintableERC20, ERC20 {
contract LegacyMintableERC20 is ILegacyMintableERC20, ERC20 {
/**
/// @notice Emitted when the token is minted by the bridge.
* @notice Emitted when the token is minted by the bridge.
*/
event Mint(address indexed _account, uint256 _amount);
event Mint(address indexed _account, uint256 _amount);
/**
/// @notice Emitted when a token is burned by the bridge.
* @notice Emitted when a token is burned by the bridge.
*/
event Burn(address indexed _account, uint256 _amount);
event Burn(address indexed _account, uint256 _amount);
/**
/// @notice The token on the remote domain.
* @notice The token on the remote domain.
*/
address public l1Token;
address public l1Token;
/**
/// @notice The local bridge.
* @notice The local bridge.
*/
address public l2Bridge;
address public l2Bridge;
/**
/// @param _l2Bridge Address of the L2 standard bridge.
* @param _l2Bridge Address of the L2 standard bridge.
/// @param _l1Token Address of the corresponding L1 token.
* @param _l1Token Address of the corresponding L1 token.
/// @param _name ERC20 name.
* @param _name ERC20 name.
/// @param _symbol ERC20 symbol.
* @param _symbol ERC20 symbol.
*/
constructor(
constructor(
address _l2Bridge,
address _l2Bridge,
address _l1Token,
address _l1Token,
...
@@ -46,17 +34,13 @@ contract LegacyMintableERC20 is ILegacyMintableERC20, ERC20 {
...
@@ -46,17 +34,13 @@ contract LegacyMintableERC20 is ILegacyMintableERC20, ERC20 {
l2Bridge = _l2Bridge;
l2Bridge = _l2Bridge;
}
}
/**
/// @notice Modifier that requires the contract was called by the bridge.
* @notice Modifier that requires the contract was called by the bridge.
*/
modifier onlyL2Bridge() {
modifier onlyL2Bridge() {
require(msg.sender == l2Bridge, "Only L2 Bridge can mint and burn");
require(msg.sender == l2Bridge, "Only L2 Bridge can mint and burn");
_;
_;
}
}
/**
/// @notice EIP165 implementation.
* @notice EIP165 implementation.
*/
function supportsInterface(bytes4 _interfaceId) public pure returns (bool) {
function supportsInterface(bytes4 _interfaceId) public pure returns (bool) {
bytes4 firstSupportedInterface = bytes4(keccak256("supportsInterface(bytes4)")); // ERC165
bytes4 firstSupportedInterface = bytes4(keccak256("supportsInterface(bytes4)")); // ERC165
bytes4 secondSupportedInterface = ILegacyMintableERC20.l1Token.selector ^
bytes4 secondSupportedInterface = ILegacyMintableERC20.l1Token.selector ^
...
@@ -65,22 +49,18 @@ contract LegacyMintableERC20 is ILegacyMintableERC20, ERC20 {
...
@@ -65,22 +49,18 @@ contract LegacyMintableERC20 is ILegacyMintableERC20, ERC20 {
return _interfaceId == firstSupportedInterface || _interfaceId == secondSupportedInterface;
return _interfaceId == firstSupportedInterface || _interfaceId == secondSupportedInterface;
}
}
/**
/// @notice Only the bridge can mint tokens.
* @notice Only the bridge can mint tokens.
/// @param _to The account receiving tokens.
* @param _to The account receiving tokens.
/// @param _amount The amount of tokens to receive.
* @param _amount The amount of tokens to receive.
*/
function mint(address _to, uint256 _amount) public virtual onlyL2Bridge {
function mint(address _to, uint256 _amount) public virtual onlyL2Bridge {
_mint(_to, _amount);
_mint(_to, _amount);
emit Mint(_to, _amount);
emit Mint(_to, _amount);
}
}
/**
/// @notice Only the bridge can burn tokens.
* @notice Only the bridge can burn tokens.
/// @param _from The account having tokens burnt.
* @param _from The account having tokens burnt.
/// @param _amount The amount of tokens being burnt.
* @param _amount The amount of tokens being burnt.
*/
function burn(address _from, uint256 _amount) public virtual onlyL2Bridge {
function burn(address _from, uint256 _amount) public virtual onlyL2Bridge {
_burn(_from, _amount);
_burn(_from, _amount);
...
...
packages/contracts-bedrock/contracts/legacy/ResolvedDelegateProxy.sol
View file @
92bc1b4f
...
@@ -3,43 +3,33 @@ pragma solidity 0.8.15;
...
@@ -3,43 +3,33 @@ pragma solidity 0.8.15;
import { AddressManager } from "./AddressManager.sol";
import { AddressManager } from "./AddressManager.sol";
/**
/// @custom:legacy
* @custom:legacy
/// @title ResolvedDelegateProxy
* @title ResolvedDelegateProxy
/// @notice ResolvedDelegateProxy is a legacy proxy contract that makes use of the AddressManager to
* @notice ResolvedDelegateProxy is a legacy proxy contract that makes use of the AddressManager to
/// resolve the implementation address. We're maintaining this contract for backwards
* resolve the implementation address. We're maintaining this contract for backwards
/// compatibility so we can manage all legacy proxies where necessary.
* compatibility so we can manage all legacy proxies where necessary.
*/
contract ResolvedDelegateProxy {
contract ResolvedDelegateProxy {
/**
/// @notice Mapping used to store the implementation name that corresponds to this contract. A
* @notice Mapping used to store the implementation name that corresponds to this contract. A
/// mapping was originally used as a way to bypass the same issue normally solved by
* mapping was originally used as a way to bypass the same issue normally solved by
/// storing the implementation address in a specific storage slot that does not conflict
* storing the implementation address in a specific storage slot that does not conflict
/// with any other storage slot. Generally NOT a safe solution but works as long as the
* with any other storage slot. Generally NOT a safe solution but works as long as the
/// implementation does not also keep a mapping in the first storage slot.
* implementation does not also keep a mapping in the first storage slot.
*/
mapping(address => string) private implementationName;
mapping(address => string) private implementationName;
/**
/// @notice Mapping used to store the address of the AddressManager contract where the
* @notice Mapping used to store the address of the AddressManager contract where the
/// implementation address will be resolved from. Same concept here as with the above
* implementation address will be resolved from. Same concept here as with the above
/// mapping. Also generally unsafe but fine if the implementation doesn't keep a mapping
* mapping. Also generally unsafe but fine if the implementation doesn't keep a mapping
/// in the second storage slot.
* in the second storage slot.
*/
mapping(address => AddressManager) private addressManager;
mapping(address => AddressManager) private addressManager;
/**
/// @param _addressManager Address of the AddressManager.
* @param _addressManager Address of the AddressManager.
/// @param _implementationName implementationName of the contract to proxy to.
* @param _implementationName implementationName of the contract to proxy to.
*/
constructor(AddressManager _addressManager, string memory _implementationName) {
constructor(AddressManager _addressManager, string memory _implementationName) {
addressManager[address(this)] = _addressManager;
addressManager[address(this)] = _addressManager;
implementationName[address(this)] = _implementationName;
implementationName[address(this)] = _implementationName;
}
}
/**
/// @notice Fallback, performs a delegatecall to the resolved implementation address.
* @notice Fallback, performs a delegatecall to the resolved implementation address.
*/
// solhint-disable-next-line no-complex-fallback
// solhint-disable-next-line no-complex-fallback
fallback() external payable {
fallback() external payable {
address target = addressManager[address(this)].getAddress(
address target = addressManager[address(this)].getAddress(
...
...
packages/contracts-bedrock/contracts/test/DeployerWhitelist.t.sol
View file @
92bc1b4f
// SPDX-License-Identifier: MIT
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
pragma solidity 0.8.15;
// Testing utilities
import { CommonTest } from "./CommonTest.t.sol";
import { CommonTest } from "./CommonTest.t.sol";
// Target contract
import { DeployerWhitelist } from "../legacy/DeployerWhitelist.sol";
import { DeployerWhitelist } from "../legacy/DeployerWhitelist.sol";
contract DeployerWhitelist_Test is CommonTest {
contract DeployerWhitelist_Test is CommonTest {
DeployerWhitelist list;
DeployerWhitelist list;
/// @dev Sets up the test suite.
function setUp() public virtual override {
function setUp() public virtual override {
list = new DeployerWhitelist();
list = new DeployerWhitelist();
}
}
//
The owner should be address(0)
//
/ @dev Tests that `owner` is initialized to the zero address.
function test_owner_succeeds() external {
function test_owner_succeeds() external {
assertEq(list.owner(), address(0));
assertEq(list.owner(), address(0));
}
}
//
The storage slot for the owner must be the same
//
/ @dev Tests that `setOwner` correctly sets the contract owner.
function test_storageSlots_succeeds() external {
function test_storageSlots_succeeds() external {
vm.prank(list.owner());
vm.prank(list.owner());
list.setOwner(address(1));
list.setOwner(address(1));
...
...
packages/contracts-bedrock/contracts/test/L1BlockNumber.t.sol
View file @
92bc1b4f
// SPDX-License-Identifier: MIT
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
pragma solidity 0.8.15;
// Testing utilities
import { Test } from "forge-std/Test.sol";
import { Test } from "forge-std/Test.sol";
// Target contract dependencies
import { L1Block } from "../L2/L1Block.sol";
import { L1Block } from "../L2/L1Block.sol";
import { L1BlockNumber } from "../legacy/L1BlockNumber.sol";
import { Predeploys } from "../libraries/Predeploys.sol";
import { Predeploys } from "../libraries/Predeploys.sol";
// Target contract
import { L1BlockNumber } from "../legacy/L1BlockNumber.sol";
contract L1BlockNumberTest is Test {
contract L1BlockNumberTest is Test {
L1Block lb;
L1Block lb;
L1BlockNumber bn;
L1BlockNumber bn;
uint64 constant number = 99;
uint64 constant number = 99;
/// @dev Sets up the test suite.
function setUp() external {
function setUp() external {
vm.etch(Predeploys.L1_BLOCK_ATTRIBUTES, address(new L1Block()).code);
vm.etch(Predeploys.L1_BLOCK_ATTRIBUTES, address(new L1Block()).code);
lb = L1Block(Predeploys.L1_BLOCK_ATTRIBUTES);
lb = L1Block(Predeploys.L1_BLOCK_ATTRIBUTES);
...
@@ -30,16 +36,19 @@ contract L1BlockNumberTest is Test {
...
@@ -30,16 +36,19 @@ contract L1BlockNumberTest is Test {
});
});
}
}
/// @dev Tests that `getL1BlockNumber` returns the set block number.
function test_getL1BlockNumber_succeeds() external {
function test_getL1BlockNumber_succeeds() external {
assertEq(bn.getL1BlockNumber(), number);
assertEq(bn.getL1BlockNumber(), number);
}
}
/// @dev Tests that `fallback` is correctly dispatched.
function test_fallback_succeeds() external {
function test_fallback_succeeds() external {
(bool success, bytes memory ret) = address(bn).call(hex"");
(bool success, bytes memory ret) = address(bn).call(hex"");
assertEq(success, true);
assertEq(success, true);
assertEq(ret, abi.encode(number));
assertEq(ret, abi.encode(number));
}
}
/// @dev Tests that `receive` is correctly dispatched.
function test_receive_succeeds() external {
function test_receive_succeeds() external {
(bool success, bytes memory ret) = address(bn).call{ value: 1 }(hex"");
(bool success, bytes memory ret) = address(bn).call{ value: 1 }(hex"");
assertEq(success, true);
assertEq(success, true);
...
...
packages/contracts-bedrock/contracts/test/LegacyERC20ETH.t.sol
View file @
92bc1b4f
// SPDX-License-Identifier: MIT
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
pragma solidity 0.8.15;
// Testing utilities
import { CommonTest } from "./CommonTest.t.sol";
import { CommonTest } from "./CommonTest.t.sol";
import { LegacyERC20ETH } from "../legacy/LegacyERC20ETH.sol";
// Target contract dependencies
import { Predeploys } from "../libraries/Predeploys.sol";
import { Predeploys } from "../libraries/Predeploys.sol";
// Target contract
import { LegacyERC20ETH } from "../legacy/LegacyERC20ETH.sol";
contract LegacyERC20ETH_Test is CommonTest {
contract LegacyERC20ETH_Test is CommonTest {
LegacyERC20ETH eth;
LegacyERC20ETH eth;
/// @dev Sets up the test suite.
function setUp() public virtual override {
function setUp() public virtual override {
super.setUp();
super.setUp();
eth = new LegacyERC20ETH();
eth = new LegacyERC20ETH();
}
}
/// @dev Tests that the default metadata was set correctly.
function test_metadata_succeeds() external {
function test_metadata_succeeds() external {
assertEq(eth.name(), "Ether");
assertEq(eth.name(), "Ether");
assertEq(eth.symbol(), "ETH");
assertEq(eth.symbol(), "ETH");
assertEq(eth.decimals(), 18);
assertEq(eth.decimals(), 18);
}
}
/// @dev Tests that `l2Bridge` and `l1Token` return the correct values.
function test_crossDomain_succeeds() external {
function test_crossDomain_succeeds() external {
assertEq(eth.l2Bridge(), Predeploys.L2_STANDARD_BRIDGE);
assertEq(eth.l2Bridge(), Predeploys.L2_STANDARD_BRIDGE);
assertEq(eth.l1Token(), address(0));
assertEq(eth.l1Token(), address(0));
}
}
/// @dev Tests that `transfer` reverts since it does not exist.
function test_transfer_doesNotExist_reverts() external {
function test_transfer_doesNotExist_reverts() external {
vm.expectRevert("LegacyERC20ETH: transfer is disabled");
vm.expectRevert("LegacyERC20ETH: transfer is disabled");
eth.transfer(alice, 100);
eth.transfer(alice, 100);
}
}
/// @dev Tests that `approve` reverts since it does not exist.
function test_approve_doesNotExist_reverts() external {
function test_approve_doesNotExist_reverts() external {
vm.expectRevert("LegacyERC20ETH: approve is disabled");
vm.expectRevert("LegacyERC20ETH: approve is disabled");
eth.approve(alice, 100);
eth.approve(alice, 100);
}
}
/// @dev Tests that `transferFrom` reverts since it does not exist.
function test_transferFrom_doesNotExist_reverts() external {
function test_transferFrom_doesNotExist_reverts() external {
vm.expectRevert("LegacyERC20ETH: transferFrom is disabled");
vm.expectRevert("LegacyERC20ETH: transferFrom is disabled");
eth.transferFrom(bob, alice, 100);
eth.transferFrom(bob, alice, 100);
}
}
/// @dev Tests that `increaseAllowance` reverts since it does not exist.
function test_increaseAllowance_doesNotExist_reverts() external {
function test_increaseAllowance_doesNotExist_reverts() external {
vm.expectRevert("LegacyERC20ETH: increaseAllowance is disabled");
vm.expectRevert("LegacyERC20ETH: increaseAllowance is disabled");
eth.increaseAllowance(alice, 100);
eth.increaseAllowance(alice, 100);
}
}
/// @dev Tests that `decreaseAllowance` reverts since it does not exist.
function test_decreaseAllowance_doesNotExist_reverts() external {
function test_decreaseAllowance_doesNotExist_reverts() external {
vm.expectRevert("LegacyERC20ETH: decreaseAllowance is disabled");
vm.expectRevert("LegacyERC20ETH: decreaseAllowance is disabled");
eth.decreaseAllowance(alice, 100);
eth.decreaseAllowance(alice, 100);
}
}
/// @dev Tests that `mint` reverts since it does not exist.
function test_mint_doesNotExist_reverts() external {
function test_mint_doesNotExist_reverts() external {
vm.expectRevert("LegacyERC20ETH: mint is disabled");
vm.expectRevert("LegacyERC20ETH: mint is disabled");
eth.mint(alice, 100);
eth.mint(alice, 100);
}
}
/// @dev Tests that `burn` reverts since it does not exist.
function test_burn_doesNotExist_reverts() external {
function test_burn_doesNotExist_reverts() external {
vm.expectRevert("LegacyERC20ETH: burn is disabled");
vm.expectRevert("LegacyERC20ETH: burn is disabled");
eth.burn(alice, 100);
eth.burn(alice, 100);
...
...
packages/contracts-bedrock/contracts/test/LegacyMessagePasser.t.sol
View file @
92bc1b4f
// SPDX-License-Identifier: MIT
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
pragma solidity 0.8.15;
// Testing utilities
import { CommonTest } from "./CommonTest.t.sol";
import { CommonTest } from "./CommonTest.t.sol";
import { LegacyMessagePasser } from "../legacy/LegacyMessagePasser.sol";
// Testing contract dependencies
import { Predeploys } from "../libraries/Predeploys.sol";
import { Predeploys } from "../libraries/Predeploys.sol";
// Target contract
import { LegacyMessagePasser } from "../legacy/LegacyMessagePasser.sol";
contract LegacyMessagePasser_Test is CommonTest {
contract LegacyMessagePasser_Test is CommonTest {
LegacyMessagePasser messagePasser;
LegacyMessagePasser messagePasser;
/// @dev Sets up the test suite.
function setUp() public virtual override {
function setUp() public virtual override {
super.setUp();
super.setUp();
messagePasser = new LegacyMessagePasser();
messagePasser = new LegacyMessagePasser();
}
}
/// @dev Tests that `passMessageToL1` succeeds.
function test_passMessageToL1_succeeds() external {
function test_passMessageToL1_succeeds() external {
vm.prank(alice);
vm.prank(alice);
messagePasser.passMessageToL1(hex"ff");
messagePasser.passMessageToL1(hex"ff");
...
...
packages/contracts-bedrock/contracts/test/ResolvedDelegateProxy.t.sol
View file @
92bc1b4f
// SPDX-License-Identifier: MIT
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
pragma solidity 0.8.15;
// Testing utilities
import { Test } from "forge-std/Test.sol";
import { Test } from "forge-std/Test.sol";
// Target contract dependencies
import { AddressManager } from "../legacy/AddressManager.sol";
import { AddressManager } from "../legacy/AddressManager.sol";
// Target contract
import { ResolvedDelegateProxy } from "../legacy/ResolvedDelegateProxy.sol";
import { ResolvedDelegateProxy } from "../legacy/ResolvedDelegateProxy.sol";
contract ResolvedDelegateProxy_Test is Test {
contract ResolvedDelegateProxy_Test is Test {
...
@@ -10,6 +15,7 @@ contract ResolvedDelegateProxy_Test is Test {
...
@@ -10,6 +15,7 @@ contract ResolvedDelegateProxy_Test is Test {
SimpleImplementation internal impl;
SimpleImplementation internal impl;
SimpleImplementation internal proxy;
SimpleImplementation internal proxy;
/// @dev Sets up the test suite.
function setUp() public {
function setUp() public {
// Set up the address manager.
// Set up the address manager.
addressManager = new AddressManager();
addressManager = new AddressManager();
...
@@ -22,21 +28,21 @@ contract ResolvedDelegateProxy_Test is Test {
...
@@ -22,21 +28,21 @@ contract ResolvedDelegateProxy_Test is Test {
);
);
}
}
// Tests that the proxy properly bubbles up returndata when the delegatecall succeeds.
//
/ @dev
Tests that the proxy properly bubbles up returndata when the delegatecall succeeds.
function testFuzz_fallback_delegateCallFoo_succeeds(uint256 x) public {
function testFuzz_fallback_delegateCallFoo_succeeds(uint256 x) public {
vm.expectCall(address(impl), abi.encodeWithSelector(impl.foo.selector, x));
vm.expectCall(address(impl), abi.encodeWithSelector(impl.foo.selector, x));
assertEq(proxy.foo(x), x);
assertEq(proxy.foo(x), x);
}
}
// Tests that the proxy properly bubbles up returndata when the delegatecall reverts.
//
/ @dev
Tests that the proxy properly bubbles up returndata when the delegatecall reverts.
function test_fallback_delegateCallBar_reverts() public {
function test_fallback_delegateCallBar_reverts() public {
vm.expectRevert("SimpleImplementation: revert");
vm.expectRevert("SimpleImplementation: revert");
vm.expectCall(address(impl), abi.encodeWithSelector(impl.bar.selector));
vm.expectCall(address(impl), abi.encodeWithSelector(impl.bar.selector));
proxy.bar();
proxy.bar();
}
}
// Tests that the proxy fallback reverts as expected if the implementation within the
//
/ @dev
Tests that the proxy fallback reverts as expected if the implementation within the
// address manager is not set.
//
/
address manager is not set.
function test_fallback_addressManagerNotSet_reverts() public {
function test_fallback_addressManagerNotSet_reverts() public {
AddressManager am = new AddressManager();
AddressManager am = new AddressManager();
SimpleImplementation p = SimpleImplementation(
SimpleImplementation p = SimpleImplementation(
...
...
packages/contracts-bedrock/tasks/check-l2.ts
View file @
92bc1b4f
...
@@ -234,7 +234,7 @@ const check = {
...
@@ -234,7 +234,7 @@ const check = {
signer
signer
)
)
await
assertSemver
(
LegacyMessagePasser
,
'
LegacyMessagePasser
'
)
await
assertSemver
(
LegacyMessagePasser
,
'
LegacyMessagePasser
'
,
'
1.0.1
'
)
await
checkProxy
(
hre
,
'
LegacyMessagePasser
'
,
signer
.
provider
)
await
checkProxy
(
hre
,
'
LegacyMessagePasser
'
,
signer
.
provider
)
await
assertProxy
(
hre
,
'
LegacyMessagePasser
'
,
signer
.
provider
)
await
assertProxy
(
hre
,
'
LegacyMessagePasser
'
,
signer
.
provider
)
},
},
...
@@ -249,7 +249,7 @@ const check = {
...
@@ -249,7 +249,7 @@ const check = {
signer
signer
)
)
await
assertSemver
(
DeployerWhitelist
,
'
DeployerWhitelist
'
)
await
assertSemver
(
DeployerWhitelist
,
'
DeployerWhitelist
'
,
'
1.0.1
'
)
const
owner
=
await
DeployerWhitelist
.
owner
()
const
owner
=
await
DeployerWhitelist
.
owner
()
assert
(
owner
===
hre
.
ethers
.
constants
.
AddressZero
)
assert
(
owner
===
hre
.
ethers
.
constants
.
AddressZero
)
...
@@ -446,7 +446,7 @@ const check = {
...
@@ -446,7 +446,7 @@ const check = {
signer
signer
)
)
await
assertSemver
(
L1BlockNumber
,
'
L1BlockNumber
'
)
await
assertSemver
(
L1BlockNumber
,
'
L1BlockNumber
'
,
'
1.0.1
'
)
await
checkProxy
(
hre
,
'
L1BlockNumber
'
,
signer
.
provider
)
await
checkProxy
(
hre
,
'
L1BlockNumber
'
,
signer
.
provider
)
await
assertProxy
(
hre
,
'
L1BlockNumber
'
,
signer
.
provider
)
await
assertProxy
(
hre
,
'
L1BlockNumber
'
,
signer
.
provider
)
...
...
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