vault

package module
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: Apache-2.0 Imports: 24 Imported by: 1

README

Vault Module

A Provenance Blockchain module for managing vaults.

Table of Contents

Prerequisites

Before you begin, ensure you have the following installed:

Local Development

The local.sh script provides a convenient way to run a single-node blockchain for development and testing purposes.

Starting the Chain

To start the local chain, run:

./local.sh

The first time you run this, it will:

  1. Initialize a new chain with chain-id: vaulty-1.
  2. Create three accounts: validator, account-1, and account-2.
  3. Set up genesis accounts with initial token balances.
  4. Create a genesis transaction for the validator.
  5. Collect the genesis transactions.
  6. Start the chain.

Subsequent runs will simply start the existing chain.

Resetting the Chain

To start from a clean slate, use the -r or --reset flag. This will remove the existing chain data before initializing and starting a new one.

./local.sh --reset

Interacting with the Chain

The scripts directory contains several wrapper scripts to simplify interaction with the local chain via the simd command-line interface.

Transactions

The scripts/tx.sh script is a wrapper for simd tx .... It automatically includes necessary flags like --keyring-backend, --home, --chain-id, and --yes. It also waits for the transaction to be included in a block and reports the result.

Example: To create a vault (the exact command may vary based on module implementation):

# Get the address for account-1
ACCOUNT_1_ADDR=$(./scripts/get-key.sh account-1)

# Example: Create a public vault
./scripts/tx.sh vault create-vault $ACCOUNT_1_ADDR $ACCOUNT_1_ADDR false --from account-1

The script will print the command being executed, and upon completion, it will output the transaction result.

Queries

The scripts/query.sh script is a wrapper for simd q .... It simplifies running queries against the chain.

Example: To query the list of vaults (command may vary):

./scripts/query.sh vault list-vaults

Helper Scripts

  • ./scripts/get-key.sh <key_name>: Retrieves the bech32 address for a given key name from the test keyring.

    ./scripts/get-key.sh account-2
    
  • ./scripts/get-marker-address.sh <denom>: Retrieves the address for a marker with the given denom. This is useful when interacting with the marker module.

    # Assuming a 'hotdogcoin' marker exists
    ./scripts/get-marker-address.sh hotdogcoin
    
  • ./scripts/wait-tx.sh <tx_hash>: Waits for a given transaction hash to be confirmed on-chain. This is used internally by tx.sh.

Protobuf

This project uses Buf to manage Protobuf files and generate Go code. The Protobuf definitions are located in the proto/ directory, and the generated Go code is placed in the api/ directory.

A Makefile at the root of the repository provides commands to manage Protobuf files.

Generating Protobuf Files

To regenerate the Go code from the .proto files, run:

make proto-all

Specifications

The spec/ directory contains module documentation:

  • Concepts & Overview — what a vault is, share/asset model, payment denom behavior, module responsibilities.
  • State — canonical vault accounts, queues/collections, addressing, genesis notes.
  • Msgs — tx endpoints, endpoint gating matrix, flows and validation.
  • Events — event catalog and operational guidance (incl. swap-out success/refund signaling).
  • Queries — gRPC/REST query endpoints, request/response shapes, usage notes.
  • Begin/End Blockers — ABCI hooks for interest rotation and pending swap-out processing. (WIP if empty)

Documentation

Index

Constants

View Source
const ConsensusVersion = 1

ConsensusVersion defines the current x/vault module consensus version.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppModule

type AppModule struct {
	AppModuleBasic
	// contains filtered or unexported fields
}

AppModule implements the core vault module functionality.

func NewAppModule

func NewAppModule(keeper *keeper.Keeper, mk types.MarkerKeeper, bk types.BankKeeper, addressCodec address.Codec) AppModule

NewAppModule creates a new AppModule instance.

func (AppModule) AutoCLIOptions

func (AppModule) AutoCLIOptions() *autocliv1.ModuleOptions

AutoCLIOptions defines CLI commands for tx and query.

