Bamboo Relay Integrates Chainlink Oracles for Stop-Loss Order Functionalities

Dex
Bamboo Relay
Published in
6 min readJun 15, 2020

Despite recent volatility, Decentralized Exchanges (DEX) continue to maintain their long term trendlines indicating sustained growth. As a key component of DeFi, DEXs facilitate peer-to-peer non-custodial trading, lending, and borrowing of digital assets at spot prices or on margin.

To eventually rival Centralized Exchanges (CEX), DEXs must maintain these unique characteristics while at the same time providing all the familiar features that traders use today to manage their portfolios. One of those key features is stop-loss functionality, which allows traders to automate asset management functions based on the price action of assets.

To further close the gap between CEXs and DEXs, we are excited to announce that Bamboo Relay now supports stop-loss functions via integration with Chainlink’s Price Reference Contracts for high-quality price feeds. Bamboo Relay is the first 0x relayer to add stop-loss functionality and bring it to the 0x ecosystem. While the initial integration will be limited to Bamboo Relay, future integrations will allow anyone on the 0x mesh framework to utilize Chainlink for this feature.

Understanding the Importance of Stop-Loss Functionality

Bamboo Relay is a 0x relayer — a DEX with its own UI and set of functionalities that uses the 0x protocol on the backend to facilitate wallet-to-wallet trading of any ERC-20 token. The 0x protocol is a smart contract protocol and mesh network of relayers that have a common messaging layer for communication and shared liquidity.

To enhance the set of features available to users, Bamboo Relay is the first 0x relayer to add stop-loss functionality. There are two basic types of stop-loss functions:

  1. Sell Stop Limit — The user informs Bamboo Relay to limit sell a set number of tokens at a specific spot price if the price drops into a range.
    Example: Put a limit sell order in for 10 ETH, which may only be executed at the spot price of $150 ETH/DAI when ETH/DAI is between $145 — $150 .
  2. Buy Stop Limit — The user informs Bamboo Relay to limit buy a set number of tokens at a specific spot price if the price rises into.
    Example: Put a limit buy order in for 10 ETH, which may only be executed at the spot price of $170 ETH/DAI when ETH/DAI is between $170 — $165.

The overarching idea is the creation of conditional trading functions based on the price action of an asset. Users can hedge against price volatility by automating specific actions to take if certain price levels are hit. The main advantage is that the user can assure certain asset management strategies are executed without having to constantly be at their computer monitoring the market.

Stop-Loss Order Liquidations

In order for stop-loss orders to be executed in a manner that is not dependent on a single party, Bamboo Relay has developed a liquidator bot.

When creating stop-loss orders users specify a price and a trigger price, the difference between these two values is the premium offered up to liquidators. This premium acts as an incentive for liquidators to match the stop-loss orders and execute trades.
Liquidators pay for the gas and transaction costs for doing so and in return collect a small value from the difference between the stop-order price and the market price of the asset.

Using Chainlink Oracles To Trigger Stop-Loss Functions

To implement stop-loss functions, Bamboo Relay needs reliable data feeds that inform the smart contract when a specific trading pair hits the designated price. The price feed will automatically trigger the execution of the smart contract’s stop-loss function.

Since stop-loss functions are automated trading strategies of user’s funds, having access to accurate price feeds is essential. Obtaining a truly accurate price isn’t as straightforward as it sounds. It requires the aggregation of prices from all trading exchanges engaging in price discovery, both centralized and decentralized, and consistently weighting them based on their current liquidity. Additionally, there must be a secure oracle mechanism to deliver the price data to the smart contract on-time without fear of manipulation.

Chainlink is a decentralized oracle network that acts as a gateway for getting off-chain market data onto the blockchain so smart contracts can consume it. Chainlink’s Price Reference Contracts consist of 30 DeFi price feeds currently live on the Ethereum mainnet. They are secured by decentralized oracle networks made up of 7 to 21 independent, security reviewed, and Sybil resistant node operators. Each node operator sources market data from a high-quality data aggregator, such as Kaiko, Coingecko or BraveNewCoin. All Reference Contract updates reflect an aggregation of at least seven different data providers and trigger based on price deviations (e.g. every 1% change in price) and linear time updates (at least every 2 hours).

Integrating Chainlink’s oracle design allows Bamboo Relay to source highly accurate price feeds when triggering stop-loss functions. These price feeds provide extensive market coverage to the price discovery happening throughout the entire market as opposed to only one or a few exchanges. Since Chainlink’s Price Reference Contracts utilize decentralization at both the oracle and data level, there is no central point of failure in the delivery or sourcing of price data to the smart contract. The Price Reference Contracts store these prices on-chain, which allows Bamboo Relay to quickly read them for price references at little costs to the end users.

DEXs are set to revolutionize the way financial economies exchange assets. With the help of Chainlink, Bamboo Relay is one step closer to making that a reality by adding key functionality to allow users better management of their assets without sacrificing security.

“We’re thrilled to integrate Chainlink’s world-class oracle technology to bring stop loss-functionality to 0x users — an essential tool for successfully managing assets. Chainlink ensures that all stop-loss orders are triggered by highly accurate data from a secure oracle mechanism, bringing the highest level of security and reliability to Bamboo Relay. Through this integration, the 0x ecosystem is better positioned as a viable alternative to centralized exchanges; traders now have access to the same set of tools available on CEXs, yet receive the added benefits of user control of their assets.” — Joshua Richardson, Founder of Bamboo Relay

Supported assets

The initial release of stop-loss functionality supports orders on the following token pairs:

About Bamboo Relay

Bamboo Relay is a relayer for decentralized protocols.

Powered by premier blockchain projects such as 0x for trading and bZx for margin and lending.

Further leveraging on-chain protocols such as Chainlink to power stop-limit orders.

Proudly built upon the Ethereum blockchain, the world’s foremost smart contract platform.

Follow us on our website, twitter, medium, telegram or discord for the latest updates and developments. For all developer and integration related documentation please see our developer portal.

About Chainlink

If you’re a developer and want to connect your smart contract to existing data and infrastructure outside the underlying blockchain, reach out to Chainlink here. They can help you quickly and securely launch your data-enabled application or Chainlink Price Reference Data Contract on mainnet today. You can also visit the developer documentation or join the technical discussion on Discord. Learn more by visiting the Chainlink website or following them on Twitter or Reddit.

Chainlink is a decentralized oracle network that enables smart contracts to securely access off-chain data feeds, web APIs, and traditional bank payments. It is well known for providing highly secure and reliable oracles to large enterprises (Google, Oracle, and SWIFT) and leading smart contract development teams such as Polkadot/Substrate, Synthetix, Loopring, Aave, OpenLaw, Etherisc, Conflux, and many others.

--

--