# MsgJoinPool

Joins an existing pool by providing liquidity. Users can join a pool by providing tokens proportional to the current pool composition. In return, they receive LP tokens representing their share of the pool.

## Join Pool Properties

When joining a pool:

* Tokens must be provided in the correct proportions
* LP tokens are minted to the user
* Pool liquidity increases
* User becomes eligible for trading fees

## Proto Definition

```protobuf
// ===================== MsgJoinPool
// This is really MsgJoinPoolNoSwap
message MsgJoinPool {
  option (amino.name) = "gamm/join-pool";
  option (cosmos.msg.v1.signer) = "sender";

  string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
  uint64 pool_id = 2 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ];
  string share_out_amount = 3 [

    (gogoproto.customtype) = "cosmossdk.io/math.Int",
    (gogoproto.moretags) = "yaml:\"pool_amount_out\"",
    (gogoproto.nullable) = false
  ];
  repeated cosmos.base.v1beta1.Coin token_in_maxs = 4 [
    (gogoproto.moretags) = "yaml:\"token_in_max_amounts\"",
    (gogoproto.nullable) = false
  ];
}

message MsgJoinPoolResponse {
  string share_out_amount = 1 [

    (gogoproto.customtype) = "cosmossdk.io/math.Int",
    (gogoproto.moretags) = "yaml:\"share_out_amount\"",
    (gogoproto.nullable) = false
  ];
  repeated cosmos.base.v1beta1.Coin token_in = 2 [
    (gogoproto.moretags) = "yaml:\"token_out\"",
    (gogoproto.nullable) = false
  ];
}
```

### JSON Example

```json
{
    "sender": "bb1abc123...",
    "pool_id": "1",
    "share_out_amount": "1000000",
    "token_in_maxs": [
        {
            "denom": "uatom",
            "amount": "100000"
        },
        {
            "denom": "uosmo",
            "amount": "500000"
        }
    ]
}
```

## Token Proportions

The tokens provided must be in the same proportion as the current pool composition. If not, the transaction will fail or tokens will be returned.

## Slippage Protection

The `token_in_maxs` field provides slippage protection by setting maximum amounts for each token that can be used in the join operation.

## LP Token Minting

Upon successful join, LP tokens are minted to the user's address. These tokens represent ownership of the pool and can be used for:

* Earning trading fees
* Governance participation
* Staking in yield farming programs


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bitbadges.io/other-modules/x-gamm/messages/msg-join-pool.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
