Skip to content
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
14 changes: 8 additions & 6 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,18 @@ jobs:
- name: Install stable Rust
run: cargo make install-stable

# selecting a toolchain should happen before the plugin, as the cache uses the current rustc version as its cache key
- name: Cache dependencies
uses: Swatinem/rust-cache@v2

# Artifacts used by tests
- name: Compile workspace
run: cargo make build

- name: Run test
run: cargo make test
# FIXME: enable it one problem with `no space left fixed`
# - remove `target/release` deps
# - name: Cleanup
# run: |
# rm -rf target/release

# - name: Run test
# run: cargo make test

# disabled because of "no space left" error.
# - name: Run test coverage
Expand Down
104 changes: 38 additions & 66 deletions Cargo.lock

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

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ members = [
"contracts/rewards-collector",
"packages/chains/*",
"packages/health",
"packages/liquidation",
"packages/testing",
"packages/types",
"packages/utils",
Expand Down Expand Up @@ -66,8 +67,9 @@ proptest = "1.1.0"

# packages
mars-health = { version = "1.0.0", path = "./packages/health" }
mars-liquidation = { version = "1.0.0", path = "./packages/liquidation" }
mars-osmosis = { version = "1.0.0", path = "./packages/chains/osmosis" }
mars-params = "=1.0.2"
mars-params = { version = "1.0.7", path = "./contracts/params" }
mars-red-bank-types = { version = "1.0.0", path = "./packages/types" }
mars-testing = { version = "1.0.0", path = "./packages/testing" }
mars-utils = { version = "1.0.0", path = "./packages/utils" }
Expand Down
8 changes: 0 additions & 8 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,6 @@ docker run --rm -v "$(pwd)":/code \
${image}
"""

# Download artifacts used in integration tests.
# NOTE: use correct version of the artifact.
[tasks.download-artifacts]
script = """
wget https://github.com/mars-protocol/mars-common/releases/download/v1.0.0-alpha/mars_params.wasm -O $ARTIFACTS_DIR_PATH/mars_params.wasm
"""

[tasks.test]
toolchain = "${RUST_VERSION}"
command = "cargo"
Expand Down Expand Up @@ -99,7 +92,6 @@ dependencies = [
"fmt",
"clippy",
"build",
"download-artifacts",
"test",
"audit",
"generate-all-schemas",
Expand Down
3 changes: 3 additions & 0 deletions contracts/red-bank/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,15 @@ cw2 = { workspace = true }
cw-storage-plus = { workspace = true }
cw-utils = { workspace = true }
mars-health = { workspace = true }
mars-liquidation = { workspace = true }
mars-owner = { workspace = true }
mars-params = { workspace = true }
mars-red-bank-types = { workspace = true }
mars-utils = { workspace = true }
thiserror = { workspace = true }

[dev-dependencies]
anyhow = { workspace = true }
cosmwasm-schema = { workspace = true }
cw-multi-test = { workspace = true }
mars-testing = { workspace = true }
4 changes: 2 additions & 2 deletions contracts/red-bank/src/contract.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use cosmwasm_std::{entry_point, to_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response};
use mars_red_bank_types::red_bank::{ExecuteMsg, InstantiateMsg, QueryMsg};

use crate::{error::ContractError, execute, query};
use crate::{error::ContractError, execute, liquidate, query};

#[entry_point]
pub fn instantiate(
Expand Down Expand Up @@ -74,7 +74,7 @@ pub fn execute(
} => {
let user_addr = deps.api.addr_validate(&user)?;
let sent_coin = cw_utils::one_coin(&info)?;
execute::liquidate(
liquidate::liquidate(
deps,
env,
info,
Expand Down
12 changes: 11 additions & 1 deletion contracts/red-bank/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use cosmwasm_std::{OverflowError, StdError};
use cosmwasm_std::{CheckedFromRatioError, CheckedMultiplyFractionError, OverflowError, StdError};
use cw_utils::PaymentError;
use mars_health::error::HealthError;
use mars_liquidation::error::LiquidationError;
use mars_owner::OwnerError;
use mars_red_bank_types::error::MarsError;
use mars_utils::error::ValidationError;
Expand All @@ -26,9 +27,18 @@ pub enum ContractError {
#[error("{0}")]
Overflow(#[from] OverflowError),

#[error("{0}")]
CheckedFromRatio(#[from] CheckedFromRatioError),

#[error("{0}")]
CheckedMultiplyFraction(#[from] CheckedMultiplyFractionError),

#[error("{0}")]
Health(#[from] HealthError),

#[error("{0}")]
Liquidation(#[from] LiquidationError),

#[error("Price not found for asset: {denom:?}")]
PriceNotFound {
denom: String,
Expand Down
Loading