Documentation ¶
Index ¶
- func AddAndSaveBalance(ctx context.Context, table ecoApi.BatchBalanceTable, addr sdk.AccAddress, ...) error
- func BatchSupplyInvariant(ctx context.Context, k Keeper, basketBalances map[uint64]math.Dec) (msg string, broken bool)
- func RetireAndSaveBalance(ctx context.Context, table ecoApi.BatchBalanceTable, addr sdk.AccAddress, ...) error
- func RetireSupply(ctx context.Context, table ecoApi.BatchSupplyTable, batchKey uint64, ...) error
- type Keeper
- func (k Keeper) AddCreditType(ctx sdk.Context, ctp *core.CreditTypeProposal) error
- func (k Keeper) Balance(ctx context.Context, req *core.QueryBalanceRequest) (*core.QueryBalanceResponse, error)
- func (k Keeper) Balances(ctx context.Context, req *core.QueryBalancesRequest) (*core.QueryBalancesResponse, error)
- func (k Keeper) Batch(ctx context.Context, request *core.QueryBatchRequest) (*core.QueryBatchResponse, error)
- func (k Keeper) Batches(ctx context.Context, request *core.QueryBatchesRequest) (*core.QueryBatchesResponse, error)
- func (k Keeper) BatchesByClass(ctx context.Context, request *core.QueryBatchesByClassRequest) (*core.QueryBatchesByClassResponse, error)
- func (k Keeper) BatchesByIssuer(ctx context.Context, req *core.QueryBatchesByIssuerRequest) (*core.QueryBatchesByIssuerResponse, error)
- func (k Keeper) BatchesByProject(ctx context.Context, request *core.QueryBatchesByProjectRequest) (*core.QueryBatchesByProjectResponse, error)
- func (k Keeper) Bridge(ctx context.Context, req *core.MsgBridge) (*core.MsgBridgeResponse, error)
- func (k Keeper) BridgeReceive(ctx context.Context, req *core.MsgBridgeReceive) (*core.MsgBridgeReceiveResponse, error)
- func (k Keeper) Cancel(ctx context.Context, req *core.MsgCancel) (*core.MsgCancelResponse, error)
- func (k Keeper) Class(ctx context.Context, request *core.QueryClassRequest) (*core.QueryClassResponse, error)
- func (k Keeper) ClassIssuers(ctx context.Context, request *core.QueryClassIssuersRequest) (*core.QueryClassIssuersResponse, error)
- func (k Keeper) Classes(ctx context.Context, request *core.QueryClassesRequest) (*core.QueryClassesResponse, error)
- func (k Keeper) ClassesByAdmin(ctx context.Context, req *core.QueryClassesByAdminRequest) (*core.QueryClassesByAdminResponse, error)
- func (k Keeper) CreateBatch(ctx context.Context, req *core.MsgCreateBatch) (*core.MsgCreateBatchResponse, error)
- func (k Keeper) CreateClass(goCtx context.Context, req *core.MsgCreateClass) (*core.MsgCreateClassResponse, error)
- func (k Keeper) CreateProject(ctx context.Context, req *core.MsgCreateProject) (*core.MsgCreateProjectResponse, error)
- func (k Keeper) CreditType(ctx context.Context, request *core.QueryCreditTypeRequest) (*core.QueryCreditTypeResponse, error)
- func (k Keeper) CreditTypes(ctx context.Context, _ *core.QueryCreditTypesRequest) (*core.QueryCreditTypesResponse, error)
- func (k Keeper) MintBatchCredits(ctx context.Context, req *core.MsgMintBatchCredits) (*core.MsgMintBatchCreditsResponse, error)
- func (k Keeper) Params(ctx context.Context, _ *core.QueryParamsRequest) (*core.QueryParamsResponse, error)
- func (k Keeper) Project(ctx context.Context, request *core.QueryProjectRequest) (*core.QueryProjectResponse, error)
- func (k Keeper) Projects(ctx context.Context, request *core.QueryProjectsRequest) (*core.QueryProjectsResponse, error)
- func (k Keeper) ProjectsByAdmin(ctx context.Context, req *core.QueryProjectsByAdminRequest) (*core.QueryProjectsByAdminResponse, error)
- func (k Keeper) ProjectsByClass(ctx context.Context, request *core.QueryProjectsByClassRequest) (*core.QueryProjectsByClassResponse, error)
- func (k Keeper) ProjectsByReferenceId(ctx context.Context, req *core.QueryProjectsByReferenceIdRequest) (*core.QueryProjectsByReferenceIdResponse, error)
- func (k Keeper) Retire(ctx context.Context, req *core.MsgRetire) (*core.MsgRetireResponse, error)
- func (k Keeper) SealBatch(ctx context.Context, req *core.MsgSealBatch) (*core.MsgSealBatchResponse, error)
- func (k Keeper) Send(ctx context.Context, req *core.MsgSend) (*core.MsgSendResponse, error)
- func (k Keeper) Supply(ctx context.Context, request *core.QuerySupplyRequest) (*core.QuerySupplyResponse, error)
- func (k Keeper) UpdateClassAdmin(ctx context.Context, req *core.MsgUpdateClassAdmin) (*core.MsgUpdateClassAdminResponse, error)
- func (k Keeper) UpdateClassIssuers(ctx context.Context, req *core.MsgUpdateClassIssuers) (*core.MsgUpdateClassIssuersResponse, error)
- func (k Keeper) UpdateClassMetadata(ctx context.Context, req *core.MsgUpdateClassMetadata) (*core.MsgUpdateClassMetadataResponse, error)
- func (k Keeper) UpdateProjectAdmin(ctx context.Context, req *core.MsgUpdateProjectAdmin) (*core.MsgUpdateProjectAdminResponse, error)
- func (k Keeper) UpdateProjectMetadata(ctx context.Context, req *core.MsgUpdateProjectMetadata) (*core.MsgUpdateProjectMetadataResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddAndSaveBalance ¶
func AddAndSaveBalance(ctx context.Context, table ecoApi.BatchBalanceTable, addr sdk.AccAddress, batchKey uint64, amt math.Dec) error
AddAndSaveBalance adds 'amt' to the addr's tradable balance.
func BatchSupplyInvariant ¶
func BatchSupplyInvariant(ctx context.Context, k Keeper, basketBalances map[uint64]math.Dec) (msg string, broken bool)
BatchSupplyInvariant checks - calculated total tradable balance of each credit batch matches the total tradable supply - calculated total retired balance of each credit batch matches the total retired supply
func RetireAndSaveBalance ¶
func RetireAndSaveBalance(ctx context.Context, table ecoApi.BatchBalanceTable, addr sdk.AccAddress, batchKey uint64, amount math.Dec) error
RetireAndSaveBalance adds 'amt' to the addr's retired balance.
func RetireSupply ¶
func RetireSupply(ctx context.Context, table ecoApi.BatchSupplyTable, batchKey uint64, amount math.Dec) error
RetireSupply moves `amount` of credits from the supply's tradable amount to its retired amount.
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
func NewKeeper ¶
func NewKeeper( ss api.StateStore, bk ecocredit.BankKeeper, pk ecocredit.ParamKeeper, ma sdk.AccAddress, ) Keeper
func (Keeper) AddCreditType ¶
AddCreditType is a gov handler method that adds a new credit type to the network
func (Keeper) Balance ¶
func (k Keeper) Balance(ctx context.Context, req *core.QueryBalanceRequest) (*core.QueryBalanceResponse, error)
Balance queries the balance (both tradable and retired) of a given credit batch for a given account.
func (Keeper) Balances ¶
func (k Keeper) Balances(ctx context.Context, req *core.QueryBalancesRequest) (*core.QueryBalancesResponse, error)
func (Keeper) Batch ¶
func (k Keeper) Batch(ctx context.Context, request *core.QueryBatchRequest) (*core.QueryBatchResponse, error)
Batch queries for information on a credit batch.
func (Keeper) Batches ¶
func (k Keeper) Batches(ctx context.Context, request *core.QueryBatchesRequest) (*core.QueryBatchesResponse, error)
Batches queries for all batches in the given credit class.
func (Keeper) BatchesByClass ¶
func (k Keeper) BatchesByClass(ctx context.Context, request *core.QueryBatchesByClassRequest) (*core.QueryBatchesByClassResponse, error)
BatchesByClass queries all batches issued under a given credit class.
func (Keeper) BatchesByIssuer ¶
func (k Keeper) BatchesByIssuer(ctx context.Context, req *core.QueryBatchesByIssuerRequest) (*core.QueryBatchesByIssuerResponse, error)
BatchesByIssuer queries all batches issued from the given issuer address
func (Keeper) BatchesByProject ¶
func (k Keeper) BatchesByProject(ctx context.Context, request *core.QueryBatchesByProjectRequest) (*core.QueryBatchesByProjectResponse, error)
BatchesByProject queries for all batches in the given credit class.
func (Keeper) Bridge ¶
Bridge cancel credits, removing them from the supply and balance of the holder
func (Keeper) BridgeReceive ¶
func (k Keeper) BridgeReceive(ctx context.Context, req *core.MsgBridgeReceive) (*core.MsgBridgeReceiveResponse, error)
BridgeReceive bridges credits received from another chain.
func (Keeper) Class ¶
func (k Keeper) Class(ctx context.Context, request *core.QueryClassRequest) (*core.QueryClassResponse, error)
Class queries for information on a credit class.
func (Keeper) ClassIssuers ¶
func (k Keeper) ClassIssuers(ctx context.Context, request *core.QueryClassIssuersRequest) (*core.QueryClassIssuersResponse, error)
ClassIssuers returns a list of addresses that are allowed to issue batches from the given class.
func (Keeper) Classes ¶
func (k Keeper) Classes(ctx context.Context, request *core.QueryClassesRequest) (*core.QueryClassesResponse, error)
Classes queries for all credit classes with pagination.
func (Keeper) ClassesByAdmin ¶
func (k Keeper) ClassesByAdmin(ctx context.Context, req *core.QueryClassesByAdminRequest) (*core.QueryClassesByAdminResponse, error)
ClassesByAdmin queries for all classes with a specific admin address.
func (Keeper) CreateBatch ¶
func (k Keeper) CreateBatch(ctx context.Context, req *core.MsgCreateBatch) (*core.MsgCreateBatchResponse, error)
CreateBatch creates a new batch of credits. Credits in the batch must not have more decimal places than the credit type's specified precision.
func (Keeper) CreateClass ¶
func (k Keeper) CreateClass(goCtx context.Context, req *core.MsgCreateClass) (*core.MsgCreateClassResponse, error)
CreateClass creates a new class of ecocredit
The admin is charged a fee for creating the class. This is controlled by the global parameter CreditClassFee, which can be updated through the governance process.
func (Keeper) CreateProject ¶
func (k Keeper) CreateProject(ctx context.Context, req *core.MsgCreateProject) (*core.MsgCreateProjectResponse, error)
CreateProject creates a new project for a specific credit class.
func (Keeper) CreditType ¶
func (k Keeper) CreditType(ctx context.Context, request *core.QueryCreditTypeRequest) (*core.QueryCreditTypeResponse, error)
CreditType queries credit type information by abbreviation.
func (Keeper) CreditTypes ¶
func (k Keeper) CreditTypes(ctx context.Context, _ *core.QueryCreditTypesRequest) (*core.QueryCreditTypesResponse, error)
CreditTypes queries the list of allowed types that credit classes can have.
func (Keeper) MintBatchCredits ¶
func (k Keeper) MintBatchCredits(ctx context.Context, req *core.MsgMintBatchCredits) (*core.MsgMintBatchCreditsResponse, error)
MintBatchCredits issues additional credits from an open batch.
func (Keeper) Params ¶
func (k Keeper) Params(ctx context.Context, _ *core.QueryParamsRequest) (*core.QueryParamsResponse, error)
Params queries the ecocredit module parameters. TODO: remove params https://github.com/regen-network/regen-ledger/issues/729 Currently this is an ugly hack that grabs v1alpha types and converts them into v1beta types. will be gone with #729.
func (Keeper) Project ¶
func (k Keeper) Project(ctx context.Context, request *core.QueryProjectRequest) (*core.QueryProjectResponse, error)
Project queries project info from the given project name.
func (Keeper) Projects ¶
func (k Keeper) Projects(ctx context.Context, request *core.QueryProjectsRequest) (*core.QueryProjectsResponse, error)
Projects queries all projects.
func (Keeper) ProjectsByAdmin ¶
func (k Keeper) ProjectsByAdmin(ctx context.Context, req *core.QueryProjectsByAdminRequest) (*core.QueryProjectsByAdminResponse, error)
func (Keeper) ProjectsByClass ¶
func (k Keeper) ProjectsByClass(ctx context.Context, request *core.QueryProjectsByClassRequest) (*core.QueryProjectsByClassResponse, error)
ProjectsByClass queries all projects from a given credit class.
func (Keeper) ProjectsByReferenceId ¶
func (k Keeper) ProjectsByReferenceId(ctx context.Context, req *core.QueryProjectsByReferenceIdRequest) (*core.QueryProjectsByReferenceIdResponse, error)
ProjectsByReferenceId queries projects by reference id.
func (Keeper) Retire ¶
Retire credits to the specified jurisdiction. WARNING: retiring credits is permanent. Retired credits cannot be un-retired.
func (Keeper) SealBatch ¶
func (k Keeper) SealBatch(ctx context.Context, req *core.MsgSealBatch) (*core.MsgSealBatchResponse, error)
SealBatch sets the Open field to false in a batch IFF the requester address matches the batch issuer address. This method is a no-op for batches which already have Open set to false.
func (Keeper) Send ¶
Send sends credits to a recipient. Send also retires credits if the amount to retire is specified in the request.
func (Keeper) Supply ¶
func (k Keeper) Supply(ctx context.Context, request *core.QuerySupplyRequest) (*core.QuerySupplyResponse, error)
Supply queries the supply (tradable, retired, cancelled) of a given credit batch.
func (Keeper) UpdateClassAdmin ¶
func (k Keeper) UpdateClassAdmin(ctx context.Context, req *core.MsgUpdateClassAdmin) (*core.MsgUpdateClassAdminResponse, error)
UpdateClassAdmin updates the admin address for a class. WARNING: this method will forfeit control of the entire class to the provided address. double check your inputs to ensure you do not lose control of the class.
func (Keeper) UpdateClassIssuers ¶
func (k Keeper) UpdateClassIssuers(ctx context.Context, req *core.MsgUpdateClassIssuers) (*core.MsgUpdateClassIssuersResponse, error)
UpdateClassIssuers updates a class's issuers by either adding more issuers, or removing issuers from the class issuer store.
func (Keeper) UpdateClassMetadata ¶
func (k Keeper) UpdateClassMetadata(ctx context.Context, req *core.MsgUpdateClassMetadata) (*core.MsgUpdateClassMetadataResponse, error)
UpdateClassMetadata updates the metadata for the class.
func (Keeper) UpdateProjectAdmin ¶
func (k Keeper) UpdateProjectAdmin(ctx context.Context, req *core.MsgUpdateProjectAdmin) (*core.MsgUpdateProjectAdminResponse, error)
UpdateProjectAdmin updates the project admin.
func (Keeper) UpdateProjectMetadata ¶
func (k Keeper) UpdateProjectMetadata(ctx context.Context, req *core.MsgUpdateProjectMetadata) (*core.MsgUpdateProjectMetadataResponse, error)
UpdateProjectMetadata updates the project metadata.
Source Files ¶
- invariants.go
- keeper.go
- msg_bridge.go
- msg_bridge_receive.go
- msg_cancel.go
- msg_create_batch.go
- msg_create_class.go
- msg_create_project.go
- msg_mint_batch_credits.go
- msg_retire.go
- msg_seal_batch.go
- msg_send.go
- msg_update_class_admin.go
- msg_update_class_issuers.go
- msg_update_class_metadata.go
- msg_update_project_admin.go
- msg_update_project_metadata.go
- proposal_add_credit_type.go
- query_balance.go
- query_balances.go
- query_batch_info.go
- query_batches.go
- query_batches_by_class.go
- query_batches_by_issuer.go
- query_batches_by_project.go
- query_class_info.go
- query_class_issuers.go
- query_classes.go
- query_classes_by_admin.go
- query_credit_type.go
- query_credit_types.go
- query_params.go
- query_project_info.go
- query_projects.go
- query_projects_by_admin.go
- query_projects_by_class.go
- query_projects_by_reference_id.go
- query_supply.go
- utils.go