How Set Protocol Works Under the Hood

Diving deep into the world of bundled crypto-assets

Anthony Sassano
9 min readJun 18, 2019

Introduction

Set Protocol is an Ethereum-native DeFi primitive that leverages existing Open Finance protocols to allow for the bundling of crypto-assets into fully collateralized baskets which are represented as ERC20 tokens on the Ethereum blockchain. The protocol currently supports 3 assets — ETH, DAI and Wrapped Bitcoin (WBTC).

Set Protocols most exciting feature is that it allows for the creation of Strategy Enabled Tokens (or Sets) that are algorithmically structured based on a wide range of criteria, strategies, parameters and asset weights. These Sets can be set to automatically rebalance based on one or more of the aforementioned factors.

Set Protocols native interface, TokenSets, currently allows users to buy and sell 4 ‘Range Bound Sets’ and 3 ‘Buy and Hold Sets’ management strategies. These will be explained in greater detail later in this post.

Buying and Selling a Set

When users purchase a Set through the TokenSets interface, they are purchasing an ERC20 token that represents a claim on the underlying assets inside the Set Protocol smart contracts. For example, purchasing 1 BTC ETH Equal Weight Set would bundle together 50% WBTC and 50% WETH and issue a BTCETH5050 token to the users Ethereum wallet. At time of writing, this would cost you 1.212 ETH (or $330.85).

The buy modal for the BTCETH5050 Set on the TokenSets platform

The real magic of buying a Set is that the liquidity is automatically sourced from Kyber Networks on-chain reserves. The key benefit of this is that there is no need for users to hold the underlying tokens or wrap ETH to buy a Set — they can simply use ETH which is then converted into the appropriate tokens. In the above case, 50% of the ETH would be used to purchase WBTC through Kyber and 50% of the ETH would be automatically wrapped — all in one transaction!

A typical Set purchase visualized

The end result is that the user is credited 1 BTCETH5050 token to their Ethereum wallet which is freely tradable on platforms such as Uniswap and other centralized or decentralized exchanges (provided that there is liquidity and trading pairs). In fact, the ETHLOVOL Set is already listed on the DDEX decentralized exchange.

Once a user is ready to sell their Set, they can use the TokenSets platform which automatically credits the appropriate tokens to the users Ethereum wallet — effectively burning the relevant Set token(s). User’s are also able to sell their Set on any platform that allows for the trading of ERC20 tokens.

You may be wondering about the tax implications of buying, selling or trading Sets. Unfortunately, given the global nature of crypto, tax laws can vary wildly depending on jurisdiction. As suggested in the official TokenSets FAQ, it is recommended that users consult a tax professional.

How Sets Are Valued

Each Set has its own price which is based on its Net Asset Value (NAV) which is the sum of the value of each of its underlying components.

Let’s take the above example of a user buying 1 BTCETH5050 token for 1.212 ETH ($330.85).

This Set price is calculated by summing the spot prices of the underlying collateral. So for the BTCETH5050 token, 50% WBTC will cost $170.34, 50% ETH will cost $157.71 and there is a $2.80 Ethereum network fee. The network fee is larger than a normal transaction because it’s actually executing a bundle of transactions in order to trade the ETH for WETH and WBTC.

This ultimately gives a total BTCETH5050 Set price of $321.71.

A view of Etherscan displaying all of the transactions that are bundled together when a user purchases a Set

It’s also worth noting that users may sometimes be credited ‘change’ after purchasing a Set because the protocol was able to obtain a better purchase price after the fact.

Different Types of Sets

As mentioned earlier, the TokenSets interface allows users to buy 4 ‘Range Bound Sets’ and 3 ‘Buy and Hold Sets’ Sets.

Range Bound Sets are structured to profit from when prices of a volatile asset are not trending in one particular direction. Each Range Bound Set contains a mix of a volatile asset (ETH) and a stable asset (Dai). The Range Bound strategy automates buying the bottom and selling the top within its defined range.

For example, the ETH Range Bound High Volatility Set automatically sells DAI for ETH if the price of ETH dips more than 50% and sells ETH for DAI if the price of ETH rebounds more than 40% — with a minimum rebalance interval of 14 days.

Given how volatile crypto prices are, the Range Bound Volatility Sets could prove quite profitable over a long-term time horizon. Below is an example of how the ETH Range Bound High and Low Volatility Sets would’ve performed against ETH itself from 5/12/16 to 1/16/17. You’ll notice that both range bound strategies (the red and green lines) turned out to be more profitable than simply holding ETH over the given time period.

Buy and Hold Sets rebalance based on specific weight changes in the underlying collateral. For example, the ETH Enthusiast Set is collateralized by 75% of ETH and 25% of BTC. This Set automatically rebalances every 30 days if the price difference between the underlying assets is 2% or greater so that the 75/25 ratio is always kept in check.

Endless Strategies

