radix

package
v1.114.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OneOnRadix    = 1000000000000000000
	OneOnMaya     = common.One
	ScalingFactor = OneOnRadix / OneOnMaya
)

Variables

View Source
var (
	XrdFeeEstimateInRadixSubunits = cosmos.NewUint(5000000000000000000) // 5 XRD
	XrdFeeEstimateInMayaSubunits  = XrdSubunitsToMayaRoundingDown(XrdFeeEstimateInRadixSubunits)
)

Functions

func CreateRadixCoreApiClient

func CreateRadixCoreApiClient(baseUrl string) (*apiclient.RadixCoreApiClient, error)

func GetTotalTxnFee

func GetTotalTxnFee(receipt models.TransactionReceiptable) (common.Gas, error)

func MayaSubunitsToXrd

func MayaSubunitsToXrd(value cosmos.Uint) cosmos.Uint

func XrdSubunitsToMayaRoundingDown

func XrdSubunitsToMayaRoundingDown(value cosmos.Uint) cosmos.Uint

XrdSubunitsToMayaRoundingDown Returns the value converted from Radix (18 decimals) to Maya (8 decimals) rounded down, if needed. This is used for conversions that affect deposits from vault accounts, so that the protocol's books are always less or equal to the actual balance on-chain.

func XrdSubunitsToMayaRoundingUp

func XrdSubunitsToMayaRoundingUp(value cosmos.Uint) cosmos.Uint

XrdSubunitsToMayaRoundingUp Returns the value converted from Radix (18 decimals) to Maya (8 decimals) rounded up, if needed. This is used for conversions that affect withdrawals from vault accounts (incl. fee payments), so that the protocol's books are always less or equal to the actual balance on-chain.

Types

type Client

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

func NewClient

func NewClient(
	mayaKeys *mayaclient.Keys,
	cfg config.BifrostChainConfiguration,
	tssServer *tssp.TssServer,
	mayaBridge mayaclient.MayachainBridge,
	metrics *metrics.Metrics,
	pubKeyValidator pubkeymanager.PubKeyValidator,
) (*Client, error)

func (*Client) BroadcastTx

func (c *Client) BroadcastTx(txOutItem stypes.TxOutItem, notarizedTransactionBytes []byte) (string, error)

func (*Client) ConfirmationCountReady

func (c *Client) ConfirmationCountReady(txIn stypes.TxIn) bool

func (*Client) GetAccount

func (c *Client) GetAccount(pkey common.PubKey, height *big.Int) (common.Account, error)

func (*Client) GetAccountByAddress

func (c *Client) GetAccountByAddress(address string, height *big.Int) (common.Account, error)

func (*Client) GetAddress

func (c *Client) GetAddress(poolPubKey common.PubKey) string

func (*Client) GetBlockScannerHeight

func (c *Client) GetBlockScannerHeight() (int64, error)

func (*Client) GetChain

func (c *Client) GetChain() common.Chain

func (*Client) GetConfig

func (c *Client) GetConfig() config.BifrostChainConfiguration

func (*Client) GetConfirmationCount

func (c *Client) GetConfirmationCount(txIn stypes.TxIn) int64

func (*Client) GetHeight

func (c *Client) GetHeight() (int64, error)

func (*Client) GetLatestTxForVault

func (c *Client) GetLatestTxForVault(vault string) (string, string, error)

func (*Client) IsBlockScannerHealthy

func (c *Client) IsBlockScannerHealthy() bool

func (*Client) OnObservedTxIn

func (c *Client) OnObservedTxIn(txIn stypes.TxInItem, blockHeight int64)

func (*Client) ReportSolvency

func (c *Client) ReportSolvency(xrdHeight int64) error

func (*Client) ShouldReportSolvency

func (c *Client) ShouldReportSolvency(xrdHeight int64) bool

func (*Client) SignTx

func (c *Client) SignTx(tx stypes.TxOutItem, height int64) ([]byte, []byte, *stypes.TxInItem, error)

func (*Client) Start

func (c *Client) Start(globalTxsQueue chan stypes.TxIn, globalErrataQueue chan stypes.ErrataBlock, globalSolvencyQueue chan stypes.Solvency)

func (*Client) Stop

func (c *Client) Stop()

type RadixScanner

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

func NewRadixScanner

func NewRadixScanner(
	cfg config.BifrostBlockScannerConfiguration,
	scannerStorage blockscanner.ScannerStorage,
	coreApiWrapper *coreapi.CoreApiWrapper,
	mayaBridge mayaclient.MayachainBridge,
	metrics *metrics.Metrics,
	pubKeyValidator pubkeymanager.PubKeyValidator,
	network types.Network,
	xrdAddress string,
) (*RadixScanner, error)

func (*RadixScanner) FetchMemPool

func (e *RadixScanner) FetchMemPool(_ int64) (stypes.TxIn, error)

func (*RadixScanner) FetchTxs

func (e *RadixScanner) FetchTxs(fetchHeight, chainHeight int64) (stypes.TxIn, error)

func (*RadixScanner) GetHeight

func (e *RadixScanner) GetHeight() (int64, error)

type SignerHelper

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

func NewSignerHelper

func NewSignerHelper(privateKey *ecdsa.PrivateKey, pubKey common.PubKey, keyManager tss.ThorchainKeyManager, mayaBridge mayaclient.MayachainBridge) *SignerHelper

func (*SignerHelper) Sign

func (h *SignerHelper) Sign(txOutItem stypes.TxOutItem, signedIntent *ret.SignedIntent, poolPubKey common.PubKey, mayaHeight int64) (*ret.NotarizedTransaction, error)

type SolvencyReporter

type SolvencyReporter func(int64) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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