Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove farm penalty code #966

Merged
merged 26 commits into from
Dec 2, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove unneeded annotation
dorin-iancu committed Oct 25, 2024
commit ae1b782585bb89b343af933425f88f7539373787
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(deprecated)]

use common_structs::FarmTokenAttributes;
use config::ConfigModule;
use multiversx_sc::{
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(deprecated)]

use common_structs::FarmTokenAttributes;
use farm_with_locked_rewards::Farm;
use multiversx_sc::{codec::Empty, imports::OptionalValue};
5 changes: 3 additions & 2 deletions dex/farm/tests/energy_update_test.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(deprecated)]

mod farm_setup;

use farm_setup::multi_user_farm_setup::*;
@@ -10,6 +8,7 @@ fn test_farm_setup() {
farm::contract_obj,
energy_factory_mock::contract_obj,
energy_update::contract_obj,
timestamp_oracle::contract_obj,
);
}

@@ -19,6 +18,7 @@ fn test_energy_update() {
farm::contract_obj,
energy_factory_mock::contract_obj,
energy_update::contract_obj,
timestamp_oracle::contract_obj,
);

let first_farm_token_amount = 100_000_000;
@@ -39,6 +39,7 @@ fn test_energy_update_no_claim_current_week() {
farm::contract_obj,
energy_factory_mock::contract_obj,
energy_update::contract_obj,
timestamp_oracle::contract_obj,
);

let first_farm_token_amount = 100_000_000;
18 changes: 16 additions & 2 deletions dex/farm/tests/farm_multi_user_test.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(deprecated)]

use common_structs::FarmTokenAttributes;
use multiversx_sc_scenario::{managed_address, managed_biguint, rust_biguint, DebugApi};

