substrate

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2021 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FindNewMultiSigTx         string = "Find a MultiSign New extrinsic"
	FindApproveMultiSigTx     string = "Find a MultiSign Approve extrinsic"
	FindExecutedMultiSigTx    string = "Find a MultiSign Executed extrinsic"
	FindBatchMultiSigTx       string = "Find a MultiSign Batch Extrinsic"
	FindFailedBatchMultiSigTx string = "But Batch Extrinsic Failed"

	StartATx                    string = "Start a redeemTx..."
	MeetARepeatTx               string = "Meet a Repeat Transaction"
	FindLostMultiSigTx          string = "Find a Lost BatchTx"
	TryToMakeNewMultiSigTx      string = "Try to make a New MultiSign Tx!"
	TryToApproveMultiSigTx      string = "Try to Approve a MultiSignTx!"
	FinishARedeemTx             string = "Finish a redeemTx"
	MultiSigExtrinsicExecuted   string = "MultiSig extrinsic executed!"
	BlockNotYetFinalized        string = "Block not yet finalized"
	SubListenerWorkFinished     string = "Sub listener work is Finished"
	FailedToProcessCurrentBlock string = "Failed to process current block"
	FailedToWriteToBlockStore   string = "Failed to write to blockStore"
	RelayerFinishTheTx          string = "Relayer Finish the Tx"
	LineLog                     string = "------------------------------------"

	MaybeAProblem                         string = "There may be a problem with the deal"
	RedeemTxTryTooManyTimes               string = "Redeem Tx failed, try too many times"
	MultiSigExtrinsicError                string = "MultiSig extrinsic err! UnknownError(amount、chainId...)"
	RedeemNegAmountError                  string = "Redeem a neg amount"
	NewBalancesTransferCallError          string = "New Balances.transfer err"
	NewBalancesTransferKeepAliveCallError string = "New Balances.transferKeepAlive err"
	NewXAssetsTransferCallError           string = "New XAssets.Transfer err"
	NewCrossChainTransferCallError        string = "New Cross-Chain Transfer err"
	NewMultiCallError                     string = "New MultiCall err"
	NewApiError                           string = "New api error"
	SignMultiSignTxFailed                 string = "Sign MultiSignTx failed"
	SubmitExtrinsicFailed                 string = "Submit Extrinsic Failed"
	GetMetadataError                      string = "Get Metadata Latest err"
	GetBlockHashError                     string = "Get BlockHash Latest err"
	GetBlockByNumberError                 string = "Get BlockByNumber err"
	GetRuntimeVersionLatestError          string = "Get RuntimeVersionLatest Latest err"
	GetStorageLatestError                 string = "Get StorageLatest Latest err"
	CreateStorageKeyError                 string = "Create StorageKey err"
	ProcessBlockError                     string = "ProcessBlock err, check it"
)
View Source
const FungibleTransfer eventName = "FungibleTransfer"
View Source
const GenericTransfer eventName = "GenericTransfer"
View Source
const HexPrefix = "hex"
View Source
const InitCapacity = 100

Frequency of polling for a new block

View Source
const NativeTransfer eventName = "NativeTransfer"
View Source
const NonFungibleTransfer eventName = "NonFungibleTransfer"
View Source
const RoundInterval = time.Second * 6

Variables

View Source
var (
	StartBlockOpt      = "startBlock"
	EndBlockOpt        = "endBlock"
	LostAddressOpt     = "lostAddress"
	UseExtendedCallOpt = "useExtendedCall"
	TotalRelayerOpt    = "totalRelayer"
	//OtherRelayersOpt	  = "otherRelayers"
	CurrentRelayerNumberOpt = "currentRe2layerNumber"
	MultiSignAddressOpt     = "multiSignAddress"
	MaxWeightOpt            = "maxWeight"
	DestIdOpt               = "destId"
	ResourceIdOpt           = "resourceId"
	MultiSignThresholdOpt   = "multiSignThreshold"

	OtherRelayerOpt = "otherRelayer"
)

Chain specific options

