pathprocessor

package
v0.181.31 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: MPL-2.0 Imports: 49 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IncreaseEstimatedGasFactor = 1.1
	SevenDaysInSeconds         = 60 * 60 * 24 * 7

	EthSymbol  = "ETH"
	SntSymbol  = "SNT"
	SttSymbol  = "STT"
	UsdcSymbol = "USDC"
	HopSymbol  = "HOP"

	ProcessorTransferName     = "Transfer"
	ProcessorBridgeHopName    = "Hop"
	ProcessorBridgeCelerName  = "CBridge"
	ProcessorSwapParaswapName = "Paraswap"
	ProcessorERC721Name       = "ERC721Transfer"
	ProcessorERC1155Name      = "ERC1155Transfer"
	ProcessorENSRegisterName  = "ENSRegister"
	ProcessorENSReleaseName   = "ENSRelease"
	ProcessorENSPublicKeyName = "ENSPublicKey"
	ProcessorStickersBuyName  = "StickersBuy"
)

Variables

View Source
var (
	ZeroAddress     = common.Address{}
	ZeroBigIntValue = big.NewInt(0)
)
View Source
var (
	ErrFailedToParseBaseFee           = &errors.ErrorResponse{Code: errors.ErrorCode("WPP-001"), Details: "failed to parse base fee"}
	ErrFailedToParsePercentageFee     = &errors.ErrorResponse{Code: errors.ErrorCode("WPP-002"), Details: "failed to parse percentage fee"}
	ErrContractNotFound               = &errors.ErrorResponse{Code: errors.ErrorCode("WPP-003"), Details: "contract not found"}
	ErrNetworkNotFound                = &errors.ErrorResponse{Code: errors.ErrorCode("WPP-004"), Details: "network not found"}
	ErrTokenNotFound                  = &errors.ErrorResponse{Code: errors.ErrorCode("WPP-005"), Details: "token not found"}
	ErrNoEstimationFound              = &errors.ErrorResponse{Code: errors.ErrorCode("WPP-006"), Details: "no estimation found"}
	ErrNotAvailableForContractType    = &errors.ErrorResponse{Code: errors.ErrorCode("WPP-007"), Details: "not available for contract type"}
	ErrNoBonderFeeFound               = &errors.ErrorResponse{Code: errors.ErrorCode("WPP-008"), Details: "no bonder fee found"}
	ErrContractTypeNotSupported       = &errors.ErrorResponse{Code: errors.ErrorCode("WPP-009"), Details: "contract type not supported"}
	ErrFromChainNotSupported          = &errors.ErrorResponse{Code: errors.ErrorCode("WPP-010"), Details: "from chain not supported"}
	ErrToChainNotSupported            = &errors.ErrorResponse{Code: errors.ErrorCode("WPP-011"), Details: "to chain not supported"}
	ErrTxForChainNotSupported         = &errors.ErrorResponse{Code: errors.ErrorCode("WPP-012"), Details: "tx for chain not supported"}
	ErrENSResolverNotFound            = &errors.ErrorResponse{Code: errors.ErrorCode("WPP-013"), Details: "ENS resolver not found"}
	ErrENSRegistrarNotFound           = &errors.ErrorResponse{Code: errors.ErrorCode("WPP-014"), Details: "ENS registrar not found"}
	ErrToAndFromTokensMustBeSet       = &errors.ErrorResponse{Code: errors.ErrorCode("WPP-015"), Details: "to and from tokens must be set"}
	ErrCannotResolveTokens            = &errors.ErrorResponse{Code: errors.ErrorCode("WPP-016"), Details: "cannot resolve tokens"}
	ErrPriceRouteNotFound             = &errors.ErrorResponse{Code: errors.ErrorCode("WPP-017"), Details: "price route not found"}
	ErrConvertingAmountToBigInt       = &errors.ErrorResponse{Code: errors.ErrorCode("WPP-018"), Details: "converting amount to big.Int"}
	ErrNoChainSet                     = &errors.ErrorResponse{Code: errors.ErrorCode("WPP-019"), Details: "no chain set"}
	ErrNoTokenSet                     = &errors.ErrorResponse{Code: errors.ErrorCode("WPP-020"), Details: "no token set"}
	ErrToTokenShouldNotBeSet          = &errors.ErrorResponse{Code: errors.ErrorCode("WPP-021"), Details: "to token should not be set"}
	ErrFromAndToChainsMustBeDifferent = &errors.ErrorResponse{Code: errors.ErrorCode("WPP-022"), Details: "from and to chains must be different"}
	ErrFromAndToChainsMustBeSame      = &errors.ErrorResponse{Code: errors.ErrorCode("WPP-023"), Details: "from and to chains must be same"}
	ErrFromAndToTokensMustBeDifferent = &errors.ErrorResponse{Code: errors.ErrorCode("WPP-024"), Details: "from and to tokens must be different"}
)

