Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
test
  • Loading branch information
solonk8 committed Mar 18, 2024
1 parent 837c594 commit 19c4df7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pub fn handler(ctx: Context<ExtWithdrawSell>, args: WithdrawSellArgs) -> Result<
let pool = &mut ctx.accounts.pool;
let sell_state = &mut ctx.accounts.sell_state;
let asset_mint = &ctx.accounts.asset_mint;

let pool_uuid_key = pool.uuid.key();
let owner_key = owner.key();
let pool_seeds: &[&[&[u8]]] = &[&[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ pub fn handler<'info>(
)
.map_err(|_| MMMErrorCode::NumericOverflow)?;

let lp_fee = get_sol_lp_fee(pool, buyside_sol_escrow_account.lamports(), seller_receives)?;

// withdraw sol from M2 first if shared escrow is enabled
let remaining_account_without_m2 = if pool.using_shared_escrow() {
check_remaining_accounts_for_m2(remaining_accounts, &pool.owner.key())?;
Expand All @@ -179,8 +181,6 @@ pub fn handler<'info>(
remaining_accounts
};

let lp_fee = get_sol_lp_fee(pool, buyside_sol_escrow_account.lamports(), seller_receives)?;

if pool.reinvest_fulfill_buy {
if pool.using_shared_escrow() {
return Err(MMMErrorCode::InvalidAccountState.into());
Expand Down
2 changes: 1 addition & 1 deletion tests/mmm-ext-fulfill.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import {
SIGNATURE_FEE_LAMPORTS,
airdrop,
assertIsBetween,
assertTx,
createPoolWithExampleT22ExtDeposits,
createTestMintAndTokenT22VanillaExt,
getSellStatePDARent,
Expand Down Expand Up @@ -530,6 +529,7 @@ describe('mmm-ext-fulfill', () => {
);
// do not reinvest so sell side asset amount should be 0
assert.equal(poolAccountInfo.sellsideAssetAmount.toNumber(), 0);
assert.equal(poolAccountInfo.lpFeeEarned.toNumber(), 0);
});

it('Buyside only with shared escrow and close the pool', async () => {
Expand Down
3 changes: 1 addition & 2 deletions tests/mmm-ext-withdraw.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ import {
ASSOCIATED_TOKEN_PROGRAM_ID,
TOKEN_2022_PROGRAM_ID,
} from '@solana/spl-token';
import { Keypair, LAMPORTS_PER_SOL, SystemProgram } from '@solana/web3.js';
import { Keypair, SystemProgram } from '@solana/web3.js';
import { assert } from 'chai';
import { Mmm, IDL, MMMProgramID } from '../sdk/src';
import {
airdrop,
createPoolWithExampleT22ExtDeposits,
getTokenAccount2022,
SIGNATURE_FEE_LAMPORTS,
} from './utils';

describe('mmm-ext-withdraw', () => {
Expand Down

0 comments on commit 19c4df7

Please sign in to comment.