core

package
v0.0.0-...-94bd4ab Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2022 License: GPL-3.0 Imports: 10 Imported by: 4

Documentation

Index

Constants

View Source
const (
	//send from other chain
	ReasonNewEra           = Reason("NewEra")
	ReasonExeLiquidityBond = Reason("ExeLiquidityBond")
	ReasonBondReport       = Reason("BondReport")
	ReasonActiveReport     = Reason("ActiveReport")
	ReasonWithdrawReport   = Reason("WithdrawReport")
	ReasonTransferReport   = Reason("TransferReport")
	ReasonSubmitSignature  = Reason("SubmitSignature")

	ReasonCurrentChainEra  = Reason("CurrentChainEra")
	ReasonBondedPools      = Reason("BondedPools")
	ReasonNewMultisig      = Reason("AsMulti")
	ReasonMultisigExecuted = Reason("MultisigExecuted")
	ReasonGetEraNominated  = Reason("GetEraNominated")

	//send when got event from stafi chain
	ReasonLiquidityBondEvent = Reason("LiquidityBondEvent")

	//send when got event from stafi/stafihub chain
	ReasonEraPoolUpdatedEvent    = Reason("EraPoolUpdatedEvent")
	ReasonBondReportedEvent      = Reason("BondReportedEvent")
	ReasonActiveReportedEvent    = Reason("ActiveReportedEvent")
	ReasonWithdrawReportedEvent  = Reason("WithdrawReportedEvent")
	ReasonTransferReportedEvent  = Reason("TransferReportedEvent")
	ReasonNominationUpdatedEvent = Reason("NominationUpdatedEvent")
	ReasonSignatureEnoughEvent   = Reason("SignatureEnoughed")

	ReasonValidatorUpdatedEvent = Reason("ValidatorUpdatedEvent")

	//get reason
	ReasonGetPools = Reason("GetPools")
)
View Source
const (
	//stafi chain
	RFIS   = RSymbol("RFIS")
	RDOT   = RSymbol("RDOT")
	RKSM   = RSymbol("RKSM")
	RATOM  = RSymbol("RATOM")
	RSOL   = RSymbol("RSOL")
	RMATIC = RSymbol("RMATIC")
	RBNB   = RSymbol("RBNB")
)
View Source
const (
	//stafi hub
	HubRFIS = RSymbol("RFIS")
)

Variables

This section is empty.

Functions

func UseSdkConfigContext

func UseSdkConfigContext(accountPrefix string) func()

UseSDKContext uses a custom Bech32 account prefix and returns a restore func CONTRACT: When using this function, caller must ensure that lock contention doesn't cause program to hang. This function is only for use in codec calls

Types

type Chain

type Chain interface {
	Initialize(cfg *config.RawChainConfig, logger log15.Logger, sysErr chan<- error) error
	Start() error // Start chain
	SetRouter(*Router)
	RSymbol() RSymbol
	Name() string
	Stop()
}

type Core

type Core struct {
	Registry []Chain
	// contains filtered or unexported fields
}

func NewCore

func NewCore(sysErr <-chan error) *Core

func (*Core) AddChain

func (c *Core) AddChain(chain Chain)

AddChain registers the chain in the Registry and calls Chain.SetRouter()

func (*Core) Errors

func (c *Core) Errors() <-chan error

func (*Core) Start

func (c *Core) Start()

Start will call all registered chains' Start methods and block forever (or until signal is received)

type EventActiveReported

type EventActiveReported struct {
	Denom       string
	ShotId      string
	LasterVoter string
	Snapshot    stafiHubXLedgerTypes.BondSnapshot
	PoolUnbond  stafiHubXLedgerTypes.PoolUnbond
}

type EventBondReported

type EventBondReported struct {
	Denom       string
	ShotId      string
	LasterVoter string
	Snapshot    stafiHubXLedgerTypes.BondSnapshot
}

type EventEraPoolUpdated

type EventEraPoolUpdated struct {
	Denom       string
	LastEra     uint32
	CurrentEra  uint32
	ShotId      string
	LasterVoter string
	Snapshot    stafiHubXLedgerTypes.BondSnapshot
}

=== stafihub -> other chain msg data used in cosmos

type EventSignatureEnough

type EventSignatureEnough struct {
	Denom      string
	Era        uint32
	Pool       string
	TxType     stafiHubXLedgerTypes.OriginalTxType
	ProposalId []byte
	Signatures [][]byte
	Threshold  uint32
}

type EventTransferReported

type EventTransferReported struct {
	Denom       string
	ShotId      string
	LasterVoter string
}

type EventWithdrawReported

type EventWithdrawReported struct {
	Denom       string
	ShotId      string
	LasterVoter string
	Snapshot    stafiHubXLedgerTypes.BondSnapshot
	PoolUnbond  stafiHubXLedgerTypes.PoolUnbond
}

type Handler

type Handler interface {
	HandleMessage(msg *Message)
}

Handler consumes a message and makes the requried on-chain interactions.

type Message

type Message struct {
	Source      RSymbol
	Destination RSymbol
	Reason      Reason
	Content     interface{}
}

type ParamGetPools

type ParamGetPools struct {
	Denom string
	Pools chan []string
}

get msg

type ParamSubmitSignature

type ParamSubmitSignature struct {
	Denom     string
	Era       uint32
	Pool      string
	TxType    stafiHubXLedgerTypes.OriginalTxType
	PropId    []byte
	Signature string
}

type ProposalActiveReport

type ProposalActiveReport struct {
	Denom    string
	ShotId   []byte
	Staked   sdk.Int
	Unstaked sdk.Int
}

type ProposalBondReport

type ProposalBondReport struct {
	Denom  string
	ShotId []byte
	Action stafiHubXLedgerTypes.BondAction
}

type ProposalExeLiquidityBond

type ProposalExeLiquidityBond struct {
	Denom     string
	Bonder    string
	Pool      string
	Blockhash string
	Txhash    string
	Amount    sdk.Int
}

=== other chain -> stafihub msg data used in cosmos

type ProposalSetChainEra

type ProposalSetChainEra struct {
	Denom string
	Era   uint32
}

type ProposalTransferReport

type ProposalTransferReport struct {
	Denom  string
	ShotId []byte
}

type ProposalWithdrawReport

type ProposalWithdrawReport struct {
	Denom  string
	ShotId []byte
}

type RSymbol

type RSymbol string

func (*RSymbol) Decode

func (r *RSymbol) Decode(decoder scale.Decoder) error

func (RSymbol) Encode

func (r RSymbol) Encode(encoder scale.Encoder) error

type Reason

type Reason string

type Router

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

Router forwards messages from their source to their destination

func NewRouter

func NewRouter(log log.Logger) *Router

func (*Router) Listen

func (r *Router) Listen(symbol RSymbol, w Handler)

Listen registers a Writer with a ChainId which Router.Send can then use to propagate messages

func (*Router) Send

func (r *Router) Send(msg *Message) error

Send passes a message to the destination Writer if it exists

func (*Router) StopMsgHandler

func (r *Router) StopMsgHandler()

Jump to

Keyboard shortcuts

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