Documentation ¶
Index ¶
- Constants
- Variables
- func IterateBalances(store sdk.KVStore, storeKey byte, ...) error
- func IterateSupplies(store sdk.KVStore, storeKey byte, cb func(denom, supply string) (bool, error)) error
- func MigrateState(sdkCtx sdk.Context, storeKey storetypes.StoreKey, cdc codec.Codec, ...) error
- func NormalizeCreditTypeName(name string) string
- func ParamKeyTable() paramtypes.KeyTable
- func ParseBatchDenom(denom string) (*time.Time, *time.Time, error)
- func RetiredBalanceKey(acc sdk.AccAddress, batchDenom BatchDenomT) []byte
- func RetiredSupplyKey(batchDenom BatchDenomT) []byte
- func TradableBalanceKey(acc sdk.AccAddress, denom BatchDenomT) []byte
- func TradableSupplyKey(batchDenom BatchDenomT) []byte
- func ValidateCreditTypeAbbreviation(abbr string) error
- type BatchDenomT
- type BatchInfo
- func (*BatchInfo) Descriptor() ([]byte, []int)
- func (m *BatchInfo) GetAmountCancelled() string
- func (m *BatchInfo) GetBatchDenom() string
- func (m *BatchInfo) GetClassId() string
- func (m *BatchInfo) GetEndDate() *time.Time
- func (m *BatchInfo) GetIssuer() string
- func (m *BatchInfo) GetMetadata() []byte
- func (m *BatchInfo) GetProjectLocation() string
- func (m *BatchInfo) GetStartDate() *time.Time
- func (m *BatchInfo) GetTotalAmount() string
- func (m *BatchInfo) Marshal() (dAtA []byte, err error)
- func (m *BatchInfo) MarshalTo(dAtA []byte) (int, error)
- func (m *BatchInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (m *BatchInfo) PrimaryKeyFields() []interface{}
- func (*BatchInfo) ProtoMessage()
- func (m *BatchInfo) Reset()
- func (m *BatchInfo) Size() (n int)
- func (m *BatchInfo) String() string
- func (m *BatchInfo) Unmarshal(dAtA []byte) error
- func (m *BatchInfo) XXX_DiscardUnknown()
- func (m *BatchInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *BatchInfo) XXX_Merge(src proto.Message)
- func (m *BatchInfo) XXX_Size() int
- func (m *BatchInfo) XXX_Unmarshal(b []byte) error
- type ClassInfo
- func (*ClassInfo) Descriptor() ([]byte, []int)
- func (m *ClassInfo) GetAdmin() string
- func (m *ClassInfo) GetClassId() string
- func (m *ClassInfo) GetCreditType() *CreditType
- func (m *ClassInfo) GetIssuers() []string
- func (m *ClassInfo) GetMetadata() []byte
- func (m *ClassInfo) GetNumBatches() uint64
- func (m *ClassInfo) Marshal() (dAtA []byte, err error)
- func (m *ClassInfo) MarshalTo(dAtA []byte) (int, error)
- func (m *ClassInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (m *ClassInfo) PrimaryKeyFields() []interface{}
- func (*ClassInfo) ProtoMessage()
- func (m *ClassInfo) Reset()
- func (m *ClassInfo) Size() (n int)
- func (m *ClassInfo) String() string
- func (m *ClassInfo) Unmarshal(dAtA []byte) error
- func (m *ClassInfo) XXX_DiscardUnknown()
- func (m *ClassInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ClassInfo) XXX_Merge(src proto.Message)
- func (m *ClassInfo) XXX_Size() int
- func (m *ClassInfo) XXX_Unmarshal(b []byte) error
- type CreditType
- func (*CreditType) Descriptor() ([]byte, []int)
- func (m *CreditType) GetAbbreviation() string
- func (m *CreditType) GetName() string
- func (m *CreditType) GetPrecision() uint32
- func (m *CreditType) GetUnit() string
- func (m *CreditType) Marshal() (dAtA []byte, err error)
- func (m *CreditType) MarshalTo(dAtA []byte) (int, error)
- func (m *CreditType) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*CreditType) ProtoMessage()
- func (m *CreditType) Reset()
- func (m *CreditType) Size() (n int)
- func (m *CreditType) String() string
- func (m *CreditType) Unmarshal(dAtA []byte) error
- func (m *CreditType) XXX_DiscardUnknown()
- func (m *CreditType) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *CreditType) XXX_Merge(src proto.Message)
- func (m *CreditType) XXX_Size() int
- func (m *CreditType) XXX_Unmarshal(b []byte) error
- type CreditTypeSeq
- func (*CreditTypeSeq) Descriptor() ([]byte, []int)
- func (m *CreditTypeSeq) GetAbbreviation() string
- func (m *CreditTypeSeq) GetSeqNumber() uint64
- func (m *CreditTypeSeq) Marshal() (dAtA []byte, err error)
- func (m *CreditTypeSeq) MarshalTo(dAtA []byte) (int, error)
- func (m *CreditTypeSeq) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (m *CreditTypeSeq) PrimaryKeyFields() []interface{}
- func (*CreditTypeSeq) ProtoMessage()
- func (m *CreditTypeSeq) Reset()
- func (m *CreditTypeSeq) Size() (n int)
- func (m *CreditTypeSeq) String() string
- func (m *CreditTypeSeq) Unmarshal(dAtA []byte) error
- func (m *CreditTypeSeq) XXX_DiscardUnknown()
- func (m *CreditTypeSeq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *CreditTypeSeq) XXX_Merge(src proto.Message)
- func (m *CreditTypeSeq) XXX_Size() int
- func (m *CreditTypeSeq) XXX_Unmarshal(b []byte) error
- type Params
- func (*Params) Descriptor() ([]byte, []int)
- func (m *Params) GetAllowedClassCreators() []string
- func (m *Params) GetAllowlistEnabled() bool
- func (m *Params) GetBasketCreationFee() github_com_cosmos_cosmos_sdk_types.Coins
- func (m *Params) GetCreditClassFee() github_com_cosmos_cosmos_sdk_types.Coins
- func (m *Params) GetCreditTypes() []*CreditType
- func (m *Params) Marshal() (dAtA []byte, err error)
- func (m *Params) MarshalTo(dAtA []byte) (int, error)
- func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs
- func (*Params) ProtoMessage()
- func (m *Params) Reset()
- func (m *Params) Size() (n int)
- func (m *Params) String() string
- func (m *Params) Unmarshal(dAtA []byte) error
- func (p Params) Validate() error
- func (m *Params) XXX_DiscardUnknown()
- func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Params) XXX_Merge(src proto.Message)
- func (m *Params) XXX_Size() int
- func (m *Params) XXX_Unmarshal(b []byte) error
Constants ¶
const ( TradableBalancePrefix byte = 0x0 TradableSupplyPrefix byte = 0x1 RetiredBalancePrefix byte = 0x2 RetiredSupplyPrefix byte = 0x3 CreditTypeSeqTablePrefix byte = 0x4 ClassInfoTablePrefix byte = 0x5 BatchInfoTablePrefix byte = 0x6 )
const (
PRECISION uint32 = 6
)
Variables ¶
Functions ¶
func IterateBalances ¶
func IterateBalances(store sdk.KVStore, storeKey byte, cb func(address, denom, balance string) (bool, error)) error
IterateBalances iterates over balances and calls the specified callback function `cb`
func IterateSupplies ¶
func IterateSupplies(store sdk.KVStore, storeKey byte, cb func(denom, supply string) (bool, error)) error
IterateSupplies iterates over supplies and calls the specified callback function `cb`
func MigrateState ¶
func MigrateState(sdkCtx sdk.Context, storeKey storetypes.StoreKey, cdc codec.Codec, ss api.StateStore, basketStore basketapi.StateStore, subspace paramtypes.Subspace) error
MigrateState performs in-place store migrations from v3.0 to v4.0.
func NormalizeCreditTypeName ¶
NormalizeCreditTypeName credit type name by removing whitespace and converting to lowercase.
func ParamKeyTable ¶
func ParamKeyTable() paramtypes.KeyTable
ParamKeyTable returns the parameter key table.
func RetiredBalanceKey ¶
func RetiredBalanceKey(acc sdk.AccAddress, batchDenom BatchDenomT) []byte
RetiredBalanceKey creates the index key for recipient address and batch-denom
func RetiredSupplyKey ¶
func RetiredSupplyKey(batchDenom BatchDenomT) []byte
RetiredSupplyKey creates the retired supply key for a given batch-denom
func TradableBalanceKey ¶
func TradableBalanceKey(acc sdk.AccAddress, denom BatchDenomT) []byte
TradableBalanceKey creates the index key for recipient address and batch-denom
func TradableSupplyKey ¶
func TradableSupplyKey(batchDenom BatchDenomT) []byte
TradableSupplyKey creates the tradable supply key for a given batch-denom
func ValidateCreditTypeAbbreviation ¶
ValidateCreditTypeAbbreviation asserts that the argument is 1-3 latin alphabet uppercase letters
Types ¶
type BatchDenomT ¶
type BatchDenomT string
func ParseBalanceKey ¶
func ParseBalanceKey(key []byte) (sdk.AccAddress, BatchDenomT)
ParseBalanceKey parses the recipient address and batch-denom from tradable or retired balance key. Balance keys take the following form: <storage prefix 1 byte><addr length 1 byte><addr><batchDenom>
func ParseSupplyKey ¶
func ParseSupplyKey(key []byte) BatchDenomT
ParseSupplyKey parses the batch-denom from tradable or retired supply key
type BatchInfo ¶
type BatchInfo struct { // class_id is the unique ID of credit class. ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` // batch_denom is the unique ID of credit batch. BatchDenom string `protobuf:"bytes,2,opt,name=batch_denom,json=batchDenom,proto3" json:"batch_denom,omitempty"` // issuer is the issuer of the credit batch. Issuer string `protobuf:"bytes,3,opt,name=issuer,proto3" json:"issuer,omitempty"` // total_amount is the total number of active credits in the credit batch. // Some of the issued credits may be cancelled and will be removed from // total_amount and tracked in amount_cancelled. total_amount and // amount_cancelled will always sum to the original amount of credits that // were issued. TotalAmount string `protobuf:"bytes,4,opt,name=total_amount,json=totalAmount,proto3" json:"total_amount,omitempty"` // metadata is any arbitrary metadata attached to the credit batch. Metadata []byte `protobuf:"bytes,5,opt,name=metadata,proto3" json:"metadata,omitempty"` // amount_cancelled is the number of credits in the batch that have been // cancelled, effectively undoing there issuance. The sum of total_amount and // amount_cancelled will always sum to the original amount of credits that // were issued. AmountCancelled string `protobuf:"bytes,6,opt,name=amount_cancelled,json=amountCancelled,proto3" json:"amount_cancelled,omitempty"` // start_date is the beginning of the period during which this credit batch // was quantified and verified. StartDate *time.Time `protobuf:"bytes,7,opt,name=start_date,json=startDate,proto3,stdtime" json:"start_date,omitempty"` // end_date is the end of the period during which this credit batch was // quantified and verified. EndDate *time.Time `protobuf:"bytes,8,opt,name=end_date,json=endDate,proto3,stdtime" json:"end_date,omitempty"` // project_location is the location of the project backing the credits in this // batch. Full documentation can be found in MsgCreateBatch.project_location. ProjectLocation string `protobuf:"bytes,9,opt,name=project_location,json=projectLocation,proto3" json:"project_location,omitempty"` }
BatchInfo represents the high-level on-chain information for a credit batch.
func (*BatchInfo) Descriptor ¶
func (*BatchInfo) GetAmountCancelled ¶
func (*BatchInfo) GetBatchDenom ¶
func (*BatchInfo) GetClassId ¶
func (*BatchInfo) GetEndDate ¶
func (*BatchInfo) GetMetadata ¶
func (*BatchInfo) GetProjectLocation ¶
func (*BatchInfo) GetStartDate ¶
func (*BatchInfo) GetTotalAmount ¶
func (*BatchInfo) MarshalToSizedBuffer ¶
func (*BatchInfo) PrimaryKeyFields ¶
func (m *BatchInfo) PrimaryKeyFields() []interface{}
PrimaryKeyFields returns the fields of the object that will make up the primary key for BatchInfo.
func (*BatchInfo) ProtoMessage ¶
func (*BatchInfo) ProtoMessage()
func (*BatchInfo) XXX_DiscardUnknown ¶
func (m *BatchInfo) XXX_DiscardUnknown()
func (*BatchInfo) XXX_Marshal ¶
func (*BatchInfo) XXX_Unmarshal ¶
type ClassInfo ¶
type ClassInfo struct { // class_id is the unique ID of credit class. ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` // admin is the admin of the credit class. Admin string `protobuf:"bytes,2,opt,name=admin,proto3" json:"admin,omitempty"` // issuers are the approved issuers of the credit class. Issuers []string `protobuf:"bytes,3,rep,name=issuers,proto3" json:"issuers,omitempty"` // metadata is any arbitrary metadata to attached to the credit class. Metadata []byte `protobuf:"bytes,4,opt,name=metadata,proto3" json:"metadata,omitempty"` // credit_type describes the type of credit (e.g. carbon, biodiversity), as // well as unit and precision. CreditType *CreditType `protobuf:"bytes,5,opt,name=credit_type,json=creditType,proto3" json:"credit_type,omitempty"` // The number of batches issued in this credit class. NumBatches uint64 `protobuf:"varint,6,opt,name=num_batches,json=numBatches,proto3" json:"num_batches,omitempty"` }
ClassInfo represents the high-level on-chain information for a credit class.
func (*ClassInfo) Descriptor ¶
func (*ClassInfo) GetClassId ¶
func (*ClassInfo) GetCreditType ¶
func (m *ClassInfo) GetCreditType() *CreditType
func (*ClassInfo) GetIssuers ¶
func (*ClassInfo) GetMetadata ¶
func (*ClassInfo) GetNumBatches ¶
func (*ClassInfo) MarshalToSizedBuffer ¶
func (*ClassInfo) PrimaryKeyFields ¶
func (m *ClassInfo) PrimaryKeyFields() []interface{}
PrimaryKeyFields returns the fields of the object that will make up the primary key for ClassInfo.
func (*ClassInfo) ProtoMessage ¶
func (*ClassInfo) ProtoMessage()
func (*ClassInfo) XXX_DiscardUnknown ¶
func (m *ClassInfo) XXX_DiscardUnknown()
func (*ClassInfo) XXX_Marshal ¶
func (*ClassInfo) XXX_Unmarshal ¶
type CreditType ¶
type CreditType struct { // the type of credit (e.g. carbon, biodiversity, etc) Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // abbreviation is a 1-3 character uppercase abbreviation of the CreditType // name, used in batch denominations within the CreditType. It must be unique. Abbreviation string `protobuf:"bytes,2,opt,name=abbreviation,proto3" json:"abbreviation,omitempty"` // the measurement unit (e.g. kg, ton, etc) Unit string `protobuf:"bytes,3,opt,name=unit,proto3" json:"unit,omitempty"` // the decimal precision Precision uint32 `protobuf:"varint,4,opt,name=precision,proto3" json:"precision,omitempty"` }
CreditType defines the measurement unit/precision of a certain credit type (e.g. carbon, biodiversity...)
func (*CreditType) Descriptor ¶
func (*CreditType) Descriptor() ([]byte, []int)
func (*CreditType) GetAbbreviation ¶
func (m *CreditType) GetAbbreviation() string
func (*CreditType) GetName ¶
func (m *CreditType) GetName() string
func (*CreditType) GetPrecision ¶
func (m *CreditType) GetPrecision() uint32
func (*CreditType) GetUnit ¶
func (m *CreditType) GetUnit() string
func (*CreditType) Marshal ¶
func (m *CreditType) Marshal() (dAtA []byte, err error)
func (*CreditType) MarshalToSizedBuffer ¶
func (m *CreditType) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*CreditType) ProtoMessage ¶
func (*CreditType) ProtoMessage()
func (*CreditType) Reset ¶
func (m *CreditType) Reset()
func (*CreditType) Size ¶
func (m *CreditType) Size() (n int)
func (*CreditType) String ¶
func (m *CreditType) String() string
func (*CreditType) Unmarshal ¶
func (m *CreditType) Unmarshal(dAtA []byte) error
func (*CreditType) XXX_DiscardUnknown ¶
func (m *CreditType) XXX_DiscardUnknown()
func (*CreditType) XXX_Marshal ¶
func (m *CreditType) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*CreditType) XXX_Merge ¶
func (m *CreditType) XXX_Merge(src proto.Message)
func (*CreditType) XXX_Size ¶
func (m *CreditType) XXX_Size() int
func (*CreditType) XXX_Unmarshal ¶
func (m *CreditType) XXX_Unmarshal(b []byte) error
type CreditTypeSeq ¶
type CreditTypeSeq struct { // The credit type abbreviation Abbreviation string `protobuf:"bytes,1,opt,name=abbreviation,proto3" json:"abbreviation,omitempty"` // The sequence number of classes of the credit type SeqNumber uint64 `protobuf:"varint,2,opt,name=seq_number,json=seqNumber,proto3" json:"seq_number,omitempty"` }
CreditTypeSeq associates a sequence number with a credit type abbreviation. This represents the number of credit classes created with that credit type.
func (*CreditTypeSeq) Descriptor ¶
func (*CreditTypeSeq) Descriptor() ([]byte, []int)
func (*CreditTypeSeq) GetAbbreviation ¶
func (m *CreditTypeSeq) GetAbbreviation() string
func (*CreditTypeSeq) GetSeqNumber ¶
func (m *CreditTypeSeq) GetSeqNumber() uint64
func (*CreditTypeSeq) Marshal ¶
func (m *CreditTypeSeq) Marshal() (dAtA []byte, err error)
func (*CreditTypeSeq) MarshalToSizedBuffer ¶
func (m *CreditTypeSeq) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*CreditTypeSeq) PrimaryKeyFields ¶
func (m *CreditTypeSeq) PrimaryKeyFields() []interface{}
PrimaryKeyFields returns the fields of the object that will make up the primary key for CreditTypeSeq.
func (*CreditTypeSeq) ProtoMessage ¶
func (*CreditTypeSeq) ProtoMessage()
func (*CreditTypeSeq) Reset ¶
func (m *CreditTypeSeq) Reset()
func (*CreditTypeSeq) Size ¶
func (m *CreditTypeSeq) Size() (n int)
func (*CreditTypeSeq) String ¶
func (m *CreditTypeSeq) String() string
func (*CreditTypeSeq) Unmarshal ¶
func (m *CreditTypeSeq) Unmarshal(dAtA []byte) error
func (*CreditTypeSeq) XXX_DiscardUnknown ¶
func (m *CreditTypeSeq) XXX_DiscardUnknown()
func (*CreditTypeSeq) XXX_Marshal ¶
func (m *CreditTypeSeq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*CreditTypeSeq) XXX_Merge ¶
func (m *CreditTypeSeq) XXX_Merge(src proto.Message)
func (*CreditTypeSeq) XXX_Size ¶
func (m *CreditTypeSeq) XXX_Size() int
func (*CreditTypeSeq) XXX_Unmarshal ¶
func (m *CreditTypeSeq) XXX_Unmarshal(b []byte) error
type Params ¶
type Params struct { // credit_class_fee is the fixed fee charged on creation of a new credit class CreditClassFee github_com_cosmos_cosmos_sdk_types.Coins `` /* 149-byte string literal not displayed */ // allowed_class_creators is an allowlist defining the addresses with // the required permissions to create credit classes AllowedClassCreators []string `protobuf:"bytes,2,rep,name=allowed_class_creators,json=allowedClassCreators,proto3" json:"allowed_class_creators,omitempty"` // allowlist_enabled is a param that enables/disables the allowlist for credit // creation AllowlistEnabled bool `protobuf:"varint,3,opt,name=allowlist_enabled,json=allowlistEnabled,proto3" json:"allowlist_enabled,omitempty"` // credit_types is a list of definitions for credit types CreditTypes []*CreditType `protobuf:"bytes,4,rep,name=credit_types,json=creditTypes,proto3" json:"credit_types,omitempty"` // basket_creation_fee is the fee to create a new basket denom. BasketCreationFee github_com_cosmos_cosmos_sdk_types.Coins `` /* 158-byte string literal not displayed */ }
Params defines the updatable global parameters of the ecocredit module for use with the x/params module.
func (*Params) Descriptor ¶
func (*Params) GetAllowedClassCreators ¶
func (*Params) GetAllowlistEnabled ¶
func (*Params) GetBasketCreationFee ¶
func (m *Params) GetBasketCreationFee() github_com_cosmos_cosmos_sdk_types.Coins
func (*Params) GetCreditClassFee ¶
func (m *Params) GetCreditClassFee() github_com_cosmos_cosmos_sdk_types.Coins
func (*Params) GetCreditTypes ¶
func (m *Params) GetCreditTypes() []*CreditType
func (*Params) MarshalToSizedBuffer ¶
func (*Params) ParamSetPairs ¶
func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs
Implements params.ParamSet
func (*Params) ProtoMessage ¶
func (*Params) ProtoMessage()
func (*Params) XXX_DiscardUnknown ¶
func (m *Params) XXX_DiscardUnknown()