πŸ“šOverview

This directory contains comprehensive developer documentation for the BitBadges blockchain's x/gamm module.

This module was forked from Osmosis's x/gamm module with several key modifications to support BitBadges tokens and enhance compatibility.

Key Differences from Osmosis

1. Interface Revamps

  • Removed smoothWeightChangeParams and other unused parameters

  • Updated certain type definitions for better compatibility with our codebase

  • Streamlined interfaces for improved performance

  • Remove unneeded logic like stableswap pools and governance proposal handling

  • Removed future pool governor functionality

  • Removed pool creation fee requirements

2. Badge Token Integration

The main difference is in the badge token handling system. With every attempted transfer of BitBadges tokens, the system:

  • Wrapping Conversion: Uses cosmosCoinWrapperPaths defined by the collection to convert badge tokens to x/bank denominations (using the path.balances array) at a set conversion rate

  • 1:1 Minting: Behind the scenes, mints/burns 1:1 at the conversion rate into an x/bank denomination before / after each transfer to/from a pool

  • Pool Compatibility: Ensures seamless integration with existing pool infrastructure

  • Automatic Conversion: Handles badge token transfers to/from pools automatically

Conversion Example

Here's how the badge token conversion works:

Badge Token: badges:21:utoken

  • Collection ID: 21

  • Base Denom: utoken

  • Wrapper Path Balances Conversion Rate: [{ amount: 1n, badgeIds: [{ start: 1n, end: 1n }], ownershipTimes: UintRangeArray.FullRanges() }]

Conversion Process:

1 badges:21:utoken = [{ amount: 1n, badgeIds: [{ start: 1n, end: 1n }], ownershipTimes: UintRangeArray.FullRanges() }]

2 badges:21:utoken = [{ amount: 2n, badgeIds: [{ start: 1n, end: 1n }], ownershipTimes: UintRangeArray.FullRanges() }]

Visual Flow:

User wants to add 5 badges:21:utoken to a pool in liquidity
    ↓
System reads cosmosCoinWrapperPaths for collection 21
    ↓
Finds path with denom "utoken" and balances array (using the wrapper path's balances array)
    ↓
Transfers the x/badges balances to the pool address with conversions applied
    ↓
Pool receives the x/badges balances and mints the corresponding badges:21:utoken balances which are native x/bank denominations
    ↓
The user now has the equivalent of badges:21:utoken balances in the pool (all else in x/gamm is kept the same as standard in Osmosis)

For the reverse, when a pool wants to send tokens to the user, it will burn the native x/bank denominations and transfer the x/badges balances back to the user address.

Table of Contents

  1. Introduction - Overview and key concepts

  2. Messages - Transaction messages and handlers

Message Reference

Core Operations

Query Reference

For all GAMM queries, please refer to the BitBadges LCD API.

The LCD provides comprehensive query endpoints for:

  • Pool information and statistics

  • Trading data and spot prices

  • Module parameters

  • And more

All queries follow the standard Cosmos SDK query patterns and can be accessed via REST API or gRPC.

Documentation Style

This documentation follows the Cosmos SDK module documentation standards and is designed for developers building on or integrating with the BitBadges blockchain.

Last updated