JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 16
  • Score
    100M100P100Q59742F
  • License Apache-2.0

Solidity Library that implements swap using different plaforms with a homogeneneous interface

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@ensuro/swaplibrary) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    SwapLibrary

    SwapLibrary is a Solidity library that provides functions for executing token swaps using different protocols. It currently supports Uniswap protocol.

    Functions

    exactInput

    Executes an exact input swap.

    Parameters

    • swapConfig: Swap configuration including the protocol to use for the swap.
    • tokenIn: The address of the token to be used as input for the swap.
    • tokenOut: The address of the token to be received as a result of the swap.
    • amount: The exact amount of input tokens to be swapped.
    • price: Approximate amount of units of tokenInrequired to acquire a unit oftokenOut. It will be validated against the swap rate considering the maxSlippage.

    exactOutput

    Executes an exact output swap.

    Parameters

    • swapConfig: Swap configuration including the protocol to use for the swap.
    • tokenIn: The address of the token to be used as input for the swap.
    • tokenOut: The address of the token to be received as a result of the swap.
    • amount: The desired amount of output tokens to be obtained from the swap.
    • price: Approximate amount of units of tokenInrequired to acquire a unit oftokenOut. It will be validated against the swap rate considering the maxSlippage.