Skip to content

Commit

Permalink
fix(token-vesting): allow start times before current block time
Browse files Browse the repository at this point in the history
  • Loading branch information
k-yang committed Nov 6, 2023
1 parent 6b7b3d2 commit dfe9c8f
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 30 deletions.
3 changes: 0 additions & 3 deletions contracts/core-token-vesting/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),

Expand Down
14 changes: 0 additions & 14 deletions contracts/core-token-vesting/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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 {
Expand Down
13 changes: 0 additions & 13 deletions contracts/core-token-vesting/src/testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit dfe9c8f

Please sign in to comment.