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

feat: added staking denom #245

Merged
merged 6 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion Cargo.lock

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

6 changes: 6 additions & 0 deletions packages/injective-testing/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [1.1.1] - 2024-10-02

### Added

- Added a staking denom to the mocks

## [1.1.0] - 2024-08-23

### Changed
Expand Down
2 changes: 1 addition & 1 deletion packages/injective-testing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2021"
license = "Apache-2.0"
name = "injective-testing"
repository = "https://github.com/InjectiveLabs/cw-injective/tree/dev/packages/injective-testing"
version = "1.1.0"
version = "1.1.1"

[dependencies]
anyhow = { workspace = true }
Expand Down
2 changes: 2 additions & 0 deletions packages/injective-testing/src/mocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ pub const MOCKED_FEE_RECIPIENT: &str = "0x01edfab47f124748dc89998eb33144af734484

pub const MOCK_EXCHANGE_DECIMALS: i32 = 18i32;
pub const MOCK_BASE_DECIMALS: i32 = 18i32;
pub const MOCK_STAKE_DECIMALS: i32 = 18i32;
pub const MOCK_ATOM_DECIMALS: i32 = 8i32;
pub const MOCK_QUOTE_DECIMALS: i32 = 6i32;

pub const MOCK_ATOM_DENOM: &str = "atom";
pub const MOCK_BASE_DENOM: &str = "inj";
pub const MOCK_STAKE_DENOM: &str = "hinj";
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

MOCK_STAKE_DENOM is defined but not used anywhere in the codebase

The constant MOCK_STAKE_DENOM with the value "hinj" is currently not referenced in any part of the codebase. Please verify whether this constant is intended for future use or remove it if it's unnecessary to maintain a clean and efficient codebase.

🔗 Analysis chain

Please clarify the purpose and usage of MOCK_STAKE_DENOM

The addition of MOCK_STAKE_DENOM with the value "hinj" is noted. However, the purpose and intended usage of this new denomination are not immediately clear from the context. Could you please provide more information on:

  1. What does the "h" prefix in "hinj" represent? (e.g., hashed INJ, staked INJ)
  2. How and where will this new denomination be used in the codebase?
  3. Are there any specific reasons for introducing this new denomination alongside the existing MOCK_BASE_DENOM ("inj")?

This information will help ensure that the new constant aligns with the project's requirements and conventions.

To help understand the usage of this new denomination, let's search for its occurrences in the codebase:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for occurrences of "hinj" in the codebase
rg --type rust '"hinj"'

Length of output: 108

pub const MOCK_QUOTE_DENOM: &str = "usdt";
pub const MOCK_USDC_DENOM: &str = "usdc";

Expand Down
7 changes: 6 additions & 1 deletion packages/injective-testing/src/test_tube/exchange.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use crate::{
mocks::{MOCK_ATOM_DECIMALS, MOCK_ATOM_DENOM, MOCK_BASE_DECIMALS, MOCK_BASE_DENOM, MOCK_QUOTE_DECIMALS, MOCK_QUOTE_DENOM, MOCK_USDC_DENOM},
mocks::{
MOCK_ATOM_DECIMALS, MOCK_ATOM_DENOM, MOCK_BASE_DECIMALS, MOCK_BASE_DENOM, MOCK_QUOTE_DECIMALS, MOCK_QUOTE_DENOM, MOCK_STAKE_DECIMALS,
MOCK_STAKE_DENOM, MOCK_USDC_DENOM,
},
utils::{dec_to_proto, scale_price_quantity_perp_market, scale_price_quantity_spot_market, str_coin},
};

Expand Down Expand Up @@ -551,6 +554,7 @@ pub fn execute_spot_limit_order(app: &InjectiveTestApp, market_id: String, price
.init_account(&[
str_coin("1000000", MOCK_ATOM_DENOM, MOCK_ATOM_DECIMALS),
str_coin("1000000", MOCK_BASE_DENOM, MOCK_BASE_DECIMALS),
str_coin("1000000", MOCK_STAKE_DENOM, MOCK_STAKE_DECIMALS),
str_coin("1000000", MOCK_QUOTE_DENOM, MOCK_QUOTE_DECIMALS),
str_coin("1000000", MOCK_USDC_DENOM, MOCK_QUOTE_DECIMALS),
])
Expand Down Expand Up @@ -634,6 +638,7 @@ pub fn execute_derivative_limit_order(
.init_account(&[
str_coin("1000000", MOCK_ATOM_DENOM, MOCK_ATOM_DECIMALS),
str_coin("1000000", MOCK_BASE_DENOM, MOCK_BASE_DECIMALS),
str_coin("1000000", MOCK_STAKE_DENOM, MOCK_STAKE_DECIMALS),
str_coin("1000000", MOCK_QUOTE_DENOM, MOCK_QUOTE_DECIMALS),
])
.unwrap();
Expand Down
Loading