As you may have realised by now, Sets can be structured to offer nearly endless management strategies depending on a user’s risk appetite. Outside of range bound and buy & hold, Sets can be created based on other categories of technical and fundamental indicators.

Technical indicators refer to those mainly used by traders (such as the MACD, bollinger bands, RSI etc) whereas fundamental indicators track on-chain metrics (such as hashrate, active addresses, fees paid etc).

Technical Indicators

In crypto, technical analysis (TA) indicators are used and shared within the community frequently which means that they tend to have a material effect on the prices of crypto-assets (especially smaller market cap assets).

Given this fact, a Set could be structured to automatically rebalance by selling a certain crypto-asset if the RSI indicator paints an “overbought” pattern or buy a crypto-asset if it paints an “oversold” pattern.

Technical indicators are commonly thought of as leading indicators meaning that price tends to follow them.

Fundamental Indicators

There are many on-chain indicators that could possibly be used to structure a Set. We’ll take the popular NVT indicator that is used to determine when BTC is either overvalued or undervalued based on on-chain trends.

The Bitcoin networks NVT is calculated by dividing the Network Value (market cap) by the daily USD volume transmitted through the blockchain. When the NVT is high, it indicates that the network valuation is outstripping the value being transmitted through the Bitcoin blockchain.

A Set could be structured to track the NVT indicator (via some sort of oracle service) and automatically rebalance based on certain parameter changes — such as a low NVT signalling that BTC is undervalued.

It’s important to keep in mind that on-chain metrics are usually seen as a lagging indicator meaning that they tend to follow price.

Multiple Indicators

Sets don’t have to be based on just a single indicator — they could potentially be structured to track a combination of technical and fundamental indicators and only rebalance if a certain threshold is met across all of them.

For example, there could be a Set that is designed to rebalance if the price of ETH has moved up 50% within a 30 day period, the RSI indicates that the asset is “overbought” and the Ethereum network active addresses have actually declined over this 30 day period. This could potentially indicate that the price rise was driven mainly by inorganic demand (or “manipulation”) which could signal that ETH may be overvalued.

Set Phases Explained

Sets have three main phases: Normal, Proposal, and Rebalancing.

Normal is the phase between rebalances that Sets sit in for the majority of the time.

A Set enters the Proposal phase once its rebalancing conditions are satisfied and the next allocation is determined. This period is set at 8 hours for the current Sets listed on TokenSets.

During the Rebalancing phase, Set trading is disabled and the underlying components in the old Set allocation are swapped for the new allocation via a modified open dutch auction process which typically lasts between 10 and 14 hours. Do note that in the future the aim is for the auction time to be significantly shorter.

Let’s take a look at how this would work for the ETH Enthusiast Set.

This Set is eligible for rebalancing if there is a 2% price difference in the underlying tokens (ETH and BTC) and a minimum of 30 days has passed since the last rebalance. Once this criteria is met, the Set enters the Proposal phase and the propose function is called on the Manager smart contract which then calls the propose function on the Set that is rebalancing. From here, anyone is able to call the startRebalance function which then triggers the Set to enter the Rebalancing phase and begin the open dutch auction process.

During the auction process, traders can submit bids to swap the new components of the Set for the old ones. Over time, the price becomes more and more favorable to traders as the auction goes on which ensures that the rebalancing reaches completion.

The rebalancing interface (not currently available to the public)

Users place bids by calling the placeBid function on the RebalancingAuctionModule smart contract and are essentially trading against the Set Protocol system. With the current Sets, the auction is parameterised at prices 50% higher and lower than fair value. The auction completes once the price reaches a fair value (taking into account some amount of slippage).

Please note that this auction process is currently not available to the public.

Building on Set Protocol

The Set team have built out an extensive developer portal with documentation that walks through how to get started building on top of the Set Protocol.

Developers can already create and issue their own simple basket Set (such as a ‘Stable Set’) or create their own Rebalancing Set based on indicators of their choosing. The developer portal also lists other project ideas that the Set team has come up with that can already be built using Set Protocol.

The ‘Set Creator’ functionality will eventually be available via an easy to use front-end interface so that the general public can create and deploy their own Sets. This would open up opportunities for use-cases such as traders tokenizing their positions or for dApp creators to deploy baskets of assets easily by utilising the Set Protocol smart contracts.

The Future for Set Protocol

All in all, the Set Protocol team have built out a solid primitive that fits nicely into the existing Ethereum DeFi stack. Sets are a powerful combination of Ethereum-native protocols such as decentralized exchanges & stablecoins. I fully expect to see hundreds, if not thousands, of unique Sets deployed over time to fit every investor appetite and risk profile which will ultimately allow for anyone to become their own Crypto Fund manager.

Want to dive in and purchase your very first set? Head on over to TokenSets to get started!

I’d like to thank the entire Set Protocol team for reviewing and providing feedback on this piece.

Learn more about Set and join the community

Website | Medium | Twitter | Telegram | Slack |

--

--