Closed PnxBlue closed 5 months ago
Hey @PnxBlue! You can update to the latest version of NovaX and the code will work.
If you choose to update NovaX you need to be warned of the following:
As you can see in the dev-dependencies, tests use a specific commit of the mx-exchange-sc repo. A big limitation of the mx-sdk-rs's test engine, used by NovaX, is to require all contracts to be written in the same version of the SDK. The latest version of NovaX (0.1.4) uses the mx-sdk-rs 0.47.5 version, however at the moment no commit in the mx-exchange-sc repo uses this exact version.
Therefore, it won't be possible to run the tests of this repo as is and you won't be able to build it due to Cargo finding conflicts in dependencies.
Please note that in the future it will possible to use the mx-sdk-rs's test engine with opaque WASM contracts downloaded from the MultiversX explorer, it will address the problem.
The easiest workaround is to get rid of the tests and the dev-dependencies, such a Cargo.toml is enough to make everything but tests work:
[package]
name = "novax-price-getter"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
novax = "0.1.4"
novax-token = "0.1.4"
novax-caching = "0.1.4"
tokio = { version = "1.32.0", features = ["full"] }
async-recursion = "1.0.5"
num-bigint = "0.4.4"
num-rational = "0.4.1"
num-traits = "0.2.16"
I made a branch without the tests: temp/no_test
The above workaround requires to remove tests, this not a best practice. Another solution would be to fork the mx-exchange-rs repo and update yourself the contracts to the 0.47.5 version, or create mock versions of the pair and router contracts and replace the dev-dependencies in the Cargo.toml file:
[package]
name = "novax-price-getter"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
novax = "0.1.4"
novax-token = "0.1.4"
novax-caching = "0.1.4"
tokio = { version = "1.32.0", features = ["full"] }
async-recursion = "1.0.5"
num-bigint = "0.4.4"
num-rational = "0.4.1"
num-traits = "0.2.16"
[dev-dependencies]
novax-mocking = "0.1.4"
mx-exchange-sc-pair = { path = "<path to the mock/fork pair contract>" }
mx-exchange-sc-router = { path = "<path to the mock/fork router contract>" }
lazy_static = "1.4.0"
Wait for the xExchange team to update the contracts to the 0.47.5 version of the Rust SDK. It seems to be a work in progress: https://github.com/multiversx/mx-exchange-sc/pull/860
If you have any question feel free to ask!
Awesome - Thanks for the detailed response! 🙏
In the Cargo.toml for the example, the following version numbers are listed
Do these need updating - or ok to use these with latest version of novax?
Thanks!