v3

package
v2.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2022 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TradableBalancePrefix    byte = 0x0
	TradableSupplyPrefix     byte = 0x1
	RetiredBalancePrefix     byte = 0x2
	RetiredSupplyPrefix      byte = 0x3
	CreditTypeSeqTablePrefix byte = 0x4
	ClassInfoTablePrefix     byte = 0x5
	BatchInfoTablePrefix     byte = 0x6
)
View Source
const (
	PRECISION uint32 = 6
)

Variables

View Source
var (
	KeyCreditClassFee       = []byte("CreditClassFee")
	KeyAllowedClassCreators = []byte("AllowedClassCreators")
	KeyAllowlistEnabled     = []byte("AllowlistEnabled")
	KeyCreditTypes          = []byte("CreditTypes")
	KeyBasketCreationFee    = []byte("BasketCreationFee")
)
View Source
var (
	ErrInvalidLengthTypes        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTypes          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group")
)

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

func NormalizeCreditTypeName(name string) string

NormalizeCreditTypeName credit type name by removing whitespace and converting to lowercase.

func ParamKeyTable

func ParamKeyTable() paramtypes.KeyTable

ParamKeyTable returns the parameter key table.

func ParseBatchDenom

func ParseBatchDenom(denom string) (*time.Time, *time.Time, error)

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

func ValidateCreditTypeAbbreviation(abbr string) error

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) Descriptor() ([]byte, []int)

func (*BatchInfo) GetAmountCancelled

func (m *BatchInfo) GetAmountCancelled() string

func (*BatchInfo) GetBatchDenom

func (m *BatchInfo) GetBatchDenom() string

func (*BatchInfo) GetClassId

func (m *BatchInfo) GetClassId() string

func (*BatchInfo) GetEndDate

func (m *BatchInfo) GetEndDate() *time.Time

func (*BatchInfo) GetIssuer

func (m *BatchInfo) GetIssuer() string

func (*BatchInfo) GetMetadata

func (m *BatchInfo) GetMetadata() []byte

func (*BatchInfo) GetProjectLocation

func (m *BatchInfo) GetProjectLocation() string

func (*BatchInfo) GetStartDate

func (m *BatchInfo) GetStartDate() *time.Time

func (*BatchInfo) GetTotalAmount

func (m *BatchInfo) GetTotalAmount() string

func (*BatchInfo) Marshal

func (m *BatchInfo) Marshal() (dAtA []byte, err error)

func (*BatchInfo) MarshalTo

func (m *BatchInfo) MarshalTo(dAtA []byte) (int, error)

func (*BatchInfo) MarshalToSizedBuffer

func (m *BatchInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)

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) Reset

func (m *BatchInfo) Reset()

func (*BatchInfo) Size

func (m *BatchInfo) Size() (n int)

func (*BatchInfo) String

func (m *BatchInfo) String() string

func (*BatchInfo) Unmarshal

func (m *BatchInfo) Unmarshal(dAtA []byte) error

func (*BatchInfo) XXX_DiscardUnknown

func (m *BatchInfo) XXX_DiscardUnknown()

func (*BatchInfo) XXX_Marshal

func (m *BatchInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*BatchInfo) XXX_Merge

func (m *BatchInfo) XXX_Merge(src proto.Message)

func (*BatchInfo) XXX_Size

func (m *BatchInfo) XXX_Size() int

func (*BatchInfo) XXX_Unmarshal

func (m *BatchInfo) XXX_Unmarshal(b []byte) error

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) Descriptor() ([]byte, []int)

func (*ClassInfo) GetAdmin

func (m *ClassInfo) GetAdmin() string

func (*ClassInfo) GetClassId

func (m *ClassInfo) GetClassId() string

func (*ClassInfo) GetCreditType

func (m *ClassInfo) GetCreditType() *CreditType

func (*ClassInfo) GetIssuers

func (m *ClassInfo) GetIssuers() []string

func (*ClassInfo) GetMetadata

func (m *ClassInfo) GetMetadata() []byte

func (*ClassInfo) GetNumBatches

func (m *ClassInfo) GetNumBatches() uint64

func (*ClassInfo) Marshal

func (m *ClassInfo) Marshal() (dAtA []byte, err error)

func (*ClassInfo) MarshalTo

func (m *ClassInfo) MarshalTo(dAtA []byte) (int, error)

func (*ClassInfo) MarshalToSizedBuffer

func (m *ClassInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)

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) Reset

func (m *ClassInfo) Reset()

func (*ClassInfo) Size

func (m *ClassInfo) Size() (n int)

func (*ClassInfo) String

func (m *ClassInfo) String() string

func (*ClassInfo) Unmarshal

func (m *ClassInfo) Unmarshal(dAtA []byte) error

func (*ClassInfo) XXX_DiscardUnknown

func (m *ClassInfo) XXX_DiscardUnknown()

func (*ClassInfo) XXX_Marshal

func (m *ClassInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ClassInfo) XXX_Merge

func (m *ClassInfo) XXX_Merge(src proto.Message)

func (*ClassInfo) XXX_Size

func (m *ClassInfo) XXX_Size() int

func (*ClassInfo) XXX_Unmarshal

func (m *ClassInfo) XXX_Unmarshal(b []byte) error

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) MarshalTo

func (m *CreditType) MarshalTo(dAtA []byte) (int, 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) MarshalTo

func (m *CreditTypeSeq) MarshalTo(dAtA []byte) (int, 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) Descriptor() ([]byte, []int)

func (*Params) GetAllowedClassCreators

func (m *Params) GetAllowedClassCreators() []string

func (*Params) GetAllowlistEnabled

func (m *Params) GetAllowlistEnabled() bool

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) Marshal

func (m *Params) Marshal() (dAtA []byte, err error)

func (*Params) MarshalTo

func (m *Params) MarshalTo(dAtA []byte) (int, error)

func (*Params) MarshalToSizedBuffer

func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Params) ParamSetPairs

func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs

Implements params.ParamSet

func (*Params) ProtoMessage

func (*Params) ProtoMessage()

func (*Params) Reset

func (m *Params) Reset()

func (*Params) Size

func (m *Params) Size() (n int)

func (*Params) String

func (m *Params) String() string

func (*Params) Unmarshal

func (m *Params) Unmarshal(dAtA []byte) error

func (Params) Validate

func (p Params) Validate() error

Validate will run each param field's validate method

func (*Params) XXX_DiscardUnknown

func (m *Params) XXX_DiscardUnknown()

func (*Params) XXX_Marshal

func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Params) XXX_Merge

func (m *Params) XXX_Merge(src proto.Message)

func (*Params) XXX_Size

func (m *Params) XXX_Size() int

func (*Params) XXX_Unmarshal

func (m *Params) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL