chore(programs/amm): fix initial LP supply calculations

ift-ts:sc:logos:2026q1-amm-core-improvements:fix-initial-lp-calc
This commit is contained in:
Andrea Franz 2026-02-24 16:24:36 +01:00
parent 6f77c75b9c
commit a62310ce82
2 changed files with 13 additions and 1 deletions

View File

@ -200,4 +200,4 @@ pub fn compute_liquidity_token_pda_seed(pool_id: AccountId) -> PdaSeed {
.try_into()
.expect("Hash output must be exactly 32 bytes long"),
)
}
}

View File

@ -129,6 +129,18 @@ pub fn new_definition(
},
);
// Chain call for liquidity token (TokenLP definition -> User LP Holding)
let instruction = if pool.account == Account::default() {
token_core::Instruction::NewFungibleDefinition {
name: String::from("LP Token"),
total_supply: initial_lp,
}
} else {
token_core::Instruction::Mint {
amount_to_mint: initial_lp,
}
};
let mut pool_lp_auth = pool_definition_lp.clone();
pool_lp_auth.is_authorized = true;