-
Notifications
You must be signed in to change notification settings - Fork 9
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
Token vesting #48
Token vesting #48
Conversation
- Refactored `VestingSchedule::vested_amount` for better readability - Added missing error handling for multiplication and division operations - Updated variable names for clarity and consistency - Removed unnecessary parentheses in arithmetic expressions - Added missing test cases for the `VestingSchedule::LinearVestingWithCliff` variant - Updated version number to `0.1.0` and edition to `2021` in `Cargo.toml` - Removed `authors` field from `Cargo.toml` - Added new dependencies `cw-utils` (`1.0.1`) and `thiserror` (`1.0.23`) - Removed `dev-dependencies` section from `Cargo.toml` - Updated import statements in `state.rs` - Changed `cw20::Denom` to `cosmwasm_std::Denom` in `state.rs` - Added `#[cw_serde]` attribute for `VestingAccount` struct in `state.rs` - Added `test_denom_to_key` function in `state.rs` - Modified `test_denom_to_key` function to use `Uint64` and `Uint128` from `cosmwasm_std` - Modified `vesting_amount` value in `test_denom_to_key` function to `Uint128::zero()` - Modified `claimed_amount` value in `vesting_account` to `Uint128::zero()`
- Remove the "license" field from the `Cargo.toml` file in `contracts/token-vesting` - Omitted other large changes in the file diff summaries - High level description: Updated `Cargo.toml` file in `contracts/token-vesting` by removing the "license" field
- Remove unused imports and unnecessary print statements in `msg.rs` - Add additional properties and definitions to JSON schemas in `schema/` - Add and update `.wasm` files in `artifacts/` - Update the version of `cosmwasm-std` in `Cargo.toml` - Change import statement in `state.rs` - Modify `.wasm` files in `artifacts/`
- Add tests for registering cliff vesting account with native token in `contracts/token-vesting/src/testing.rs` - Add tests for proper initialization in `contracts/token-vesting/src/testing.rs` - Lower numeric tolerance for test files in `contracts/token-vesting/src/testing.rs` - Add validation for `cliff_amount` in `VestingSchedule::LinearVestingWithCliff` in `contracts/token-vesting/src/contract.rs` - Add validation for `vesting_amount` in `VestingSchedule::LinearVestingWithCliff` in `contracts/token-vesting/src/contract.rs` - Add validation for `cliff_time` in `VestingSchedule::LinearVestingWithCliff` in `contracts/token-vesting/src/contract.rs` - Remove `todo!("LinearVestingWithCliff")` in `register_vesting_account` function in `contracts/token-vesting/src/contract.rs`
- Refactor: Create `create_msg` helper function in `testing.rs` to generate `ExecuteMsg` object
- Fix assertion comparing cliff_time in `register_cliff_vesting_account_with_native_token` test in testing.rs - Fix assertions in contract.rs related to cliff_time, end_time, start_time, and cliff_amount - Improve code consistency and correctness in token-vesting module
} | ||
|
||
if block_time == cliff_time.u64() { | ||
return Ok(*cliff_amount); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's pretty much unreachable lol
end_time: Uint64::new(110), | ||
vesting_amount: Uint128::new(1_000_000_u128), | ||
cliff_amount: Uint128::new(100_000_u128), | ||
cliff_time: Uint64::new(105), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
start_time is useless then in this implementation. We could just use start_time instead of cliff_time right?
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #48 +/- ##
==========================================
+ Coverage 79.65% 84.28% +4.63%
==========================================
Files 41 39 -2
Lines 3161 4723 +1562
==========================================
+ Hits 2518 3981 +1463
- Misses 643 742 +99
☔ View full report in Codecov by Sentry. |
Spinning off an epic ticket with changes from when I audited/reviewed this |
* Include TokenVesting contract. * update dependencies * some refactor * some refactor for block time * dont need to clone * add new vesting option * remove periodic vesting option * add linear vesting with cliff * now works, starting point * refactor times to Uint64, half baked * refactor times to Uint64 done * add linear vesting with cliff * refactor: Refactor token vesting contract and dependencies - Refactored `VestingSchedule::vested_amount` for better readability - Added missing error handling for multiplication and division operations - Updated variable names for clarity and consistency - Removed unnecessary parentheses in arithmetic expressions - Added missing test cases for the `VestingSchedule::LinearVestingWithCliff` variant - Updated version number to `0.1.0` and edition to `2021` in `Cargo.toml` - Removed `authors` field from `Cargo.toml` - Added new dependencies `cw-utils` (`1.0.1`) and `thiserror` (`1.0.23`) - Removed `dev-dependencies` section from `Cargo.toml` - Updated import statements in `state.rs` - Changed `cw20::Denom` to `cosmwasm_std::Denom` in `state.rs` - Added `#[cw_serde]` attribute for `VestingAccount` struct in `state.rs` - Added `test_denom_to_key` function in `state.rs` - Modified `test_denom_to_key` function to use `Uint64` and `Uint128` from `cosmwasm_std` - Modified `vesting_amount` value in `test_denom_to_key` function to `Uint128::zero()` - Modified `claimed_amount` value in `vesting_account` to `Uint128::zero()` * Refactor codebase for improved performance * chore: Remove license field from Cargo.toml - Remove the "license" field from the `Cargo.toml` file in `contracts/token-vesting` - Omitted other large changes in the file diff summaries - High level description: Updated `Cargo.toml` file in `contracts/token-vesting` by removing the "license" field * refactor: Refactor and update code, schemas, and artifacts - Remove unused imports and unnecessary print statements in `msg.rs` - Add additional properties and definitions to JSON schemas in `schema/` - Add and update `.wasm` files in `artifacts/` - Update the version of `cosmwasm-std` in `Cargo.toml` - Change import statement in `state.rs` - Modify `.wasm` files in `artifacts/` * feat: Refactor token vesting tests and validation - Add tests for registering cliff vesting account with native token in `contracts/token-vesting/src/testing.rs` - Add tests for proper initialization in `contracts/token-vesting/src/testing.rs` - Lower numeric tolerance for test files in `contracts/token-vesting/src/testing.rs` - Add validation for `cliff_amount` in `VestingSchedule::LinearVestingWithCliff` in `contracts/token-vesting/src/contract.rs` - Add validation for `vesting_amount` in `VestingSchedule::LinearVestingWithCliff` in `contracts/token-vesting/src/contract.rs` - Add validation for `cliff_time` in `VestingSchedule::LinearVestingWithCliff` in `contracts/token-vesting/src/contract.rs` - Remove `todo!("LinearVestingWithCliff")` in `register_vesting_account` function in `contracts/token-vesting/src/contract.rs` * feat: Improve validation checks for token vesting contracts - Refactor: Create `create_msg` helper function in `testing.rs` to generate `ExecuteMsg` object * fix: Fix assertion errors in token-vesting contract - Fix assertion comparing cliff_time in `register_cliff_vesting_account_with_native_token` test in testing.rs - Fix assertions in contract.rs related to cliff_time, end_time, start_time, and cliff_amount - Improve code consistency and correctness in token-vesting module * epic(contracts): token vesting first version * (token-vesting): fn docs + move validation to type impl statements * .editorconfig + DRY improvements + docs * refactor: simply msg send construction --------- Co-authored-by: Unique-Divine <[email protected]>
No description provided.