Abbreviartion `WPP` for the error code stands for `Wallet Path Processor`

Functions

This section is empty.

Types

type BonderFee

type BonderFee struct {
	AmountIn                *bigint.BigInt `json:"amountIn"`
	Slippage                float32        `json:"slippage"`
	AmountOutMin            *bigint.BigInt `json:"amountOutMin"`
	DestinationAmountOutMin *bigint.BigInt `json:"destinationAmountOutMin"`
	BonderFee               *bigint.BigInt `json:"bonderFee"`
	EstimatedRecieved       *bigint.BigInt `json:"estimatedRecieved"`
	Deadline                int64          `json:"deadline"`
	DestinationDeadline     int64          `json:"destinationDeadline"`
}

func (*BonderFee) UnmarshalJSON

func (bf *BonderFee) UnmarshalJSON(data []byte) error

type CelerBridgeProcessor

type CelerBridgeProcessor struct {
	// contains filtered or unexported fields
}

func NewCelerBridgeProcessor

func NewCelerBridgeProcessor(rpcClient *rpc.Client, transactor transactions.TransactorIface, tokenManager *token.Manager) *CelerBridgeProcessor

func (*CelerBridgeProcessor) AvailableFor

func (s *CelerBridgeProcessor) AvailableFor(params ProcessorInputParams) (bool, error)

func (*CelerBridgeProcessor) BuildTransaction

func (s *CelerBridgeProcessor) BuildTransaction(sendArgs *MultipathProcessorTxArgs) (*ethTypes.Transaction, error)

func (*CelerBridgeProcessor) BuildTx

func (*CelerBridgeProcessor) CalculateAmountOut

func (s *CelerBridgeProcessor) CalculateAmountOut(params ProcessorInputParams) (*big.Int, error)

func (*CelerBridgeProcessor) CalculateFees

func (s *CelerBridgeProcessor) CalculateFees(params ProcessorInputParams) (*big.Int, *big.Int, error)

func (*CelerBridgeProcessor) EstimateGas

func (s *CelerBridgeProcessor) EstimateGas(params ProcessorInputParams) (uint64, error)

func (*CelerBridgeProcessor) GetContractAddress

func (s *CelerBridgeProcessor) GetContractAddress(params ProcessorInputParams) (common.Address, error)

func (*CelerBridgeProcessor) Name

func (s *CelerBridgeProcessor) Name() string

func (*CelerBridgeProcessor) PackTxInputData

func (c *CelerBridgeProcessor) PackTxInputData(params ProcessorInputParams) ([]byte, error)

func (*CelerBridgeProcessor) Send

func (s *CelerBridgeProcessor) Send(sendArgs *MultipathProcessorTxArgs, verifiedAccount *account.SelectedExtKey) (types.Hash, error)

type CelerBridgeTxArgs

type CelerBridgeTxArgs struct {
	transactions.SendTxArgs
	ChainID   uint64         `json:"chainId"`
	Symbol    string         `json:"symbol"`
	Recipient common.Address `json:"recipient"`
	Amount    *hexutil.Big   `json:"amount"`
}

type ENSPublicKeyProcessor

type ENSPublicKeyProcessor struct {
	// contains filtered or unexported fields
}

func NewENSPublicKeyProcessor

func NewENSPublicKeyProcessor(rpcClient *rpc.Client, transactor transactions.TransactorIface, ensService *ens.Service) *ENSPublicKeyProcessor

func (*ENSPublicKeyProcessor) AvailableFor

func (s *ENSPublicKeyProcessor) AvailableFor(params ProcessorInputParams) (bool, error)

