> ## Documentation Index
> Fetch the complete documentation index at: https://docs.multiliquid.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Program IDL

> Interface Definition Language for the Multiliquid Swap Program on Solana

The program IDL (Interface Definition Language) is required for interacting with the Multiliquid Swap Program via the Anchor framework or `@solana/web3.js`. It defines all instructions, accounts, types, and events.

<Info>
  The code block includes a built-in copy button. Click the copy icon in the top-right corner to copy the full IDL to your clipboard.
</Info>

## Swap Program

Handles all swap operations between RWAs and stablecoins, asset configuration, pair management, liquidity operations, and fee collection.

**Program ID**: `HaWDr94LKJQT2fXuHJGsSGeQf6M7S68FXpEQLcE5RYs6`

<Accordion title="Swap Program IDL">
  ```json swap_program.json theme={null}
  {
    "address": "HaWDr94LKJQT2fXuHJGsSGeQf6M7S68FXpEQLcE5RYs6",
    "metadata": {
      "name": "swap_program",
      "version": "0.1.0",
      "spec": "0.1.0",
      "description": "Created with Anchor"
    },
    "instructions": [
      {
        "name": "add_liquidity",
        "discriminator": [
          181,
          157,
          89,
          67,
          143,
          182,
          52,
          72
        ],
        "accounts": [
          {
            "name": "liquidity_provider",
            "docs": [
              "the liquidity provider that provides the tokens"
            ],
            "signer": true
          },
          {
            "name": "mint_address",
            "docs": [
              "the mint address of the token"
            ]
          },
          {
            "name": "lp_token_account",
            "docs": [
              "the token account of the liquidity provider"
            ],
            "writable": true
          },
          {
            "name": "vault_token_account",
            "docs": [
              "the vault token account (for the program)"
            ],
            "writable": true,
            "pda": {
              "seeds": [
                {
                  "kind": "account",
                  "path": "lp_vault_authority"
                },
                {
                  "kind": "account",
                  "path": "token_program"
                },
                {
                  "kind": "account",
                  "path": "mint_address"
                }
              ],
              "program": {
                "kind": "const",
                "value": [
                  140,
                  151,
                  37,
                  143,
                  78,
                  36,
                  137,
                  241,
                  187,
                  61,
                  16,
                  41,
                  20,
                  142,
                  13,
                  131,
                  11,
                  90,
                  19,
                  153,
                  218,
                  255,
                  16,
                  132,
                  4,
                  142,
                  123,
                  216,
                  219,
                  233,
                  248,
                  89
                ]
              }
            }
          },
          {
            "name": "lp_vault_authority",
            "docs": [
              "the LP-specific vault authority used in vault ATA constraints"
            ],
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    118,
                    97,
                    117,
                    108,
                    116,
                    95,
                    97,
                    117,
                    116,
                    104,
                    111,
                    114,
                    105,
                    116,
                    121
                  ]
                },
                {
                  "kind": "account",
                  "path": "liquidity_provider"
                }
              ]
            }
          },
          {
            "name": "global_config",
            "docs": [
              "the global config, used to check if the program is paused"
            ],
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    103,
                    108,
                    111,
                    98,
                    97,
                    108,
                    95,
                    99,
                    111,
                    110,
                    102,
                    105,
                    103
                  ]
                }
              ]
            }
          },
          {
            "name": "token_program",
            "docs": [
              "the token program, could be either the token2022 or the legacy token program"
            ]
          }
        ],
        "args": [
          {
            "name": "amount",
            "type": "u64"
          }
        ]
      },
      {
        "name": "claim_fees",
        "discriminator": [
          82,
          251,
          233,
          156,
          12,
          52,
          184,
          202
        ],
        "accounts": [
          {
            "name": "stable_coin_mint_address",
            "docs": [
              "the mint address of the stable coin"
            ]
          },
          {
            "name": "fee_wallet_token_account",
            "docs": [
              "the token account of the fee wallet"
            ],
            "writable": true
          },
          {
            "name": "program_authority",
            "docs": [
              "the program authority, used to sign the CPI transfer"
            ],
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    112,
                    114,
                    111,
                    103,
                    114,
                    97,
                    109,
                    95,
                    97,
                    117,
                    116,
                    104,
                    111,
                    114,
                    105,
                    116,
                    121
                  ]
                }
              ]
            }
          },
          {
            "name": "fee_token_account",
            "docs": [
              "the fee vault token account, used to transfer the tokens to the fee wallet"
            ],
            "writable": true,
            "pda": {
              "seeds": [
                {
                  "kind": "account",
                  "path": "program_authority"
                },
                {
                  "kind": "account",
                  "path": "token_program"
                },
                {
                  "kind": "account",
                  "path": "stable_coin_mint_address"
                }
              ],
              "program": {
                "kind": "const",
                "value": [
                  140,
                  151,
                  37,
                  143,
                  78,
                  36,
                  137,
                  241,
                  187,
                  61,
                  16,
                  41,
                  20,
                  142,
                  13,
                  131,
                  11,
                  90,
                  19,
                  153,
                  218,
                  255,
                  16,
                  132,
                  4,
                  142,
                  123,
                  216,
                  219,
                  233,
                  248,
                  89
                ]
              }
            }
          },
          {
            "name": "global_config",
            "docs": [
              "the global config, used to check if the program is paused, and check fee wallet"
            ],
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    103,
                    108,
                    111,
                    98,
                    97,
                    108,
                    95,
                    99,
                    111,
                    110,
                    102,
                    105,
                    103
                  ]
                }
              ]
            }
          },
          {
            "name": "token_program",
            "docs": [
              "the token program, could be either the token2022 or the legacy token program"
            ]
          }
        ],
        "args": [
          {
            "name": "fee_wallet",
            "type": "pubkey"
          }
        ]
      },
      {
        "name": "close_pair",
        "discriminator": [
          45,
          8,
          194,
          47,
          65,
          139,
          172,
          120
        ],
        "accounts": [
          {
            "name": "admin",
            "docs": [
              "the admin, checked by has_one constraint with global config"
            ],
            "writable": true,
            "relations": [
              "global_config"
            ]
          },
          {
            "name": "liquidity_provider",
            "docs": [
              "the liquidity provider, will receive tokens and reclaimed rent back if necessary"
            ],
            "writable": true,
            "signer": true
          },
          {
            "name": "pair",
            "docs": [
              "the pair account, will be closed"
            ],
            "writable": true,
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    112,
                    97,
                    105,
                    114
                  ]
                },
                {
                  "kind": "account",
                  "path": "liquidity_provider"
                },
                {
                  "kind": "account",
                  "path": "stable_coin_mint_address"
                },
                {
                  "kind": "account",
                  "path": "asset_token_mint_address"
                }
              ]
            }
          },
          {
            "name": "stable_coin_mint_address",
            "docs": [
              "the mint address of the pair's stable coin"
            ]
          },
          {
            "name": "asset_token_mint_address",
            "docs": [
              "the mint address of the pair's asset token"
            ]
          },
          {
            "name": "lp_vault_authority",
            "docs": [
              "the LP-specific vault authority, used to sign LP vault transfers"
            ],
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    118,
                    97,
                    117,
                    108,
                    116,
                    95,
                    97,
                    117,
                    116,
                    104,
                    111,
                    114,
                    105,
                    116,
                    121
                  ]
                },
                {
                  "kind": "account",
                  "path": "liquidity_provider"
                }
              ]
            }
          },
          {
            "name": "stable_coin_vault_token_account",
            "docs": [
              "the vault token account for the stable coin"
            ],
            "writable": true,
            "pda": {
              "seeds": [
                {
                  "kind": "account",
                  "path": "lp_vault_authority"
                },
                {
                  "kind": "account",
                  "path": "token_program_stable"
                },
                {
                  "kind": "account",
                  "path": "stable_coin_mint_address"
                }
              ],
              "program": {
                "kind": "const",
                "value": [
                  140,
                  151,
                  37,
                  143,
                  78,
                  36,
                  137,
                  241,
                  187,
                  61,
                  16,
                  41,
                  20,
                  142,
                  13,
                  131,
                  11,
                  90,
                  19,
                  153,
                  218,
                  255,
                  16,
                  132,
                  4,
                  142,
                  123,
                  216,
                  219,
                  233,
                  248,
                  89
                ]
              }
            }
          },
          {
            "name": "asset_token_vault_token_account",
            "docs": [
              "the vault token account for the asset token"
            ],
            "writable": true,
            "pda": {
              "seeds": [
                {
                  "kind": "account",
                  "path": "lp_vault_authority"
                },
                {
                  "kind": "account",
                  "path": "token_program_asset"
                },
                {
                  "kind": "account",
                  "path": "asset_token_mint_address"
                }
              ],
              "program": {
                "kind": "const",
                "value": [
                  140,
                  151,
                  37,
                  143,
                  78,
                  36,
                  137,
                  241,
                  187,
                  61,
                  16,
                  41,
                  20,
                  142,
                  13,
                  131,
                  11,
                  90,
                  19,
                  153,
                  218,
                  255,
                  16,
                  132,
                  4,
                  142,
                  123,
                  216,
                  219,
                  233,
                  248,
                  89
                ]
              }
            }
          },
          {
            "name": "lp_stable_token_account",
            "docs": [
              "the token account of the liquidity provider for the stable coin"
            ],
            "writable": true
          },
          {
            "name": "lp_asset_token_account",
            "docs": [
              "the token account of the liquidity provider for the asset token"
            ],
            "writable": true
          },
          {
            "name": "lp_vault_stable_pda",
            "docs": [
              "the LP vault info for the stable coin"
            ],
            "writable": true,
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    117,
                    115,
                    101,
                    114,
                    95,
                    118,
                    97,
                    117,
                    108,
                    116,
                    95,
                    105,
                    110,
                    102,
                    111
                  ]
                },
                {
                  "kind": "account",
                  "path": "stable_coin_mint_address"
                },
                {
                  "kind": "account",
                  "path": "liquidity_provider"
                }
              ]
            }
          },
          {
            "name": "lp_vault_asset_pda",
            "docs": [
              "the LP vault info for the asset token"
            ],
            "writable": true,
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    117,
                    115,
                    101,
                    114,
                    95,
                    118,
                    97,
                    117,
                    108,
                    116,
                    95,
                    105,
                    110,
                    102,
                    111
                  ]
                },
                {
                  "kind": "account",
                  "path": "asset_token_mint_address"
                },
                {
                  "kind": "account",
                  "path": "liquidity_provider"
                }
              ]
            }
          },
          {
            "name": "asset_config_stable",
            "docs": [
              "the asset config (stable)"
            ],
            "writable": true,
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    97,
                    115,
                    115,
                    101,
                    116
                  ]
                },
                {
                  "kind": "account",
                  "path": "stable_coin_mint_address"
                }
              ]
            }
          },
          {
            "name": "asset_config_rwa",
            "docs": [
              "the asset config (asset)"
            ],
            "writable": true,
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    97,
                    115,
                    115,
                    101,
                    116
                  ]
                },
                {
                  "kind": "account",
                  "path": "asset_token_mint_address"
                }
              ]
            }
          },
          {
            "name": "global_config",
            "docs": [
              "the global config, used to check if the program is paused, and check admin"
            ],
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    103,
                    108,
                    111,
                    98,
                    97,
                    108,
                    95,
                    99,
                    111,
                    110,
                    102,
                    105,
                    103
                  ]
                }
              ]
            }
          },
          {
            "name": "token_program_stable",
            "docs": [
              "the token program for the stable coin, could be either the token2022 or the legacy token program"
            ]
          },
          {
            "name": "token_program_asset",
            "docs": [
              "the token program for the asset token, could be either the token2022 or the legacy token program"
            ]
          }
        ],
        "args": []
      },
      {
        "name": "confirm_new_admin",
        "discriminator": [
          3,
          109,
          83,
          170,
          106,
          54,
          173,
          117
        ],
        "accounts": [
          {
            "name": "global_config",
            "docs": [
              "the global config account, will be updated"
            ],
            "writable": true,
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    103,
                    108,
                    111,
                    98,
                    97,
                    108,
                    95,
                    99,
                    111,
                    110,
                    102,
                    105,
                    103
                  ]
                }
              ]
            }
          },
          {
            "name": "new_admin",
            "signer": true
          }
        ],
        "args": []
      },
      {
        "name": "init_asset_config_account",
        "discriminator": [
          32,
          66,
          21,
          159,
          176,
          230,
          59,
          11
        ],
        "accounts": [
          {
            "name": "asset_config",
            "docs": [
              "the RWA config account, will be initialized if needed"
            ],
            "writable": true,
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    97,
                    115,
                    115,
                    101,
                    116
                  ]
                },
                {
                  "kind": "account",
                  "path": "mint_address"
                }
              ]
            }
          },
          {
            "name": "mint_address",
            "docs": [
              "the mint address of the RWA token"
            ]
          },
          {
            "name": "admin",
            "writable": true,
            "signer": true,
            "relations": [
              "global_config"
            ]
          },
          {
            "name": "fee_vault_token_account",
            "docs": [
              "the fee vault token account, used to store the fees"
            ],
            "writable": true,
            "pda": {
              "seeds": [
                {
                  "kind": "account",
                  "path": "program_authority"
                },
                {
                  "kind": "account",
                  "path": "token_program"
                },
                {
                  "kind": "account",
                  "path": "mint_address"
                }
              ],
              "program": {
                "kind": "const",
                "value": [
                  140,
                  151,
                  37,
                  143,
                  78,
                  36,
                  137,
                  241,
                  187,
                  61,
                  16,
                  41,
                  20,
                  142,
                  13,
                  131,
                  11,
                  90,
                  19,
                  153,
                  218,
                  255,
                  16,
                  132,
                  4,
                  142,
                  123,
                  216,
                  219,
                  233,
                  248,
                  89
                ]
              }
            }
          },
          {
            "name": "program_authority",
            "docs": [
              "the program authority"
            ],
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    112,
                    114,
                    111,
                    103,
                    114,
                    97,
                    109,
                    95,
                    97,
                    117,
                    116,
                    104,
                    111,
                    114,
                    105,
                    116,
                    121
                  ]
                }
              ]
            }
          },
          {
            "name": "global_config",
            "docs": [
              "the global config, used to check admin"
            ],
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    103,
                    108,
                    111,
                    98,
                    97,
                    108,
                    95,
                    99,
                    111,
                    110,
                    102,
                    105,
                    103
                  ]
                }
              ]
            }
          },
          {
            "name": "token_program",
            "docs": [
              "the token program for the asset token, could be either the token2022 or the legacy token program"
            ]
          },
          {
            "name": "system_program",
            "docs": [
              "the system program, used to initialize the account"
            ],
            "address": "11111111111111111111111111111111"
          },
          {
            "name": "associated_token_program",
            "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
          }
        ],
        "args": [
          {
            "name": "nav_data",
            "type": {
              "vec": {
                "defined": {
                  "name": "NavData"
                }
              }
            }
          },
          {
            "name": "price_difference_bps",
            "type": "u16"
          },
          {
            "name": "asset_type",
            "type": {
              "defined": {
                "name": "AssetType"
              }
            }
          }
        ]
      },
      {
        "name": "init_global_config",
        "discriminator": [
          140,
          136,
          214,
          48,
          87,
          0,
          120,
          255
        ],
        "accounts": [
          {
            "name": "global_config",
            "docs": [
              "the global config account, will be initialized"
            ],
            "writable": true,
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    103,
                    108,
                    111,
                    98,
                    97,
                    108,
                    95,
                    99,
                    111,
                    110,
                    102,
                    105,
                    103
                  ]
                }
              ]
            }
          },
          {
            "name": "admin",
            "docs": [
              "the admin, will be the admin of the global config"
            ],
            "writable": true,
            "signer": true
          },
          {
            "name": "system_program",
            "docs": [
              "the system program, used to initialize the account"
            ],
            "address": "11111111111111111111111111111111"
          }
        ],
        "args": [
          {
            "name": "fee_wallet",
            "type": "pubkey"
          },
          {
            "name": "protocol_fees_bps",
            "type": "u16"
          }
        ]
      },
      {
        "name": "init_pair",
        "discriminator": [
          210,
          79,
          92,
          60,
          153,
          69,
          57,
          157
        ],
        "accounts": [
          {
            "name": "admin",
            "docs": [
              "the admin, checked by has_one constraint with global config"
            ],
            "relations": [
              "global_config"
            ]
          },
          {
            "name": "liquidity_provider",
            "docs": [
              "the liquidity provider, must sign to initialize its own pair"
            ],
            "writable": true,
            "signer": true
          },
          {
            "name": "pair",
            "docs": [
              "the pair account, will be initialized"
            ],
            "writable": true,
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    112,
                    97,
                    105,
                    114
                  ]
                },
                {
                  "kind": "account",
                  "path": "liquidity_provider"
                },
                {
                  "kind": "account",
                  "path": "stable_coin_mint_address"
                },
                {
                  "kind": "account",
                  "path": "asset_token_mint_address"
                }
              ]
            }
          },
          {
            "name": "stable_coin_mint_address",
            "docs": [
              "the mint address of the pair's stable coin"
            ]
          },
          {
            "name": "asset_token_mint_address",
            "docs": [
              "the mint address of the pair's asset token"
            ]
          },
          {
            "name": "lp_vault_authority",
            "docs": [
              "the LP-specific vault authority used to own LP's token accounts"
            ],
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    118,
                    97,
                    117,
                    108,
                    116,
                    95,
                    97,
                    117,
                    116,
                    104,
                    111,
                    114,
                    105,
                    116,
                    121
                  ]
                },
                {
                  "kind": "account",
                  "path": "liquidity_provider"
                }
              ]
            }
          },
          {
            "name": "stable_coin_vault_token_account",
            "docs": [
              "the vault token account for the stable coin"
            ],
            "writable": true,
            "pda": {
              "seeds": [
                {
                  "kind": "account",
                  "path": "lp_vault_authority"
                },
                {
                  "kind": "account",
                  "path": "token_program_stable"
                },
                {
                  "kind": "account",
                  "path": "stable_coin_mint_address"
                }
              ],
              "program": {
                "kind": "const",
                "value": [
                  140,
                  151,
                  37,
                  143,
                  78,
                  36,
                  137,
                  241,
                  187,
                  61,
                  16,
                  41,
                  20,
                  142,
                  13,
                  131,
                  11,
                  90,
                  19,
                  153,
                  218,
                  255,
                  16,
                  132,
                  4,
                  142,
                  123,
                  216,
                  219,
                  233,
                  248,
                  89
                ]
              }
            }
          },
          {
            "name": "asset_token_vault_token_account",
            "docs": [
              "the vault token account for the asset token"
            ],
            "writable": true,
            "pda": {
              "seeds": [
                {
                  "kind": "account",
                  "path": "lp_vault_authority"
                },
                {
                  "kind": "account",
                  "path": "token_program_asset"
                },
                {
                  "kind": "account",
                  "path": "asset_token_mint_address"
                }
              ],
              "program": {
                "kind": "const",
                "value": [
                  140,
                  151,
                  37,
                  143,
                  78,
                  36,
                  137,
                  241,
                  187,
                  61,
                  16,
                  41,
                  20,
                  142,
                  13,
                  131,
                  11,
                  90,
                  19,
                  153,
                  218,
                  255,
                  16,
                  132,
                  4,
                  142,
                  123,
                  216,
                  219,
                  233,
                  248,
                  89
                ]
              }
            }
          },
          {
            "name": "lp_vault_stable_pda",
            "docs": [
              "the LP vault info for the stable coin"
            ],
            "writable": true,
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    117,
                    115,
                    101,
                    114,
                    95,
                    118,
                    97,
                    117,
                    108,
                    116,
                    95,
                    105,
                    110,
                    102,
                    111
                  ]
                },
                {
                  "kind": "account",
                  "path": "stable_coin_mint_address"
                },
                {
                  "kind": "account",
                  "path": "liquidity_provider"
                }
              ]
            }
          },
          {
            "name": "lp_vault_asset_pda",
            "docs": [
              "the LP vault info for the asset token"
            ],
            "writable": true,
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    117,
                    115,
                    101,
                    114,
                    95,
                    118,
                    97,
                    117,
                    108,
                    116,
                    95,
                    105,
                    110,
                    102,
                    111
                  ]
                },
                {
                  "kind": "account",
                  "path": "asset_token_mint_address"
                },
                {
                  "kind": "account",
                  "path": "liquidity_provider"
                }
              ]
            }
          },
          {
            "name": "global_config",
            "docs": [
              "the global config, used to check admin"
            ],
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    103,
                    108,
                    111,
                    98,
                    97,
                    108,
                    95,
                    99,
                    111,
                    110,
                    102,
                    105,
                    103
                  ]
                }
              ]
            }
          },
          {
            "name": "lp_stable_config",
            "docs": [
              "the LP stable config, will be initialized if needed"
            ],
            "writable": true,
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    108,
                    112,
                    95,
                    115,
                    116,
                    97,
                    98,
                    108,
                    101,
                    95,
                    99,
                    111,
                    110,
                    102,
                    105,
                    103
                  ]
                },
                {
                  "kind": "account",
                  "path": "stable_coin_mint_address"
                },
                {
                  "kind": "account",
                  "path": "liquidity_provider"
                }
              ]
            }
          },
          {
            "name": "asset_config_stable",
            "docs": [
              "the asset config (stable)"
            ],
            "writable": true,
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    97,
                    115,
                    115,
                    101,
                    116
                  ]
                },
                {
                  "kind": "account",
                  "path": "stable_coin_mint_address"
                }
              ]
            }
          },
          {
            "name": "asset_config_rwa",
            "docs": [
              "the asset config (asset)"
            ],
            "writable": true,
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    97,
                    115,
                    115,
                    101,
                    116
                  ]
                },
                {
                  "kind": "account",
                  "path": "asset_token_mint_address"
                }
              ]
            }
          },
          {
            "name": "token_program_stable",
            "docs": [
              "the token program for the stable coin, could be either the token2022 or the legacy token program"
            ]
          },
          {
            "name": "token_program_asset",
            "docs": [
              "the token program for the asset token, could be either the token2022 or the legacy token program"
            ]
          },
          {
            "name": "associated_token_program",
            "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
          },
          {
            "name": "system_program",
            "docs": [
              "the system program, used to initialize the account"
            ],
            "address": "11111111111111111111111111111111"
          }
        ],
        "args": [
          {
            "name": "redemption_fee_bps",
            "type": "u16"
          },
          {
            "name": "discount_rate_bps",
            "type": "u16"
          }
        ]
      },
      {
        "name": "remove_liquidity",
        "discriminator": [
          80,
          85,
          209,
          72,
          24,
          206,
          177,
          108
        ],
        "accounts": [
          {
            "name": "liquidity_provider",
            "docs": [
              "the liquidity provider, will receive the tokens back"
            ],
            "signer": true
          },
          {
            "name": "mint_address",
            "docs": [
              "the mint address of the token"
            ]
          },
          {
            "name": "lp_token_account",
            "docs": [
              "the token account of the liquidity provider"
            ],
            "writable": true
          },
          {
            "name": "vault_token_account",
            "docs": [
              "the vault token account for the token"
            ],
            "writable": true,
            "pda": {
              "seeds": [
                {
                  "kind": "account",
                  "path": "lp_vault_authority"
                },
                {
                  "kind": "account",
                  "path": "token_program"
                },
                {
                  "kind": "account",
                  "path": "mint_address"
                }
              ],
              "program": {
                "kind": "const",
                "value": [
                  140,
                  151,
                  37,
                  143,
                  78,
                  36,
                  137,
                  241,
                  187,
                  61,
                  16,
                  41,
                  20,
                  142,
                  13,
                  131,
                  11,
                  90,
                  19,
                  153,
                  218,
                  255,
                  16,
                  132,
                  4,
                  142,
                  123,
                  216,
                  219,
                  233,
                  248,
                  89
                ]
              }
            }
          },
          {
            "name": "lp_vault_authority",
            "docs": [
              "the LP-specific vault authority, used to sign the CPI transfers"
            ],
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    118,
                    97,
                    117,
                    108,
                    116,
                    95,
                    97,
                    117,
                    116,
                    104,
                    111,
                    114,
                    105,
                    116,
                    121
                  ]
                },
                {
                  "kind": "account",
                  "path": "liquidity_provider"
                }
              ]
            }
          },
          {
            "name": "global_config",
            "docs": [
              "the global config, used to check if the program is paused"
            ],
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    103,
                    108,
                    111,
                    98,
                    97,
                    108,
                    95,
                    99,
                    111,
                    110,
                    102,
                    105,
                    103
                  ]
                }
              ]
            }
          },
          {
            "name": "token_program",
            "docs": [
              "the token program for the token, could be either the token2022 or the legacy token program"
            ]
          }
        ],
        "args": [
          {
            "name": "amount",
            "type": "u64"
          }
        ]
      },
      {
        "name": "set_new_admin",
        "discriminator": [
          62,
          156,
          4,
          148,
          79,
          162,
          148,
          252
        ],
        "accounts": [
          {
            "name": "global_config",
            "docs": [
              "the global config account, will be updated"
            ],
            "writable": true,
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    103,
                    108,
                    111,
                    98,
                    97,
                    108,
                    95,
                    99,
                    111,
                    110,
                    102,
                    105,
                    103
                  ]
                }
              ]
            }
          },
          {
            "name": "admin",
            "docs": [
              "the multi liquid admin"
            ],
            "signer": true,
            "relations": [
              "global_config"
            ]
          }
        ],
        "args": [
          {
            "name": "new_admin",
            "type": "pubkey"
          }
        ]
      },
      {
        "name": "set_paused_for_asset",
        "discriminator": [
          116,
          141,
          145,
          189,
          67,
          108,
          178,
          238
        ],
        "accounts": [
          {
            "name": "global_config",
            "docs": [
              "global config account, used to check the admin"
            ],
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    103,
                    108,
                    111,
                    98,
                    97,
                    108,
                    95,
                    99,
                    111,
                    110,
                    102,
                    105,
                    103
                  ]
                }
              ]
            }
          },
          {
            "name": "asset_config",
            "docs": [
              "RWA config account, used to update the paused state"
            ],
            "writable": true,
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    97,
                    115,
                    115,
                    101,
                    116
                  ]
                },
                {
                  "kind": "account",
                  "path": "mint_address"
                }
              ]
            }
          },
          {
            "name": "mint_address",
            "docs": [
              "the mint address of the RWA token"
            ]
          },
          {
            "name": "admin",
            "docs": [
              "the multi liquid admin"
            ],
            "writable": true,
            "signer": true,
            "relations": [
              "global_config"
            ]
          }
        ],
        "args": [
          {
            "name": "paused",
            "type": "bool"
          }
        ]
      },
      {
        "name": "set_paused_for_lp_stable_config",
        "discriminator": [
          214,
          35,
          14,
          32,
          51,
          46,
          101,
          150
        ],
        "accounts": [
          {
            "name": "global_config",
            "docs": [
              "global config account, used to check if the program is paused"
            ],
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    103,
                    108,
                    111,
                    98,
                    97,
                    108,
                    95,
                    99,
                    111,
                    110,
                    102,
                    105,
                    103
                  ]
                }
              ]
            }
          },
          {
            "name": "lp_stable_config",
            "docs": [
              "LP stable config account, used to update the paused state"
            ],
            "writable": true,
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    108,
                    112,
                    95,
                    115,
                    116,
                    97,
                    98,
                    108,
                    101,
                    95,
                    99,
                    111,
                    110,
                    102,
                    105,
                    103
                  ]
                },
                {
                  "kind": "account",
                  "path": "mint_address"
                },
                {
                  "kind": "account",
                  "path": "liquidity_provider"
                }
              ]
            }
          },
          {
            "name": "mint_address",
            "docs": [
              "the mint address of the stable coin"
            ]
          },
          {
            "name": "liquidity_provider",
            "docs": [
              "the liquidity provider"
            ]
          },
          {
            "name": "signer",
            "docs": [
              "the signer, could be either multiliquid admin, or the liquidity provider"
            ],
            "signer": true
          }
        ],
        "args": [
          {
            "name": "paused",
            "type": "bool"
          }
        ]
      },
      {
        "name": "swap",
        "discriminator": [
          248,
          198,
          158,
          145,
          225,
          117,
          135,
          200
        ],
        "accounts": [
          {
            "name": "user",
            "docs": [
              "the trader"
            ],
            "signer": true
          },
          {
            "name": "pair",
            "docs": [
              "the pair account"
            ],
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    112,
                    97,
                    105,
                    114
                  ]
                },
                {
                  "kind": "account",
                  "path": "liquidity_provider"
                },
                {
                  "kind": "account",
                  "path": "stable_coin_mint_address"
                },
                {
                  "kind": "account",
                  "path": "asset_token_mint_address"
                }
              ]
            }
          },
          {
            "name": "program_authority",
            "docs": [
              "the program authority, used to sign the CPI transfers"
            ],
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    112,
                    114,
                    111,
                    103,
                    114,
                    97,
                    109,
                    95,
                    97,
                    117,
                    116,
                    104,
                    111,
                    114,
                    105,
                    116,
                    121
                  ]
                }
              ]
            }
          },
          {
            "name": "liquidity_provider",
            "docs": [
              "liquidity provider, must be the liquidity provider of the pair"
            ]
          },
          {
            "name": "lp_vault_authority",
            "docs": [
              "the LP-specific vault authority, used to sign LP vault transfers"
            ],
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    118,
                    97,
                    117,
                    108,
                    116,
                    95,
                    97,
                    117,
                    116,
                    104,
                    111,
                    114,
                    105,
                    116,
                    121
                  ]
                },
                {
                  "kind": "account",
                  "path": "liquidity_provider"
                }
              ]
            }
          },
          {
            "name": "stable_coin_mint_address",
            "docs": [
              "the mint address of the stable coin"
            ]
          },
          {
            "name": "asset_token_mint_address",
            "docs": [
              "the mint address of the asset token"
            ]
          },
          {
            "name": "asset_token_user_token_account",
            "docs": [
              "the token account of the asset token, owned by the trader"
            ],
            "writable": true
          },
          {
            "name": "stable_coin_user_token_account",
            "docs": [
              "the token account of the stable coin, owned by the trader"
            ],
            "writable": true
          },
          {
            "name": "stable_coin_vault_token_account",
            "docs": [
              "the vault token account for the stable coin"
            ],
            "writable": true,
            "pda": {
              "seeds": [
                {
                  "kind": "account",
                  "path": "lp_vault_authority"
                },
                {
                  "kind": "account",
                  "path": "token_program_stable"
                },
                {
                  "kind": "account",
                  "path": "stable_coin_mint_address"
                }
              ],
              "program": {
                "kind": "const",
                "value": [
                  140,
                  151,
                  37,
                  143,
                  78,
                  36,
                  137,
                  241,
                  187,
                  61,
                  16,
                  41,
                  20,
                  142,
                  13,
                  131,
                  11,
                  90,
                  19,
                  153,
                  218,
                  255,
                  16,
                  132,
                  4,
                  142,
                  123,
                  216,
                  219,
                  233,
                  248,
                  89
                ]
              }
            }
          },
          {
            "name": "asset_token_vault_token_account",
            "docs": [
              "the vault token account for the asset token"
            ],
            "writable": true,
            "pda": {
              "seeds": [
                {
                  "kind": "account",
                  "path": "lp_vault_authority"
                },
                {
                  "kind": "account",
                  "path": "token_program_asset"
                },
                {
                  "kind": "account",
                  "path": "asset_token_mint_address"
                }
              ],
              "program": {
                "kind": "const",
                "value": [
                  140,
                  151,
                  37,
                  143,
                  78,
                  36,
                  137,
                  241,
                  187,
                  61,
                  16,
                  41,
                  20,
                  142,
                  13,
                  131,
                  11,
                  90,
                  19,
                  153,
                  218,
                  255,
                  16,
                  132,
                  4,
                  142,
                  123,
                  216,
                  219,
                  233,
                  248,
                  89
                ]
              }
            }
          },
          {
            "name": "global_config",
            "docs": [
              "the global config, used to check if the program is paused"
            ],
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    103,
                    108,
                    111,
                    98,
                    97,
                    108,
                    95,
                    99,
                    111,
                    110,
                    102,
                    105,
                    103
                  ]
                }
              ]
            }
          },
          {
            "name": "fee_token_account",
            "docs": [
              "the fee vault token account for the stable coin"
            ],
            "writable": true,
            "pda": {
              "seeds": [
                {
                  "kind": "account",
                  "path": "program_authority"
                },
                {
                  "kind": "account",
                  "path": "token_program_stable"
                },
                {
                  "kind": "account",
                  "path": "stable_coin_mint_address"
                }
              ],
              "program": {
                "kind": "const",
                "value": [
                  140,
                  151,
                  37,
                  143,
                  78,
                  36,
                  137,
                  241,
                  187,
                  61,
                  16,
                  41,
                  20,
                  142,
                  13,
                  131,
                  11,
                  90,
                  19,
                  153,
                  218,
                  255,
                  16,
                  132,
                  4,
                  142,
                  123,
                  216,
                  219,
                  233,
                  248,
                  89
                ]
              }
            }
          },
          {
            "name": "rwa_config",
            "docs": [
              "the RWA config account for the asset token"
            ],
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    97,
                    115,
                    115,
                    101,
                    116
                  ]
                },
                {
                  "kind": "account",
                  "path": "asset_token_mint_address"
                }
              ]
            }
          },
          {
            "name": "stable_config",
            "docs": [
              "the stable config account for the stable coin"
            ],
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    97,
                    115,
                    115,
                    101,
                    116
                  ]
                },
                {
                  "kind": "account",
                  "path": "stable_coin_mint_address"
                }
              ]
            }
          },
          {
            "name": "lp_stable_config",
            "docs": [
              "the LP stable config account for the stable coin"
            ],
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    108,
                    112,
                    95,
                    115,
                    116,
                    97,
                    98,
                    108,
                    101,
                    95,
                    99,
                    111,
                    110,
                    102,
                    105,
                    103
                  ]
                },
                {
                  "kind": "account",
                  "path": "stable_coin_mint_address"
                },
                {
                  "kind": "account",
                  "path": "liquidity_provider"
                }
              ]
            }
          },
          {
            "name": "token_program_stable",
            "docs": [
              "the token program for the stable coin, could be either the token2022 or the legacy token program"
            ]
          },
          {
            "name": "token_program_asset",
            "docs": [
              "the token program for the asset token, could be either the token2022 or the legacy token program"
            ]
          }
        ],
        "args": [
          {
            "name": "amount",
            "type": "u64"
          },
          {
            "name": "min_amount_out",
            "type": {
              "option": "u64"
            }
          },
          {
            "name": "max_amount_in",
            "type": {
              "option": "u64"
            }
          },
          {
            "name": "swap_direction",
            "type": {
              "defined": {
                "name": "SwapDirection"
              }
            }
          },
          {
            "name": "swap_type",
            "type": {
              "defined": {
                "name": "SwapType"
              }
            }
          }
        ]
      },
      {
        "name": "update_asset_config_account",
        "discriminator": [
          217,
          201,
          225,
          177,
          234,
          99,
          234,
          162
        ],
        "accounts": [
          {
            "name": "asset_config",
            "docs": [
              "the RWA config account, will be updated"
            ],
            "writable": true,
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    97,
                    115,
                    115,
                    101,
                    116
                  ]
                },
                {
                  "kind": "account",
                  "path": "mint_address"
                }
              ]
            }
          },
          {
            "name": "mint_address",
            "docs": [
              "the mint address of the RWA token (used in seeds)"
            ]
          },
          {
            "name": "admin",
            "docs": [
              "the multi liquid admin"
            ],
            "signer": true,
            "relations": [
              "global_config"
            ]
          },
          {
            "name": "global_config",
            "docs": [
              "the global config account, used to check the admin"
            ],
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    103,
                    108,
                    111,
                    98,
                    97,
                    108,
                    95,
                    99,
                    111,
                    110,
                    102,
                    105,
                    103
                  ]
                }
              ]
            }
          }
        ],
        "args": [
          {
            "name": "nav_data",
            "type": {
              "vec": {
                "defined": {
                  "name": "NavData"
                }
              }
            }
          },
          {
            "name": "price_difference_bps",
            "type": "u16"
          },
          {
            "name": "asset_type",
            "type": {
              "defined": {
                "name": "AssetType"
              }
            }
          }
        ]
      },
      {
        "name": "update_global_config",
        "discriminator": [
          164,
          84,
          130,
          189,
          111,
          58,
          250,
          200
        ],
        "accounts": [
          {
            "name": "global_config",
            "docs": [
              "the global config account, will be updated"
            ],
            "writable": true,
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    103,
                    108,
                    111,
                    98,
                    97,
                    108,
                    95,
                    99,
                    111,
                    110,
                    102,
                    105,
                    103
                  ]
                }
              ]
            }
          },
          {
            "name": "admin",
            "docs": [
              "the multi liquid admin"
            ],
            "signer": true,
            "relations": [
              "global_config"
            ]
          }
        ],
        "args": [
          {
            "name": "fee_wallet",
            "type": {
              "option": "pubkey"
            }
          },
          {
            "name": "paused",
            "type": {
              "option": "bool"
            }
          },
          {
            "name": "protocol_fees_bps",
            "type": {
              "option": "u16"
            }
          }
        ]
      },
      {
        "name": "update_pair",
        "discriminator": [
          176,
          62,
          36,
          215,
          255,
          206,
          35,
          12
        ],
        "accounts": [
          {
            "name": "liquidity_provider",
            "docs": [
              "the liquidity provider, must be the liquidity provider of the pair"
            ],
            "signer": true,
            "relations": [
              "pair"
            ]
          },
          {
            "name": "pair",
            "docs": [
              "the pair account, will be updated"
            ],
            "writable": true,
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    112,
                    97,
                    105,
                    114
                  ]
                },
                {
                  "kind": "account",
                  "path": "liquidity_provider"
                },
                {
                  "kind": "account",
                  "path": "stable_coin_mint_address"
                },
                {
                  "kind": "account",
                  "path": "asset_token_mint_address"
                }
              ]
            }
          },
          {
            "name": "stable_coin_mint_address",
            "docs": [
              "the mint address of the stable coin (used in seeds)"
            ]
          },
          {
            "name": "asset_token_mint_address",
            "docs": [
              "the mint address of the asset token (used in seeds)"
            ]
          },
          {
            "name": "global_config",
            "docs": [
              "the global config account, used to check if the program is paused"
            ],
            "pda": {
              "seeds": [
                {
                  "kind": "const",
                  "value": [
                    103,
                    108,
                    111,
                    98,
                    97,
                    108,
                    95,
                    99,
                    111,
                    110,
                    102,
                    105,
                    103
                  ]
                }
              ]
            }
          }
        ],
        "args": [
          {
            "name": "redemption_fee_bps",
            "type": "u16"
          },
          {
            "name": "discount_rate_bps",
            "type": "u16"
          },
          {
            "name": "paused",
            "type": "bool"
          }
        ]
      }
    ],
    "accounts": [
      {
        "name": "AssetConfig",
        "discriminator": [
          57,
          112,
          247,
          166,
          247,
          64,
          140,
          23
        ]
      },
      {
        "name": "GlobalConfig",
        "discriminator": [
          149,
          8,
          156,
          202,
          160,
          252,
          176,
          217
        ]
      },
      {
        "name": "LpStableConfig",
        "discriminator": [
          178,
          48,
          23,
          140,
          152,
          86,
          22,
          226
        ]
      },
      {
        "name": "Pair",
        "discriminator": [
          85,
          72,
          49,
          176,
          182,
          228,
          141,
          82
        ]
      },
      {
        "name": "UserVaultInfo",
        "discriminator": [
          100,
          30,
          4,
          32,
          178,
          226,
          105,
          0
        ]
      }
    ],
    "events": [
      {
        "name": "SwapExecuted",
        "discriminator": [
          150,
          166,
          26,
          225,
          28,
          89,
          38,
          79
        ]
      }
    ],
    "errors": [
      {
        "code": 6000,
        "name": "InvalidNav",
        "msg": "Invalid NAV"
      },
      {
        "code": 6001,
        "name": "ConfidenceTooLow",
        "msg": "Confidence too low"
      },
      {
        "code": 6002,
        "name": "OutOfRange",
        "msg": "Out of range"
      },
      {
        "code": 6003,
        "name": "MustProvideAtLeastOneNavData",
        "msg": "Must provide at least one NAV data"
      },
      {
        "code": 6004,
        "name": "MustProvideHardcodedPrice",
        "msg": "Must provide hardcoded price"
      },
      {
        "code": 6005,
        "name": "ProgramPaused",
        "msg": "Program paused"
      },
      {
        "code": 6006,
        "name": "AmountMustBePositive",
        "msg": "Amount must be positive"
      },
      {
        "code": 6007,
        "name": "InsufficientLiquidity",
        "msg": "Insufficient liquidity"
      },
      {
        "code": 6008,
        "name": "PairPaused",
        "msg": "Pair paused"
      },
      {
        "code": 6009,
        "name": "RwaPaused",
        "msg": "RWA paused"
      },
      {
        "code": 6010,
        "name": "StablePaused",
        "msg": "Stable paused"
      },
      {
        "code": 6011,
        "name": "Max5NavData",
        "msg": "Max 5 NAV data"
      },
      {
        "code": 6012,
        "name": "ProtocolFeesMustBePositive",
        "msg": "Protocol fees must be positive"
      },
      {
        "code": 6013,
        "name": "DiscountMustBePositive",
        "msg": "Discount must be positive"
      },
      {
        "code": 6014,
        "name": "AmountInMustBePositive",
        "msg": "Amount in must be positive"
      },
      {
        "code": 6015,
        "name": "AmountOutMustBePositive",
        "msg": "Amount out must be positive"
      },
      {
        "code": 6016,
        "name": "PriceDecimalsTooLarge",
        "msg": "Price decimals too large"
      },
      {
        "code": 6017,
        "name": "Unauthorized",
        "msg": "Unauthorized"
      },
      {
        "code": 6018,
        "name": "MathOverflow",
        "msg": "Math Overflow"
      },
      {
        "code": 6019,
        "name": "MathUnderflow",
        "msg": "Math Underflow"
      },
      {
        "code": 6020,
        "name": "InvalidAssetType",
        "msg": "Invalid asset type"
      },
      {
        "code": 6021,
        "name": "NavMustBePositive",
        "msg": "Nav must be positive"
      },
      {
        "code": 6022,
        "name": "FeesOutOfRange",
        "msg": "Fees out of range"
      },
      {
        "code": 6023,
        "name": "AssetConfigInUse",
        "msg": "Asset config in use"
      },
      {
        "code": 6024,
        "name": "InvalidNewAdmin",
        "msg": "Invalid new admin"
      },
      {
        "code": 6025,
        "name": "InvalidAccountPublicKey",
        "msg": "Invalid account public key"
      },
      {
        "code": 6026,
        "name": "AmountInTooHigh",
        "msg": "Amount in too high"
      },
      {
        "code": 6027,
        "name": "AmountOutTooLow",
        "msg": "Amount out too low"
      },
      {
        "code": 6028,
        "name": "InvalidFeedId",
        "msg": "Invalid pyth feed id"
      },
      {
        "code": 6029,
        "name": "InvalidMaxAge",
        "msg": "Pyth max age must be > 0"
      },
      {
        "code": 6030,
        "name": "MaxAgeTooLarge",
        "msg": "Pyth max age too high"
      },
      {
        "code": 6031,
        "name": "ConfBpsTooLarge",
        "msg": "Pyth max conf too high"
      },
      {
        "code": 6032,
        "name": "MissingPythAccount",
        "msg": "Pyth feed missing from remaining accounts"
      },
      {
        "code": 6033,
        "name": "FeedIdMismatch",
        "msg": "Pyth feed mismatch"
      }
    ],
    "types": [
      {
        "name": "AssetConfig",
        "docs": [
          "State that tracks configurations related to a specific asset (RWA or stable).",
          "PDA seeds [b\"asset\", asset_mint_address]"
        ],
        "type": {
          "kind": "struct",
          "fields": [
            {
              "name": "mint_address",
              "docs": [
                "asset mint address"
              ],
              "type": "pubkey"
            },
            {
              "name": "nav_data",
              "docs": [
                "NAV data"
              ],
              "type": {
                "vec": {
                  "defined": {
                    "name": "NavData"
                  }
                }
              }
            },
            {
              "name": "price_difference_bps",
              "docs": [
                "the max and min prices fetched with the vec above should not have",
                "a bigger difference than this BPS"
              ],
              "type": "u16"
            },
            {
              "name": "paused",
              "docs": [
                "whether this asset is paused at a program level"
              ],
              "type": "bool"
            },
            {
              "name": "version",
              "docs": [
                "version of the NavData struct"
              ],
              "type": "u8"
            },
            {
              "name": "asset_type",
              "docs": [
                "type of the asset"
              ],
              "type": {
                "defined": {
                  "name": "AssetType"
                }
              }
            },
            {
              "name": "used_in_pairs_count",
              "docs": [
                "how many times this asset is set in a pair"
              ],
              "type": "u16"
            },
            {
              "name": "bump",
              "docs": [
                "bump"
              ],
              "type": "u8"
            },
            {
              "name": "padding",
              "docs": [
                "padding in case we need to add more fields in the future (128 bytes for each NavData)"
              ],
              "type": {
                "vec": {
                  "array": [
                    "u8",
                    128
                  ]
                }
              }
            }
          ]
        }
      },
      {
        "name": "AssetType",
        "type": {
          "kind": "enum",
          "variants": [
            {
              "name": "Rwa"
            },
            {
              "name": "Stable"
            }
          ]
        }
      },
      {
        "name": "GlobalConfig",
        "docs": [
          "Multiliquid swap program global configration",
          "PDA seeds [b\"global_config\"]"
        ],
        "type": {
          "kind": "struct",
          "fields": [
            {
              "name": "admin",
              "docs": [
                "MultiLiquid admin"
              ],
              "type": "pubkey"
            },
            {
              "name": "fee_wallet",
              "docs": [
                "Wallet address that has the ability to withdraw the fees"
              ],
              "type": "pubkey"
            },
            {
              "name": "protocol_fees_bps",
              "docs": [
                "Protocol fee in basis points (0-10000)"
              ],
              "type": "u16"
            },
            {
              "name": "paused",
              "docs": [
                "whether the whole app is paused"
              ],
              "type": "bool"
            },
            {
              "name": "pending_new_admin",
              "docs": [
                "the new admin that is pending to be set"
              ],
              "type": {
                "option": "pubkey"
              }
            },
            {
              "name": "bump",
              "docs": [
                "bump"
              ],
              "type": "u8"
            },
            {
              "name": "padding",
              "docs": [
                "add some padding"
              ],
              "type": {
                "array": [
                  "u8",
                  128
                ]
              }
            }
          ]
        }
      },
      {
        "name": "LpStableConfig",
        "docs": [
          "State that tracks configurations related to a specific LP Stable.",
          "PDA seeds [b\"lp_stable_config\", stable_coin, liquidity_provider]"
        ],
        "type": {
          "kind": "struct",
          "fields": [
            {
              "name": "stable_coin_mint_address",
              "docs": [
                "mint address of the stable coin"
              ],
              "type": "pubkey"
            },
            {
              "name": "paused",
              "docs": [
                "whether this LP Stable is paused (for all pairs)"
              ],
              "type": "bool"
            },
            {
              "name": "liquidity_provider",
              "docs": [
                "liquidity provider address"
              ],
              "type": "pubkey"
            },
            {
              "name": "bump",
              "docs": [
                "bump"
              ],
              "type": "u8"
            },
            {
              "name": "padding",
              "docs": [
                "add some padding"
              ],
              "type": {
                "array": [
                  "u8",
                  128
                ]
              }
            }
          ]
        }
      },
      {
        "name": "NavData",
        "docs": [
          "NavData is used to store info about the methods to retrieve the NAV data for a specific asset",
          "Currently we support 3 methods:",
          "1. U64FixedAddress: read the price from an onchain account with a fixed address",
          "in this case we need the account address and the offset of the price in the account data",
          "2. HARDCODED: read the price from a hardcoded value",
          "3. PYTH_PUSH: read the price from a pyth push account"
        ],
        "type": {
          "kind": "enum",
          "variants": [
            {
              "name": "U64FixedAddress",
              "fields": [
                {
                  "name": "nav_account_address",
                  "docs": [
                    "fixed account address"
                  ],
                  "type": "pubkey"
                },
                {
                  "name": "nav_price_offset",
                  "docs": [
                    "Byte offset of the NAV"
                  ],
                  "type": "u16"
                },
                {
                  "name": "price_decimals",
                  "docs": [
                    "price decimals"
                  ],
                  "type": "u8"
                }
              ]
            },
            {
              "name": "Hardcoded",
              "fields": [
                {
                  "name": "hardcoded_price",
                  "docs": [
                    "hardcoded price"
                  ],
                  "type": "u64"
                },
                {
                  "name": "price_decimals",
                  "docs": [
                    "price decimals"
                  ],
                  "type": "u8"
                }
              ]
            },
            {
              "name": "PythPush",
              "fields": [
                {
                  "name": "pyth_push_account_address",
                  "docs": [
                    "Pyth push account address"
                  ],
                  "type": "pubkey"
                },
                {
                  "name": "feed_id",
                  "docs": [
                    "Pyth feed id"
                  ],
                  "type": {
                    "array": [
                      "u8",
                      32
                    ]
                  }
                },
                {
                  "name": "max_age_secs",
                  "docs": [
                    "Maximum accepted age for the price update"
                  ],
                  "type": "u64"
                },
                {
                  "name": "max_conf_bps",
                  "docs": [
                    "Maximum accepted confidence ratio in basis points"
                  ],
                  "type": "u16"
                }
              ]
            }
          ]
        }
      },
      {
        "name": "Pair",
        "docs": [
          "Account that maintains state for a given stable coin and asset pairing.",
          "PDA seeds [b\"pair\", liquidity_provider, stable_coin_mint_address, asset_token_mint_address]"
        ],
        "type": {
          "kind": "struct",
          "fields": [
            {
              "name": "redemption_fee_bps",
              "docs": [
                "Fee applied when swapping stable to asset"
              ],
              "type": "u16"
            },
            {
              "name": "discount_rate_bps",
              "docs": [
                "Fee applied when swapping asset to stable"
              ],
              "type": "u16"
            },
            {
              "name": "stable_coin_mint_address",
              "docs": [
                "Mint address of the stable coin that prices the asset"
              ],
              "type": "pubkey"
            },
            {
              "name": "asset_token_mint_address",
              "docs": [
                "Mint address of the RWA asset that can be swapped for stable coin"
              ],
              "type": "pubkey"
            },
            {
              "name": "liquidity_provider",
              "docs": [
                "liquidiy ptovider (pair owner)"
              ],
              "type": "pubkey"
            },
            {
              "name": "paused",
              "docs": [
                "if this pair is paused"
              ],
              "type": "bool"
            },
            {
              "name": "bump",
              "docs": [
                "bump"
              ],
              "type": "u8"
            },
            {
              "name": "padding",
              "docs": [
                "add some padding"
              ],
              "type": {
                "array": [
                  "u8",
                  128
                ]
              }
            }
          ]
        }
      },
      {
        "name": "SwapDirection",
        "type": {
          "kind": "enum",
          "variants": [
            {
              "name": "StableToAsset"
            },
            {
              "name": "AssetToStable"
            }
          ]
        }
      },
      {
        "name": "SwapExecuted",
        "type": {
          "kind": "struct",
          "fields": [
            {
              "name": "requestor",
              "docs": [
                "the trader"
              ],
              "type": "pubkey"
            },
            {
              "name": "amount_in",
              "docs": [
                "the amount in"
              ],
              "type": "u64"
            },
            {
              "name": "protocol_fee_amount",
              "docs": [
                "the protocol fee amount"
              ],
              "type": "u64"
            },
            {
              "name": "discount_bps",
              "docs": [
                "the discount bps"
              ],
              "type": "u16"
            },
            {
              "name": "amount_out",
              "docs": [
                "the amount out"
              ],
              "type": "u64"
            },
            {
              "name": "pair",
              "docs": [
                "the pair pubkey"
              ],
              "type": "pubkey"
            },
            {
              "name": "swap_direction",
              "type": {
                "defined": {
                  "name": "SwapDirection"
                }
              }
            },
            {
              "name": "swap_type",
              "type": {
                "defined": {
                  "name": "SwapType"
                }
              }
            }
          ]
        }
      },
      {
        "name": "SwapType",
        "type": {
          "kind": "enum",
          "variants": [
            {
              "name": "ExactIn"
            },
            {
              "name": "ExactOut"
            }
          ]
        }
      },
      {
        "name": "UserVaultInfo",
        "docs": [
          "Vaults are shared between multiple pairs",
          "We use this state to track how many pairs include a specific vault",
          "PDA seeds [b\"user_vault_info\", asset_mint_address, liquidity_provider]"
        ],
        "type": {
          "kind": "struct",
          "fields": [
            {
              "name": "user",
              "docs": [
                "LP wallet address"
              ],
              "type": "pubkey"
            },
            {
              "name": "mint_address",
              "docs": [
                "Mint address of the vault's token"
              ],
              "type": "pubkey"
            },
            {
              "name": "used",
              "docs": [
                "Counter for how many pairs include this vault (for the same LP)"
              ],
              "type": "u16"
            },
            {
              "name": "bump",
              "docs": [
                "bump"
              ],
              "type": "u8"
            },
            {
              "name": "padding",
              "docs": [
                "add some padding"
              ],
              "type": {
                "array": [
                  "u8",
                  128
                ]
              }
            }
          ]
        }
      }
    ],
    "constants": [
      {
        "name": "GLOBAL_CONFIG_PREFIX",
        "type": "bytes",
        "value": "[103, 108, 111, 98, 97, 108, 95, 99, 111, 110, 102, 105, 103]"
      }
    ]
  }
  ```
