Skip to content
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

epic: nibiru-std::math::{ SdkDec, DecimalExt } #106

Merged
merged 8 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ coverage:
threshold: 1% # Allow coverage to drop by X%, posting a success status.
# removed_code_behavior: Takes values [off, removals_only, adjust_base]
removed_code_behavior: adjust_base
patch:
default:
threshold: 7%

# See https://docs.codecov.com/docs/pull-request-comments
comment:
Expand Down
111 changes: 97 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 14 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,21 @@ resolver = "2"
# anyhow = { workspace = true }
# ```
[workspace.dependencies]
anyhow = "1"
thiserror = "1.0.50"
assert_cmd = "2"
lazy_static = "1.4.0"
clap = { version = "4.4.7", features = ["derive", "cargo", "env", "string"] }
schemars = "0.8.15"
# serde
serde = { version = "1.0.189", default-features = false, features = ["derive"] }
serde_json = "1.0.108"

nibiru-std = { path = "nibiru-std" }
prost = "0.12.3"
prost-types = "0.12.3"
nibiru-macro = { path = "packages/nibiru-macro" }
bash-rs = { path = "packages/bash-rs" }

# deps: CosmWasm
cosmwasm-std = { version = "1.5.0", features = ["stargate"] }
cosmwasm-schema = "1.5.0"
cw-storage-plus = { version = "1.2.0" }
cw-multi-test = { version = "0.19.0" }
cw-multi-test = { version = "0.20.0" }
cw-utils = { version = "1.0.2" }
# Macros for controlling ownership of CosmWasm smart contracts
cw-ownable = { version = "0.5.1"}
Expand All @@ -46,4 +42,14 @@ cw20 = { version = "1.1.1" }
shifter = { path = "contracts/core-shifter" }
controller = { path = "contracts/core-controller" }
lockup = { path = "contracts/lockup", features = ["library"] }
incentives = { path = "contracts/incentives", features = ["library"] }
incentives = { path = "contracts/incentives", features = ["library"] }

# deps: else
anyhow = "1"
thiserror = "1.0.50"
assert_cmd = "2"
lazy_static = "1.4.0"
clap = { version = "4.4.7", features = ["derive", "cargo", "env", "string"] }
schemars = "0.8.15"
home = "0.5"
toml = "0.8"
8 changes: 4 additions & 4 deletions artifacts/checksums.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
83d726be3842b4df7179b9cfd84c3c9f8856d4252738cf4a6d27fc699f5b43bf cw3_flex_multisig.wasm
f44fd4d9a266f9281bdbedec277d82484c88688ac436d908d41ded1643b0b3f3 incentives.wasm
4c3932c7bcf99112053da52ab15d7718e827d9e71a64d57181c3816dff141e71 lockup.wasm
825a6cac125774a6c339790fdbee9c048519b2d4151c0abb06901754175cae9b nibi_stargate.wasm
91bad813055effb2e7cd8917525136510c0dff9102afe134013b904dbfd0a05e nibi_stargate_perp.wasm
823b4dd1a99ab60418483ec596f42da7396a917f6141dabbee7886ce1bf87412 nusd_valuator.wasm
e6e0180d424b4f546b8d29c8f49d7ced09011a33eccfe124af7daccbac005a37 nibi_stargate.wasm
e2741d21b4bc8a8628e340d1c119a6f5411b4a7d2b69b9e3c7f344bdcb15ec57 nibi_stargate_perp.wasm
ec015f78a854ae7450915b973193e65039050b156af21791899a72d532d2c623 nusd_valuator.wasm
d4b6a34c5c51c1e080b953fcc43b011f6616e7a49b50fb18bf93ec7dddbe9a95 pricefeed.wasm
03f0172191ac12a41e190b692b8c3c1901d4042db4bec8eff19cadba73a08418 shifter.wasm
ce1ff9cd1e5127ae94797f5d013074ef2d9fb4d6c41f7488ead3361626687d5d shifter.wasm
dd8fb20aefaf69951c09f42bfe5d9678678d51b9f3e2bba098f3175fb86785a9 token_vesting.wasm
8 changes: 4 additions & 4 deletions artifacts/checksums_intermediate.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
4714efc1737ae3a5be19d88fcf8adf8c904a3820f82e13ab5d684e2e50b1910a target/wasm32-unknown-unknown/release/lockup.wasm
e24d58bfffb5e32d61da22a7571017617376c8ee6018a05a5a8d24a7c0c9cad3 target/wasm32-unknown-unknown/release/pricefeed.wasm
c2b0bf03c5467fb861465a2ce22235e5bf64e9dcd267036fed387b9a13177ee4 target/wasm32-unknown-unknown/release/token_vesting.wasm
16e656e6ea48b3592c8658cac2b6853924dcfa299744e035e950db97dc6f4a89 target/wasm32-unknown-unknown/release/nibi_stargate.wasm
be74c66de99c676174a2d083a43d2cd8b478823625a858dcba0b1241c996d3ff target/wasm32-unknown-unknown/release/nibi_stargate_perp.wasm
95fafe51628251eef85217a86c7a675a8d0a4cde9e1fa6f86cb5cc25e379c07f target/wasm32-unknown-unknown/release/nusd_valuator.wasm
03a1ad2840cfe2f19e523f8fa1b5ad6a7b212797b9ef096a5a66f3b7b2454af9 target/wasm32-unknown-unknown/release/shifter.wasm
0f51bc6ca239f7e25008328517e5a91d6bdcafee7145ac0e11bf7a119c095307 target/wasm32-unknown-unknown/release/nibi_stargate.wasm
dc2b5e17be86494c3c8805b05ab3237b0acf7a35235013a5924f51c96347a215 target/wasm32-unknown-unknown/release/nusd_valuator.wasm
11a3ced844daa84f7b700728626051df946f27553ddfeafeb86b2828d24d6ed5 target/wasm32-unknown-unknown/release/nibi_stargate_perp.wasm
d5041907139c2c5bf63f71baa7e0c13de29c4899aba61965012c0280e5a30100 target/wasm32-unknown-unknown/release/shifter.wasm
Binary file modified artifacts/nibi_stargate.wasm
Binary file not shown.
Binary file modified artifacts/nibi_stargate_perp.wasm
Binary file not shown.
Binary file modified artifacts/nusd_valuator.wasm
Binary file not shown.
Binary file modified artifacts/shifter.wasm
Binary file not shown.
64 changes: 64 additions & 0 deletions contracts/core-shifter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,72 @@ is whitelisted or not.

