eth

package
v0.0.0-...-11a4fed Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2023 License: LGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const ClaimEventName = "Claimed"
View Source
const HTLTEventName = "HTLT"

Variables

View Source
var ClaimEventHash = common.HexToHash("0x9f46b1606087bdf4183ec7dfdbe68e4ab9129a6a37901c16a7b320ae11a96018")
View Source
var HTLTEventHash = common.HexToHash("0xb3e26d98380491276a8dce9d38fd1049e89070230ff5f36ebb55ead64500ade1")
View Source
var RefundEventHash = common.HexToHash("0x04eb8ae268f23cfe2f9d72fa12367b104af16959f6a93530a4cc0f50688124f9")

Functions

func CalculateSwapID

func CalculateSwapID(randomNumberHash []byte, sender []byte, senderOtherChain []byte) []byte

Types

type ClaimEvent

type ClaimEvent struct {
	MsgSender        common.Address
	RecipientAddr    common.Address
	SwapId           common.Hash
	RandomNumberHash common.Hash
	RandomNumber     common.Hash
}

func (ClaimEvent) ToTxLog

func (ev ClaimEvent) ToTxLog() *store.TxLog

type ContractEvent

type ContractEvent interface {
	ToTxLog() *store.TxLog
}

func ParseClaimEvent

func ParseClaimEvent(abi *abi.ABI, log *types.Log) (ContractEvent, error)

func ParseEvent

func ParseEvent(abi *abi.ABI, log *types.Log) (ContractEvent, error)

func ParseHTLTEvent

func ParseHTLTEvent(abi *abi.ABI, log *types.Log) (ContractEvent, error)

func ParseRefundEvent

func ParseRefundEvent(log *types.Log) (ContractEvent, error)

type ContractType

type ContractType int

type Erc20Executor

type Erc20Executor struct {
	Abi               abi.ABI
	Provider          string
	Config            *util.Config
	Client            *ethclient.Client
	SwapContractAddr  common.Address
	TokenContractAddr common.Address
}

func NewErc20Executor

func NewErc20Executor(provider string, contractAddress common.Address, cfg *util.Config) *Erc20Executor

func (*Erc20Executor) Allowance

func (executor *Erc20Executor) Allowance() (*big.Int, error)

func (*Erc20Executor) CalcSwapId

func (executor *Erc20Executor) CalcSwapId(randomNumberHash common.Hash, sender string, senderOtherChain string) ([]byte, error)

func (*Erc20Executor) Claim

func (executor *Erc20Executor) Claim(swapId common.Hash, randomNumber common.Hash) (string, *dc.Error)

func (*Erc20Executor) Claimable

func (executor *Erc20Executor) Claimable(swapId common.Hash) (bool, error)

func (*Erc20Executor) Erc20Balance

func (executor *Erc20Executor) Erc20Balance(address common.Address) (*big.Int, error)

func (*Erc20Executor) EthBalance

func (executor *Erc20Executor) EthBalance(address common.Address) (*big.Int, error)

func (*Erc20Executor) GetBalance

func (executor *Erc20Executor) GetBalance(addressString string) (*big.Int, error)

func (*Erc20Executor) GetBalanceAlertMsg

func (executor *Erc20Executor) GetBalanceAlertMsg() (string, error)

func (*Erc20Executor) GetBlockAndTxs

func (executor *Erc20Executor) GetBlockAndTxs(height int64) (*dc.BlockAndTxLogs, error)

func (*Erc20Executor) GetChain

func (executor *Erc20Executor) GetChain() string

func (*Erc20Executor) GetColdWalletAddress

func (executor *Erc20Executor) GetColdWalletAddress() string

func (*Erc20Executor) GetDeputyAddress

func (executor *Erc20Executor) GetDeputyAddress() string

func (*Erc20Executor) GetFetchInterval

func (executor *Erc20Executor) GetFetchInterval() time.Duration

func (*Erc20Executor) GetHTLTEvent

func (executor *Erc20Executor) GetHTLTEvent(swapId common.Hash) (*HTLTEvent, error)

func (*Erc20Executor) GetHeight

func (executor *Erc20Executor) GetHeight() (int64, error)

func (*Erc20Executor) GetLogs

func (executor *Erc20Executor) GetLogs(blockHash common.Hash) ([]*store.TxLog, error)

func (*Erc20Executor) GetSentTxStatus

func (executor *Erc20Executor) GetSentTxStatus(hash string) store.TxStatus

func (*Erc20Executor) GetStatus

func (executor *Erc20Executor) GetStatus() (interface{}, error)

func (*Erc20Executor) GetSwap

func (executor *Erc20Executor) GetSwap(swapId common.Hash) (*dc.SwapRequest, error)

func (*Erc20Executor) GetTransactor

func (executor *Erc20Executor) GetTransactor() (*bind.TransactOpts, error)

func (*Erc20Executor) HTLT

func (executor *Erc20Executor) HTLT(randomNumberHash common.Hash, timestamp int64, heightSpan int64, recipientAddr string, otherChainSenderAddr string, otherChainRecipientAddr string, outAmount *big.Int) (string, *dc.Error)

