tendermint/vm/types.go

50 lines
916 B
Go
Raw Normal View History

2015-03-17 21:46:26 -07:00
package vm
import (
2015-04-01 17:30:16 -07:00
. "github.com/tendermint/tendermint/common"
2015-05-15 21:48:04 -07:00
ptypes "github.com/tendermint/tendermint/permission/types"
)
2015-03-17 21:46:26 -07:00
const (
defaultDataStackCapacity = 10
)
type Account struct {
2015-07-28 12:39:10 -07:00
Address Word256
Balance int64
Code []byte
Nonce int64
Other interface{} // For holding all other data.
2015-05-15 21:48:04 -07:00
Permissions ptypes.AccountPermissions
2015-03-17 21:46:26 -07:00
}
2015-05-01 17:26:49 -07:00
func (acc *Account) String() string {
if acc == nil {
return "nil-VMAccount"
}
2015-07-28 12:39:10 -07:00
return Fmt("VMAccount{%X B:%v C:%X N:%v}",
acc.Address, acc.Balance, acc.Code, acc.Nonce)
2015-05-01 17:26:49 -07:00
}
2015-03-17 21:46:26 -07:00
type AppState interface {
// Accounts
GetAccount(addr Word256) *Account
UpdateAccount(*Account)
RemoveAccount(*Account)
CreateAccount(*Account) *Account
2015-03-17 21:46:26 -07:00
// Storage
GetStorage(Word256, Word256) Word256
SetStorage(Word256, Word256, Word256) // Setting to Zero is deleting.
2015-03-17 21:46:26 -07:00
}
2015-03-20 05:47:52 -07:00
type Params struct {
BlockHeight int64
BlockHash Word256
2015-03-20 05:47:52 -07:00
BlockTime int64
GasLimit int64
2015-03-20 05:47:52 -07:00
}