Crescent Docs
  • Introduction
    • What is Crescent?
    • Crescent DEX
      • Market
      • Pool (Liquidity Pool)
      • Position
      • Order-book and Tick system
      • Hybrid DEX
      • Batch Matching
      • Sequential Matching
      • Multi-hop Swap(SlipLess Swap)
      • Ranged Liquidity
        • Comparison with Basic position
        • Liquidity Amplification Factor
        • Possibility of Change to a Single-Coin position
        • Multiple Positions in the Pool
      • Fee
      • Farming
        • Current Farming vs Legacy Farming
      • Market Maker Incentives
        • MarketMaker Apply / Incentive Claim
        • MarketMaker Scoring
    • Liquid Staking
      • Staking vs. Liquid Staking
      • Overview of Staking Rewards
      • Calculations for Staking Rewards
      • Liquid Staking Validator
    • Snowball (Liquid AMM)
      • Mint & Burn sb-Token
      • Reward Auction
        • How to Participate
    • Gas and Fees
    • Liquid Governance
    • Partnership
    • Crescent Derivatives
    • Crescent DEX (legacy)
      • Coin Pair
      • Liquidity Pool
      • Legacy Farming Rewards (LP Incentives)
      • New Farming Rewards (LP Incentives)
      • Orderbook and Tick System
      • Hybrid DEX
      • Batch Execution
      • Ranged Pools
      • Market Maker Incentives
        • MarketMaker Apply / Incentive Claim
        • MarketMaker Scoring
      • Synergy with Crescent Boost
  • Developer Guide
    • CLI and API
      • AMM module
        • CLI Reference
        • API Reference
      • Exchange module
        • CLI Reference
        • API Reference
      • LiquidStaking module
        • CLI Reference
        • API Reference
      • LiquidAmm module
        • CLI Reference
        • API Reference
  • Technical Guide
    • Market Maker
    • Farming Planner
  • Other Information
    • Network Configurations
    • Crescent Design Assets
Powered by GitBook
On this page
  • Params
  • AllPools
  • Pool
  • AllPositions
  • Position
  • AddLiquiditySimulation
  • RemoveLiquiditySimulation
  • CollectibleCoins
  • AllTickInfos
  • TickInfo
  • AllFarmingPlans
  • FarmingPlan
  1. Developer Guide
  2. CLI and API
  3. AMM module

API Reference

Params

Example Request

http://localhost:1317/crescent/amm/v1beta1/params

Example Response

{
  "params": {
    "pool_creation_fee": [
      {
        "denom": "stake",
        "amount": "1000000"
      }
    ],
    "default_tick_spacing": 50,
    "private_farming_plan_creation_fee": [
      {
        "denom": "stake",
        "amount": "1000000"
      }
    ],
    "max_num_private_farming_plans": 50,
    "max_farming_block_time": "10s"
  }
}

AllPools

Example Request

http://localhost:1317/crescent/amm/v1beta1/pools
http://localhost:1317/crescent/amm/v1beta1/pools?market_id=1

Example Response

{
  "pools": [
    {
      "id": "1",
      "market_id": "1",
      "balance0": {
        "denom": "uatom",
        "amount": "706867"
      },
      "balance1": {
        "denom": "uusd",
        "amount": "12020740"
      },
      "reserve_address": "cre1pf3w839s80c26z8dqccuzu4epyj58jrzglqv93yppqpj6yggu9qs8vpazr",
      "rewards_pool": "cre1srphgsfqllr85ndknjme24txux8m0sz0hhpnnksn2339d3a788rs3ax6tu",
      "tick_spacing": 50,
      "min_order_quantity": "1.000000000000000000",
      "min_order_quote": "1.000000000000000000",
      "current_tick": 90208,
      "current_price": "10.208470700277704312",
      "current_liquidity": "61622776",
      "total_liquidity": "61622776",
      "fee_growth_global": [
        {
          "denom": "uatom",
          "amount": "2417937.160117551341731180"
        },
        {
          "denom": "uusd",
          "amount": "8072226411.870831654841385269"
        }
      ],
      "farming_rewards_growth_global": [
        {
          "denom": "uatom",
          "amount": "1363132.358723988675875290"
        }
      ]
    }
  ],
  "pagination": {
    "next_key": null,
    "total": "1"
  }
}

Pool

Example Request

http://localhost:1317/crescent/amm/v1beta1/pools/1

Example Response

{
  "pool": {
    "id": "1",
    "market_id": "1",
    "balance0": {
      "denom": "uatom",
      "amount": "706867"
    },
    "balance1": {
      "denom": "uusd",
      "amount": "12020740"
    },
    "reserve_address": "cre1pf3w839s80c26z8dqccuzu4epyj58jrzglqv93yppqpj6yggu9qs8vpazr",
    "rewards_pool": "cre1srphgsfqllr85ndknjme24txux8m0sz0hhpnnksn2339d3a788rs3ax6tu",
    "tick_spacing": 50,
    "min_order_quantity": "1.000000000000000000",
    "min_order_quote": "1.000000000000000000",
    "current_tick": 90208,
    "current_price": "10.208470700277704312",
    "current_liquidity": "61622776",
    "total_liquidity": "61622776",
    "fee_growth_global": [
      {
        "denom": "uatom",
        "amount": "2417937.160117551341731180"
      },
      {
        "denom": "uusd",
        "amount": "8072226411.870831654841385269"
      }
    ],
    "farming_rewards_growth_global": [
      {
        "denom": "uatom",
        "amount": "6052956.783381521144065276"
      }
    ]
  }
}

AllPositions

Example Request

