Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("not found")
Functions ¶
This section is empty.
Types ¶
type BurnEvent ¶ added in v1.4.0
type BurnEvent interface { // ProcessEvent processes the burn event by submitting the appropriate // scheduled transaction, leaving the synchronization of the actual transfer on HCS ProcessEvent(transfer transfer.Transfer) // TransactionID returns the corresponding Scheduled Transaction paying out the // fees to validators and the amount being bridged to the receiver address TransactionID(id string) (string, error) }
BurnEvent is the major service used for processing BurnEvent operations
type Contracts ¶
type Contracts interface { // Address returns the address of the contract instance Address() common.Address // GetMembers returns the array of bridge members currently set in the Bridge contract GetMembers() []string // ReloadMembers triggers to fetch all the members from the Router Contract ReloadMembers() // GetClient returns the Contracts Service corresponding EVM Client GetClient() client.Core // IsMember returns true/false depending on whether the provided address is a Bridge member or not IsMember(address string) bool // HasValidSignaturesLength returns whether the signatures are enough for submission HasValidSignaturesLength(*big.Int) (bool, error) // ParseBurnLog parses a general typed log to a RouterBurn event ParseBurnLog(log types.Log) (*abi.RouterBurn, error) // ParseLockLog parses a general typed log to a RouterLock event ParseLockLog(log types.Log) (*abi.RouterLock, error) // WatchBurnEventLogs creates a subscription for Burn Events emitted in the Bridge contract WatchBurnEventLogs(opts *bind.WatchOpts, sink chan<- *abi.RouterBurn) (event.Subscription, error) // WatchLockEventLogs creates a subscription for Lock Events emitted in the Bridge contract WatchLockEventLogs(opts *bind.WatchOpts, sink chan<- *abi.RouterLock) (event.Subscription, error) // AddDecimals adjusts the decimals in the native and wrapped tokens when their decimals do not match and one of them is over 8 AddDecimals(amount *big.Int, asset string) (*big.Int, error) // RemoveDecimals adjusts the decimals in the native and wrapped tokens when their decimals do not match and one of them is over 8 RemoveDecimals(amount *big.Int, asset string) (*big.Int, error) }
Contracts interface is implemented by the Contracts Service providing business logic access to the EVM SmartContracts and other related utility functions
type Distributor ¶ added in v1.4.0
type Distributor interface { // PrepareTransfers Returns an equally divided array of transfers to each member PrepareTransfers(fee int64, token string) ([]model.Transfer, error) // CalculateMemberDistribution Returns an equally divided to each member CalculateMemberDistribution(validFee int64) ([]transfer.Hedera, error) // ValidAmount Returns the closest amount, which can be equally divided to members ValidAmount(amount int64) int64 }
Distributor interface is implemented by the Distributor Service Handles distribution of proportional amounts to members
type Fee ¶ added in v1.4.0
type Fee interface { // CalculateFee calculates the fee and remainder of a given amount, based on a specified token fee percentage CalculateFee(token string, amount int64) (fee, remainder int64) }
Fee interface is implemented by the Calculator Service
type LockEvent ¶ added in v1.4.0
type LockEvent interface { // ProcessEvent processes the lock event by submitting the appropriate // Scheduled Token Mint and Transfer transactions ProcessEvent(event transfer.Transfer) }
LockEvent is the major service used for processing BurnEvent operations
type Messages ¶
type Messages interface { // SanityCheckSignature performs any validation required prior handling the topic message // (verifies metadata against the corresponding Transaction record) SanityCheckSignature(tm message.Message) (bool, error) // ProcessSignature processes the signature message, verifying and updating all necessary fields in the DB ProcessSignature(tm message.Message) error // SignMessage signs a message based on Transfer SignMessage(transfer model.Transfer) (*message.Message, error) }
type ReadOnly ¶ added in v1.4.0
type ReadOnly interface { FindTransfer(transferID string, fetch func() (*mirror_node.Response, error), save func(transactionID, scheduleID, status string) error) FindAssetTransfer(transferID string, asset string, transfers []model.Hedera, fetch func() (*mirror_node.Response, error), save func(transactionID, scheduleID, status string) error) }
type Scheduled ¶ added in v1.4.0
type Scheduled interface { // ExecuteScheduledTransferTransaction submits a scheduled transfer transaction and executes provided functions when necessary ExecuteScheduledTransferTransaction(id, asset string, transfers []transfer.Hedera, onExecutionSuccess func(transactionID, scheduleID string), onExecutionFail, onSuccess, onFail func(transactionID string)) // ExecuteScheduledMintTransaction submits a scheduled mint transaction and executes provided functions when necessary ExecuteScheduledMintTransaction(id, asset string, amount int64, status *chan string, onExecutionSuccess func(transactionID, scheduleID string), onExecutionFail, onSuccess, onFail func(transactionID string)) // ExecuteScheduledBurnTransaction submits a scheduled burn transaction and executes provided functions when necessary ExecuteScheduledBurnTransaction(id, asset string, amount int64, status *chan string, onExecutionSuccess func(transactionID, scheduleID string), onExecutionFail, onSuccess, onFail func(transactionID string)) }
Scheduled interface is implemented by the Scheduled Service Provides business logic for execution of Scheduled Transactions
type TransferData ¶
type TransferData struct { Recipient string `json:"recipient"` RouterAddress string `json:"routerAddress"` Amount string `json:"amount"` SourceChainId int64 `json:"sourceChainId"` TargetChainId int64 `json:"targetChainId"` SourceAsset string `json:"sourceAsset"` NativeAsset string `json:"nativeAsset"` TargetAsset string `json:"wrappedAsset"` Signatures []string `json:"signatures"` Majority bool `json:"majority"` }
type Transfers ¶
type Transfers interface { // SanityCheckTransfer performs any validation required prior to handling the transaction // (memo, state proof verification) SanityCheckTransfer(tx model.Transaction) (int64, string, error) // InitiateNewTransfer Stores the incoming transfer message into the Database // aware of already processed transfers InitiateNewTransfer(tm transfer.Transfer) (*entity.Transfer, error) // ProcessNativeTransfer processes the native transfer message by signing the required // authorisation signature submitting it into the required HCS Topic ProcessNativeTransfer(tm transfer.Transfer) error // ProcessWrappedTransfer processes the wrapped transfer message by signing the required // authorisation signature submitting it into the required HCS Topic ProcessWrappedTransfer(tm transfer.Transfer) error // TransferData returns from the database the given transfer, its signatures and // calculates if its messages have reached super majority TransferData(txId string) (TransferData, error) }
Transfers is the major service used for processing Transfers operations