Primatives
Bbamm

BBAMM

Bitcoin Based Automated Market Maker

Introduction

This document outlines a Bitcoin Based automated market maker.

Digital assets that are stored in a BBAMM liquidity pool which are able to be traded against by traders.

Liquidity providers store digital assets in a liquidity pool by depositing proportionate BRC-20 tokens into a given liquidity pool, based on Ticker, where liquidity providers take on price risk and are compensated with trading fees.

Technical Requirements

  • Indexer: Library which fully implements the specification of brc-20 rolling up transaction proofs into human readable format for UI consumption.

  • Pool Manager Logic based intermediary that uses input data to release signatures which are used to call Swap and Deposit functions.

  • Observer Instance of historical price and liquidity data of a given tick position.

Key Considerations

  • Immutable: Supply and max per mint is immutable after the first deployment
  • First is First: Naming space is limited to 4 digits with "First is first" approach
  • Supply: Fractional relationship of Satoshis to Bitcoin must be represented in token reward paring.

Rationale

There needs to be a Bitcoin native way to swap BRC-20 tokens without an order book.

A protocol interface that users can employ to swap or add liquidity.

Definitions

TermDescription
BRC-20Created in March 2023, BRC-20’s are fungible tokens compatible with Bitcoin
BTC-20BTC-20 enables BRC-20s to be used in defi by making them compatible with a BTC familiar
InscribeThe process of attaching data to individual satoshis. This information is stored within the Witness Data of the Transaction, meaning that all inscriptions are On-Chain. Ordinal inscriptions may also be referred to as Digital Artifacts
PositionAn instance of liquidity defined by upper and lower ticker and the amount of liquidity contained therein
LiquidityDigital asset positions that are stored in a BBAMM pool contract, and are able to be traded against by traders.
Spot PriceThe current price of a token relative to another within a given position
Swap FeesThe fees collected upon swapping which are rewarded to liquidity providers
PebbleSatoshi pegged familar

Methods

MethodDescription
DeployDeploy a pool based on a given ticker position (e.g. BTC-ORDI) using pay & inscribe
SwapTransfer a balance of BRC-20 token, receive a balance of BRC-20 token

Protocol

This proposal introduces a Bitcoin Based Automated Market Maker, enabling trustless swaps of BRC-20 tokens.

Deploy Inscription process that creates new position of BRC-20 tokens, locked in a vault against liquidity backing.

Swap An inscription event which enables the swaping of two BRC-20 tokens.

The protocol remains compatible with BRC-20 functionality that includes deploy, mint and transfer.

Swap

A Spot Price is established based on the vaulted amount of lower ticker (e.g. ordi) divided by the the vaulted upper ticker amount (e.g. BTC-20)

When swapping from a BRC-20 token (selling for Bitcoin) the receiving token ticker is PBBL (a satoshi familar representing 1/100,000,000 Bitcoin)

You must compose PBBL into BTC-20 in order to swap 1:1 for Bitcoin.

Strategically, it makes sense to create PBBL liquidity positions.

The liquidity provider receives fees in PBBL.

Validation

A valid Swap is required to transfer a balance. Validity can be determined by the following:

A valid Deploy function is required to establish a BBAMM liquidity position.

A valid transfer based on Spot Price is required to swap against the deployed liquidity position.

Changelog

Version 0.1 - May 16, 2023