periphery

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrZeroLiquidity = errors.New("zero liquidity")
	ErrNoWETH        = errors.New("no WETH")
	ErrCannotBurn    = errors.New("cannot burn")
)
View Source
var (
	ErrInvalidOptions = errors.New("invalid options")
)
View Source
var MaxUint128 = new(big.Int).Sub(new(big.Int).Exp(big.NewInt(2), big.NewInt(128), nil), big.NewInt(1))

Functions

func AddCallParameters

func AddCallParameters(position *entities.Position, opts *AddLiquidityOptions) (*utils.MethodParameters, error)

func CollectCallParameters

func CollectCallParameters(opts *CollectOptions) (*utils.MethodParameters, error)

func CreateCallParameters

func CreateCallParameters(pool *entities.Pool) (*utils.MethodParameters, error)

func EncodeAllowedPermit

func EncodeAllowedPermit(token *entities.Token, options *AllowedPermitArguments) ([]byte, error)

func EncodeMulticall

func EncodeMulticall(calldatas [][]byte) ([]byte, error)

func EncodePermit

func EncodePermit(token *entities.Token, options *PermitOptions) ([]byte, error)

func EncodeRefundETH

func EncodeRefundETH() []byte

func EncodeStandardPermit

func EncodeStandardPermit(token *entities.Token, options *StandardPermitArguments) ([]byte, error)

func EncodeSweepToken

func EncodeSweepToken(token *entities.Token, amountMinimum *big.Int, recipient common.Address, feeOptions *FeeOptions) ([]byte, error)

func EncodeUnwrapWETH9

func EncodeUnwrapWETH9(amountMinimum *big.Int, recipient common.Address, feeOptions *FeeOptions) ([]byte, error)

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)

Types

type AllowedPermitArguments

type AllowedPermitArguments struct {
	V      uint
	R      string
	S      string
	Nonce  *big.Int
	Expiry *big.Int
}

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.Token          // TODO: merge this with Currency
	ExpectedTokenOwed1    *core.Token          // TODO: merge this with Currency
	Recipient             common.Address       // The account that should receive the tokens
}

type CollectParams

type CollectParams struct {
	TokenId    *big.Int
	Recipient  common.Address
	Amount0Max *big.Int
	Amount1Max *big.Int
}

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.Currency // Whether to spend ether. If true, one of the pool tokens must be WETH, by default false
	NativeToken       *core.Token    // TODO: merge this with UseNative

	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 DecreaseLiquidityParams struct {
	TokenId    *big.Int
	Liquidity  *big.Int
	Amount0Min *big.Int
	Amount1Min *big.Int
	Deadline   *big.Int
}

type FeeOptions

type FeeOptions struct {
	Fee       *entities.Percent // The percent of the output that will be taken as a fee.
	Recipient common.Address    // The recipient of the fee.

}

type IncreaseLiquidityParams

type IncreaseLiquidityParams struct {
	TokenId        *big.Int
	Amount0Desired *big.Int
	Amount1Desired *big.Int
	Amount0Min     *big.Int
	Amount1Min     *big.Int
	Deadline       *big.Int
}

type IncreaseOptions

type IncreaseOptions struct {
	*CommonAddLiquidityOptions
	*IncreaseSpecificOptions
}

type IncreaseSpecificOptions

type IncreaseSpecificOptions struct {
	TokenID *big.Int // Indicates the ID of the position to increase liquidity for
}

type MintOptions

type MintOptions struct {
	*CommonAddLiquidityOptions
	*MintSpecificOptions
}

type MintParams

type MintParams struct {
	Token0         common.Address
	Token1         common.Address
	Fee            *big.Int
	TickLower      *big.Int
	TickUpper      *big.Int
	Amount0Desired *big.Int
	Amount1Desired *big.Int
	Amount0Min     *big.Int
	Amount1Min     *big.Int
	Recipient      common.Address
	Deadline       *big.Int
}

type MintSpecificOptions

type MintSpecificOptions struct {
	Recipient  common.Address // The account that should receive the minted NFT
	CreatePool bool           // Creates pool if not initialized before mint
}

type NFTPermitOptions

type NFTPermitOptions struct {
	V        uint
	R        string
	S        string
	Deadline *big.Int
	Spender  string
}

type PermitOptions

type PermitOptions struct {
	*StandardPermitArguments
	*AllowedPermitArguments
}

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 StandardPermitArguments struct {
	V        uint
	R        string
	S        string
	Amount   *big.Int
	Deadline *big.Int
}

type WrappedABI

type WrappedABI struct {
	ABI abi.ABI `json:"abi"`
}

Jump to

Keyboard shortcuts

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