repository

package
v0.0.0-...-ae94c13 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProtocolsRepositoryFactory = map[string]func(url string, logger *zap.Logger) ProtocolRepository{

	commons.MayanProtocol: func(baseURL string, logger *zap.Logger) ProtocolRepository {
		return NewMayanRestClient(baseURL, logger, &http.Client{})
	},

	commons.AllBridgeProtocol: func(baseURL string, logger *zap.Logger) ProtocolRepository {
		return NewAllBridgeRestClient(baseURL, logger, &http.Client{})
	},
}

ProtocolsRepositoryFactory RestClient Factory to create the right client for each protocol.

Functions

This section is empty.

Types

type Activity

type Activity struct {
	EmitterChainID     uint64  `json:"emitter_chain_id"`
	DestinationChainID uint64  `json:"destination_chain_id"`
	Txs                uint64  `json:"txs"`
	TotalUSD           float64 `json:"total_usd"`
}

type AllBridgeRestClient

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

func NewAllBridgeRestClient

func NewAllBridgeRestClient(baseURL string, logger *zap.Logger, httpClient commons.HttpDo) *AllBridgeRestClient

func (*AllBridgeRestClient) GetActivity

func (d *AllBridgeRestClient) GetActivity(ctx context.Context, from, to time.Time) (ProtocolActivity, error)

func (*AllBridgeRestClient) GetStats

func (d *AllBridgeRestClient) GetStats(ctx context.Context) (Stats, error)

func (*AllBridgeRestClient) ProtocolName

func (d *AllBridgeRestClient) ProtocolName() string

type MayanRestClient

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

func NewMayanRestClient

func NewMayanRestClient(baseURL string, logger *zap.Logger, httpClient commons.HttpDo) *MayanRestClient

func (*MayanRestClient) GetActivity

func (d *MayanRestClient) GetActivity(ctx context.Context, from, to time.Time) (ProtocolActivity, error)

func (*MayanRestClient) GetStats

func (d *MayanRestClient) GetStats(ctx context.Context) (Stats, error)

func (*MayanRestClient) ProtocolName

func (d *MayanRestClient) ProtocolName() string

type ProtocolActivity

type ProtocolActivity struct {
	TotalValueSecure      float64    `json:"total_value_secure"`
	TotalValueTransferred float64    `json:"total_value_transferred"`
	Volume                float64    `json:"volume"`
	TotalMessages         uint64     `json:"total_messages"`
	Activities            []Activity `json:"activity"`
}

type ProtocolRepository

type ProtocolRepository interface {
	GetActivity(ctx context.Context, from, to time.Time) (ProtocolActivity, error)
	GetStats(ctx context.Context) (Stats, error)
	ProtocolName() string
}

type Stats

type Stats struct {
	TotalValueLocked float64 `json:"total_value_locked"`
	TotalMessages    uint64  `json:"total_messages"`
	Volume           float64 `json:"volume"`
}

Jump to

Keyboard shortcuts

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