You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.2 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. package vm
  2. import (
  3. . "github.com/tendermint/tendermint/common"
  4. ptypes "github.com/tendermint/tendermint/permission/types"
  5. )
  6. const (
  7. defaultDataStackCapacity = 10
  8. )
  9. type Account struct {
  10. Address Word256
  11. Balance int64
  12. Code []byte
  13. Nonce int64
  14. StorageRoot Word256
  15. Other interface{} // For holding all other data.
  16. Permissions ptypes.AccountPermissions
  17. }
  18. func (acc *Account) String() string {
  19. return Fmt("VMAccount{%X B:%v C:%X N:%v S:%X}",
  20. acc.Address, acc.Balance, acc.Code, acc.Nonce, acc.StorageRoot)
  21. }
  22. // NOTE: This is serialized as an event from vm/vm.
  23. // See: EventStringLogEvent
  24. type Log struct {
  25. Address Word256 `json:"address"`
  26. Topics []Word256 `json:"topics"`
  27. Data []byte `json:"data"`
  28. Height int64 `json:"height"`
  29. }
  30. type AppState interface {
  31. // Accounts
  32. GetAccount(addr Word256) *Account
  33. UpdateAccount(*Account)
  34. RemoveAccount(*Account)
  35. CreateAccount(*Account) *Account
  36. // Storage
  37. GetStorage(Word256, Word256) Word256
  38. SetStorage(Word256, Word256, Word256) // Setting to Zero is deleting.
  39. // Logs
  40. AddLog(*Log)
  41. }
  42. type Params struct {
  43. BlockHeight int64
  44. BlockHash Word256
  45. BlockTime int64
  46. GasLimit int64
  47. }