http://localhost:1317/crescent/amm/v1beta1/positions
http://localhost:1317/crescent/amm/v1beta1/positions?pool_id=1
http://localhost:1317/crescent/amm/v1beta1/positions?owner=cre1zaavvzxez0elundtn32qnk9lkm8kmcszxclz6p

Example Response

{
  "positions": [
    {
      "id": "1",
      "pool_id": "1",
      "owner": "cre1zaavvzxez0elundtn32qnk9lkm8kmcszxclz6p",
      "lower_price": "9.000000000000000000",
      "upper_price": "11.000000000000000000",
      "liquidity": "61622776",
      "last_fee_growth_inside": [
      ],
      "owed_fee": [
      ],
      "last_farming_rewards_growth_inside": [
      ],
      "owed_farming_rewards": [
      ]
    }
  ],
  "pagination": {
    "next_key": null,
    "total": "1"
  }
}

Position

Example Request

http://localhost:1317/crescent/amm/v1beta1/positions/1

Example Response

{
  "position": {
    "id": "1",
    "pool_id": "1",
    "owner": "cre1zaavvzxez0elundtn32qnk9lkm8kmcszxclz6p",
    "lower_price": "9.000000000000000000",
    "upper_price": "11.000000000000000000",
    "liquidity": "61622776",
    "last_fee_growth_inside": [
    ],
    "owed_fee": [
    ],
    "last_farming_rewards_growth_inside": [
    ],
    "owed_farming_rewards": [
    ]
  }
}

AddLiquiditySimulation

Example Request

http://localhost:1317/crescent/amm/v1beta1/simulation/add_liquidity?pool_id=1&lower_price=9&upper_price=11&desired_amount=100uatom,100uusd

Example Response

{
  "liquidity": "559",
  "amount": [
    {
      "denom": "uatom",
      "amount": "8"
    },
    {
      "denom": "uusd",
      "amount": "100"
    }
  ]
}

RemoveLiquiditySimulation

Example Request

http://localhost:1317/crescent/amm/v1beta1/simulation/remove_liquidity?position_id=1&liquidity=10000

Example Response

{
  "amount": [
    {
      "denom": "uatom",
      "amount": "130"
    },
    {
      "denom": "uusd",
      "amount": "1785"
    }
  ]
}

CollectibleCoins

Example Request

http://localhost:1317/crescent/amm/v1beta1/collectible_coins?owner=cre1zaavvzxez0elundtn32qnk9lkm8kmcszxclz6p
http://localhost:1317/crescent/amm/v1beta1/collectible_coins?position_id=1

Example Response

{
  "fee": [
    {
      "denom": "uatom",
      "amount": "147"
    },
    {
      "denom": "uusd",
      "amount": "2571"
    }
  ],
  "farming_rewards": [
    {
      "denom": "uatom",
      "amount": "63407"
    }
  ]
}

AllTickInfos

Example Request

http://localhost:1317/crescent/amm/v1beta1/pools/1/tick_infos

Example Response

{
  "tick_infos": [
    {
      "tick": 80000,
      "gross_liquidity": "61622776",
      "net_liquidity": "61622776",
      "fee_growth_outside": [
      ],
      "farming_rewards_growth_outside": [
      ]
    },
    {
      "tick": 91000,
      "gross_liquidity": "61622776",
      "net_liquidity": "-61622776",
      "fee_growth_outside": [
      ],
      "farming_rewards_growth_outside": [
      ]
    }
  ],
  "pagination": {
    "next_key": null,
    "total": "2"
  }
}

TickInfo

Example Request

http://localhost:1317/crescent/amm/v1beta1/pools/1/tick_infos/80000

Example Response

{
  "tick_info": {
    "tick": 80000,
    "gross_liquidity": "61622776",
    "net_liquidity": "61622776",
    "fee_growth_outside": [
    ],
    "farming_rewards_growth_outside": [
    ]
  }
}

AllFarmingPlans

Example Request

http://localhost:1317/crescent/amm/v1beta1/farming_plans

Example Response

{
  "farming_plans": [
    {
      "id": "1",
      "description": "New farming plan",
      "farming_pool_address": "cre1ll5dtdmug9n54fnhr9fpr8nmr840s72dstydd723ufgsxzrjg5qq9kzn3e",
      "termination_address": "cre1zaavvzxez0elundtn32qnk9lkm8kmcszxclz6p",
      "reward_allocations": [
        {
          "pool_id": "1",
          "rewards_per_day": [
            {
              "denom": "uatom",
              "amount": "1000000"
            }
          ]
        }
      ],
      "start_time": "2023-01-01T00:00:00Z",
      "end_time": "2024-01-01T00:00:00Z",
      "is_private": true,
      "is_terminated": false
    }
  ],
  "pagination": {
    "next_key": null,
    "total": "1"
  }
}

FarmingPlan

Example Request

http://localhost:1317/crescent/amm/v1beta1/farming_plans/1

Example Response

{
  "farming_plan": {
    "id": "1",
    "description": "New farming plan",
    "farming_pool_address": "cre1ll5dtdmug9n54fnhr9fpr8nmr840s72dstydd723ufgsxzrjg5qq9kzn3e",
    "termination_address": "cre1zaavvzxez0elundtn32qnk9lkm8kmcszxclz6p",
    "reward_allocations": [
      {
        "pool_id": "1",
        "rewards_per_day": [
          {
            "denom": "uatom",
            "amount": "1000000"
          }
        ]
      }
    ],
    "start_time": "2023-01-01T00:00:00Z",
    "end_time": "2024-01-01T00:00:00Z",
    "is_private": true,
    "is_terminated": false
  }
}
PreviousCLI ReferenceNextExchange module

Last updated 1 year ago