diff --git a/backstop/src/emissions/claim.rs b/backstop/src/emissions/claim.rs index d8f8c665..32186556 100644 --- a/backstop/src/emissions/claim.rs +++ b/backstop/src/emissions/claim.rs @@ -212,7 +212,7 @@ mod tests { assert_eq!(result, 75_3145677 + 6_2904190); assert_eq!( lp_client.balance(&backstop_address), - backstop_lp_balance + 6_5244800 + backstop_lp_balance + 6_4729326 ); assert_eq!( blnd_token_client.balance(&backstop_address), @@ -221,18 +221,18 @@ mod tests { let sam_balance_1 = storage::get_user_balance(&e, &pool_1_id, &samwise); assert_eq!(sam_balance_1.shares, 9_0000000); let frodo_balance_1 = storage::get_user_balance(&e, &pool_1_id, &frodo); - assert_eq!(frodo_balance_1.shares, pre_frodo_balance_1 + 4_5761820); + assert_eq!(frodo_balance_1.shares, pre_frodo_balance_1 + 4_5400274); let sam_balance_2 = storage::get_user_balance(&e, &pool_2_id, &samwise); assert_eq!(sam_balance_2.shares, 7_5000000); let frodo_balance_2 = storage::get_user_balance(&e, &pool_2_id, &frodo); - assert_eq!(frodo_balance_2.shares, pre_frodo_balance_2 + 0_3947102); + assert_eq!(frodo_balance_2.shares, pre_frodo_balance_2 + 0_3915917); let pool_balance_1 = storage::get_pool_balance(&e, &pool_1_id); - assert_eq!(pool_balance_1.tokens, pre_pool_tokens_1 + 6_1015761); - assert_eq!(pool_balance_1.shares, pre_pool_shares_1 + 4_5761820); + assert_eq!(pool_balance_1.tokens, pre_pool_tokens_1 + 6_0533699); + assert_eq!(pool_balance_1.shares, pre_pool_shares_1 + 4_5400274); let pool_balance_2 = storage::get_pool_balance(&e, &pool_2_id); - assert_eq!(pool_balance_2.tokens, pre_pool_tokens_2 + 0_4229038); - assert_eq!(pool_balance_2.shares, pre_pool_shares_2 + 0_3947102); + assert_eq!(pool_balance_2.tokens, pre_pool_tokens_2 + 0_4195626); + assert_eq!(pool_balance_2.shares, pre_pool_shares_2 + 0_3915917); let new_backstop_1_data = storage::get_backstop_emis_data(&e, &pool_1_id).unwrap_optimized(); @@ -371,7 +371,7 @@ mod tests { assert_eq!(result, 75_3145677 + 6_2904190); assert_eq!( lp_client.balance(&backstop_address), - backstop_lp_balance + 6_5244800 + backstop_lp_balance + 6_4729326 ); assert_eq!( blnd_token_client.balance(&backstop_address), @@ -380,18 +380,18 @@ mod tests { let sam_balance_1 = storage::get_user_balance(&e, &pool_1_id, &samwise); assert_eq!(sam_balance_1.shares, 9_0000000); let frodo_balance_1 = storage::get_user_balance(&e, &pool_1_id, &frodo); - assert_eq!(frodo_balance_1.shares, pre_frodo_balance_1 + 4_5761820); + assert_eq!(frodo_balance_1.shares, pre_frodo_balance_1 + 4_5400274); let sam_balance_2 = storage::get_user_balance(&e, &pool_2_id, &samwise); assert_eq!(sam_balance_2.shares, 7_5000000); let frodo_balance_2 = storage::get_user_balance(&e, &pool_2_id, &frodo); - assert_eq!(frodo_balance_2.shares, pre_frodo_balance_2 + 0_3947102); + assert_eq!(frodo_balance_2.shares, pre_frodo_balance_2 + 0_3915917); let pool_balance_1 = storage::get_pool_balance(&e, &pool_1_id); - assert_eq!(pool_balance_1.tokens, pre_pool_tokens_1 + 6_1015761); - assert_eq!(pool_balance_1.shares, pre_pool_shares_1 + 4_5761820); + assert_eq!(pool_balance_1.tokens, pre_pool_tokens_1 + 6_0533699); + assert_eq!(pool_balance_1.shares, pre_pool_shares_1 + 4_5400274); let pool_balance_2 = storage::get_pool_balance(&e, &pool_2_id); - assert_eq!(pool_balance_2.tokens, pre_pool_tokens_2 + 0_4229038); - assert_eq!(pool_balance_2.shares, pre_pool_shares_2 + 0_3947102); + assert_eq!(pool_balance_2.tokens, pre_pool_tokens_2 + 0_4195626); + assert_eq!(pool_balance_2.shares, pre_pool_shares_2 + 0_3915917); let new_backstop_1_data = storage::get_backstop_emis_data(&e, &pool_1_id).unwrap_optimized(); @@ -435,47 +435,47 @@ mod tests { &vec![&e, pool_1_id.clone(), pool_2_id.clone()], &frodo, ); - assert_eq!(result_1, 1005009202); + assert_eq!(result_1, 1005194703); assert_eq!( blnd_token_client.balance(&backstop_address), - 200_0000000 - (75_3145677 + 6_2904190) - (1005009202) + 200_0000000 - (75_3145677 + 6_2904190) - (1005194703) ); assert_eq!( lp_client.balance(&backstop_address), - backstop_lp_balance + 7_9137036 + backstop_lp_balance + 7_7889107 ); let sam_balance_1 = storage::get_user_balance(&e, &pool_1_id, &samwise); assert_eq!(sam_balance_1.shares, 9_0000000); let frodo_balance_1 = storage::get_user_balance(&e, &pool_1_id, &frodo); - assert_eq!(frodo_balance_1.shares, pre_frodo_balance_1 + 4_3004891); + assert_eq!(frodo_balance_1.shares, pre_frodo_balance_1 + 4_2609092); let sam_balance_2 = storage::get_user_balance(&e, &pool_2_id, &samwise); assert_eq!(sam_balance_2.shares, 7_5000000); let frodo_balance_2 = storage::get_user_balance(&e, &pool_2_id, &frodo); - assert_eq!(frodo_balance_2.shares, pre_frodo_balance_2 + 2_0344033); + assert_eq!(frodo_balance_2.shares, pre_frodo_balance_2 + 2_0152958); let pool_balance_1 = storage::get_pool_balance(&e, &pool_1_id); - assert_eq!(pool_balance_1.tokens, pre_pool_tokens_1 + 5_7339856); - assert_eq!(pool_balance_1.shares, pre_pool_shares_1 + 4_3004891); + assert_eq!(pool_balance_1.tokens, pre_pool_tokens_1 + 5_6812124); + assert_eq!(pool_balance_1.shares, pre_pool_shares_1 + 4_2609092); let pool_balance_2 = storage::get_pool_balance(&e, &pool_2_id); - assert_eq!(pool_balance_2.tokens, pre_pool_tokens_2 + 2_1797179); - assert_eq!(pool_balance_2.shares, pre_pool_shares_2 + 2_0344033); + assert_eq!(pool_balance_2.tokens, pre_pool_tokens_2 + 2_1592456); + assert_eq!(pool_balance_2.shares, pre_pool_shares_2 + 2_0152958); let new_backstop_1_data = storage::get_backstop_emis_data(&e, &pool_1_id).unwrap_optimized(); let new_user_1_data = storage::get_user_emis_data(&e, &pool_1_id, &samwise).unwrap_optimized(); assert_eq!(new_backstop_1_data.last_time, block_timestamp_1); - assert_eq!(new_backstop_1_data.index, 164344784); + assert_eq!(new_backstop_1_data.index, 164363961); assert_eq!(new_user_1_data.accrued, 0); - assert_eq!(new_user_1_data.index, 164344784); + assert_eq!(new_user_1_data.index, 164363961); let new_backstop_2_data = storage::get_backstop_emis_data(&e, &pool_2_id).unwrap_optimized(); let new_user_2_data = storage::get_user_emis_data(&e, &pool_2_id, &samwise).unwrap_optimized(); assert_eq!(new_backstop_2_data.last_time, block_timestamp_1); - assert_eq!(new_backstop_2_data.index, 43961378); + assert_eq!(new_backstop_2_data.index, 43963099); assert_eq!(new_user_2_data.accrued, 0); - assert_eq!(new_user_2_data.index, 43961378); + assert_eq!(new_user_2_data.index, 43963099); }); } diff --git a/backstop/src/testutils.rs b/backstop/src/testutils.rs index 8fb8d027..f9ca72a7 100644 --- a/backstop/src/testutils.rs +++ b/backstop/src/testutils.rs @@ -142,21 +142,15 @@ pub(crate) fn create_comet_lp_pool<'a>( let usdc_client = MockTokenClient::new(e, usdc_token); blnd_client.mint(&admin, &1_000_0000000); usdc_client.mint(&admin, &25_0000000); - let exp_ledger = e.ledger().sequence() + 100; - blnd_client.approve(&admin, &contract_address, &2_000_0000000, &exp_ledger); - usdc_client.approve(&admin, &contract_address, &2_000_0000000, &exp_ledger); - client.init(&Address::generate(e), &admin); - client.bundle_bind( + client.init( + admin, &vec![e, blnd_token.clone(), usdc_token.clone()], + &vec![e, 0_8000000, 0_2000000], &vec![e, 1_000_0000000, 25_0000000], - &vec![e, 8_0000000, 2_0000000], + &0_0030000, ); - client.set_swap_fee(&0_0030000, &admin); - client.set_public_swap(&admin, &true); - client.finalize(); - (contract_address, client) } diff --git a/comet.wasm b/comet.wasm old mode 100644 new mode 100755 index 82118f99..e9493fd7 Binary files a/comet.wasm and b/comet.wasm differ diff --git a/pool/src/testutils.rs b/pool/src/testutils.rs index 86d4e63f..057bc181 100644 --- a/pool/src/testutils.rs +++ b/pool/src/testutils.rs @@ -145,21 +145,15 @@ pub(crate) fn create_comet_lp_pool<'a>( let usdc_client = MockTokenClient::new(e, usdc_token); blnd_client.mint(&admin, &1_000_0000000); usdc_client.mint(&admin, &25_0000000); - let exp_ledger = e.ledger().sequence() + 100; - blnd_client.approve(&admin, &contract_address, &2_000_0000000, &exp_ledger); - usdc_client.approve(&admin, &contract_address, &2_000_0000000, &exp_ledger); - client.init(&Address::generate(e), &admin); - client.bundle_bind( + client.init( + admin, &vec![e, blnd_token.clone(), usdc_token.clone()], + &vec![e, 0_8000000, 0_2000000], &vec![e, 1_000_0000000, 25_0000000], - &vec![e, 8_0000000, 2_0000000], + &0_0030000, ); - client.set_swap_fee(&0_0030000, &admin); - client.set_public_swap(&admin, &true); - client.finalize(); - (contract_address, client) } diff --git a/test-suites/src/liquidity_pool.rs b/test-suites/src/liquidity_pool.rs index 0afa5c88..3a0df37e 100644 --- a/test-suites/src/liquidity_pool.rs +++ b/test-suites/src/liquidity_pool.rs @@ -30,19 +30,14 @@ pub(crate) fn create_lp_pool<'a>( let token_2_client = MockTokenClient::new(e, token_2); token_1_client.mint(&admin, &1_000_0000000); token_2_client.mint(&admin, &25_0000000); - token_1_client.approve(&admin, &contract_address, &1_000_0000000, &5356700); - token_2_client.approve(&admin, &contract_address, &1_000_0000000, &5356700); - client.init(&Address::generate(e), &admin); - client.bundle_bind( + client.init( + admin, &vec![e, token_1.clone(), token_2.clone()], + &vec![e, 0_8000000, 0_2000000], &vec![e, 1_000_0000000, 25_0000000], - &vec![e, 8_0000000, 2_0000000], + &0_0030000, ); - client.set_swap_fee(&0_0030000, &admin); - client.set_public_swap(&admin, &true); - client.finalize(); - (contract_address, client) } diff --git a/test-suites/tests/test_wasm_happy_path.rs b/test-suites/tests/test_wasm_happy_path.rs index ad9fc1bc..cfc777ee 100644 --- a/test-suites/tests/test_wasm_happy_path.rs +++ b/test-suites/tests/test_wasm_happy_path.rs @@ -391,7 +391,7 @@ fn test_wasm_happy_path() { &vec![&fixture.env, pool_fixture.pool.address.clone()], &frodo, ); - assert_eq!(claim_amount, 420798_0000000); + assert_eq!(claim_amount, 420797_9966204); backstop_blnd_balance -= claim_amount; assert_eq!( fixture.tokens[TokenIndex::BLND].balance(&fixture.backstop.address), @@ -433,8 +433,8 @@ fn test_wasm_happy_path() { &vec![&fixture.env, pool_fixture.pool.address.clone()], &frodo, ); - assert_eq!(claim_amount, 22014719_9998450); //actual amount is 22014720_0000000 but get's rounded down // 22014719_9998450 - backstop_blnd_balance -= 22014719_9998450; + assert_eq!(claim_amount, 22014719_9894996); //actual amount is 22014720_0000000 but get's rounded down + backstop_blnd_balance -= 22014719_9894996; assert_eq!( fixture.tokens[TokenIndex::BLND].balance(&fixture.backstop.address), backstop_blnd_balance