func (*ENSPublicKeyProcessor) BuildTransaction

func (s *ENSPublicKeyProcessor) BuildTransaction(sendArgs *MultipathProcessorTxArgs) (*ethTypes.Transaction, error)

func (*ENSPublicKeyProcessor) BuildTx

func (*ENSPublicKeyProcessor) CalculateAmountOut

func (s *ENSPublicKeyProcessor) CalculateAmountOut(params ProcessorInputParams) (*big.Int, error)

func (*ENSPublicKeyProcessor) CalculateFees

func (s *ENSPublicKeyProcessor) CalculateFees(params ProcessorInputParams) (*big.Int, *big.Int, error)

func (*ENSPublicKeyProcessor) EstimateGas

func (s *ENSPublicKeyProcessor) EstimateGas(params ProcessorInputParams) (uint64, error)

func (*ENSPublicKeyProcessor) GetContractAddress

func (s *ENSPublicKeyProcessor) GetContractAddress(params ProcessorInputParams) (common.Address, error)

func (*ENSPublicKeyProcessor) Name

func (s *ENSPublicKeyProcessor) Name() string

func (*ENSPublicKeyProcessor) PackTxInputData

func (s *ENSPublicKeyProcessor) PackTxInputData(params ProcessorInputParams) ([]byte, error)

func (*ENSPublicKeyProcessor) Send

func (s *ENSPublicKeyProcessor) Send(sendArgs *MultipathProcessorTxArgs, verifiedAccount *account.SelectedExtKey) (hash types.Hash, err error)

type ENSRegisterProcessor

type ENSRegisterProcessor struct {
	// contains filtered or unexported fields
}

func NewENSRegisterProcessor

func NewENSRegisterProcessor(rpcClient *rpc.Client, transactor transactions.TransactorIface, ensService *ens.Service) *ENSRegisterProcessor

func (*ENSRegisterProcessor) AvailableFor

func (s *ENSRegisterProcessor) AvailableFor(params ProcessorInputParams) (bool, error)

func (*ENSRegisterProcessor) BuildTransaction

func (s *ENSRegisterProcessor) BuildTransaction(sendArgs *MultipathProcessorTxArgs) (*ethTypes.Transaction, error)

func (*ENSRegisterProcessor) BuildTx

func (*ENSRegisterProcessor) CalculateAmountOut

func (s *ENSRegisterProcessor) CalculateAmountOut(params ProcessorInputParams) (*big.Int, error)

func (*ENSRegisterProcessor) CalculateFees

func (s *ENSRegisterProcessor) CalculateFees(params ProcessorInputParams) (*big.Int, *big.Int, error)

func (*ENSRegisterProcessor) EstimateGas

func (s *ENSRegisterProcessor) EstimateGas(params ProcessorInputParams) (uint64, error)

func (*ENSRegisterProcessor) GetContractAddress

func (s *ENSRegisterProcessor) GetContractAddress(params ProcessorInputParams) (common.Address, error)

func (*ENSRegisterProcessor) GetPriceForRegisteringEnsName

func (s *ENSRegisterProcessor) GetPriceForRegisteringEnsName(chainID uint64) (*big.Int, error)

func (*ENSRegisterProcessor) Name

func (s *ENSRegisterProcessor) Name() string

func (*ENSRegisterProcessor) PackTxInputData

func (s *ENSRegisterProcessor) PackTxInputData(params ProcessorInputParams) ([]byte, error)

func (*ENSRegisterProcessor) Send

func (s *ENSRegisterProcessor) Send(sendArgs *MultipathProcessorTxArgs, verifiedAccount *account.SelectedExtKey) (hash types.Hash, err error)

type ENSReleaseProcessor

type ENSReleaseProcessor struct {
	// contains filtered or unexported fields
}

func NewENSReleaseProcessor

func NewENSReleaseProcessor(rpcClient *rpc.Client, transactor transactions.TransactorIface, ensService *ens.Service) *ENSReleaseProcessor

func (*ENSReleaseProcessor) AvailableFor

func (s *ENSReleaseProcessor) AvailableFor(params ProcessorInputParams) (bool, error)

func (*ENSReleaseProcessor) BuildTransaction

func (s *ENSReleaseProcessor) BuildTransaction(sendArgs *MultipathProcessorTxArgs) (*ethTypes.Transaction, error)

