From dfe9c8f9a5031b2acc7d9cf95635c5c2ce9f9035 Mon Sep 17 00:00:00 2001 From: Kevin Yang <5478483+k-yang@users.noreply.github.com> Date: Mon, 6 Nov 2023 13:06:26 -0600 Subject: [PATCH] fix(token-vesting): allow start times before current block time --- contracts/core-token-vesting/src/errors.rs | 3 --- contracts/core-token-vesting/src/msg.rs | 14 -------------- contracts/core-token-vesting/src/testing.rs | 13 ------------- 3 files changed, 30 deletions(-) diff --git a/contracts/core-token-vesting/src/errors.rs b/contracts/core-token-vesting/src/errors.rs index aef5e59..be9b992 100644 --- a/contracts/core-token-vesting/src/errors.rs +++ b/contracts/core-token-vesting/src/errors.rs @@ -40,9 +40,6 @@ pub enum VestingError { )] InvalidTimeRange { start_time: u64, end_time: u64 }, - #[error("start_time ({start_time}) should be greater than block_time ({block_time})")] - StartBeforeBlockTime { start_time: u64, block_time: u64 }, - #[error(transparent)] Cliff(#[from] CliffError), diff --git a/contracts/core-token-vesting/src/msg.rs b/contracts/core-token-vesting/src/msg.rs index 8b9bc78..ca496fb 100644 --- a/contracts/core-token-vesting/src/msg.rs +++ b/contracts/core-token-vesting/src/msg.rs @@ -203,13 +203,6 @@ impl VestingSchedule { return Err(VestingError::ZeroVestingAmount); } - if start_time.u64() < block_time.seconds() { - return Err(VestingError::StartBeforeBlockTime { - start_time: start_time.u64(), - block_time: block_time.seconds(), - }); - } - if end_time <= start_time { return Err(VestingError::InvalidTimeRange { start_time: start_time.u64(), @@ -246,13 +239,6 @@ impl VestingSchedule { }); } - if start_time.u64() < block_time.seconds() { - return Err(VestingError::StartBeforeBlockTime { - start_time: start_time.u64(), - block_time: block_time.seconds(), - }); - } - if vesting_amount != deposit_amount { return Err( VestingError::MismatchedVestingAndDepositAmount { diff --git a/contracts/core-token-vesting/src/testing.rs b/contracts/core-token-vesting/src/testing.rs index 2bb5178..02986a4 100644 --- a/contracts/core-token-vesting/src/testing.rs +++ b/contracts/core-token-vesting/src/testing.rs @@ -106,19 +106,6 @@ fn register_cliff_vesting_account_with_native_token() -> TestResult { }), ); - // start time less than block time - let msg = create_msg(99, 110, 1000, 1000, 105); - require_error( - &mut deps, - &env, - mock_info("addr0000", &[Coin::new(1000u128, "uusd")]), - msg, - ContractError::Vesting(VestingError::StartBeforeBlockTime { - start_time: 99, - block_time: 100, - }), - ); - // cliff amount greater than vesting amount let (vesting_amount, cliff_amount, cliff_time) = (1000, 1001, 105); let msg = create_msg(100, 110, vesting_amount, cliff_amount, cliff_time);