feat: actors: Add bytecode getter
This commit is contained in:
parent
9339267e6e
commit
8d6aa2477c
@ -49,4 +49,7 @@ type State interface {
|
||||
|
||||
Nonce() (uint64, error)
|
||||
GetState() interface{}
|
||||
|
||||
GetBytecodeCID() (cid.Cid, error)
|
||||
GetBytecodeHash() ([32]byte, error)
|
||||
}
|
||||
|
@ -49,4 +49,7 @@ type State interface {
|
||||
|
||||
Nonce() (uint64, error)
|
||||
GetState() interface{}
|
||||
|
||||
GetBytecodeCID() (cid.Cid, error)
|
||||
GetBytecodeHash() ([32]byte, error)
|
||||
}
|
||||
|
@ -21,12 +21,12 @@ func load{{.v}}(store adt.Store, root cid.Cid) (State, error) {
|
||||
|
||||
func make{{.v}}(store adt.Store, bytecode cid.Cid) (State, error) {
|
||||
out := state{{.v}}{store: store}
|
||||
s, err := evm{{.v}}.ConstructState(store, bytecode)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
s, err := evm{{.v}}.ConstructState(store, bytecode)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out.State = *s
|
||||
out.State = *s
|
||||
|
||||
return &out, nil
|
||||
}
|
||||
@ -42,4 +42,12 @@ func (s *state{{.v}}) Nonce() (uint64, error) {
|
||||
|
||||
func (s *state{{.v}}) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) GetBytecodeCID() (cid.Cid, error) {
|
||||
return s.State.Bytecode, nil
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) GetBytecodeHash() ([32]byte, error) {
|
||||
return s.State.BytecodeHash, nil
|
||||
}
|
||||
|
8
chain/actors/builtin/evm/v10.go
generated
8
chain/actors/builtin/evm/v10.go
generated
@ -43,3 +43,11 @@ func (s *state10) Nonce() (uint64, error) {
|
||||
func (s *state10) GetState() interface{} {
|
||||
return &s.State
|
||||
}
|
||||
|
||||
func (s *state10) GetBytecodeCID() (cid.Cid, error) {
|
||||
return s.State.Bytecode, nil
|
||||
}
|
||||
|
||||
func (s *state10) GetBytecodeHash() ([32]byte, error) {
|
||||
return s.State.BytecodeHash, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user