Skip to main content

Introduction

This guide will cover how to create (or mint) a liquidity position on the Ramses V3 protocol. Like the Liquidity Position guide it doesn’t have an accompanying example, nevertheless the concepts and functions used here can be found among the various examples that interact with liquidity positions.
If you need an introduction to liquidity positions, check out the Liquidity Position guide
The RamsesV3PositionManager Contract can be used to create Positions, as well as get information on existing Positions. In this guide, we will fetch all Positions an address has and fetch the detailed Position Data for those positions. The guide will cover:
  1. Creating an ethersJS contract to interact with the RamsesV3PositionManager.
  2. Fetching all positions for an address.
  3. Fetching the position info for the positions.
At the end of the guide, given the inputs above, we should be able to mint a liquidity position with the press of a button and view the position on the UI of the web application. For this guide, we do not need to use the SDK packages directly. We will only import the contract ABI for the NonfungiblePositionManager Contract from @uniswap/v3-periphery (Ramses V3 uses compatible interfaces).

Connecting to the NFTPositionManager Contract

We use ethersJS to interact with the RamsesV3PositionManager Contract. Let’s create an ethers Contract:
We get the Contract ABI from the v3-periphery package and the contract address from the Ramses contract addresses

Fetching the Position Ids

We want to fetch all Position Ids for our address. We first fetch the number of positions and then the ids by their indices. We fetch the number of positions using the balanceOf read call:
Next we iterate over the number of positions and fetch the ids:

Fetching the Position Info

Now that we have the ids of the Positions associated with our address, we can fetch the position info using the positions function. The solidity function returns a lot of values describing the Position:
In this example we only care about values needed to interact with positions, so we create an Interface PositionInfo:
We fetch the Position data with positions:
Finally, we map the RPC response to our interface:
We now have an array containing PositionInfo for all positions that our address holds.