Skip to content

Commit 9d32297

Browse files
committed
Various bugfixes
1 parent dfcf58c commit 9d32297

File tree

7 files changed

+33
-33
lines changed

7 files changed

+33
-33
lines changed

js/src/ids.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { PublicKey } from "@solana/web3.js";
22

33
// Devnet
44
export const DEX_ID = new PublicKey(
5-
"FCLTih6H1jMuxZSmJ13u5DnpUU7BuT8MV4By2VftggCQ"
5+
"HEHEVQNZMTmjUt3CUKdddqHWa4dtXqA9QUsi7QptCCHj"
66
);
77

88
export const SRM_MINT = new PublicKey(

js/src/openOrders.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,7 @@ export class OpenOrders {
168168
programId
169169
);
170170

171-
const userAccount = await UserAccount.retrieve(
172-
connection,
173-
address,
174-
marketState
175-
);
171+
const userAccount = await UserAccount.retrieve(connection, address);
176172

177173
return new OpenOrders(
178174
address,

js/tests/all.test.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -72,21 +72,21 @@ jest.setTimeout(50_000_000);
7272
// );
7373
// });
7474

75-
test("Simple Trade (baseCurrencyMultiplier != 1)", async () => {
76-
await simpleTrade(
77-
connection,
78-
feePayer,
79-
6,
80-
6,
81-
20_000,
82-
30_000,
83-
1,
84-
6,
85-
2,
86-
new BN(10),
87-
new BN(5)
88-
);
89-
});
75+
// test("Simple Trade (baseCurrencyMultiplier != 1)", async () => {
76+
// await simpleTrade(
77+
// connection,
78+
// feePayer,
79+
// 6,
80+
// 6,
81+
// 20_000,
82+
// 30_000,
83+
// 1,
84+
// 6,
85+
// 2,
86+
// new BN(10),
87+
// new BN(5)
88+
// );
89+
// });
9090

9191
// test("Orderbook (6, 6)", async () => {
9292
// await orderbookTest(connection, feePayer, 6, 6, 100, 1_000, 1, 100, 2);

js/tests/create-market.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export const createMarketTest = async (
2424
6,
2525
6
2626
);
27+
console.log("Created context");
2728

2829
let marketObj = await MarketState.retrieve(connection, marketKey);
2930
const now = new Date().getTime() / 1_000;

js/tests/simple-trade.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export const simpleTrade = async (
4747
*/
4848

4949
const tickSize = new BN(random(0, maxTickSize) * 2 ** 32);
50-
const minBaseOrderSize = new BN(1);
50+
const minBaseOrderSize = baseCurrencyMultiplier || new BN(1);
5151
const { marketKey, base, quote, Alice, Bob } = await createContext(
5252
connection,
5353
feePayer,
@@ -172,9 +172,13 @@ export const simpleTrade = async (
172172

173173
console.log(tx);
174174
const executionPrice = computeFp32Price(market, bobPrice);
175-
const takerFee = computeTakerFee(new BN(bobSize).mul(executionPrice).shrn(32))
176-
.mul(market.quoteCurrencyMultiplier)
177-
.div(market.baseCurrencyMultiplier);
175+
const takerFee = computeTakerFee(
176+
new BN(bobSize)
177+
.mul(executionPrice)
178+
.shrn(32)
179+
.mul(market.quoteCurrencyMultiplier)
180+
.div(market.baseCurrencyMultiplier)
181+
);
178182
const orderPrice = computeFp32Price(market, alicePrice);
179183

180184
/**

js/tests/swap.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,12 @@ export const swapTest = async (
144144

145145
const executionPrice = computeFp32Price(market, swapPrice);
146146
const takerFees = computeTakerFee(
147-
new BN(swapSize).mul(executionPrice).shrn(32)
148-
)
149-
.mul(market.quoteCurrencyMultiplier)
150-
.div(market.baseCurrencyMultiplier);
147+
new BN(swapSize)
148+
.mul(executionPrice)
149+
.shrn(32)
150+
.mul(market.quoteCurrencyMultiplier)
151+
.div(market.baseCurrencyMultiplier)
152+
);
151153

152154
/**
153155
* Check market state

program/src/processor/sweep_fees.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,7 @@ pub(crate) fn process(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramR
151151
accounts.destination_token_account.key,
152152
accounts.market_signer.key,
153153
&[],
154-
market_state
155-
.accumulated_fees
156-
.checked_mul(market_state.quote_currency_multiplier)
157-
.unwrap(),
154+
market_state.accumulated_fees,
158155
)?;
159156

160157
invoke_signed(

0 commit comments

Comments
 (0)