Introducing Hippo — The Aptos Aggregation Layer

Hippo Labs
5 min readJul 14, 2022

--

Hippo Labs is building the ultimate aggregation layer for the Aptos ecosystem.

We’re not just your run-of-the-mill aggregator though; the way we work is a bit different: Hippo provides developers with tools at the compiler, SDK, and framework-level to dramatically increase their productivity. Ultimately, we provide improved product discoverability, interoperability, in aggregate by default.

Our infrastructure is better described as an aggregation mechanism — leveraging a friendly user-facing frontend which provides users direct access to the most optimal pricing and lending rates across multiple DEXs and money markets.

In this post, we’re pleased to introduce ourselves, our product vision, and our open-source development efforts within the Aptos ecosystem.

Who We Are

We are builders, product designers, marketers, and we love the need to wear multiple hats. Our historical roots are spread across the spectrum of traditional finance, compilers, high frequency trading, and previous DeFi startups. We take pride in our ability to iterate quickly on new infrastructure to ship useful open source development tools and compossible DeFi infrastructure.

What We’re Building

Trade Aggregator: First and foremost, we are building a trade aggregator that enables users to find the best trading rates across multiple DEXs in the Aptos ecosystem.

While Aptos is in its early days, we have already seen half a dozen emerging DEXs with their respective tech stack and product focus. We’ll do the footwork to interlink all DEXs so users always have access to the best trading rates within the Aptos ecosystem.

Open-sourced Swap Implementations

We have already built, tested and deployed multiple swap implementations to devnet. Our current Github repo includes the following:

  • Constant-product swap
  • Stable-curve swap
  • Piecewise constant-product swap

The last item in the list, Piecewise constant-product swap, or PSwap for short, is a gas-efficient optimization of the original Curve Finance swap. It can be extended to support non-pegged trading pairs. With the help of oracles, it can serve as the basis for automated concentrated liquidity similar to the product pioneered by Lifinity. We will introduce a detailed breakdown of PSwap within a separate post.

Move to Typescript Transpiler

Down the road, it is likely there will be a significant amount of new DEXs and lending protocols launched within the ecosystem. It’s unlikely we will be able to manually integrate with each and every one of them.

To remedy this issue, we are building a move-to-ts transpiler that helps us to automate the hardest part of that work:

  1. Automatically fetch onchain data and use the transpiled TypeScript code to generate exact quotes for our users in the frontend
  2. Automatically generate multi-hop trades that connect multiple DEXs in a single transaction

The use case for this transpiler, however, goes far beyond trade aggregation.

For example, lending protocols traditionally code their interest rate and borrow limit checking logic in their Move contract (the language that Aptos uses for smart contracts), and then re-implement that exact logic in TypeScript for their frontends to use. This kind of copy-paste-translate and boilerplate work slows down dev velocity and introduces additional sources of bugs.

Using the move-to-ts transpiler, developers only need to write that logic once in their Move contract, and the transpiler automatically generates semantically identical TypeScript code to be used in their frontends.

Similarly, developers for liquidation bots, arbitrage bots, DEXs, yield farming protocols, and other Aptos protocols in general can leverage move-to-ts to significantly reduce the amount of work they need to do managing multiple copies of the same business logic.

Our current status for this transpiler is that it is effectively a TypeScript-based emulator of Move code, already capable of transpiling, executing and passing the majority of unit tests written in the Move language. These tests are aggregated across `AptosFramework`, the standard library `Std`, and our own hippo-swap package. We’ll continue to increase the number of unit tests by having it execute move contracts from open-sourced Move packages we find on Github and soon we will be able to bring it to a production-level quality.

Transaction Simulation API

To continue our mission of serving developers and users in the Aptos ecosystem, we recently developed and merged the Transaction Simulation API into the aptos-core repo. Wallet developers can make use of this API to provide users with the following benefits:

  • Accurately provide transaction gas estimates — This means users will always have some certainty about their anticipated gas expenditures.
  • Preview wallet balance changes when asking for users to confirm a transaction — This means users will be far less likely to suffer from phishing/scam sites attempting drain their wallet’s assets (coins/NFTs).

For a preview of what this transaction simulation feature looks like to users, we have attached this screenshot from our own wallet when it asks the user for confirmation:

Developers looking for a reference implementation to obtain the gas estimate and wallet balance change can take a look at our open-sourced wallet here.

Aptos-wallet-adapter

Our wallet adapter supports most of the wallets in the Aptos ecosystem, including the Aptos official wallet, the Martian wallet, the Fewcha wallet, our own Hippo wallet, and will soon support Pontem and Nightly wallet as well.

We intend to support all Aptos-compatible wallets as we become aware of them, so that frontend developers from other Aptos protocols can simply import this library and provide support for multiple wallets out of the box.

Stay up to date

This article provides a summary of some of the things we are working on. We have more surprises for you down the road. To keep up to date on our progress regarding development tools, integrations, and launch dates, follow us here on Medium, Twitter, and join our Discord community.

--

--