After building a marketplace around a utility token, we quickly encountered a (predictable) problem: Who owns our token? We rapidly found that the circulation created by our token sale was smaller than the base of consumers we wanted to reach. Exchanges are confusing. The whole model is new. The pain of acquiring tokens blocked their use.

Clearly, we needed a unicorn.

Uniswap is presently seeking a more unicorn-themed logo.

Enter Uniswap: “A protocol for automated token exchange on Ethereum.” Uniswap provides liquidity pooling for ERC-20 tokens, abiding by the Constant Product Market Maker Model in determining exchange amounts.

What does the Constant Product Market Maker Model look like?

x × y = k

All this asserts is that the product of two variables, x and y, remains constant, k.

In a Uniswap pool, x measures the quantity of pooled ether and y measures the quantity of pooled ERC-20 tokens. A smart contract holds the ether and tokens, and permits swaps which maintain the constant relationship of their product. (To encourage the pooling of liquidity, stakers are allocated a 0.3% fee per swap.)

(x + 𝚫x) × (y + 𝚫y) = k

Consequently, Uniswap provides heterogeneous liquidity at self-adjusting exchange rates.

The guests we’re trying to reach aren’t interested in swapping tokens, though; they want to book travel! Sending customers off to an exchange (Uniswap or otherwise) is just not viable.

And so we introduced Unipay. The goal of Unipay is simple: Allow buyers and sellers to transact transparently in their preferred token.

This is not such a new idea; credit cards and other payment processors already handle currency conversion as a matter of course. Unipay introduces this capability to the ERC-20 token ecosystem, and it does so in a trustless, auditable way, end-to-end.

Payments with ERC-20 tokens most often take the form of an approve call: A token holder grants permission to an address (usually a contract) to withdraw some amount of tokens, and then the payment system uses that approval to handle the rest.

The technical realization of transparent token conversion should, then, adhere to the same pattern: The purchaser makes an approve call, and the payment handler sees an approve call. However, this approval needs to occur on two different tokens.

Unipay bridges this gap. Specifically, Unipay is a smart contract which withdraws an approved amount of tokens from a purchaser, uses Uniswap to exchange those tokens for our preferred token, and then approves the withdrawal of those tokens by our Payments contract. Payment via ether is handled similarly, for the most part. There is no equivalent to an approve call with ether, so instead funds are directly transferred by the purchaser and then converted to tokens for withdrawal.