github.com/cosmos/cosmos-sdk@v0.50.10/types/account.go (about)

     1  package types
     2  
     3  import (
     4  	"github.com/cosmos/gogoproto/proto"
     5  
     6  	cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
     7  )
     8  
     9  // AccountI is an interface used to store coins at a given address within state.
    10  // It presumes a notion of sequence numbers for replay protection,
    11  // a notion of account numbers for replay protection for previously pruned accounts,
    12  // and a pubkey for authentication purposes.
    13  //
    14  // Many complex conditions can be used in the concrete struct which implements AccountI.
    15  type AccountI interface {
    16  	proto.Message
    17  
    18  	GetAddress() AccAddress
    19  	SetAddress(AccAddress) error // errors if already set.
    20  
    21  	GetPubKey() cryptotypes.PubKey // can return nil.
    22  	SetPubKey(cryptotypes.PubKey) error
    23  
    24  	GetAccountNumber() uint64
    25  	SetAccountNumber(uint64) error
    26  
    27  	GetSequence() uint64
    28  	SetSequence(uint64) error
    29  
    30  	// Ensure that account implements stringer
    31  	String() string
    32  }
    33  
    34  // ModuleAccountI defines an account interface for modules that hold tokens in
    35  // an escrow.
    36  type ModuleAccountI interface {
    37  	AccountI
    38  
    39  	GetName() string
    40  	GetPermissions() []string
    41  	HasPermission(string) bool
    42  }