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
eddb8113
Unverified
Commit
eddb8113
authored
Dec 06, 2023
by
Mark Tyneway
Committed by
GitHub
Dec 06, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8435 from ethereum-optimism/ctb/set-bool
contracts-bedrock: add bool getter/setter to `Storage.sol`
parents
e4de5602
890a44a5
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
150 additions
and
26 deletions
+150
-26
storagesetter.go
op-bindings/bindings/storagesetter.go
+63
-11
storagesetter_more.go
op-bindings/bindings/storagesetter_more.go
+1
-1
semver-lock.json
packages/contracts-bedrock/semver-lock.json
+2
-2
StorageSetter.json
packages/contracts-bedrock/snapshots/abi/StorageSetter.json
+40
-3
Storage.sol
packages/contracts-bedrock/src/libraries/Storage.sol
+20
-1
StorageSetter.sol
packages/contracts-bedrock/src/universal/StorageSetter.sol
+18
-8
Storage.t.sol
packages/contracts-bedrock/test/libraries/Storage.t.sol
+6
-0
No files found.
op-bindings/bindings/storagesetter.go
View file @
eddb8113
...
...
@@ -36,8 +36,8 @@ type StorageSetterSlot struct {
// StorageSetterMetaData contains all meta data concerning the StorageSetter contract.
var
StorageSetterMetaData
=
&
bind
.
MetaData
{
ABI
:
"[{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
bytes32
\"
,
\"
name
\"
:
\"
_slot
\"
,
\"
type
\"
:
\"
bytes32
\"
}],
\"
name
\"
:
\"
getAddress
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
address
\"
,
\"
name
\"
:
\"
\"
,
\"
type
\"
:
\"
address
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
bytes32
\"
,
\"
name
\"
:
\"
_slot
\"
,
\"
type
\"
:
\"
bytes32
\"
}],
\"
name
\"
:
\"
getBytes32
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
bytes32
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
bytes32
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
bytes32
\"
,
\"
name
\"
:
\"
_slot
\"
,
\"
type
\"
:
\"
bytes32
\"
}],
\"
name
\"
:
\"
getUint
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
uint256
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
uint256
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
bytes32
\"
,
\"
name
\"
:
\"
_slot
\"
,
\"
type
\"
:
\"
bytes32
\"
},{
\"
internalType
\"
:
\"
address
\"
,
\"
name
\"
:
\"
_address
\"
,
\"
type
\"
:
\"
address
\"
}],
\"
name
\"
:
\"
setAddress
\"
,
\"
outputs
\"
:[],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
components
\"
:[{
\"
internalType
\"
:
\"
bytes32
\"
,
\"
name
\"
:
\"
key
\"
,
\"
type
\"
:
\"
bytes32
\"
},{
\"
internalType
\"
:
\"
bytes32
\"
,
\"
name
\"
:
\"
value
\"
,
\"
type
\"
:
\"
bytes32
\"
}],
\"
internalType
\"
:
\"
structStorageSetter.Slot[]
\"
,
\"
name
\"
:
\"
slots
\"
,
\"
type
\"
:
\"
tuple[]
\"
}],
\"
name
\"
:
\"
setBytes32
\"
,
\"
outputs
\"
:[],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
bytes32
\"
,
\"
name
\"
:
\"
_slot
\"
,
\"
type
\"
:
\"
bytes32
\"
},{
\"
internalType
\"
:
\"
bytes32
\"
,
\"
name
\"
:
\"
_value
\"
,
\"
type
\"
:
\"
bytes32
\"
}],
\"
name
\"
:
\"
setBytes32
\"
,
\"
outputs
\"
:[],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
bytes32
\"
,
\"
name
\"
:
\"
_slot
\"
,
\"
type
\"
:
\"
bytes32
\"
},{
\"
internalType
\"
:
\"
uint256
\"
,
\"
name
\"
:
\"
_value
\"
,
\"
type
\"
:
\"
uint256
\"
}],
\"
name
\"
:
\"
setUint
\"
,
\"
outputs
\"
:[],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[],
\"
name
\"
:
\"
version
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
string
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
string
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
}]"
,
Bin
:
"0x608060405234801561001057600080fd5b50610
3de806100206000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c8063a6ed563e1161005b578063a6ed563e1461013a578063bd02d0f51461013a578063ca446dd914610156578063e2a4853a146100df57600080fd5b80630528afe21461008d57806321f8a721146100a25780634e91db08146100df57806354fd4d50146100f1575b600080fd5b6100a061009b3660046101d7565b610164565b005b6100b56100b036600461024c565b6101c7565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6100a06100ed366004610265565b9055565b61012d6040518060400160405280600581526020017f312e312e3000000000000000000000000000000000000000000000000000000081525081565b6040516100d69190610287565b6101486100b036600461024c565b6040519081526020016100d6565b6100a06100ed3660046102fa565b8060005b818110156101c1576101af84848381811061018557610185610343565b905060400201600001358585848181106101a1576101a1610343565b905060400201602001359055565b806101b981610372565b915050610168565b50505050565b60006101d1825490565b92915050565b600080602083850312156101ea57600080fd5b823567ffffffffffffffff8082111561020257600080fd5b818501915085601f83011261021657600080fd5b81358181111561022557600080fd5b8660208260061b850101111561023a57600080fd5b60209290920196919550909350505050565b60006020828403121561025e57600080fd5b5035919050565b6000806040838503121561027857600080fd5b50508035926020909101359150565b600060208083528351808285015260005b818110156102b457858101830151858201604001528201610298565b818111156102c6576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b6000806040838503121561030d57600080fd5b82359150602083013573ffffffffffffffffffffffffffffffffffffffff8116811461033857600080fd5b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036103ca
577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b506001019056fea164736f6c634300080f000a"
,
ABI
:
"[{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
bytes32
\"
,
\"
name
\"
:
\"
_slot
\"
,
\"
type
\"
:
\"
bytes32
\"
}],
\"
name
\"
:
\"
getAddress
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
address
\"
,
\"
name
\"
:
\"
addr_
\"
,
\"
type
\"
:
\"
address
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
bytes32
\"
,
\"
name
\"
:
\"
_slot
\"
,
\"
type
\"
:
\"
bytes32
\"
}],
\"
name
\"
:
\"
getBool
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
bool
\"
,
\"
name
\"
:
\"
value_
\"
,
\"
type
\"
:
\"
bool
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
bytes32
\"
,
\"
name
\"
:
\"
_slot
\"
,
\"
type
\"
:
\"
bytes32
\"
}],
\"
name
\"
:
\"
getBytes32
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
bytes32
\"
,
\"
name
\"
:
\"
value_
\"
,
\"
type
\"
:
\"
bytes32
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
bytes32
\"
,
\"
name
\"
:
\"
_slot
\"
,
\"
type
\"
:
\"
bytes32
\"
}],
\"
name
\"
:
\"
getUint
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
uint256
\"
,
\"
name
\"
:
\"
value_
\"
,
\"
type
\"
:
\"
uint256
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
bytes32
\"
,
\"
name
\"
:
\"
_slot
\"
,
\"
type
\"
:
\"
bytes32
\"
},{
\"
internalType
\"
:
\"
address
\"
,
\"
name
\"
:
\"
_address
\"
,
\"
type
\"
:
\"
address
\"
}],
\"
name
\"
:
\"
setAddress
\"
,
\"
outputs
\"
:[],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
bytes32
\"
,
\"
name
\"
:
\"
_slot
\"
,
\"
type
\"
:
\"
bytes32
\"
},{
\"
internalType
\"
:
\"
bool
\"
,
\"
name
\"
:
\"
_value
\"
,
\"
type
\"
:
\"
bool
\"
}],
\"
name
\"
:
\"
setBool
\"
,
\"
outputs
\"
:[],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
components
\"
:[{
\"
internalType
\"
:
\"
bytes32
\"
,
\"
name
\"
:
\"
key
\"
,
\"
type
\"
:
\"
bytes32
\"
},{
\"
internalType
\"
:
\"
bytes32
\"
,
\"
name
\"
:
\"
value
\"
,
\"
type
\"
:
\"
bytes32
\"
}],
\"
internalType
\"
:
\"
structStorageSetter.Slot[]
\"
,
\"
name
\"
:
\"
slots
\"
,
\"
type
\"
:
\"
tuple[]
\"
}],
\"
name
\"
:
\"
setBytes32
\"
,
\"
outputs
\"
:[],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
bytes32
\"
,
\"
name
\"
:
\"
_slot
\"
,
\"
type
\"
:
\"
bytes32
\"
},{
\"
internalType
\"
:
\"
bytes32
\"
,
\"
name
\"
:
\"
_value
\"
,
\"
type
\"
:
\"
bytes32
\"
}],
\"
name
\"
:
\"
setBytes32
\"
,
\"
outputs
\"
:[],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
bytes32
\"
,
\"
name
\"
:
\"
_slot
\"
,
\"
type
\"
:
\"
bytes32
\"
},{
\"
internalType
\"
:
\"
uint256
\"
,
\"
name
\"
:
\"
_value
\"
,
\"
type
\"
:
\"
uint256
\"
}],
\"
name
\"
:
\"
setUint
\"
,
\"
outputs
\"
:[],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[],
\"
name
\"
:
\"
version
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
string
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
string
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
}]"
,
Bin
:
"0x608060405234801561001057600080fd5b50610
46a806100206000396000f3fe608060405234801561001057600080fd5b50600436106100be5760003560e01c8063a6ed563e11610076578063bd02d0f51161005b578063bd02d0f51461018e578063ca446dd9146101b8578063e2a4853a1461011557600080fd5b8063a6ed563e1461018e578063abfdcced146101aa57600080fd5b80634e91db08116100a75780634e91db081461011557806354fd4d50146101275780637ae1cfca1461017057600080fd5b80630528afe2146100c357806321f8a721146100d8575b600080fd5b6100d66100d1366004610239565b6101c6565b005b6100eb6100e63660046102ae565b610229565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6100d66101233660046102c7565b9055565b6101636040518060400160405280600581526020017f312e322e3000000000000000000000000000000000000000000000000000000081525081565b60405161010c91906102e9565b61017e6100e63660046102ae565b604051901515815260200161010c565b61019c6100e63660046102ae565b60405190815260200161010c565b6100d661012336600461035c565b6100d6610123366004610391565b8060005b81811015610223576102118484838181106101e7576101e76103cf565b90506040020160000135858584818110610203576102036103cf565b905060400201602001359055565b8061021b816103fe565b9150506101ca565b50505050565b6000610233825490565b92915050565b6000806020838503121561024c57600080fd5b823567ffffffffffffffff8082111561026457600080fd5b818501915085601f83011261027857600080fd5b81358181111561028757600080fd5b8660208260061b850101111561029c57600080fd5b60209290920196919550909350505050565b6000602082840312156102c057600080fd5b5035919050565b600080604083850312156102da57600080fd5b50508035926020909101359150565b600060208083528351808285015260005b81811015610316578581018301518582016040015282016102fa565b81811115610328576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b6000806040838503121561036f57600080fd5b823591506020830135801515811461038657600080fd5b809150509250929050565b600080604083850312156103a457600080fd5b82359150602083013573ffffffffffffffffffffffffffffffffffffffff8116811461038657600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610456
577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b506001019056fea164736f6c634300080f000a"
,
}
// StorageSetterABI is the input ABI used to generate the binding from.
...
...
@@ -209,7 +209,7 @@ func (_StorageSetter *StorageSetterTransactorRaw) Transact(opts *bind.TransactOp
// GetAddress is a free data retrieval call binding the contract method 0x21f8a721.
//
// Solidity: function getAddress(bytes32 _slot) view returns(address)
// Solidity: function getAddress(bytes32 _slot) view returns(address
addr_
)
func
(
_StorageSetter
*
StorageSetterCaller
)
GetAddress
(
opts
*
bind
.
CallOpts
,
_slot
[
32
]
byte
)
(
common
.
Address
,
error
)
{
var
out
[]
interface
{}
err
:=
_StorageSetter
.
contract
.
Call
(
opts
,
&
out
,
"getAddress"
,
_slot
)
...
...
@@ -226,21 +226,52 @@ func (_StorageSetter *StorageSetterCaller) GetAddress(opts *bind.CallOpts, _slot
// GetAddress is a free data retrieval call binding the contract method 0x21f8a721.
//
// Solidity: function getAddress(bytes32 _slot) view returns(address)
// Solidity: function getAddress(bytes32 _slot) view returns(address
addr_
)
func
(
_StorageSetter
*
StorageSetterSession
)
GetAddress
(
_slot
[
32
]
byte
)
(
common
.
Address
,
error
)
{
return
_StorageSetter
.
Contract
.
GetAddress
(
&
_StorageSetter
.
CallOpts
,
_slot
)
}
// GetAddress is a free data retrieval call binding the contract method 0x21f8a721.
//
// Solidity: function getAddress(bytes32 _slot) view returns(address)
// Solidity: function getAddress(bytes32 _slot) view returns(address
addr_
)
func
(
_StorageSetter
*
StorageSetterCallerSession
)
GetAddress
(
_slot
[
32
]
byte
)
(
common
.
Address
,
error
)
{
return
_StorageSetter
.
Contract
.
GetAddress
(
&
_StorageSetter
.
CallOpts
,
_slot
)
}
// GetBool is a free data retrieval call binding the contract method 0x7ae1cfca.
//
// Solidity: function getBool(bytes32 _slot) view returns(bool value_)
func
(
_StorageSetter
*
StorageSetterCaller
)
GetBool
(
opts
*
bind
.
CallOpts
,
_slot
[
32
]
byte
)
(
bool
,
error
)
{
var
out
[]
interface
{}
err
:=
_StorageSetter
.
contract
.
Call
(
opts
,
&
out
,
"getBool"
,
_slot
)
if
err
!=
nil
{
return
*
new
(
bool
),
err
}
out0
:=
*
abi
.
ConvertType
(
out
[
0
],
new
(
bool
))
.
(
*
bool
)
return
out0
,
err
}
// GetBool is a free data retrieval call binding the contract method 0x7ae1cfca.
//
// Solidity: function getBool(bytes32 _slot) view returns(bool value_)
func
(
_StorageSetter
*
StorageSetterSession
)
GetBool
(
_slot
[
32
]
byte
)
(
bool
,
error
)
{
return
_StorageSetter
.
Contract
.
GetBool
(
&
_StorageSetter
.
CallOpts
,
_slot
)
}
// GetBool is a free data retrieval call binding the contract method 0x7ae1cfca.
//
// Solidity: function getBool(bytes32 _slot) view returns(bool value_)
func
(
_StorageSetter
*
StorageSetterCallerSession
)
GetBool
(
_slot
[
32
]
byte
)
(
bool
,
error
)
{
return
_StorageSetter
.
Contract
.
GetBool
(
&
_StorageSetter
.
CallOpts
,
_slot
)
}
// GetBytes32 is a free data retrieval call binding the contract method 0xa6ed563e.
//
// Solidity: function getBytes32(bytes32 _slot) view returns(bytes32)
// Solidity: function getBytes32(bytes32 _slot) view returns(bytes32
value_
)
func
(
_StorageSetter
*
StorageSetterCaller
)
GetBytes32
(
opts
*
bind
.
CallOpts
,
_slot
[
32
]
byte
)
([
32
]
byte
,
error
)
{
var
out
[]
interface
{}
err
:=
_StorageSetter
.
contract
.
Call
(
opts
,
&
out
,
"getBytes32"
,
_slot
)
...
...
@@ -257,21 +288,21 @@ func (_StorageSetter *StorageSetterCaller) GetBytes32(opts *bind.CallOpts, _slot
// GetBytes32 is a free data retrieval call binding the contract method 0xa6ed563e.
//
// Solidity: function getBytes32(bytes32 _slot) view returns(bytes32)
// Solidity: function getBytes32(bytes32 _slot) view returns(bytes32
value_
)
func
(
_StorageSetter
*
StorageSetterSession
)
GetBytes32
(
_slot
[
32
]
byte
)
([
32
]
byte
,
error
)
{
return
_StorageSetter
.
Contract
.
GetBytes32
(
&
_StorageSetter
.
CallOpts
,
_slot
)
}
// GetBytes32 is a free data retrieval call binding the contract method 0xa6ed563e.
//
// Solidity: function getBytes32(bytes32 _slot) view returns(bytes32)
// Solidity: function getBytes32(bytes32 _slot) view returns(bytes32
value_
)
func
(
_StorageSetter
*
StorageSetterCallerSession
)
GetBytes32
(
_slot
[
32
]
byte
)
([
32
]
byte
,
error
)
{
return
_StorageSetter
.
Contract
.
GetBytes32
(
&
_StorageSetter
.
CallOpts
,
_slot
)
}
// GetUint is a free data retrieval call binding the contract method 0xbd02d0f5.
//
// Solidity: function getUint(bytes32 _slot) view returns(uint256)
// Solidity: function getUint(bytes32 _slot) view returns(uint256
value_
)
func
(
_StorageSetter
*
StorageSetterCaller
)
GetUint
(
opts
*
bind
.
CallOpts
,
_slot
[
32
]
byte
)
(
*
big
.
Int
,
error
)
{
var
out
[]
interface
{}
err
:=
_StorageSetter
.
contract
.
Call
(
opts
,
&
out
,
"getUint"
,
_slot
)
...
...
@@ -288,14 +319,14 @@ func (_StorageSetter *StorageSetterCaller) GetUint(opts *bind.CallOpts, _slot [3
// GetUint is a free data retrieval call binding the contract method 0xbd02d0f5.
//
// Solidity: function getUint(bytes32 _slot) view returns(uint256)
// Solidity: function getUint(bytes32 _slot) view returns(uint256
value_
)
func
(
_StorageSetter
*
StorageSetterSession
)
GetUint
(
_slot
[
32
]
byte
)
(
*
big
.
Int
,
error
)
{
return
_StorageSetter
.
Contract
.
GetUint
(
&
_StorageSetter
.
CallOpts
,
_slot
)
}
// GetUint is a free data retrieval call binding the contract method 0xbd02d0f5.
//
// Solidity: function getUint(bytes32 _slot) view returns(uint256)
// Solidity: function getUint(bytes32 _slot) view returns(uint256
value_
)
func
(
_StorageSetter
*
StorageSetterCallerSession
)
GetUint
(
_slot
[
32
]
byte
)
(
*
big
.
Int
,
error
)
{
return
_StorageSetter
.
Contract
.
GetUint
(
&
_StorageSetter
.
CallOpts
,
_slot
)
}
...
...
@@ -352,6 +383,27 @@ func (_StorageSetter *StorageSetterTransactorSession) SetAddress(_slot [32]byte,
return
_StorageSetter
.
Contract
.
SetAddress
(
&
_StorageSetter
.
TransactOpts
,
_slot
,
_address
)
}
// SetBool is a paid mutator transaction binding the contract method 0xabfdcced.
//
// Solidity: function setBool(bytes32 _slot, bool _value) returns()
func
(
_StorageSetter
*
StorageSetterTransactor
)
SetBool
(
opts
*
bind
.
TransactOpts
,
_slot
[
32
]
byte
,
_value
bool
)
(
*
types
.
Transaction
,
error
)
{
return
_StorageSetter
.
contract
.
Transact
(
opts
,
"setBool"
,
_slot
,
_value
)
}
// SetBool is a paid mutator transaction binding the contract method 0xabfdcced.
//
// Solidity: function setBool(bytes32 _slot, bool _value) returns()
func
(
_StorageSetter
*
StorageSetterSession
)
SetBool
(
_slot
[
32
]
byte
,
_value
bool
)
(
*
types
.
Transaction
,
error
)
{
return
_StorageSetter
.
Contract
.
SetBool
(
&
_StorageSetter
.
TransactOpts
,
_slot
,
_value
)
}
// SetBool is a paid mutator transaction binding the contract method 0xabfdcced.
//
// Solidity: function setBool(bytes32 _slot, bool _value) returns()
func
(
_StorageSetter
*
StorageSetterTransactorSession
)
SetBool
(
_slot
[
32
]
byte
,
_value
bool
)
(
*
types
.
Transaction
,
error
)
{
return
_StorageSetter
.
Contract
.
SetBool
(
&
_StorageSetter
.
TransactOpts
,
_slot
,
_value
)
}
// SetBytes32 is a paid mutator transaction binding the contract method 0x0528afe2.
//
// Solidity: function setBytes32((bytes32,bytes32)[] slots) returns()
...
...
op-bindings/bindings/storagesetter_more.go
View file @
eddb8113
...
...
@@ -13,7 +13,7 @@ const StorageSetterStorageLayoutJSON = "{\"storage\":null,\"types\":{}}"
var
StorageSetterStorageLayout
=
new
(
solc
.
StorageLayout
)
var
StorageSetterDeployedBin
=
"0x608060405234801561001057600080fd5b50600436106100
885760003560e01c8063a6ed563e1161005b578063a6ed563e1461013a578063bd02d0f51461013a578063ca446dd914610156578063e2a4853a146100df57600080fd5b80630528afe21461008d57806321f8a721146100a25780634e91db08146100df57806354fd4d50146100f1575b600080fd5b6100a061009b3660046101d7565b610164565b005b6100b56100b036600461024c565b6101c7565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6100a06100ed366004610265565b9055565b61012d6040518060400160405280600581526020017f312e312e3000000000000000000000000000000000000000000000000000000081525081565b6040516100d69190610287565b6101486100b036600461024c565b6040519081526020016100d6565b6100a06100ed3660046102fa565b8060005b818110156101c1576101af84848381811061018557610185610343565b905060400201600001358585848181106101a1576101a1610343565b905060400201602001359055565b806101b981610372565b915050610168565b50505050565b60006101d1825490565b92915050565b600080602083850312156101ea57600080fd5b823567ffffffffffffffff8082111561020257600080fd5b818501915085601f83011261021657600080fd5b81358181111561022557600080fd5b8660208260061b850101111561023a57600080fd5b60209290920196919550909350505050565b60006020828403121561025e57600080fd5b5035919050565b6000806040838503121561027857600080fd5b50508035926020909101359150565b600060208083528351808285015260005b818110156102b457858101830151858201604001528201610298565b818111156102c6576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b6000806040838503121561030d57600080fd5b82359150602083013573ffffffffffffffffffffffffffffffffffffffff8116811461033857600080fd5b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036103ca
577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b506001019056fea164736f6c634300080f000a"
var
StorageSetterDeployedBin
=
"0x608060405234801561001057600080fd5b50600436106100
be5760003560e01c8063a6ed563e11610076578063bd02d0f51161005b578063bd02d0f51461018e578063ca446dd9146101b8578063e2a4853a1461011557600080fd5b8063a6ed563e1461018e578063abfdcced146101aa57600080fd5b80634e91db08116100a75780634e91db081461011557806354fd4d50146101275780637ae1cfca1461017057600080fd5b80630528afe2146100c357806321f8a721146100d8575b600080fd5b6100d66100d1366004610239565b6101c6565b005b6100eb6100e63660046102ae565b610229565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6100d66101233660046102c7565b9055565b6101636040518060400160405280600581526020017f312e322e3000000000000000000000000000000000000000000000000000000081525081565b60405161010c91906102e9565b61017e6100e63660046102ae565b604051901515815260200161010c565b61019c6100e63660046102ae565b60405190815260200161010c565b6100d661012336600461035c565b6100d6610123366004610391565b8060005b81811015610223576102118484838181106101e7576101e76103cf565b90506040020160000135858584818110610203576102036103cf565b905060400201602001359055565b8061021b816103fe565b9150506101ca565b50505050565b6000610233825490565b92915050565b6000806020838503121561024c57600080fd5b823567ffffffffffffffff8082111561026457600080fd5b818501915085601f83011261027857600080fd5b81358181111561028757600080fd5b8660208260061b850101111561029c57600080fd5b60209290920196919550909350505050565b6000602082840312156102c057600080fd5b5035919050565b600080604083850312156102da57600080fd5b50508035926020909101359150565b600060208083528351808285015260005b81811015610316578581018301518582016040015282016102fa565b81811115610328576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b6000806040838503121561036f57600080fd5b823591506020830135801515811461038657600080fd5b809150509250929050565b600080604083850312156103a457600080fd5b82359150602083013573ffffffffffffffffffffffffffffffffffffffff8116811461038657600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610456
577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b506001019056fea164736f6c634300080f000a"
func
init
()
{
...
...
packages/contracts-bedrock/semver-lock.json
View file @
eddb8113
...
...
@@ -148,7 +148,7 @@
"sourceCodeHash"
:
"0x89cab3bfb4a6a6146336585216c78f20733219ac6973e7fc1cb49c43c060662d"
},
"src/universal/StorageSetter.sol"
:
{
"initCodeHash"
:
"0xb
579792cbef7a862d60190712b3b5bc6b5ec8e2d0d4cc75a4ca9980490e3c238
"
,
"sourceCodeHash"
:
"0x
c5d4a62bcb4dfe1844c72d40b21375769004e9dc76f6f293ee1ecb35abe58a92
"
"initCodeHash"
:
"0xb
656d2aa6aff3e6435e747a0c23236d1b66f1f5c0b45e4b1a10d290a90223c5a
"
,
"sourceCodeHash"
:
"0x
ebfc968e6b78d7ea355547d427300739f14d000a11ff35f29d9ded3ddb7882da
"
}
}
\ No newline at end of file
packages/contracts-bedrock/snapshots/abi/StorageSetter.json
View file @
eddb8113
...
...
@@ -11,13 +11,32 @@
"outputs"
:
[
{
"internalType"
:
"address"
,
"name"
:
""
,
"name"
:
"
addr_
"
,
"type"
:
"address"
}
],
"stateMutability"
:
"view"
,
"type"
:
"function"
},
{
"inputs"
:
[
{
"internalType"
:
"bytes32"
,
"name"
:
"_slot"
,
"type"
:
"bytes32"
}
],
"name"
:
"getBool"
,
"outputs"
:
[
{
"internalType"
:
"bool"
,
"name"
:
"value_"
,
"type"
:
"bool"
}
],
"stateMutability"
:
"view"
,
"type"
:
"function"
},
{
"inputs"
:
[
{
...
...
@@ -30,7 +49,7 @@
"outputs"
:
[
{
"internalType"
:
"bytes32"
,
"name"
:
""
,
"name"
:
"
value_
"
,
"type"
:
"bytes32"
}
],
...
...
@@ -49,7 +68,7 @@
"outputs"
:
[
{
"internalType"
:
"uint256"
,
"name"
:
""
,
"name"
:
"
value_
"
,
"type"
:
"uint256"
}
],
...
...
@@ -74,6 +93,24 @@
"stateMutability"
:
"nonpayable"
,
"type"
:
"function"
},
{
"inputs"
:
[
{
"internalType"
:
"bytes32"
,
"name"
:
"_slot"
,
"type"
:
"bytes32"
},
{
"internalType"
:
"bool"
,
"name"
:
"_value"
,
"type"
:
"bool"
}
],
"name"
:
"setBool"
,
"outputs"
:
[],
"stateMutability"
:
"nonpayable"
,
"type"
:
"function"
},
{
"inputs"
:
[
{
...
...
packages/contracts-bedrock/src/libraries/Storage.sol
View file @
eddb8113
...
...
@@ -58,7 +58,7 @@ library Storage {
/// @notice Stores a bytes32 value in an arbitrary storage slot, `_slot`.
/// @param _slot The storage slot to store the address in.
/// @param _value The
protocol version to store
/// @param _value The
bytes32 value to store.
/// @dev WARNING! This function must be used cautiously, as it allows for overwriting values
/// in arbitrary storage slots.
function setBytes32(bytes32 _slot, bytes32 _value) internal {
...
...
@@ -66,4 +66,23 @@ library Storage {
sstore(_slot, _value)
}
}
/// @notice Stores a bool value in an arbitrary storage slot, `_slot`.
/// @param _slot The storage slot to store the bool in.
/// @param _value The bool value to store
/// @dev WARNING! This function must be used cautiously, as it allows for overwriting values
/// in arbitrary storage slots.
function setBool(bytes32 _slot, bool _value) internal {
assembly {
sstore(_slot, _value)
}
}
/// @notice Returns a bool stored in an arbitrary storage slot.
/// @param _slot The storage slot to retrieve the bool from.
function getBool(bytes32 _slot) internal view returns (bool value_) {
assembly {
value_ := sload(_slot)
}
}
}
packages/contracts-bedrock/src/universal/StorageSetter.sol
View file @
eddb8113
...
...
@@ -16,8 +16,8 @@ contract StorageSetter is ISemver {
}
/// @notice Semantic version.
/// @custom:semver 1.
1
.0
string public constant version = "1.
1
.0";
/// @custom:semver 1.
2
.0
string public constant version = "1.
2
.0";
/// @notice Stores a bytes32 `_value` at `_slot`. Any storage slots that
/// are packed should be set through this interface.
...
...
@@ -34,8 +34,8 @@ contract StorageSetter is ISemver {
}
/// @notice Retrieves a bytes32 value from `_slot`.
function getBytes32(bytes32 _slot) external view returns (bytes32) {
return
Storage.getBytes32(_slot);
function getBytes32(bytes32 _slot) external view returns (bytes32
value_
) {
value_ =
Storage.getBytes32(_slot);
}
/// @notice Stores a uint256 `_value` at `_slot`.
...
...
@@ -44,8 +44,8 @@ contract StorageSetter is ISemver {
}
/// @notice Retrieves a uint256 value from `_slot`.
function getUint(bytes32 _slot) external view returns (uint256) {
return
Storage.getUint(_slot);
function getUint(bytes32 _slot) external view returns (uint256
value_
) {
value_ =
Storage.getUint(_slot);
}
/// @notice Stores an address `_value` at `_slot`.
...
...
@@ -54,7 +54,17 @@ contract StorageSetter is ISemver {
}
/// @notice Retrieves an address value from `_slot`.
function getAddress(bytes32 _slot) external view returns (address) {
return Storage.getAddress(_slot);
function getAddress(bytes32 _slot) external view returns (address addr_) {
addr_ = Storage.getAddress(_slot);
}
/// @notice Stores a bool `_value` at `_slot`.
function setBool(bytes32 _slot, bool _value) public {
Storage.setBool(_slot, _value);
}
/// @notice Retrieves a bool value from `_slot`.
function getBool(bytes32 _slot) external view returns (bool value_) {
value_ = Storage.getBool(_slot);
}
}
packages/contracts-bedrock/test/libraries/Storage.t.sol
View file @
eddb8113
...
...
@@ -40,6 +40,12 @@ contract Storage_Roundtrip_Test is Test {
assertEq(hash, vm.load(address(setter), slot));
}
function test_setGetBool_succeeds(bytes32 slot, bool value) external {
setter.setBool(slot, value);
assertEq(setter.getBool(slot), value);
assertEq(value, vm.load(address(setter), slot) == bytes32(uint256(1)));
}
/// @dev All keys must be unique in the input so deduplication is required.
function testFuzz_setGetBytes32Multi_succeeds(StorageSetter.Slot[] calldata _slots) external {
for (uint256 i; i < _slots.length; i++) {
...
...
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