- InitMsg: Initializes the contract with the admin address.

Save the following `shifter-0-inst.json`:
```json
{ "owner": "nibi1zaavvzxez0elundtn32qnk9lkm8kmcsz44g7xl" }
```

```bash
# FOR anyone
alias tx="jq -rcs '.[0].txhash' | { read txhash; sleep 3; nibid q tx \$txhash | jq '{txhash, height, code, logs, tx, gas_wanted, gas_used}' >> out.json}"
Comment on lines +30 to +31
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alias tx is defined for extracting the transaction hash and querying transaction details. It's a useful addition for users to quickly retrieve transaction information. However, consider adding a comment explaining the purpose of each part of the command for users who might not be familiar with jq or the other command-line tools used here.

```

```bash
nibid tx wasm inst 1 "$(cat shifter-0-inst.json)" --label="Crazy tester" --no-admin --from=$KEY_NAME -y | tx
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The command for contract instantiation using nibid is provided, but it might be helpful to include a brief explanation of the parameters used in the command, such as --label, --no-admin, and --from=$KEY_NAME, to aid users in understanding their purpose and how to modify them if necessary.

```

```bash
# FOR ME
alias tx="jq -rcs '.[0].txhash' | { read txhash; sleep 3; nibid q tx \$txhash | jq '{txhash, height, code, logs, gas_used, gas_wanted, tx}' | vv}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alias tx is redefined here with a different output command (vv). This could be confusing for users, as the same alias is used for different purposes. It would be better to use distinct alias names for different operations to avoid any ambiguity.

```

CONTRACT=nibi14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9ssa9gcs
CONTRACT=nibi1yyca08xqdgvjz0psg56z67ejh9xms6l436u8y58m82npdqqhmmtqzvacjr
Comment on lines +43 to +44
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate CONTRACT environment variable declarations are present. This seems like an oversight and could lead to confusion. Only one of these lines should be kept, preferably the one that is intended to be used in subsequent commands.



- ExecuteMsg: Enum for executing msgs
- ExecuteMsg::DepthShift


sudo-add.json
```json
{
"action": "add_contracts",
"contracts": [
"nibi14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9ssa9gcs",
"nibi1yyca08xqdgvjz0psg56z67ejh9xms6l436u8y58m82npdqqhmmtqzvacjr"
],
"sender": "nibi1zaavvzxez0elundtn32qnk9lkm8kmcsz44g7xl"
}
```

```bash
nibid tx sudo edit sudo-add.json -y --from=$KEY_NAME
```



32E82D3CF2BBD48EDFFFDA260E4EF78D1E2B865A6111985B86BD74CDE8BA921B

Save the following `shifter-1-exec-shift-peg.json`:
```json
{
"shift_peg_multiplier": {
"pair": "ubtc:unusd",
"new_peg_mult": "400001"
}
}
```

```bash
nibid tx wasm exec $CONTRACT "$(cat shifter-1-exec-shift-peg.json)" --from=$KEY_NAME -y | tx
```

```bash
nibid
```
Comment on lines +86 to +87
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An incomplete bash command is present. This should either be completed with the correct command or removed if it was added by mistake.



- ExecuteMsg::PegShift
- ExecuteMsg::AddMember adds an address to the whitelist
- ExecuteMsg::RemoveMember removes and address from the whitelist.
Expand Down
Loading