binding

package
v0.21.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CustomExecuteMsgHandler

func CustomExecuteMsgHandler(
	perpv2 perpv2keeper.Keeper,
	sudoKeeper sudo.Keeper,
	oracleKeeper oraclekeeper.Keeper,
) func(wasmkeeper.Messenger) wasmkeeper.Messenger

func CustomQuerier

func CustomQuerier(qp QueryPlugin) func(ctx sdk.Context, request json.RawMessage) ([]byte, error)

CustomQuerier returns a function that is an implementation of the custom querier mechanism for specific messages

func RegisterWasmOptions

func RegisterWasmOptions(
	perpv2 perpv2keeper.Keeper,
	sudoKeeper sudo.Keeper,
	oracleKeeper oraclekeeper.Keeper,
) []wasm.Option

Types

type BindingExecuteMsgWrapper

type BindingExecuteMsgWrapper struct {
	// Routes here refer to groups of modules on Nibiru. The idea behind setting
	// routes alongside the messae payload is to add information on which module
	// or group of modules a particular execute message belongs to.
	// For example, the perp bindings have route "perp".
	Route *string `json:"route,omitempty"`
	// ExecuteMsg is a json struct for ExecuteMsg::{
	//   OpenPosition, ClosePosition, AddMargin, RemoveMargin, ...} from the
	//   bindings smart contracts.
	ExecuteMsg *cw_struct.BindingMsg `json:"msg,omitempty"`
}

BindingExecuteMsgWrapper is a n override of CosmosMsg::Custom (json.RawMessage), which corresponds to `BindingExecuteMsgWrapper` in the bindings-perp.rs contract.

type CustomWasmExecutor

type CustomWasmExecutor struct {
	Wasm   wasmkeeper.Messenger
	Perp   ExecutorPerp
	Sudo   sudo.Keeper
	Oracle ExecutorOracle
}

CustomWasmExecutor is an extension of wasm/keeper.Messenger with its own custom `DispatchMsg` for CosmWasm execute calls on Nibiru.

func (*CustomWasmExecutor) DispatchMsg

func (messenger *CustomWasmExecutor) DispatchMsg(
	ctx sdk.Context,
	contractAddr sdk.AccAddress,
	contractIBCPortID string,
	wasmMsg wasmvmtypes.CosmosMsg,
) (events []sdk.Event, data [][]byte, err error)

DispatchMsg encodes the wasmVM message and dispatches it.

type ExecutorOracle

type ExecutorOracle struct {
	Oracle oraclekeeper.Keeper
}

func (ExecutorOracle) SetOracleParams

func (o ExecutorOracle) SetOracleParams(msg *cw_struct.EditOracleParams, ctx sdk.Context) error

type ExecutorPerp

type ExecutorPerp struct {
	PerpV2 perpv2keeper.Keeper
}

func (*ExecutorPerp) AddMargin

func (exec *ExecutorPerp) AddMargin(
	cwMsg *cw_struct.AddMargin, sender sdk.AccAddress, ctx sdk.Context,
) (
	sdkResp *perpv2types.MsgAddMarginResponse, err error,
)

func (*ExecutorPerp) ClosePosition

func (exec *ExecutorPerp) ClosePosition(
	cwMsg *cw_struct.ClosePosition, sender sdk.AccAddress, ctx sdk.Context,
) (
	sdkResp *perpv2types.MsgClosePositionResponse, err error,
)

func (*ExecutorPerp) CreateMarket

func (exec *ExecutorPerp) CreateMarket(
	cwMsg *cw_struct.CreateMarket, ctx sdk.Context,
) (err error)

func (*ExecutorPerp) DepthShift

func (exec *ExecutorPerp) DepthShift(cwMsg *cw_struct.DepthShift, ctx sdk.Context) (err error)

func (*ExecutorPerp) InsuranceFundWithdraw

