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.

56 lines
1.0 KiB

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. 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. type Log struct {
  23. Address Word256
  24. Topics []Word256
  25. Data []byte
  26. Height int64
  27. }
  28. type AppState interface {
  29. // Accounts
  30. GetAccount(addr Word256) *Account
  31. UpdateAccount(*Account)
  32. RemoveAccount(*Account)
  33. CreateAccount(*Account) *Account
  34. // Storage
  35. GetStorage(Word256, Word256) Word256
  36. SetStorage(Word256, Word256, Word256) // Setting to Zero is deleting.
  37. // Logs
  38. AddLog(*Log)
  39. }
  40. type Params struct {
  41. BlockHeight int64
  42. BlockHash Word256
  43. BlockTime int64
  44. GasLimit int64
  45. }