# Welcome to Velar

## Quick links

{% content-ref url="/pages/nzbUQKzVY8lq4Q5JrjOo" %}
[How to Use Velar Products](/velar/getting-started/how-to-use-velar-products)
{% endcontent-ref %}

{% content-ref url="/pages/zsRMfUhH2Zmq2KJDIXaS" %}
[Velar Assets](/velar/developers/velar-assets)
{% endcontent-ref %}

{% content-ref url="/pages/NQEPT4smJnhPOKw1xRCZ" %}
[Token](/velar/token/introduction)
{% endcontent-ref %}

## Get Started

We've put together some helpful guides for you to get setup with our product quickly and easily.

{% content-ref url="/pages/nzbUQKzVY8lq4Q5JrjOo" %}
[How to Use Velar Products](/velar/getting-started/how-to-use-velar-products)
{% endcontent-ref %}

{% content-ref url="/pages/qJhAOE5eYUI15QzXjzmz" %}
[Providing Liquidity](/velar/getting-started/providing-liquidity)
{% endcontent-ref %}

{% content-ref url="/pages/pSZykroIIWxVYDZnBDig" %}
[Yield Farming](/velar/getting-started/yield-farming)
{% endcontent-ref %}


# Introduction

## What is Velar?

Velar is a decentralized finance (DeFi) protocol built on top of Bitcoin as a Layer-2 agnostic platform. It aims to provide a secure, scalable, and decentralized infrastructure for DeFi activities while maintaining Bitcoin's security and decentralization.

The protocol is designed to unlock Bitcoin's potential for sophisticated DeFi applications through various Layer-2 scaling solutions. Velar is currently live on multiple Bitcoin Layer-2 platforms, including Stacks, Bitlayer, and BOB. By leveraging the security of Bitcoin and the smart contract functionality of these Layer-2 solutions, Velar strives to build an open and accessible financial system.


# Roadmap

Velar's development roadmap is divided into four main versions:

* [Velar Dharma](/velar/velar-versions/velar-dharma) (v1): Focuses on core products like AMM, liquidity pools, yield farming, VELAR staking, and IDO launchpad.
* [Velar Artha](/velar/velar-versions/velar-artha) (v2): Introduce perpetual swaps, concentrated liquidity, and cross-chain bridge.
* [Velar Kama](/velar/velar-versions/velar-kama) (v3): Details to be shared at the launch of Velar Artha.
* [Velar Moksha](/velar/velar-versions/velar-moksha) (v4): Details to be revealed at the launch of Velar Kama.


# Architecture

Velar's architecture consists of the following key components:

## Bitcoin Base Layer

This provides the underlying security and decentralization for the ecosystem. Velar leverages Bitcoin's proof of work consensus mechanism to validate transactions and secure the network.

## Bitcoin Layer 2 Solutions

Velar operates on various Bitcoin Layer-2 scaling solutions to enable fast and low-cost transactions while reducing the load on the Bitcoin base layer. These Layer-2 platforms also provide smart contract functionality, allowing for the development of sophisticated DeFi applications.

Currently, Velar is live on the following Bitcoin Layer-2 solutions:

\- Stacks

\- Bitlayer

\- BOB

As Velar progresses, the protocol aims to expand its compatibility and go live on EVM-compatible Bitcoin Layer-2 solutions. This will further enhance Velar's interoperability and accessibility, enabling developers to build DeFi applications using familiar tools and programming languages.

By leveraging multiple Bitcoin Layer-2 solutions, Velar ensures a robust and flexible infrastructure that can adapt to the evolving needs of the DeFi ecosystem while maintaining the security and decentralization benefits of the Bitcoin base layer.

## DeFi Applications

The DeFi products like decentralized exchanges, lending protocols etc. are built on top of the Stacks layer. This is where the end-user DeFi services reside.

## Decentralized Identity

Velar will integrate decentralized identity solutions to enable users to manage identities without relying on centralized authorities.

## Interoperability

The protocol is designed for interoperability between various crypto assets. This increases liquidity and enhances usability for end users.

<br>


# Velar Labs

**Accelerating Bitcoin's Future.**

Velar Labs is a premier platform empowering the next generation of Bitcoin innovation through comprehensive ecosystem support, strategic investment, and seamless launch capabilities.

As a cornerstone institution in the Bitcoin ecosystem, Velar Labs provide end-to-end solutions for promising projects from ideation to successful launch and beyond.

### Core Offerings

#### Velar Launchpad

* Comprehensive launch infrastructure for Bitcoin ecosystem projects
* End-to-end technical, marketing, and strategic support
* Access to extensive network of KOLs and strategic partners
* Integrated DeFi ecosystem solutions

#### Investment & Acceleration

* Strategic investment in early-stage Bitcoin projects
* Partnership with elite accelerators mentioned below
* BTC Startup Lab: Premier Bitcoin ecosystem incubator
* BitcoinFi Accelerator: Exclusive 6-week builder program
* Sats Ventures: Led by former Bitcoin Frontier Fund partner

#### Technical Infrastructure

* Support across multiple Bitcoin layers (Stacks, Bitlayer, BOB)
* Smart contract development and audit assistance
* Technical architecture consultation
* Security and compliance guidance

### Links

