mirror of
https://github.com/luxfi/bridge.git
synced 2026-09-24 00:26:46 +00:00
- opnet-watcher: universal binary with plugin architecture - 3 functional plugins (OP_NET, Solana, TON) - Generic EVMPlugin handles all EVM chains (Ethereum, Base, Arbitrum, etc.) - 17 non-EVM chain stubs (Sui, NEAR, Cosmos, XRPL, ICP, etc.) - Threshold signing via luxfi/crypto (CGGMP21/FROST) - Separate txSigner hot wallet for on-chain submission - Multi-tenant API with hostname-based routing - Confirmation depth, backing sanity checks, EIP-155 local signing - manifests: 32 chain configs + 5 tenant configs (lux, zoo, hanzo, pars, spc) - k8s: fix chain IDs 1330663759→4294967299, ClusterIP services, KMS secrets - CI: conformance tests gate production deployment
41 lines
1.7 KiB
Go
41 lines
1.7 KiB
Go
// Copyright (C) 2025, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package plugins
|
|
|
|
import (
|
|
"context"
|
|
"math/big"
|
|
)
|
|
|
|
// DepositEvent is the canonical deposit event format emitted by all source-chain adapters.
|
|
// Maps 1:1 to Teleporter.mintDeposit parameters on Lux C-Chain.
|
|
type DepositEvent struct {
|
|
SrcChainID uint64 // Source chain identifier (OPNET=4294967299, SOLANA=1399811149, TON=1414483791)
|
|
Nonce uint64 // Monotonic deposit nonce on source chain
|
|
Recipient [20]byte // Lux C-Chain recipient address (EVM)
|
|
Amount *big.Int // Deposit amount in source chain native units
|
|
TxID string // Source chain transaction identifier
|
|
BlockHeight uint64 // Source chain block/slot height
|
|
}
|
|
|
|
// ChainPlugin abstracts a source-chain block indexer for the Teleport bridge watcher.
|
|
// Each implementation polls its chain for deposit events and converts them to the
|
|
// canonical format consumed by the signer and relay pipeline.
|
|
type ChainPlugin interface {
|
|
// Name returns a human-readable identifier (e.g., "opnet", "solana", "ton").
|
|
Name() string
|
|
|
|
// ChainID returns the Teleporter chain identifier for this source chain.
|
|
ChainID() uint64
|
|
|
|
// PollDeposits fetches deposit events from fromSlot onward.
|
|
// Returns events found and the latest processed slot/block height.
|
|
// The watcher calls this on each tick interval.
|
|
PollDeposits(ctx context.Context, fromSlot uint64) ([]DepositEvent, uint64, error)
|
|
|
|
// QueryBacking returns the total value locked in the bridge contract on this chain.
|
|
// Used for periodic backing attestations to Teleporter.updateBacking.
|
|
QueryBacking(ctx context.Context) (*big.Int, error)
|
|
}
|