@@ -14,10 +12,12 @@ use weekly_rewards_splitting::global_info::WeeklyRewardsGlobalInfo;
#[test]
fn farm_with_no_boost_test() {
DebugApi::dummy();

let mut farm_setup = MultiUserFarmSetup::new(
farm::contract_obj,
energy_factory_mock::contract_obj,
energy_update::contract_obj,
timestamp_oracle::contract_obj,
);

// first user enter farm
@@ -112,10 +112,12 @@ fn farm_with_no_boost_test() {
#[test]
fn farm_with_boosted_yields_test() {
DebugApi::dummy();

let mut farm_setup = MultiUserFarmSetup::new(
farm::contract_obj,
energy_factory_mock::contract_obj,
energy_update::contract_obj,
timestamp_oracle::contract_obj,
);

farm_setup.set_boosted_yields_rewards_percentage(BOOSTED_YIELDS_PERCENTAGE);
@@ -224,10 +226,12 @@ fn farm_with_boosted_yields_test() {
#[test]
fn farm_change_boosted_yields_factors_test() {
DebugApi::dummy();

let mut farm_setup = MultiUserFarmSetup::new(
farm::contract_obj,
energy_factory_mock::contract_obj,
energy_update::contract_obj,
timestamp_oracle::contract_obj,
);

farm_setup.set_boosted_yields_rewards_percentage(BOOSTED_YIELDS_PERCENTAGE);
@@ -287,10 +291,12 @@ fn farm_change_boosted_yields_factors_test() {
#[test]
fn farm_boosted_yields_claim_with_different_user_pos_test() {
DebugApi::dummy();

let mut farm_setup = MultiUserFarmSetup::new(
farm::contract_obj,
energy_factory_mock::contract_obj,
energy_update::contract_obj,
timestamp_oracle::contract_obj,
);

farm_setup.set_boosted_yields_rewards_percentage(BOOSTED_YIELDS_PERCENTAGE);
@@ -393,10 +399,12 @@ fn farm_boosted_yields_claim_with_different_user_pos_test() {
#[test]
fn farm_known_proxy_test() {
DebugApi::dummy();

let mut farm_setup = MultiUserFarmSetup::new(
farm::contract_obj,
energy_factory_mock::contract_obj,
energy_update::contract_obj,
timestamp_oracle::contract_obj,
);

// first user enter farm
@@ -492,10 +500,12 @@ fn farm_known_proxy_test() {
#[test]
fn farm_multiple_claim_weeks_with_collect_undistributed_rewards_test() {
DebugApi::dummy();

let mut farm_setup = MultiUserFarmSetup::new(
farm::contract_obj,
energy_factory_mock::contract_obj,
energy_update::contract_obj,
timestamp_oracle::contract_obj,
);

farm_setup.set_boosted_yields_rewards_percentage(BOOSTED_YIELDS_PERCENTAGE);
@@ -742,10 +752,12 @@ fn farm_multiple_claim_weeks_with_collect_undistributed_rewards_test() {
#[test]
fn farm_enter_with_multiple_farm_token() {
DebugApi::dummy();

let mut farm_setup = MultiUserFarmSetup::new(
farm::contract_obj,
energy_factory_mock::contract_obj,
energy_update::contract_obj,
timestamp_oracle::contract_obj,
);

farm_setup.set_boosted_yields_rewards_percentage(BOOSTED_YIELDS_PERCENTAGE);
@@ -857,10 +869,12 @@ fn farm_enter_with_multiple_farm_token() {
#[test]
fn farm_claim_with_minimum_tokens() {
DebugApi::dummy();

let mut farm_setup = MultiUserFarmSetup::new(
farm::contract_obj,
energy_factory_mock::contract_obj,
energy_update::contract_obj,
timestamp_oracle::contract_obj,
);

farm_setup.set_boosted_yields_rewards_percentage(BOOSTED_YIELDS_PERCENTAGE);
1 change: 0 additions & 1 deletion dex/farm/tests/farm_setup/farm_rewards_distr_setup.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![allow(dead_code)]
#![allow(deprecated)]

use multiversx_sc::codec::multi_types::OptionalValue;
use multiversx_sc::storage::mappers::StorageTokenWrapper;
1 change: 0 additions & 1 deletion dex/farm/tests/farm_setup/multi_user_farm_setup.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![allow(dead_code)]
#![allow(deprecated)]

use common_structs::FarmTokenAttributes;
use config::ConfigModule;
1 change: 0 additions & 1 deletion dex/farm/tests/farm_setup/single_user_farm_setup.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![allow(dead_code)]
#![allow(deprecated)]

use common_structs::FarmTokenAttributes;
use multiversx_sc::codec::multi_types::{MultiValue3, OptionalValue};
2 changes: 0 additions & 2 deletions dex/farm/tests/farm_single_user_test.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(deprecated)]

mod farm_setup;

use config::ConfigModule;
23 changes: 20 additions & 3 deletions dex/farm/tests/total_farm_position_test.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(deprecated)]

mod farm_setup;

use common_structs::FarmTokenAttributes;
@@ -19,10 +17,12 @@ use crate::farm_setup::multi_user_farm_setup::{FARMING_TOKEN_ID, FARM_TOKEN_ID,
#[test]
fn total_farm_position_claim_test() {
DebugApi::dummy();

let mut farm_setup = MultiUserFarmSetup::new(
farm::contract_obj,
energy_factory_mock::contract_obj,
energy_update::contract_obj,
timestamp_oracle::contract_obj,
);

farm_setup.set_boosted_yields_rewards_percentage(BOOSTED_YIELDS_PERCENTAGE);
@@ -124,10 +124,12 @@ fn total_farm_position_claim_test() {
#[test]
fn allow_external_claim_rewards_setting_test() {
DebugApi::dummy();

let mut farm_setup = MultiUserFarmSetup::new(
farm::contract_obj,
energy_factory_mock::contract_obj,
energy_update::contract_obj,
timestamp_oracle::contract_obj,
);

farm_setup.set_boosted_yields_rewards_percentage(BOOSTED_YIELDS_PERCENTAGE);
@@ -190,10 +192,12 @@ fn allow_external_claim_rewards_setting_test() {
#[test]
fn total_farm_position_claim_for_other_test() {
DebugApi::dummy();

let mut farm_setup = MultiUserFarmSetup::new(
farm::contract_obj,
energy_factory_mock::contract_obj,
energy_update::contract_obj,
timestamp_oracle::contract_obj,
);

farm_setup.set_boosted_yields_rewards_percentage(BOOSTED_YIELDS_PERCENTAGE);
@@ -293,10 +297,12 @@ fn total_farm_position_claim_for_other_test() {
#[test]
fn farm_total_position_migration_test() {
DebugApi::dummy();

let mut farm_setup = MultiUserFarmSetup::new(
farm::contract_obj,
energy_factory_mock::contract_obj,
energy_update::contract_obj,
timestamp_oracle::contract_obj,
);

farm_setup.set_boosted_yields_rewards_percentage(BOOSTED_YIELDS_PERCENTAGE);
@@ -410,10 +416,12 @@ fn farm_total_position_migration_test() {
#[test]
fn farm_total_position_exit_migration_test() {
DebugApi::dummy();

let mut farm_setup = MultiUserFarmSetup::new(
farm::contract_obj,
energy_factory_mock::contract_obj,
energy_update::contract_obj,
timestamp_oracle::contract_obj,
);

farm_setup.set_boosted_yields_rewards_percentage(BOOSTED_YIELDS_PERCENTAGE);
@@ -490,10 +498,12 @@ fn farm_total_position_exit_migration_test() {
#[test]
fn farm_total_position_on_claim_migration_test() {
DebugApi::dummy();

let mut farm_setup = MultiUserFarmSetup::new(
farm::contract_obj,
energy_factory_mock::contract_obj,
energy_update::contract_obj,
timestamp_oracle::contract_obj,
);

farm_setup.set_boosted_yields_rewards_percentage(BOOSTED_YIELDS_PERCENTAGE);
@@ -580,10 +590,12 @@ fn farm_total_position_on_claim_migration_test() {
#[test]
fn farm_total_position_on_merge_migration_test() {
DebugApi::dummy();

let mut farm_setup = MultiUserFarmSetup::new(
farm::contract_obj,
energy_factory_mock::contract_obj,
energy_update::contract_obj,
timestamp_oracle::contract_obj,
);

farm_setup.set_boosted_yields_rewards_percentage(BOOSTED_YIELDS_PERCENTAGE);
@@ -673,11 +685,12 @@ fn farm_total_position_on_merge_migration_test() {
#[test]
fn no_boosted_rewards_penalty_for_no_energy_test() {
DebugApi::dummy();
DebugApi::dummy();

let mut farm_setup = MultiUserFarmSetup::new(
farm::contract_obj,
energy_factory_mock::contract_obj,
energy_update::contract_obj,
timestamp_oracle::contract_obj,
);

farm_setup.set_boosted_yields_rewards_percentage(BOOSTED_YIELDS_PERCENTAGE);
@@ -754,10 +767,12 @@ fn no_boosted_rewards_penalty_for_no_energy_test() {
#[test]
fn total_farm_position_owner_change_test() {
DebugApi::dummy();

let mut farm_setup = MultiUserFarmSetup::new(
farm::contract_obj,
energy_factory_mock::contract_obj,
energy_update::contract_obj,
timestamp_oracle::contract_obj,
);

farm_setup.set_boosted_yields_rewards_percentage(BOOSTED_YIELDS_PERCENTAGE);
@@ -978,10 +993,12 @@ fn total_farm_position_through_simple_lock_test() {
const MEX_TOKEN_ID: &[u8] = b"MEX-abcdef"; // reward token ID

DebugApi::dummy();

let mut farm_setup = MultiUserFarmSetup::new(
farm::contract_obj,
energy_factory_mock::contract_obj,
energy_update::contract_obj,
timestamp_oracle::contract_obj,
);
let rust_zero = rust_biguint!(0);

1 change: 0 additions & 1 deletion dex/fuzz/src/fuzz_data.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#[cfg(test)]
pub mod fuzz_data_tests {
#![allow(deprecated)]

multiversx_sc::imports!();
multiversx_sc::derive_imports!();
1 change: 0 additions & 1 deletion dex/fuzz/src/fuzz_farm.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#[cfg(test)]
pub mod fuzz_farm_test {
#![allow(deprecated)]

multiversx_sc::imports!();
multiversx_sc::derive_imports!();
1 change: 0 additions & 1 deletion dex/fuzz/src/fuzz_pair.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#[cfg(test)]
pub mod fuzz_pair_test {
#![allow(deprecated)]

multiversx_sc::imports!();
multiversx_sc::derive_imports!();
1 change: 0 additions & 1 deletion dex/fuzz/src/fuzz_price_discovery.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#[cfg(test)]
pub mod fuzz_price_discovery_test {
#![allow(deprecated)]

multiversx_sc::imports!();
multiversx_sc::derive_imports!();
1 change: 0 additions & 1 deletion dex/fuzz/src/fuzz_start.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#[cfg(test)]
mod test {
#![allow(deprecated)]

multiversx_sc::imports!();
multiversx_sc::derive_imports!();
2 changes: 0 additions & 2 deletions dex/governance/tests/gov_tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(deprecated)]

use multiversx_sc::codec::multi_types::{MultiValue2, OptionalValue};
use multiversx_sc::types::MultiValueEncoded;
use multiversx_sc::types::{Address, EsdtLocalRole, EsdtTokenPayment, ManagedVec};
2 changes: 0 additions & 2 deletions dex/pair/tests/pair_rs_test.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(deprecated)]

mod pair_setup;
use fees_collector::{
config::ConfigModule, fees_accumulation::FeesAccumulationModule, FeesCollector,
2 changes: 0 additions & 2 deletions dex/price-discovery/tests/price_disc_tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(deprecated)]

use multiversx_sc::codec::Empty;
use multiversx_sc_scenario::{managed_biguint, managed_token_id_wrapped};
use multiversx_sc_scenario::{rust_biguint, DebugApi};
2 changes: 0 additions & 2 deletions dex/price-discovery/tests/tests_common.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(deprecated)]

use multiversx_sc::codec::Empty;
use multiversx_sc::types::{Address, EsdtLocalRole};
use multiversx_sc_scenario::whitebox_legacy::TxResult;
Loading