From f87089a00216a3c68eb91b17f6d1f523c7b92306 Mon Sep 17 00:00:00 2001 From: Art3miX <40179351+Art3miX@users.noreply.github.com> Date: Mon, 17 Jun 2024 09:26:46 +0200 Subject: [PATCH] Add error event (#65) --- Cargo.lock | 20 +++++++++---------- Cargo.toml | 2 +- contracts/services/rebalancer/src/helpers.rs | 2 ++ .../services/rebalancer/src/rebalance.rs | 4 ++++ 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3085cf01..42c63048 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -138,7 +138,7 @@ dependencies = [ [[package]] name = "auction" -version = "0.1.0" +version = "0.1.4" dependencies = [ "anyhow", "auction-package", @@ -155,7 +155,7 @@ dependencies = [ [[package]] name = "auction-package" -version = "0.1.0" +version = "0.1.4" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -167,7 +167,7 @@ dependencies = [ [[package]] name = "auctions-manager" -version = "0.1.0" +version = "0.1.4" dependencies = [ "anyhow", "auction", @@ -908,7 +908,7 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "price-oracle" -version = "0.1.0" +version = "0.1.4" dependencies = [ "anyhow", "astroport 2.9.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1012,7 +1012,7 @@ dependencies = [ [[package]] name = "rebalancer" -version = "0.1.0" +version = "0.1.4" dependencies = [ "anyhow", "auction", @@ -1165,7 +1165,7 @@ dependencies = [ [[package]] name = "services-manager" -version = "0.1.0" +version = "0.1.4" dependencies = [ "anyhow", "cosmwasm-schema", @@ -1335,7 +1335,7 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "valence-account" -version = "0.1.0" +version = "0.1.4" dependencies = [ "anyhow", "cosmwasm-schema", @@ -1351,7 +1351,7 @@ dependencies = [ [[package]] name = "valence-macros" -version = "0.1.0" +version = "0.1.4" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -1362,7 +1362,7 @@ dependencies = [ [[package]] name = "valence-package" -version = "0.1.0" +version = "0.1.4" dependencies = [ "auction-package", "cosmwasm-schema", @@ -1376,7 +1376,7 @@ dependencies = [ [[package]] name = "valence-tests" -version = "0.1.0" +version = "0.1.4" dependencies = [ "anyhow", "astroport 2.9.5 (git+https://github.com/astroport-fi/astroport-core.git?tag=v2.9.5)", diff --git a/Cargo.toml b/Cargo.toml index 997fbe7c..d3faaef5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ members = [ [workspace.package] edition = "2021" license = "BSL" -version = "0.1.0" +version = "0.1.4" repository = "https://github.com/timewave-computer/valence-services" rust-version = "1.66" diff --git a/contracts/services/rebalancer/src/helpers.rs b/contracts/services/rebalancer/src/helpers.rs index 207b3abf..0ad23220 100644 --- a/contracts/services/rebalancer/src/helpers.rs +++ b/contracts/services/rebalancer/src/helpers.rs @@ -1,3 +1,4 @@ +use cosmwasm_schema::cw_serde; use cosmwasm_std::{Decimal, SubMsg, Uint128}; use serde::Serialize; use valence_package::{ @@ -29,6 +30,7 @@ pub struct TargetHelper { pub auction_min_amount: Decimal, } +#[cw_serde] pub struct RebalanceResponse { pub config: RebalancerConfig, pub msg: Option, diff --git a/contracts/services/rebalancer/src/rebalance.rs b/contracts/services/rebalancer/src/rebalance.rs index d81c8581..67991e48 100644 --- a/contracts/services/rebalancer/src/rebalance.rs +++ b/contracts/services/rebalancer/src/rebalance.rs @@ -139,6 +139,10 @@ pub fn execute_system_rebalance( should_pause, }) = rebalance_res else { + account_events.push( + Event::new("rebalancer-error") + .add_attribute("error", rebalance_res.unwrap_err().to_string()), + ); continue; };