func (*ENSReleaseProcessor) BuildTx

func (*ENSReleaseProcessor) CalculateAmountOut

func (s *ENSReleaseProcessor) CalculateAmountOut(params ProcessorInputParams) (*big.Int, error)

func (*ENSReleaseProcessor) CalculateFees

func (s *ENSReleaseProcessor) CalculateFees(params ProcessorInputParams) (*big.Int, *big.Int, error)

func (*ENSReleaseProcessor) EstimateGas

func (s *ENSReleaseProcessor) EstimateGas(params ProcessorInputParams) (uint64, error)

func (*ENSReleaseProcessor) GetContractAddress

func (s *ENSReleaseProcessor) GetContractAddress(params ProcessorInputParams) (common.Address, error)

func (*ENSReleaseProcessor) Name

func (s *ENSReleaseProcessor) Name() string

func (*ENSReleaseProcessor) PackTxInputData

func (s *ENSReleaseProcessor) PackTxInputData(params ProcessorInputParams) ([]byte, error)

func (*ENSReleaseProcessor) Send

func (s *ENSReleaseProcessor) Send(sendArgs *MultipathProcessorTxArgs, verifiedAccount *account.SelectedExtKey) (hash types.Hash, err error)

type ERC1155Processor

type ERC1155Processor struct {
	// contains filtered or unexported fields
}

func NewERC1155Processor

func NewERC1155Processor(rpcClient *rpc.Client, transactor transactions.TransactorIface) *ERC1155Processor

func (*ERC1155Processor) AvailableFor

func (s *ERC1155Processor) AvailableFor(params ProcessorInputParams) (bool, error)

func (*ERC1155Processor) BuildTransaction

func (s *ERC1155Processor) BuildTransaction(sendArgs *MultipathProcessorTxArgs) (*ethTypes.Transaction, error)

func (*ERC1155Processor) BuildTx

func (*ERC1155Processor) CalculateAmountOut

func (s *ERC1155Processor) CalculateAmountOut(params ProcessorInputParams) (*big.Int, error)

func (*ERC1155Processor) CalculateFees

func (s *ERC1155Processor) CalculateFees(params ProcessorInputParams) (*big.Int, *big.Int, error)

func (*ERC1155Processor) EstimateGas

func (s *ERC1155Processor) EstimateGas(params ProcessorInputParams) (uint64, error)

func (*ERC1155Processor) GetContractAddress

func (s *ERC1155Processor) GetContractAddress(params ProcessorInputParams) (common.Address, error)

func (*ERC1155Processor) Name

func (s *ERC1155Processor) Name() string

func (*ERC1155Processor) PackTxInputData

func (s *ERC1155Processor) PackTxInputData(params ProcessorInputParams) ([]byte, error)

func (*ERC1155Processor) Send

func (s *ERC1155Processor) Send(sendArgs *MultipathProcessorTxArgs, verifiedAccount *account.SelectedExtKey) (hash types.Hash, err error)

type ERC1155TxArgs

type ERC1155TxArgs struct {
	transactions.SendTxArgs
	TokenID   *hexutil.Big   `json:"tokenId"`
	Recipient common.Address `json:"recipient"`
	Amount    *hexutil.Big   `json:"amount"`
}

type ERC721Processor

type ERC721Processor struct {
	// contains filtered or unexported fields
}

func NewERC721Processor

func NewERC721Processor(rpcClient *rpc.Client, transactor transactions.TransactorIface) *ERC721Processor

func (*ERC721Processor) AvailableFor

func (s *ERC721Processor) AvailableFor(params ProcessorInputParams) (bool, error)

func (*ERC721Processor) BuildTransaction

func (s *ERC721Processor) BuildTransaction(sendArgs *MultipathProcessorTxArgs) (*ethTypes.Transaction, error)

func (*ERC721Processor) BuildTx

func (*ERC721Processor) CalculateAmountOut

func (s *ERC721Processor) CalculateAmountOut(params ProcessorInputParams) (*big.Int, error)

func (*ERC721Processor) CalculateFees

func (s *ERC721Processor) CalculateFees(params ProcessorInputParams) (*big.Int, *big.Int, error)

func (*ERC721Processor) EstimateGas

