Documentation ¶
Index ¶
- Constants
- Variables
- func GetRequestKey(channelId []byte, simplexReceiver string) []byte
- func GetSubscriptionKey(ethAddress string) []byte
- func RegisterCodec(cdc *codec.Codec)
- type ChanStatus
- type GuardProof
- type GuardTrigger
- type InitRequest
- type MsgRequestGuard
- type Params
- type QueryEpochParams
- type QueryRequestParams
- type QuerySubscriptionParams
- type Request
- type Subscription
Constants ¶
View Source
const ( // module name ModuleName = "guard" // StoreKey to be used when creating the KVStore StoreKey = ModuleName )
View Source
const ( // Default number of guards for guarding request DefaultRequestGuardCount uint64 = 3 // Default minimal channel dispute timeout in mainchain blocks DefaultMinDisputeTimeout uint64 = 80000 )
guard params default values
View Source
const ( QuerySubscription = "subscription" QueryRequest = "request" QueryEpoch = "epoch" QueryParameters = "parameters" )
View Source
const RouterKey = ModuleName // this was defined in your key.go file
Variables ¶
View Source
var ( SubscriptionKeyPrefix = []byte{0x01} // Key prefix for subscription RequestKeyPrefix = []byte{0x21} // Key prefix for request )
View Source
var ( KeyRequestGuardCount = []byte("RequestGuardCount") KeyRequestCost = []byte("RequestCost") KeyMinDisputeTimeout = []byte("MinDisputeTimeout") )
nolint - Keys for parameter access
View Source
var ( // Default cost per request DefaultRequestCost = sdk.NewInt(1000000000000000000) )
View Source
var ModuleCdc = codec.New()
Functions ¶
func GetRequestKey ¶
get request key from channelID
func GetSubscriptionKey ¶
get guardian key from eth address
func RegisterCodec ¶
RegisterCodec registers concrete types on the Amino codec
Types ¶
type ChanStatus ¶
type ChanStatus uint8
const ( // state of simplex channel guard request ChanStatus_Idle ChanStatus = 0 ChanStatus_Withdrawing ChanStatus = 1 ChanStatus_Settling ChanStatus = 2 ChanStatus_Settled ChanStatus = 3 )
func (ChanStatus) String ¶
func (status ChanStatus) String() string
type GuardProof ¶
type GuardProof struct { ChannelId []byte `json:"channel_id"` SimplexReceiver string `json:"simplex_receiver"` GuardTxHash string `json:"guard_tx_hash"` GuardTxBlkNum uint64 `json:"guard_tx_blk_num"` GuardSender string `json:"guard_sender"` Status ChanStatus `json:"status"` }
func NewGuardProof ¶
func (GuardProof) String ¶
func (gp GuardProof) String() string
type GuardTrigger ¶
type GuardTrigger struct { ChannelId []byte `json:"channel_id"` SimplexReceiver string `json:"simplex_receiver"` TriggerTxHash string `json:"trigger_tx_hash"` TriggerTxBlkNum uint64 `json:"trigger_tx_blk_num"` TriggerSeqNum uint64 `json:"trigger_seq_num"` Status ChanStatus `json:"status"` }
func NewGuardTrigger ¶
func NewGuardTrigger( channelId mainchain.CidType, simplexReceiver mainchain.Addr, triggerTxHash mainchain.HashType, triggerTxBlkNum uint64, triggerSeqNum uint64, status ChanStatus) *GuardTrigger
func (GuardTrigger) String ¶
func (gt GuardTrigger) String() string
type InitRequest ¶
type InitRequest struct { SignedSimplexStateBytes []byte `json:"signed_simplex_state_bytes"` SimplexReceiverSig []byte `json:"simplex_receiver_sig"` DisputeTimeout uint64 `json:"dispute_timeout"` }
func NewInitRequest ¶
func NewInitRequest(signedSimplexStateBytes, simplexReceiverSig []byte, disputeTimeout uint64) *InitRequest
type MsgRequestGuard ¶
type MsgRequestGuard struct { SignedSimplexStateBytes []byte `json:"signed_simplex_state_bytes"` SimplexReceiverSig []byte `json:"simplex_receiver_sig"` Sender sdk.AccAddress `json:"sender"` }
func NewMsgRequestGuard ¶
func NewMsgRequestGuard(signedSimplexStateBytes, simplexReceiverSig []byte, sender sdk.AccAddress) MsgRequestGuard
NewMsgRequestGuard is a constructor function for MsgRequestGuard
func (MsgRequestGuard) GetSignBytes ¶
func (msg MsgRequestGuard) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgRequestGuard) GetSigners ¶
func (msg MsgRequestGuard) GetSigners() []sdk.AccAddress
GetSigners defines whose signature is required
func (MsgRequestGuard) Route ¶
func (msg MsgRequestGuard) Route() string
Route should return the name of the module
func (MsgRequestGuard) Type ¶
func (msg MsgRequestGuard) Type() string
Type should return the action
func (MsgRequestGuard) ValidateBasic ¶
func (msg MsgRequestGuard) ValidateBasic() error
ValidateBasic runs stateless checks on the message
type Params ¶
type Params struct { RequestGuardCount uint64 `json:"request_guard_count" yaml:"request_guard_count"` // request guard count RequestCost sdk.Int `json:"request_cost" yaml:"request_cost"` // request cost MinDisputeTimeout uint64 `json:"min_dispute_timeout" yaml:"min_dispute_timeout"` // minimal channel dispute timeout in mainchain blocks }
Params defines the high level settings for guard
func MustUnmarshalParams ¶
unmarshal the current guard params value from store key or panic
func UnmarshalParams ¶
unmarshal the current guard params value from store key
func (*Params) ParamSetPairs ¶
func (p *Params) ParamSetPairs() params.ParamSetPairs
Implements params.ParamSet
type QueryEpochParams ¶
type QueryEpochParams struct {
EpochId int64
}
func NewQueryEpochParams ¶
func NewQueryEpochParams(epochId int64) QueryEpochParams
type QueryRequestParams ¶
func NewQueryRequestParams ¶
func NewQueryRequestParams(channelId []byte, simplexReceiver string) QueryRequestParams
type QuerySubscriptionParams ¶
type QuerySubscriptionParams struct {
EthAddress string
}
func NewQuerySubscriptionParams ¶
func NewQuerySubscriptionParams(addr string) QuerySubscriptionParams
type Request ¶
type Request struct { ChannelId []byte `json:"channel_id"` SeqNum uint64 `json:"seq_num"` SimplexSender string `json:"simplex_sender"` SimplexReceiver string `json:"simplex_receiver"` SignedSimplexStateBytes []byte `json:"signed_simplex_state_bytes"` DisputeTimeout uint64 `json:"dispute_timeout"` Status ChanStatus `json:"status"` AssignedGuards []sdk.AccAddress `json:"assigned_guards"` TriggerTxHash string `json:"trigger_tx_hash"` TriggerTxBlkNum uint64 `json:"trigger_tx_blk_num"` GuardTxHash string `json:"guard_tx_hash"` GuardTxBlkNum uint64 `json:"guard_tx_blk_num"` GuardSender string `json:"guard_sender"` }
func NewRequest ¶
type Subscription ¶
type Subscription struct { EthAddress string `json:"eth_address"` Deposit sdk.Int `json:"deposit"` Spend sdk.Int `json:"spend"` }
func NewSubscription ¶
func NewSubscription(ethAddress string) Subscription
Click to show internal directories.
Click to hide internal directories.