Skip to content

Commit

Permalink
fix(token-vesting): allow start times before current block time (#89)
Browse files Browse the repository at this point in the history
* fix(token-vesting): allow start times before current block time

* build wasm artifact for token vesting

---------

Co-authored-by: Unique-Divine <realuniquedivine@gmail.com>
  • Loading branch information
k-yang and Unique-Divine authored Nov 6, 2023
1 parent 6b7b3d2 commit d334509
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 32 deletions.
2 changes: 1 addition & 1 deletion artifacts/checksums.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ d8da804212d8936dd83cabd3a72bdf9736177b860fee90e27bd8cdf19081abe7 incentives.was
48882c2a3cb6a4d660876956a1f3ed20128aaad0b2a42d28db83ce08c47f2ee1 nibi_stargate.wasm
847b7f4da9f1b4691af6a637980f9076b4d467268f40a628dd5730e10fbbaea4 pricefeed.wasm
ac216371a86908eadbe99f5cfd83785eee30b70d6214a3ea5a112c2fc2b33321 shifter.wasm
6cef010d18ab705c89bccccaa00918faf2d1b89a4d47529b9fb92ab8589dd202 token_vesting.wasm
daeacf4a9738b716d4447e2e843c41cc4e1d69245334d5f7f409250c2c6ff149 token_vesting.wasm
2 changes: 1 addition & 1 deletion artifacts/checksums_intermediate.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
5880bd966316aa68c8674017b66a0fe1d969365e91cf7cc6c0f5c9138afc0c7f target/wasm32-unknown-unknown/release/cw3_flex_multisig.wasm
f05b9f9728f6d1beea36b183f790cc02223b9cef3ad17eff627b44614d022a53 target/wasm32-unknown-unknown/release/nibi_stargate.wasm
d0f9b859d13e40e5ba0062c60a31626b2db078d4e7c2d177c30d3cf4c8ec93b4 target/wasm32-unknown-unknown/release/shifter.wasm
387304f01b78be6d9a02ae7d708fd1f395f1d66fcd29274641b2f500e4344fb3 target/wasm32-unknown-unknown/release/token_vesting.wasm
9b021b82d0b818dd53888ce8874664c991b13969cf8bcc465fe82093a7e4849b target/wasm32-unknown-unknown/release/incentives.wasm
289eab8de64b6e5e162a2e5f10beb351883f9c5db64d8b6a27909167f5ce6916 target/wasm32-unknown-unknown/release/lockup.wasm
80657dbf13a68f0f36eb6e5e336d034418ee29b226f2404979c9880fa08c3d5a target/wasm32-unknown-unknown/release/pricefeed.wasm
73cf16d252f15867edbe4508d08524654f719fa873ace1fd2f7cfea74228f89c target/wasm32-unknown-unknown/release/token_vesting.wasm
Binary file modified artifacts/token_vesting.wasm
Binary file not shown.
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 d334509

Please sign in to comment.