func (s *ERC721Processor) EstimateGas(params ProcessorInputParams) (uint64, error)

func (*ERC721Processor) GetContractAddress

func (s *ERC721Processor) GetContractAddress(params ProcessorInputParams) (common.Address, error)

func (*ERC721Processor) Name

func (s *ERC721Processor) Name() string

func (*ERC721Processor) PackTxInputData

func (s *ERC721Processor) PackTxInputData(params ProcessorInputParams) ([]byte, error)

func (*ERC721Processor) Send

func (s *ERC721Processor) Send(sendArgs *MultipathProcessorTxArgs, verifiedAccount *account.SelectedExtKey) (hash types.Hash, err error)

type ERC721TxArgs

type ERC721TxArgs struct {
	transactions.SendTxArgs
	TokenID   *hexutil.Big   `json:"tokenId"`
	Recipient common.Address `json:"recipient"`
}

type HopBridgeProcessor

type HopBridgeProcessor struct {
	// contains filtered or unexported fields
}

func NewHopBridgeProcessor

func NewHopBridgeProcessor(rpcClient *rpc.Client, transactor transactions.TransactorIface, tokenManager *token.Manager) *HopBridgeProcessor

func (*HopBridgeProcessor) AvailableFor

func (h *HopBridgeProcessor) AvailableFor(params ProcessorInputParams) (bool, error)

func (*HopBridgeProcessor) BuildTransaction

func (h *HopBridgeProcessor) BuildTransaction(sendArgs *MultipathProcessorTxArgs) (*ethTypes.Transaction, error)

func (*HopBridgeProcessor) BuildTx

func (*HopBridgeProcessor) CalculateAmountOut

func (h *HopBridgeProcessor) CalculateAmountOut(params ProcessorInputParams) (*big.Int, error)

func (*HopBridgeProcessor) CalculateFees

func (h *HopBridgeProcessor) CalculateFees(params ProcessorInputParams) (*big.Int, *big.Int, error)

func (*HopBridgeProcessor) Clear added in v0.181.31

func (h *HopBridgeProcessor) Clear()

func (*HopBridgeProcessor) EstimateGas

func (h *HopBridgeProcessor) EstimateGas(params ProcessorInputParams) (uint64, error)

func (*HopBridgeProcessor) GetContractAddress

func (h *HopBridgeProcessor) GetContractAddress(params ProcessorInputParams) (common.Address, error)

func (*HopBridgeProcessor) Name

func (h *HopBridgeProcessor) Name() string

func (*HopBridgeProcessor) PackTxInputData

func (h *HopBridgeProcessor) PackTxInputData(params ProcessorInputParams) ([]byte, error)

func (*HopBridgeProcessor) Send

func (h *HopBridgeProcessor) Send(sendArgs *MultipathProcessorTxArgs, verifiedAccount *account.SelectedExtKey) (hash types.Hash, err error)

type HopBridgeTxArgs

type HopBridgeTxArgs struct {
	transactions.SendTxArgs
	ChainID   uint64         `json:"chainId"`
	ChainIDTo uint64         `json:"chainIdTo"`
	Symbol    string         `json:"symbol"`
	Recipient common.Address `json:"recipient"`
	Amount    *hexutil.Big   `json:"amount"`
	BonderFee *hexutil.Big   `json:"bonderFee"`
}

type MultipathProcessorTxArgs

type MultipathProcessorTxArgs struct {
	Name              string `json:"bridgeName"`
	ChainID           uint64
	TransferTx        *transactions.SendTxArgs
	HopTx             *HopBridgeTxArgs
	CbridgeTx         *CelerBridgeTxArgs
	ERC721TransferTx  *ERC721TxArgs
	ERC1155TransferTx *ERC1155TxArgs
	SwapTx            *SwapParaswapTxArgs
}

func (*MultipathProcessorTxArgs) Data

func (*MultipathProcessorTxArgs) From

func (*MultipathProcessorTxArgs) To

func (*MultipathProcessorTxArgs) Value

func (t *MultipathProcessorTxArgs) Value() *big.Int

type PathProcessor

