Documentation
¶
Overview ¶
Package types is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func GetErrorFromUpdateResults(success bool, successPerUpdate []UpdateResult, updates []Update) error
- func NewCreateSettledFundingEvent(subaccount SubaccountId, perpetualId uint32, fundingPaid *big.Int) sdk.Event
- func RegisterCodec(cdc *codec.LegacyAmino)
- func RegisterInterfaces(registry cdctypes.InterfaceRegistry)
- func RegisterMsgServer(s grpc1.Server, srv MsgServer)
- func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error
- func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error
- func RegisterQueryServer(s grpc1.Server, srv QueryServer)
- type AssetPosition
- func (*AssetPosition) Descriptor() ([]byte, []int)
- func (m *AssetPosition) GetAssetId() uint32
- func (m *AssetPosition) GetBigQuantums() *big.Int
- func (m *AssetPosition) GetId() uint32
- func (m *AssetPosition) GetIndex() uint64
- func (m *AssetPosition) GetIsLong() bool
- func (m *AssetPosition) GetProductType() string
- func (m *AssetPosition) Marshal() (dAtA []byte, err error)
- func (m *AssetPosition) MarshalTo(dAtA []byte) (int, error)
- func (m *AssetPosition) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*AssetPosition) ProtoMessage()
- func (m *AssetPosition) Reset()
- func (m *AssetPosition) SetBigQuantums(sizeQuantums *big.Int)
- func (m *AssetPosition) Size() (n int)
- func (m *AssetPosition) String() string
- func (m *AssetPosition) Unmarshal(dAtA []byte) error
- func (m *AssetPosition) XXX_DiscardUnknown()
- func (m *AssetPosition) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *AssetPosition) XXX_Merge(src proto.Message)
- func (m *AssetPosition) XXX_Size() int
- func (m *AssetPosition) XXX_Unmarshal(b []byte) error
- type AssetUpdate
- type AssetsKeeper
- type BankKeeper
- type BaseQuantums
- type BlocktimeKeeper
- type CollateralTransferPerpetualPositionStateTransition
- type GenesisState
- func (*GenesisState) Descriptor() ([]byte, []int)
- func (m *GenesisState) GetSubaccounts() []Subaccount
- func (m *GenesisState) Marshal() (dAtA []byte, err error)
- func (m *GenesisState) MarshalTo(dAtA []byte) (int, error)
- func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*GenesisState) ProtoMessage()
- func (m *GenesisState) Reset()
- func (m *GenesisState) Size() (n int)
- func (m *GenesisState) String() string
- func (m *GenesisState) Unmarshal(dAtA []byte) error
- func (gs GenesisState) Validate() error
- func (m *GenesisState) XXX_DiscardUnknown()
- func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *GenesisState) XXX_Merge(src proto.Message)
- func (m *GenesisState) XXX_Size() int
- func (m *GenesisState) XXX_Unmarshal(b []byte) error
- type MsgClaimYieldForSubaccount
- func (*MsgClaimYieldForSubaccount) Descriptor() ([]byte, []int)
- func (m *MsgClaimYieldForSubaccount) GetId() *SubaccountId
- func (m *MsgClaimYieldForSubaccount) Marshal() (dAtA []byte, err error)
- func (m *MsgClaimYieldForSubaccount) MarshalTo(dAtA []byte) (int, error)
- func (m *MsgClaimYieldForSubaccount) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*MsgClaimYieldForSubaccount) ProtoMessage()
- func (m *MsgClaimYieldForSubaccount) Reset()
- func (m *MsgClaimYieldForSubaccount) Size() (n int)
- func (m *MsgClaimYieldForSubaccount) String() string
- func (m *MsgClaimYieldForSubaccount) Unmarshal(dAtA []byte) error
- func (msg *MsgClaimYieldForSubaccount) ValidateBasic() error
- func (m *MsgClaimYieldForSubaccount) XXX_DiscardUnknown()
- func (m *MsgClaimYieldForSubaccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *MsgClaimYieldForSubaccount) XXX_Merge(src proto.Message)
- func (m *MsgClaimYieldForSubaccount) XXX_Size() int
- func (m *MsgClaimYieldForSubaccount) XXX_Unmarshal(b []byte) error
- type MsgClaimYieldForSubaccountResponse
- func (*MsgClaimYieldForSubaccountResponse) Descriptor() ([]byte, []int)
- func (m *MsgClaimYieldForSubaccountResponse) Marshal() (dAtA []byte, err error)
- func (m *MsgClaimYieldForSubaccountResponse) MarshalTo(dAtA []byte) (int, error)
- func (m *MsgClaimYieldForSubaccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*MsgClaimYieldForSubaccountResponse) ProtoMessage()
- func (m *MsgClaimYieldForSubaccountResponse) Reset()
- func (m *MsgClaimYieldForSubaccountResponse) Size() (n int)
- func (m *MsgClaimYieldForSubaccountResponse) String() string
- func (m *MsgClaimYieldForSubaccountResponse) Unmarshal(dAtA []byte) error
- func (m *MsgClaimYieldForSubaccountResponse) XXX_DiscardUnknown()
- func (m *MsgClaimYieldForSubaccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *MsgClaimYieldForSubaccountResponse) XXX_Merge(src proto.Message)
- func (m *MsgClaimYieldForSubaccountResponse) XXX_Size() int
- func (m *MsgClaimYieldForSubaccountResponse) XXX_Unmarshal(b []byte) error
- type MsgClient
- type MsgServer
- type PerpetualPosition
- func (*PerpetualPosition) Descriptor() ([]byte, []int)
- func (m *PerpetualPosition) GetBigQuantums() *big.Int
- func (m *PerpetualPosition) GetId() uint32
- func (m *PerpetualPosition) GetIsLong() bool
- func (m *PerpetualPosition) GetPerpetualId() uint32
- func (m *PerpetualPosition) GetProductType() string
- func (m *PerpetualPosition) GetYieldIndex() string
- func (m *PerpetualPosition) Marshal() (dAtA []byte, err error)
- func (m *PerpetualPosition) MarshalTo(dAtA []byte) (int, error)
- func (m *PerpetualPosition) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*PerpetualPosition) ProtoMessage()
- func (m *PerpetualPosition) Reset()
- func (m *PerpetualPosition) SetBigQuantums(sizeQuantums *big.Int)
- func (m *PerpetualPosition) SetQuantums(sizeQuantums int64)
- func (m *PerpetualPosition) Size() (n int)
- func (m *PerpetualPosition) String() string
- func (m *PerpetualPosition) Unmarshal(dAtA []byte) error
- func (m *PerpetualPosition) XXX_DiscardUnknown()
- func (m *PerpetualPosition) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *PerpetualPosition) XXX_Merge(src proto.Message)
- func (m *PerpetualPosition) XXX_Size() int
- func (m *PerpetualPosition) XXX_Unmarshal(b []byte) error
- type PerpetualUpdate
- type PerpetualsKeeper
- type Position
- type PositionSize
- type PositionStateTransition
- type PositionUpdate
- type ProductKeeper
- type QueryAllSubaccountRequest
- func (*QueryAllSubaccountRequest) Descriptor() ([]byte, []int)
- func (m *QueryAllSubaccountRequest) GetPagination() *query.PageRequest
- func (m *QueryAllSubaccountRequest) Marshal() (dAtA []byte, err error)
- func (m *QueryAllSubaccountRequest) MarshalTo(dAtA []byte) (int, error)
- func (m *QueryAllSubaccountRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*QueryAllSubaccountRequest) ProtoMessage()
- func (m *QueryAllSubaccountRequest) Reset()
- func (m *QueryAllSubaccountRequest) Size() (n int)
- func (m *QueryAllSubaccountRequest) String() string
- func (m *QueryAllSubaccountRequest) Unmarshal(dAtA []byte) error
- func (m *QueryAllSubaccountRequest) XXX_DiscardUnknown()
- func (m *QueryAllSubaccountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *QueryAllSubaccountRequest) XXX_Merge(src proto.Message)
- func (m *QueryAllSubaccountRequest) XXX_Size() int
- func (m *QueryAllSubaccountRequest) XXX_Unmarshal(b []byte) error
- type QueryClient
- type QueryCollateralPoolAddressRequest
- func (*QueryCollateralPoolAddressRequest) Descriptor() ([]byte, []int)
- func (m *QueryCollateralPoolAddressRequest) GetPerpetualId() uint32
- func (m *QueryCollateralPoolAddressRequest) Marshal() (dAtA []byte, err error)
- func (m *QueryCollateralPoolAddressRequest) MarshalTo(dAtA []byte) (int, error)
- func (m *QueryCollateralPoolAddressRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*QueryCollateralPoolAddressRequest) ProtoMessage()
- func (m *QueryCollateralPoolAddressRequest) Reset()
- func (m *QueryCollateralPoolAddressRequest) Size() (n int)
- func (m *QueryCollateralPoolAddressRequest) String() string
- func (m *QueryCollateralPoolAddressRequest) Unmarshal(dAtA []byte) error
- func (m *QueryCollateralPoolAddressRequest) XXX_DiscardUnknown()
- func (m *QueryCollateralPoolAddressRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *QueryCollateralPoolAddressRequest) XXX_Merge(src proto.Message)
- func (m *QueryCollateralPoolAddressRequest) XXX_Size() int
- func (m *QueryCollateralPoolAddressRequest) XXX_Unmarshal(b []byte) error
- type QueryCollateralPoolAddressResponse
- func (*QueryCollateralPoolAddressResponse) Descriptor() ([]byte, []int)
- func (m *QueryCollateralPoolAddressResponse) GetCollateralPoolAddress() string
- func (m *QueryCollateralPoolAddressResponse) Marshal() (dAtA []byte, err error)
- func (m *QueryCollateralPoolAddressResponse) MarshalTo(dAtA []byte) (int, error)
- func (m *QueryCollateralPoolAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*QueryCollateralPoolAddressResponse) ProtoMessage()
- func (m *QueryCollateralPoolAddressResponse) Reset()
- func (m *QueryCollateralPoolAddressResponse) Size() (n int)
- func (m *QueryCollateralPoolAddressResponse) String() string
- func (m *QueryCollateralPoolAddressResponse) Unmarshal(dAtA []byte) error
- func (m *QueryCollateralPoolAddressResponse) XXX_DiscardUnknown()
- func (m *QueryCollateralPoolAddressResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *QueryCollateralPoolAddressResponse) XXX_Merge(src proto.Message)
- func (m *QueryCollateralPoolAddressResponse) XXX_Size() int
- func (m *QueryCollateralPoolAddressResponse) XXX_Unmarshal(b []byte) error
- type QueryGetSubaccountRequest
- func (*QueryGetSubaccountRequest) Descriptor() ([]byte, []int)
- func (m *QueryGetSubaccountRequest) GetNumber() uint32
- func (m *QueryGetSubaccountRequest) GetOwner() string
- func (m *QueryGetSubaccountRequest) Marshal() (dAtA []byte, err error)
- func (m *QueryGetSubaccountRequest) MarshalTo(dAtA []byte) (int, error)
- func (m *QueryGetSubaccountRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*QueryGetSubaccountRequest) ProtoMessage()
- func (m *QueryGetSubaccountRequest) Reset()
- func (m *QueryGetSubaccountRequest) Size() (n int)
- func (m *QueryGetSubaccountRequest) String() string
- func (m *QueryGetSubaccountRequest) Unmarshal(dAtA []byte) error
- func (m *QueryGetSubaccountRequest) XXX_DiscardUnknown()
- func (m *QueryGetSubaccountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *QueryGetSubaccountRequest) XXX_Merge(src proto.Message)
- func (m *QueryGetSubaccountRequest) XXX_Size() int
- func (m *QueryGetSubaccountRequest) XXX_Unmarshal(b []byte) error
- type QueryGetWithdrawalAndTransfersBlockedInfoRequest
- func (*QueryGetWithdrawalAndTransfersBlockedInfoRequest) Descriptor() ([]byte, []int)
- func (m *QueryGetWithdrawalAndTransfersBlockedInfoRequest) GetPerpetualId() uint32
- func (m *QueryGetWithdrawalAndTransfersBlockedInfoRequest) Marshal() (dAtA []byte, err error)
- func (m *QueryGetWithdrawalAndTransfersBlockedInfoRequest) MarshalTo(dAtA []byte) (int, error)
- func (m *QueryGetWithdrawalAndTransfersBlockedInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*QueryGetWithdrawalAndTransfersBlockedInfoRequest) ProtoMessage()
- func (m *QueryGetWithdrawalAndTransfersBlockedInfoRequest) Reset()
- func (m *QueryGetWithdrawalAndTransfersBlockedInfoRequest) Size() (n int)
- func (m *QueryGetWithdrawalAndTransfersBlockedInfoRequest) String() string
- func (m *QueryGetWithdrawalAndTransfersBlockedInfoRequest) Unmarshal(dAtA []byte) error
- func (m *QueryGetWithdrawalAndTransfersBlockedInfoRequest) XXX_DiscardUnknown()
- func (m *QueryGetWithdrawalAndTransfersBlockedInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *QueryGetWithdrawalAndTransfersBlockedInfoRequest) XXX_Merge(src proto.Message)
- func (m *QueryGetWithdrawalAndTransfersBlockedInfoRequest) XXX_Size() int
- func (m *QueryGetWithdrawalAndTransfersBlockedInfoRequest) XXX_Unmarshal(b []byte) error
- type QueryGetWithdrawalAndTransfersBlockedInfoResponse
- func (*QueryGetWithdrawalAndTransfersBlockedInfoResponse) Descriptor() ([]byte, []int)
- func (m *QueryGetWithdrawalAndTransfersBlockedInfoResponse) GetChainOutageSeenAtBlock() uint32
- func (m *QueryGetWithdrawalAndTransfersBlockedInfoResponse) GetNegativeTncSubaccountSeenAtBlock() uint32
- func (m *QueryGetWithdrawalAndTransfersBlockedInfoResponse) GetWithdrawalsAndTransfersUnblockedAtBlock() uint32
- func (m *QueryGetWithdrawalAndTransfersBlockedInfoResponse) Marshal() (dAtA []byte, err error)
- func (m *QueryGetWithdrawalAndTransfersBlockedInfoResponse) MarshalTo(dAtA []byte) (int, error)
- func (m *QueryGetWithdrawalAndTransfersBlockedInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*QueryGetWithdrawalAndTransfersBlockedInfoResponse) ProtoMessage()
- func (m *QueryGetWithdrawalAndTransfersBlockedInfoResponse) Reset()
- func (m *QueryGetWithdrawalAndTransfersBlockedInfoResponse) Size() (n int)
- func (m *QueryGetWithdrawalAndTransfersBlockedInfoResponse) String() string
- func (m *QueryGetWithdrawalAndTransfersBlockedInfoResponse) Unmarshal(dAtA []byte) error
- func (m *QueryGetWithdrawalAndTransfersBlockedInfoResponse) XXX_DiscardUnknown()
- func (m *QueryGetWithdrawalAndTransfersBlockedInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *QueryGetWithdrawalAndTransfersBlockedInfoResponse) XXX_Merge(src proto.Message)
- func (m *QueryGetWithdrawalAndTransfersBlockedInfoResponse) XXX_Size() int
- func (m *QueryGetWithdrawalAndTransfersBlockedInfoResponse) XXX_Unmarshal(b []byte) error
- type QueryServer
- type QuerySubaccountAllResponse
- func (*QuerySubaccountAllResponse) Descriptor() ([]byte, []int)
- func (m *QuerySubaccountAllResponse) GetPagination() *query.PageResponse
- func (m *QuerySubaccountAllResponse) GetSubaccount() []Subaccount
- func (m *QuerySubaccountAllResponse) Marshal() (dAtA []byte, err error)
- func (m *QuerySubaccountAllResponse) MarshalTo(dAtA []byte) (int, error)
- func (m *QuerySubaccountAllResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*QuerySubaccountAllResponse) ProtoMessage()
- func (m *QuerySubaccountAllResponse) Reset()
- func (m *QuerySubaccountAllResponse) Size() (n int)
- func (m *QuerySubaccountAllResponse) String() string
- func (m *QuerySubaccountAllResponse) Unmarshal(dAtA []byte) error
- func (m *QuerySubaccountAllResponse) XXX_DiscardUnknown()
- func (m *QuerySubaccountAllResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *QuerySubaccountAllResponse) XXX_Merge(src proto.Message)
- func (m *QuerySubaccountAllResponse) XXX_Size() int
- func (m *QuerySubaccountAllResponse) XXX_Unmarshal(b []byte) error
- type QuerySubaccountResponse
- func (*QuerySubaccountResponse) Descriptor() ([]byte, []int)
- func (m *QuerySubaccountResponse) GetSubaccount() Subaccount
- func (m *QuerySubaccountResponse) Marshal() (dAtA []byte, err error)
- func (m *QuerySubaccountResponse) MarshalTo(dAtA []byte) (int, error)
- func (m *QuerySubaccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*QuerySubaccountResponse) ProtoMessage()
- func (m *QuerySubaccountResponse) Reset()
- func (m *QuerySubaccountResponse) Size() (n int)
- func (m *QuerySubaccountResponse) String() string
- func (m *QuerySubaccountResponse) Unmarshal(dAtA []byte) error
- func (m *QuerySubaccountResponse) XXX_DiscardUnknown()
- func (m *QuerySubaccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *QuerySubaccountResponse) XXX_Merge(src proto.Message)
- func (m *QuerySubaccountResponse) XXX_Size() int
- func (m *QuerySubaccountResponse) XXX_Unmarshal(b []byte) error
- type RatelimitKeeper
- type SortedSubaccountIds
- type Subaccount
- func (*Subaccount) Descriptor() ([]byte, []int)
- func (m *Subaccount) GetAssetPosition(assetId uint32) *big.Int
- func (m *Subaccount) GetAssetPositions() []*AssetPosition
- func (m *Subaccount) GetAssetYieldIndex() string
- func (m *Subaccount) GetId() *SubaccountId
- func (m *Subaccount) GetMarginEnabled() bool
- func (m *Subaccount) GetPerpetualPositionForId(perpetualId uint32) (perpetualPosition *PerpetualPosition, exists bool)
- func (m *Subaccount) GetPerpetualPositions() []*PerpetualPosition
- func (m *Subaccount) GetTDaiPosition() *big.Int
- func (m *Subaccount) Marshal() (dAtA []byte, err error)
- func (m *Subaccount) MarshalTo(dAtA []byte) (int, error)
- func (m *Subaccount) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Subaccount) ProtoMessage()
- func (m *Subaccount) Reset()
- func (m *Subaccount) SetAssetPosition(newAssetPosition *big.Int, assetId uint32)
- func (m *Subaccount) SetTDaiAssetPosition(newTDaiPosition *big.Int)
- func (m *Subaccount) Size() (n int)
- func (m *Subaccount) String() string
- func (m *Subaccount) Unmarshal(dAtA []byte) error
- func (m *Subaccount) XXX_DiscardUnknown()
- func (m *Subaccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Subaccount) XXX_Merge(src proto.Message)
- func (m *Subaccount) XXX_Size() int
- func (m *Subaccount) XXX_Unmarshal(b []byte) error
- type SubaccountId
- func (*SubaccountId) Descriptor() ([]byte, []int)
- func (m *SubaccountId) GetNumber() uint32
- func (m *SubaccountId) GetOwner() string
- func (m *SubaccountId) Marshal() (dAtA []byte, err error)
- func (m *SubaccountId) MarshalTo(dAtA []byte) (int, error)
- func (m *SubaccountId) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (m *SubaccountId) MustGetAccAddress() sdk.AccAddress
- func (*SubaccountId) ProtoMessage()
- func (m *SubaccountId) Reset()
- func (m *SubaccountId) Size() (n int)
- func (m *SubaccountId) String() string
- func (id *SubaccountId) ToStateKey() []byte
- func (m *SubaccountId) Unmarshal(dAtA []byte) error
- func (m *SubaccountId) Validate() error
- func (m *SubaccountId) XXX_DiscardUnknown()
- func (m *SubaccountId) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *SubaccountId) XXX_Merge(src proto.Message)
- func (m *SubaccountId) XXX_Size() int
- func (m *SubaccountId) XXX_Unmarshal(b []byte) error
- type SubaccountsKeeper
- type UnimplementedMsgServer
- type UnimplementedQueryServer
- func (*UnimplementedQueryServer) CollateralPoolAddress(ctx context.Context, req *QueryCollateralPoolAddressRequest) (*QueryCollateralPoolAddressResponse, error)
- func (*UnimplementedQueryServer) GetWithdrawalAndTransfersBlockedInfo(ctx context.Context, req *QueryGetWithdrawalAndTransfersBlockedInfoRequest) (*QueryGetWithdrawalAndTransfersBlockedInfoResponse, error)
- func (*UnimplementedQueryServer) Subaccount(ctx context.Context, req *QueryGetSubaccountRequest) (*QuerySubaccountResponse, error)
- func (*UnimplementedQueryServer) SubaccountAll(ctx context.Context, req *QueryAllSubaccountRequest) (*QuerySubaccountAllResponse, error)
- type Update
- type UpdateResult
- type UpdateType
Constants ¶
const ( ErrMatchUpdatesMustHaveTwoPerpetualUpdates = "internalCanUpdateSubaccounts: MATCH subaccount updates must consist of " + "exactly 2 perpetual updates, got settledUpdates: %+v" ErrMatchUpdatesMustHaveTwoUpdates = "internalCanUpdateSubaccounts: MATCH subaccount updates must consist of " + "exactly 2 updates, got settledUpdates: %+v" ErrMatchUpdatesMustUpdateOnePerp = "internalCanUpdateSubaccounts: MATCH subaccount updates must each have " + "exactly 1 PerpetualUpdate, got settledUpdates: %+v" ErrMatchUpdatesMustBeSamePerpId = "internalCanUpdateSubaccounts: MATCH subaccount updates must consists of two " + "updates on same perpetual Id, got settledUpdates: %+v" ErrMatchUpdatesInvalidSize = "internalCanUpdateSubaccounts: MATCH subaccount updates must consists of two " + "updates of equal absolute base quantums and opposite sign: %+v" )
Panic strings
const ( EventTypeSettledFunding = "settled_funding" AttributeKeySubaccount = "subaccount" AttributeKeySubaccountNumber = "subaccount_number" AttributeKeyPerpetualId = "perpetual_id" AttributeKeyFundingPaid = "funding_paid_quote_quantums" )
Subaccounts module event types.
const ( // ModuleName defines the module name ModuleName = "subaccounts" // StoreKey defines the primary module store key StoreKey = ModuleName )
Module name and store keys
const ( // SubaccountKeyPrefix is the prefix to retrieve all Subaccounts SubaccountKeyPrefix = "SA:" // NegativeTncSubaccountForCollateralPoolSeenAtBlockKeyPrefix is the prefix for the store key that // stores the last block a negative TNC subaccount was seen in state for a specific collateral pool. NegativeTncSubaccountForCollateralPoolSeenAtBlockKeyPrefix = "NegSA:" // Suffix for the store key to the last block a negative TNC subaccount was seen in state for the // cross collateral pool. NegativeTncSuffix = "ntnc" )
State
const ( AssetProductType = "asset" PerpetualProductType = "perpetual" UnknownProductTYpe = "unknown" )
const (
MaxSubaccountIdNumber = 128_000 // 0 ... 128,000 are valid numbers.
)
const WITHDRAWAL_AND_TRANSFERS_BLOCKED_AFTER_CHAIN_OUTAGE_DURATION = 5 * time.Minute
const WITHDRAWAL_AND_TRANSFERS_BLOCKED_AFTER_NEGATIVE_TNC_SUBACCOUNT_SEEN_BLOCKS = 50
WITHDRAWAL_AND_TRANSFER_DELAY_AFTER_NEGATIVE_TNC_SUBACCOUNT_SEEN_BLOCKS defines the number of blocks withdrawals and transfers will be blocked if a negative TNC subaccount is seen in state, starting from the last block a negative TNC subaccount was seen.
Variables ¶
var ( ModuleAddress = authtypes.NewModuleAddress(ModuleName) CollateralPoolZeroAddress = authtypes.NewModuleAddress(ModuleName + ":0") CollateralPoolOneAddress = authtypes.NewModuleAddress(ModuleName + ":1") CollateralPoolTwoAddress = authtypes.NewModuleAddress(ModuleName + ":2") CollateralPoolThreeAddress = authtypes.NewModuleAddress(ModuleName + ":3") CollateralPoolFourAddress = authtypes.NewModuleAddress(ModuleName + ":4") LiquidityFeeModuleAddress = "liquidity_module" )
var ( ErrInvalidLengthAssetPosition = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowAssetPosition = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupAssetPosition = fmt.Errorf("proto: unexpected end of group") )
var ( Amino = codec.NewLegacyAmino() ModuleCdc = codec.NewProtoCodec(module.InterfaceRegistry) )
var ( // 0 - 99: generic. ErrIntegerOverflow = errorsmod.Register(ModuleName, 0, "integer overflow") ErrRatConversion = errorsmod.Register(ModuleName, 1, "could not convert rat to string") ErrPositionIsNil = errorsmod.Register(ModuleName, 2, "position is nil") ErrSubaccountIdIsNil = errorsmod.Register(ModuleName, 3, "subaccount Id is nil") // 100 - 199: update related. ErrNonUniqueUpdatesPosition = errorsmod.Register( ModuleName, 100, "multiple updates were specified for the same position id") ErrNonUniqueUpdatesSubaccount = errorsmod.Register( ModuleName, 101, "multiple updates were specified for the same subaccountId") ErrFailedToUpdateSubaccounts = errorsmod.Register(ModuleName, 102, "failed to apply subaccount updates") ErrProductPositionNotUpdatable = errorsmod.Register(ModuleName, 103, "product position is not updatable") ErrGlobalYieldIndexNil = errorsmod.Register(ModuleName, 104, "general yield index is nil") ErrGlobalYieldIndexNegative = errorsmod.Register(ModuleName, 105, "general yield index is negative") ErrYieldIndexUninitialized = errorsmod.Register(ModuleName, 106, "yield index for subaccount is badly initialised to empty string") ErrPerpYieldIndexUninitialized = errorsmod.Register(ModuleName, 107, "yield index for perpetual is badly initialised to empty string") ErrGeneralYieldIndexSmallerThanYieldIndexInSubaccount = errorsmod.Register(ModuleName, 108, "general yield index is less than the current yield index") ErrNoYieldToClaim = errorsmod.Register(ModuleName, 109, "there is no yield to claim for subaccount") ErrYieldClaimedNegative = errorsmod.Register(ModuleName, 110, "subaccount has negative total yield claim") ErrTryingToDepositNegativeYield = errorsmod.Register(ModuleName, 111, "attempting to deposit negative yield into collateral pool") // 200 - 299: subaccount id related. ErrInvalidSubaccountIdNumber = errorsmod.Register( ModuleName, 200, "subaccount id number cannot exceed "+lib.IntToString(MaxSubaccountIdNumber), ) ErrInvalidSubaccountIdOwner = errorsmod.Register(ModuleName, 201, "subaccount id owner is an invalid address") ErrDuplicateSubaccountIds = errorsmod.Register(ModuleName, 202, "duplicate subaccount id found in genesis") // 300 - 399: asset position related. ErrAssetPositionZeroQuantum = errorsmod.Register(ModuleName, 301, "asset position's quantum cannot be zero") ErrNegativeAssetYieldIndexNotSupported = errorsmod.Register(ModuleName, 304, "negative asset yield index not supported") // 400 - 499: perpetual position related. ErrPerpPositionsOutOfOrder = errorsmod.Register(ModuleName, 400, "perpetual positions are out of order") ErrPerpPositionZeroQuantum = errorsmod.Register( ModuleName, 401, "perpetual position's quantum cannot be zero", ) ErrCannotModifyPerpOpenInterestForOIMF = errorsmod.Register( ModuleName, 402, "cannot modify perpetual open interest for OIMF calculation", ) ErrCannotRevertPerpOpenInterestForOIMF = errorsmod.Register( ModuleName, 403, "cannot revert perpetual open interest for OIMF calculation", ) ErrPerpetualPositionPriceNotPresentForEpoch = errorsmod.Register( ModuleName, 404, "price for perpetual position not found for epoch", ) // 500 - 599: transfer related. ErrAssetTransferQuantumsNotPositive = errorsmod.Register( ModuleName, 500, "asset transfer quantums is not positive") ErrYieldClaim = errorsmod.Register( ModuleName, 502, "error when claiming yield for subaccount") )
x/subaccounts module sentinel errors
var ( ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") )
var ( ErrInvalidLengthPerpetualPosition = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowPerpetualPosition = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupPerpetualPosition = fmt.Errorf("proto: unexpected end of group") )
var ( ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") )
Functions ¶
func GetErrorFromUpdateResults ¶
func GetErrorFromUpdateResults( success bool, successPerUpdate []UpdateResult, updates []Update, ) error
GetErrorFromUpdateResults generates a helpful error when UpdateSubaccounts or CanUpdateSubaccounts returns one or more failed updates.
func NewCreateSettledFundingEvent ¶
func NewCreateSettledFundingEvent( subaccount SubaccountId, perpetualId uint32, fundingPaid *big.Int, ) sdk.Event
NewCreateSettledFundingEvent constructs a new funding sdk.Event. Note that `fundingPaid` is positive if the subaccount paid funding, negative if the subaccount received funding. TODO(CT-245): Add tests that this event is emitted.
func RegisterCodec ¶
func RegisterCodec(cdc *codec.LegacyAmino)
func RegisterInterfaces ¶
func RegisterInterfaces(registry cdctypes.InterfaceRegistry)
func RegisterMsgServer ¶
func RegisterQueryHandler ¶
RegisterQueryHandler registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterQueryHandlerClient ¶
func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error
RegisterQueryHandlerClient registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "QueryClient" to call the correct interceptors.
func RegisterQueryHandlerFromEndpoint ¶
func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterQueryHandlerServer ¶
func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error
RegisterQueryHandlerServer registers the http handlers for service Query to "mux". UnaryRPC :call QueryServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.
func RegisterQueryServer ¶
func RegisterQueryServer(s grpc1.Server, srv QueryServer)
Types ¶
type AssetPosition ¶
type AssetPosition struct { // The `Id` of the `Asset`. AssetId uint32 `protobuf:"varint,1,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` // The absolute size of the position in base quantums. Quantums github_com_StreamFinance_Protocol_stream_chain_protocol_dtypes.SerializableInt `` /* 149-byte string literal not displayed */ // The `Index` (either `LongIndex` or `ShortIndex`) of the `Asset` the last // time this position was settled // TODO(DEC-582): pending margin trading being added. Index uint64 `protobuf:"varint,3,opt,name=index,proto3" json:"index,omitempty"` }
AssetPositions define an account’s positions of an `Asset`. Therefore they hold any information needed to trade on Spot and Margin.
func (*AssetPosition) Descriptor ¶
func (*AssetPosition) Descriptor() ([]byte, []int)
func (*AssetPosition) GetAssetId ¶
func (m *AssetPosition) GetAssetId() uint32
func (*AssetPosition) GetBigQuantums ¶
func (m *AssetPosition) GetBigQuantums() *big.Int
Get the asset position quantum size in big.Int. Panics if the size is zero.
func (*AssetPosition) GetId ¶
func (m *AssetPosition) GetId() uint32
func (*AssetPosition) GetIndex ¶
func (m *AssetPosition) GetIndex() uint64
func (*AssetPosition) GetIsLong ¶
func (m *AssetPosition) GetIsLong() bool
func (*AssetPosition) GetProductType ¶
func (m *AssetPosition) GetProductType() string
func (*AssetPosition) Marshal ¶
func (m *AssetPosition) Marshal() (dAtA []byte, err error)
func (*AssetPosition) MarshalToSizedBuffer ¶
func (m *AssetPosition) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*AssetPosition) ProtoMessage ¶
func (*AssetPosition) ProtoMessage()
func (*AssetPosition) Reset ¶
func (m *AssetPosition) Reset()
func (*AssetPosition) SetBigQuantums ¶
func (m *AssetPosition) SetBigQuantums(sizeQuantums *big.Int)
func (*AssetPosition) Size ¶
func (m *AssetPosition) Size() (n int)
func (*AssetPosition) String ¶
func (m *AssetPosition) String() string
func (*AssetPosition) Unmarshal ¶
func (m *AssetPosition) Unmarshal(dAtA []byte) error
func (*AssetPosition) XXX_DiscardUnknown ¶
func (m *AssetPosition) XXX_DiscardUnknown()
func (*AssetPosition) XXX_Marshal ¶
func (m *AssetPosition) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*AssetPosition) XXX_Merge ¶
func (m *AssetPosition) XXX_Merge(src proto.Message)
func (*AssetPosition) XXX_Size ¶
func (m *AssetPosition) XXX_Size() int
func (*AssetPosition) XXX_Unmarshal ¶
func (m *AssetPosition) XXX_Unmarshal(b []byte) error
type AssetUpdate ¶
type AssetUpdate struct { // The `Id` of the `Asset` for which the `AssetPosition` is for. AssetId uint32 // The signed change in the Size of the `AssetPosition`. BigQuantumsDelta *big.Int }
func (AssetUpdate) GetBigQuantums ¶
func (au AssetUpdate) GetBigQuantums() *big.Int
func (AssetUpdate) GetId ¶
func (au AssetUpdate) GetId() uint32
func (AssetUpdate) GetIsLong ¶
func (au AssetUpdate) GetIsLong() bool
func (AssetUpdate) GetProductType ¶
func (au AssetUpdate) GetProductType() string
type AssetsKeeper ¶
type AssetsKeeper interface { ProductKeeper ConvertAssetToCoin( ctx sdk.Context, assetId uint32, quantums *big.Int, ) ( convertedQuantums *big.Int, coin sdk.Coin, err error, ) ConvertCoinToAsset(ctx sdk.Context, assetId uint32, coin sdk.Coin) (quantums *big.Int, convertedDenom *big.Int, err error) ConvertAssetToFullCoin( ctx sdk.Context, assetId uint32, quantums *big.Int, ) ( convertedQuantums *big.Int, fullCoinAmount *big.Int, err error, ) }
type BankKeeper ¶
type BankKeeper interface { SendCoinsFromAccountToModule( ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins, ) error SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins, ) error SendCoinsFromModuleToModule(ctx context.Context, senderModule, recipientModule string, amt sdk.Coins) error SendCoins(ctx context.Context, fromAddr, toAddr sdk.AccAddress, amt sdk.Coins) error GetBalance(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin }
BankKeeper defines the expected interface needed to retrieve account balances.
type BaseQuantums ¶
type BaseQuantums uint64
BaseQuantums is used to represent an amount in base quantums.
func (BaseQuantums) ToBigInt ¶
func (bq BaseQuantums) ToBigInt() *big.Int
Get the BaseQuantum value in *big.Int.
func (BaseQuantums) ToUint64 ¶
func (bq BaseQuantums) ToUint64() uint64
Get the BaseQuantum value in uint64.
type BlocktimeKeeper ¶
type BlocktimeKeeper interface {
GetDowntimeInfoFor(ctx sdk.Context, duration time.Duration) blocktimetypes.AllDowntimeInfo_DowntimeInfo
}
type CollateralTransferPerpetualPositionStateTransition ¶
type CollateralTransferPerpetualPositionStateTransition struct { SubaccountId *SubaccountId PerpetualId uint32 AssetIds []uint32 // BigQuantums of collateral to transfer as a result of the state transition. BigQuantums []*big.Int // The state transition that occurred for the isolated perpetual positions. Transition PositionStateTransition }
Represents a state transition for a collateral transfer from one collateral pool to another when a perpetual position is opened or closed.
type GenesisState ¶
type GenesisState struct {
Subaccounts []Subaccount `protobuf:"bytes,1,rep,name=subaccounts,proto3" json:"subaccounts"`
}
GenesisState defines the subaccounts module's genesis state.
func DefaultGenesis ¶
func DefaultGenesis() *GenesisState
DefaultGenesis returns the default Capability genesis state
func (*GenesisState) Descriptor ¶
func (*GenesisState) Descriptor() ([]byte, []int)
func (*GenesisState) GetSubaccounts ¶
func (m *GenesisState) GetSubaccounts() []Subaccount
func (*GenesisState) Marshal ¶
func (m *GenesisState) Marshal() (dAtA []byte, err error)
func (*GenesisState) MarshalToSizedBuffer ¶
func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*GenesisState) ProtoMessage ¶
func (*GenesisState) ProtoMessage()
func (*GenesisState) Reset ¶
func (m *GenesisState) Reset()
func (*GenesisState) Size ¶
func (m *GenesisState) Size() (n int)
func (*GenesisState) String ¶
func (m *GenesisState) String() string
func (*GenesisState) Unmarshal ¶
func (m *GenesisState) Unmarshal(dAtA []byte) error
func (GenesisState) Validate ¶
func (gs GenesisState) Validate() error
Validate performs basic genesis state validation returning an error upon any failure.
func (*GenesisState) XXX_DiscardUnknown ¶
func (m *GenesisState) XXX_DiscardUnknown()
func (*GenesisState) XXX_Marshal ¶
func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*GenesisState) XXX_Merge ¶
func (m *GenesisState) XXX_Merge(src proto.Message)
func (*GenesisState) XXX_Size ¶
func (m *GenesisState) XXX_Size() int
func (*GenesisState) XXX_Unmarshal ¶
func (m *GenesisState) XXX_Unmarshal(b []byte) error
type MsgClaimYieldForSubaccount ¶
type MsgClaimYieldForSubaccount struct {
Id *SubaccountId `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
}
MsgClaimYieldForSubaccount is the Msg/ClaimYieldForSubaccount request type.
func (*MsgClaimYieldForSubaccount) Descriptor ¶
func (*MsgClaimYieldForSubaccount) Descriptor() ([]byte, []int)
func (*MsgClaimYieldForSubaccount) GetId ¶
func (m *MsgClaimYieldForSubaccount) GetId() *SubaccountId
func (*MsgClaimYieldForSubaccount) Marshal ¶
func (m *MsgClaimYieldForSubaccount) Marshal() (dAtA []byte, err error)
func (*MsgClaimYieldForSubaccount) MarshalTo ¶
func (m *MsgClaimYieldForSubaccount) MarshalTo(dAtA []byte) (int, error)
func (*MsgClaimYieldForSubaccount) MarshalToSizedBuffer ¶
func (m *MsgClaimYieldForSubaccount) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*MsgClaimYieldForSubaccount) ProtoMessage ¶
func (*MsgClaimYieldForSubaccount) ProtoMessage()
func (*MsgClaimYieldForSubaccount) Reset ¶
func (m *MsgClaimYieldForSubaccount) Reset()
func (*MsgClaimYieldForSubaccount) Size ¶
func (m *MsgClaimYieldForSubaccount) Size() (n int)
func (*MsgClaimYieldForSubaccount) String ¶
func (m *MsgClaimYieldForSubaccount) String() string
func (*MsgClaimYieldForSubaccount) Unmarshal ¶
func (m *MsgClaimYieldForSubaccount) Unmarshal(dAtA []byte) error
func (*MsgClaimYieldForSubaccount) ValidateBasic ¶
func (msg *MsgClaimYieldForSubaccount) ValidateBasic() error
ValidateBasic runs validation on the fields of a MsgClaimYieldForSubaccount.
func (*MsgClaimYieldForSubaccount) XXX_DiscardUnknown ¶
func (m *MsgClaimYieldForSubaccount) XXX_DiscardUnknown()
func (*MsgClaimYieldForSubaccount) XXX_Marshal ¶
func (m *MsgClaimYieldForSubaccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*MsgClaimYieldForSubaccount) XXX_Merge ¶
func (m *MsgClaimYieldForSubaccount) XXX_Merge(src proto.Message)
func (*MsgClaimYieldForSubaccount) XXX_Size ¶
func (m *MsgClaimYieldForSubaccount) XXX_Size() int
func (*MsgClaimYieldForSubaccount) XXX_Unmarshal ¶
func (m *MsgClaimYieldForSubaccount) XXX_Unmarshal(b []byte) error
type MsgClaimYieldForSubaccountResponse ¶
type MsgClaimYieldForSubaccountResponse struct { }
MsgClaimYieldForSubaccountResponse is the Msg/ClaimYieldForSubaccount response type.
func (*MsgClaimYieldForSubaccountResponse) Descriptor ¶
func (*MsgClaimYieldForSubaccountResponse) Descriptor() ([]byte, []int)
func (*MsgClaimYieldForSubaccountResponse) Marshal ¶
func (m *MsgClaimYieldForSubaccountResponse) Marshal() (dAtA []byte, err error)
func (*MsgClaimYieldForSubaccountResponse) MarshalTo ¶
func (m *MsgClaimYieldForSubaccountResponse) MarshalTo(dAtA []byte) (int, error)
func (*MsgClaimYieldForSubaccountResponse) MarshalToSizedBuffer ¶
func (m *MsgClaimYieldForSubaccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*MsgClaimYieldForSubaccountResponse) ProtoMessage ¶
func (*MsgClaimYieldForSubaccountResponse) ProtoMessage()
func (*MsgClaimYieldForSubaccountResponse) Reset ¶
func (m *MsgClaimYieldForSubaccountResponse) Reset()
func (*MsgClaimYieldForSubaccountResponse) Size ¶
func (m *MsgClaimYieldForSubaccountResponse) Size() (n int)
func (*MsgClaimYieldForSubaccountResponse) String ¶
func (m *MsgClaimYieldForSubaccountResponse) String() string
func (*MsgClaimYieldForSubaccountResponse) Unmarshal ¶
func (m *MsgClaimYieldForSubaccountResponse) Unmarshal(dAtA []byte) error
func (*MsgClaimYieldForSubaccountResponse) XXX_DiscardUnknown ¶
func (m *MsgClaimYieldForSubaccountResponse) XXX_DiscardUnknown()
func (*MsgClaimYieldForSubaccountResponse) XXX_Marshal ¶
func (m *MsgClaimYieldForSubaccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*MsgClaimYieldForSubaccountResponse) XXX_Merge ¶
func (m *MsgClaimYieldForSubaccountResponse) XXX_Merge(src proto.Message)
func (*MsgClaimYieldForSubaccountResponse) XXX_Size ¶
func (m *MsgClaimYieldForSubaccountResponse) XXX_Size() int
func (*MsgClaimYieldForSubaccountResponse) XXX_Unmarshal ¶
func (m *MsgClaimYieldForSubaccountResponse) XXX_Unmarshal(b []byte) error
type MsgClient ¶
type MsgClient interface { // ClaimYieldForSubaccount claims the yield for the provided subaccount and // persists it to state. ClaimYieldForSubaccount(ctx context.Context, in *MsgClaimYieldForSubaccount, opts ...grpc.CallOption) (*MsgClaimYieldForSubaccountResponse, error) }
MsgClient is the client API for Msg service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewMsgClient ¶
func NewMsgClient(cc grpc1.ClientConn) MsgClient
type MsgServer ¶
type MsgServer interface { // ClaimYieldForSubaccount claims the yield for the provided subaccount and // persists it to state. ClaimYieldForSubaccount(context.Context, *MsgClaimYieldForSubaccount) (*MsgClaimYieldForSubaccountResponse, error) }
MsgServer is the server API for Msg service.
type PerpetualPosition ¶
type PerpetualPosition struct { // The `Id` of the `Perpetual`. PerpetualId uint32 `protobuf:"varint,1,opt,name=perpetual_id,json=perpetualId,proto3" json:"perpetual_id,omitempty"` // The size of the position in base quantums. Quantums github_com_StreamFinance_Protocol_stream_chain_protocol_dtypes.SerializableInt `` /* 149-byte string literal not displayed */ // The funding_index of the `Perpetual` the last time this position was // settled. FundingIndex github_com_StreamFinance_Protocol_stream_chain_protocol_dtypes.SerializableInt `` /* 177-byte string literal not displayed */ // The current yield index last time this position was settled. // Should be converted from string to big.Rat. YieldIndex string `protobuf:"bytes,4,opt,name=yield_index,json=yieldIndex,proto3" json:"yield_index,omitempty"` }
PerpetualPositions are an account’s positions of a `Perpetual`. Therefore they hold any information needed to trade perpetuals.
func (*PerpetualPosition) Descriptor ¶
func (*PerpetualPosition) Descriptor() ([]byte, []int)
func (*PerpetualPosition) GetBigQuantums ¶
func (m *PerpetualPosition) GetBigQuantums() *big.Int
Get the perpetual position quantum size in big.Int. Panics if the size is zero.
func (*PerpetualPosition) GetId ¶
func (m *PerpetualPosition) GetId() uint32
func (*PerpetualPosition) GetIsLong ¶
func (m *PerpetualPosition) GetIsLong() bool
func (*PerpetualPosition) GetPerpetualId ¶
func (m *PerpetualPosition) GetPerpetualId() uint32
func (*PerpetualPosition) GetProductType ¶
func (m *PerpetualPosition) GetProductType() string
func (*PerpetualPosition) GetYieldIndex ¶
func (m *PerpetualPosition) GetYieldIndex() string
func (*PerpetualPosition) Marshal ¶
func (m *PerpetualPosition) Marshal() (dAtA []byte, err error)
func (*PerpetualPosition) MarshalTo ¶
func (m *PerpetualPosition) MarshalTo(dAtA []byte) (int, error)
func (*PerpetualPosition) MarshalToSizedBuffer ¶
func (m *PerpetualPosition) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*PerpetualPosition) ProtoMessage ¶
func (*PerpetualPosition) ProtoMessage()
func (*PerpetualPosition) Reset ¶
func (m *PerpetualPosition) Reset()
func (*PerpetualPosition) SetBigQuantums ¶
func (m *PerpetualPosition) SetBigQuantums(sizeQuantums *big.Int)
func (*PerpetualPosition) SetQuantums ¶
func (m *PerpetualPosition) SetQuantums(sizeQuantums int64)
func (*PerpetualPosition) Size ¶
func (m *PerpetualPosition) Size() (n int)
func (*PerpetualPosition) String ¶
func (m *PerpetualPosition) String() string
func (*PerpetualPosition) Unmarshal ¶
func (m *PerpetualPosition) Unmarshal(dAtA []byte) error
func (*PerpetualPosition) XXX_DiscardUnknown ¶
func (m *PerpetualPosition) XXX_DiscardUnknown()
func (*PerpetualPosition) XXX_Marshal ¶
func (m *PerpetualPosition) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*PerpetualPosition) XXX_Merge ¶
func (m *PerpetualPosition) XXX_Merge(src proto.Message)
func (*PerpetualPosition) XXX_Size ¶
func (m *PerpetualPosition) XXX_Size() int
func (*PerpetualPosition) XXX_Unmarshal ¶
func (m *PerpetualPosition) XXX_Unmarshal(b []byte) error
type PerpetualUpdate ¶
type PerpetualUpdate struct { // The `Id` of the `Perpetual` for which the `PerpetualPosition` is for. PerpetualId uint32 // The signed change in the `Quantums` of the `PerpetualPosition` // represented in base quantums. BigQuantumsDelta *big.Int }
func (PerpetualUpdate) GetBigQuantums ¶
func (pu PerpetualUpdate) GetBigQuantums() *big.Int
func (PerpetualUpdate) GetId ¶
func (pu PerpetualUpdate) GetId() uint32
func (PerpetualUpdate) GetIsLong ¶
func (pu PerpetualUpdate) GetIsLong() bool
func (PerpetualUpdate) GetProductType ¶
func (pu PerpetualUpdate) GetProductType() string
type PerpetualsKeeper ¶
type PerpetualsKeeper interface { ProductKeeper GetSettlementPpm( ctx sdk.Context, perpetualId uint32, quantums *big.Int, index *big.Int, ) ( bigNetSettlement *big.Int, newFundingIndex *big.Int, err error, ) GetPerpetual( ctx sdk.Context, perpetualId uint32, ) ( perpetual perptypes.Perpetual, err error, ) GetAllPerpetuals(ctx sdk.Context) []perptypes.Perpetual GetInsuranceFundName(ctx sdk.Context, perpetualId uint32) (string, error) GetInsuranceFundModuleAddress(ctx sdk.Context, perpetualId uint32) (sdk.AccAddress, error) ModifyOpenInterest(ctx sdk.Context, perpetualId uint32, bigQuantums *big.Int) error GetCollateralPool(ctx sdk.Context, id uint32) ( collateralPool perptypes.CollateralPool, err error, ) GetCollateralPoolFromPerpetualId(ctx sdk.Context, perpetualId uint32) ( collateralPool perptypes.CollateralPool, err error, ) GetQuoteCurrencyAtomicResolutionFromPerpetualId(ctx sdk.Context, perpetualId uint32) (int32, error) }
type PositionSize ¶
type PositionSize interface { // Returns true if and only if the position size is positive. GetIsLong() bool // Returns the signed position size in big.Int. GetBigQuantums() *big.Int GetId() uint32 GetProductType() string }
PositionSize is an interface for expressing the size of a position
type PositionStateTransition ¶
type PositionStateTransition uint
const ( Opened PositionStateTransition = iota Closed )
func (PositionStateTransition) String ¶
func (t PositionStateTransition) String() string
type PositionUpdate ¶
func NewPositionUpdate ¶
func NewPositionUpdate(id uint32) PositionUpdate
func (PositionUpdate) GetBigQuantums ¶
func (pu PositionUpdate) GetBigQuantums() *big.Int
func (PositionUpdate) GetId ¶
func (pu PositionUpdate) GetId() uint32
func (PositionUpdate) GetIsLong ¶
func (pu PositionUpdate) GetIsLong() bool
func (PositionUpdate) GetProductType ¶
func (pu PositionUpdate) GetProductType() string
func (PositionUpdate) SetBigQuantums ¶
func (pu PositionUpdate) SetBigQuantums(bigQuantums *big.Int)
type ProductKeeper ¶
type ProductKeeper interface { GetNetCollateral( ctx sdk.Context, id uint32, bigQuantums *big.Int, quoteCurrencyAtomicResolution int32, ) ( bigNetCollateralQuoteQuantums *big.Int, err error, ) GetMarginRequirements( ctx sdk.Context, id uint32, bigQuantums *big.Int, quoteCurrencyAtomicResolution int32, ) ( bigInitialMarginQuoteQuantums *big.Int, bigMaintenanceMarginQuoteQuantums *big.Int, err error, ) IsPositionUpdatable( ctx sdk.Context, id uint32, ) ( updatable bool, err error, ) }
ProductKeeper represents a generic interface for a keeper of a product.
type QueryAllSubaccountRequest ¶
type QueryAllSubaccountRequest struct {
Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
QueryAllSubaccountRequest is request type for the Query RPC method.
func (*QueryAllSubaccountRequest) Descriptor ¶
func (*QueryAllSubaccountRequest) Descriptor() ([]byte, []int)
func (*QueryAllSubaccountRequest) GetPagination ¶
func (m *QueryAllSubaccountRequest) GetPagination() *query.PageRequest
func (*QueryAllSubaccountRequest) Marshal ¶
func (m *QueryAllSubaccountRequest) Marshal() (dAtA []byte, err error)
func (*QueryAllSubaccountRequest) MarshalTo ¶
func (m *QueryAllSubaccountRequest) MarshalTo(dAtA []byte) (int, error)
func (*QueryAllSubaccountRequest) MarshalToSizedBuffer ¶
func (m *QueryAllSubaccountRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*QueryAllSubaccountRequest) ProtoMessage ¶
func (*QueryAllSubaccountRequest) ProtoMessage()
func (*QueryAllSubaccountRequest) Reset ¶
func (m *QueryAllSubaccountRequest) Reset()
func (*QueryAllSubaccountRequest) Size ¶
func (m *QueryAllSubaccountRequest) Size() (n int)
func (*QueryAllSubaccountRequest) String ¶
func (m *QueryAllSubaccountRequest) String() string
func (*QueryAllSubaccountRequest) Unmarshal ¶
func (m *QueryAllSubaccountRequest) Unmarshal(dAtA []byte) error
func (*QueryAllSubaccountRequest) XXX_DiscardUnknown ¶
func (m *QueryAllSubaccountRequest) XXX_DiscardUnknown()
func (*QueryAllSubaccountRequest) XXX_Marshal ¶
func (m *QueryAllSubaccountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*QueryAllSubaccountRequest) XXX_Merge ¶
func (m *QueryAllSubaccountRequest) XXX_Merge(src proto.Message)
func (*QueryAllSubaccountRequest) XXX_Size ¶
func (m *QueryAllSubaccountRequest) XXX_Size() int
func (*QueryAllSubaccountRequest) XXX_Unmarshal ¶
func (m *QueryAllSubaccountRequest) XXX_Unmarshal(b []byte) error
type QueryClient ¶
type QueryClient interface { // Queries a Subaccount by id Subaccount(ctx context.Context, in *QueryGetSubaccountRequest, opts ...grpc.CallOption) (*QuerySubaccountResponse, error) // Queries a list of Subaccount items. SubaccountAll(ctx context.Context, in *QueryAllSubaccountRequest, opts ...grpc.CallOption) (*QuerySubaccountAllResponse, error) // Queries information about whether withdrawal and transfers are blocked, and // if so which block they are re-enabled on. GetWithdrawalAndTransfersBlockedInfo(ctx context.Context, in *QueryGetWithdrawalAndTransfersBlockedInfoRequest, opts ...grpc.CallOption) (*QueryGetWithdrawalAndTransfersBlockedInfoResponse, error) // Queries the collateral pool account address for a perpetual id. CollateralPoolAddress(ctx context.Context, in *QueryCollateralPoolAddressRequest, opts ...grpc.CallOption) (*QueryCollateralPoolAddressResponse, error) }
QueryClient is the client API for Query service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewQueryClient ¶
func NewQueryClient(cc grpc1.ClientConn) QueryClient
type QueryCollateralPoolAddressRequest ¶
type QueryCollateralPoolAddressRequest struct {
PerpetualId uint32 `protobuf:"varint,1,opt,name=perpetual_id,json=perpetualId,proto3" json:"perpetual_id,omitempty"`
}
QueryCollateralPoolAddressRequest is the request type for fetching the account address of the collateral pool associated with the passed in perpetual id.
func (*QueryCollateralPoolAddressRequest) Descriptor ¶
func (*QueryCollateralPoolAddressRequest) Descriptor() ([]byte, []int)
func (*QueryCollateralPoolAddressRequest) GetPerpetualId ¶
func (m *QueryCollateralPoolAddressRequest) GetPerpetualId() uint32
func (*QueryCollateralPoolAddressRequest) Marshal ¶
func (m *QueryCollateralPoolAddressRequest) Marshal() (dAtA []byte, err error)
func (*QueryCollateralPoolAddressRequest) MarshalTo ¶
func (m *QueryCollateralPoolAddressRequest) MarshalTo(dAtA []byte) (int, error)
func (*QueryCollateralPoolAddressRequest) MarshalToSizedBuffer ¶
func (m *QueryCollateralPoolAddressRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*QueryCollateralPoolAddressRequest) ProtoMessage ¶
func (*QueryCollateralPoolAddressRequest) ProtoMessage()
func (*QueryCollateralPoolAddressRequest) Reset ¶
func (m *QueryCollateralPoolAddressRequest) Reset()
func (*QueryCollateralPoolAddressRequest) Size ¶
func (m *QueryCollateralPoolAddressRequest) Size() (n int)
func (*QueryCollateralPoolAddressRequest) String ¶
func (m *QueryCollateralPoolAddressRequest) String() string
func (*QueryCollateralPoolAddressRequest) Unmarshal ¶
func (m *QueryCollateralPoolAddressRequest) Unmarshal(dAtA []byte) error
func (*QueryCollateralPoolAddressRequest) XXX_DiscardUnknown ¶
func (m *QueryCollateralPoolAddressRequest) XXX_DiscardUnknown()
func (*QueryCollateralPoolAddressRequest) XXX_Marshal ¶
func (m *QueryCollateralPoolAddressRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*QueryCollateralPoolAddressRequest) XXX_Merge ¶
func (m *QueryCollateralPoolAddressRequest) XXX_Merge(src proto.Message)
func (*QueryCollateralPoolAddressRequest) XXX_Size ¶
func (m *QueryCollateralPoolAddressRequest) XXX_Size() int
func (*QueryCollateralPoolAddressRequest) XXX_Unmarshal ¶
func (m *QueryCollateralPoolAddressRequest) XXX_Unmarshal(b []byte) error
type QueryCollateralPoolAddressResponse ¶
type QueryCollateralPoolAddressResponse struct {
CollateralPoolAddress string `` /* 126-byte string literal not displayed */
}
QueryCollateralPoolAddressResponse is a response type for fetching the account address of the collateral pool associated with the passed in perpetual id.
func (*QueryCollateralPoolAddressResponse) Descriptor ¶
func (*QueryCollateralPoolAddressResponse) Descriptor() ([]byte, []int)
func (*QueryCollateralPoolAddressResponse) GetCollateralPoolAddress ¶
func (m *QueryCollateralPoolAddressResponse) GetCollateralPoolAddress() string
func (*QueryCollateralPoolAddressResponse) Marshal ¶
func (m *QueryCollateralPoolAddressResponse) Marshal() (dAtA []byte, err error)
func (*QueryCollateralPoolAddressResponse) MarshalTo ¶
func (m *QueryCollateralPoolAddressResponse) MarshalTo(dAtA []byte) (int, error)
func (*QueryCollateralPoolAddressResponse) MarshalToSizedBuffer ¶
func (m *QueryCollateralPoolAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*QueryCollateralPoolAddressResponse) ProtoMessage ¶
func (*QueryCollateralPoolAddressResponse) ProtoMessage()
func (*QueryCollateralPoolAddressResponse) Reset ¶
func (m *QueryCollateralPoolAddressResponse) Reset()
func (*QueryCollateralPoolAddressResponse) Size ¶
func (m *QueryCollateralPoolAddressResponse) Size() (n int)
func (*QueryCollateralPoolAddressResponse) String ¶
func (m *QueryCollateralPoolAddressResponse) String() string
func (*QueryCollateralPoolAddressResponse) Unmarshal ¶
func (m *QueryCollateralPoolAddressResponse) Unmarshal(dAtA []byte) error
func (*QueryCollateralPoolAddressResponse) XXX_DiscardUnknown ¶
func (m *QueryCollateralPoolAddressResponse) XXX_DiscardUnknown()
func (*QueryCollateralPoolAddressResponse) XXX_Marshal ¶
func (m *QueryCollateralPoolAddressResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*QueryCollateralPoolAddressResponse) XXX_Merge ¶
func (m *QueryCollateralPoolAddressResponse) XXX_Merge(src proto.Message)
func (*QueryCollateralPoolAddressResponse) XXX_Size ¶
func (m *QueryCollateralPoolAddressResponse) XXX_Size() int
func (*QueryCollateralPoolAddressResponse) XXX_Unmarshal ¶
func (m *QueryCollateralPoolAddressResponse) XXX_Unmarshal(b []byte) error
type QueryGetSubaccountRequest ¶
type QueryGetSubaccountRequest struct { Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` Number uint32 `protobuf:"varint,2,opt,name=number,proto3" json:"number,omitempty"` }
QueryGetSubaccountRequest is request type for the Query RPC method.
func (*QueryGetSubaccountRequest) Descriptor ¶
func (*QueryGetSubaccountRequest) Descriptor() ([]byte, []int)
func (*QueryGetSubaccountRequest) GetNumber ¶
func (m *QueryGetSubaccountRequest) GetNumber() uint32
func (*QueryGetSubaccountRequest) GetOwner ¶
func (m *QueryGetSubaccountRequest) GetOwner() string
func (*QueryGetSubaccountRequest) Marshal ¶
func (m *QueryGetSubaccountRequest) Marshal() (dAtA []byte, err error)
func (*QueryGetSubaccountRequest) MarshalTo ¶
func (m *QueryGetSubaccountRequest) MarshalTo(dAtA []byte) (int, error)
func (*QueryGetSubaccountRequest) MarshalToSizedBuffer ¶
func (m *QueryGetSubaccountRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*QueryGetSubaccountRequest) ProtoMessage ¶
func (*QueryGetSubaccountRequest) ProtoMessage()
func (*QueryGetSubaccountRequest) Reset ¶
func (m *QueryGetSubaccountRequest) Reset()
func (*QueryGetSubaccountRequest) Size ¶
func (m *QueryGetSubaccountRequest) Size() (n int)
func (*QueryGetSubaccountRequest) String ¶
func (m *QueryGetSubaccountRequest) String() string
func (*QueryGetSubaccountRequest) Unmarshal ¶
func (m *QueryGetSubaccountRequest) Unmarshal(dAtA []byte) error
func (*QueryGetSubaccountRequest) XXX_DiscardUnknown ¶
func (m *QueryGetSubaccountRequest) XXX_DiscardUnknown()
func (*QueryGetSubaccountRequest) XXX_Marshal ¶
func (m *QueryGetSubaccountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*QueryGetSubaccountRequest) XXX_Merge ¶
func (m *QueryGetSubaccountRequest) XXX_Merge(src proto.Message)
func (*QueryGetSubaccountRequest) XXX_Size ¶
func (m *QueryGetSubaccountRequest) XXX_Size() int
func (*QueryGetSubaccountRequest) XXX_Unmarshal ¶
func (m *QueryGetSubaccountRequest) XXX_Unmarshal(b []byte) error
type QueryGetWithdrawalAndTransfersBlockedInfoRequest ¶
type QueryGetWithdrawalAndTransfersBlockedInfoRequest struct {
PerpetualId uint32 `protobuf:"varint,1,opt,name=perpetual_id,json=perpetualId,proto3" json:"perpetual_id,omitempty"`
}
QueryGetWithdrawalAndTransfersBlockedInfoRequest is a request type for fetching information about whether withdrawals and transfers are blocked for a collateral pool associated with the passed in perpetual id.
func (*QueryGetWithdrawalAndTransfersBlockedInfoRequest) Descriptor ¶
func (*QueryGetWithdrawalAndTransfersBlockedInfoRequest) Descriptor() ([]byte, []int)
func (*QueryGetWithdrawalAndTransfersBlockedInfoRequest) GetPerpetualId ¶
func (m *QueryGetWithdrawalAndTransfersBlockedInfoRequest) GetPerpetualId() uint32
func (*QueryGetWithdrawalAndTransfersBlockedInfoRequest) Marshal ¶
func (m *QueryGetWithdrawalAndTransfersBlockedInfoRequest) Marshal() (dAtA []byte, err error)
func (*QueryGetWithdrawalAndTransfersBlockedInfoRequest) MarshalTo ¶
func (m *QueryGetWithdrawalAndTransfersBlockedInfoRequest) MarshalTo(dAtA []byte) (int, error)
func (*QueryGetWithdrawalAndTransfersBlockedInfoRequest) MarshalToSizedBuffer ¶
func (m *QueryGetWithdrawalAndTransfersBlockedInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*QueryGetWithdrawalAndTransfersBlockedInfoRequest) ProtoMessage ¶
func (*QueryGetWithdrawalAndTransfersBlockedInfoRequest) ProtoMessage()
func (*QueryGetWithdrawalAndTransfersBlockedInfoRequest) Reset ¶
func (m *QueryGetWithdrawalAndTransfersBlockedInfoRequest) Reset()
func (*QueryGetWithdrawalAndTransfersBlockedInfoRequest) Size ¶
func (m *QueryGetWithdrawalAndTransfersBlockedInfoRequest) Size() (n int)
func (*QueryGetWithdrawalAndTransfersBlockedInfoRequest) String ¶
func (m *QueryGetWithdrawalAndTransfersBlockedInfoRequest) String() string
func (*QueryGetWithdrawalAndTransfersBlockedInfoRequest) Unmarshal ¶
func (m *QueryGetWithdrawalAndTransfersBlockedInfoRequest) Unmarshal(dAtA []byte) error
func (*QueryGetWithdrawalAndTransfersBlockedInfoRequest) XXX_DiscardUnknown ¶
func (m *QueryGetWithdrawalAndTransfersBlockedInfoRequest) XXX_DiscardUnknown()
func (*QueryGetWithdrawalAndTransfersBlockedInfoRequest) XXX_Marshal ¶
func (m *QueryGetWithdrawalAndTransfersBlockedInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*QueryGetWithdrawalAndTransfersBlockedInfoRequest) XXX_Merge ¶
func (m *QueryGetWithdrawalAndTransfersBlockedInfoRequest) XXX_Merge(src proto.Message)
func (*QueryGetWithdrawalAndTransfersBlockedInfoRequest) XXX_Size ¶
func (m *QueryGetWithdrawalAndTransfersBlockedInfoRequest) XXX_Size() int
func (*QueryGetWithdrawalAndTransfersBlockedInfoRequest) XXX_Unmarshal ¶
func (m *QueryGetWithdrawalAndTransfersBlockedInfoRequest) XXX_Unmarshal(b []byte) error
type QueryGetWithdrawalAndTransfersBlockedInfoResponse ¶
type QueryGetWithdrawalAndTransfersBlockedInfoResponse struct { NegativeTncSubaccountSeenAtBlock uint32 `` /* 166-byte string literal not displayed */ ChainOutageSeenAtBlock uint32 `` /* 134-byte string literal not displayed */ WithdrawalsAndTransfersUnblockedAtBlock uint32 `` /* 187-byte string literal not displayed */ }
QueryGetWithdrawalAndTransfersBlockedInfoRequest is a response type for fetching information about whether withdrawals and transfers are blocked.
func (*QueryGetWithdrawalAndTransfersBlockedInfoResponse) Descriptor ¶
func (*QueryGetWithdrawalAndTransfersBlockedInfoResponse) Descriptor() ([]byte, []int)
func (*QueryGetWithdrawalAndTransfersBlockedInfoResponse) GetChainOutageSeenAtBlock ¶
func (m *QueryGetWithdrawalAndTransfersBlockedInfoResponse) GetChainOutageSeenAtBlock() uint32
func (*QueryGetWithdrawalAndTransfersBlockedInfoResponse) GetNegativeTncSubaccountSeenAtBlock ¶
func (m *QueryGetWithdrawalAndTransfersBlockedInfoResponse) GetNegativeTncSubaccountSeenAtBlock() uint32
func (*QueryGetWithdrawalAndTransfersBlockedInfoResponse) GetWithdrawalsAndTransfersUnblockedAtBlock ¶
func (m *QueryGetWithdrawalAndTransfersBlockedInfoResponse) GetWithdrawalsAndTransfersUnblockedAtBlock() uint32
func (*QueryGetWithdrawalAndTransfersBlockedInfoResponse) Marshal ¶
func (m *QueryGetWithdrawalAndTransfersBlockedInfoResponse) Marshal() (dAtA []byte, err error)
func (*QueryGetWithdrawalAndTransfersBlockedInfoResponse) MarshalTo ¶
func (m *QueryGetWithdrawalAndTransfersBlockedInfoResponse) MarshalTo(dAtA []byte) (int, error)
func (*QueryGetWithdrawalAndTransfersBlockedInfoResponse) MarshalToSizedBuffer ¶
func (m *QueryGetWithdrawalAndTransfersBlockedInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*QueryGetWithdrawalAndTransfersBlockedInfoResponse) ProtoMessage ¶
func (*QueryGetWithdrawalAndTransfersBlockedInfoResponse) ProtoMessage()
func (*QueryGetWithdrawalAndTransfersBlockedInfoResponse) Reset ¶
func (m *QueryGetWithdrawalAndTransfersBlockedInfoResponse) Reset()
func (*QueryGetWithdrawalAndTransfersBlockedInfoResponse) Size ¶
func (m *QueryGetWithdrawalAndTransfersBlockedInfoResponse) Size() (n int)
func (*QueryGetWithdrawalAndTransfersBlockedInfoResponse) String ¶
func (m *QueryGetWithdrawalAndTransfersBlockedInfoResponse) String() string
func (*QueryGetWithdrawalAndTransfersBlockedInfoResponse) Unmarshal ¶
func (m *QueryGetWithdrawalAndTransfersBlockedInfoResponse) Unmarshal(dAtA []byte) error
func (*QueryGetWithdrawalAndTransfersBlockedInfoResponse) XXX_DiscardUnknown ¶
func (m *QueryGetWithdrawalAndTransfersBlockedInfoResponse) XXX_DiscardUnknown()
func (*QueryGetWithdrawalAndTransfersBlockedInfoResponse) XXX_Marshal ¶
func (m *QueryGetWithdrawalAndTransfersBlockedInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*QueryGetWithdrawalAndTransfersBlockedInfoResponse) XXX_Merge ¶
func (m *QueryGetWithdrawalAndTransfersBlockedInfoResponse) XXX_Merge(src proto.Message)
func (*QueryGetWithdrawalAndTransfersBlockedInfoResponse) XXX_Size ¶
func (m *QueryGetWithdrawalAndTransfersBlockedInfoResponse) XXX_Size() int
func (*QueryGetWithdrawalAndTransfersBlockedInfoResponse) XXX_Unmarshal ¶
func (m *QueryGetWithdrawalAndTransfersBlockedInfoResponse) XXX_Unmarshal(b []byte) error
type QueryServer ¶
type QueryServer interface { // Queries a Subaccount by id Subaccount(context.Context, *QueryGetSubaccountRequest) (*QuerySubaccountResponse, error) // Queries a list of Subaccount items. SubaccountAll(context.Context, *QueryAllSubaccountRequest) (*QuerySubaccountAllResponse, error) // Queries information about whether withdrawal and transfers are blocked, and // if so which block they are re-enabled on. GetWithdrawalAndTransfersBlockedInfo(context.Context, *QueryGetWithdrawalAndTransfersBlockedInfoRequest) (*QueryGetWithdrawalAndTransfersBlockedInfoResponse, error) // Queries the collateral pool account address for a perpetual id. CollateralPoolAddress(context.Context, *QueryCollateralPoolAddressRequest) (*QueryCollateralPoolAddressResponse, error) }
QueryServer is the server API for Query service.
type QuerySubaccountAllResponse ¶
type QuerySubaccountAllResponse struct { Subaccount []Subaccount `protobuf:"bytes,1,rep,name=subaccount,proto3" json:"subaccount"` Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` }
QuerySubaccountAllResponse is response type for the Query RPC method.
func (*QuerySubaccountAllResponse) Descriptor ¶
func (*QuerySubaccountAllResponse) Descriptor() ([]byte, []int)
func (*QuerySubaccountAllResponse) GetPagination ¶
func (m *QuerySubaccountAllResponse) GetPagination() *query.PageResponse
func (*QuerySubaccountAllResponse) GetSubaccount ¶
func (m *QuerySubaccountAllResponse) GetSubaccount() []Subaccount
func (*QuerySubaccountAllResponse) Marshal ¶
func (m *QuerySubaccountAllResponse) Marshal() (dAtA []byte, err error)
func (*QuerySubaccountAllResponse) MarshalTo ¶
func (m *QuerySubaccountAllResponse) MarshalTo(dAtA []byte) (int, error)
func (*QuerySubaccountAllResponse) MarshalToSizedBuffer ¶
func (m *QuerySubaccountAllResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*QuerySubaccountAllResponse) ProtoMessage ¶
func (*QuerySubaccountAllResponse) ProtoMessage()
func (*QuerySubaccountAllResponse) Reset ¶
func (m *QuerySubaccountAllResponse) Reset()
func (*QuerySubaccountAllResponse) Size ¶
func (m *QuerySubaccountAllResponse) Size() (n int)
func (*QuerySubaccountAllResponse) String ¶
func (m *QuerySubaccountAllResponse) String() string
func (*QuerySubaccountAllResponse) Unmarshal ¶
func (m *QuerySubaccountAllResponse) Unmarshal(dAtA []byte) error
func (*QuerySubaccountAllResponse) XXX_DiscardUnknown ¶
func (m *QuerySubaccountAllResponse) XXX_DiscardUnknown()
func (*QuerySubaccountAllResponse) XXX_Marshal ¶
func (m *QuerySubaccountAllResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*QuerySubaccountAllResponse) XXX_Merge ¶
func (m *QuerySubaccountAllResponse) XXX_Merge(src proto.Message)
func (*QuerySubaccountAllResponse) XXX_Size ¶
func (m *QuerySubaccountAllResponse) XXX_Size() int
func (*QuerySubaccountAllResponse) XXX_Unmarshal ¶
func (m *QuerySubaccountAllResponse) XXX_Unmarshal(b []byte) error
type QuerySubaccountResponse ¶
type QuerySubaccountResponse struct {
Subaccount Subaccount `protobuf:"bytes,1,opt,name=subaccount,proto3" json:"subaccount"`
}
QuerySubaccountResponse is response type for the Query RPC method.
func (*QuerySubaccountResponse) Descriptor ¶
func (*QuerySubaccountResponse) Descriptor() ([]byte, []int)
func (*QuerySubaccountResponse) GetSubaccount ¶
func (m *QuerySubaccountResponse) GetSubaccount() Subaccount
func (*QuerySubaccountResponse) Marshal ¶
func (m *QuerySubaccountResponse) Marshal() (dAtA []byte, err error)
func (*QuerySubaccountResponse) MarshalTo ¶
func (m *QuerySubaccountResponse) MarshalTo(dAtA []byte) (int, error)
func (*QuerySubaccountResponse) MarshalToSizedBuffer ¶
func (m *QuerySubaccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*QuerySubaccountResponse) ProtoMessage ¶
func (*QuerySubaccountResponse) ProtoMessage()
func (*QuerySubaccountResponse) Reset ¶
func (m *QuerySubaccountResponse) Reset()
func (*QuerySubaccountResponse) Size ¶
func (m *QuerySubaccountResponse) Size() (n int)
func (*QuerySubaccountResponse) String ¶
func (m *QuerySubaccountResponse) String() string
func (*QuerySubaccountResponse) Unmarshal ¶
func (m *QuerySubaccountResponse) Unmarshal(dAtA []byte) error
func (*QuerySubaccountResponse) XXX_DiscardUnknown ¶
func (m *QuerySubaccountResponse) XXX_DiscardUnknown()
func (*QuerySubaccountResponse) XXX_Marshal ¶
func (m *QuerySubaccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*QuerySubaccountResponse) XXX_Merge ¶
func (m *QuerySubaccountResponse) XXX_Merge(src proto.Message)
func (*QuerySubaccountResponse) XXX_Size ¶
func (m *QuerySubaccountResponse) XXX_Size() int
func (*QuerySubaccountResponse) XXX_Unmarshal ¶
func (m *QuerySubaccountResponse) XXX_Unmarshal(b []byte) error
type RatelimitKeeper ¶
type SortedSubaccountIds ¶
type SortedSubaccountIds []SubaccountId
SortedSubaccountIds is type alias for `[]SubaccountId` which supports deterministic sorting. SubaccountIds are first ordered by string comparison of their `Owner`, followed by integer comparison of their `Number`. If two `SubaccountId` have equal Owners, and Numbers, they are assumed to be equal, and their sorted order is not deterministic.
func (SortedSubaccountIds) Len ¶
func (s SortedSubaccountIds) Len() int
func (SortedSubaccountIds) Less ¶
func (s SortedSubaccountIds) Less(i, j int) bool
func (SortedSubaccountIds) Swap ¶
func (s SortedSubaccountIds) Swap(i, j int)
type Subaccount ¶
type Subaccount struct { // The Id of the Subaccount Id *SubaccountId `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // All `AssetPosition`s associated with this subaccount. // Always sorted ascending by `asset_id`. AssetPositions []*AssetPosition `protobuf:"bytes,2,rep,name=asset_positions,json=assetPositions,proto3" json:"asset_positions,omitempty"` // All `PerpetualPosition`s associated with this subaccount. // Always sorted ascending by `perpetual_id. PerpetualPositions []*PerpetualPosition `protobuf:"bytes,3,rep,name=perpetual_positions,json=perpetualPositions,proto3" json:"perpetual_positions,omitempty"` // Set by the owner. If true, then margin trades can be made in this // subaccount. MarginEnabled bool `protobuf:"varint,4,opt,name=margin_enabled,json=marginEnabled,proto3" json:"margin_enabled,omitempty"` // The current yield index is determined by the cumulative // all-time history of the yield mechanism for assets. // Starts at 0. This string should always be converted big.Rat. AssetYieldIndex string `protobuf:"bytes,5,opt,name=asset_yield_index,json=assetYieldIndex,proto3" json:"asset_yield_index,omitempty"` }
Subaccount defines a single sub-account for a given address. Subaccounts are uniquely indexed by a subaccountNumber/owner pair.
func (*Subaccount) Descriptor ¶
func (*Subaccount) Descriptor() ([]byte, []int)
func (*Subaccount) GetAssetPosition ¶
func (m *Subaccount) GetAssetPosition(assetId uint32) *big.Int
func (*Subaccount) GetAssetPositions ¶
func (m *Subaccount) GetAssetPositions() []*AssetPosition
func (*Subaccount) GetAssetYieldIndex ¶
func (m *Subaccount) GetAssetYieldIndex() string
func (*Subaccount) GetId ¶
func (m *Subaccount) GetId() *SubaccountId
func (*Subaccount) GetMarginEnabled ¶
func (m *Subaccount) GetMarginEnabled() bool
func (*Subaccount) GetPerpetualPositionForId ¶
func (m *Subaccount) GetPerpetualPositionForId( perpetualId uint32, ) ( perpetualPosition *PerpetualPosition, exists bool, )
GetPerpetualPositionForId returns the perpetual position with the given perpetual id. Returns nil if subaccount does not have an open position for the perpetual.
func (*Subaccount) GetPerpetualPositions ¶
func (m *Subaccount) GetPerpetualPositions() []*PerpetualPosition
func (*Subaccount) GetTDaiPosition ¶
func (m *Subaccount) GetTDaiPosition() *big.Int
GetTDaiPosition returns the balance of the TDAI asset position.
func (*Subaccount) Marshal ¶
func (m *Subaccount) Marshal() (dAtA []byte, err error)
func (*Subaccount) MarshalToSizedBuffer ¶
func (m *Subaccount) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*Subaccount) ProtoMessage ¶
func (*Subaccount) ProtoMessage()
func (*Subaccount) Reset ¶
func (m *Subaccount) Reset()
func (*Subaccount) SetAssetPosition ¶
func (m *Subaccount) SetAssetPosition(newAssetPosition *big.Int, assetId uint32)
func (*Subaccount) SetTDaiAssetPosition ¶
func (m *Subaccount) SetTDaiAssetPosition(newTDaiPosition *big.Int)
SetTDaiAssetPosition sets the balance of the TDai asset position to `newTDaiPosition`.
func (*Subaccount) Size ¶
func (m *Subaccount) Size() (n int)
func (*Subaccount) String ¶
func (m *Subaccount) String() string
func (*Subaccount) Unmarshal ¶
func (m *Subaccount) Unmarshal(dAtA []byte) error
func (*Subaccount) XXX_DiscardUnknown ¶
func (m *Subaccount) XXX_DiscardUnknown()
func (*Subaccount) XXX_Marshal ¶
func (m *Subaccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*Subaccount) XXX_Merge ¶
func (m *Subaccount) XXX_Merge(src proto.Message)
func (*Subaccount) XXX_Size ¶
func (m *Subaccount) XXX_Size() int
func (*Subaccount) XXX_Unmarshal ¶
func (m *Subaccount) XXX_Unmarshal(b []byte) error
type SubaccountId ¶
type SubaccountId struct { // The address of the wallet that owns this subaccount. Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` // The unique number of this subaccount for the owner. // Currently limited to 128*1000 subaccounts per owner. Number uint32 `protobuf:"varint,2,opt,name=number,proto3" json:"number,omitempty"` }
SubaccountId defines a unique identifier for a Subaccount.
func (*SubaccountId) Descriptor ¶
func (*SubaccountId) Descriptor() ([]byte, []int)
func (*SubaccountId) GetNumber ¶
func (m *SubaccountId) GetNumber() uint32
func (*SubaccountId) GetOwner ¶
func (m *SubaccountId) GetOwner() string
func (*SubaccountId) Marshal ¶
func (m *SubaccountId) Marshal() (dAtA []byte, err error)
func (*SubaccountId) MarshalToSizedBuffer ¶
func (m *SubaccountId) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*SubaccountId) MustGetAccAddress ¶
func (m *SubaccountId) MustGetAccAddress() sdk.AccAddress
func (*SubaccountId) ProtoMessage ¶
func (*SubaccountId) ProtoMessage()
func (*SubaccountId) Reset ¶
func (m *SubaccountId) Reset()
func (*SubaccountId) Size ¶
func (m *SubaccountId) Size() (n int)
func (*SubaccountId) String ¶
func (m *SubaccountId) String() string
func (*SubaccountId) ToStateKey ¶
func (id *SubaccountId) ToStateKey() []byte
ToStateKey returns a bytes representation of a SubaccountId for use as a state key. The key uses the proto marshaling of the object such that it can be unmarshalled in the same way if it needs to be.
func (*SubaccountId) Unmarshal ¶
func (m *SubaccountId) Unmarshal(dAtA []byte) error
func (*SubaccountId) Validate ¶
func (m *SubaccountId) Validate() error
func (*SubaccountId) XXX_DiscardUnknown ¶
func (m *SubaccountId) XXX_DiscardUnknown()
func (*SubaccountId) XXX_Marshal ¶
func (m *SubaccountId) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*SubaccountId) XXX_Merge ¶
func (m *SubaccountId) XXX_Merge(src proto.Message)
func (*SubaccountId) XXX_Size ¶
func (m *SubaccountId) XXX_Size() int
func (*SubaccountId) XXX_Unmarshal ¶
func (m *SubaccountId) XXX_Unmarshal(b []byte) error
type SubaccountsKeeper ¶
type SubaccountsKeeper interface { GetAllSubaccount(ctx sdk.Context) (list []Subaccount) GetRandomSubaccount(ctx sdk.Context, rand *rand.Rand) (Subaccount, error) GetNetCollateralAndMarginRequirements( ctx sdk.Context, update Update, ) ( bigNetCollateral *big.Int, bigInitialMargin *big.Int, bigMaintenanceMargin *big.Int, err error, ) CanUpdateSubaccounts( ctx sdk.Context, updates []Update, updateType UpdateType, ) ( success bool, successPerUpdate []UpdateResult, err error, ) UpdateSubaccounts( ctx sdk.Context, updates []Update, updateType UpdateType, ) ( success bool, successPerUpdate []UpdateResult, err error, ) DepositFundsFromAccountToSubaccount( ctx sdk.Context, fromAccount sdk.AccAddress, toSubaccountId SubaccountId, assetId uint32, amount *big.Int, ) (err error) WithdrawFundsFromSubaccountToAccount( ctx sdk.Context, fromSubaccountId SubaccountId, toAccount sdk.AccAddress, assetId uint32, amount *big.Int, ) (err error) TransferFundsFromSubaccountToSubaccount( ctx sdk.Context, senderSubaccountId SubaccountId, recipientSubaccountId SubaccountId, assetId uint32, quantums *big.Int, ) (err error) SetSubaccount(ctx sdk.Context, subaccount Subaccount) GetSubaccount( ctx sdk.Context, id SubaccountId, ) (val Subaccount) GetNegativeTncSubaccountSeenAtBlock( ctx sdk.Context, perpetualId uint32, ) (uint32, bool, error) SetNegativeTncSubaccountSeenAtBlock( ctx sdk.Context, perpetualId uint32, blockHeight uint32, ) error }
type UnimplementedMsgServer ¶
type UnimplementedMsgServer struct { }
UnimplementedMsgServer can be embedded to have forward compatible implementations.
func (*UnimplementedMsgServer) ClaimYieldForSubaccount ¶
func (*UnimplementedMsgServer) ClaimYieldForSubaccount(ctx context.Context, req *MsgClaimYieldForSubaccount) (*MsgClaimYieldForSubaccountResponse, error)
type UnimplementedQueryServer ¶
type UnimplementedQueryServer struct { }
UnimplementedQueryServer can be embedded to have forward compatible implementations.
func (*UnimplementedQueryServer) CollateralPoolAddress ¶
func (*UnimplementedQueryServer) CollateralPoolAddress(ctx context.Context, req *QueryCollateralPoolAddressRequest) (*QueryCollateralPoolAddressResponse, error)
func (*UnimplementedQueryServer) GetWithdrawalAndTransfersBlockedInfo ¶
func (*UnimplementedQueryServer) GetWithdrawalAndTransfersBlockedInfo(ctx context.Context, req *QueryGetWithdrawalAndTransfersBlockedInfoRequest) (*QueryGetWithdrawalAndTransfersBlockedInfoResponse, error)
func (*UnimplementedQueryServer) Subaccount ¶
func (*UnimplementedQueryServer) Subaccount(ctx context.Context, req *QueryGetSubaccountRequest) (*QuerySubaccountResponse, error)
func (*UnimplementedQueryServer) SubaccountAll ¶
func (*UnimplementedQueryServer) SubaccountAll(ctx context.Context, req *QueryAllSubaccountRequest) (*QuerySubaccountAllResponse, error)
type Update ¶
type Update struct { // The `Id` of the `Subaccount` for which this update applies. SubaccountId SubaccountId // A list of changes to make to any `AssetPositions` in the `Subaccount`. AssetUpdates []AssetUpdate // A list of changes to make to any `PerpetualPositions` in the `Subaccount`. PerpetualUpdates []PerpetualUpdate }
Update is used by the subaccounts keeper to allow other modules to specify changes to one or more `Subaccounts` (for example the result of a trade, transfer, etc)
type UpdateResult ¶
type UpdateResult uint
const ( Success UpdateResult = iota NewlyUndercollateralized StillUndercollateralized WithdrawalsAndTransfersBlocked UpdateCausedError ViolatesCollateralPoolConstraints ViolatesMultiCollateralConstraints )
func (UpdateResult) IsCollateralPoolError ¶
func (u UpdateResult) IsCollateralPoolError() bool
func (UpdateResult) IsMultiCollateralError ¶
func (u UpdateResult) IsMultiCollateralError() bool
func (UpdateResult) IsSuccess ¶
func (u UpdateResult) IsSuccess() bool
IsSuccess returns true if the `UpdateResult` value is `Success`.
func (UpdateResult) String ¶
func (u UpdateResult) String() string
type UpdateType ¶
type UpdateType uint
const ( UpdateTypeUnspecified UpdateType = iota Withdrawal Transfer Deposit Match CollatCheck )
func (UpdateType) String ¶
func (u UpdateType) String() string
Source Files
¶
- addresses.go
- asset_position.pb.go
- codec.go
- collateral_pool_state_transition.go
- errors.go
- events.go
- expected_keepers.go
- genesis.go
- genesis.pb.go
- keys.go
- message_claim_yield_for_subaccount.go
- perpetual_position.pb.go
- position_size.go
- query.pb.go
- query.pb.gw.go
- subaccount.go
- subaccount.pb.go
- subaccount_id.go
- tx.pb.go
- types.go
- update.go