func (AppModule) BeginBlock

func (m AppModule) BeginBlock(ctx context.Context) error

BeginBlock returns the begin blocker for the vault module.

func (AppModule) ConsensusVersion

func (AppModule) ConsensusVersion() uint64

ConsensusVersion returns the module consensus version.

func (AppModule) EndBlock

func (m AppModule) EndBlock(ctx context.Context) error

EndBlock returns the end blocker for the vault module.

func (AppModule) ExportGenesis

func (m AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage

ExportGenesis exports the module's state to genesis.

func (AppModule) GenerateGenesisState

func (m AppModule) GenerateGenesisState(simState *module.SimulationState)

GenerateGenesisState creates a randomized GenState of the bank module.

func (AppModule) InitGenesis

func (m AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, bz json.RawMessage)

InitGenesis initializes the module's state from genesis.

func (AppModule) IsAppModule

func (AppModule) IsAppModule()

IsAppModule asserts this is an app module.

func (AppModule) IsOnePerModuleType

func (AppModule) IsOnePerModuleType()

IsOnePerModuleType asserts one module per type.

func (AppModule) RegisterServices

func (m AppModule) RegisterServices(cfg module.Configurator)

RegisterServices registers gRPC query and message services.

func (AppModule) RegisterStoreDecoder

func (m AppModule) RegisterStoreDecoder(_ simtypes.StoreDecoderRegistry)

RegisterStoreDecoder registers a decoder for supply module's types

func (AppModule) WeightedOperations

func (m AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation

WeightedOperations returns the all the gov module operations with their respective weights.

type AppModuleBasic

type AppModuleBasic struct{}

AppModuleBasic implements the basic methods for the vault module.

func NewAppModuleBasic

func NewAppModuleBasic() AppModuleBasic

NewAppModuleBasic creates a new AppModuleBasic.

func (AppModuleBasic) DefaultGenesis

func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage

DefaultGenesis returns default genesis state as raw bytes.

func (AppModuleBasic) Name

func (AppModuleBasic) Name() string

Name returns the vault module name.

func (AppModuleBasic) RegisterGRPCGatewayRoutes

func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux)

RegisterGRPCGatewayRoutes sets up gRPC gateway routes.

func (AppModuleBasic) RegisterInterfaces

func (AppModuleBasic) RegisterInterfaces(reg codectypes.InterfaceRegistry)

RegisterInterfaces registers vault interfaces to the interface registry.

func (AppModuleBasic) RegisterLegacyAminoCodec

func (AppModuleBasic) RegisterLegacyAminoCodec(_ *codec.LegacyAmino)

RegisterLegacyAminoCodec registers the legacy amino codec.

func (AppModuleBasic) ValidateGenesis

ValidateGenesis validates the vault genesis state.

type ModuleInputs

type ModuleInputs struct {
	depinject.In
	Config        *modulev1.Module
	StoreService  store.KVStoreService
	HeaderService header.Service
	EventService  event.Service
	Codec         codec.Codec
	AddressCodec  address.Codec
	AuthKeeper    types.AccountKeeper
	MarkerKeeper  types.MarkerKeeper
	BankKeeper    types.BankKeeper
}

ModuleInputs defines the inputs required to initialize the vault module.

type ModuleOutputs

type ModuleOutputs struct {
	depinject.Out
	Keeper *keeper.Keeper
	Module appmodule.AppModule
}

ModuleOutputs defines the outputs of the vault module provider.

func ProvideModule

func ProvideModule(in ModuleInputs) ModuleOutputs

ProvideModule wires up the vault module and its keeper.

Directories

Path Synopsis
api
provlabs/vault/module/v1
Code generated by protoc-gen-go-pulsar.
Code generated by protoc-gen-go-pulsar.
provlabs/vault/v1
Code generated by protoc-gen-go-pulsar.
Code generated by protoc-gen-go-pulsar.
simapp module
Package types is a reverse proxy.
Package types is a reverse proxy.

Jump to

Keyboard shortcuts

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