relayer

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

Functions

func SetOracle added in v0.2.7

func SetOracle(o Oracle) func(GravityRelayer)

SetOracle sets a new oracle to the Gravity Relayer.

func SetSymbolRetriever added in v0.2.7

func SetSymbolRetriever(coinGecko SymbolRetriever) func(GravityRelayer)

Types

type BridgeValidators

type BridgeValidators []types.BridgeValidator

func (BridgeValidators) GetPowers

func (b BridgeValidators) GetPowers() []uint64

GetPowers returns only the power values for all members

func (BridgeValidators) HasDuplicates

func (b BridgeValidators) HasDuplicates() bool

HasDuplicates returns true if there are duplicates in the set

func (BridgeValidators) Sort

func (b BridgeValidators) Sort()

Sort sorts the validators by power

type GravityRelayer added in v0.2.0

type GravityRelayer interface {
	Start(ctx context.Context) error

	FindLatestValset(ctx context.Context) (*gravitytypes.Valset, error)

	RelayBatches(
		ctx context.Context,
		currentValset gravitytypes.Valset,
		possibleBatches map[ethcmn.Address][]SubmittableBatch,
	) error

	RelayValsets(ctx context.Context, currentValset gravitytypes.Valset) error

	// SetSymbolRetriever sets the Symbol Retriever api to get the symbol from contract address.
	SetSymbolRetriever(SymbolRetriever)

	// SetOracle sets the oracle for price feeder used when performing profitable
	// batch calculations.
	SetOracle(Oracle)

	GetProfitMultiplier() float64
}

func NewGravityRelayer added in v0.2.0

func NewGravityRelayer(
	logger zerolog.Logger,
	gravityQueryClient gravitytypes.QueryClient,
	gravityContract gravity.Contract,
	valsetRelayMode ValsetRelayMode,
	batchRelayEnabled bool,
	loopDuration time.Duration,
	pendingTxWait time.Duration,
	profitMultiplier float64,
	options ...func(GravityRelayer),
) GravityRelayer

type GravityValsetUpdatedEvents added in v0.2.0

type GravityValsetUpdatedEvents []*wrappers.GravityValsetUpdatedEvent

func (GravityValsetUpdatedEvents) Len added in v0.2.0

func (GravityValsetUpdatedEvents) Less added in v0.2.0

func (a GravityValsetUpdatedEvents) Less(i, j int) bool

func (GravityValsetUpdatedEvents) Swap added in v0.2.0

func (a GravityValsetUpdatedEvents) Swap(i, j int)

type Oracle added in v0.2.7

type Oracle interface {
	// GetPrices returns the price for the provided base symbols.
	GetPrices(baseSymbols ...string) (map[string]sdk.Dec, error)

	// GetPrice returns the price based on the base symbol ex.: UMEE, ETH.
	GetPrice(baseSymbol string) (sdk.Dec, error)

	// SubscribeSymbols attempts to subscribe the symbols in all the providers.
	// baseSymbols is the base to be subscribed ex.: ["UMEE", "ATOM"].
	SubscribeSymbols(baseSymbols ...string) error
}

Oracle defines the Oracle interface that the relayer depends on.

type SubmittableBatch

type SubmittableBatch struct {
	Batch      types.OutgoingTxBatch
	Signatures []types.MsgConfirmBatch
}

type SymbolRetriever added in v0.2.7

type SymbolRetriever interface {
	// GetTokenSymbol executes an API client to retrieve the
	// correct Symbol from the contract address
	GetTokenSymbol(erc20Contract ethcmn.Address) (string, error)
}

SymbolRetriever wraps the interface to convert an ethereum contract address into an token symbol like 0xdAC17F958D2ee523a2206206994597C13D831ec7 -> USDT

type ValsetRelayMode added in v0.2.5

type ValsetRelayMode int64

ValsetRelayMode defines an enumerated validator set relay mode.

const (
	ValsetRelayModeNone ValsetRelayMode = iota
	ValsetRelayModeMinimum
	ValsetRelayModeAll
)

Allowed validator set relay modes

func (ValsetRelayMode) String added in v0.2.5

func (d ValsetRelayMode) String() string

String gets the string representation of the validator set relay mode.

Jump to

Keyboard shortcuts

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