Smart Liquidity Routing — 101

Simon Barducci
Cargo Protocol
Published in
4 min readJun 6, 2022

DeFi promises not only the composability of financial primitives but also enhanced capital efficiency. The problem is that the landscape is a rapidly changing, where anyone can write and use smart contracts thanks to the permissionless nature of blockchains. Fortunately, certain standards have come about, largely due to Ethereum and the EVM, and some key contracts becoming widely adopted due to passing audits and being battle-tested with billions of USD. Right now we are seeing a new wave of innovation thanks to Uniswap v3.

History

To tackle the challenge of capital efficiency, we began development covering autocompounding, a process that increases the amount of tokens over time through the automation of claiming rewards on behalf of the user and compounding effects from redepositing. On the surface this looks like a toy, however the complexity lies within the rounding errors in calculating balances due to different formats. This makes calculating yields accurately something that needs to be addressed if we want to see mainstream adoption.

Next we integrated with DEXs, the Uniswap v2 standard, the endpoint at which tokens are swapped for other tokens. To make swaps possible, we introduced deposit and withdrawal calls to the contract which is currently being aligned with our aggregator on Polygon which serves other LP managers for Uniswap v3. This impacted our autocompounder (rather positively) as it introduced the management of rewards which impacts yield calculations. We are finalising our integration to Uniswap v3 on Celo which will launch soon!

Finally, we implemented leverage and the integration of lending protocols. Not only does this make capital work more efficiently, users can borrow to increase liquidity, but you can also introduce cover products to buffer against market shocks. The market is volatile so we built a mechanism to protect against liquidation. The challenge is implementing the UI which can be determined through A/B testing, however when it comes to allowing users to choose their risk tolerance, we found ourselves observing the requirements of regulatory sandboxes which has become more relevant as our project has progressed. With this in mind, we pivoted towards collaborating with different partners to refine the UI together.

Current Path

In developing the UX, we uncovered different issues that do exist in DeFi that are not going away soon. Wallet or asset management, risk notifications, and even moving across platforms are hurdles yet to be addressed. To counter these, we developed our own integrations with wallets Valora, Metamask and Coinbase, we built an MVP (based on and integrates with Moralis) to provide a visual representation of transactions and token flow, and architected the system so that smart contracts could be updated safely and flexibly in a team environment.

Naturally we continue to follow best practices used within the industry to ensure the integrity of the system is maintained. Multisig controls configurations and updates in the event of platforms or other user behaviours needing to be changed. Finally, we carried out front-end penetration and vulnerability testing, in addition to recently submitting our code to be reviewed by cLabs for feedback.

Focus Now

As described above, blockchains enable the end user control of money with a UX that the industry is still figuring out. We want to improve the UX of money which we will benefit DeFi and help bring about the adoption of ReFi. Bitcoin brought individual sovereignty, and Ethereum brought dapps and the ability for money to be backed by the work of the people (Web3 will be amazing). DeFi can be improved with structured deposits, a guarantee that we don’t get rekked. For now, these are only available in the form of centralised services and not built around communities. We believe we can enable these communities by improving the UX with more stablecoin solutions.

As a project, this also makes sense since stablecoin regulation in the UK is becoming clearer and more accepted by authorities. This will help real world assets (RWA) flow into structured deposits and provide investor protection in the face of market volatility. What this will look like in the end depends on the makers and builders in the space. Community support can be the new consumer protection; independent financial advisors associations can become a collection of tools; and indexes can track performance (specifically in ReFi) based on different metrics such as user engagement. The collective action of directing liquidity is a powerful tool for humanity and we will continue to build tools that increase the visibility of market signals.

🚢 Join us at the dock: Discord // Twitter // Medium

--

--