diff --git a/legacy-contracts/simple-lock-legacy/src/proxy_lp.rs b/legacy-contracts/simple-lock-legacy/src/proxy_lp.rs index 2d384a1f3..60145ad5e 100644 --- a/legacy-contracts/simple-lock-legacy/src/proxy_lp.rs +++ b/legacy-contracts/simple-lock-legacy/src/proxy_lp.rs @@ -1,8 +1,6 @@ multiversx_sc::imports!(); multiversx_sc::derive_imports!(); -use crate::{error_messages::CANNOT_UNLOCK_YET_ERR_MSG, locked_token::LockedTokenAttributes}; - #[derive(TypeAbi, TopEncode, TopDecode, NestedEncode, NestedDecode, PartialEq, Debug)] pub struct LpProxyTokenAttributes { pub lp_token_id: TokenIdentifier, @@ -55,28 +53,6 @@ pub trait ProxyLpModule: crate::locked_token::LockedTokenModule { let lp_proxy_token_attributes: LpProxyTokenAttributes = lp_proxy_token_mapper.get_token_attributes(token_nonce); - let current_epoch = self.blockchain().get_block_epoch(); - if lp_proxy_token_attributes.first_token_locked_nonce > 0 { - let token_attributes: LockedTokenAttributes = self - .locked_token() - .get_token_attributes(lp_proxy_token_attributes.first_token_locked_nonce); - - require!( - current_epoch >= token_attributes.unlock_epoch, - CANNOT_UNLOCK_YET_ERR_MSG - ); - } - if lp_proxy_token_attributes.second_token_locked_nonce > 0 { - let token_attributes: LockedTokenAttributes = self - .locked_token() - .get_token_attributes(lp_proxy_token_attributes.second_token_locked_nonce); - - require!( - current_epoch >= token_attributes.unlock_epoch, - CANNOT_UNLOCK_YET_ERR_MSG - ); - } - lp_proxy_token_attributes.lp_token_id } diff --git a/legacy-contracts/simple-lock-legacy/tests/rust_test.rs b/legacy-contracts/simple-lock-legacy/tests/rust_test.rs index 31fe17235..568605b0b 100644 --- a/legacy-contracts/simple-lock-legacy/tests/rust_test.rs +++ b/legacy-contracts/simple-lock-legacy/tests/rust_test.rs @@ -106,20 +106,6 @@ fn unlock_token_test() { b_mock.check_esdt_balance(sc_wrapper.address_ref(), FREE_TOKEN_ID, &lock_amount); b_mock.check_esdt_balance(&user_addr, FREE_TOKEN_ID, &rust_zero); - // try unlock too early - b_mock - .execute_esdt_transfer( - &user_addr, - &sc_wrapper, - LOCKED_TOKEN_ID, - lock_token_nonce, - &lock_amount, - |sc| { - sc.unlock_tokens_endpoint(OptionalValue::None); - }, - ) - .assert_user_error("Cannot unlock yet"); - // unlock ok b_mock.set_block_epoch(10); b_mock @@ -264,20 +250,6 @@ fn exit_lp_test() { Some(&locked_lp_token_attributes), ); - // try unlock too early - b_mock - .execute_esdt_transfer( - &user_addr, - &sc_wrapper, - LP_PROXY_TOKEN_ID, - lock_token_nonce, - &lock_amount, - |sc| { - sc.remove_liquidity_locked_token(managed_biguint!(0u64), managed_biguint!(0u64)); - }, - ) - .assert_user_error("Cannot unlock yet"); - // unlock ok b_mock.set_block_epoch(10); b_mock @@ -460,32 +432,6 @@ fn exit_farm_test() { Some(&farm_attributes), ); - // try unlock too early - b_mock - .execute_esdt_transfer( - &user_addr, - &sc_wrapper, - FARM_PROXY_TOKEN_ID, - lock_token_nonce, - &lock_amount, - |sc| { - sc.farm_claim_rewards_locked_token(); - }, - ) - .assert_user_error("Cannot unlock yet"); - b_mock - .execute_esdt_transfer( - &user_addr, - &sc_wrapper, - FARM_PROXY_TOKEN_ID, - lock_token_nonce, - &lock_amount, - |sc| { - sc.exit_farm_locked_token(); - }, - ) - .assert_user_error("Cannot unlock yet"); - // unlock ok let half_lock_amount = rust_biguint!(1_000u64); b_mock.set_block_epoch(10);