Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed Aug 15, 2024
1 parent 37d9797 commit cadd805
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions x/evm/statedb/state_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
ethermint "github.com/evmos/ethermint/types"
"github.com/evmos/ethermint/x/evm/types"
)

var emptyCodeHash = crypto.Keccak256(nil)
Expand All @@ -44,16 +43,14 @@ func NewEmptyAccount() *Account {

// NewAccountFromSdkAccount extracts the nonce and code hash from the provided SDK account.
func NewAccountFromSdkAccount(acct sdk.AccountI) *Account {
codeHash := types.EmptyCodeHash
ethAcct, ok := acct.(ethermint.EthAccountI)
if ok {
codeHash = ethAcct.GetCodeHash().Bytes()
}
acc := NewEmptyAccount()
acc.Nonce = acct.GetSequence()

return &Account{
Nonce: acct.GetSequence(),
CodeHash: codeHash,
if ethAcct, ok := acct.(ethermint.EthAccountI); ok {
acc.CodeHash = ethAcct.GetCodeHash().Bytes()
}

return acc
}

// IsContract returns if the account contains contract code.
Expand Down

0 comments on commit cadd805

Please sign in to comment.