Confidential Trading: Hinkal Swaps
Introduction
Over the past year, DeFi has become one of the crucial venues for price discovery and execution. Within a range of $20m-$100m AUM, DeFi is a necessary function in the order execution management systems for liquid funds.
With the yields coming back to DeFi with new primitives, such as re-staking and yield trading, DEXs and aggregators are the must-have avenues for traders.
One of the crucial points to facilitate this movement is having functional privacy infrastructure that enables custom setups for different types of trades. CEX traders looking to move to DeFi can find an answer in privacy.
Hinkal’s all-in-one-place solution
Hinkal provides all the necessary functions for a confidential execution environment. It combines the liquidity of three major exchanges - Uniswap, 1Inch, and Odos, with compliance and custom functions:
- The adjustable slippage gives the users great freedom to execute their preferred strategies.
- The built-in cost breakdown module and the ZK Proof generation calculator enable complete control over the user’s asset utilization.
- The statistics dashboard provides detailed token allocation information and transaction history.
With this set of functionalities, the protocol enables confidential trading, protecting against copy-traders and MEV attacks for 3 major cases:
- Traders with a significant amount of tokens and/or frequency of swaps.
- Buy and hold strategies.
- Receiving illiquid tokens for future liquidation.
Let’s dive into specifics.
A wide range of tokens
Once users have deposited their funds in Hinkal, they can execute their trading strategies in complete privacy with any token. Hinkal has integrated 3 major liquidity aggregators - Odos, 1Inch, and Uniswap. This ensures that users:
- Get access to the vast majority - if not all token pairs to swap.
- Get the best price rate for any chosen pair.
To achieve this, the protocol leverages the strengths of all 3 integrated aggregators. Odos manages to provide the best quotes for swap pairs compared to other exchanges. However, Hinkal also taps into the liquidity of Uniswap which might have a better price if the routing isn’t needed, so it saves from an additional smart contract interaction gas cost. Lastly, 1Inch provides a wide variety of pools, giving traders access to more token pairs.
Hinkal first scans the price quotes of these liquidity providers for the chosen token pair. Then, a price comparison takes place and the most favorable for the user is chosen. Users can see how much they save by executing their swap through this provider. They can also manually change the provider and accept the quote from any of the available choices.
Custom tokens
Hinkal enables its users to transact confidentially with any token. In case a user wishes to deposit or execute swaps with new tokens, they can easily import it manually. If the token can’t be found in the list of token options, the contract address of the token can be pasted into the search bar. The user can enter a name and then save it. Same applies to DEXs, users can add the tokens they want to buy manually, so no one can understand who acquired the token. This use case might be relevant to VCs wishing to receive tokens onto shielded addresses.
Custom slippage
Available liquidity and price fluctuations can cause swap transactions to fail if the slippage tolerance is set at low values. At the same time, swaps with high volumes could be picked up by potential exploiters and be the target of MEV attacks. To counter both of these issues, users set a custom slippage tolerance with an easy-to-use slider.
Costs breakdown
All transactions that take place through the protocol are done on behalf of the users through a relayer. Users cover the gas fees and the Hinkal commission of those transactions with a portion of the token received from the swap - without worrying about having the required balance in the native gas token. To simplify the process, Hinkal has implemented a comprehensive breakdown of all costs. After the quotes are received for a token pair swap, the following information is provided:
- Gas costs: The gas costs to execute the transaction in terms of dollar value and token amount. Hinkal uses the gas terminal, calculating the average gas costs at the time of the transaction.
- Hinkal Commission: Hinkal charges 5 bps (0.05%) to provide swaps in complete confidentiality. The commission is calculated as a portion of the token received from the swap.
- Received Token: The total amount of tokens received from the user after deducting the above costs.
ZK proof generation calculator
When a swap takes place, the protocol first generates a ZKP determining the user has enough funds to execute the transaction. The ZKP along with the smart contracts interactions to execute the swap comprise the total gas fees the user needs to cover. By pressing “Calculate” the user can find out the exact costs before the swap - not the gas terminal estimation. A ZKP is generated and Hinkal emulates the transaction with the exact parameters, thus calculating the gas costs accurately. This functionality is provided as an optional feature, as ZKPs generation is process-intensive and requires a few moments.
Stealth addresses
Changes in token amounts are pre-determined before a transaction is submitted and costs for the transaction are covered by the user. However, gas fees might be less than expected. To return to the user any overhead costs covered, while preserving their privacy, the protocol uses stealth addresses. They are generated before the transaction swap is submitted. This enables the protocol to execute the transaction, cover the transaction costs, and send back to the user’s shielded balance any difference between the expected and the actual cost.
Statistics dashboard
Traders, asset managers, and investors need to have complete control over their crypto portfolio. Hinkal provides a comprehensive picture of the user’s transactions and assets usage, through the dashboard found in the statistics page. Divided into two tabs, the dashboard includes:
- Balance: It provides a clear breakdown of tokens and their percentages comprising the user’s balance. The dashboard tracks and visualizes which assets are staked and on which protocol, the liquidity provided on pools, as well as which assets are idle. Users can refer to the graphs representing their total portfolio allocation and its breakdown in token percentages to get the full picture.
- Transactions: It acts as a built-in block explorer. Users can track all their transactions executed through the protocol with their shielded balances. It includes information on the status of the transaction, the block it was included in, its timestamp, the dApps the user interacted with, the fees and gas prices as well as a short description. The transaction hash provided is clickable, enabling users to view it on the network explorer.
Security
In 2023, 231 smart contract hacks occurred ($1.7 billion). To prevent a similar scenario, Hinkal has secured its smart contract with audits by Quanstamp, Secure3, and Zokyo. Hired white hacker has also inspected the protocol for potential exploits. On top of that, Hexagate provides real-time threat detection and wallet screening. Lastly, to ensure no individuals or wallets that belong to sanctioned lists access the protocol, Hinkal is secured with a privacy-preserving AML/KYC (B) layer.
Conclusion
Hinkal provides a powerful confidential execution environment of all swap strategies for the most sophisticated users. As DeFi continues to advance, Hinkal will continue to innovate, offering a sophisticated and user-centric solution to meet the needs of any demanding user.