View Source
var AcknowledgeProposal utils.Method = utils.BridgePalletName + ".acknowledge_proposal"
View Source
var BlockRetryInterval = time.Second * 5
View Source
var BlockRetryLimit = 15
View Source
var ErrBlockNotReady = errors.New("required result to be 32 bytes, but got 0")
View Source
var NotExecuted = MultiSignTx{
	Block: -1,
	TxId:  0,
}
View Source
var RedeemRetryLimit = 15
View Source
var Subscriptions = []struct {
	name    eventName
	handler eventHandler
}{
	{NativeTransfer, nativeTransferHandler},
	{FungibleTransfer, fungibleTransferHandler},
	{NonFungibleTransfer, nonFungibleTransferHandler},
	{GenericTransfer, genericTransferHandler},
}
View Source
var TerminatedError = errors.New("terminated")
View Source
var UnKnownError = MultiSignTx{
	Block: -2,
	TxId:  0,
}
View Source
var YesVoted = MultiSignTx{
	Block: -1,
	TxId:  1,
}

Functions

func EncodeCall

func EncodeCall(call types.Call) []byte

func NewListener

func NewListener(
	conn *Connection, name string, id msg.ChainId, startBlock uint64, endBlock uint64, lostAddress string,
	log log15.Logger, bs blockstore.Blockstorer, stop <-chan int, sysErr chan<- error, m *metrics.ChainMetrics,
	multiSignAddress types.AccountID, resource msg.ResourceId, dest msg.ChainId, relayer Relayer, bc *chainset.BridgeCore) *listener

func NewWriter

func NewWriter(conn *Connection, listener *listener, log log15.Logger, sysErr chan<- error,
	m *metrics.ChainMetrics, extendCall bool, weight uint64, relayer Relayer, bc *chainset.BridgeCore) *writer

Types

type BlockNumber

type BlockNumber int64

type Chain

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

func InitializeChain

func InitializeChain(cfg *core.ChainConfig, logger log15.Logger, sysErr chan<- error, m *metrics.ChainMetrics) (*Chain, error)

func (*Chain) Id

func (c *Chain) Id() msg.ChainId

func (*Chain) LatestBlock

func (c *Chain) LatestBlock() metrics.LatestBlock

func (*Chain) Name

func (c *Chain) Name() string

func (*Chain) SetRouter

func (c *Chain) SetRouter(r *core.Router)

func (*Chain) Start

func (c *Chain) Start() error

func (*Chain) Stop

func (c *Chain) Stop()

type Connection

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

func NewConnection

func NewConnection(url string, endpoint []string, name string, key *signature.KeyringPair, log log15.Logger, stop <-chan int, sysErr chan<- error) *Connection

func (*Connection) Close

func (c *Connection) Close()

func (*Connection) Connect

func (c *Connection) Connect() error

func (*Connection) Reconnect

func (c *Connection) Reconnect() error

func (*Connection) SubmitTx

func (c *Connection) SubmitTx(method utils.Method, args ...interface{}) error

SubmitTx constructs and submits an extrinsic to call the method with the given arguments. All args are passed directly into GSRPC. GSRPC types are recommended to avoid serialization inconsistencies.

type Dest

type Dest struct {
	DepositNonce msg.Nonce
	DestAddress  string
	DestAmount   string
}

type Msg

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

func NewMsg

func NewMsg(msg msg.Message) *Msg

type MultiSigAsMulti

type MultiSigAsMulti struct {
	OriginMsTx     MultiSignTx
	Executed       bool
	Threshold      uint16
	Others         []OtherSignatories
	MaybeTimePoint expand.TimePointSafe32
	DestAddress    string
	DestAmount     string
	StoreCall      bool
	MaxWeight      uint64
	DepositNonce   msg.Nonce
	YesVote        []types.AccountID
}

type MultiSignTx

type MultiSignTx struct {
	Block BlockNumber
	TxId  MultiSignTxId
}

type MultiSignTxId

type MultiSignTxId uint64

type OtherSignatories

type OtherSignatories []string

type Relayer

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

func NewRelayer

func NewRelayer(kr signature.KeyringPair, otherSignatories []types.AccountID, totalRelayers uint64,
	multiSignThreshold uint16, currentRelayer uint64) Relayer

type Round

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

type TimePointSafe32

type TimePointSafe32 struct {
	Height types.OptionU32
	Index  types.U32
}

Jump to

Keyboard shortcuts

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