Skip to content

Commit

Permalink
epic: stargate migration and dependency cleanup
Browse files Browse the repository at this point in the history
epic: stargate migration and dependency cleanup

- (nibiru-std): impl From<cosmwasm_std::Coin> for cosmos::base::v1beta1::Coin
- refactor(bindings-migration): rm bindings-perp and dummy
- fix(stargate-migration): make workspace deps consistent across contracts + core prefix
- refactor(stargate-migration): make macro a workspace dependency
- refactor: rm external artifacts as they were only there as examples
- refactor(scripts): Simplify wasm-out.sh
- feat(justfile): add cosmwasm-check just command
- feat(packages): run tidy and extract bash-rs to its own package
- feat(contracts): add cw3-flx-msig as core contract with stargate feature
- refactor: workspace deps + token vesting should be core
- docs(contracts): Describe each contract in the README
- docs(contracts): Describe each contract in the README
- build(artifacts): fresh wasm and checksums
- feat(nibiru-std): update to workspace deps + impl traits for cosmos bank
- feat(scripts): add wasm_out.rs Rust script for extensibility
- chore(deps): use workspace deps in scripts
  • Loading branch information
Unique-Divine authored Nov 6, 2023
2 parents 2fc3a13 + bcb9b3a commit 381c746
Show file tree
Hide file tree
Showing 101 changed files with 4,244 additions and 5,407 deletions.
1,193 changes: 264 additions & 929 deletions Cargo.lock

Large diffs are not rendered by default.

29 changes: 27 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace]
members = ["packages/*", "contracts/*", "nibiru-std", "scripts"]
members = ["scripts", "packages/*", "nibiru-std", "contracts/*"]
exclude = ["packages/msig-ez"]
resolver = "2"

Expand All @@ -11,4 +11,29 @@ resolver = "2"
# ```
[workspace.dependencies]
anyhow = "1"
thiserror = "1.0.49"
thiserror = "1.0.50"
assert_cmd = "2"
lazy_static = "1.4.0"
clap = { version = "4.4.7", features = ["derive", "cargo", "env", "string"] }

nibiru-std = { path = "nibiru-std" }
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.1.0" }

# deps: cw-plus
cw2 = { version = "1.1.1" }
cw3 = { version = "1.1.1" }
cw3-fixed-multisig = { version = "1.1.1", features = ["library"] }
cw4 = { version = "1.1.1" }
cw20 = { version = "1.1.1" }

# deps: core contracts
# TODO: revive bindings-perp with stargate
# bindings-perp = { path = "core/core-bindings-perp" }
shifter = { path = "contracts/core-shifter" }
controller = { path = "contracts/core-controller" }
62 changes: 0 additions & 62 deletions artifacts-cw-plus/README.md

This file was deleted.

8 changes: 0 additions & 8 deletions artifacts-cw-plus/checksums.txt

This file was deleted.

8 changes: 0 additions & 8 deletions artifacts-cw-plus/checksums_intermediate.txt

This file was deleted.

