DipDupExchange

public struct DipDupExchange : Codable, Hashable, Equatable

A DipDup Exchange object with all the necessary pieces for checking liquidity and performing Swaps

  • Enum to denote the type of Exchange (e.g. Liquidity Baking, Quipuswap)

    Declaration

    Swift

    public let name: DipDupExchangeName
  • The KT address of the exchange contract

    Declaration

    Swift

    public let address: String
  • String representation of the Exchanges TezPool

    Declaration

    Swift

    public let tezPool: String
  • String representation of the Exchanges TokenPool

    Declaration

    Swift

    public let tokenPool: String
  • The total liquidity available (RPC representation, no decimals)

    Declaration

    Swift

    public let sharesTotal: String
  • The daily middle price

    Declaration

    Swift

    public let midPrice: String
  • The token object containing all the token info (decimals, contract address, symbol etc,)

    Declaration

    Swift

    public let token: DipDupToken

Helper functions

  • Return the XTZ pool as an XTZAmount object

    Declaration

    Swift

    public func xtzPoolAmount() -> XTZAmount
  • Return the Token pool as an TokenAmount object

    Declaration

    Swift

    public func tokenPoolAmount() -> TokenAmount
  • Retrieving the liquidity token decimals is currently not supported. Hardcode the numbers for now

    Declaration

    Swift

    public func liquidityTokenDecimalPlaces() -> Int
  • Return the total liquidity as an TokenAmount object

    Declaration

    Swift

    public func totalLiquidity() -> TokenAmount
  • Helper to detect if the pools are empty (determiens if the next addLiquidity will be setting the exchange rate)

    Declaration

    Swift

    public func arePoolsEmpty() -> Bool
  • Conforming to Hashable to enable working with UITableViewDiffableDataSource

    Declaration

    Swift

    public func hash(into hasher: inout Hasher)
  • Conforming to Equatable to enable working with UITableViewDiffableDataSource

    Declaration

    Swift

    public static func == (lhs: DipDupExchange, rhs: DipDupExchange) -> Bool