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.

60 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. Other interface{} // For holding all other data.
  15. Permissions ptypes.AccountPermissions
  16. }
  17. func (acc *Account) String() string {
  18. if acc == nil {
  19. return "nil-VMAccount"
  20. }
  21. return Fmt("VMAccount{%X B:%v C:%X N:%v}",
  22. acc.Address, acc.Balance, acc.Code, acc.Nonce)
  23. }
  24. // NOTE: This is serialized as an event from vm/vm.
  25. // See: EventStringLogEvent
  26. type Log struct {
  27. Address Word256 `json:"address"`
  28. Topics []Word256 `json:"topics"`
  29. Data []byte `json:"data"`
  30. Height int64 `json:"height"`
  31. }
  32. type AppState interface {
  33. // Accounts
  34. GetAccount(addr Word256) *Account
  35. UpdateAccount(*Account)
  36. RemoveAccount(*Account)
  37. CreateAccount(*Account) *Account
  38. // Storage
  39. GetStorage(Word256, Word256) Word256
  40. SetStorage(Word256, Word256, Word256) // Setting to Zero is deleting.
  41. // Logs
  42. AddLog(*Log)
  43. }
  44. type Params struct {
  45. BlockHeight int64
  46. BlockHash Word256
  47. BlockTime int64
  48. GasLimit int64
  49. }