func (exec *ExecutorPerp) InsuranceFundWithdraw(
	cwMsg *cw_struct.InsuranceFundWithdraw, ctx sdk.Context,
) (err error)

func (*ExecutorPerp) MsgServer

func (exec *ExecutorPerp) MsgServer() perpv2types.MsgServer

func (*ExecutorPerp) OpenPosition

func (exec *ExecutorPerp) OpenPosition(
	cwMsg *cw_struct.OpenPosition, sender sdk.AccAddress, ctx sdk.Context,
) (
	sdkResp *perpv2types.MsgOpenPositionResponse, err error,
)

func (*ExecutorPerp) PegShift

func (exec *ExecutorPerp) PegShift(
	cwMsg *cw_struct.PegShift, contractAddr sdk.AccAddress, ctx sdk.Context,
) (err error)

func (*ExecutorPerp) RemoveMargin

func (exec *ExecutorPerp) RemoveMargin(
	cwMsg *cw_struct.RemoveMargin, sender sdk.AccAddress, ctx sdk.Context,
) (
	sdkResp *perpv2types.MsgRemoveMarginResponse, err error,
)

func (*ExecutorPerp) SetMarketEnabled

func (exec *ExecutorPerp) SetMarketEnabled(
	cwMsg *cw_struct.SetMarketEnabled, ctx sdk.Context,
) (err error)

type PerpQuerier

type PerpQuerier struct {
	// contains filtered or unexported fields
}

func (*PerpQuerier) AllMarkets

func (perpExt *PerpQuerier) AllMarkets(
	ctx sdk.Context,
) (*cw_struct.AllMarketsResponse, error)

func (*PerpQuerier) BasePrice

func (perpExt *PerpQuerier) BasePrice(
	ctx sdk.Context, cwReq *cw_struct.BasePriceRequest,
) (*cw_struct.BasePriceResponse, error)

func (*PerpQuerier) Metrics

func (perpExt *PerpQuerier) Metrics(
	ctx sdk.Context, cwReq *cw_struct.MetricsRequest,
) (*cw_struct.MetricsResponse, error)

func (*PerpQuerier) ModuleAccounts

func (perpExt *PerpQuerier) ModuleAccounts(
	ctx sdk.Context, cwReq *cw_struct.ModuleAccountsRequest,
) (*cw_struct.ModuleAccountsResponse, error)

func (*PerpQuerier) ModuleParams

func (perpExt *PerpQuerier) ModuleParams(
	ctx sdk.Context, cwReq *cw_struct.PerpParamsRequest,
) (*cw_struct.PerpParamsResponse, error)

func (*PerpQuerier) Position

func (perpExt *PerpQuerier) Position(
	ctx sdk.Context, cwReq *cw_struct.PositionRequest,
) (*cw_struct.PositionResponse, error)

func (*PerpQuerier) Positions

func (perpExt *PerpQuerier) Positions(
	ctx sdk.Context, cwReq *cw_struct.PositionsRequest,
) (*cw_struct.PositionsResponse, error)

func (*PerpQuerier) PremiumFraction

func (perpExt *PerpQuerier) PremiumFraction(
	ctx sdk.Context, cwReq *cw_struct.PremiumFractionRequest,
) (*cw_struct.PremiumFractionResponse, error)

func (*PerpQuerier) Reserves

func (perpExt *PerpQuerier) Reserves(
	ctx sdk.Context, cwReq *cw_struct.ReservesRequest,
) (*cw_struct.ReservesResponse, error)

type QueryPlugin

type QueryPlugin struct {
	Perp *PerpQuerier
}

func NewQueryPlugin

func NewQueryPlugin(perp perpv2keeper.Keeper) QueryPlugin

NewQueryPlugin returns a pointer to a new QueryPlugin

func (*QueryPlugin) ToBinary

func (qp *QueryPlugin) ToBinary(
	cwResp any, err error, cwReq any,
) ([]byte, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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