keeper

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(e error)

checks an error if not nil, it breaks the execution

func CompareCommitment

func CompareCommitment(u *Commitment, v *Commitment) bool

CompareCommitment compares two commitments

func DecodeAccount

func DecodeAccount(accStr string) (*PublicKey, *Commitment, error)

DecodeAccount returns the Pk and Commitment reconstructed from hex

func DecodePoints

func DecodePoints(bytes []byte) (*r255.Element, *r255.Element)

DecodePoints returns the underlying Ristretto Points reconstructed from the concatenated byte array

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.

func ScalarFromBytes

func ScalarFromBytes(b [32]byte) (*r255.Scalar, error)

ScalarFromBytes returns a ristretto scalar from the input bytes performs input mod l where l is the group order

Types

type Commitment

type Commitment struct {
	C *r255.Element
	D *r255.Element
}

Commitment struct

func GenerateCommitment

func GenerateCommitment(p *PublicKey, rscalar *r255.Scalar, intScalar *r255.Scalar) *Commitment

GenerateCommitment creates commitment over balance c = k*g (where k is a random scalar) d = vG + kh (where v is balance, G is base point, k is random scalar and h is grsk generated in pk)

type Keeper

type Keeper struct {
	VoltKeeper *voltkeeper.Keeper
	BankKeeper types.BankKeeper
	// contains filtered or unexported fields
}

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey,
	memKey storetypes.StoreKey,
	ps paramtypes.Subspace,
	voltKeeper *voltkeeper.Keeper,
	bankKeeper types.BankKeeper,

) *Keeper

func (Keeper) DeductFeeFromPrivatePool

func (k Keeper) DeductFeeFromPrivatePool(ctx sdk.Context, fee uint64) error

DeductFeeFromPrivatePool deducts the fee from the private pool in the reserve and adds it to the fee pool

func (Keeper) GetMintOrBurnTradingBtc

func (k Keeper) GetMintOrBurnTradingBtc(ctx sdk.Context, twilightAddress string) ([]types.MsgMintBurnTradingBtc, bool)

GetMintOrBurnTradingBtc returns the stored mint or burn quisquis btc using given twilight address

func (Keeper) GetNextUnlockingReserve

func (k Keeper) GetNextUnlockingReserve(ctx sdk.Context) (*uint64, *volttypes.BtcReserve, error)

GetNextUnlockingReserve returns the next reserve id to be unlocked

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) types.Params

GetParams get all parameters as types.Params

func (Keeper) GetTransferTx

func (k Keeper) GetTransferTx(ctx sdk.Context, txId string) (types.MsgTransferTx, bool)

GetTransferTx returns the stored transfer tx using given txId

func (Keeper) HasUsedQqAccount

func (k Keeper) HasUsedQqAccount(ctx sdk.Context, QqAccount string) bool

HasUsedQqAccount checks if a QqAccount was used before

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

func (Keeper) MarkQqAccountAsUsed

func (k Keeper) MarkQqAccountAsUsed(ctx sdk.Context, QqAccount string)

MarkQqAccountAsUsed saves the used Qqaccount in a new KV store to avoid being reused

func (Keeper) Params

func (Keeper) SetMintOrBurnTradingBtc

func (k Keeper) SetMintOrBurnTradingBtc(ctx sdk.Context, msg *types.MsgMintBurnTradingBtc) error

SetMintOrBurnTradingBtc mints or burns quisquis btc

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

SetParams set the params

func (Keeper) SetTransferTx

func (k Keeper) SetTransferTx(ctx sdk.Context, txId string, txByteCode string, txFee uint64, zkOracleAddress string)

SetTransferTx sets the transfer tx

func (Keeper) TransferTx

type PublicKey

type PublicKey struct {
	Gr   *r255.Element //gi
	Grsk *r255.Element //hi
}

PublicKey struct (g^r, g^r^sk)

Jump to

Keyboard shortcuts

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