-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
75cb79a
commit 1d71150
Showing
5 changed files
with
166 additions
and
6 deletions.
There are no files selected for viewing
Binary file not shown.
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
pub mod revert; | ||
pub mod success; |
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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
use crate::utils::setup; | ||
use fuels::programs::call_utils::TxDependencyExtension; | ||
use test_harness::utils::common::to_9_decimal; | ||
use test_harness::wallet::get_transaction_inputs_outputs; | ||
|
||
#[tokio::test] | ||
#[ignore] | ||
#[should_panic(expected = "ZeroInputAmount")] | ||
async fn removes_all_liquidity_passing_exact_a_and_b_values() { | ||
let ( | ||
add_liquidity_script_instance, | ||
remove_liquidity_script_instance, | ||
amm, | ||
_token_contract, | ||
_provider, | ||
pool_id, | ||
wallet, | ||
transaction_parameters, | ||
deadline, | ||
) = setup().await; | ||
|
||
let token_0_amount: u64 = to_9_decimal(1); | ||
let token_1_amount: u64 = to_9_decimal(1); | ||
|
||
// adds initial liquidity | ||
let added_liquidity = add_liquidity_script_instance | ||
.main( | ||
pool_id, | ||
token_0_amount, | ||
token_1_amount, | ||
0, | ||
0, | ||
wallet.address().into(), | ||
deadline, | ||
) | ||
.with_contracts(&[&amm.instance]) | ||
.with_inputs(transaction_parameters.inputs) | ||
.with_outputs(transaction_parameters.outputs) | ||
.call() | ||
.await | ||
.unwrap() | ||
.value; | ||
|
||
let transaction_parameters = get_transaction_inputs_outputs( | ||
&wallet, | ||
&vec![added_liquidity.id], | ||
&vec![added_liquidity.amount], | ||
) | ||
.await; | ||
|
||
remove_liquidity_script_instance | ||
.main(pool_id, 0, 0, 0, wallet.address().into(), deadline) | ||
.with_contracts(&[&amm.instance]) | ||
.with_inputs(transaction_parameters.0) | ||
.with_outputs(transaction_parameters.1) | ||
.append_variable_outputs(2) | ||
.call() | ||
.await | ||
.unwrap(); | ||
} |
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