Documentation
¶
Index ¶
- Constants
- Variables
- func GetEpochKey(epochId sdk.Int) []byte
- func GetLatestEpochKey() []byte
- func GetRequestKey(channelId []byte, simplexReceiver string) []byte
- func GetSubscriptionKey(ethAddress string) []byte
- func RegisterCodec(cdc *codec.Codec)
- type ChanStatus
- type Epoch
- type GuardProof
- type GuardTrigger
- type InitRequest
- type MsgRequestGuard
- type Params
- type QueryEpochParams
- type QueryRequestParams
- type QuerySubscriptionParams
- type Request
- type Subscription
Constants ¶
const ( // module name ModuleName = "guard" // StoreKey to be used when creating the KVStore StoreKey = ModuleName )
const ( // Default number of guards for guarding request DefaultRequestGuardCount uint64 = 3 // Default epoch length based on seconds DefaultEpochLength uint64 = 60 // Default minimal channel dispute timeout in mainchain blocks DefaultMinDisputeTimeout uint64 = 80000 )
guard params default values
const ( QuerySubscription = "subscription" QueryRequest = "request" QueryEpoch = "epoch" QueryParameters = "parameters" )
const RouterKey = ModuleName // this was defined in your key.go file
Variables ¶
var ( SubscriptionKeyPrefix = []byte{0x01} // Key prefix for subscription RequestKeyPrefix = []byte{0x21} // Key prefix for request EpochKeyPrefix = []byte{0x31} // Key prefix for epoch LatestEpochKey = []byte{0x32} // Key for latest epoch )
var ( KeyRequestGuardCount = []byte("RequestGuardCount") KeyEpochLength = []byte("EpochLength") KeyRequestCost = []byte("RequestCost") KeyMinDisputeTimeout = []byte("MinDisputeTimeout") )
nolint - Keys for parameter access
var ( // Default cost per request DefaultRequestCost = sdk.NewInt(1000000000000000000) )
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 Epoch ¶
type GuardProof ¶
type GuardProof struct {
ChannelId []byte `json:"channelId"`
SimplexReceiver string `json:"simplexReceiver"`
GuardTxHash string `json:"guardTxHash"`
GuardTxBlkNum uint64 `json:"guardTxBlkNum"`
GuardSender string `json:"guardSender"`
Status ChanStatus `json:"status"`
}
func NewGuardProof ¶
func (GuardProof) String ¶
func (gp GuardProof) String() string
type GuardTrigger ¶
type GuardTrigger struct {
ChannelId []byte `json:"channelId"`
SimplexReceiver string `json:"simplexReceiver"`
TriggerTxHash string `json:"triggerTxHash"`
TriggerTxBlkNum uint64 `json:"triggerTxBlkNum"`
TriggerSeqNum uint64 `json:"triggerSeqNum"`
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:"signedSimplexStateBytes"`
SimplexReceiverSig []byte `json:"simplexReceiverSig"`
DisputeTimeout uint64 `json:"disputeTimeout"`
}
func NewInitRequest ¶
func NewInitRequest(signedSimplexStateBytes, simplexReceiverSig []byte, disputeTimeout uint64) *InitRequest
type MsgRequestGuard ¶
type MsgRequestGuard struct {
SignedSimplexStateBytes []byte `json:"signedSimplexStateBytes"`
SimplexReceiverSig []byte `json:"simplexReceiverSig"`
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
EpochLength uint64 `json:"epoch_length" yaml:"epoch_length"` // epoch length based on seconds
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 NewParams ¶
func NewParams(requestGuardCount, epochLength uint64, requestCost sdk.Int, minDisputeTimeout uint64) Params
NewParams creates a new Params instance
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:"channelId"`
SeqNum uint64 `json:"seqNum"`
SimplexSender string `json:"simplexSender"`
SimplexReceiver string `json:"simplexReceiver"`
SignedSimplexStateBytes []byte `json:"signedSimplexStateBytes"`
DisputeTimeout uint64 `json:"disputeTimeout"`
Status ChanStatus `json:"status"`
AssignedGuards []sdk.AccAddress `json:"assignedGuards"`
TriggerTxHash string `json:"triggerTxHash"`
TriggerTxBlkNum uint64 `json:"triggerTxBlkNum"`
GuardTxHash string `json:"guardTxHash"`
GuardTxBlkNum uint64 `json:"guardTxBlkNum"`
GuardSender string `json:"guardSender"`
}
func NewRequest ¶
type Subscription ¶
type Subscription struct {
EthAddress string `json:"ethAddress"`
Deposit sdk.Int `json:"deposit"`
Spend sdk.Int `json:"spend"`
}
func NewSubscription ¶
func NewSubscription(ethAddress string) Subscription