QuipuSwap Wrapper

Import Plugins

#import { Connection } into Tezos from "w3://ens/tezos.web3api.eth"

Response Types

Network

enum Network {
  custom
  mainnet
  ghostnet
}

Mutations

Import Plugins

#import { Mutation, SendParams, TransferParams } into Tezos from "w3://ens/tezos.web3api.eth"
#import { Network, CustomConnection } from "../common/schema.graphql"

Add Operator

FA2-interface: grant allowance to move LP tokens owned by owner.

    addOperator(
        network: Network!
        params: OperatorParams!
        contractAddress: String
        sendParams: Tezos_SendParams
        custom: CustomConnection
    ): Tezos_TransferParams!

Remove Operator

FA2-interface: revoke allowance to move LP tokens

    removeOperator(
        network: Network!
        params: OperatorParams!
        contractAddress: String
        sendParams: Tezos_SendParams
        custom: CustomConnection
    ): Tezos_TransferParams!

Swap Direct

DEX interface: swap variant 1: direct swap using an explicit pair

//   pair_id: id of the dex pair to remove liquidity from
//   direction: a_to_b | b_to_a
//   amount_in: amount of token X to sell (DEX needs operator grant on token X contract)
//   min_amount_out: minimum amount of token Y to buy
//   receiver: recipient of token Y after sale completes
//   deadline: latest block timestamp to execute this transaction
    swapDirect(
        network: Network!
        params: SwapDirectParams!
        sendParams: Tezos_SendParams
        custom: CustomConnection
    ): [Tezos_TransferParams!]!

Swap Multi Hop

DEX interface: swap variant 2: user-defined routing

//   hops: list of {direction, pair_id} hops
//   amount_in: amount of token X to sell (DEX needs operator grant on token X contract)
//   min_amount_out: minimum amount of token Y to buy
//   receiver: recipient of token Y after sale completes
//   deadline: latest block timestamp to execute this transaction
    swapMultiHop(
        network: Network!
        params: SwapMultiHopParams!
        sendParams: Tezos_SendParams
        custom: CustomConnection
    ): [Tezos_TransferParams!]!

Invest

DEX interface: add liquidity

//   pair_id: id of the dex pair to add liquidity to
//   shares: exact amount of LP shares to mint (must pre-calc from current pool supply + added tokens)
//   token_a_in: minimum amount of token A to add (user-defined, DEX needs operator grant on token A contract)
//   token_b_in: minimum amount of token B to add (user-defined, DEX needs operator grant on token B contract)
//   deadline: latest block timestamp to execute this transaction
    invest(
        network: Network!
        params: InvestParams!
        sendParams: Tezos_SendParams
        custom: CustomConnection
    ): [Tezos_TransferParams!]!

Divest

DEX interface: remove liquidity

//   pair_id: id of the dex pair to remove liquidity from
//   shares: exact amount of LP shares to burn (user-defined)
//   token_a_in: minimum amount of token A to return (pre-calculate from current pool supply + LP burn)
//   token_b_in: minimum amount of token B to return (pre-calculate from current pool supply + LP burn)
//   deadline: latest block timestamp to execute this transaction
   divest(
        network: Network!
        params: DivestParams!
        sendParams: Tezos_SendParams
        custom: CustomConnection
    ): Tezos_TransferParams!

Transfer

FA2-interface: transfer own tokens (sender/from is caller)

   transfer(
        network: Network!
        params: TransferParams!
        sendParams: Tezos_SendParams
        custom: CustomConnection
    ): Tezos_TransferParams!

Transfer From

FA2-interface: transfer from tokens (sender is explicit)

    transferFrom(
        network: Network!
        from: String!
        params: TransferParams!
        sendParams: Tezos_SendParams
        custom: CustomConnection
    ): Tezos_TransferParams!

Common Types

Swap Direction

enum SwapDirection {
    a_to_b
    b_to_a
}

Operator Params

type OperatorParams {
    tokenId: UInt32!
    operator: String!
}

Swap Pair

type SwapPair {
    pairId: UInt32!
    direction: SwapDirection!
}

Swap Params

type SwapParams {
    amountIn: BigInt!
    minAmountOut: BigInt!
    receiver: String!
    deadline: String!
}

Swap Direct Params

type SwapDirectParams {
    pairId: UInt32!
    direction: SwapDirection!
    swapParams: SwapParams!
}

Swap Multi Hop Params

type SwapMultiHopParams {
    hops: [SwapPair!]!
    swapParams: SwapParams!
}

Invest Params

type InvestParams {
    pairId: UInt32!
    shares: BigInt!
    tokenAIn: BigInt! 
    tokenBIn: BigInt! 
    deadline: String!
}

Divest Params

type DivestParams {
    pairId: UInt32!
    minTokenAOut: BigInt!
    minTokenBOut: BigInt!
    shares: BigInt!
    deadline: String!
}

Transfer Params

type TransferParams {
    to: String!
    tokenId: UInt32!
    amount: BigInt!
}

Query Functions

Last updated