Documentation ¶
Index ¶
- Constants
- Variables
- type Bridge
- type CBridge
- func (s *CBridge) CalculateAmountOut(from, to *params.Network, amountIn *big.Int, symbol string) (*big.Int, error)
- func (s *CBridge) CalculateFees(from, to *params.Network, token *token.Token, amountIn *big.Int, ...) (*big.Int, *big.Int, error)
- func (s *CBridge) Can(from, to *params.Network, token *token.Token, balance *big.Int) (bool, error)
- func (s *CBridge) EstimateGas(from, to *params.Network, token *token.Token, amountIn *big.Int) (uint64, error)
- func (s *CBridge) GetContractAddress(network *params.Network, token *token.Token) *common.Address
- func (s *CBridge) Name() string
- func (s *CBridge) Send(sendArgs *TransactionBridge, verifiedAccount *account.SelectedExtKey) (types.Hash, error)
- type CBridgeTxArgs
- type HopBridge
- func (h *HopBridge) CalculateAmountOut(from, to *params.Network, amountIn *big.Int, symbol string) (*big.Int, error)
- func (h *HopBridge) CalculateBonderFees(from, to *params.Network, token *token.Token, amountIn *big.Int, ...) (*big.Int, error)
- func (h *HopBridge) CalculateFees(from, to *params.Network, token *token.Token, amountIn *big.Int, ...) (*big.Int, *big.Int, error)
- func (h *HopBridge) Can(from, to *params.Network, token *token.Token, balance *big.Int) (bool, error)
- func (h *HopBridge) EstimateGas(from, to *params.Network, token *token.Token, amountIn *big.Int) (uint64, error)
- func (h *HopBridge) GetContractAddress(network *params.Network, token *token.Token) *common.Address
- func (h *HopBridge) Name() string
- func (h *HopBridge) Send(sendArgs *TransactionBridge, verifiedAccount *account.SelectedExtKey) (hash types.Hash, err error)
- type HopTxArgs
- type SimpleBridge
- func (s *SimpleBridge) CalculateAmountOut(from, to *params.Network, amountIn *big.Int, symbol string) (*big.Int, error)
- func (s *SimpleBridge) CalculateFees(from, to *params.Network, token *token.Token, amountIn *big.Int, ...) (*big.Int, *big.Int, error)
- func (s *SimpleBridge) Can(from, to *params.Network, token *token.Token, balance *big.Int) (bool, error)
- func (s *SimpleBridge) EstimateGas(from, to *params.Network, token *token.Token, amountIn *big.Int) (uint64, error)
- func (s *SimpleBridge) GetContractAddress(network *params.Network, token *token.Token) *common.Address
- func (s *SimpleBridge) Name() string
- func (s *SimpleBridge) Send(sendArgs *TransactionBridge, verifiedAccount *account.SelectedExtKey) (types.Hash, error)
- type TransactionBridge
Constants ¶
View Source
const HopCanonicalTokenIndex = 0
View Source
const HopLpFeeBps = 4
View Source
const HopMinBonderFeeUsd = 0.25
View Source
const HophTokenIndex = 1
Variables ¶
View Source
var HopBondTransferGasLimit = map[uint64]int64{
1: 165000,
5: 165000,
10: 100000000,
42161: 2500000,
420: 100000000,
421613: 2500000,
}
View Source
var HopBonderFeeBps = map[string]map[uint64]int64{
"USDC": {
1: 14,
5: 14,
10: 14,
42161: 14,
420: 14,
421613: 14,
},
"USDT": {
1: 26,
10: 26,
421613: 26,
},
"DAI": {
1: 26,
10: 26,
42161: 26,
},
"ETH": {
1: 5,
5: 5,
10: 5,
42161: 5,
420: 5,
421613: 5,
},
"WBTC": {
1: 23,
10: 23,
42161: 23,
},
}
View Source
var HopSettlementGasLimitPerTx = map[uint64]int64{
1: 5141,
5: 5141,
10: 8545,
42161: 19843,
420: 8545,
421613: 19843,
}
Functions ¶
This section is empty.
Types ¶
type Bridge ¶
type Bridge interface { Name() string Can(from *params.Network, to *params.Network, token *token.Token, balance *big.Int) (bool, error) CalculateFees(from, to *params.Network, token *token.Token, amountIn *big.Int, nativeTokenPrice, tokenPrice float64, gasPrice *big.Float) (*big.Int, *big.Int, error) EstimateGas(from *params.Network, to *params.Network, token *token.Token, amountIn *big.Int) (uint64, error) CalculateAmountOut(from, to *params.Network, amountIn *big.Int, symbol string) (*big.Int, error) Send(sendArgs *TransactionBridge, verifiedAccount *account.SelectedExtKey) (types.Hash, error) GetContractAddress(network *params.Network, token *token.Token) *common.Address }
type CBridge ¶ added in v0.117.3
type CBridge struct {
// contains filtered or unexported fields
}
func NewCbridge ¶ added in v0.117.3
func NewCbridge(rpcClient *rpc.Client, transactor *transactions.Transactor, tokenManager *token.Manager) *CBridge
func (*CBridge) CalculateAmountOut ¶ added in v0.117.3
func (*CBridge) CalculateFees ¶ added in v0.117.3
func (*CBridge) EstimateGas ¶ added in v0.117.3
func (*CBridge) GetContractAddress ¶ added in v0.125.0
func (*CBridge) Send ¶ added in v0.117.3
func (s *CBridge) Send(sendArgs *TransactionBridge, verifiedAccount *account.SelectedExtKey) (types.Hash, error)
type CBridgeTxArgs ¶ added in v0.117.3
type CBridgeTxArgs struct { transactions.SendTxArgs ChainID uint64 `json:"chainId"` Symbol string `json:"symbol"` Recipient common.Address `json:"recipient"` Amount *hexutil.Big `json:"amount"` }
type HopBridge ¶
type HopBridge struct {
// contains filtered or unexported fields
}
func NewHopBridge ¶
func NewHopBridge(rpcClient *rpc.Client, transactor *transactions.Transactor, tokenManager *token.Manager) *HopBridge
func (*HopBridge) CalculateAmountOut ¶
func (*HopBridge) CalculateBonderFees ¶
func (h *HopBridge) CalculateBonderFees(from, to *params.Network, token *token.Token, amountIn *big.Int, nativeTokenPrice, tokenPrice float64, gasPrice *big.Float) (*big.Int, error)
CalculateBonderFees logics come from: https://docs.hop.exchange/fee-calculation
func (*HopBridge) CalculateFees ¶
func (*HopBridge) EstimateGas ¶
func (*HopBridge) GetContractAddress ¶ added in v0.125.0
func (*HopBridge) Send ¶
func (h *HopBridge) Send(sendArgs *TransactionBridge, verifiedAccount *account.SelectedExtKey) (hash types.Hash, err error)
type HopTxArgs ¶
type HopTxArgs struct { transactions.SendTxArgs ChainID uint64 `json:"chainId"` Symbol string `json:"symbol"` Recipient common.Address `json:"recipient"` Amount *hexutil.Big `json:"amount"` BonderFee *hexutil.Big `json:"bonderFee"` }
type SimpleBridge ¶
type SimpleBridge struct {
// contains filtered or unexported fields
}
func NewSimpleBridge ¶
func NewSimpleBridge(transactor *transactions.Transactor) *SimpleBridge
func (*SimpleBridge) CalculateAmountOut ¶
func (*SimpleBridge) CalculateFees ¶
func (*SimpleBridge) EstimateGas ¶
func (*SimpleBridge) GetContractAddress ¶ added in v0.125.0
func (*SimpleBridge) Name ¶
func (s *SimpleBridge) Name() string
func (*SimpleBridge) Send ¶
func (s *SimpleBridge) Send(sendArgs *TransactionBridge, verifiedAccount *account.SelectedExtKey) (types.Hash, error)
type TransactionBridge ¶
type TransactionBridge struct { BridgeName string ChainID uint64 SimpleTx *transactions.SendTxArgs HopTx *HopTxArgs CbridgeTx *CBridgeTxArgs }
func (*TransactionBridge) Data ¶
func (t *TransactionBridge) Data() types.HexBytes
func (*TransactionBridge) From ¶
func (t *TransactionBridge) From() types.Address
func (*TransactionBridge) To ¶
func (t *TransactionBridge) To() types.Address
func (*TransactionBridge) Value ¶
func (t *TransactionBridge) Value() *big.Int
Click to show internal directories.
Click to hide internal directories.