type PathProcessor interface {
	// Name returns the name of the bridge
	Name() string
	// AvailableFor checks if the bridge is available for the given networks/tokens
	AvailableFor(params ProcessorInputParams) (bool, error)
	// CalculateFees calculates the fees for the bridge and returns the amount BonderFee and TokenFee (used for bridges)
	CalculateFees(params ProcessorInputParams) (*big.Int, *big.Int, error)
	// PackTxInputData packs tx for sending
	PackTxInputData(params ProcessorInputParams) ([]byte, error)
	// EstimateGas estimates the gas
	EstimateGas(params ProcessorInputParams) (uint64, error)
	// CalculateAmountOut calculates the amount out
	CalculateAmountOut(params ProcessorInputParams) (*big.Int, error)
	// Send sends the tx
	Send(sendArgs *MultipathProcessorTxArgs, verifiedAccount *account.SelectedExtKey) (types.Hash, error)
	// GetContractAddress returns the contract address
	GetContractAddress(params ProcessorInputParams) (common.Address, error)
	// BuildTransaction builds the transaction based on MultipathProcessorTxArgs
	BuildTransaction(sendArgs *MultipathProcessorTxArgs) (*ethTypes.Transaction, error)
	// BuildTx builds the transaction based on ProcessorInputParams
	BuildTx(params ProcessorInputParams) (*ethTypes.Transaction, error)
}

type PathProcessorClearable added in v0.181.31

type PathProcessorClearable interface {
	// Clear clears the local cache
	Clear()
}

type ProcessorInputParams

type ProcessorInputParams struct {
	FromChain *params.Network
	ToChain   *params.Network
	FromAddr  common.Address
	ToAddr    common.Address
	FromToken *token.Token
	ToToken   *token.Token
	AmountIn  *big.Int
	AmountOut *big.Int

	// extra params
	BonderFee *big.Int
	Username  string
	PublicKey string
	PackID    *big.Int

	// for testing purposes
	TestsMode                 bool
	TestEstimationMap         map[string]uint64   // [brifge-name, estimated-value]
	TestBonderFeeMap          map[string]*big.Int // [token-symbol, bonder-fee]
	TestApprovalGasEstimation uint64
	TestApprovalL1Fee         uint64
}

type StickersBuyProcessor added in v0.180.31

type StickersBuyProcessor struct {
	// contains filtered or unexported fields
}

func NewStickersBuyProcessor added in v0.180.31

func NewStickersBuyProcessor(rpcClient *rpc.Client, transactor transactions.TransactorIface, stickersService *stickers.Service) *StickersBuyProcessor

func (*StickersBuyProcessor) AvailableFor added in v0.180.31

func (s *StickersBuyProcessor) AvailableFor(params ProcessorInputParams) (bool, error)

func (*StickersBuyProcessor) BuildTransaction added in v0.180.31

func (s *StickersBuyProcessor) BuildTransaction(sendArgs *MultipathProcessorTxArgs) (*ethTypes.Transaction, error)

func (*StickersBuyProcessor) BuildTx added in v0.180.31

func (*StickersBuyProcessor) CalculateAmountOut added in v0.180.31

func (s *StickersBuyProcessor) CalculateAmountOut(params ProcessorInputParams) (*big.Int, error)

func (*StickersBuyProcessor) CalculateFees added in v0.180.31

func (s *StickersBuyProcessor) CalculateFees(params ProcessorInputParams) (*big.Int, *big.Int, error)

func (*StickersBuyProcessor) EstimateGas added in v0.180.31

func (s *StickersBuyProcessor) EstimateGas(params ProcessorInputParams) (uint64, error)

func (*StickersBuyProcessor) GetContractAddress added in v0.180.31

func (s *StickersBuyProcessor) GetContractAddress(params ProcessorInputParams) (common.Address, error)

func (*StickersBuyProcessor) Name added in v0.180.31

func (s *StickersBuyProcessor) Name() string

func (*StickersBuyProcessor) PackTxInputData added in v0.180.31

func (s *StickersBuyProcessor) PackTxInputData(params ProcessorInputParams) ([]byte, error)

func (*StickersBuyProcessor) Send added in v0.180.31

func (s *StickersBuyProcessor) Send(sendArgs *MultipathProcessorTxArgs, verifiedAccount *account.SelectedExtKey) (hash types.Hash, err error)

type SwapParaswapProcessor

