-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove post only slide from the core, plan is for wrapper (#17)
- Loading branch information
Showing
6 changed files
with
31 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,6 @@ export enum OrderType { | |
Limit, | ||
ImmediateOrCancel, | ||
PostOnly, | ||
PostOnlySlide, | ||
Global, | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -701,123 +701,6 @@ async fn post_only_fail_test() -> anyhow::Result<()> { | |
Ok(()) | ||
} | ||
|
||
#[tokio::test] | ||
async fn post_only_slide_test() -> anyhow::Result<()> { | ||
let mut test_fixture: TestFixture = TestFixture::new().await; | ||
test_fixture.claim_seat().await?; | ||
|
||
// Ask for 2@10 | ||
test_fixture.deposit(Token::SOL, 20 * SOL_UNIT_SIZE).await?; | ||
test_fixture | ||
.place_order( | ||
Side::Ask, | ||
2 * SOL_UNIT_SIZE, | ||
10, | ||
0, | ||
NO_EXPIRATION_LAST_VALID_SLOT, | ||
OrderType::Limit, | ||
) | ||
.await?; | ||
|
||
let second_keypair: Keypair = test_fixture.second_keypair.insecure_clone(); | ||
test_fixture.claim_seat_for_keypair(&second_keypair).await?; | ||
test_fixture | ||
.deposit_for_keypair(Token::USDC, 20_000 * USDC_UNIT_SIZE, &second_keypair) | ||
.await?; | ||
|
||
// Post only slide should slide the order down to 10.0 | ||
test_fixture | ||
.place_order_for_keypair( | ||
Side::Bid, | ||
1 * SOL_UNIT_SIZE, | ||
11, | ||
0, | ||
NO_EXPIRATION_LAST_VALID_SLOT, | ||
OrderType::PostOnlySlide, | ||
&second_keypair, | ||
) | ||
.await?; | ||
|
||
// To verify that we have 10.00000, withdraw 10 and then unable to do more | ||
test_fixture | ||
.withdraw_for_keypair(Token::USDC, 10_000 * USDC_UNIT_SIZE, &second_keypair) | ||
.await?; | ||
|
||
assert!(test_fixture | ||
.withdraw_for_keypair(Token::USDC, 1_000 * USDC_UNIT_SIZE, &second_keypair) | ||
.await | ||
.is_err()); | ||
assert!(test_fixture | ||
.withdraw_for_keypair(Token::SOL, 1 * SOL_UNIT_SIZE, &second_keypair) | ||
.await | ||
.is_err()); | ||
Ok(()) | ||
} | ||
|
||
#[tokio::test] | ||
async fn post_only_slide_ask_test() -> anyhow::Result<()> { | ||
let mut test_fixture: TestFixture = TestFixture::new().await; | ||
test_fixture.claim_seat().await?; | ||
|
||
// Bid for 1@10 | ||
test_fixture | ||
.deposit(Token::USDC, 20_000 * USDC_UNIT_SIZE) | ||
.await?; | ||
test_fixture | ||
.place_order( | ||
Side::Bid, | ||
1 * SOL_UNIT_SIZE, | ||
10, | ||
0, | ||
NO_EXPIRATION_LAST_VALID_SLOT, | ||
OrderType::Limit, | ||
) | ||
.await?; | ||
|
||
let second_keypair: Keypair = test_fixture.second_keypair.insecure_clone(); | ||
test_fixture.claim_seat_for_keypair(&second_keypair).await?; | ||
test_fixture | ||
.deposit_for_keypair(Token::SOL, 20 * SOL_UNIT_SIZE, &second_keypair) | ||
.await?; | ||
|
||
// Post only slide should slide the order up to 10.000001 | ||
test_fixture | ||
.place_order_for_keypair( | ||
Side::Ask, | ||
1 * SOL_UNIT_SIZE, | ||
9, | ||
0, | ||
NO_EXPIRATION_LAST_VALID_SLOT, | ||
OrderType::PostOnlySlide, | ||
&second_keypair, | ||
) | ||
.await?; | ||
|
||
// To verify that we have [email protected], bid 1@12 from main keypair and check results. | ||
test_fixture | ||
.place_order( | ||
Side::Bid, | ||
1 * SOL_UNIT_SIZE, | ||
12, | ||
0, | ||
NO_EXPIRATION_LAST_VALID_SLOT, | ||
OrderType::Limit, | ||
) | ||
.await?; | ||
|
||
// Second keypair got 10.00001, so withdraw 10 and not any more. | ||
test_fixture | ||
.withdraw_for_keypair(Token::USDC, 10_000 * USDC_UNIT_SIZE, &second_keypair) | ||
.await?; | ||
|
||
assert!(test_fixture | ||
.withdraw_for_keypair(Token::USDC, 1_000 * USDC_UNIT_SIZE, &second_keypair) | ||
.await | ||
.is_err()); | ||
|
||
Ok(()) | ||
} | ||
|
||
#[tokio::test] | ||
async fn place_order_already_expired_test() -> anyhow::Result<()> { | ||
let mut test_fixture: TestFixture = TestFixture::new().await; | ||
|