Documentation ¶
Index ¶
- Constants
- Variables
- func DefaultOracleHandler(m *Oracle, currentBlock *big.Int) error
- func PreSendTx(idx int, selfChainId, toChainID uint64, blockNumber *big.Int, orderId []byte) (int64, error)
- func Request(urlPath string) (interface{}, error)
- func SetupBlockStore(cfg *Config, role mapprotocol.Role) (*blockstore.Blockstore, error)
- type AssembleProof
- type Chain
- type CommonSync
- func (c *CommonSync) BuildQuery(contract ethcommon.Address, sig []constant.EventSig, startBlock *big.Int, ...) eth.FilterQuery
- func (c *CommonSync) FilterLatestBlock() (*big.Int, error)
- func (c *CommonSync) GetMethod(topic ethcommon.Hash) string
- func (c *CommonSync) Match(target string) int
- func (c *CommonSync) SetRouter(r chains.Router)
- func (c *CommonSync) WaitUntilMsgHandled(counter int) error
- type Config
- type Maintainer
- type Messenger
- type Mos
- type MulSignInfoResp
- type Oracle
- type OracleHandler
- type OrderStatusResp
- type ProposalInfoResp
- type SyncHeader2Map
- type SyncOpt
- type Writer
Constants ¶
View Source
const ( DefaultGasLimit = 1000000 DefaultGasPrice = 50000000 DefaultBlockConfirmations = 10 DefaultGasMultiplier = 1 )
Variables ¶
View Source
var ( OrderExist = errors.New("order exist") NotVerifyAble = errors.New("not verify able") ContractNotExist = errors.New("contract not exist") )
View Source
var ( McsOpt = "mcs" TronMcsOpt = "tronmcs" MaxGasPriceOpt = "maxGasPrice" GasLimitOpt = "gasLimit" GasMultiplier = "gasMultiplier" LimitMultiplier = "limitMultiplier" HttpOpt = "http" StartBlockOpt = "startBlock" BlockConfirmationsOpt = "blockConfirmations" SyncToMap = "syncToMap" SyncIDList = "syncIdList" LightNode = "lightnode" Event = "event" Eth2Url = "eth2Url" RedisOpt = "redis" ApiUrl = "apiUrl" OracleNode = "oracleNode" RentNode = "rentNode" EthFrom = "ethFrom" FeeKey = "feeKey" FeeType = "feeType" )
Chain specific options
Functions ¶
func DefaultOracleHandler ¶ added in v1.2.0
func SetupBlockStore ¶
func SetupBlockStore(cfg *Config, role mapprotocol.Role) (*blockstore.Blockstore, error)
Types ¶
type AssembleProof ¶ added in v1.2.0
type Chain ¶
type Chain struct {
// contains filtered or unexported fields
}
func New ¶
func New(chainCfg *core.ChainConfig, logger log15.Logger, sysErr chan<- error, role mapprotocol.Role, createConn core.CreateConn, opts ...SyncOpt) (*Chain, error)
func (*Chain) Conn ¶
func (c *Chain) Conn() core.Connection
Conn return Connection interface for relayer register
type CommonSync ¶
type CommonSync struct { Cfg Config Conn core.Connection Log log15.Logger Router chains.Router Stop <-chan int MsgCh chan struct{} SysErr chan<- error // Reports fatal error to core BlockConfirmations *big.Int BlockStore blockstore.Blockstorer // contains filtered or unexported fields }
func NewCommonSync ¶
func NewCommonSync(conn core.Connection, cfg *Config, log log15.Logger, stop <-chan int, sysErr chan<- error, bs blockstore.Blockstorer, opts ...SyncOpt) *CommonSync
NewCommonSync creates and returns a listener
func (*CommonSync) BuildQuery ¶
func (c *CommonSync) BuildQuery(contract ethcommon.Address, sig []constant.EventSig, startBlock *big.Int, endBlock *big.Int) eth.FilterQuery
BuildQuery constructs a query for the bridgeContract by hashing sig to get the event topic
func (*CommonSync) FilterLatestBlock ¶ added in v1.2.2
func (c *CommonSync) FilterLatestBlock() (*big.Int, error)
func (*CommonSync) Match ¶ added in v1.2.2
func (c *CommonSync) Match(target string) int
func (*CommonSync) SetRouter ¶
func (c *CommonSync) SetRouter(r chains.Router)
func (*CommonSync) WaitUntilMsgHandled ¶
func (c *CommonSync) WaitUntilMsgHandled(counter int) error
WaitUntilMsgHandled this function will block untill message is handled
type Config ¶
type Config struct { Name string // Human-readable chain name Id msg.ChainId // ChainID Endpoint string // url for rpc endpoint From string // address of key to use KeystorePath string // Location of keyfiles BlockstorePath string FreshStart bool // Disables loading from blockstore at start McsContract []common.Address GasLimit *big.Int MaxGasPrice *big.Int GasMultiplier float64 LimitMultiplier float64 Http bool // Config for type of connection StartBlock *big.Int BlockConfirmations *big.Int SyncToMap bool // Whether sync blockchain headers to Map MapChainID msg.ChainId SyncChainIDList []msg.ChainId // chain ids which map sync to LightNode common.Address // the lightnode to sync header SyncMap map[msg.ChainId]*big.Int Events []constant.EventSig SkipError bool Eth2Endpoint string ApiUrl string OracleNode common.Address TronContract []common.Address Filter bool FilterHost string }
Config encapsulates all necessary parameters in ethereum compatible forms
func ParseConfig ¶
func ParseConfig(chainCfg *core.ChainConfig) (*Config, error)
ParseConfig uses a core.ChainConfig to construct a corresponding Config
type Maintainer ¶
type Maintainer struct { *CommonSync // contains filtered or unexported fields }
func NewMaintainer ¶
func NewMaintainer(cs *CommonSync) *Maintainer
func (*Maintainer) Sync ¶
func (m *Maintainer) Sync() error
type Messenger ¶
type Messenger struct {
*CommonSync
}
func NewMessenger ¶
func NewMessenger(cs *CommonSync) *Messenger
type MulSignInfoResp ¶ added in v1.2.2
func MulSignInfo ¶ added in v1.2.2
func MulSignInfo(idx int, selfChainId, toChainID uint64) (*MulSignInfoResp, error)
type Oracle ¶ added in v1.2.0
type Oracle struct {
*CommonSync
}
func NewOracle ¶ added in v1.2.0
func NewOracle(cs *CommonSync) *Oracle
type OrderStatusResp ¶ added in v1.2.0
func OrderStatus ¶ added in v1.2.0
type ProposalInfoResp ¶ added in v1.2.2
func ProposalInfo ¶ added in v1.2.2
type SyncHeader2Map ¶
type SyncHeader2Map func(*Maintainer, *big.Int) error
type SyncOpt ¶
type SyncOpt func(*CommonSync)
func OptOfAssembleProof ¶ added in v1.2.0
func OptOfAssembleProof(fn AssembleProof) SyncOpt
func OptOfInitHeight ¶
func OptOfOracleHandler ¶ added in v1.2.0
func OptOfOracleHandler(fn OracleHandler) SyncOpt
func OptOfSync2Map ¶
func OptOfSync2Map(fn SyncHeader2Map) SyncOpt
Click to show internal directories.
Click to hide internal directories.