-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(token-vesting): strong error types, explicit checks in tests, an…
…d deregister tests test(token-vesting): strong error types, explicit checks in tests, and deregister tests - Closes #82 --- - ci: Exclude prost types from nibiru-std/src/proto/buf from coverage + fmt - feat(nibiru-std): implement NibiruStargateQuery as an extension of prost::Nme - test(nibiru-std): verify that CosmosMsg::Stargate types error when converted to QueryRequest::Stargate - test(token-vesting): add tests for execute deregister - test(token-vesting): clean up linear vesting tests - test(token-vesting): use strongly-typed, idiomatic errors - test(token-vesting): use typed errors + Result types in contract.rs - test(token-vesting): use explicit error comparisons in tests + Result types in testing.rs
- Loading branch information
Showing
14 changed files
with
541 additions
and
305 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
37e1b6a8583c5158568cebedbced902936d2f4f397f9ba20fe8e3f49a312fb8b bindings_perp.wasm | ||
d0d3df98c4af178c66630777092df45462289530b731e2ddc6b1c2300d1d657e controller.wasm | ||
65548e00849045afabb51ec80f357dc1306198ffbfd548d03660ef40fba29017 bindings_perp.wasm | ||
67191fdbcaaaae07c19cb3fca86a7273fae46c1015a0c52b1526b5329e559d81 controller.wasm | ||
ec6cc298bf32cad7f5f426002fdcee602b133f24f6f7d65905c5aad0e3b777c9 incentives.wasm | ||
459f3d2dd6240ef36cba48d3e102407639caffa7bca9c3b924df483b4fd40b6a lockup.wasm | ||
663f737a0f25ec93eb6dab83f8872e3a7a289cde2a3ec4c49d1bf6127b992ec8 nibi_stargate.wasm | ||
d2dfc9ed4a689a8b23b020421c7e3fc0a90fd985c1291a44659073cc9021bb38 nibi_stargate.wasm | ||
bbb9c32c863ff78366ac5bae241967b206a6ad463e0154e7081309ab36904dce pricefeed.wasm | ||
76dc1fc5e9b7fd975bde8f30d364b185733402ffe64fd841866bdf85634dcd3a shifter.wasm | ||
a2f0262bbb39bcc16a353976154de22325e53f68f264ba61549f39d78dde2291 token_vesting.wasm | ||
8014645275544b90c2ae33002e30c6cce6859dcd1193a48c599bedf4fb1015e3 shifter.wasm | ||
0e4db7a116f27db4973e46db4a9cdd60abde1fb3e0dfeb7b1d5d9197c788229b token_vesting.wasm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
1d228461eaa095ec54360c920a851ed142703721f1e5596e740068f19492a868 target/wasm32-unknown-unknown/release/bindings_perp.wasm | ||
da3bdc0569f318d367eea17f39517e9f39d75b37c164b00bed22a4050b4e088c target/wasm32-unknown-unknown/release/controller.wasm | ||
e03f22cf0c8fe52eda23249aafdc7afc2545b227918d9480835b160187083ad3 target/wasm32-unknown-unknown/release/incentives.wasm | ||
9a088c48bd29274d7a0a95359d3749c236dc323d31e94ed0aba0c6c7826930e5 target/wasm32-unknown-unknown/release/lockup.wasm | ||
8c6960f4852bfde4b9ed427a1708f2d0039d439aeb7c1697ece7059a0b998989 target/wasm32-unknown-unknown/release/pricefeed.wasm | ||
a82731d918951ed592e25fb1bd4afba60e0b2be2346d99dda1c52118730ce678 target/wasm32-unknown-unknown/release/shifter.wasm | ||
9318d75912302fedb0f775bb2fe75a60c494e7535f0e08e8e4eb0442cc5ef49a target/wasm32-unknown-unknown/release/token_vesting.wasm | ||
02098f31f1a0dac2f01832c40ab3fc85883533fce16bb8aef966dbb201200b83 target/wasm32-unknown-unknown/release/nibi_stargate.wasm | ||
f95b4a566d319f6cf39de88d168c19134bdff3864916c48c71a9a7f2d4474ee2 target/wasm32-unknown-unknown/release/bindings_perp.wasm | ||
516fc6e8ca410041834e807cfed96478b51805d5c112bdd520bfd32e0f55eb4b target/wasm32-unknown-unknown/release/controller.wasm | ||
ae4e6405de49a97cde63c7d8abb88a77b8dcb8211759dc22ecab61b8e98f8519 target/wasm32-unknown-unknown/release/nibi_stargate.wasm | ||
4a9bc648eaa78b691e286108dcf57111b1325c8df4c59366532b19cf80bac782 target/wasm32-unknown-unknown/release/shifter.wasm | ||
b457a863837b7f4e93a322e9cc90887bd6b6d51f88efd0be50d9d52ee5a8c2d0 target/wasm32-unknown-unknown/release/token_vesting.wasm |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
use thiserror::Error; | ||
|
||
#[derive(Error, Debug, PartialEq)] | ||
pub enum ContractError { | ||
#[error(transparent)] | ||
Std(#[from] cosmwasm_std::StdError), | ||
|
||
#[error(transparent)] | ||
Vesting(#[from] VestingError), | ||
|
||
#[error(transparent)] | ||
Cliff(#[from] CliffError), | ||
|
||
#[error(transparent)] | ||
Overflow(#[from] cosmwasm_std::OverflowError), | ||
} | ||
|
||
#[derive(thiserror::Error, Debug, PartialEq)] | ||
pub enum CliffError { | ||
#[error("cliff_amount is zero but should be greater than 0")] | ||
ZeroAmount, | ||
|
||
#[error("cliff_time ({cliff_time}) should be greater than block_time ({block_time})")] | ||
InvalidTime { cliff_time: u64, block_time: u64 }, | ||
|
||
#[error("cliff_amount ({cliff_amount}) should be less than or equal to vesting_amount ({vesting_amount})")] | ||
ExcessiveAmount { | ||
cliff_amount: u128, | ||
vesting_amount: u128, | ||
}, | ||
} | ||
|
||
#[derive(thiserror::Error, Debug, PartialEq)] | ||
pub enum VestingError { | ||
#[error("vesting_amount is zero but should be greater than 0")] | ||
ZeroVestingAmount, | ||
|
||
#[error( | ||
"end_time ({end_time}) should be greater than start_time ({start_time})" | ||
)] | ||
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), | ||
|
||
#[error("vesting_amount ({vesting_amount}) should be equal to deposit_amount ({deposit_amount})")] | ||
MismatchedVestingAndDepositAmount { | ||
vesting_amount: u128, | ||
deposit_amount: u128, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
pub mod contract; | ||
pub mod errors; | ||
pub mod msg; | ||
pub mod state; | ||
|
||
|
Oops, something went wrong.