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
c4edcd2e
Unverified
Commit
c4edcd2e
authored
Jul 25, 2023
by
OptimismBot
Committed by
GitHub
Jul 25, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6435 from ethereum-optimism/feat/storage-layout-getter
op-bindings: storage layout entry getter
parents
64649169
bd4a39a4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
1 deletion
+16
-1
types.go
op-bindings/solc/types.go
+16
-1
No files found.
op-bindings/solc/types.go
View file @
c4edcd2e
...
@@ -2,6 +2,7 @@ package solc
...
@@ -2,6 +2,7 @@ package solc
import
(
import
(
"encoding/json"
"encoding/json"
"fmt"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/accounts/abi"
)
)
...
@@ -36,7 +37,8 @@ type CompilerOutput struct {
...
@@ -36,7 +37,8 @@ type CompilerOutput struct {
type
CompilerOutputContracts
map
[
string
]
CompilerOutputContract
type
CompilerOutputContracts
map
[
string
]
CompilerOutputContract
// TODO(tynes): ignoring devdoc and userdoc for now
// CompilerOutputContract represents the solc compiler output for a contract.
// Ignoring some fields such as devdoc and userdoc.
type
CompilerOutputContract
struct
{
type
CompilerOutputContract
struct
{
Abi
abi
.
ABI
`json:"abi"`
Abi
abi
.
ABI
`json:"abi"`
Evm
CompilerOutputEvm
`json:"evm"`
Evm
CompilerOutputEvm
`json:"evm"`
...
@@ -44,11 +46,24 @@ type CompilerOutputContract struct {
...
@@ -44,11 +46,24 @@ type CompilerOutputContract struct {
StorageLayout
StorageLayout
`json:"storageLayout"`
StorageLayout
StorageLayout
`json:"storageLayout"`
}
}
// StorageLayout represents the solc compilers output storage layout for
// a contract.
type
StorageLayout
struct
{
type
StorageLayout
struct
{
Storage
[]
StorageLayoutEntry
`json:"storage"`
Storage
[]
StorageLayoutEntry
`json:"storage"`
Types
map
[
string
]
StorageLayoutType
`json:"types"`
Types
map
[
string
]
StorageLayoutType
`json:"types"`
}
}
// GetStorageLayoutEntry returns the StorageLayoutEntry where the label matches
// the provided name.
func
(
s
*
StorageLayout
)
GetStorageLayoutEntry
(
name
string
)
(
StorageLayoutEntry
,
error
)
{
for
_
,
entry
:=
range
s
.
Storage
{
if
entry
.
Label
==
name
{
return
entry
,
nil
}
}
return
StorageLayoutEntry
{},
fmt
.
Errorf
(
"%s not found"
,
name
)
}
type
StorageLayoutEntry
struct
{
type
StorageLayoutEntry
struct
{
AstId
uint
`json:"astId"`
AstId
uint
`json:"astId"`
Contract
string
`json:"contract"`
Contract
string
`json:"contract"`
...
...
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