Skip to content

Commit

Permalink
Log test data in proptest
Browse files Browse the repository at this point in the history
  • Loading branch information
lubkoll committed Jul 18, 2024
1 parent ab5e732 commit a1ceef1
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions smart-contracts/contracts/cl-vault/src/test_tube/proptest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,6 @@ mod tests {
.unwrap()
}

// TESTS
proptest! {
// setup the config with amount of cases, usable for setting different values on ci vs local
#![proptest_config(ProptestConfig::with_cases(get_cases()))]
Expand All @@ -463,7 +462,6 @@ mod tests {
percentages in get_percentage_list(),
account_indexes in get_account_index_list()
) {
// Creating test core
let (app, contract_address, _cl_pool_id, admin_account, _deposit_ratio, _deposit_ratio_approx) = init_test_contract(
"./test-tube-build/wasm32-unknown-unknown/release/cl_vault.wasm",
&[
Expand Down Expand Up @@ -498,7 +496,6 @@ mod tests {
let cl = ConcentratedLiquidity::new(&app);
let bank = Bank::new(&app);

// Create a fixed number of accounts using app.init_accounts() function from test-tube, and assign a fixed initial balance for all of them
let accounts = app
.init_accounts(&[
Coin::new(ACCOUNTS_INITIAL_BALANCE, "uosmo"),
Expand All @@ -509,23 +506,26 @@ mod tests {

// Make one arbitrary deposit foreach one of the created accounts using 10.00% of its balance, to avoid complications on withdrawing without any position
for i in 0..ACCOUNTS_NUMBER {
let account = &accounts[account_indexes[i as usize] as usize];
println!("Account {}: {}", i, account.signing_key().public_key().to_string());
deposit(&wasm, &bank, &contract_address, &accounts[i as usize], 10.00, DENOM_BASE, DENOM_QUOTE);
}

// Iterate iterations times
for i in 0..ITERATIONS_NUMBER {
match actions[i] {
let idx = account_indexes[i] as usize;
let account = &accounts[idx];
let percentage = percentages[i];
let action = actions[i];
println!("Action for account {} with percentage {} and action {:?}", idx, percentage, action);
match action {
Action::Deposit => {
deposit(&wasm, &bank, &contract_address, &accounts[account_indexes[i] as usize], percentages[i], DENOM_BASE, DENOM_QUOTE);
deposit(&wasm, &bank, &contract_address, account, percentage, DENOM_BASE, DENOM_QUOTE);
},
Action::Withdraw => {
withdraw(&wasm, &contract_address, &accounts[account_indexes[i] as usize], percentages[i]);
withdraw(&wasm, &contract_address, account, percentage);
},
// Action::Swap => {
// swap(&wasm, &bank, &contract_address, &accounts[account_indexes[i] as usize], percentages[i], cl_pool_id);
// },
Action::UpdateRange => {
update_range(&wasm, &cl, &contract_address, percentages[i], &admin_account);
update_range(&wasm, &cl, &contract_address, percentage, &admin_account);
},
}
}
Expand Down

0 comments on commit a1ceef1

Please sign in to comment.