Introduction

What is BentoSwap? 🍱🔀

The Bentoswap Decentralized Token Exchange is a revolutionary new on-chain protocol built on the APTOS ($APT) blockchain, implementing a fully customizable automatic market maker (AMM) based on Uniswap’s ‘constant product formula’. Like Uniswap, pools consist of reserves of two assets, known as a pool pair, which maintain the liquidity reserves in a safe and proven way. Traders pay a fee of 50 basis points (25bp to liquidity providers, 12.5bp to a buy back and burn, and 12.5bp to bentoswap) which equates to 0.5% on each trade. Bentoswap’s reinvention of AMMs provides a few key differences than any other AMM in development today. Any token or coin can be used as an asset to the pool pair, not just coins. This allows the creation of arbitrary NFT pools, such as NFT/Coin pairs, and even NFT/NFT pools. Also implemented is an optimized price oracle utilizing a time-weighted average price equation to ensure large swings in liquidity do not cause an exploited market price. In addition to these two major enhancements over AMMs such as UniswapV2, there exists an on-chain limit order book where people can automatically transact at desired price points without watching and timing the market. This paper outlines the mechanics of each contract that is used to create the full suite of features that power Bentoswap. This includes the swapping contract that performs the trades, the order book which allows limit orders on top of the market, and the router contract that sends the users to the correct destination contracts depending on their use.

V1 Features 🏆1️⃣

1) Creation of arbitrary pairs of NFTs and Coins, Coin/Coin, NFT/Coin, and NFT/NFT

2) Add liquidity to any pool to collect fees on trades

3) Automated pricing using constant sum formula (x + y = k)

4) Instantly swap any token or coin that has a pool for it

5) Time-Weighted Average Pricing formula pricing oracle (based on UniswapV3’s TWAP Oracle) to obtain real-time pricing for any token or coin asset

6) Flash swaps

7) Order book for tracking limit orders of certain price points with customizable time-in-force

Arbitrary Token/Coin Pairs 🪙/🪙

UniswapV2 invented the creation of arbitrary Coin/Coin pools to allow users the ability to automatically price any coin as it correlates to another coin. Limiting this to only coin pairs imposes a limitation for liquidity providers of large-scale decentralized economies, since immediate liquidity as well as trustless demand-based pricing of non-coin assets are not possible.

Bentoswap allows liquidity providers to create fully customizable pool pairs of any asset type. This addition unlocks new ways to balance multi-asset ecosystems combining tokens with coins. However, having infinitely many pair combinations for any given asset can make it difficult to find an optimal path for trades, but routing can be handled on top of the Bentoswap protocol, either through an aggregator or other off-chain solutions.

Add Liquidity to Collect Fees 🚰💰

Liquidity Positions (LP) are tracked using a Coin that represents a users position in any given pool, much like UniswapV2. Because of this, Coin/Coin pair liquidity handling remains the same familiar experience as UniswapV2 style pools.

NFT pools track positions with the same LP coins, and has the same logic for adding liquidity in a pool (equal parts of both sides of a pair). However, because NFTs are non-fungible, removing liquidity is slightly different from normal liquidity handling. When removing liquidity from an NFT/Coin pool, fractionalized NFT withdraws are automatically converted to the paired Coin through the pool and withdrawn to the user. NFT/NFT pools will calculate the remaining fraction of an NFT and look for a corresponding NFT/Coin pool that the user selects to convert the fraction of the NFT to, sending the user their NFT+NFT+Coins from removing LP. If there is no NFT/Coin pool to swap into, the swap will incur a unique slippage when removing liquidity, having the fraction of the NFT stay in the pool to be distributed to liquidity providers.

Constant Sum Formula 🤓

The constant sum formula is a formula that TraderJoe pioneered. It is also known as the x + y = k formula, and the logic can be found at https://docs.traderjoexyz.com/concepts/bin-liquidtyarrow-up-right

Instant Swaps 💨🔀

For Coin/Coin pools, this experience is the familiar UniswapV2 style pools. However for NFTs, this means the default experience of NFT trading is instantaneous, optimizing the true value of NFT assets based on supply/demand instead of speculative listings and undercutting.

Time-Weighted Average Price ⚖️

The TWAP oracle in charge of providing real-time pricing of every digital asset allows for summed, logarithmic, and geometric means to be calculated for pricing given the period of time. In addition to this, it also does not require constant updates to the oracle’s stored pricing like with UniswapV2, so users of the Oracles can calculate true TWAP values needed for protocols where correct pricing is paramount. This allows Bentoswap to be the first solution to real-time, accurate NFT pricing needed for lending protocols.

Flash Swaps 📸🔀

Based off of UniswapV2’s flash swap mechanics, this does not alter the experience that is familiar amongst UniswapV2 style AMM users. However, for NFTs this allows NFT asset flash loans to be utilized to claim ownership of assets for the life of the transaction.

Limit Order Book 📂📖

Set desired price points to buy or sell Coins or NFTs automatically based on the market value of the asset. Customize time-in-force parameters in a similar way as you do your favorite CEX to make sure you never miss a pump. For NFTs, this is the final feature that creates a full suite marketplace experience while honing in on DeFi liquidity and pricing stability.

Last updated