fix compile errors

This commit is contained in:
thesn10
2026-06-14 18:24:26 +02:00
parent cfc75a05b3
commit 955430f1c9
7 changed files with 142 additions and 172 deletions

View File

@@ -1,6 +1,6 @@
use anchor_lang::prelude::*;
use crate::state::{ListingAccount, OrderAccount};
use crate::error::SolistingError;
use crate::state::{ListingAccount, OrderAccount};
use anchor_lang::prelude::*;
#[derive(Accounts)]
pub struct AcceptOrder<'info> {
@@ -52,17 +52,15 @@ pub fn handler(ctx: Context<AcceptOrder>) -> Result<()> {
SolistingError::InvalidDescroProgram
);
descro::cpi::seller_confirm(
CpiContext::new(
ctx.accounts.descro_program.to_account_info(),
descro::cpi::accounts::SellerConfirm {
seller: ctx.accounts.seller.to_account_info(),
resolver: ctx.accounts.resolver.to_account_info(),
escrow_account: ctx.accounts.escrow_account.to_account_info(),
resolver_entry: ctx.accounts.resolver_entry.to_account_info(),
},
),
)?;
descro::cpi::seller_confirm(CpiContext::new(
ctx.accounts.descro_program.key(),
descro::cpi::accounts::SellerConfirm {
seller: ctx.accounts.seller.to_account_info(),
resolver: ctx.accounts.resolver.to_account_info(),
escrow_account: ctx.accounts.escrow_account.to_account_info(),
resolver_entry: ctx.accounts.resolver_entry.to_account_info(),
},
))?;
let listing = &mut ctx.accounts.listing_account;
listing.quantity_reserved = listing.quantity_reserved.saturating_sub(1);

View File

@@ -1,7 +1,7 @@
use crate::error::SolistingError;
use crate::state::{ListingAccount, OrderAccount};
use anchor_lang::prelude::*;
use anchor_lang::AccountDeserialize;
use crate::state::{ListingAccount, OrderAccount};
use crate::error::SolistingError;
#[derive(Accounts)]
pub struct CancelOrder<'info> {
@@ -59,23 +59,24 @@ pub fn handler(ctx: Context<CancelOrder>) -> Result<()> {
if let Ok(escrow) = descro::EscrowAccount::try_deserialize(&mut data.as_ref()) {
if escrow.state == descro::EscrowState::AwaitingSellerConfirm {
drop(data);
descro::cpi::cancel(
CpiContext::new(
ctx.accounts.descro_program.to_account_info(),
descro::cpi::accounts::Cancel {
canceller: ctx.accounts.buyer.to_account_info(),
buyer: ctx.accounts.buyer.to_account_info(),
escrow_account: ctx.accounts.escrow_account.to_account_info(),
vault: ctx.accounts.vault.to_account_info(),
system_program: ctx.accounts.system_program.to_account_info(),
},
),
)?;
descro::cpi::cancel(CpiContext::new(
ctx.accounts.descro_program.key(),
descro::cpi::accounts::Cancel {
canceller: ctx.accounts.buyer.to_account_info(),
buyer: ctx.accounts.buyer.to_account_info(),
escrow_account: ctx.accounts.escrow_account.to_account_info(),
vault: ctx.accounts.vault.to_account_info(),
system_program: ctx.accounts.system_program.to_account_info(),
},
))?;
}
}
}
ctx.accounts.listing_account.quantity_reserved =
ctx.accounts.listing_account.quantity_reserved.saturating_sub(1);
ctx.accounts.listing_account.quantity_reserved = ctx
.accounts
.listing_account
.quantity_reserved
.saturating_sub(1);
Ok(())
}

View File

@@ -1,7 +1,7 @@
use anchor_lang::prelude::*;
use crate::state::{Currency, ListingAccount, OrderAccount};
use crate::error::SolistingError;
use crate::oracle;
use crate::state::{Currency, ListingAccount, OrderAccount};
use anchor_lang::prelude::*;
#[derive(Accounts)]
#[instruction(order_id: u64, escrow_id: u64, resolver: Pubkey, payment_currency: Currency)]
@@ -133,7 +133,7 @@ pub fn handler(
descro::cpi::buyer_create_escrow(
CpiContext::new(
ctx.accounts.descro_program.to_account_info(),
ctx.accounts.descro_program.key(),
descro::cpi::accounts::BuyerCreateEscrow {
buyer: ctx.accounts.buyer.to_account_info(),
seller: ctx.accounts.seller.to_account_info(),

View File

@@ -1,7 +1,7 @@
use crate::error::SolistingError;
use crate::state::{ListingAccount, OrderAccount};
use anchor_lang::prelude::*;
use anchor_lang::AccountDeserialize;
use crate::state::{ListingAccount, OrderAccount};
use crate::error::SolistingError;
#[derive(Accounts)]
pub struct RejectOrder<'info> {
@@ -66,23 +66,24 @@ pub fn handler(ctx: Context<RejectOrder>) -> Result<()> {
if let Ok(escrow) = descro::EscrowAccount::try_deserialize(&mut data.as_ref()) {
if escrow.state == descro::EscrowState::AwaitingSellerConfirm {
drop(data);
descro::cpi::cancel(
CpiContext::new(
ctx.accounts.descro_program.to_account_info(),
descro::cpi::accounts::Cancel {
canceller: ctx.accounts.seller.to_account_info(),
buyer: ctx.accounts.buyer.to_account_info(),
escrow_account: ctx.accounts.escrow_account.to_account_info(),
vault: ctx.accounts.vault.to_account_info(),
system_program: ctx.accounts.system_program.to_account_info(),
},
),
)?;
descro::cpi::cancel(CpiContext::new(
ctx.accounts.descro_program.key(),
descro::cpi::accounts::Cancel {
canceller: ctx.accounts.seller.to_account_info(),
buyer: ctx.accounts.buyer.to_account_info(),
escrow_account: ctx.accounts.escrow_account.to_account_info(),
vault: ctx.accounts.vault.to_account_info(),
system_program: ctx.accounts.system_program.to_account_info(),
},
))?;
}
}
}
ctx.accounts.listing_account.quantity_reserved =
ctx.accounts.listing_account.quantity_reserved.saturating_sub(1);
ctx.accounts.listing_account.quantity_reserved = ctx
.accounts
.listing_account
.quantity_reserved
.saturating_sub(1);
Ok(())
}