TLDR: We propose a way to modify Bonding Curve to allow trustless and fully collateralized short-selling directly with the bonding curve without the need of counter-party existence. WIP smart contract is available here.

Mechanic like Bonding Curve token model allows dynamic token price discovery, and incentivizes early adopter with growing price of community token. In the classic bonding curve setting, if anyone finds token undervalued, they can buy tokens on bonding curve, and sell it later at a higher price. When token is overvalued, however, there is no direct way to generate negative signal to the community and earn profit (similar to Short Selling in regular markets). In this article, we will explore a solution to this problem by improving the smart contracts so that it natively support short sellings.

Quick Introduction to Short-Selling

Short-selling in traditional market

What do you do in traditional markets if you are confident an asset is overpriced? Easy, you can short-sell the asset, and hope to buy it back at a lower price in the future, thus reaping the profit. In essense, you borrow and sell the asset from your exchange or broker, who will ensure that you will always be able to buy the asset back, or force liquidating your position otherwise.

Moving on to the world of decentralization

Traditional markets require trusted setup so that you can borrow or lend assets with other parties without worrying about cheating. That does not really exist in the blockchain world. However, various protocols, such as ∂y∂x or Dharma, aim to allow decentralized margin lending. Ocean Protocol has a nice technical series about applying those protocols to Bonding Curve settings with a counterparty. That said, having counterparty introduces unnecessary fees and friction. What if you would like to short an asset, but nobody is willing to put it up for lending? This is very possible for niche bonded tokens without much volume.

Getting rid of counterparty with Bonding Curve

Enough introduction! The remaining of the article will focus on the idea of adding short-selling functionality directly to bonding curve. Three methods will be added to the contract: shortSell , closePosition , and forceLiquidation . For purpose of demonstration, we will create an imaginary community with COMM token, bonded with ETH with price equation P(x) = 10x (collateral equation C(x) = 5x^2 ). Let's assume that there is currently an outstanding supply of 100 COMM the marginal price of 1 COMM is 1,000 ETH . The community has set marginCall threshold to 80% (See Liquidating positions subsection).

Shorting directly with bonding curve

Alice believes that COMM is overpriced and wants to speculate on the price going down. She sends a shortSell command for 15 COMM , and puts 10,000 ETH as collateral. At this point, the smart contracts adjust token supply to 85 and issues a position for Alice with the size of 15 COMM and effective collateral of 13,875 (ETH received from selling 15 tokens) + 10,000 (extra collateral) = 23,875 ETH.

Closing positions

After some time, the interest in community does indeed drop, and 30 community tokens were sold during the period by other people. Community token supply thus reduces to 55. At this point, Alice calls closePosition to buy shorted tokens back and gets 23,875 - 9,375 = 14,500 ETH back. This translates to 4,500 ETH net profit!

Note that if the supply instead moved up, Alice can also choose to close position, but she will get less than 10,000 ETH back. She will not gain profit in that case.

Liquidating positions

However, if Alice declines to close the position even after the supply moves beyond 103.92. At that point, the cost of buying back 15 COMM would be C(118.92) - C(103.92) ≈ 16713 , which is greater than 70% of the Alice's total collateral. To prevent the risk of community losing collateral due to closing position giving back negative ETH (not possible), the smart contract force closing the position and returning Alice whatever left from 23,875 ETH subtracted by the cost of buying back 15 COMM .

Implementation Details

The work-in-progress source code of ShortableBondingCurve is current available here. In this subsection, we will go over some important technical implementation details and the rational behind them.

The notion of bonding curve’s current supply

Traditional bonding curve has only one notion of token supply. In this shortable model, however, the notion of bonding curve supply does not directly translate to the token’s actual total supply. Instead, the effective bonding curve supply point must be subtracted by the total amount of tokens being shorted at the moment.

function getBondingCurveSupplyPoint() public view returns (uint256) {

return super.getBondingCurveSupplyPoint().sub(totalShortTokens);

}

Watch out for the worst possible case of liquidation

Naive implementation may use the bonding curve’s supply point to determine liquidation point. This is not problem if there exists one short-sale at a time. If there are multiple open positions, however, multiple liquidation events may lead insufficient collateral to cover all loses. To fix this, the supply point to determine liquidation point should be the current supply plus all outstanding shorted tokens. In other words, to check if Alice’s position should get margin called, the contract assumes all positions other than Alice’s are liquidated before her.

function _shouldMarginCall(ShortSale storage shortSale)

internal

view

returns (bool)

{

uint256 totalSupply = super.getBondingCurveSupplyPoint();

uint256 worstCaseBuyPrice = getCollateralAtSupply(totalSupply).sub(

getCollateralAtSupply(totalSupply.sub(shortSale.shortAmount))

);

return (

worstCaseBuyPrice.mul(RATIONAL_DENOMINATOR) >=

shortSale.shortSaleCollateral.mul(shortMarginCallNumerator)

);

}

Liquidation as an incentive Game

In an ordinary crypto currency exchange, the exchange’s centralized authority needs to make sure that all open positions have collateral covered, and is responsible for liquidiating all positions that risk losing lenders’ money. On-chain bonding curve contract does not really have that privilege. Instead we open forceLiquidation call open to the public. Anyone can call that and earn a fixed percentage of the tokens returned to the position's owner as the caller's commission. This is similar to what is being done in MakerDAO's liquidation scheme.

Possible Attack Vectors and Responses

We end this article by quickly discussing expected potential attack vectors and our responses toward those arguments.

Attacker short-sell the whole token supply: When that happens, no one in the community can sell their tokens since the supply goes straight down to zero. This may look problematic at first glance. However, dropping supply to zero makes purchasing new tokens extremely cheap. People that find the tokens undervalued can purchase tokens to move the supply and price back up. It’s also important to note that the attacker will always lose money from this attack.

When that happens, no one in the community can sell their tokens since the supply goes straight down to zero. This may look problematic at first glance. However, dropping supply to zero makes purchasing new tokens extremely cheap. People that find the tokens undervalued can purchase tokens to move the supply and price back up. It’s also important to note that the attacker will always lose money from this attack. Attacker pumps the bonding curve to force liquidate everyone: This attack is already possible in traditional exchanges (see 2017 Ethereum Flash Crash). To mitigate the risk, the short sellers must put in more collateral to ensure that their positions will not get liquidated easily.

Conclusion

In this article, we explore an implementation idea to allow direct short selling of bonding curve bonded tokens. The design requires no counterparty and can be incorporated to any bonding curve to accelerate price discovery. We also presented the smart contract to show that implementation is possible. That being said, this is still a work in progress, and we appreciate any feedback or comment. Just drop us a line at connect@bandprotocol.com!