type SwapParaswapProcessor struct {
	// contains filtered or unexported fields
}

func NewSwapParaswapProcessor

func NewSwapParaswapProcessor(rpcClient *rpc.Client, transactor transactions.TransactorIface, tokenManager *walletToken.Manager) *SwapParaswapProcessor

func (*SwapParaswapProcessor) AvailableFor

func (s *SwapParaswapProcessor) AvailableFor(params ProcessorInputParams) (bool, error)

func (*SwapParaswapProcessor) BuildTransaction

func (s *SwapParaswapProcessor) BuildTransaction(sendArgs *MultipathProcessorTxArgs) (*ethTypes.Transaction, error)

func (*SwapParaswapProcessor) BuildTx

func (*SwapParaswapProcessor) CalculateAmountOut

func (s *SwapParaswapProcessor) CalculateAmountOut(params ProcessorInputParams) (*big.Int, error)

func (*SwapParaswapProcessor) CalculateFees

func (s *SwapParaswapProcessor) CalculateFees(params ProcessorInputParams) (*big.Int, *big.Int, error)

func (*SwapParaswapProcessor) Clear added in v0.181.31

func (s *SwapParaswapProcessor) Clear()

func (*SwapParaswapProcessor) EstimateGas

func (s *SwapParaswapProcessor) EstimateGas(params ProcessorInputParams) (uint64, error)

func (*SwapParaswapProcessor) GetContractAddress

func (s *SwapParaswapProcessor) GetContractAddress(params ProcessorInputParams) (address common.Address, err error)

func (*SwapParaswapProcessor) Name

func (s *SwapParaswapProcessor) Name() string

func (*SwapParaswapProcessor) PackTxInputData

func (s *SwapParaswapProcessor) PackTxInputData(params ProcessorInputParams) ([]byte, error)

func (*SwapParaswapProcessor) Send

func (s *SwapParaswapProcessor) Send(sendArgs *MultipathProcessorTxArgs, verifiedAccount *account.SelectedExtKey) (types.Hash, error)

type SwapParaswapTxArgs

type SwapParaswapTxArgs struct {
	transactions.SendTxArgs
	ChainID            uint64  `json:"chainId"`
	ChainIDTo          uint64  `json:"chainIdFrom"`
	TokenIDFrom        string  `json:"tokenIdFrom"`
	TokenIDTo          string  `json:"tokenIdTo"`
	SlippagePercentage float32 `json:"slippagePercentage"`
}

type TransferProcessor

type TransferProcessor struct {
	// contains filtered or unexported fields
}

func NewTransferProcessor

func NewTransferProcessor(rpcClient *rpc.Client, transactor transactions.TransactorIface) *TransferProcessor

func (*TransferProcessor) AvailableFor

func (s *TransferProcessor) AvailableFor(params ProcessorInputParams) (bool, error)

func (*TransferProcessor) BuildTransaction

func (s *TransferProcessor) BuildTransaction(sendArgs *MultipathProcessorTxArgs) (*ethTypes.Transaction, error)

func (*TransferProcessor) BuildTx

func (*TransferProcessor) CalculateAmountOut

func (s *TransferProcessor) CalculateAmountOut(params ProcessorInputParams) (*big.Int, error)

func (*TransferProcessor) CalculateFees

func (s *TransferProcessor) CalculateFees(params ProcessorInputParams) (*big.Int, *big.Int, error)

func (*TransferProcessor) EstimateGas

func (s *TransferProcessor) EstimateGas(params ProcessorInputParams) (uint64, error)

func (*TransferProcessor) GetContractAddress

func (s *TransferProcessor) GetContractAddress(params ProcessorInputParams) (common.Address, error)

func (*TransferProcessor) Name

func (s *TransferProcessor) Name() string

func (*TransferProcessor) PackTxInputData

func (s *TransferProcessor) PackTxInputData(params ProcessorInputParams) ([]byte, error)

func (*TransferProcessor) Send

func (s *TransferProcessor) Send(sendArgs *MultipathProcessorTxArgs, verifiedAccount *account.SelectedExtKey) (types.Hash, error)

Directories

Path Synopsis
Package mock_pathprocessor is a generated GoMock package.
Package mock_pathprocessor is a generated GoMock package.

Jump to

Keyboard shortcuts

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