Introducing Swingby LP Tokens on Ethereum!

Discover how fees are paid in the network with our deep dive into SWIP-020.

Image for post
Image for post

Swingby’s Skybridge network consists of clusters of nodes that use threshold signature cryptography (“TSS”) to form gas-optimized multi-signature wallets that offer token swaps across blockchains.

As announced previously, our ChaosNet MainNet was set to launch December 28th and bridge BTC to Ethereum through WBTC. After a very successful rollout, the team have recently announced that the first Skybridge is now live and had signed the first EVER trustless swap from BTC to WBTC (and back).

With the launch of the network, a new ERC20 token named “Swingby BTC LP Token (sbBTC)” came along with it. But what is it and what is it used for? Don’t worry, we’ve got you covered. This article discusses the current development of SWIP-020 and how Swingby LP tokens are used in Skybridge.

Problems

Skybridge consists of a network with close to a hundred validators: the metanodes and an endless number of external liquidity providers, locking their funds into the pools for end-users to swap their assets across blockchains.

The first iteration of Skybridge offers users to move trustlessly their BTCs (on the Bitcoin blockchain) to WBTC on the Ethereum public network and vice versa.

With Skybridge, hundreds of stakeholders must be rewarded with a fee mechanism associated with each cross-chain transaction (i.e., BTC to WBTC or WBTC to BTC). To prevent an explicit distribution of these fees that would be costly (like a multi-send transaction), Skybridge scales by relying on a distinct sort of LP token: the Swingby LP token that is issued on Ethereum as an ERC-20 compliant token.

The WBTC/BTC Swingby LP token is deployed on the Ethereum mainnet at 0xefcf527fdd2084de2ac9ba34463be4a245b45efa.

Solutions

These LP tokens allow efficient distribution of swap fees from cross-chain transactions to both liquidity providers and network validators, with a dynamic exchange rate relative to the assets pooled (i.e., WBTC/BTC for the ChaosNet).

Compared to the use of multi-send transactions, this LP mechanism prevents any explicit distribution of fees, which would have led to a number of transactions equal to the number of participants in Skybridge. Thus, this results in better gas cost execution for all network participants.

In short, this implicit fee mechanism makes network providers (the metanodes!) and liquidity providers earn more for each swap while making Skybridge suitable for both small and large size transactions.

The first iteration of Skybridge focuses on a BTC/WBTC pool; this pool’s LP token is referred to as “sbBTC” and is an ERC-20 compliant token on Ethereum.

Finally, the issuance of LP tokens on Ethereum allows their integration into existing DeFi protocols, leveraging the composability value proposition of the DeFi ecosystem. Yes, these tokens will be tradable and/or usable in your favorite DeFi protocols!

Implementation

Circulating on Ethereum, these tokens represent ownerships of the assets pooled: (1) their supply and (2) their value fluctuate over time based on an exchange rate relative to the asset being bridged (e.g., BTC).

The exchange rate & supply logic can be broken down into three distinct sections:

1. Users swapping assets (WBTC to BTC & BTC to WBTC)

2. Liquidity providers depositing assets

3. Liquidity providers withdrawing assets

1. User swap transactions

When a swap is handled, part of the transaction fee is allocated to the smart contract and defined in the contract by using a variable called amountReceivedLP (expressed in BTC for each sbBTC). Node operators are also rewarded by collecting fees.

For instance, for any given swap transaction moving BTC to WBTC on Ethereum, the total fee amount received can be calculated such as:

Image for post
Image for post

The value for k is handled at the smart contract level and adjusted by the TSS address.

This fee collection mechanism is achieved by minting LP tokens to metanode operators, allowing them to become liquidity providers and to benefit from the compounding of their stake.

Once the amount is paid to LPs, the exchange rate of the LP (relative to BTC) must be re-calculated such as:

Image for post
Image for post
Image for post
Image for post
Image for post
Image for post

Thus, the exchange rate of the LP relative to the price of BTC increases after every new swap because:

Image for post
Image for post

The number of new LP tokens that must be minted for metanodes is calculated as:

Image for post
Image for post

Each i metanode has a stake in Swingby tokens.

Thereby, the number of unclaimed LP tokens increases by

Image for post
Image for post

while,

Image for post
Image for post

At any point in time, metanodes can claim these LP tokens (i.e., minting), resetting the number of tokens that have not been claimed.

2. Liquidity deposits

For liquidity deposits, a fee can apply if there is an imbalance in the pool quantities, as defined by its ratio relative to the total quantities held in a two-asset pool.

Thus, adding liquidity can change the LP exchange rate (vs. BTC). If so, these deposit fees are collected exclusively by metanode operators. Thus, the number of LP tokens increases accordingly based on the fee collected (if any).

For the full details, please visit Swingby’s SWIP repo.

3. Liquidity withdrawals

When a user wishes to withdraw liquidity to one side of the pool, the LP token must be burnt. The exchange rate of the LP relative to BTC is recorded as part of the user’s request.

Removing liquidity can change the LP exchange rate (vs. BTC). Like liquidity deposits, a fee would be collected exclusively by metanode operators if there is an imbalance in the quantities held on two sides of the pools.

For additional details on the fee structure, please refer to Swingby’s SWIP-020 subsection.

Final words

Skybridge is the first protocol offering non-custodial swaps to move assets between the Bitcoin blockchain and Ethereum by building on TSS technology. On December 28th, ChaosNet will offer bi-directional swaps between BTC (on the Bitcoin blockchain) to Ethereum through WBTC (and vice versa!).

As shown in this deep dive on SWIP-020, protocol decentralization often comes at great costs for protocol users, reducing the appeal of such solutions. Fortunately, using a dedicated LP token allows all protocol stakeholders not to compromise security or trading decentralization for efficiency.

Since one of our core goals is to bridge the gap between blockchains by offering non-custodial cross-chain swaps, the team will strive to find additional ways to offer a non-custodial decentralized solution that rewards fairly liquidity providers, network validators, and end-users.

Time to make cross-chain protocols truly decentralized with Swingby’s Skybridge!

Want to trade Swingby? Check us out on CoinGecko or CoinMarketCap.

Get Rewards! Stake your Swingby Token to earn up to 52% annualized (67% compounded) in rewards, airdropped to your wallet weekly. Use the Staking Portal or BitMax.

TestNet Explorer: bridge-testnet.swingby.network/explorer
Staking Program: https://swingby.network/earn

Telegram: https://swingby.network/telegram
Twitter: https://swingby.network/twitter
Reddit: https://swingby.network/reddit
Discord: https://swingby.network/discord
Github: https://swingby.network/github

Written by

The fastest protocol for cross-chain swaps, allowing DeFi users to move assets between blockchains without the need for a trusted party. https://swingby.network

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store