mirror of
https://github.com/logos-blockchain/lez-programs.git
synced 2026-08-25 14:11:09 +00:00
fix(idl): align LEZ account metadata
Mark unconditional signer, init, and mutable accounts in guest entrypoints. Regenerate IDL artifacts for token, ATA, stablecoin, TWAP oracle, and AMM.
This commit is contained in:
committed by
r4bbit
parent
e4447617f6
commit
255f87f38f
@@ -1,4 +1,8 @@
|
||||
#![cfg_attr(not(test), no_main)]
|
||||
#![allow(
|
||||
clippy::cloned_ref_to_slice_refs,
|
||||
reason = "SPEL macro emits cloned validation slices for one-account instructions"
|
||||
)]
|
||||
|
||||
use std::num::NonZeroU128;
|
||||
|
||||
@@ -27,6 +31,7 @@ mod amm {
|
||||
#[instruction]
|
||||
pub fn initialize(
|
||||
ctx: ProgramContext,
|
||||
#[account(init)]
|
||||
config: AccountWithMetadata,
|
||||
token_program_id: ProgramId,
|
||||
twap_oracle_program_id: ProgramId,
|
||||
@@ -50,7 +55,9 @@ mod amm {
|
||||
#[instruction]
|
||||
pub fn update_config(
|
||||
ctx: ProgramContext,
|
||||
#[account(mut)]
|
||||
config: AccountWithMetadata,
|
||||
#[account(signer)]
|
||||
authority: AccountWithMetadata,
|
||||
token_program_id: Option<ProgramId>,
|
||||
twap_oracle_program_id: Option<ProgramId>,
|
||||
@@ -83,6 +90,7 @@ mod amm {
|
||||
config: AccountWithMetadata,
|
||||
pool: AccountWithMetadata,
|
||||
current_tick_account: AccountWithMetadata,
|
||||
#[account(init)]
|
||||
price_observations: AccountWithMetadata,
|
||||
clock: AccountWithMetadata,
|
||||
window_duration: u64,
|
||||
@@ -114,6 +122,7 @@ mod amm {
|
||||
ctx: ProgramContext,
|
||||
config: AccountWithMetadata,
|
||||
pool: AccountWithMetadata,
|
||||
#[account(init)]
|
||||
oracle_price_account: AccountWithMetadata,
|
||||
clock: AccountWithMetadata,
|
||||
window_duration: u64,
|
||||
@@ -140,14 +149,23 @@ mod amm {
|
||||
pub fn new_definition(
|
||||
ctx: ProgramContext,
|
||||
config: AccountWithMetadata,
|
||||
#[account(init)]
|
||||
pool: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
vault_a: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
vault_b: AccountWithMetadata,
|
||||
#[account(init)]
|
||||
pool_definition_lp: AccountWithMetadata,
|
||||
#[account(init)]
|
||||
lp_lock_holding: AccountWithMetadata,
|
||||
#[account(mut, signer)]
|
||||
user_holding_a: AccountWithMetadata,
|
||||
#[account(mut, signer)]
|
||||
user_holding_b: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
user_holding_lp: AccountWithMetadata,
|
||||
#[account(init)]
|
||||
current_tick_account: AccountWithMetadata,
|
||||
clock: AccountWithMetadata,
|
||||
token_a_amount: u128,
|
||||
@@ -185,13 +203,21 @@ mod amm {
|
||||
pub fn add_liquidity(
|
||||
ctx: ProgramContext,
|
||||
config: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
pool: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
vault_a: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
vault_b: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
pool_definition_lp: AccountWithMetadata,
|
||||
#[account(mut, signer)]
|
||||
user_holding_a: AccountWithMetadata,
|
||||
#[account(mut, signer)]
|
||||
user_holding_b: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
user_holding_lp: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
current_tick_account: AccountWithMetadata,
|
||||
clock: AccountWithMetadata,
|
||||
min_amount_liquidity: u128,
|
||||
@@ -228,13 +254,21 @@ mod amm {
|
||||
pub fn remove_liquidity(
|
||||
ctx: ProgramContext,
|
||||
config: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
pool: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
vault_a: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
vault_b: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
pool_definition_lp: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
user_holding_a: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
user_holding_b: AccountWithMetadata,
|
||||
#[account(mut, signer)]
|
||||
user_holding_lp: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
current_tick_account: AccountWithMetadata,
|
||||
clock: AccountWithMetadata,
|
||||
remove_liquidity_amount: u128,
|
||||
@@ -272,11 +306,17 @@ mod amm {
|
||||
pub fn swap_exact_input(
|
||||
ctx: ProgramContext,
|
||||
config: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
pool: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
vault_a: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
vault_b: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
user_holding_a: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
user_holding_b: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
current_tick_account: AccountWithMetadata,
|
||||
clock: AccountWithMetadata,
|
||||
swap_amount_in: u128,
|
||||
@@ -311,11 +351,17 @@ mod amm {
|
||||
pub fn swap_exact_output(
|
||||
ctx: ProgramContext,
|
||||
config: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
pool: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
vault_a: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
vault_b: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
user_holding_a: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
user_holding_b: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
current_tick_account: AccountWithMetadata,
|
||||
clock: AccountWithMetadata,
|
||||
exact_amount_out: u128,
|
||||
@@ -346,9 +392,14 @@ mod amm {
|
||||
pub fn sync_reserves(
|
||||
ctx: ProgramContext,
|
||||
config: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
pool: AccountWithMetadata,
|
||||
// vault_a / vault_b are only read to compute balances in
|
||||
// amm_program::sync::sync_reserves (their post-states are unchanged
|
||||
// clones), so they are not writable — no `mut` metadata.
|
||||
vault_a: AccountWithMetadata,
|
||||
vault_b: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
current_tick_account: AccountWithMetadata,
|
||||
clock: AccountWithMetadata,
|
||||
) -> SpelResult {
|
||||
|
||||
@@ -22,8 +22,10 @@ mod ata {
|
||||
#[instruction]
|
||||
pub fn create(
|
||||
ctx: ProgramContext,
|
||||
#[account(mut)]
|
||||
owner: AccountWithMetadata,
|
||||
token_definition: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
ata_account: AccountWithMetadata,
|
||||
token_program_id: ProgramId,
|
||||
) -> SpelResult {
|
||||
@@ -45,8 +47,11 @@ mod ata {
|
||||
#[instruction]
|
||||
pub fn transfer(
|
||||
ctx: ProgramContext,
|
||||
#[account(signer)]
|
||||
owner: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
sender_ata: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
recipient: AccountWithMetadata,
|
||||
token_program_id: ProgramId,
|
||||
amount: u128,
|
||||
@@ -69,8 +74,11 @@ mod ata {
|
||||
#[instruction]
|
||||
pub fn burn(
|
||||
ctx: ProgramContext,
|
||||
#[account(signer)]
|
||||
owner: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
holder_ata: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
token_definition: AccountWithMetadata,
|
||||
token_program_id: ProgramId,
|
||||
amount: u128,
|
||||
|
||||
@@ -20,9 +20,13 @@ mod stablecoin {
|
||||
#[instruction]
|
||||
pub fn open_position(
|
||||
ctx: ProgramContext,
|
||||
#[account(signer)]
|
||||
owner: AccountWithMetadata,
|
||||
#[account(init)]
|
||||
position: AccountWithMetadata,
|
||||
#[account(init)]
|
||||
vault: AccountWithMetadata,
|
||||
#[account(mut, signer)]
|
||||
user_holding: AccountWithMetadata,
|
||||
token_definition: AccountWithMetadata,
|
||||
collateral_amount: u128,
|
||||
@@ -53,9 +57,13 @@ mod stablecoin {
|
||||
#[instruction]
|
||||
pub fn withdraw_collateral(
|
||||
ctx: ProgramContext,
|
||||
#[account(signer)]
|
||||
owner: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
position: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
vault: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
destination: AccountWithMetadata,
|
||||
amount: u128,
|
||||
) -> SpelResult {
|
||||
@@ -83,9 +91,13 @@ mod stablecoin {
|
||||
#[instruction]
|
||||
pub fn repay_debt(
|
||||
ctx: ProgramContext,
|
||||
#[account(signer)]
|
||||
owner: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
position: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
stablecoin_definition: AccountWithMetadata,
|
||||
#[account(mut, signer)]
|
||||
user_stablecoin_holding: AccountWithMetadata,
|
||||
amount: u128,
|
||||
) -> SpelResult {
|
||||
|
||||
@@ -19,7 +19,9 @@ mod token {
|
||||
/// Fresh public recipients must be explicitly authorized in the same transaction.
|
||||
#[instruction]
|
||||
pub fn transfer(
|
||||
#[account(mut, signer)]
|
||||
sender: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
recipient: AccountWithMetadata,
|
||||
amount_to_transfer: u128,
|
||||
) -> SpelResult {
|
||||
@@ -34,7 +36,9 @@ mod token {
|
||||
/// Definition and holding targets must be uninitialized and authorized.
|
||||
#[instruction]
|
||||
pub fn new_fungible_definition(
|
||||
#[account(init, signer)]
|
||||
definition_target_account: AccountWithMetadata,
|
||||
#[account(init, signer)]
|
||||
holding_target_account: AccountWithMetadata,
|
||||
name: String,
|
||||
total_supply: u128,
|
||||
@@ -58,8 +62,11 @@ mod token {
|
||||
)]
|
||||
#[instruction]
|
||||
pub fn new_definition_with_metadata(
|
||||
#[account(init, signer)]
|
||||
definition_target_account: AccountWithMetadata,
|
||||
#[account(init, signer)]
|
||||
holding_target_account: AccountWithMetadata,
|
||||
#[account(init, signer)]
|
||||
metadata_target_account: AccountWithMetadata,
|
||||
new_definition: token_core::NewTokenDefinition,
|
||||
metadata: Box<token_core::NewTokenMetadata>,
|
||||
@@ -82,6 +89,7 @@ mod token {
|
||||
pub fn initialize_account(
|
||||
ctx: ProgramContext,
|
||||
definition_account: AccountWithMetadata,
|
||||
#[account(init, signer)]
|
||||
account_to_initialize: AccountWithMetadata,
|
||||
) -> SpelResult {
|
||||
Ok(spel_framework::SpelOutput::execute(
|
||||
@@ -97,7 +105,9 @@ mod token {
|
||||
/// Burn tokens from the holder's account.
|
||||
#[instruction]
|
||||
pub fn burn(
|
||||
#[account(mut)]
|
||||
definition_account: AccountWithMetadata,
|
||||
#[account(mut, signer)]
|
||||
user_holding_account: AccountWithMetadata,
|
||||
amount_to_burn: u128,
|
||||
) -> SpelResult {
|
||||
@@ -113,7 +123,9 @@ mod token {
|
||||
#[instruction]
|
||||
pub fn mint(
|
||||
ctx: ProgramContext,
|
||||
#[account(mut, signer)]
|
||||
definition_account: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
user_holding_account: AccountWithMetadata,
|
||||
amount_to_mint: u128,
|
||||
) -> SpelResult {
|
||||
@@ -129,7 +141,9 @@ mod token {
|
||||
/// The printed copy target must be uninitialized and authorized.
|
||||
#[instruction]
|
||||
pub fn print_nft(
|
||||
#[account(mut, signer)]
|
||||
master_account: AccountWithMetadata,
|
||||
#[account(init, signer)]
|
||||
printed_account: AccountWithMetadata,
|
||||
) -> SpelResult {
|
||||
Ok(spel_framework::SpelOutput::execute(token_program::print_nft::print_nft(
|
||||
|
||||
@@ -22,7 +22,9 @@ mod twap_oracle {
|
||||
#[instruction]
|
||||
pub fn create_price_observations(
|
||||
ctx: ProgramContext,
|
||||
#[account(init)]
|
||||
price_observations: AccountWithMetadata,
|
||||
#[account(signer)]
|
||||
price_source: AccountWithMetadata,
|
||||
clock: AccountWithMetadata,
|
||||
initial_tick: i32,
|
||||
@@ -56,7 +58,9 @@ mod twap_oracle {
|
||||
#[instruction]
|
||||
pub fn create_oracle_price_account(
|
||||
ctx: ProgramContext,
|
||||
#[account(init)]
|
||||
oracle_price_account: AccountWithMetadata,
|
||||
#[account(signer)]
|
||||
price_source: AccountWithMetadata,
|
||||
clock: AccountWithMetadata,
|
||||
base_asset: AccountId,
|
||||
@@ -89,7 +93,9 @@ mod twap_oracle {
|
||||
#[instruction]
|
||||
pub fn create_current_tick_account(
|
||||
ctx: ProgramContext,
|
||||
#[account(init)]
|
||||
current_tick_account: AccountWithMetadata,
|
||||
#[account(signer)]
|
||||
price_source: AccountWithMetadata,
|
||||
clock: AccountWithMetadata,
|
||||
initial_price: u128,
|
||||
@@ -118,6 +124,7 @@ mod twap_oracle {
|
||||
pub fn publish_price(
|
||||
ctx: ProgramContext,
|
||||
price_observations: AccountWithMetadata,
|
||||
#[account(mut)]
|
||||
oracle_price_account: AccountWithMetadata,
|
||||
current_tick_account: AccountWithMetadata,
|
||||
clock: AccountWithMetadata,
|
||||
@@ -145,6 +152,7 @@ mod twap_oracle {
|
||||
#[instruction]
|
||||
pub fn record_tick(
|
||||
ctx: ProgramContext,
|
||||
#[account(mut)]
|
||||
price_observations: AccountWithMetadata,
|
||||
current_tick_account: AccountWithMetadata,
|
||||
clock: AccountWithMetadata,
|
||||
@@ -173,7 +181,9 @@ mod twap_oracle {
|
||||
#[instruction]
|
||||
pub fn update_current_tick(
|
||||
ctx: ProgramContext,
|
||||
#[account(mut)]
|
||||
current_tick_account: AccountWithMetadata,
|
||||
#[account(signer)]
|
||||
price_source: AccountWithMetadata,
|
||||
clock: AccountWithMetadata,
|
||||
price: u128,
|
||||
|
||||
Reference in New Issue
Block a user