Skip to content

Commit

Permalink
GITBOOK-67: No subject
Browse files Browse the repository at this point in the history
  • Loading branch information
Spark Team authored and gitbook-bot committed Mar 25, 2024
1 parent 00099b3 commit 709e9eb
Show file tree
Hide file tree
Showing 35 changed files with 62 additions and 65 deletions.
Binary file added docs/.gitbook/assets/2 (1).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/.gitbook/assets/2 (2).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/.gitbook/assets/image (1) (1).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/.gitbook/assets/image (1).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/.gitbook/assets/image (2) (1).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/.gitbook/assets/image (2).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/.gitbook/assets/image (3) (1).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/.gitbook/assets/image (3).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/.gitbook/assets/image (4) (1).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/.gitbook/assets/image (4).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/.gitbook/assets/image (5).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/.gitbook/assets/image (6).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/.gitbook/assets/image (7).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/.gitbook/assets/image (8).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/.gitbook/assets/image (9).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/.gitbook/assets/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 7 additions & 9 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,19 @@

## What is Spark?

Spark V1 is a cross-margin oracle-based perpetual order book built on [Fuel Network](https://www.fuel.network/). V1 design is made for optimum user experience and safety, as well as to give us a launchpad for future innovations. 
Spark is a DeFi super app on the [Fuel.network](https://fuel.network/), revolutionizing financial services with its integrated suite of offerings including perpetual contracts, an order book, as well as lending, borrowing features.

Spark V1 will rely on the active participation of market-makers for its success, and future iterations of our protocol will include various mechanisms to enhance the user trading experience.
Spark V1 introduces a multicollateral cross-margin system for its perpetual contracts, supporting deposits of diverse assets and implementing sophisticated liquidation protocols to ensure trading flexibility and risk management.



Key features of **Spark V1**:

* A highly performant order book for longing/shorting Perpetual Contracts with up to 2000 TPS
* Cross-margin, partial liquidations, and funding rates
* An advanced risk engine and insurance fund will ensure that the protocol incurs no bad debt
* SDKs and APIs for non-custodial interaction with our order book
* Users will be able to gain up to 50x leverage (depending on how much margin they have)

Spark V1 solely accepts USDC as collateral and requires active market makers in order to reduce spread.
* **High Performance Order Book:** Support for longing/shorting Perpetual Contracts with up to 2000 TPS.
* **Cross-Margin and Liquidations:** Enhanced margin and liquidation mechanisms, including partial liquidations and dynamic funding rates.
* **Advanced Risk Management:** A robust risk engine and insurance fund to prevent bad debt within the protocol.
* **Developer Tools:** Comprehensive SDKs and APIs for non-custodial interaction with our order book, facilitating integration and innovation.
* **Multicollateral Support:** Margin logic that accommodates the deposit of multiple assets, enhancing trading flexibility and risk distribution.

This means that on Mainnet, we will foster active participation from market makers. Read more in our Market Makers incentivization program.

24 changes: 11 additions & 13 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,19 @@

* [✨ Welcome](README.md)

## 🖥 Spark DEX
## 🖥 Spark DEX

* [🌅 Getting started](spark-dex/getting-started/README.md)
* [💫 Basics](spark-dex/getting-started/basics.md)
* [💰 Wallet Setup](spark-dex/getting-started/wallet-setup/README.md)
* [⚡ Fuel Wallet](spark-dex/getting-started/wallet-setup/fuel-wallet.md)
* [☄ Fuelet Wallet](spark-dex/getting-started/wallet-setup/fuelet-wallet.md)
* [ Fuelet Wallet](spark-dex/getting-started/wallet-setup/fuelet-wallet.md)
* [🦊 Metamask](spark-dex/getting-started/wallet-setup/metamask.md)
* [Deposit Assets using Faucet](spark-dex/getting-started/deposit-assets-using-faucet.md)
* [⛽ Why Fuel](spark-dex/getting-started/why-fuel.md)
* [Order Types](spark-dex/getting-started/order-types.md)
* [Referral Links](spark-dex/getting-started/referral-links.md)
* [Spot Margin Trading](spark-dex/spot-margin-trading/README.md)
* [What is Spot Trading?](spark-dex/spot-margin-trading/what-is-spot-trading.md)
* [FAQ](spark-dex/spot-margin-trading/faq.md)
* [Spot Trading](spark-dex/spot-trading/README.md)
* [What is Spot Trading?](spark-dex/spot-trading/what-is-spot-trading.md)
* [FAQ](spark-dex/spot-trading/faq.md)
* [📈 Perpetual Futures](spark-dex/perpetual-futures/README.md)
* [What are Perps?](spark-dex/perpetual-futures/what-are-perps.md)
* [How to Trade Perps?](spark-dex/perpetual-futures/how-to-trade-perps.md)
Expand All @@ -26,10 +24,10 @@
* [Risk Parameters](spark-dex/perpetual-futures/risk-parameters.md)
* [Account Value and Free Collateral](spark-dex/perpetual-futures/account-value-and-free-collateral.md)
* [Funding Rates](spark-dex/perpetual-futures/funding-rates.md)
* [Oracles](spark-dex/perpetual-futures/oracles.md)
* [Oracle](spark-dex/perpetual-futures/oracle.md)
* [Liquidations](spark-dex/perpetual-futures/liquidations.md)
* [Insurance Fund](spark-dex/perpetual-futures/insurance-fund.md)
* [🧙 Market Makers](spark-dex/market-makers/README.md)
* [🧙‍♂️ Market Makers](spark-dex/market-makers/README.md)
* [Market Making on Spark](spark-dex/market-makers/market-making-on-spark.md)
* [Spark Points Earning Program](spark-dex/market-makers/spark-points-earning-program.md)
* [Token Market Making Proposal](spark-dex/market-makers/token-market-making-proposal.md)
Expand All @@ -38,17 +36,17 @@

## 📖 Spark Order Book

* [⛩ Introduction](spark-order-book/introduction.md)
* [ Introduction](spark-order-book/introduction.md)

## 🏗 Build on Spark
## 🏗 Build on Spark

* [📓 SDK Docs](build-on-spark/sdk-docs.md)
* [🤖 Trading Bots](build-on-spark/trading-bots.md)
* [🤹 MM Bots](build-on-spark/mm-bots.md)
* [🤹‍♂️ MM Bots](build-on-spark/mm-bots.md)
* [🧞 Keeper Bots](build-on-spark/keeper-bots.md)
* [☔ Liquidation](build-on-spark/liquidation.md)

## 🛡 Security
## 🛡 Security

* [🔬 Audits](security/audits.md)

Expand Down
5 changes: 2 additions & 3 deletions docs/spark-dex/getting-started/basics.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# 💫 Basics

<figure><img src="../../.gitbook/assets/2.png" alt=""><figcaption></figcaption></figure>
<figure><img src="../../.gitbook/assets/2 (2).png" alt=""><figcaption></figcaption></figure>

Here are some of the more technical features of our MVP launch:

* Market Makers can earn rewards for active market-making (up to 3000 USDC each week)
* Our platform will only accept USDC as collateral but will offer a diverse range of popular markets such as ….
* We will rely on oracles (Pyth and Redstone) to track the prices of our contracts
* Profit, Liquidations, and Losses will be settled permissionless

We chose this approach out of an abundance of caution for MVP launch. As more tokens gain significant liquidity on Fuel Mainnet, we will also accept them as collateral. We are relying on two oracles and will utilize industry-best standards in Oracle pricing. Some of the measures that we take to ensure that a Mango-Markets style exploit is impossible to include:
We rely on two oracles and will utilize industry-best standards in Oracle pricing. Some of the measures that we take to ensure that a Mango-Markets style exploit is impossible to include:

**Multi-Oracle Systems**: mitigate risks stemming from any single oracle's potential failure or manipulation. ✅

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ description: 'Note: Faucet operates on Fuel Testnet'

The next step is to acquire some funds in your wallet. To mint tokens on the Fuel network, you'll need to have some ETH in your wallet to pay transaction fees. There are two ways to obtain ETH:

1. Via the Fuel [faucet link](https://faucet-beta-3.fuel.network).
1. Via the Fuel [faucet link](https://faucet-beta-5.fuel.network/).
2. Via the [Spark Faucet](https://app.sprk.fi/#/faucet), representing a table with all tokens supported by our platform, including UNI, USDC, BTC, LINK, and any other in the near future. Note that to mint any token other than ETH, you must first have some ETH in your wallet.
2 changes: 0 additions & 2 deletions docs/spark-dex/getting-started/order-types.md

This file was deleted.

2 changes: 0 additions & 2 deletions docs/spark-dex/getting-started/referral-links.md

This file was deleted.

7 changes: 4 additions & 3 deletions docs/spark-dex/getting-started/wallet-setup/fuel-wallet.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# ⚡ Fuel Wallet

To interact with the Spark, you'll first need to connect a wallet. There are three options for doing this:
**Fuel Wallet:** Developed by the Fuel Network core team, this browser extension is the gateway to Spark's functionalities. Users are required to download the extension to connect. For setup instructions, visit [Fuel Wallet](https://wallet.fuel.network/).

<figure><img src="../../../.gitbook/assets/image.png" alt="" width="348"><figcaption></figcaption></figure>


1. Generate a new account by clicking the "Connect to Wallet" button and then clicking the "Create account" button in the modal window that appears. After generating the account, you can copy the seed phrase for safekeeping by clicking the "Copy Seed" button.
2. Connect a Fuel Wallet, which is currently in alpha testing. For more information on how to do this, please follow this link: [https://wallet.fuel.network/](https://wallet.fuel.network/).

5 changes: 4 additions & 1 deletion docs/spark-dex/getting-started/wallet-setup/fuelet-wallet.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# ☄ Fuelet Wallet
# Fuelet Wallet

**Fuelet Wallet:** A self-custodial crypto wallet created by the Fuel ecosystem's community team. Available as both a browser extension and a mobile application, Fuelet offers a comprehensive and accessible way to interact with Spark. For more details, visit [Fuelet](https://fuelet.app/).

<figure><img src="../../../.gitbook/assets/image (1).png" alt="" width="363"><figcaption></figcaption></figure>
3 changes: 3 additions & 0 deletions docs/spark-dex/getting-started/wallet-setup/metamask.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# 🦊 Metamask

**MetaMask:** Thanks to the Fuel team's innovative module based on predicate logic, users can now seamlessly connect their MetaMask wallets. This allows Ethereum users to sign transactions with their EVM-associated accounts, ensuring a smooth onboarding experience. Learn more about this connection at [EVM Wallet Connector](https://github.com/FuelLabs/EVM-Wallet-Connector).

<figure><img src="../../../.gitbook/assets/image (9).png" alt="" width="356"><figcaption></figcaption></figure>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ This value is the sum of your collateral, any unrealized PnL (profit & loss) and

<figure><img src="https://lh7-us.googleusercontent.com/qTUWcKLw3RbdMuqnbym6lf0vOsbMWwt2XGhxaD4b5MjX6aFAM07irhBZOUfImiKBTU0X1yea8UC5dFSRLcyCkHASBOYjCyxy9C4Hnjofi41Umho8kR4Z4LfuooxGiUM3ZrNyYSbk22Xfx46buHMphJepdO2ytDIza7NlzD9-i5ZqsWN_dDDhwm8_Y3-QZwzRj6nMnwE" alt=""><figcaption></figcaption></figure>

\


### Free Collateral
Expand Down
2 changes: 1 addition & 1 deletion docs/spark-dex/perpetual-futures/how-to-trade-perps.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

To begin, navigate to the collateral section and click Deposit to add collateral. This step safeguards your account against potential losses due to market fluctuations.


<figure><img src="../../.gitbook/assets/image (7).png" alt="" width="375"><figcaption></figcaption></figure>

Next, select the market for trading. Do this by clicking on 'Trade', then 'Perpetuals', and selecting the market of your interest.\

Expand Down
10 changes: 6 additions & 4 deletions docs/spark-dex/perpetual-futures/liquidations.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,18 @@ Leveraged trading amplifies trading power by allowing you to trade with more fun

\#long

liqPrice = indexPrice - ((accountValue - totalPositionValue \* mmRatio) / ((1 - mmRatio) \* positionSizeOfTokenX))
$$
liqPrice = indexPrice - ((accountValue - totalPositionValue * mmRatio) / ((1 - mmRatio) * positionSizeOfTokenX))
$$

\


\#short

liqPrice = indexPrice - ((accountValue - totalPositionValue \* mmRatio) / ((1 + mmRatio) \* positionSizeOfTokenX))
$$
liqPrice = indexPrice - ((accountValue - totalPositionValue * mmRatio) / ((1 + mmRatio) * positionSizeOfTokenX))
$$

\


### **Example**
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/spark-dex/perpetual-futures/p-and-l.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The position table displays the P\&L for the existing position. Users have the o



The P\&L mentioned, particularly in the context of SOL-PERP and ETH-PERP shorts, pertains to the unrealized P\&L or uPNL of open positions. To convert this uPNL into realized profit or loss, positions must be closed.
The P\&L mentioned, particularly in the context of BTC-PERP and ETH-PERP shorts, pertains to the unrealized P\&L or uPNL of open positions. To convert this uPNL into realized profit or loss, positions must be closed.

The PnL in the table is determined by calculating the difference between the entry price of the position and the current time-weighted average price of trades, multiplied by the size of the position.

Expand Down
6 changes: 3 additions & 3 deletions docs/spark-dex/perpetual-futures/risk-parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
5. Liquidation Buffer: The absolute minimum amount over the maintenance margin at which we liquidate positions. For instance, a liquidation buffer of 1.05 would mean that we liquidate positions at 5% above the maintenance margin.
6. Opening Buffer: the user’s minimum collateral needed to not immediately be liquidated, expressed as opening\_buffer \* maintenance\_margin. The product of these is Initial Margin. For example, an opening buffer of 1.10 and a maintenance margin of 10% for Market A would mean that the max amount of leverage that a user could take in this market would be:

Minimum Collateral = Position Size × Maintenance Margin × Opening Buffer&#x20;

\
$$
Minimum Collateral = Position Size × Maintenance Margin × Opening Buffer
$$
21 changes: 0 additions & 21 deletions docs/spark-dex/spot-margin-trading/what-is-spot-trading.md

This file was deleted.

File renamed without changes.
File renamed without changes.
19 changes: 19 additions & 0 deletions docs/spark-dex/spot-trading/what-is-spot-trading.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# What is Spot Trading?

Spot trading involves the immediate purchase or sale of assets, with on-chain settlement, resulting in instant confirmation and an immediate reflection of the asset's change in your account balances.&#x20;

In Spark , spot trading utilizes liquidity from Spark CLOB. It's important to note that margin trading is not enabled by default, and you can find instructions on how to activate it in the following section.&#x20;

1. Select the UNI / USDC market in the top bar or the market's menu

<figure><img src="../../.gitbook/assets/image (3).png" alt="" width="281"><figcaption></figcaption></figure>

2. Select your direction (e.g. Buy or Sell) and order type (e.g. Market, Limit)&#x20;
3. Input the asset amount you'd like to trade or the notional value

&#x20;![](<../../.gitbook/assets/image (4).png>)

4. Once you've confirmed your order and it has been filled, your Balances tab will update to reflect your balance changes.&#x20;

<figure><img src="../../.gitbook/assets/image (5).png" alt=""><figcaption></figcaption></figure>

1 comment on commit 709e9eb

@gkp-sumaiya
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very good doc

Please sign in to comment.