Binary file removed artifacts-cw-plus/cw1_subkeys.wasm
Binary file not shown.
Binary file removed artifacts-cw-plus/cw1_whitelist.wasm
Binary file not shown.
Binary file removed artifacts-cw-plus/cw20_base.wasm
Binary file not shown.
Binary file removed artifacts-cw-plus/cw20_ics20.wasm
Binary file not shown.
Binary file removed artifacts-cw-plus/cw3_fixed_multisig.wasm
Binary file not shown.
Binary file removed artifacts-cw-plus/cw3_flex_multisig.wasm
Binary file not shown.
Binary file removed artifacts-cw-plus/cw4_group.wasm
Binary file not shown.
Binary file removed artifacts-cw-plus/cw4_stake.wasm
Binary file not shown.
15 changes: 8 additions & 7 deletions artifacts/checksums.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
65548e00849045afabb51ec80f357dc1306198ffbfd548d03660ef40fba29017 bindings_perp.wasm
67191fdbcaaaae07c19cb3fca86a7273fae46c1015a0c52b1526b5329e559d81 controller.wasm
ec6cc298bf32cad7f5f426002fdcee602b133f24f6f7d65905c5aad0e3b777c9 incentives.wasm
459f3d2dd6240ef36cba48d3e102407639caffa7bca9c3b924df483b4fd40b6a lockup.wasm
d2dfc9ed4a689a8b23b020421c7e3fc0a90fd985c1291a44659073cc9021bb38 nibi_stargate.wasm
bbb9c32c863ff78366ac5bae241967b206a6ad463e0154e7081309ab36904dce pricefeed.wasm
8014645275544b90c2ae33002e30c6cce6859dcd1193a48c599bedf4fb1015e3 shifter.wasm
27b401ca6e918bec98ec1e8e98dcb9f4de25191e1a53c34c4ceae6d4847b3b31 token_vesting.wasm
382c05baf544f2886de849933ecf59e8bc3bcdcdd552d5a63537bd6d63f2ecf1 controller.wasm
715ee1e374074d61da6f9f31b3c645430099368c40f2d310ecec9035ab36bbb9 cw3_flex_multisig.wasm
902365ed0458119ddad65f529656c243966ec42041b30c88208c1623d920fa3f incentives.wasm
f20db4f2aa87eec3e7fd65b5b160cbe9f462054ddf9072b32631925ad7e2d9b3 lockup.wasm
48882c2a3cb6a4d660876956a1f3ed20128aaad0b2a42d28db83ce08c47f2ee1 nibi_stargate.wasm
0c2164c7cd69ebf545e24cf86fd61d76d67352b01b478e8612cc2afa44da59f3 pricefeed.wasm
ac216371a86908eadbe99f5cfd83785eee30b70d6214a3ea5a112c2fc2b33321 shifter.wasm
6cef010d18ab705c89bccccaa00918faf2d1b89a4d47529b9fb92ab8589dd202 token_vesting.wasm
16 changes: 8 additions & 8 deletions artifacts/checksums_intermediate.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
e03f22cf0c8fe52eda23249aafdc7afc2545b227918d9480835b160187083ad3 target/wasm32-unknown-unknown/release/incentives.wasm
9a088c48bd29274d7a0a95359d3749c236dc323d31e94ed0aba0c6c7826930e5 target/wasm32-unknown-unknown/release/lockup.wasm
8c6960f4852bfde4b9ed427a1708f2d0039d439aeb7c1697ece7059a0b998989 target/wasm32-unknown-unknown/release/pricefeed.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
f781a92390f4b89086310d79f20d9c81ce0aaa8865fb5811150244db483785f5 target/wasm32-unknown-unknown/release/token_vesting.wasm
2ab8bde9574144e1c77e28658e2bbb8fe3f650ce893d16c7a0ae09caf4d5f20c target/wasm32-unknown-unknown/release/controller.wasm
5880bd966316aa68c8674017b66a0fe1d969365e91cf7cc6c0f5c9138afc0c7f target/wasm32-unknown-unknown/release/cw3_flex_multisig.wasm
496003ed921f6c3625a713c6e8e17cc106fa56428d3364e2a5bee767ea9a2322 target/wasm32-unknown-unknown/release/incentives.wasm
21a48122ee4cfd862407aa9add2293efcbaae48f98a047d9b6dfe02291040e6f target/wasm32-unknown-unknown/release/lockup.wasm
f05b9f9728f6d1beea36b183f790cc02223b9cef3ad17eff627b44614d022a53 target/wasm32-unknown-unknown/release/nibi_stargate.wasm
e85d899b270c168254d2c691ba0821469d2ae508774616dea6745ab7c613d1ad target/wasm32-unknown-unknown/release/pricefeed.wasm
d0f9b859d13e40e5ba0062c60a31626b2db078d4e7c2d177c30d3cf4c8ec93b4 target/wasm32-unknown-unknown/release/shifter.wasm
387304f01b78be6d9a02ae7d708fd1f395f1d66fcd29274641b2f500e4344fb3 target/wasm32-unknown-unknown/release/token_vesting.wasm
Binary file modified artifacts/controller.wasm
Binary file not shown.
Binary file added artifacts/cw3_flex_multisig.wasm
Binary file not shown.
Binary file modified artifacts/incentives.wasm
Binary file not shown.
Binary file modified artifacts/lockup.wasm
Binary file not shown.
Binary file modified artifacts/nibi_stargate.wasm
Binary file not shown.
Binary file modified artifacts/pricefeed.wasm
Binary file not shown.
Binary file modified artifacts/shifter.wasm
Binary file not shown.
Binary file modified artifacts/token_vesting.wasm
Binary file not shown.
45 changes: 19 additions & 26 deletions contracts/README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,30 @@
# Contracts <!-- omit in toc -->
- [shifter](#shifter)
- [Contained Functionality](#contained-functionality)
- [Entry Points](#entry-points)

- [Core Contracts](#core-contracts)
- [Example Contracts](#example-contracts)
- [Utility Contracts](#utility-contracts)

---

# shifter
## Core Contracts

- [**core-token-vesting**](./core-token-vesting/README.md)
- [**core-shifter**](./core-shifter/README.md): Simple contract to execute peg shift
and depth shift admin calls in x/perp module. This contract is meant to be used
to run a bot.
- [**core-controller**](./core-controller): Admin calls for things like creating
perp markets or changing oracle parameters.

"Shifter" is a simple contract that can be used to execute peg shift and
depth shifts in the x/perp module of Nibiru. The contract stores a whitelist
of addresses, managed by an admin. This whitelist design takes inspiration
from cw-plus/contracts/cw1-whitelist.
## Example Contracts

The contract initializes with an admin address and allows the admin to add
or remove addresses from the whitelist. Users can query whether an address
is whitelisted or not.
- [**nibi-stargate**](./nibi-stargate/README.md): Example smart contract that showcases how to use the Nibiru standard (nibiru-std) library to execute `CosmosMsg::Stargate` transactions for the token factory module.

### Contained Functionality
## Utility Contracts

1. Initialize the contract with an admin address.
2. Allow the admin to add or remove addresses from the whitelist.
3. Allow anyone to query if an address is on the whitelist.
4. Members of the whitelist set can execute permissioned calls on the Nibiru
x/perp module for dynamic optimizations like peg shift and depth shift.
- **lockup**: Smart contract that enables users to lock or bond tokens for arbitrary durations. This contract can be used as a building block in combination with a contract like `incentives` to implement liquidity mining incentives or other yield mechanisms.

### Entry Points
- **incentives**: Smart contract for funding lockups based with tokens.

- InitMsg: Initializes the contract with the admin address.
- ExecuteMsg: Enum for executing msgs
- ExecuteMsg::DepthShift
- ExecuteMsg::PegShift
- ExecuteMsg::AddMember adds an address to the whitelist
- ExecuteMsg::RemoveMember removes and address from the whitelist.
- ExecuteMsg::ChangeAdmin lets the current admin set a new one.

---
- [**pricefeed**](./pricefeed): Legacy implementation of the Nibiru Oracle Module in pure
CosmWasm rather than the Cosmos-SDK.
Loading

0 comments on commit 381c746

Please sign in to comment.