Documentation
¶
Index ¶
- Constants
- Variables
- func CheckMemo(memoStr string) (retMomoType uint8, retStafiAddress string, retRecoverTxHash string)
- func GetBondUnBondProposalId(shotId [32]byte, bond, unbond *big.Int, index uint8) []byte
- func GetBondUnbondWithdrawMsgsWithTargets(client *hubClient.Client, bond, unbond *big.Int, poolAddr types.AccAddress, ...) (msgs []types.Msg, unSignedType int, err error)
- func GetBondUnbondWithdrawUnsignedTxWithTargets(client *hubClient.Client, bond, unbond, minUnDelegateAmount *big.Int, ...) (unSignedTx []byte, unSignedTxType int, err error)
- func GetClaimRewardProposalId(shotId [32]byte, height uint64, index uint8) []byte
- func GetDelegateRewardUnsignedTxWithReward(client *hubClient.Client, poolAddr types.AccAddress, height int64, ...) ([]byte, *types.Int, error)
- func GetLatestDealEraUpdatedTx(c *hubClient.Client, dstChannelId string) (*types.TxResponse, int64, error)
- func GetLatestReDelegateTx(c *hubClient.Client, delegatorAddr string) (*types.TxResponse, int64, error)
- func GetMemo(era uint32, txType string) string
- func GetRewardToBeDelegated(c *hubClient.Client, delegatorAddr string, era uint32) (map[string]types.Coin, int64, bool, error)
- func GetTransferMsgs(client *hubClient.Client, poolAddr types.AccAddress, ...) ([]types.Msg, []xBankTypes.Output, error)
- func GetTransferProposalId(unSignTxHash [32]byte, index uint8) []byte
- func GetTransferUnsignedTxWithMemo(client *hubClient.Client, poolAddr types.AccAddress, ...) ([]byte, []xBankTypes.Output, error)
- func GetValidatorUpdateProposalId(content []byte, index uint8) []byte
- func GetValidatorUpdatedMemo(era uint32, cycleVersion, cycleNumber uint64) string
- func NewBlockstore(path string, relayer string) (*utils.Blockstore, error)
- func ParseBondUnBondProposalId(content []byte) (shotId [32]byte, bond, unbond *big.Int, index uint8, err error)
- func ParseClaimRewardProposalId(content []byte) (shotId [32]byte, height uint64, index uint8, err error)
- func ParseMemoAndMsgs(client *hubClient.Client, txValue []byte) (string, []*xBankTypes.MsgSend, error)
- func ShotIdToArray(shotId string) ([32]byte, error)
- func StartBlock(bs *utils.Blockstore, blk uint64) (uint64, error)
- type BlockResult
- type Chain
- type ConfigOption
- type Connection
- func (c *Connection) AddIcaPool(poolAddrStr, withdrawalAddr, hostChannelId string, targetValidators []string) error
- func (c *Connection) AddPoolTargetValidator(poolAddrStr string, newVal types.ValAddress)
- func (c *Connection) BlockStoreUseAddress() string
- func (c *Connection) GetIcaPoolHostChannelId(poolAddrStr string) (string, error)
- func (c *Connection) GetIcaPoolRewardAddress(poolAddrStr string) (types.AccAddress, error)
- func (c *Connection) GetOnePoolClient() (*hubClient.Client, error)
- func (c *Connection) GetPoolClient(poolAddrStr string) (*hubClient.Client, bool, error)
- func (c *Connection) GetPoolSubkeyName(poolAddrStr string) (string, error)
- func (c *Connection) GetPoolTargetValidators(poolAddrStr string) ([]types.ValAddress, error)
- func (c *Connection) GetPoolThreshold(poolAddrStr string) (uint32, error)
- func (c *Connection) RemovePool(poolAddrStr string)
- func (c *Connection) RemovePoolClient(poolAddrStr string)
- func (c *Connection) RemovePoolTarget(poolAddrStr string)
- func (c *Connection) ReplacePoolTargetValidator(poolAddrStr string, oldVal, newVal types.ValAddress)
- func (c *Connection) SetPoolTargetValidators(poolAddrStr string, vals []types.ValAddress) error
- type Handler
- type Listener
- type RParams
- type WrapUnsignedTx
Constants ¶
const ( UnSignedTxTypeUnSpecified = 0 UnSignedTxTypeBondEqualUnbondWithdraw = 1 UnSignedTxTypeDelegate = 2 UnSignedTxTypeUnDelegateAndWithdraw = 3 UnSignedTxTypeSkipAndWithdraw = 4 )
Variables ¶
var ( ErrNoOutPuts = errors.New("outputs length is zero") ErrNoRewardNeedDelegate = fmt.Errorf("no tx reward need delegate") ErrNotFound = errors.New("NotFound") ErrUnknownQueryPath = errors.New("UnknownQueryPath") )
var ( TxTypeHandleEraPoolUpdatedEvent = "handleEraPoolUpdatedEvent" TxTypeHandleBondReportedEvent = "handleBondReportedEvent" TxTypeHandleActiveReportedEvent = "handleActiveReportedEvent" TxTypeHandleRValidatorUpdatedEvent = "handleRValidatorUpdatedEvent" )
var ( BlockRetryInterval = time.Second * 6 BlockRetryLimit = 500 BlockConfirmNumber = int64(1) )
var (
ErrorTerminated = errors.New("terminated")
)
var ValidatorBondCapDisabled = types.NewDecFromInt(types.NewInt(-1))
Functions ¶
func GetBondUnBondProposalId ¶
func GetBondUnbondWithdrawMsgsWithTargets ¶ added in v1.6.0
func GetBondUnbondWithdrawMsgsWithTargets(client *hubClient.Client, bond, unbond *big.Int, poolAddr types.AccAddress, height int64, targets []types.ValAddress, logger log.Logger) (msgs []types.Msg, unSignedType int, err error)
ensue every validator claim reward if bond == unbond: if no delegation before, return errNoMsgs, else gen withdraw tx if bond > unbond: gen delegate tx if bond < unbond: gen undelegate+withdraw tx
func GetBondUnbondWithdrawUnsignedTxWithTargets ¶ added in v0.0.2
func GetBondUnbondWithdrawUnsignedTxWithTargets(client *hubClient.Client, bond, unbond, minUnDelegateAmount *big.Int, poolAddr types.AccAddress, height int64, targets []types.ValAddress, memo string) (unSignedTx []byte, unSignedTxType int, err error)
ensue every validator claim reward if bond == unbond: if no delegation before, return errNoMsgs, else gen withdraw tx if bond > unbond: gen delegate tx if bond < unbond: gen undelegate+withdraw tx or withdraw tx when no available vals for unbonding
func GetDelegateRewardUnsignedTxWithReward ¶ added in v1.4.0
func GetDelegateRewardUnsignedTxWithReward(client *hubClient.Client, poolAddr types.AccAddress, height int64, rewards map[string]types.Coin, memo string) ([]byte, *types.Int, error)
Notice: delegate/undelegate/withdraw operates will withdraw all reward all delegations had withdraw all reward in eraUpdatedEvent handler (0)if rewardAmount of height == 0, hubClient.ErrNoMsgs (1)else gen delegate tx
func GetLatestDealEraUpdatedTx ¶ added in v1.6.0
func GetLatestDealEraUpdatedTx(c *hubClient.Client, dstChannelId string) (*types.TxResponse, int64, error)
used for ica pool should filter with dst channel, because the dst channel is unique on dst chain.
func GetLatestReDelegateTx ¶ added in v1.5.0
func GetRewardToBeDelegated ¶ added in v1.4.1
func GetRewardToBeDelegated(c *hubClient.Client, delegatorAddr string, era uint32) (map[string]types.Coin, int64, bool, error)
get reward info of pre txs(tx in eraUpdatedEvent of this era and tx in bondReportedEvent/rValidatorUpdatedEvent of era-1) tx in bondReportedEvent of era-1 should use the old validator tx in rValidatorUpdatedEvent of era -1 should replace old to new validator tx in eraUpdatedEvent of this era should already use the new validator
func GetTransferMsgs ¶ added in v1.6.0
func GetTransferMsgs(client *hubClient.Client, poolAddr types.AccAddress, receives []*stafiHubXLedgerTypes.Unbonding, logger log.Logger) ([]types.Msg, []xBankTypes.Output, error)
func GetTransferProposalId ¶
func GetTransferUnsignedTxWithMemo ¶ added in v1.4.0
func GetTransferUnsignedTxWithMemo(client *hubClient.Client, poolAddr types.AccAddress, receives []*stafiHubXLedgerTypes.Unbonding, memo string, logger log.Logger) ([]byte, []xBankTypes.Output, error)
func GetValidatorUpdatedMemo ¶ added in v1.5.0
func NewBlockstore ¶
func NewBlockstore(path string, relayer string) (*utils.Blockstore, error)
func ParseMemoAndMsgs ¶ added in v1.11.3
func ShotIdToArray ¶
func StartBlock ¶
func StartBlock(bs *utils.Blockstore, blk uint64) (uint64, error)
Types ¶
type BlockResult ¶ added in v1.10.9
type BlockResult struct { Height uint64 Txs []*types.TxResponse }
type Chain ¶
type Chain struct {
// contains filtered or unexported fields
}
func (*Chain) Initialize ¶
type ConfigOption ¶
type ConfigOption struct { // get from config file BlockstorePath string `json:"blockstorePath"` StartBlock int `json:"startBlock"` PoolNameSubKey map[string]string `json:"pools"` MinUnDelegateAmount string `json:"minUnDelegateAmount"` // get from stafihub rparams GasPrice string `json:"gasPrice"` EraSeconds uint32 `json:"eraSeconds"` LeastBond string `json:"leastBond"` Offset int32 `json:"offset"` AccountPrefix string `json:"accountPrefix"` // get from stafihub IcaPoolWithdrawalAddr map[string]string //delegationAddres => withdrawalAddress IcaPoolHostChannel map[string]string //delegationAddres => hostChannelId PoolTargetValidators map[string][]string `json:"targetValidators"` PoolAddressThreshold map[string]uint32 `json:"poolThreshold"` }
type Connection ¶
type Connection struct { RParams // contains filtered or unexported fields }
func NewConnection ¶
func NewConnection(cfg *config.RawChainConfig, option ConfigOption, log log.Logger) (*Connection, error)
func (*Connection) AddIcaPool ¶ added in v1.8.0
func (c *Connection) AddIcaPool(poolAddrStr, withdrawalAddr, hostChannelId string, targetValidators []string) error
func (*Connection) AddPoolTargetValidator ¶ added in v1.5.0
func (c *Connection) AddPoolTargetValidator(poolAddrStr string, newVal types.ValAddress)
func (*Connection) BlockStoreUseAddress ¶
func (c *Connection) BlockStoreUseAddress() string
func (*Connection) GetIcaPoolHostChannelId ¶ added in v1.8.10
func (c *Connection) GetIcaPoolHostChannelId(poolAddrStr string) (string, error)
func (*Connection) GetIcaPoolRewardAddress ¶ added in v1.6.0
func (c *Connection) GetIcaPoolRewardAddress(poolAddrStr string) (types.AccAddress, error)
func (*Connection) GetOnePoolClient ¶
func (c *Connection) GetOnePoolClient() (*hubClient.Client, error)
func (*Connection) GetPoolClient ¶
func (*Connection) GetPoolSubkeyName ¶ added in v1.5.0
func (c *Connection) GetPoolSubkeyName(poolAddrStr string) (string, error)
func (*Connection) GetPoolTargetValidators ¶ added in v1.5.0
func (c *Connection) GetPoolTargetValidators(poolAddrStr string) ([]types.ValAddress, error)
func (*Connection) GetPoolThreshold ¶ added in v1.5.0
func (c *Connection) GetPoolThreshold(poolAddrStr string) (uint32, error)
func (*Connection) RemovePool ¶ added in v1.8.0
func (c *Connection) RemovePool(poolAddrStr string)
func (*Connection) RemovePoolClient ¶ added in v1.8.0
func (c *Connection) RemovePoolClient(poolAddrStr string)
func (*Connection) RemovePoolTarget ¶ added in v1.8.0
func (c *Connection) RemovePoolTarget(poolAddrStr string)
func (*Connection) ReplacePoolTargetValidator ¶ added in v1.5.0
func (c *Connection) ReplacePoolTargetValidator(poolAddrStr string, oldVal, newVal types.ValAddress)
func (*Connection) SetPoolTargetValidators ¶ added in v1.5.0
func (c *Connection) SetPoolTargetValidators(poolAddrStr string, vals []types.ValAddress) error
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func (*Handler) HandleMessage ¶
resolve msg from other chains
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
func NewListener ¶
func NewListener(symbol core.RSymbol, startBlock uint64, bs utils.Blockstorer, conn *Connection, log log.Logger, stopChan <-chan struct{}, sysErr chan<- error) *Listener
func (Listener) SubmitProposalExeLiquidityBond ¶
func (l Listener) SubmitProposalExeLiquidityBond(proposalExeLiquidityBond core.ProposalExeLiquidityBond) error
blocked until tx is dealed on stafichain
func (Listener) SubmitProposalExeNativeAndLsmLiquidityBond ¶ added in v1.11.1
func (l Listener) SubmitProposalExeNativeAndLsmLiquidityBond(proposalExeNativeAndLsmLiquidityBond core.ProposalExeNativeAndLsmLiquidityBond) error
blocked until tx is dealed on stafichain
type WrapUnsignedTx ¶
type WrapUnsignedTx struct { UnsignedTx []byte Key string SnapshotId string Era uint32 Bond *big.Int Unbond *big.Int Type stafiHubXLedgerTypes.OriginalTxType PoolAddressStr string CycleVersion uint64 CycleNumber uint64 OldValidator types.ValAddress NewValidator types.ValAddress }