func (state *Object) SetNonce(nonce uint64) {
	state.setNonce(nonce)
	state.db.makeDirtyObj(state)
}
SetNonce sets the nonce to be nonce for this Object.
package state
import (
	"fmt"
	"io"
	"math/big"
	"github.com/spacemeshos/go-spacemesh/common/types"
	"github.com/spacemeshos/go-spacemesh/crypto"
	"github.com/spacemeshos/go-spacemesh/rlp"
)
type AccountState interface {
	GetBalance() uint64
	GetNonce() uint64
	SetNonce(newNonce uint64)
	AddBalance(amount uint64)
	SubBalance(amount uint64)
	SetBalance(amount uint64)
	GetAddress() types.Address
}
type Object struct {
	address  types.Address
	addrHash types.Hash32
	account  types.AccountState
	db       *DB
}
func newObject(db *DB, address types.Address, data types.AccountState) *Object {
	return &Object{
		db:       db,
		address:  address,
		addrHash: crypto.Keccak256Hash(address[:]),
		account:  data,
	}
}
func (state *Object) EncodeRLP(w io.Writer) error {
	if err := rlp.Encode(w, state.account); err != nil {
		return fmt.Errorf("encode RLP: %w", err)
	}
	return nil
}
func (state *Object) AddBalance(amount uint64) {
	if amount == 0 {
		if state.empty() {
			state.touch()
		}
		return
	}
	state.SetBalance(state.Balance() + amount)
}
func (state *Object) touch() {
	state.db.makeDirtyObj(state)
}
func (state *Object) empty() bool {
	return state.account.Nonce == 0 && state.account.Balance == 0
}
func (state *Object) SubBalance(amount uint64) {
	if amount == 0 {
		return
	}
	state.SetBalance(state.Balance() - amount)
}
func (state *Object) SetBalance(amount uint64) {
	state.setBalance(amount)
	state.db.makeDirtyObj(state)
}
func (state *Object) setBalance(amount uint64) {
	state.account.Balance = amount
}
func (state *Object) ReturnGas(gas *big.Int) {}
func (state *Object) deepCopy(db *DB) *Object {
	StateObj := newObject(db, state.address, state.account)
	return StateObj
}
func (state *Object) Address() types.Address {
	return state.address
}