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.

49 lines
916 B

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. type AppState interface {
  25. // Accounts
  26. GetAccount(addr Word256) *Account
  27. UpdateAccount(*Account)
  28. RemoveAccount(*Account)
  29. CreateAccount(*Account) *Account
  30. // Storage
  31. GetStorage(Word256, Word256) Word256
  32. SetStorage(Word256, Word256, Word256) // Setting to Zero is deleting.
  33. }
  34. type Params struct {
  35. BlockHeight int64
  36. BlockHash Word256
  37. BlockTime int64
  38. GasLimit int64
  39. }