Swaps

Hinkal Swaps are allowing users to swap ERC-20 tokens confidentially. To achieve confidentiality, Hinkal uses relayers and APIs from Odos, Uniswap, and 1inch (more to be added in the future).

When a user wants to swap assets, they generate zk-proof that they are eligible to swap a given amount of the first asset in return for the incoming amount of the second asset. From the viewpoint of outsiders, the swap transaction will be submitted from the relayer's public Ethereum address to Hinkal Pool smart contract.

In the transaction, Hinkal Pool will call Odos, Uniswap or 1inch’s Smart Contract in order to swap the assets. If, for any reason, the swap fails, then the whole transaction will be reverted, so no additional commitments and nullifiers will be created.

Since the protocol implements UTXO based model of commitments and nullifiers, the swapped amount should be known at the time of zk-proof generation. At the time of the swap transaction submission, it is unknown how many other swap transactions will be submitted in the current block.

This factor generates unpredictable slippage from the viewpoint of the user and relayer. Slippage is relative to the transaction value, whereas gas fees are not. For example, paying $1 out of $10 in gas fees amounts to 10%, but paying $1 out of $1000 is only 0.1%. Check out Hinkal's current fee structure used to fairly compensate for the costs.

To tackle the following risks:

  • slippage

  • gas costs

  • smart-contract parameter change affecting payoffs (e.g. CRV emission rate)

the Unexpected Payoffs are compensated to the user using stealth addresses generated before the transaction is submitted.

Important to mention, relayers do not have custody of the swapped assets.

Last updated