tron

package
v0.0.0-...-e30b66f Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 License: GPL-3.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultBlockConfirmations = 12
View Source
const DefaultGasLimit = 6721975
View Source
const DefaultGasPrice = 10000000000
View Source
const ExecuteBlockWatchLimit = 100

Number of blocks to wait for an finalization event

View Source
const TxRetryInterval = time.Second * 2

Time between retrying a failed tx

View Source
const TxRetryLimit = 10

Maximum number of tx retries before exiting

View Source
const UpdateEthGasPriceInterval = time.Minute * 5

Update eth gas price interval

Variables

View Source
var (
	BridgeOpt = "bridge"

	MaxGasPriceOpt         = "maxGasPrice"
	GasLimitOpt            = "gasLimit"
	StartBlockOpt          = "startBlock"
	BlockConfirmationsOpt  = "blockConfirmations"
	CommitVotesStartSeqOpt = "commitVotesStartSeq"
)

Chain specific options

View Source
var BlockRetryInterval = time.Second * 10
View Source
var CancelledStatus uint8 = 4
View Source
var ErrFatalQuery = errors.New("query of chain state failed")
View Source
var ErrFatalTx = errors.New("submission of transaction failed")
View Source
var ErrNonceTooLow = errors.New("nonce too low")
View Source
var ErrTxUnderpriced = errors.New("replacement transaction underpriced")
View Source
var PassedStatus uint8 = 2
View Source
var TransferredStatus uint8 = 3
View Source
var WatchDuration = 60 * 30 // 30 Minute

Functions

func ConstructTrc20ProposalDataHash

func ConstructTrc20ProposalDataHash(handler string, recipient []byte, amount *big.Int) [32]byte

func GetBridgeChainId

func GetBridgeChainId(client *tron.GrpcClient, brigeAddress string) (uint8, error)

func IsTriggerSmartContract

func IsTriggerSmartContract(tx api.TransactionExtention) bool

func NewListener

func NewListener(conn Connection, chainDB *chains.ChainDB, cfg *Config, log log.Logger, stop <-chan int, sysErr chan<- error, m *metrics.ChainMetrics) *listener

NewListener creates and returns a listener

func NewWriter

func NewWriter(conn Connection, cfg *Config, log log.Logger, stop <-chan int, sysErr chan<- error, m *metrics.ChainMetrics) *writer

NewWriter creates and returns writer

func ParseNumericProperty

func ParseNumericProperty(data string) (*big.Int, error)

func ParseStringProperty

func ParseStringProperty(data string) (string, error)

func TriggerContract

func TriggerContract(client *tron.GrpcClient, from, contractAddress, method, jsonString string,
	feeLimit, tAmount int64, tTokenID string, tTokenAmount int64) (*api.TransactionExtention, error)

TriggerContract and return tx result

Types

type Chain

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

func InitializeChain

func InitializeChain(chainCfg *core.ChainConfig, chainDB *chains.ChainDB, logger log.Logger, sysErr chan<- error, m *metrics.ChainMetrics) (*Chain, core.ProposalState, error)

func (*Chain) Id

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

func (*Chain) LatestBlock

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

func (*Chain) Name

func (c *Chain) Name() string

func (*Chain) SetState

func (c *Chain) SetState(state map[types.ChainId]core.ProposalState)

func (*Chain) Start

func (c *Chain) Start() error

func (*Chain) Stop

func (c *Chain) Stop()

Stop signals to any running routines to exit

type Config

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

Config encapsulates all necessary parameters in ethereum compatible forms

type Connection

type Connection interface {
	Connect() error
	Keypair() *secp256k1.Keypair
	Client() *tron.GrpcClient
	EnsureHasBytecode(constractAddrss string) error
	LatestBlock() (*big.Int, error)
	WaitForBlock(block *big.Int) error
	Close()
}

Jump to

Keyboard shortcuts

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