</Accordion>

## Usage

### Fetch from On-Chain

The IDL is published on-chain and can be fetched directly:

```bash theme={null}
anchor idl fetch HaWDr94LKJQT2fXuHJGsSGeQf6M7S68FXpEQLcE5RYs6 --provider.cluster mainnet
```

### Load from File

```typescript theme={null}
import { Program, AnchorProvider } from "@coral-xyz/anchor";
import idl from "./swap_program.json";

const provider = AnchorProvider.env();
const program = new Program(idl as any, provider);
```

### Fetch Programmatically

```typescript theme={null}
import { Program, AnchorProvider } from "@coral-xyz/anchor";

const provider = new AnchorProvider(connection, wallet, {});
const idl = await Program.fetchIdl(
  "HaWDr94LKJQT2fXuHJGsSGeQf6M7S68FXpEQLcE5RYs6",
  provider
);
const program = new Program(idl, provider);
```

## Deriving PDAs

All program accounts are Program-Derived Addresses. Use the program ID and the appropriate seeds to derive any account address:

```typescript theme={null}
import { PublicKey } from "@solana/web3.js";
import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID } from "@solana/spl-token";

const PROGRAM_ID = new PublicKey("HaWDr94LKJQT2fXuHJGsSGeQf6M7S68FXpEQLcE5RYs6");

function deriveGlobalConfig(): PublicKey {
  return PublicKey.findProgramAddressSync(
    [Buffer.from("global_config")],
    PROGRAM_ID
  )[0];
}

function deriveAssetConfig(mint: PublicKey): PublicKey {
  return PublicKey.findProgramAddressSync(
    [Buffer.from("asset"), mint.toBuffer()],
    PROGRAM_ID
  )[0];
}

function derivePair(
  lp: PublicKey,
  stableMint: PublicKey,
  assetMint: PublicKey
): PublicKey {
  return PublicKey.findProgramAddressSync(
    [Buffer.from("pair"), lp.toBuffer(), stableMint.toBuffer(), assetMint.toBuffer()],
    PROGRAM_ID
  )[0];
}

function deriveAssociatedTokenAccount(
  mint: PublicKey,
  owner: PublicKey,
  tokenProgram = TOKEN_PROGRAM_ID
): PublicKey {
  return PublicKey.findProgramAddressSync(
    [owner.toBuffer(), tokenProgram.toBuffer(), mint.toBuffer()],
    ASSOCIATED_TOKEN_PROGRAM_ID
  )[0];
}

function deriveVaultAuthority(lp: PublicKey): PublicKey {
  return PublicKey.findProgramAddressSync(
    [Buffer.from("vault_authority"), lp.toBuffer()],
    PROGRAM_ID
  )[0];
}

function deriveVault(mint: PublicKey, lp: PublicKey): PublicKey {
  return deriveAssociatedTokenAccount(mint, deriveVaultAuthority(lp));
}

function deriveFeeVault(mint: PublicKey): PublicKey {
  return deriveAssociatedTokenAccount(mint, deriveProgramAuthority());
}

function deriveLpStableConfig(
  stableMint: PublicKey,
  lp: PublicKey
): PublicKey {
  return PublicKey.findProgramAddressSync(
    [Buffer.from("lp_stable_config"), stableMint.toBuffer(), lp.toBuffer()],
    PROGRAM_ID
  )[0];
}

function deriveProgramAuthority(): PublicKey {
  return PublicKey.findProgramAddressSync(
    [Buffer.from("program_authority")],
    PROGRAM_ID
  )[0];
}
```

<Note>
  For program and account addresses, see the [Deployments](/svm/deployments) page.
</Note>
