Skip to content

Commit 68f8f5b

Browse files
fix: unwire perp module for main branch (#1830)
* feat: rest in peace * fix: fix e2e wasm test * fix: fix justfile and deplyo-wasm --------- Co-authored-by: Unique Divine <[email protected]>
1 parent b23ae71 commit 68f8f5b

File tree

113 files changed

+63
-41813
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+63
-41813
lines changed

INSTALL.md

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
# Install `nibid` binaries <!-- omit in toc -->
1+
# Install `nibid` binaries <!-- omit in toc -->
22

33
This guide will explain how to install the Nibiru Chain binary, `nibid`, onto your system.
44

55
#### Table of Contents
6+
67
- [1. Update the system](#1-update-the-system)
78
- [2. Install Golang](#2-install-golang)
89
- [3. Install build requirements](#3-install-build-requirements)
910
- [4. Clone the Nibiru Repository](#4-clone-the-nibiru-repository)
1011
- [Upgrade](#upgrade)
11-
12+
- [Troubleshooting](#troubleshooting)
13+
- [Contributing](#contributing)
14+
- [Troubleshooting](#troubleshooting-1)
15+
- [Error when running `make install` on MacOS](#error-when-running-make-install-on-macos)
1216

1317
## 1. Update the system
1418

@@ -19,7 +23,7 @@ sudo apt update
1923
sudo apt upgrade --yes
2024
```
2125

22-
## 2. Install Golang
26+
## 2. Install Golang
2327

2428
Steps described here: https://go.dev/doc/install
2529

@@ -34,7 +38,6 @@ wget -q -O - https://git.io/vQhTU | bash -s -- --version 1.16
3438

3539
After installed, open new terminal to properly load go
3640

37-
3841
## 4. Clone the Nibiru Repository
3942

4043
```sh
@@ -43,32 +46,33 @@ git clone https://github.com/NibiruChain/nibiru
4346
cd nibiru
4447
```
4548

46-
On this fresh clone of the repo, simply run
49+
On this fresh clone of the repo, simply run
50+
4751
```sh
48-
make build
52+
make build
4953
make install
5054
make localnet
5155
```
52-
and open another terminal.
56+
57+
and open another terminal.
5358

5459
---
5560

5661
## Upgrade
5762

58-
The scheduled mainnet upgrade to `nibiru-2` is planned for
63+
The scheduled mainnet upgrade to `nibiru-2` is planned for
5964

6065
```
6166
cd nibiru
6267
git fetch tags
6368
git checkout v0.0.1
6469
```
6570

66-
67-
Testnet
71+
Testnet
6872

6973
One the Nibiru binary has been installed, for further information on joining the testnet, head over to the [testnet repo](https://github.com/NibiruChain/Networks/tree/main/Testnet).
7074

71-
Mainnet
75+
Mainnet
7276

7377
One the Nibiru binary has been installed, for further information on joining mainnet, head over to the [mainnet repo](https://github.com/NibiruChain/Networks/tree/main/Mainnet).
7478

@@ -84,9 +88,9 @@ B. New commands you've made on the `nibid` don't show up. Your `nibid` probably
8488

8589
## Contributing
8690

87-
The code for `nibid` is located in the `/cmd/nibid` folder.
91+
The code for `nibid` is located in the `/cmd/nibid` folder.
8892

89-
In addition to the commands available within that folder, `nibid` pulls in cli subcommands from the modules e.g. `/x/perps/cli`
93+
In addition to the commands available within that folder, `nibid` pulls in cli subcommands from the modules e.g. `/x/oracle/cli`
9094

9195
After updating the code run
9296

@@ -98,14 +102,14 @@ make install
98102
To see all the commands available just add `--help` to the end.
99103

100104
Example:
105+
101106
```bash
102107
nibid --help
103108
nibid query --help
104109
nibid tx --help
105-
nibid query perp --help
110+
nibid query oracle --help
106111
```
107112

108-
109113
## Troubleshooting
110114

111115
### Error when running `make install` on MacOS
@@ -120,4 +124,4 @@ You can fix it by installing `wget` with Homebrew:
120124

121125
```
122126
brew install wget
123-
```
127+
```

README.md

Lines changed: 24 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@
2222

2323
## ⚙️ — Documentation
2424

25-
- [Docs | Nibiru Chain](https://nibiru.fi/docs/): Conceptual and technical documentation can be found here.
25+
- [Docs | Nibiru Chain](https://nibiru.fi/docs/): Conceptual and technical documentation can be found here.
2626
- [Complete Golang reference docs](https://pkg.go.dev/github.com/NibiruChain/nibiru): (`pkg.go.dev`) For the blockchain implementation .
2727
- ["X Module"](https://nibiru.fi/docs/dev/x/)-specific documentation
2828

2929
## 💬 — Community
3030

3131
If you have questions or concerns, feel free to connect with a developer or community member in the [Nibiru Discord][social-discord]. We also have active communities on [Twitter][social-twitter] and [Telegram][social-telegram].
3232

33-
<!-- Markdown versions of the social badges
34-
[![description][discord-badge]][social-discord]
35-
[![description][twitter-badge]][social-twitter]
33+
<!-- Markdown versions of the social badges
34+
[![description][discord-badge]][social-discord]
35+
[![description][twitter-badge]][social-twitter]
3636
[![description][telegram-badge]][social-telegram]
3737
-->
3838

@@ -44,33 +44,30 @@ If you have questions or concerns, feel free to connect with a developer or comm
4444

4545
## 🧱 — Components of Nibiru
4646

47-
- **CosmWasm Smart Contracts**: Rust-based, Wasm smart contracts built enhanced security, performance, and interoperability. See our [CosmWasm sandbox monorepo (cw-nibiru)](https://github.com/NibiruChain/cw-nibiru/tree/main) for the protocol's core smart contracts.
48-
- **Nibi-Perps**: A perpetual futures exchange where users can take leveraged exposure and trade on a plethora of assets — completely on-chain, completely non-custodially, and with minimal gas fees.
47+
- **CosmWasm Smart Contracts**: Rust-based, Wasm smart contracts built enhanced security, performance, and interoperability. See our [CosmWasm sandbox monorepo (cw-nibiru)](https://github.com/NibiruChain/cw-nibiru/tree/main) for the protocol's core smart contracts.
4948
- **Nibi-Oracle**: Nibiru accurately prices assets using a native, system of decentralized oracles, and communicates with other Cosmos layer-1 chains using the Inter-Blockchain Communication (IBC) (opens new window)protocol.
5049
- **Nibi-Swap**: An automated market maker protocol for multichain assets. This application gives users access to swaps, pools, and bonded liquidity gauges.
5150

52-
| Module | Description |
53-
| --- | --- |
54-
| [wasm][code-x-wasm] | Implements the execution environment for [WebAssembly (WASM) smart contracts](https://nibiru.fi/docs/wasm/). |
55-
| [devgas][code-x-devgas] | The `devgas` module of Nibiru Chain shares contract execution fees with smart contract developers. This aims to increase the adoption of Nibiru by offering CosmWasm smart contract developers a direct source of income based on usage. |
56-
| [epochs][code-x-epochs] | The `epochs` module allows other modules to set hooks to be called to execute code automatically on a period basis. For example, "once a week, starting at UTC-time = x". `epochs` creates a generalized epoch interface. |
57-
| [inflation][code-x-inflation] | Implements the [tokenomics](https://nibiru.fi/docs/learn/tokenomics.html) for Nibiru. |
58-
| [common][code-x-common] | Holds helper and utility functions to be utilized by other `x/` modules. |
59-
| [oracle][code-x-oracle] | Handles the posting of an up-to-date and accurate feed of exchange rates from the validators. |
60-
| [perp][code-x-perp] | Powers the Nibi-Perps exchange. This module enables traders to open long and short leveraged positions and houses all of the PnL calculation and liquidation logic. |
61-
| [spot][code-x-spot] | Responsible for creating, joining, and exiting liquidity pools. It also allows users to swap between two assets in an existing pool. It's a fully functional AMM. |
51+
| Module | Description |
52+
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
53+
| [wasm][code-x-wasm] | Implements the execution environment for [WebAssembly (WASM) smart contracts](https://nibiru.fi/docs/wasm/). |
54+
| [devgas][code-x-devgas] | The `devgas` module of Nibiru Chain shares contract execution fees with smart contract developers. This aims to increase the adoption of Nibiru by offering CosmWasm smart contract developers a direct source of income based on usage. |
55+
| [epochs][code-x-epochs] | The `epochs` module allows other modules to set hooks to be called to execute code automatically on a period basis. For example, "once a week, starting at UTC-time = x". `epochs` creates a generalized epoch interface. |
56+
| [inflation][code-x-inflation] | Implements the [tokenomics](https://nibiru.fi/docs/learn/tokenomics.html) for Nibiru. |
57+
| [common][code-x-common] | Holds helper and utility functions to be utilized by other `x/` modules. |
58+
| [oracle][code-x-oracle] | Handles the posting of an up-to-date and accurate feed of exchange rates from the validators. |
59+
| [spot][code-x-spot] | Responsible for creating, joining, and exiting liquidity pools. It also allows users to swap between two assets in an existing pool. It's a fully functional AMM. |
6260

6361
[code-x-common]: https://github.com/NibiruChain/nibiru/tree/main/x/common
6462
[code-x-devgas]: https://nibiru.fi/docs/dev/x/nibiru-chain/devgas.html
6563
[code-x-epochs]: https://github.com/NibiruChain/nibiru/tree/main/x/epochs
6664
[code-x-inflation]: https://github.com/NibiruChain/nibiru/tree/main/x/inflation
6765
[code-x-oracle]: https://github.com/NibiruChain/nibiru/tree/main/x/oracle
68-
[code-x-perp]: https://github.com/NibiruChain/nibiru/tree/main/x/perp
6966
[code-x-spot]: https://github.com/NibiruChain/nibiru/tree/main/x/spot
7067

7168
Nibiru is built with the [Cosmos-SDK][cosmos-sdk-repo] on [Tendermint Core](https://tendermint.com/core/) consensus and communicates with other blockchain chains using the [Inter-Blockchain Communication (IBC)](https://github.com/cosmos/ibc) protocol.
7269

73-
----
70+
---
7471

7572
## ⛓️ — Building: `make` commands
7673

@@ -94,10 +91,12 @@ Usage instructions for the `nibid` CLI are available at [docs.nibiru.fi/dev/cli]
9491
### Running a Local Node
9592

9693
On a fresh clone of the repo, simply run:
94+
9795
```bash
9896
make localnet
99-
```
100-
and open another terminal.
97+
```
98+
99+
and open another terminal.
101100

102101
### Generate the protobufs
103102

@@ -131,19 +130,13 @@ Licensed under the [MIT License](./LICENSE.md).
131130

132131
[license-badge]: https://img.shields.io/badge/License-MIT-blue.svg
133132
[cosmos-sdk-repo]: https://github.com/cosmos/cosmos-sdk
134-
[badge-go-linter]:
135-
https://github.com/NibiruChain/nibiru/actions/workflows/golangci-lint.yml/badge.svg?query=branch%3Amain
136-
[workflow-go-linter]:
137-
https://github.com/NibiruChain/nibiru/actions/workflows/golangci-lint.yml?query=branch%3Amain
138-
[badge-go-releaser]:
139-
https://github.com/NibiruChain/nibiru/actions/workflows/goreleaser.yml/badge.svg?query=branch%3Amain
140-
[workflow-go-releaser]:
141-
https://github.com/NibiruChain/nibiru/actions/workflows/goreleaser.yml?query=branch%3Amain
142-
133+
[badge-go-linter]: https://github.com/NibiruChain/nibiru/actions/workflows/golangci-lint.yml/badge.svg?query=branch%3Amain
134+
[workflow-go-linter]: https://github.com/NibiruChain/nibiru/actions/workflows/golangci-lint.yml?query=branch%3Amain
135+
[badge-go-releaser]: https://github.com/NibiruChain/nibiru/actions/workflows/goreleaser.yml/badge.svg?query=branch%3Amain
136+
[workflow-go-releaser]: https://github.com/NibiruChain/nibiru/actions/workflows/goreleaser.yml?query=branch%3Amain
143137
[social-twitter]: https://twitter.com/NibiruChain
144138
[social-discord]: https://discord.gg/nibirufi
145139
[social-telegram]: https://t.me/nibiruchain
146-
147140
[discord-badge]: https://img.shields.io/badge/Discord-7289DA?&logo=discord&logoColor=white
148141
[twitter-badge]: https://img.shields.io/badge/Twitter-1DA1F2?&logo=twitter&logoColor=white
149142
[telegram-badge]: https://img.shields.io/badge/Telegram-2CA5E0?&logo=telegram&logoColor=white
@@ -153,7 +146,7 @@ https://github.com/NibiruChain/nibiru/actions/workflows/goreleaser.yml?query=bra
153146
154147
[![version](https://img.shields.io/github/tag/nibiru-labs/nibiru.svg)](https://github.com/NibiruChain/nibiru/releases/latest)
155148
156-
[![Go Report Card](https://goreportcard.com/badge/github.com/NibiruChain/nibiru)](https://goreportcard.com/report/github.com/NibiruChain/nibiru)
149+
[![Go Report Card](https://goreportcard.com/badge/github.com/NibiruChain/nibiru)](https://goreportcard.com/report/github.com/NibiruChain/nibiru)
157150
158151
[![API Reference](https://godoc.org/github.com/NibiruChain/nibiru?status.svg)](https://godoc.org/github.com/NibiruChain/nibiru)
159152

app/keepers.go

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,6 @@ import (
110110
oracle "github.com/NibiruChain/nibiru/x/oracle"
111111
oraclekeeper "github.com/NibiruChain/nibiru/x/oracle/keeper"
112112
oracletypes "github.com/NibiruChain/nibiru/x/oracle/types"
113-
perpkeeper "github.com/NibiruChain/nibiru/x/perp/v2/keeper"
114-
perpmodule "github.com/NibiruChain/nibiru/x/perp/v2/module"
115-
perptypes "github.com/NibiruChain/nibiru/x/perp/v2/types"
116113

117114
"github.com/NibiruChain/nibiru/x/spot"
118115
spotkeeper "github.com/NibiruChain/nibiru/x/spot/keeper"
@@ -172,7 +169,6 @@ type AppKeepers struct {
172169
// Nibiru keepers
173170
// ---------------
174171
EpochsKeeper epochskeeper.Keeper
175-
PerpKeeperV2 perpkeeper.Keeper
176172
SpotKeeper spotkeeper.Keeper
177173
OracleKeeper oraclekeeper.Keeper
178174
InflationKeeper inflationkeeper.Keeper
@@ -215,7 +211,6 @@ func initStoreKeys() (
215211
spottypes.StoreKey,
216212
oracletypes.StoreKey,
217213
epochstypes.StoreKey,
218-
perptypes.StoreKey,
219214
inflationtypes.StoreKey,
220215
sudotypes.StoreKey,
221216
wasmtypes.StoreKey,
@@ -371,20 +366,13 @@ func (app *NibiruApp) InitKeepers(
371366
appCodec, keys[epochstypes.StoreKey],
372367
)
373368

374-
app.PerpKeeperV2 = perpkeeper.NewKeeper(
375-
appCodec, keys[perptypes.StoreKey],
376-
app.AccountKeeper, app.BankKeeper, app.OracleKeeper, app.EpochsKeeper,
377-
app.SudoKeeper,
378-
)
379-
380369
app.InflationKeeper = inflationkeeper.NewKeeper(
381370
appCodec, keys[inflationtypes.StoreKey], app.GetSubspace(inflationtypes.ModuleName),
382371
app.AccountKeeper, app.BankKeeper, app.DistrKeeper, app.stakingKeeper, app.SudoKeeper, authtypes.FeeCollectorName,
383372
)
384373

385374
app.EpochsKeeper.SetHooks(
386375
epochstypes.NewMultiEpochHooks(
387-
app.PerpKeeperV2.Hooks(),
388376
app.InflationKeeper.Hooks(),
389377
app.OracleKeeper.Hooks(),
390378
),
@@ -437,8 +425,8 @@ func (app *NibiruApp) InitKeepers(
437425
// NOTE: This keeper depends on all of pointers to the the Keepers to which
438426
// it binds. Thus, it must be instantiated after those keepers have been
439427
// assigned.
440-
// For example, if there are bindings for the x/perp module, then the app
441-
// passed to GetWasmOpts must already have a non-nil PerpKeeper.
428+
// For example, if there are bindings for the x/inflation module, then the app
429+
// passed to GetWasmOpts must already have a non-nil InflationKeeper.
442430
supportedFeatures := strings.Join(wasmdapp.AllCapabilities(), ",")
443431
app.WasmKeeper = wasmkeeper.NewKeeper(
444432
appCodec,
@@ -593,7 +581,6 @@ func (app *NibiruApp) initAppModules(
593581
spot.NewAppModule(appCodec, app.SpotKeeper, app.AccountKeeper, app.BankKeeper),
594582
oracle.NewAppModule(appCodec, app.OracleKeeper, app.AccountKeeper, app.BankKeeper),
595583
epochs.NewAppModule(appCodec, app.EpochsKeeper),
596-
perpmodule.NewAppModule(appCodec, app.PerpKeeperV2, app.AccountKeeper, app.BankKeeper, app.OracleKeeper),
597584
inflation.NewAppModule(app.InflationKeeper, app.AccountKeeper, *app.stakingKeeper),
598585
sudo.NewAppModule(appCodec, app.SudoKeeper),
599586
genmsg.NewAppModule(app.MsgServiceRouter()),
@@ -664,7 +651,6 @@ func orderedModuleNames() []string {
664651
epochstypes.ModuleName,
665652
spottypes.ModuleName,
666653
oracletypes.ModuleName,
667-
perptypes.ModuleName,
668654
inflationtypes.ModuleName,
669655
sudotypes.ModuleName,
670656

@@ -779,7 +765,6 @@ func ModuleBasicManager() module.BasicManager {
779765
spot.AppModuleBasic{},
780766
oracle.AppModuleBasic{},
781767
epochs.AppModuleBasic{},
782-
perpmodule.AppModuleBasic{},
783768
inflation.AppModuleBasic{},
784769
sudo.AppModuleBasic{},
785770
wasm.AppModuleBasic{},
@@ -803,13 +788,6 @@ func ModuleAccPerms() map[string][]string {
803788
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
804789
ibcfeetypes.ModuleName: {},
805790

806-
perptypes.ModuleName: {},
807-
perptypes.VaultModuleAccount: {},
808-
perptypes.PerpFundModuleAccount: {},
809-
perptypes.FeePoolModuleAccount: {},
810-
perptypes.DNRAllocationModuleAccount: {},
811-
perptypes.DNREscrowModuleAccount: {},
812-
813791
epochstypes.ModuleName: {},
814792
sudotypes.ModuleName: {},
815793
common.TreasuryPoolModuleAccount: {},
@@ -818,7 +796,6 @@ func ModuleAccPerms() map[string][]string {
818796
}
819797
}
820798

821-
// initParamsKeeper init params perpammkeeper and its subspaces
822799
func initParamsKeeper(
823800
appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key,
824801
tkey storetypes.StoreKey,

cmd/nibid/cmd/root.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import (
2929

3030
"github.com/NibiruChain/nibiru/app"
3131
oraclecli "github.com/NibiruChain/nibiru/x/oracle/client/cli"
32-
perpv2cli "github.com/NibiruChain/nibiru/x/perp/v2/client/cli"
3332
)
3433

3534
// NewRootCmd creates a new root command for nibid. It is called once in the
@@ -156,7 +155,6 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig app.EncodingConfig) {
156155
genesisCommand(
157156
encodingConfig,
158157
oraclecli.AddGenesisPricefeederDelegationCmd(app.DefaultNodeHome),
159-
perpv2cli.AddMarketGenesisCmd(app.DefaultNodeHome),
160158
cli.AddSudoRootAccountCmd(app.DefaultNodeHome),
161159
),
162160
queryCommand(),

contrib/docker/chaosnet.Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ RUN apk --no-cache add \
2323
COPY --from=builder /nibiru/build/nibid /usr/local/bin/nibid
2424

2525
COPY ./contrib/scripts/chaosnet.sh ./
26-
COPY ./contrib/scripts/feat-perp.sh ./
2726
RUN chmod +x ./chaosnet.sh
2827
ARG MNEMONIC
2928
ARG CHAIN_ID

contrib/scripts/chaosnet.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22
#
33
# This script is used in tandem with `contrib/docker/chaosnet.Dockerfile` to
4-
# run nodes for Nibiru Chain networks inside docker containers.
4+
# run nodes for Nibiru Chain networks inside docker containers.
55
# - See CHAOSNET.md for usage instructions.
66
set -e
77

@@ -27,7 +27,6 @@ sed -i 's/enabled-unsafe-cors = false/enabled-unsafe-cors = true/' $HOME/.nibid/
2727
sed -i "s/localhost:1317/0.0.0.0:$LCD_PORT/" $HOME/.nibid/config/app.toml
2828
sed -i "s/localhost:9090/0.0.0.0:$GRPC_PORT/" $HOME/.nibid/config/app.toml
2929

30-
3130
# ------------------------------------------------------------------------
3231
# Configure genesis params
3332
# ------------------------------------------------------------------------
@@ -44,9 +43,7 @@ add_genesis_param() {
4443
mv $HOME/.nibid/config/tmp_genesis.json $HOME/.nibid/config/genesis.json
4544
}
4645

47-
curr_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
48-
source "$curr_dir/feat-perp.sh"
49-
add_genesis_perp_markets_offline
46+
curr_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
5047

5148
# recover mnemonic
5249
echo "$MNEMONIC" | nibid keys add validator --recover

0 commit comments

Comments
 (0)