* Website: [labs.velar.com](https://lab.velar.com)
* Twitter: [@VelarLabsHQ](https://x.com/velarlabshq)
* LinkedIn: <https://www.linkedin.com/company/velar-labs/>


# How to Use Velar Products

To start using Velar products, follow these steps:

1. Connect your wallet: Connect a compatible wallet to the Velar DApp.
2. Acquire gas: For Velar DEX, obtain STX tokens. For Velar PerpDEX on Bitlayer, obtain bridged BTC.
3. Explore Velar features: Navigate the Velar DApp to access various features like swapping tokens, providing liquidity, yield farming, staking, and participating in IDOs.


# Providing Liquidity

Providing liquidity to Velar's AMM pools allows you to earn trading fees. Follow these steps:

1\. Go to the liquidity section on the [Velar DApp](https://app.velar.com).

2\. Select the token pair you want to provide liquidity for.

3\. Deposit an equal value of both tokens to create your liquidity position.

4\. Receive LP tokens representing your share in the liquidity pool.<br>


# Yield Farming

Yield farming on Velar allows you to earn additional rewards by staking your LP tokens. Here's how to participate:

1\. Provide liquidity to an eligible pool and receive LP tokens.

2\. Go to the yield farming section on the [Velar DApp](https://app.velar.com/farm).

3\. Stake your LP tokens in the desired farming pool.

4\. Earn yield farming rewards in addition to trading fees.


# Staking $VELAR Tokens

The VELAR staking mechanism is now live, enabling protocol governance participation and rewards for long-term ecosystem alignment.

### Key Features

* Flexible staking without lock-up periods
* 500 VELAR minimum stake
* Enhanced rewards for longer staking duration
* Direct governance participation rights

### Staking Benefits

By staking VELAR tokens, you:

* Participate in protocol governance decisions
* Earn rewards scaled to staking duration
* Support protocol security and decentralization

### How to Stake

1. Connect your wallet to the Velar Webapp
2. Navigate to the [Staking tab](https://app.velar.com/stake)
3. Enter your desired staking amount (minimum 500 VELAR)
4. Confirm the transaction


# Building Integrations

Developers can build integrations and applications on top of Velar using the provided [SDKs](/velar/developers/velar-sdk) and [APIs](/velar/developers/velar-api). Refer to the developer documentation for detailed guides and examples.


# Giving Feedback

Velar values community feedback for continuous improvement. Share your suggestions, bug reports, and feature requests through the official feedback channels. Find the links to all community channels in [Community channels](/velar/getting-started/joining-community-channels) page.


# Joining Community Channels

Engage with the Velar community through various channels like Discord, Telegram, and Twitter to stay updated, ask questions, and participate in discussions.

## Important Links

1. [Discord](https://discord.gg/velarbtc)
2. [X (Formerly Twitter)](https://twitter.com/VelarBTC)
3. [Telegram](https://t.me/velarofficial)
4. [Velar Website](https://velar.com/)
5. [Velar DEX](https://app.velar.com/)
6. [Velar PerpDex](https://velar.com/perpdex/)

<br>


# Core Concepts

## Velar PerpDex

Velar PerpDex is a decentralized perpetual exchange enabling leveraged trading without custodial requirements. The platform uses an aggregated oracle system to provide reliable price feeds, reducing the risk of unfair liquidations from temporary price swings.

### Core Concepts

#### Perpetual Contracts

Perpetual contracts (perps) are futures contracts without expiry dates. Unlike traditional futures, traders can hold positions indefinitely, provided they maintain sufficient margin requirements.

The contract price is maintained close to the underlying asset's spot price through a funding rate mechanism. This system creates balanced market forces where longs and shorts periodically exchange payments to align incentives.

#### Mark Price and Entry Price

The Mark Price is the current price of the contract used for all PerpDex operations including opening and closing positions, calculating profit and loss, and determining liquidations. This price is derived from Velar's oracle system.

The Entry Price at which your position was opened.

#### Funding Rate

The funding rate is a periodic payment between long and short position holders that keeps the perpetual contract price aligned with the underlying asset's price:

When Mark Price exceeds Index Price, long position holders pay shorts (positive funding rate). This incentivizes more traders to go short or close long positions, pushing the contract price down.

When Index Price exceeds Mark Price, short position holders pay longs (negative funding rate). This incentivizes more traders to go long or close short positions, pushing the contract price up.

Funding payments occur every 8 hours (adjustable via governance) and are automatically calculated and applied to open positions.

#### Leverage and Margin

Leverage allows traders to amplify their exposure to price movements without committing full collateral. For example, using 5x leverage on a $100 position creates $500 of market exposure.

Velar PerpDex manages risk through two types of margin requirements:

Initial Margin is the collateral required to open a position. The minimum amount depends on the chosen leverage. For example, 5x leverage requires an initial margin of 20% of the position size.

Maintenance Margin is the minimum collateral needed to keep a position open. If a trader's margin falls below this threshold due to adverse price movements, their position becomes eligible for liquidation.

#### Pricing and Oracle System

Velar employs a robust hybrid oracle system to ensure accurate and manipulation-resistant price feeds:

On Stacks, Velar utilizes Pyth Network for primary price data with the BTC/USD feed ID: [0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a315b43](https://www.pyth.network/price-feeds/crypto-btc-usd)

On Mezo, Velar integrates RedStone as the primary oracle provider.

This multi-source approach delivers reliable price data that protects users from liquidations caused by temporary price wicks or manipulation attempts.

#### Liquidation Process

Liquidation occurs when a trader's position health factor falls below the required maintenance threshold. The health factor is determined by the formula:

Health Factor = (Margin + Unrealized PnL) / Maintenance Margin

When liquidation is triggered:

1. The position is flagged for liquidation
2. Liquidators close the position through a Dutch auction mechanism
3. A liquidation fee of 0.5% of the position size is charged and paid to liquidators
4. Any remaining collateral after covering losses and fees is returned to the trader

Velar maintains an Insurance Fund funded by a portion of trading fees to cover instances where liquidated positions result in negative equity that cannot be covered by the trader's remaining margin.

#### Position Types and Fees

Velar PerpDex supports both long and short positions:

Long positions profit when the asset's price increases and lose value when it decreases.

Short positions profit when the asset's price decreases and lose value when it increases.

The fee structure includes:

* Opening Fee: 0.1% of position size
* Borrowing Fee: Dynamic depending upon the liquidity utilization ratio
* Funding Fee: Variable rate paid every 8 hours
* Network Fees: Required for blockchain transactions

#### Risk Management Tools (Upcoming)

Velar PerpDex provides several risk management features:

Stop-Loss orders automatically close positions when prices reach a specified threshold, limiting potential losses.

Take-Profit orders lock in gains by closing positions when prices reach a target level.

Partial Closure allows traders to reduce exposure by closing only a portion of their position.

### Network-Specific Information

Velar PerpDex is available on multiple networks with differences in implementation and features. Details for each supported network are provided in the following sections.


# Stacks

Velar PerpDex on Stacks enables decentralized perpetual trading without requiring account creation. The platform uses Pyth Network oracles to provide reliable price feeds that reduce the risk of unfair liquidations from temporary price wicks.

### Connecting Your Wallet

To start trading on Velar PerpDex, you'll need a Stacks-compatible wallet.

Head to [perpdex.velar.com](https://perpdex.velar.com) and after you have a wallet set up, connect it by clicking the "Connect Wallet" button on the trading interface. Ensure your wallet is configured for the Stacks network.

### Providing Liquidity

Velar PerpDex allows users to provide liquidity to the sBTC/USDh trading pool and earn rewards.

#### How to Provide Liquidity

1. Navigate to the "[Pool](https://perpdex.velar.com/pools)" tab on the Velar PerpDex interface
2. Select the "Add Liquidity" option
3. Choose your liquidity contribution method:
   * Single-sided liquidity: Provide either sBTC or USDh only
   * Two-sided liquidity: Provide both sBTC and USDh in a balanced ratio
4. Enter the amount you wish to contribute
5. Review the transaction details and confirm

When you provide liquidity, you'll receive LP tokens representing your share of the pool. These tokens track your portion of the total liquidity and can be staked for additional rewards.

#### Managing Your Liquidity

You can monitor your provided liquidity in the "Pool" section, which displays:

* Your current liquidity position
* The market price of sBTC/USDh
* Pool details including reserves and collateral

#### Removing Liquidity

To withdraw your liquidity:

1. Navigate to the "Liquidity" tab
2. Select "Remove Liquidity"
3. Specify the amount of LP tokens to redeem
4. Confirm the transaction

Important: The maximum removable liquidity is limited by current open positions. You cannot withdraw more than the available reserves (Total Supply - (sBTC reserves + USDh reserves). The interface displays your "Max removable liquidity" to help you understand these constraints.\
\
*P.S: sBTC reserves & USDh reserves refers to the amount locked for existing positions.*

When you remove liquidity, you'll receive both assets (sBTC and USDh) regardless of whether you initially provided single-sided or dual-sided liquidity.

#### Earning Rewards

As a liquidity provider, you can earn multiple revenue streams:

* Trading Fees: 75% of platform trading fees are distributed to liquidity providers
* Funding Payments: Earn when providing liquidity against overbalanced positions

#### Liquidity Provider Risks

Providing liquidity involves certain risks:

* Impermanent Loss: Price fluctuations between paired assets can lead to opportunity cost
* Smart Contract Risk: Always research platform security and audits
* Market Exposure: LP positions have exposure to both sides of the market
* Locked Liquidity: During high volatility or heavy directional trading, portions of your liquidity may be temporarily locked

Monitor your liquidity positions regularly and adjust your strategy based on market conditions.

### Collateral Structure

Velar PerpDex on Stacks implements a dual-collateral system where liquidity providers (LPs) take the opposite side of trades:

Long positions require USDh as collateral. USDh provides a stable value reference point, minimizes volatility in margin calculations, creates predictable liquidation thresholds, and aligns with the quote currency of most trading pairs.

Short positions require sBTC as collateral. Using sBTC for shorts offers several advantages, including a natural hedge against Bitcoin price movements, reduced protocol exposure to directional risk, more efficient margin utilization, and enhanced protocol solvency protection.

This structure is fundamental to how the DEX operates, allowing liquidity providers to effectively balance market exposure and manage risk.

### Leverage Limitations

Velar PerpDex on Stacks currently supports leverage up to 5x. This means traders can amplify their exposure by up to five times their collateral value. Higher leverage increases both potential profits and risks.

To calculate the required initial margin:

* 5x leverage requires 20% of position size as collateral
* 4x leverage requires 25% of position size as collateral
* 3x leverage requires 33.3% of position size as collateral
* 2x leverage requires 50% of position size as collateral

### Opening a Position

To open a position on Velar PerpDex:

1. Select either "Long" or "Short" based on your market outlook
   * Long positions profit when the asset price increases
   * Short positions profit when the asset price decreases
2. Enter the amount of collateral you wish to commit
   * For long positions, deposit USDh
   * For short positions, deposit sBTC
3. Select your desired leverage (up to 5x)
4. Review the position details, including:
   * Liquidation price
   * Position size
   * Fees
   * Expected funding rate
5. Confirm the transaction through your connected wallet

The trading fee to open a position is 0.1% of the position size. No fee is applied when closing the position.

### Managing Positions

After opening a position, you can monitor and manage it through the Positions tab in the interface.

You can deposit additional collateral to decrease your leverage and improve your liquidation price. This provides a safer buffer against adverse price movements.

Alternatively, you can withdraw excess collateral if your position has moved in your favor, though this will increase your risk of liquidation.

### Borrowing Fees

Velar PerpDex applies a borrowing fee on open positions, calculated per block and automatically deducted from your collateral. The fee structure is:

* Base borrowing fee: 3000/10^9 per block
* With approximately 4 blocks per minute on Stacks
* Daily fee calculation: (Base fee × 4 blocks/min × 60 min × 24 hours)

These fees accumulate with each new block. Monitor your position's health to ensure borrowing fees don't push you toward liquidation, especially during extended holding periods.

### Closing a Position

You can close a position partially or completely by clicking the "Close" button in the position management interface.

For long positions, profits are paid in USDh. For short positions, profits are paid in sBTC.

There's no fee for closing a position.

### Liquidation Process

Liquidation occurs when a position's margin falls below the maintenance requirement. On Velar PerpDex, a position is liquidated when:

(Collateral - Fees) ≤ Collateral \* Leverage \* Liquidation Threshold

(Collateral - Fees) + PnL ≤ Collateral \* Leverage \* Liquidation Threshold

Fees = Borrow fee + Funding fee paid

Liquidation Threshold: Currently set at 1%

When liquidation is triggered:

1. The position is automatically closed
2. A liquidation fee of 50% of the remaining collateral is charged
3. All remaining collateral after deducting fees is returned to your wallet

To avoid liquidation, continue to monitor your position's remaining collateral and net value. \
\
***Important: Funding fees received are not counted in remaining collateral calculations and won't impact liquidation price or margin requirements.***

### Liquidation Risk Level Indicators

Velar PerpDex provides real-time liquidation risk assessment to help traders manage their positions effectively. The system categorizes risk into three levels based on remaining collateral after accounting for fees and unrealized losses:

#### Risk Categories

**High Risk (Less than 25% collateral remaining)**

* Position requires immediate attention
* Strong potential for liquidation if market moves adversely

**Medium Risk (25-75% collateral remaining)**

* Position should be monitored closely
* Moderate liquidation potential with significant price movements
* Evaluate risk tolerance and market conditions

**Low Risk (Above 75% collateral remaining)**

* Position has adequate margin buffer
* Lower probability of liquidation under normal market conditions
* Comfortable trading range for most market scenarios

### Liquidation Threshold Calculation

A position becomes liquidatable when either condition is met:

1. **Remaining Collateral** falls below the liquidation threshold
2. **Net Position Value** falls below the liquidation threshold

As described above, the liquidation threshold is currently set at 1% of order size. A position becomes liquidatable when either the remaining collateral or net position value equals or falls below this calculated threshold.

#### Example Calculation

For a $1,000 collateral with 2x leverage, hence a $2000 position:

* Liquidation Threshold = $2,000 × 1% = $20
* Position becomes liquidatable when remaining collateral or net value drops below $20

This threshold acts as the final safety net before automatic liquidation occurs, protecting both traders and the protocol from negative equity situations.

### Risk Monitoring Best Practices

* Monitor your risk level indicator regularly, especially during volatile market conditions
* Maintain adequate collateral buffers above the minimum requirements

### Security and Technical Details

#### Oracle Implementation

Velar PerpDex on Stacks uses Pyth Network as its primary oracle provider. The specific Pyth Oracle Feed ID for BTC/USD is:

[0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a315b43](https://www.pyth.network/price-feeds/crypto-btc-usd)

The specific Feed ID for STX/USD is: [0xec7a775f46379b5e943c3526b1c8d54cd49749176b0b98e02dde68d1bd335c17](https://www.pyth.network/price-feeds/crypto-stx-usd)

This oracle integration ensures reliable price data for all trading operations, including position opening/closing, PnL calculation, funding rates, and liquidation triggers.

#### Security Measures

Velar prioritizes security with several key measures:

* Smart Contract Audit: Conducted by Thesis Defense in July 2024, addressing critical issues and optimizing gas usage
* Clarity Contracts: Written specifically for Stacks compatibility, leveraging Bitcoin's security
* Robust Oracle System: Multiple price feeds reduce the risk of liquidations from temporary price wicks
* Bitcoin Finality: Trades ultimately settle with Bitcoin's security via Stacks' anchoring mechanism

#### Architecture

Velar PerpDex uses an Automated Market Maker (AMM) model where:

* Traders interact with liquidity pools rather than directly with other traders
* Liquidity providers deposit collateral (sBTC or USDh) to earn fees and funding payments
* All trades execute against the protocol's liquidity at oracle-derived prices

This design eliminates concerns about slippage and order book depth common to traditional exchanges.


# Mezo (Coming Soon)

Velar PerpDex is expanding to the Mezo network to provide a fast, efficient perpetual trading experience. This page will be updated with complete documentation once the Mezo implementation is live.

### Key Features (Planned)

* Integration with RedStone oracles for reliable price feeds
* Enhanced trading experience with faster block confirmations and EVM-compatibility
* Additional trading pairs and functionality

Stay tuned for updates on the launch date and specific features of Velar PerpDex on Mezo.


# Velar Dharma

Velar Dharma is the first version of the Velar protocol, laying the foundation for decentralized finance on Bitcoin. It focuses on the core DeFi products and features essential for a functional ecosystem.

<br>

{% content-ref url="/pages/IH5i11JWDdbuIZpQzbGw" %}
[Automated Market Maker (AMM)](/velar/velar-versions/velar-dharma/automated-market-maker-amm)
{% endcontent-ref %}

{% content-ref url="/pages/BXRXyFITwfdzNkP5grXG" %}
[Liquidity Pools & Yield Farming](/velar/velar-versions/velar-dharma/liquidity-pools-and-yield-farming)
{% endcontent-ref %}

{% content-ref url="/pages/mUKM3tdXx0Sg2Vo8LhZN" %}
[IDO Launchpad](/velar/velar-versions/velar-dharma/ido-launchpad)
{% endcontent-ref %}

{% content-ref url="/pages/kmlWRZrrd5vdSBEz8OKD" %}
[Bridge](/velar/velar-versions/velar-dharma/bridge)
{% endcontent-ref %}

{% content-ref url="/pages/EqLcuSd3HJXyUHmsPvZw" %}
[MemeStacker](/velar/velar-versions/velar-dharma/memestacker)
{% endcontent-ref %}


# Automated Market Maker (AMM)

The Automated Market Maker (AMM) in Velar Dharma is inspired by Uniswap V2 and facilitates decentralized token swapping and liquidity provision. It utilizes the constant product formula (x\*y=k) to determine the pricing of assets within the liquidity pools. Users can seamlessly swap between different token pairs without the need for traditional order books.

Liquidity providers can contribute their tokens to the AMM pools and earn trading fees in return. This incentivizes users to supply liquidity, ensuring a healthy and active trading environment. The AMM smart contracts are designed to be secure, efficient, and easy to integrate with other DeFi applications.

#### AMM Contract Addresses:

\- Factory Contract: SP1Y5YSTAHZ88XYK1VPDH24GY0HPX5J4JECTMY4A1

\- Router Contract: SP1Y5YSTAHZ88XYK1VPDH24GY0HPX5J4JECTMY4A1.univ2-router


# Liquidity Pools & Yield Farming

Velar Dharma introduces liquidity pools and yield farming opportunities to reward users for their participation and commitment to the protocol. Users can provide liquidity to various token pairs by depositing an equal value of each token into the corresponding AMM pool. In return, they receive LP tokens representing their share of the liquidity pool.

These LP tokens can then be staked in designated yield farming pools to earn additional rewards in the form of VELAR tokens. Yield farming incentivizes users to actively contribute liquidity and helps bootstrap adoption of the protocol. The rewards are distributed based on the proportion of LP tokens staked and the duration of staking.


# IDO Launchpad

The Initial DEX Offering (IDO) launchpad is a key feature of Velar Dharma, providing a decentralized platform for projects to launch their tokens and raise funds. It aims to solve the challenges faced by traditional token sale models by ensuring fair and wide distribution of tokens.

Projects can apply to launch their IDOs on the Velar launchpad, subject to a thorough due diligence process. Once approved, the IDO details, including token allocation, pricing, and timeline, are announced to the community. Users can participate in IDOs by staking VELAR tokens, with the allocation determined by the amount and duration of staking.

The IDO launchpad promotes a level playing field for token distributions and helps projects build a strong and engaged community from the start.


# Bridge

The Velar Bridge is a cross-chain bridge solution that enables seamless asset transfer between different blockchain networks. It plays a crucial role in enhancing interoperability and facilitating the movement of assets to and from the Bitcoin ecosystem.&#x20;

The key functionality of the Velar Bridge is the ability to bridge the $VELAR token from ERC-20 to SIP-010 and vice versa. This allows users to migrate their $VELAR tokens between the Ethereum network (ERC-20) and the Stacks network (SIP-010) effortlessly. By providing this cross-chain bridging capability, Velar ensures that users can utilize their $VELAR tokens across different blockchain ecosystems, increasing liquidity and accessibility.

The Velar Bridge is designed with security and reliability in mind, employing robust mechanisms to ensure the safe and trustless transfer of assets. It leverages advanced cryptographic techniques and follows industry best practices to protect users' funds during the bridging process. The bridge undergoes rigorous security audits to identify and address any potential vulnerabilities, providing users with peace of mind when transferring their assets.


# MemeStacker

MemeStacker is a user-friendly platform that simplifies the process of launching and listing tokens on the Velar Dharma AMM, the leading DEX in the Bitcoin ecosystem. It provides token creators with a seamless solution to deploy, distribute, and list their tokens, eliminating the complexities associated with token launches in the DeFi space.

With MemeStacker, token creators can easily create and configure their tokens using the platform's intuitive interface and customizable options. The platform streamlines the token distribution process, offering flexible options such as airdrops, token sales, and targeted allocations. Once created and distributed, MemeStacker automates the listing process on the Velar Dharma AMM, ensuring instant exposure and trading opportunities for the tokens.

By combining the power of MemeStacker and the Velar Dharma AMM, token creators can navigate the complexities of token launches with ease. The platform democratizes access to token creation and listing in the Bitcoin ecosystem, empowering individuals and projects to launch their tokens efficiently while leveraging the liquidity and user base of the Velar Dharma AMM.


# Velar Artha

Velar Artha, the second version of the protocol, introduces advanced features and improvements while embracing a Layer 2 agnostic approach. This version is designed to operate seamlessly across various Bitcoin Layer 2 solutions, ensuring flexibility and accessibility for users and developers.

Key features of Velar Artha include:

* Compatibility with both EVM (Ethereum Virtual Machine) and Clarity smart contract languages
* Perpetual Swaps DEX (PerpDex) designed to operate on multiple Bitcoin Layer 2 solutions, including Stacks, BOB, and Bitlayer
* Support for EVM-based assets and stablecoins, as well as native compatibility with Stacks-based assets like sBTC

Velar Artha's Layer 2 agnostic nature and dual compatibility with EVM and Clarity demonstrate its commitment to inclusivity, flexibility, and innovation. By embracing multiple Bitcoin Layer 2 solutions and programming languages, Velar Artha aims to create a vibrant and diverse ecosystem that caters to the needs of users and developers alike.

Whether you prefer the familiarity of EVM or the security and predictability of Clarity, Velar Artha provides a platform for everyone to participate in the exciting world of Bitcoin DeFi. Get ready to experience the power and flexibility of Velar Artha as it revolutionizes the Bitcoin DeFi landscape, one Layer 2 solution at a time.

<br>


# Perpetual Swaps

Velar Artha introduces a decentralized perpetual swaps exchange that allows users to trade with leverage without the need for an expiration date. Perpetual swaps are derivative contracts that enable traders to take long or short positions on various crypto assets, with the ability to leverage their positions for increased exposure.

The perpetual swaps exchange in Velar Artha follows a GMX-style design, bringing the benefits of decentralized trading, low fees, and high capital efficiency. GMX is a successful decentralized spot and perpetual exchange known for its unique features and user-friendly interface. By adopting a similar design, Velar Artha aims to provide users with a familiar and intuitive trading experience while leveraging the advantages of the Bitcoin ecosystem.

Velar Artha's perpetual swaps exchange will be deployed on multiple Bitcoin Layer 2 solutions, including Stacks, BOB, and Bitlayer, each offering unique features and benefits.

## **Stacks**

One of the key features of the Velar Artha perpetual swaps exchange on Stacks will be the support for BTC collateral through sBTC (Stacks-based Bitcoin). sBTC is a token that represents Bitcoin on the Stacks network, allowing users to utilize their BTC holdings as collateral for trading perpetual contracts.

By enabling BTC collateral through sBTC, Velar Artha opens up new opportunities for Bitcoin holders to participate in leveraged trading without having to sell their BTC. Users can deposit their sBTC tokens as collateral, which serves as the margin for their perpetual swap positions. This integration of BTC collateral enhances the liquidity and accessibility of the platform, attracting a wider range of traders and investors.

## **BOB (Testnet Live)**

Velar Artha testnet for its perpetual swaps exchange (PerpDex) is now live on BOB (Build on Bitcoin), a pioneering hybrid Layer 2 solution that bridges the Bitcoin and Ethereum ecosystems. This signifies a major milestone in Velar Artha's mission to foster innovation and unlock the full potential of Bitcoin DeFi.

BOB's innovative approach combines the security and liquidity of Bitcoin with the smart contract functionality of Ethereum's EVM, creating a powerful hybrid Layer 2 ecosystem. By integrating with BOB, Velar Artha can leverage the best of both worlds, offering users a secure, accessible, and feature-rich environment for trading perpetual swaps.<br>

The testnet deployment of Velar Artha PerpDex on BOB demonstrates the platform's ability to facilitate perpetual trading on a hybrid Bitcoin-Ethereum Layer 2 solution. Users can now explore and test the features of PerpDex, such as trading with leverage, accessing liquidity from both Bitcoin and Ethereum ecosystems, and utilizing Ethereum's extensive suite of dApps, stablecoins, and DeFi protocols.

## **Bitlayer (Testnet Live)**

Velar Artha testnet for its perpetual swaps exchange (PerpDex) is now live on Bitlayer, a cutting-edge Layer 2 solution built on the Bitcoin network. This marks a significant step forward in bringing the benefits of perpetual trading to the Bitcoin ecosystem.

Bitlayer's unique architecture, which combines zero-knowledge (ZK) rollups and the BitVM paradigm, provides a scalable, programmable, and secure environment for deploying decentralized applications (dApps) like PerpDex. By leveraging Bitlayer's Layered Virtual Machine (LVM), Velar Artha can seamlessly support various smart contract execution environments, such as EVM and CairoVM, while maintaining the highest security standards.

The testnet deployment of Velar Artha PerpDex on Bitlayer enables users to explore and test the features of PerpDex, including trading with leverage, low fees, and fast transaction processing. Bitlayer's optimistic execution model and efficient ZK-STARK Verifier ensure a smooth and cost-effective trading experience without compromising security.


# Concentrated Liquidity

Velar Artha will incorporate the concept of concentrated liquidity, inspired by Uniswap V3, to optimize capital efficiency and improve the trading experience. Concentrated liquidity allows liquidity providers to allocate their assets within custom price ranges, rather than distributing them evenly across the entire price spectrum.

By concentrating liquidity around the current market price, slippage is reduced, and trading becomes more efficient. Liquidity providers can earn higher fees by strategically placing their assets in high-demand price ranges. This enhancement attracts more liquidity to the platform and benefits both traders and liquidity providers.


# Cross-Chain Bridge

Velar Artha introduces a cross-chain bridge to facilitate the seamless transfer of assets between different blockchain networks. The bridge allows users to move their tokens from one blockchain to another, expanding the reach and liquidity of the Velar ecosystem.

By supporting popular blockchain networks, such as Ethereum, Binance Smart Chain, and others, Velar Artha enables interoperability and attracts a wider user base. Users can leverage the benefits of different blockchains while still participating in the Velar DeFi ecosystem.

The cross-chain bridge is designed with security and reliability in mind, ensuring the safe and trustless transfer of assets. It opens up new opportunities for collaborations, partnerships, and integrations with other DeFi protocols across multiple blockchains.


# Velar Kama

Velar Kama is the third version of the protocol, and its specific features and improvements will be unveiled closer to its launch. The Velar team is actively working on innovative solutions and enhancements to further revolutionize the DeFi landscape.

While the exact details of Velar Kama are yet to be revealed, the community can expect advanced functionalities, increased scalability, and improved user experience. The team will provide regular updates and engage with the community to gather feedback and suggestions for Velar Kama's development.


# Velar Moksha

Velar Moksha represents the fourth version of the protocol, marking the culmination of the Velar journey. The features and capabilities of Velar Moksha will be disclosed at the launch of Velar Kama, building anticipation and excitement within the community.

Velar Moksha aims to push the boundaries of what is possible in the realm of decentralized finance, delivering cutting-edge solutions and unparalleled opportunities for users. The team envisions Velar Moksha as the ultimate expression of the protocol's potential, setting new standards for DeFi innovation.

As with Velar Kama, the community will be kept informed about the progress and development of Velar Moksha. The team values transparency and will provide regular updates, ensuring that everyone is aligned with the vision and goals of the protocol.

<br>


# Introduction

At Velar, we prioritize the security and integrity of our protocol. To ensure the highest standards of safety and reliability, we have undergone rigorous audits conducted by leading blockchain security firms.&#x20;

These audits cover various components of the Velar ecosystem, including the AMM (Automated Market Maker) and PerpDex (Perpetual Swaps DEX) on both Clarity and EVM versions.


# AMM Audit on Clarity

The AMM smart contracts on Clarity have been audited by the reputable firm CoinFabrik. The audit was conducted to identify and address any potential vulnerabilities or security issues within the AMM codebase.

CoinFabrik, a leading blockchain security company, performed a comprehensive audit of the Velar AMM smart contracts. Their audit report can be accessed at: [CoinFabrik Audit Report](https://coinfabrik.b-cdn.net/wp-content/uploads/2024/02/Velar-Audit-2024-02.pdf)

QuillAudits, another respected blockchain auditing firm, also conducted a thorough review of the Velar token contract (ERC-20) on Ethereum. The audit report by QuillAudits can be found at: [QuillAudits Report](https://github.com/Quillhash/QuillAudit_Reports/blob/master/Velar%20token%20Contract%20Audit%20Report%20-%20QuillAudits.pdf)

These audits demonstrate our commitment to ensuring the security and reliability of the Velar AMM on the Clarity version.


# PerpDex Audit on Clarity

The PerpDex smart contracts on Clarity have successfully undergone rigorous security audits to ensure their security and functionality. The audit was conducted by Thesis Defense, a respected security firm in the blockchain space.

Key points from the audit:

1. The audit covered Velar's Clarity Smart Contracts for the Stacks ecosystem.
2. Critical security issues were identified and addressed.
3. Recommendations were made for enhancing protocol governance and emergency controls.
4. Suggestions for optimizing gas usage and improving code quality were provided.
5. Guidance on strengthening the oracle implementation was given.

The Velar team has worked diligently to address the identified issues, with many fixes already implemented and others planned for future releases. This audit process has significantly enhanced the security and reliability of the PerpDex platform.

We are committed to maintaining the highest standards of security and transparency. The full audit report is available here: <https://github.com/Thesis-Defense/Security-Audit-Reports/blob/main/PDFs/240711_Thesis_Defense-Velar_Clarity_Smart_Contracts_Security_Audit_Report.pdf><br>


# PerpDex Audit on EVM

The PerpDex smart contracts written in Vyper for EVM compatibility have successfully undergone a comprehensive security audit. This audit was conducted by Thesis Defense and Sherlock, respected security firms specializing in blockchain technology.

Key points from the audit:

1. The audit covered Velar's Vyper Smart Contracts designed for the Bitlayer and BOB.
2. Critical security issues were identified and promptly addressed.
3. The audit process examined every aspect of the smart contract code for potential vulnerabilities and areas of improvement.
4. Recommendations were provided for enhancing protocol governance and implementing emergency control mechanisms.
5. Suggestions for gas optimization and overall code quality improvements were given.
6. Guidance on strengthening the oracle implementation was provided.

The Velar team has diligently worked to address all identified issues. Many fixes have already been implemented, while others are planned for future releases. This thorough audit process has significantly bolstered the security and reliability of the PerpDex platform on EVM-compatible chains.

We remain committed to upholding the highest standards of security and transparency in our development process.&#x20;

The full audit report is available here

* [Audit Report by Thesis Defense](https://github.com/Thesis-Defense/Security-Audit-Reports/blob/main/PDFs/240717_Thesis_Defense-Velar_Vyper_Smart_Contracts_Security_Audit_Report.pdf)
* [Audit Report by Sherlock](https://drive.google.com/file/d/1vHiS2VXzgXXNY4CYhAzBrer7Tg9SFvQr/view?usp=sharing)


# Introduction

The $VELAR token serves as the native utility token of the Velar ecosystem, playing a crucial role in governance, staking, fee payment, and accessing various features and benefits within the protocol.


# Tokenomics

## Token Utility

* Governance: VELAR token holders can participate in the decentralized governance of the protocol, voting on proposals and shaping the future direction of Velar.
* Staking: Users can stake their VELAR tokens to earn rewards, such as a portion of protocol fees and access to exclusive features like IDO participation.
* Fee Payment: VELAR tokens can be used to pay for transaction fees within the Velar ecosystem, providing a seamless and integrated experience for users.
* Access to Features: Holding VELAR tokens grants users access to certain features, such as priority access to launchpad, enhanced yield farming opportunities, and more.

## Token Supply

The total supply of VELAR tokens is fixed at one billion (1,000,000,000) tokens. This fixed supply ensures scarcity and long-term value preservation for token holders.

Token Contract Addresses:

\- ERC-20: 0x033BbDe722EA3Cdcec73cFFEA6581DF9F9C257de

\- SIP-010: SP1Y5YSTAHZ88XYK1VPDH24GY0HPX5J4JECTMY4A1.velar-token

## Token Distribution

The initial distribution of VELAR tokens is allocated as follows:

* Community Rewards: 35% of the total supply is allocated for community incentives, including liquidity mining, yield farming, and other rewards programs.
* Treasury: 20% of the tokens are allocated to the Velar treasury, which will be used to fund ongoing development, partnerships, and ecosystem growth initiatives.
* Founders and Team: 20% of the tokens are reserved for the founding team and core contributors, subject to a vesting schedule to align long-term interests.
* Investors and Advisors: 15% of the tokens are allocated to strategic investors and advisors who provide valuable support and guidance to the project.
* Airdrops and Partnerships: The remaining 10% of the tokens are set aside for airdrops, community incentives, and strategic partnerships to foster adoption and collaboration.


# Vesting Contracts

Velar implements a vesting schedule for various token allocations to ensure long-term alignment of interests and sustainable growth. Below are the vesting contract addresses, their designated purposes, and the amount of tokens allocated to each at the time of TGE:

<table><thead><tr><th width="451">Address</th><th>Purpose</th><th>Token Amount at TGE</th></tr></thead><tbody><tr><td>0x955B593945D969e6a247E6d50385c768B9F703fe</td><td>Airdrop 2</td><td>15,000,000</td></tr><tr><td>0x2257aba7e54F30EeF79bBCe8609fc4c5e7A997CB</td><td>Airdrop 1</td><td>15,000,000</td></tr><tr><td>0x17A48a490cb84Ec7Ba557f4aef8Bd138F01A48Db</td><td>Team</td><td>30,000,000</td></tr><tr><td>0x91C476a88BFFE52e1068Fe8C730F962D8Fa0EA84</td><td>Community</td><td>350,000,000</td></tr><tr><td>0xD9557985680B32967a1aCC492bB433A5b2f80365</td><td>Treasury</td><td>150,000,000</td></tr><tr><td>0x8947fAf77c691A91064935dC74636babce0CdD7B</td><td>Strategic</td><td>46,000,000</td></tr><tr><td>0xA71e05190880f0F73d6B028C897f0E4fc71d7D58</td><td>Seed</td><td>95,000,000</td></tr><tr><td>0x479A3D14E7189F19c69616aBA0E26fA979e8BbDe</td><td>Advisors</td><td>40,000,000</td></tr><tr><td>0xE28be05aa11d3caFd2679A14C48C0E6C6c3CC8ec</td><td>Founder 1</td><td>40,000,000</td></tr><tr><td>0x4b91Ca75306b52F36579201D2aE705b07F29eb2b</td><td>Founder 2</td><td>80,000,000</td></tr><tr><td>0x3bc64784279844c2eE9c5b508cDDF275CAfDfa32</td><td>Founder 3</td><td>40,000,000</td></tr><tr><td>0x7AA19d37E8c7EFD29280915839d46Aa13B37f4FD</td><td>Airdrop 3</td><td>10,000,000</td></tr><tr><td>0x29985e5e5826318c15c5Be6cABfBbEaF3D681F3b</td><td>Liquidity Provision</td><td>30,000,000</td></tr></tbody></table>

These vesting contracts ensure a controlled and gradual distribution of tokens to various stakeholders and purposes. The vesting schedules help maintain price stability and align long-term incentives for different participants in the Velar ecosystem.

Key points about the vesting contracts:

1. Community allocation has the largest share with 350,000,000 tokens, emphasizing Velar's commitment to community-driven growth.
2. Treasury holds 150,000,000 tokens, providing resources for ongoing development and ecosystem support.
3. Multiple airdrops (1, 2, and 3) are planned to distribute tokens to early adopters and supporters.
4. Team, advisors, and strategic partners have dedicated allocations to ensure their long-term commitment to the project.
5. A separate allocation for liquidity provision (30,000,000 tokens) helps maintain market liquidity.

The specific vesting schedules and release mechanisms for each allocation may vary. For the most up-to-date information on token release schedules, please refer to the Emissions on next page.


# Emission

The VELAR token emission follows a predefined release schedule to ensure a fair and gradual distribution over time. The token generation event (TGE) took place in April 2024, marking the beginning of the token release.

The following table provides a detailed breakdown of the token release percentage at the end of each month, starting from the TGE:

| Month | Date               | Total Tokens Released |
| ----- | ------------------ | --------------------- |
| 0     | April 30, 2024     | 59,000,000            |
| 1     | May 31, 2024       | 88,458,333            |
| 2     | June 30, 2024      | 102,916,667           |
| 3     | July 31, 2024      | 117,375,000           |
| 4     | August 31, 2024    | 141,233,333           |
| 5     | September 30, 2024 | 165,091,667           |
| 6     | October 31, 2024   | 188,950,000           |
| 7     | November 30, 2024  | 222,808,333           |
| 8     | December 31, 2024  | 241,666,667           |
| 9     | January 31, 2025   | 260,525,000           |
| 10    | February 28, 2025  | 279,383,333           |
| 11    | March 31, 2025     | 298,241,667           |
| 12    | April 30, 2025     | 317,100,000           |
| 13    | May 31, 2025       | 344,708,333           |
| 14    | June 30, 2025      | 372,316,667           |
| 15    | July 31, 2025      | 399,925,000           |
| 16    | August 31, 2025    | 427,533,333           |
| 17    | September 30, 2025 | 455,141,667           |
| 18    | October 31, 2025   | 482,750,000           |
| 19    | November 30, 2025  | 500,958,333           |
| 20    | December 31, 2025  | 519,166,667           |
| 21    | January 31, 2026   | 537,375,000           |
| 22    | February 28, 2026  | 555,583,333           |
| 23    | March 31, 2026     | 573,791,667           |
| 24    | April 30, 2026     | 592,000,000           |
| 25    | May 31, 2026       | 610,208,333           |
| 26    | June 30, 2026      | 628,416,667           |
| 27    | July 31, 2026      | 646,625,000           |
| 28    | August 31, 2026    | 664,833,333           |
| 29    | September 30, 2026 | 683,041,667           |
| 30    | October 31, 2026   | 701,250,000           |
| 31    | November 30, 2026  | 719,458,333           |
| 32    | December 31, 2026  | 737,666,667           |
| 33    | January 31, 2027   | 755,875,000           |
| 34    | February 28, 2027  | 774,083,333           |
| 35    | March 31, 2027     | 792,291,667           |
| 36    | April 30, 2027     | 810,500,000           |
| 37    | May 31, 2027       | 819,958,333           |
| 38    | June 30, 2027      | 829,416,667           |
| 39    | July 31, 2027      | 838,875,000           |
| 40    | August 31, 2027    | 848,333,333           |
| 41    | September 30, 2027 | 857,791,667           |
| 42    | October 31, 2027   | 867,250,000           |
| 43    | November 30, 2027  | 876,708,333           |
| 44    | December 31, 2027  | 886,166,667           |
| 45    | January 31, 2028   | 895,625,000           |
| 46    | February 29, 2028  | 905,083,333           |
| 47    | March 31, 2028     | 914,541,667           |
| 48    | April 30, 2028     | 924,000,000           |
| 49    | May 31, 2028       | 930,333,333           |
| 50    | June 30, 2028      | 936,666,667           |
| 51    | July 31, 2028      | 943,000,000           |
| 52    | August 31, 2028    | 949,333,333           |
| 53    | September 30, 2028 | 955,666,667           |
| 54    | October 31, 2028   | 962,000,000           |
| 55    | November 30, 2028  | 968,333,333           |
| 56    | December 31, 2028  | 974,666,667           |
| 57    | January 31, 2029   | 981,000,000           |
| 58    | February 28, 2029  | 987,333,333           |
| 59    | March 31, 2029     | 993,666,667           |
| 60    | April 30, 2029     | 1,000,000,000         |

The "Total Tokens Released" column shows the liquid supply by the end of each month. As per the schedule, the token release starts with 5.90% (59,000,000 tokens) at the end of the TGE month (April 2024) and gradually increases each month. By the end of the 60th month (April 2029), a total of 100% (1,000,000,000 tokens) will have been released.


# Contract Addresses

For developers looking to integrate with or build on top of Velar, here are the key deployment addresses:

* Deployer: SP1Y5YSTAHZ88XYK1VPDH24GY0HPX5J4JECTMY4A1
* Core: SP1Y5YSTAHZ88XYK1VPDH24GY0HPX5J4JECTMY4A1.univ2-core
* Router: SP1Y5YSTAHZ88XYK1VPDH24GY0HPX5J4JECTMY4A1.univ2-router
* Library: SP1Y5YSTAHZ88XYK1VPDH24GY0HPX5J4JECTMY4A1.univ2-library

## Official Token Addresses

**Stacks SIP-010**: SP1Y5YSTAHZ88XYK1VPDH24GY0HPX5J4JECTMY4A1.velar-token

**Ethereum ERC-20**: 0x033BbDe722EA3Cdcec73cFFEA6581DF9F9C257de


# Velar SDK

The Velar SDK is a powerful toolkit that enables seamless integration with the Velar Protocol, allowing developers to implement token swaps, manage liquidity, and interact with the Velar DEX ecosystem. This SDK provides a robust set of tools for building decentralized applications on the Stacks blockchain.

### Installation

```bash
npm i @velarprotocol/velar-sdk
```

### Available Versions

#### [Velar SDK 0.7.0-beta \[Latest\]](/velar/developers/velar-sdk/velar-sdk-0.7.0-beta-latest)

The latest version introduces significant improvements and changes:

* Added support for all VELAR DEX listed tokens
* Direct token contract address support in SwapConfig
* Enhanced AmountOutResponse with detailed path information
* Simplified API with removal of SwapType requirement
* Removed support for `swapTokensForExactTokens`

#### [Velar SDK 0.6.9](/velar/developers/velar-sdk/velar-sdk-0.6.9)

Stable release with core functionality:

* Support for token swapping operations
* Implementation of `swapTokensForExactTokens`
* Includes bug fix for `assetName` in swap operations
* Uses SwapType enum for different swap operations

### Key Features

* **Token Swapping**: Execute token swaps with optimal routing
* **Price Computation**: Calculate swap amounts with slippage protection
* **Pair Management**: Query available trading pairs
* **Multi-hop Routing**: Support for complex swap paths
* **Contract Integration**: Seamless integration with Stacks blockchain

### Core Components

The SDK is built around several key interfaces and classes:

#### VelarSDK Class

The main entry point for interacting with the protocol:

```typescript
export declare class VelarSDK {
  getPairs(symbol: string): Promise<Array<string>>;
  getSwapInstance(args: SwapConfig): SwapService;
}
```

#### SwapService

Handles all swap-related operations:

```typescript
export declare class SwapService {
  constructor(args: SwapConfig);
  swap(args: SwapPayload): Promise<SwapResponse>;
  getComputedAmount(args: ComputedAmountPayload): Promise<AmountOutResponse>;
}
```

### Getting Started

1. Initialize the SDK:

```typescript
import { VelarSDK } from '@velarprotocol/velar-sdk';
const sdk = new VelarSDK();
```

2. Create a swap instance:

```typescript
const swapInstance = await sdk.getSwapInstance({
  account: userAddress,
  inToken: inputToken,  // Token Symbol or Contract Address
  outToken: outputToken // Token Symbol or Contract Address
});
```

3. Execute operations:

```typescript
// Get computed amount
const amountOut = await swapInstance.getComputedAmount({
  amount: 10,
  slippage: 0.5 // optional
});

// Perform swap
const swapOptions = await swapInstance.swap({
  amount: 10
});
```

### Token Support

The SDK supports a wide range of tokens on the Velar DEX, including:

* Core tokens: STX, VELAR, aeUSDC, aBTC
* Ecosystem tokens: SOME, ROCK, MICK, WELSH, LEO
* Staked variants: stSTX, sODIN, sROO, sWELSH
* And many more

For the latest list of supported tokens and their trading pairs, you can use the `getPairs` method or check the official token list at: <https://sdk-beta.velar.network/tokens/symbols>

### Migration Guide

When upgrading from 0.6.9 to 0.7.0-beta:

1. Remove all `SwapType` references
2. Update `getComputedAmount` implementation to handle new response type
3. Remove any `swapTokensForExactTokens` implementations
4. Update token inputs to optionally use contract addresses

### Best Practices

* Always implement proper error handling
* Use slippage protection for better trade execution
* Test with small amounts before large transactions
* Keep the SDK updated to the latest stable version
* Monitor transaction status using provided callbacks

### Support

For technical support, bug reports, or feature requests, please join our community on [Telegram](https://t.me/velarofficial) or [Discord](https://discord.gg/velarbtc). Our documentation is regularly updated to help you make the most of the Velar SDK.


# Velar SDK 0.7.0-beta \[Latest]

Installation:

```bash
npm i @velarprotocol/velar-sdk
```

## Velar SDK Types:

```typescript
  import { ContractPrincipalCV, PostCondition, PostConditionMode, UIntCV } from "@stacks/transactions";

  export interface SwapConfig {
      account: string;
      inToken: string;  // Token Symbol or Token Contract Address
      outToken: string; // Token Symbol or Token Contract Address
  }

  export interface ISwapService {
    swap(args: SwapPayload): Promise<SwapResponse>;
    getComputedAmount(args: ComputedAmountPayload): Promise<AmountOutResponse>;
  }

  export interface ComputedAmountPayload {
    amount: Number;
    slippage?: Number;
  }

  interface DestinationToken {
    symbol: string,
    contractAddress: string,
    tokenDecimalNum: Number,
    assetName: string,
  }

  export interface AmountOutResponse {
    value: Number,
    amountOut: Number // raw amount out
    path: Array<string> // route contract addresses
    path2: Array<string> // route symbols
    destinationToken: { symbol: string,  contractAddress: string,  tokenDecimalNum: Number,  assetName: string } // destination token details
    amountOutDecimal: Number // amountOutWithDecimals
    route?: Array<string>, // multihop optimal route
    result?: any // multihop routes results
  }

  export interface SwapResponse {
    contractAddress: string,
    contractName: string,
    functionName: string,
    functionArgs: [
      UIntCV,                  // pool id
      ContractPrincipalCV,    // pool token0 address
      ContractPrincipalCV,    // pool token1 address
      ContractPrincipalCV,    // in token address
      ContractPrincipalCV,    // out token address
      ContractPrincipalCV,    // staking contract
      UIntCV,                 // amount in
      UIntCV                  // amount out
    ],
    postConditions: Array<PostCondition>,
    postConditionMode: PostConditionMode,
  }

  export declare class SwapService {
    constructor(args: SwapConfig);
    swap(args: SwapPayload): Promise<SwapResponse>;
    getComputedAmount(args: ComputedAmountPayload): Promise<AmountOutResponse>;
  }
```

## VELAR SDK Interface:

```typescript
  export declare class VelarSDK {
    getPairs (symbol: string): Promise<Array<string>>;
    getSwapInstance(args: SwapConfig): SwapService;
  }
```

## Swap:

```typescript
import {
  VelarSDK,
  getTokens,
  ISwapService,
  SwapResponse,
} from '@velarprotocol/velar-sdk';
import { openContractCall } from '@stacks/connect';

const sdk = new VelarSDK();

async () => {
  const account = '';
  // setup swap instance
  const swapInstance: ISwapService = await sdk.getSwapInstance({
    account: account,
    inToken: 'SP1Y5YSTAHZ88XYK1VPDH24GY0HPX5J4JECTMY4A1.wstx',
    outToken: 'SP1Y5YSTAHZ88XYK1VPDH24GY0HPX5J4JECTMY4A1.velar-token',
  });

  // to display amount out
  const amount: AmountOutResponse = await swapInstance.getComputedAmount({
    amount: 10,
  });

  // get swap calculated arguments for contract call
  const swapOptions: SwapResponse = await swapInstance.swap({
    amount: 10,
  });

  // build options for contract call
  const options = {
    ...swapOptions,
    network: AppService.getNetwork(),
    appDetails: AppService.getAppDetails(),
    anchorMode: AnchorMode.Any,
    onFinish: data => {},
    onCancel: ex => {},
  };

  // open contract call
  await openContractCall(options);
};
```

## Available tokens:

<https://sdk-beta.velar.network/tokens/symbols>

For more detailed information and additional functions, please refer to the npm library [here](https://www.npmjs.com/package/@velarprotocol/velar-sdk).


# Velar SDK 0.6.9

Installation:

```bash
npm i @velarprotocol/velar-sdk
```

## Velar SDK Types:

```typescript
import { ContractPrincipalCV, PostCondition, PostConditionMode, UIntCV } from "@stacks/transactions";

export interface SwapConfig {
    account: string;
    inToken: string;
    outToken: string;
}

export interface ISwapService {
  swap(args: SwapPayload): Promise<SwapResponse>;
  getComputedAmount(args: ComputedAmountPayload): Promise<number>;
}

enum SwapType {
  ONE = 1,
  TWO = 2
}

export interface ComputedAmountPayload {
  amount: Number;
  slippage?: Number;
  type?: SwapType;
}

export interface SwapResponse {
  contractAddress: string,
  contractName: string,
  functionName: string,
  functionArgs: [
    UIntCV,                  // pool id
    ContractPrincipalCV,    // pool token0 address
    ContractPrincipalCV,    // pool token1 address
    ContractPrincipalCV,    // in token address
    ContractPrincipalCV,    // out token address
    ContractPrincipalCV,    // staking contract
    UIntCV,                 // amount in
    UIntCV                  // amount out
  ],
  postConditions: Array<PostCondition>,
  postConditionMode: PostConditionMode,
}

export declare class SwapService {
  constructor(args: SwapConfig);
  swap(args: SwapPayload): Promise<SwapResponse>;
  getComputedAmount(args: ComputedAmountPayload): Promise<number>;
}
```

## VELAR SDK Interface:

```typescript
export declare class VelarSDK {
  getPairs (symbol: string): Promise<Array<string>>;
  getSwapInstance(args: SwapConfig): SwapService;
}
```

## Swap Exact Tokens For Tokens and Multihop:

```typescript
import {
  SwapType,
  VelarSDK,
  getTokens,
  ISwapService,
  SwapResponse,
} from '@velarprotocol/velar-sdk';
import { openContractCall } from '@stacks/connect';

const sdk = new VelarSDK();

async () => {
  // getTokens will return you all of the tokens symbols which currently Velar supporting
  const { VELAR, STX } = await getTokens();
  const account = '';

  // setup swap instance
  const swapInstance: ISwapService = await sdk.getSwapInstance({
    account: account,
    inToken: VELAR,
    outToken: STX,
  });

  // to display amount out
  const amount: AmountOutResponse = await swapInstance.getComputedAmount({
    type: SwapType.ONE,
    amount: 10,
  });

  // get swap calculated arguments for contract call
  const swapOptions: SwapResponse = await swapInstance.swap({
    amount: 10,
    type: SwapType.ONE,
  });

  // build options for contract call
  const options = {
    ...swapOptions,
    network: AppService.getNetwork(),
    appDetails: AppService.getAppDetails(),
    anchorMode: AnchorMode.Any,
    onFinish: data => {},
    onCancel: ex => {},
  };

  // open contract call
  await openContractCall(options);
};
```

## Swap Tokens For Exact Tokens:

```typescript
import {
  SwapType,
  VelarSDK,
  getTokens,
  ISwapService,
  SwapResponse,
} from '@velarprotocol/velar-sdk';
import { openContractCall } from '@stacks/connect';

const sdk = new VelarSDK();

async () => {
  // getTokens will return you all of the tokens symbols which currently Velar supporting
  const { VELAR, STX } = await getTokens();
  const account = '';

  // setup swap instance
  const swapInstance: ISwapService = await sdk.getSwapInstance({
    account: account,
    inToken: VELAR,
    outToken: STX,
  });

  // to display amount in
  const amount: number = await swapInstance.getComputedAmount({
    type: SwapType.TWO,
    amount: 10,
  });

  // get swap calculated arguments for contract call
  const swapOptions: SwapResponse = await swapInstance.swap({
    amount: 10,
    type: SwapType.TWO,
  });

  // build options for contract call
  const options = {
    ...swapOptions,
    network: AppService.getNetwork(),
    appDetails: AppService.getAppDetails(),
    anchorMode: AnchorMode.Any,
    onFinish: data => {},
    onCancel: ex => {},
  };

  // open contract call
  await openContractCall(options);
};
```

## getPairs:

```typescript
const pairs = await sdk.getPairs('VELAR'); // ['STX', 'aeUSDC']
```

## Available tokens:

```typescript
const Tokens = {
  SOME: 'SOME',
  ROCK: 'ROCK',
  VELAR: 'VELAR',
  MICK: 'MICK',
  LONG: 'LONG',
  PEPE: 'PEPE',
  $ROO: '$ROO',
  WELSH: 'WELSH',
  LEO: 'LEO',
  stSTX: 'stSTX',
  aeUSDC: 'aeUSDC',
  aBTC: 'aBTC',
  STX: 'STX',
  ODIN: 'ODIN',
  sODIN: 'sODIN',
  sROO: 'sROO',
  sWELSH: 'sWELSH',
  Hat: 'Hat',
  HASHIKO: 'HASHIKO',
  POMBOO: 'POMBOO',
  $MOONCH: '$MOONCH',
  NOT: 'NOT',
  ALUX: 'ALUX',
  GOATSTX: 'GOATSTX',
  MWM: 'MWM',
};
```

## Pairs:

```typescript
const Pairs = [
  {
    "symbol": "SOME",
    "pairs": [
      "STX"
    ]
  },
  {
    "symbol": "ROCK",
    "pairs": [
      "STX"
    ]
  },
  {
    "symbol": "VELAR",
    "pairs": [
      "STX",
      "aeUSDC"
    ]
  },
  // ... (other pairs omitted for brevity)
];
```

For more detailed information and additional functions, please refer to the npm library [here](https://www.npmjs.com/package/@velarprotocol/velar-sdk).


# Velar API

Velar provides public APIs for developers to access various data points across the protocol. These endpoints enable seamless integration of Velar data into third-party applications, providing real-time and historical information on tokens, prices, pools, and supply metrics.

### Base URL

`https://api.velar.co`

### Available Endpoints

#### Get All Tokens Data

Retrieve details of all available tokens on the DEX.

```
GET /tickers
```

#### Get Token Details

Retrieve details for a specific token or all tokens on the DEX.

```
GET /tokens
GET /tokens?symbol={symbol}
```

Parameters:

* `symbol` (optional): Token symbol (e.g., WELSH, ROO, VELAR). Use 'all' to get all tokens.

#### Get Circulating Supply

Retrieve circulating supply information for VELAR token.

```
GET /circulating-supply
```

#### Get Current Prices

Retrieve current price data for tokens.

```
GET /prices
```

#### Get Price by Contract Address

Retrieve price information for a specific token contract.

```
GET /prices/:contractAddress
```

Parameters:

* `contractAddress`: The contract address of the token

#### Get Historical Price Data

Retrieve historical price data for a specific token with customizable time intervals.

```
GET /prices/historical/:contractAddress?interval={interval}
```

Parameters:

* `contractAddress`: The contract address of the token
* `interval`: Time interval for the historical data. Available options:
  * `hour`: Hourly data points
  * `week`: Weekly data points
  * `month`: Monthly data points
  * `year`: Yearly data points

#### Get Pool Data

Retrieve information about liquidity pools on Velar.

```
GET /pools
```

#### Get Pool Data by LP Token Address

Retrieve specific pool information using LP token contract address.

```
GET /pools/:lpTokenContractAddress
```

Parameters:

* `lpTokenContractAddress`: The contract address of the LP token

#### Get Pool Data by Token Pair

Retrieve pool information using the addresses of tokens in the pair.

```
GET /pools/:poolToken0ContractAddress/:poolToken1ContractAddress
GET /pools/:poolToken1ContractAddress/:poolToken0ContractAddress
```

Parameters:

* `poolToken0ContractAddress`: The contract address of the first token in the pair
* `poolToken1ContractAddress`: The contract address of the second token in the pair

### Integration Example

```javascript
// Example: Fetching historical price data for a token
const contractAddress = "0x...";
const response = await fetch(`https://api.velar.co/prices/historical/${contractAddress}?interval=week`);
const data = await response.json();

// Example: Fetching sBTC pool data
const sbtcPoolResponse = await fetch(`https://api.velar.co/pools/SM3VDXK3WZZSA84XXFKAFAF15NNZX32CTSG82JFQ4.sbtc-token/SP1Y5YSTAHZ88XYK1VPDH24GY0HPX5J4JECTMY4A1.wstx`);
const sbtcPoolData = await sbtcPoolResponse.json();
```

### Building with Velar

By leveraging these developer resources, you can build powerful applications and integrations on top of the Velar protocol, enhancing the overall ecosystem and user experience. The API provides comprehensive data access for:

* Token information and metrics
* Real-time price feeds
* Historical price analysis
* Supply statistics
* Market data integration
* Pool and liquidity data

For support or questions about the API, please reach out to our developer community or consult our additional documentation resources.


# Velar Verified Burner Contract

The Velar Verified Burner Contract is a specially designated one-function contract where you input a token address and amount, irreversibly sending tokens to a null address - effectively 'burning' them.

### STX Burn Contract

```
SP1Y5YSTAHZ88XYK1VPDH24GY0HPX5J4JECTMY4A1.devnull
```

### Purpose&#x20;

The Velar Verified Burned Contract serves crucial functions in the Velar ecosystem:

1. **Fair Token Listing**: It is the official destination for locking LP (Liquidity Provider) tokens during the fair token listing process on Velar.
2. **Verifiable Token Locking**: It can be used to lock any tokens in a verifiable way, providing transparency and confidence in token reduction processes.

By using this verified contract, we ensure that:

* Tokens sent to this contract are irretrievably locked
* The listing process remains transparent and fair for all participants
* LP tokens are effectively "locked," preventing liquidity from being withdrawn
* Any token locking events can be easily verified and audited by the community

### Usage&#x20;

This contract features a simple, single-function interface. When participating in a token listing on Velar or conducting a verifiable token locking event, you'll interact with this function by providing two arguments:

1. The token contract address
2. The amount of tokens to lock

Always verify you're interacting with the correct contract before sending any tokens.

Verification Our team has thoroughly verified that this contract has no withdrawal function. This ensures that once tokens are sent to this contract, they cannot be retrieved or used by any party.

Important Notes

* Always double-check the contract address before interacting with it
* This contract is to be used exclusively for Velar's official token listing processes and verifiable token locking events
* The process is irreversible - tokens sent to this contract cannot be recovered
* Do not send any tokens to this contract unless explicitly instructed by the Velar team

For any questions or concerns regarding the use of this Velar Verified Burned Contract, please contact the Velar support team.


# Velar Assets

### Primary Assets

These primary assets serve as the default choices for most applications. They provide optimal visibility while maintaining brand recognition.

P.S: Press ⌘ (CMD/CTLR) and click to open files in a new tab.

#### Token Assets

* [Token Logo (PNG)](https://drive.google.com/file/d/1xkw_WZLVplMzwIx_r7WDkY2JCMA6B-p1/view?usp=drive_link)
* [Token Logo (SVG)](https://drive.google.com/file/d/1tpfzoIAMVyESSMiRUSMge_2qLUOABpOL/view?usp=drive_link)

#### Logos & Word Mark

* [Primary Logo (PNG)](https://drive.google.com/file/d/1uhWCyy3EosPmnOuL0S_gxYbxRSeWTaTt/view?usp=drive_link)
* [Primary Logo & Word Mark (PNG)](https://drive.google.com/file/d/1o-4aD9KYV4ULNAx5sURlrgV9bm9WCcmD/view?usp=drive_link)
* [Primary Logo (SVG)](https://drive.google.com/file/d/1tuAei2DzXH9omjHP0rfRZ00gNc-lBidF/view?usp=drive_link)
* [Primary Logo & Word Mark (SVG)](https://drive.google.com/file/d/1SDHt9BjCMhkK2D69wpvV4FI3iCCeIvS1/view?usp=drive_link)

#### Brand Guidelines

* Here's the complete [Brand Guidelines](https://drive.google.com/file/d/18lqBSM8cwUpdln08Hln-Fu4KbXRUPl8o/view?usp=drive_link).

### Alternative Assets

Additional logo variations are available for specific use cases. **These alternatives require explicit approval before implementation.**

To access all the Velar assets, follow this link: <https://drive.google.com/drive/folders/10ZglrxvfliSWz5Mf6vKTQoXMS4dEpTRj?usp=drive_link>

This folder contains all the official Velar assets, including the favicon, PNG and SVG logos, and tokens.

### Available Assets

1. [Favicon](https://drive.google.com/drive/folders/1NajNqsmYH67REscQ1V8O_6OZH6B89dLr?usp=sharing)
2. [Velar Logo](https://drive.google.com/drive/folders/1TzPjkxQDiuYkmwaNSKTpxd2EMevcnxcJ?usp=drive_link)
3. [Velar Token Logo](https://drive.google.com/drive/folders/1RYTjAOWOw-XZxmFMOdy6ml7bUAFC202q?usp=drive_link)
4. [Brand Guidelines](https://drive.google.com/file/d/18lqBSM8cwUpdln08Hln-Fu4KbXRUPl8o/view?usp=drive_link)

### Guidelines for Usage

1. Always use the official Velar assets provided to maintain brand consistency.
2. Do not modify, distort, or alter the colors of the assets unless explicitly permitted by Velar's branding guidelines.
3. Ensure proper contrast and visibility when placing the logo or token on different backgrounds.
4. For digital use, prefer the SVG format when possible to ensure optimal display across various screen resolutions.
5. Refer to Velar's complete brand guidelines for detailed information on proper usage, spacing, and color specifications.

###


# CEO - Mithil Thakore

<figure><img src="https://1599276330-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7rjvLH76qeUux5q9VdQg%2Fuploads%2FttUZnHaR3HnveVUOhVXH%2FMithil-Thakore%20(1).png?alt=media&amp;token=2a457a82-0fe5-41cc-a661-cca412937012" alt="" width="375"><figcaption><p>Mithil Thakore, CEO Velar</p></figcaption></figure>

Mithil Thakore, CEO of Velar, is a seasoned entrepreneur and visionary in the cryptocurrency and blockchain industry, with over eight years of experience. Mithil founded EkBTC.in, a pioneering platform for buying Bitcoin using credit cards.&#x20;

Later, he co-founded Quillhash.com, where he helped build enterprise-grade blockchain solutions and a smart contracts audit service. After successfully exiting Quillhash, he went on to found TeraSurge Capital, a quant-based crypto derivatives trading desk and prop VC.&#x20;

Mithil is now dedicated to Velar, where his expertise in enterprise blockchain and emerging market opportunities is invaluable. He envisions a future where Bitcoin dominates decentralized finance, driven by its inherent advantages as a store of value, transfer of value, and unit of account. As CEO, Mithil is committed to building the foundations necessary to make this vision a reality.

#### Connect with Mithil

* LinkedIn: [Mithil Thakore](https://www.linkedin.com/in/mithilthakore/)
* Twitter: [@RainFire09](https://x.com/RainFire09)


# CMO - Peter Watson

<figure><img src="https://1599276330-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7rjvLH76qeUux5q9VdQg%2Fuploads%2FeRT4AitKtbv2QEdDQT5L%2FPeter-Watson%20(2).png?alt=media&amp;token=9b202fc2-b23f-4b9b-8f83-9e56631dfd29" alt="" width="375"><figcaption><p>Peter Watson, CMO Velar</p></figcaption></figure>

Peter Watson, Chief Marketing Officer at Velar, has been an entrepreneur his entire life, launching, investing in, acquiring, and selling brands before moving to Dubai. Actively involved in the cryptocurrency industry since 2017, Peter is also the founder of Featured Group, a British investment group based in the UK, and a best-selling author and keynote speaker on innovative marketing across Europe.

Peter started as one of the first investors in Velar before being brought in as CMO to support its growth. At Velar, he drives the global marketing strategy, leveraging his expertise to expand the project's reach and influence. Peter is dedicated to driving a community-first approach, viewing Bitcoin projects as an extension of the community. His insights and forward-thinking strategies have been pivotal, including leading Velar to a record-breaking launch on the Bybit platform.

#### Connect with Peter

* LinkedIn: [Peter Watson](https://www.linkedin.com/in/pwats/)
* Twitter: [@visionsbtc](https://x.com/visionsbtc)


