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.

53 lines
945 B

10 years ago
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. )
  5. const (
  6. defaultDataStackCapacity = 10
  7. )
  8. type Account struct {
  9. Address Word256
  10. Balance int64
  11. Code []byte
  12. Nonce int64
  13. StorageRoot Word256
  14. Other interface{} // For holding all other data.
  15. }
  16. func (acc *Account) String() string {
  17. return Fmt("VMAccount{%X B:%v C:%X N:%v S:%X}",
  18. acc.Address, acc.Balance, acc.Code, acc.Nonce, acc.StorageRoot)
  19. }
  20. type Log struct {
  21. Address Word256
  22. Topics []Word256
  23. Data []byte
  24. Height int64
  25. }
  26. type AppState interface {
  27. // Accounts
  28. GetAccount(addr Word256) *Account
  29. UpdateAccount(*Account)
  30. RemoveAccount(*Account)
  31. CreateAccount(*Account) *Account
  32. // Storage
  33. GetStorage(Word256, Word256) Word256
  34. SetStorage(Word256, Word256, Word256) // Setting to Zero is deleting.
  35. // Logs
  36. AddLog(*Log)
  37. }
  38. type Params struct {
  39. BlockHeight int64
  40. BlockHash Word256
  41. BlockTime int64
  42. GasLimit int64
  43. }