Skip to main content

Auto Position Creator Smart Contract (1.0.0)

Download OpenAPI specification:Download

The Auto Position Creator Smart Contract simplifies the process of interacting with liquidity pools and farm staking on the Bitcoin.me DeFi. It allows users to utilize any token to enter a liquidity pool or a farm staking position seamlessly.

Overview

The Auto Position Creator contract provides:

  • Multi-Token Entry: Supports creating positions using a single token
  • Automated Swaps: Automatically performs the required token swaps to acquire liquidity pool tokens
  • Seamless Farm Staking: Facilitates direct entry into farm staking positions
  • LP Position Creation: Creates liquidity pool positions from a single token

Endpoints

Write operations that modify contract state

Create LP Position from Single Token

Creates a liquidity pool position using a single token. The contract swaps the token into the required pair tokens and adds liquidity to the specified pool.

Process:

  1. User sends a single token as payment
  2. Contract performs swap operations to acquire both tokens needed for the LP
  3. Liquidity is added to the specified pair
  4. LP tokens are returned to the user

Swap Operations Structure: Each swap operation in the list contains:

  • address: Address of the token pair for the swap
  • method: Swap method (swapTokensFixedInput or swapTokensFixedOutput)
  • token_identifier: Identifier of the output token
  • min_amount_out: Minimum output amount of the token

Payment: Any token listed in the DeFi

Request Body schema: application/json
required
scAddress
required
string

Auto Position Creator contract address

funcName
required
string
Value: "createLpPosFromSingleToken"
args
required
Array of strings

Arguments:

  • pair_address (ManagedAddress): Address of the liquidity pool
  • add_liq_first_token_min_amount_out (BigUint): Minimum amount of the first token required after swap
  • add_liq_second_token_min_amount_out (BigUint): Minimum amount of the second token required after swap
  • swap_operations (list): List of swap operations to convert the token
    • Each operation: address, method, token_identifier, min_amount_out
value
required
string

Token payment to use for creating the LP position

Responses

Request samples

Content type
application/json
Example
{
  • "scAddress": "klv1qqqqqqqqqqqqqpgqxyz...",
  • "funcName": "createLpPosFromSingleToken",
  • "args": [
    ],
  • "value": "KLV=10000000"
}

Response samples

Content type
application/json
{
  • "data": {
    },
  • "error": "string",
  • "code": "string"
}

Create Farm Staking Position from Single Token

Creates a farm staking position using a single token. The contract performs swaps to acquire the required staking tokens and initiates the staking process.

Process:

  1. User sends a single token as payment
  2. Contract performs swap operations to acquire the farm's staking token
  3. Tokens are staked in the farm staking contract
  4. Farm position tokens are returned to the user

Swap Operations Structure: Each swap operation in the list contains:

  • address: Address of the token pair for the swap
  • method: Swap method (swapTokensFixedInput or swapTokensFixedOutput)
  • token_identifier: Identifier of the output token
  • min_amount_out: Minimum output amount of the token

Payment: Any token listed in the DeFi

Request Body schema: application/json
required
scAddress
required
string

Auto Position Creator contract address

funcName
required
string
Value: "createFarmStakingPosFromSingleToken"
args
required
Array of strings

Arguments:

  • farm_staking_address (ManagedAddress): Address of the farm staking contract
  • min_amount_out (BigUint): Minimum amount of tokens required for staking
  • swap_operations (list): List of swap operations to convert the token
    • Each operation: address, method, token_identifier, min_amount_out
value
required
string

Token payment to use for creating the farm staking position

Responses

Request samples

Content type
application/json
Example
{
  • "scAddress": "klv1qqqqqqqqqqqqqpgqxyz...",
  • "funcName": "createFarmStakingPosFromSingleToken",
  • "args": [
    ],
  • "value": "KLV=10000000"
}

Response samples

Content type
application/json
{
  • "data": {
    },
  • "error": "string",
  • "code": "string"
}