Documentation
¶
Index ¶
Constants ¶
View Source
const V2Router02ABI = "" /* 15624-byte string literal not displayed */
Variables ¶
View Source
var ( ErrEtherInOut = errors.New("the router does not support both ether in and out") ErrExactOutFot = errors.New("EXACT_OUT_FOT") )
Functions ¶
func SwapCallParametersPacked ¶
func SwapCallParametersPacked(trade *entities.Trade, options TradeOptions) (*big.Int, []byte, error)
SwapCallParametersPacked packs swap parameters.
Returns value and data to use in transaction body.
Types ¶
type SwapParameters ¶
type SwapParameters struct { MethodName string // The method to call on the Uniswap V2 Router. Args []interface{} // The arguments to pass to the method. Value *big.Int // The amount of wei to send. }
SwapParameters to use in the call to the Uniswap V2 Router to execute a trade.
func SwapCallParameters ¶
func SwapCallParameters(trade *entities.Trade, options TradeOptions) (*SwapParameters, error)
SwapCallParameters produces the on-chain method name to call and the hex encoded parameters to pass as arguments for a given trade.
type TradeOptions ¶
type TradeOptions struct { AllowedSlippage *core.Percent // How much the execution price is allowed to move unfavorably from the trade execution price. Recipient common.Address // The account that should receive the output. Deadline *big.Int // When the transaction expires, in epoch seconds. FeeOnTransfer bool // Whether any of the tokens in the path are fee on transfer tokens, which should be handled with special methods }
TradeOptions for producing the arguments to send call to the router.
Click to show internal directories.
Click to hide internal directories.