func (*Erc20Executor) HasSwap

func (executor *Erc20Executor) HasSwap(swapId common.Hash) (bool, error)

func (*Erc20Executor) IsSameAddress

func (executor *Erc20Executor) IsSameAddress(addrA string, addrB string) bool

func (*Erc20Executor) Refund

func (executor *Erc20Executor) Refund(swapId common.Hash) (string, *dc.Error)

func (*Erc20Executor) Refundable

func (executor *Erc20Executor) Refundable(swapId common.Hash) (bool, error)

func (*Erc20Executor) SendAmount

func (executor *Erc20Executor) SendAmount(address string, amount *big.Int) (string, error)

type EthExecutor

type EthExecutor struct {
	Abi              abi.ABI
	Provider         string
	Config           *util.EthConfig
	Client           *ethclient.Client
	SwapContractAddr common.Address
}

func NewEthExecutor

func NewEthExecutor(provider string, contractAddress common.Address, cfg *util.EthConfig) *EthExecutor

func (*EthExecutor) CalcSwapId

func (executor *EthExecutor) CalcSwapId(randomNumberHash common.Hash, sender string, senderOtherChain string) ([]byte, error)

func (*EthExecutor) Claim

func (executor *EthExecutor) Claim(swapId common.Hash, randomNumber common.Hash) (string, *dc.Error)

func (*EthExecutor) Claimable

func (executor *EthExecutor) Claimable(swapId common.Hash) (bool, error)

func (*EthExecutor) EthBalance

func (executor *EthExecutor) EthBalance(address common.Address) (*big.Int, error)

func (*EthExecutor) GetBalance

func (executor *EthExecutor) GetBalance(addressString string) (*big.Int, error)

func (*EthExecutor) GetBalanceAlertMsg

func (executor *EthExecutor) GetBalanceAlertMsg() (string, error)

func (*EthExecutor) GetBlockAndTxs

func (executor *EthExecutor) GetBlockAndTxs(height int64) (*dc.BlockAndTxLogs, error)

func (*EthExecutor) GetChain

func (executor *EthExecutor) GetChain() string

func (*EthExecutor) GetColdWalletAddress

func (executor *EthExecutor) GetColdWalletAddress() string

func (*EthExecutor) GetDeputyAddress

func (executor *EthExecutor) GetDeputyAddress() string

func (*EthExecutor) GetFetchInterval

func (executor *EthExecutor) GetFetchInterval() time.Duration

func (*EthExecutor) GetHTLTEvent

func (executor *EthExecutor) GetHTLTEvent(swapId common.Hash) (*HTLTEvent, error)

func (*EthExecutor) GetHeight

func (executor *EthExecutor) GetHeight() (int64, error)

func (*EthExecutor) GetLogs

func (executor *EthExecutor) GetLogs(blockHash common.Hash) ([]*store.TxLog, error)

func (*EthExecutor) GetSentTxStatus

func (executor *EthExecutor) GetSentTxStatus(hash string) store.TxStatus

func (*EthExecutor) GetStatus

func (executor *EthExecutor) GetStatus() (interface{}, error)

func (*EthExecutor) GetSwap

func (executor *EthExecutor) GetSwap(swapId common.Hash) (*dc.SwapRequest, error)

func (*EthExecutor) GetTransactor

func (executor *EthExecutor) GetTransactor() (*bind.TransactOpts, error)

func (*EthExecutor) HTLT

func (executor *EthExecutor) HTLT(randomNumberHash common.Hash, timestamp int64, heightSpan int64, recipientAddr string, otherChainSenderAddr string, otherChainRecipientAddr string, outAmount *big.Int) (string, *dc.Error)

func (*EthExecutor) HasSwap

func (executor *EthExecutor) HasSwap(swapId common.Hash) (bool, error)

func (*EthExecutor) IsSameAddress

func (executor *EthExecutor) IsSameAddress(addrA string, addrB string) bool

func (*EthExecutor) Refund

func (executor *EthExecutor) Refund(swapId common.Hash) (string, *dc.Error)

func (*EthExecutor) Refundable

func (executor *EthExecutor) Refundable(swapId common.Hash) (bool, error)

func (*EthExecutor) SendAmount

func (executor *EthExecutor) SendAmount(address string, amount *big.Int) (string, error)

type HTLTEvent

type HTLTEvent struct {
	MsgSender        common.Address
	RecipientAddr    common.Address
	SwapId           common.Hash
	RandomNumberHash common.Hash
	Timestamp        uint64
	Bep2Addr         common.Address
	ExpireHeight     *big.Int
	OutAmount        *big.Int
	Bep2Amount       *big.Int
}

func (HTLTEvent) ToTxLog

func (ev HTLTEvent) ToTxLog() *store.TxLog

type RefundEvent

type RefundEvent struct {
	MsgSender        common.Address
	RecipientAddr    common.Address
	SwapId           common.Hash
	RandomNumberHash common.Hash
}

func (RefundEvent) ToTxLog

func (ev RefundEvent) ToTxLog() *store.TxLog

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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