Documentation ¶
Index ¶
- Constants
- Variables
- func AddCallParameters(position *entities.Position, opts *AddLiquidityOptions) (*utils.MethodParameters, error)
- func CollectCallParameters(opts *CollectOptions) (*utils.MethodParameters, error)
- func CollectRewards(incentiveKeys []*IncentiveKey, options *ClaimOptions) (*utils.MethodParameters, error)
- func CreateCallParameters(pool *entities.Pool) (*utils.MethodParameters, error)
- func EncodeAllowedPermit(token *entities.Token, options *AllowedPermitArguments) ([]byte, error)
- func EncodeClaim(incentiveKey *IncentiveKey, options *ClaimOptions) ([][]byte, error)
- func EncodeDeposit(incentiveKeys []*IncentiveKey) ([]byte, error)
- func EncodeMulticall(calldatas [][]byte) ([]byte, error)
- func EncodePermit(token *entities.Token, options *PermitOptions) ([]byte, error)
- func EncodeRefundETH() []byte
- func EncodeRouteToPath(route *entities.Route, exactOutput bool) ([]byte, error)
- func EncodeStandardPermit(token *entities.Token, options *StandardPermitArguments) ([]byte, error)
- func EncodeSweepToken(token *entities.Token, amountMinimum *big.Int, recipient common.Address, ...) ([]byte, error)
- func EncodeUnwrapWETH9(amountMinimum *big.Int, recipient common.Address, feeOptions *FeeOptions) ([]byte, error)
- func GetABI(abi []byte) abi.ABI
- func PutUint24(i uint64) []byte
- func QuoteCallParameters(route *entities.Route, amount *core.CurrencyAmount, tradeType core.TradeType, ...) (*utils.MethodParameters, error)
- func RemoveCallParameters(position *entities.Position, opts *RemoveLiquidityOptions) (*utils.MethodParameters, error)
- func SafeTransferFromParameters(opts *SafeTransferOptions) (*utils.MethodParameters, error)
- func SwapCallParameters(trades []*entities.Trade, options *SwapOptions) (*utils.MethodParameters, error)
- func WithdrawToken(incentiveKeys []*IncentiveKey, withdrawOptions *FullWithdrawOptions) (*utils.MethodParameters, error)
- type AddLiquidityOptions
- type AllowedPermitArguments
- type ClaimOptions
- type CollectOptions
- type CollectParams
- type CommonAddLiquidityOptions
- type DecreaseLiquidityParams
- type ExactInputParams
- type ExactInputSingleParams
- type ExactOutputParams
- type ExactOutputSingleParams
- type FeeOptions
- type FullWithdrawOptions
- type IncentiveKey
- type IncentiveKeyParams
- type IncreaseLiquidityParams
- type IncreaseOptions
- type IncreaseSpecificOptions
- type MintOptions
- type MintParams
- type MintSpecificOptions
- type NFTPermitOptions
- type PermitOptions
- type QuoteOptions
- type RemoveLiquidityOptions
- type SafeTransferOptions
- type StandardPermitArguments
- type SwapOptions
- type WithdrawOptions
- type WrappedABI
Constants ¶
View Source
const INCENTIVE_KEY_ABI = "tuple(address rewardToken, address pool, uint256 startTime, uint256 endTime, address refundee)"
Variables ¶
View Source
var ( ErrZeroLiquidity = errors.New("zero liquidity") ErrNoWETH = errors.New("no WETH") ErrCannotBurn = errors.New("cannot burn") )
View Source
var ( ErrTokenInDiff = errors.New("TOKEN_IN_DIFF") ErrTokenOutDiff = errors.New("TOKEN_OUT_DIFF") ErrNonTokenPermit = errors.New("NON_TOKEN_PERMIT") ErrMultiHopPriceLimit = errors.New("MULTIHOP_PRICE_LIMIT") )
View Source
var (
ErrInvalidOptions = errors.New("invalid options")
)
View Source
var ErrMultihopPriceLimit = errors.New("MULTIHOP_PRICE_LIMIT")
Functions ¶
func AddCallParameters ¶
func AddCallParameters(position *entities.Position, opts *AddLiquidityOptions) (*utils.MethodParameters, error)
func CollectCallParameters ¶
func CollectCallParameters(opts *CollectOptions) (*utils.MethodParameters, error)
func CollectRewards ¶ added in v0.4.0
func CollectRewards(incentiveKeys []*IncentiveKey, options *ClaimOptions) (*utils.MethodParameters, error)
*
* * Note: A `tokenId` can be staked in many programs but to claim rewards and continue the program you must unstake, claim, and then restake. * @param incentiveKeys An IncentiveKey or array of IncentiveKeys that `tokenId` is staked in. * Input an array of IncentiveKeys to claim rewards for each program. * @param options ClaimOptions to specify tokenId, recipient, and amount wanting to collect. * Note that you can only specify one amount and one recipient across the various programs if you are collecting from multiple programs at once. * @returns
func CreateCallParameters ¶
func CreateCallParameters(pool *entities.Pool) (*utils.MethodParameters, error)
func EncodeAllowedPermit ¶
func EncodeAllowedPermit(token *entities.Token, options *AllowedPermitArguments) ([]byte, error)
func EncodeClaim ¶ added in v0.4.0
func EncodeClaim(incentiveKey *IncentiveKey, options *ClaimOptions) ([][]byte, error)
* * To claim rewards, must unstake and then claim. * @param incentiveKey The unique identifier of a staking program. * @param options Options for producing the calldata to claim. Can't claim unless you unstake. * @returns The calldatas for 'unstakeToken' and 'claimReward'.
func EncodeDeposit ¶ added in v0.4.0
func EncodeDeposit(incentiveKeys []*IncentiveKey) ([]byte, error)
*
* * @param incentiveKeys A single IncentiveKey or array of IncentiveKeys to be encoded and used in the data parameter in `safeTransferFrom` * @returns An IncentiveKey as a string *
func EncodeMulticall ¶
func EncodePermit ¶
func EncodePermit(token *entities.Token, options *PermitOptions) ([]byte, error)
func EncodeRefundETH ¶
func EncodeRefundETH() []byte
func EncodeRouteToPath ¶ added in v0.4.0
*
- Converts a route to a hex encoded path
- @param route the v3 path to convert to an encoded path
- @param exactOutput whether the route should be encoded in reverse, for making exact output swaps
func EncodeStandardPermit ¶
func EncodeStandardPermit(token *entities.Token, options *StandardPermitArguments) ([]byte, error)
func EncodeSweepToken ¶
func EncodeUnwrapWETH9 ¶
func QuoteCallParameters ¶ added in v0.4.0
func QuoteCallParameters( route *entities.Route, amount *core.CurrencyAmount, tradeType core.TradeType, options *QuoteOptions, ) (*utils.MethodParameters, error)
*
- Produces the on-chain method name of the appropriate function within QuoterV2,
- and the relevant hex encoded parameters.
- @template TInput The input token, either Ether or an ERC-20
- @template TOutput The output token, either Ether or an ERC-20
- @param route The swap route, a list of pools through which a swap can occur
- @param amount The amount of the quote, either an amount in, or an amount out
- @param tradeType The trade type, either exact input or exact output
- @returns The formatted calldata
func RemoveCallParameters ¶
func RemoveCallParameters(position *entities.Position, opts *RemoveLiquidityOptions) (*utils.MethodParameters, error)
*
- Produces the calldata for completely or partially exiting a position
- @param position The position to exit
- @param options Additional information necessary for generating the calldata
- @returns The call parameters
func SafeTransferFromParameters ¶
func SafeTransferFromParameters(opts *SafeTransferOptions) (*utils.MethodParameters, error)
func SwapCallParameters ¶ added in v0.4.0
func SwapCallParameters(trades []*entities.Trade, options *SwapOptions) (*utils.MethodParameters, error)
*
- Produces the on-chain method name to call and the hex encoded parameters to pass as arguments for a given trade.
- @param trade to produce call parameters for
- @param options options for the call parameters
func WithdrawToken ¶ added in v0.4.0
func WithdrawToken(incentiveKeys []*IncentiveKey, withdrawOptions *FullWithdrawOptions) (*utils.MethodParameters, error)
*
* * @param incentiveKeys A list of incentiveKeys to unstake from. Should include all incentiveKeys (unique staking programs) that `options.tokenId` is staked in. * @param withdrawOptions Options for producing claim calldata and withdraw calldata. Can't withdraw without unstaking all programs for `tokenId`. * @returns Calldata for unstaking, claiming, and withdrawing.
Types ¶
type AddLiquidityOptions ¶
type AddLiquidityOptions struct { *CommonAddLiquidityOptions *MintSpecificOptions *IncreaseSpecificOptions }
type AllowedPermitArguments ¶
type ClaimOptions ¶ added in v0.4.0
type ClaimOptions struct { TokenID *big.Int // The id of the NFT Recipient common.Address // Address to send rewards to. Amount *big.Int // The amount of `rewardToken` to claim. 0 claims all. }
Options to specify when claiming rewards.
type CollectOptions ¶
type CollectOptions struct { TokenID *big.Int // Indicates the ID of the position to collect for ExpectedCurrencyOwed0 *core.CurrencyAmount // Expected value of tokensOwed0, including as-of-yet-unaccounted-for fees/liquidity value to be burned ExpectedCurrencyOwed1 *core.CurrencyAmount // Expected value of tokensOwed1, including as-of-yet-unaccounted-for fees/liquidity value to be burned ExpectedTokenOwed0 core.Currency ExpectedTokenOwed1 core.Currency Recipient common.Address // The account that should receive the tokens }
type CollectParams ¶
type CommonAddLiquidityOptions ¶
type CommonAddLiquidityOptions struct { SlippageTolerance *core.Percent // How much the pool price is allowed to move Deadline *big.Int // When the transaction expires, in epoch seconds UseNative *core.Ether // Whether to spend ether. If true, one of the pool tokens must be WETH, by default false Token0Permit *PermitOptions // The optional permit parameters for spending token0 Token1Permit *PermitOptions // The optional permit parameters for spending token1 }
Options for producing the calldata to add liquidity
type DecreaseLiquidityParams ¶
type ExactInputParams ¶ added in v0.4.0
type ExactInputSingleParams ¶ added in v0.4.0
type ExactOutputParams ¶ added in v0.4.0
type ExactOutputSingleParams ¶ added in v0.4.0
type FeeOptions ¶
type FullWithdrawOptions ¶ added in v0.4.0
type FullWithdrawOptions struct { ClaimOptions WithdrawOptions }
type IncentiveKey ¶ added in v0.4.0
type IncentiveKey struct { RewardToken *core.Token // The token rewarded for participating in the staking program. Pool *entities.Pool // The pool that the staked positions must provide in. StartTime *big.Int // The time when the incentive program begins. EndTime *big.Int // The time that the incentive program ends. Refundee common.Address // The address which receives any remaining reward tokens at `endTime`. }
Represents a unique staking program.
type IncentiveKeyParams ¶ added in v0.4.0
type IncreaseLiquidityParams ¶
type IncreaseOptions ¶
type IncreaseOptions struct { *CommonAddLiquidityOptions *IncreaseSpecificOptions }
type IncreaseSpecificOptions ¶
type MintOptions ¶
type MintOptions struct { *CommonAddLiquidityOptions *MintSpecificOptions }
type MintParams ¶
type MintSpecificOptions ¶
type NFTPermitOptions ¶
type PermitOptions ¶
type PermitOptions struct { *StandardPermitArguments *AllowedPermitArguments }
type QuoteOptions ¶ added in v0.4.0
Optional arguments to send to the quoter.
type RemoveLiquidityOptions ¶
type RemoveLiquidityOptions struct { TokenID *big.Int // The ID of the token to exit LiquidityPercentage *core.Percent // The percentage of position liquidity to exit SlippageTolerance *core.Percent // How much the pool price is allowed to move Deadline *big.Int // When the transaction expires, in epoch seconds. BurnToken bool // Whether the NFT should be burned if the entire position is being exited, by default false Permit *NFTPermitOptions // The optional permit of the token ID being exited, in case the exit transaction is being sent by an account that does not own the NFT CollectOptions *CollectOptions // Parameters to be passed on to collect }
Options for producing the calldata to exit a position
type SafeTransferOptions ¶
type SafeTransferOptions struct { Sender common.Address // The account sending the NFT Recipient common.Address // The account that should receive the NFT TokenID *big.Int // The id of the token being sent Data []byte // The optional parameter that passes data to the `onERC721Received` call for the staker }
type StandardPermitArguments ¶
type SwapOptions ¶ added in v0.4.0
type SwapOptions struct { SlippageTolerance *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. InputTokenPermit *PermitOptions // The optional permit parameters for spending the input. SqrtPriceLimitX96 *big.Int // The optional price limit for the trade. Fee *FeeOptions // Optional information for taking a fee on output. }
Options for producing the arguments to send calls to the router.
type WithdrawOptions ¶ added in v0.4.0
type WithdrawOptions struct { Owner common.Address // Set when withdrawing. The position will be sent to `owner` on withdraw. Data []byte // Set when withdrawing. `data` is passed to `safeTransferFrom` when transferring the position from contract back to owner. }
Options to specify when withdrawing a position.
type WrappedABI ¶
Click to show internal directories.
Click to hide internal directories.