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
2 changes: 2 additions & 0 deletions Cargo.lock

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

5 changes: 3 additions & 2 deletions contracts/address-provider/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use cosmwasm_std::entry_point;
use cosmwasm_std::{
to_binary, Addr, Binary, Deps, DepsMut, Env, MessageInfo, Order, Response, StdResult,
};
use cw2::set_contract_version;
use cw_storage_plus::Bound;
use mars_owner::{OwnerInit::SetInitialOwner, OwnerUpdate};
use mars_red_bank_types::address_provider::{
Expand All @@ -19,7 +20,7 @@ use crate::{
state::{ADDRESSES, CONFIG, OWNER},
};

pub const CONTRACT_NAME: &str = "crates.io:mars-address-provider";
pub const CONTRACT_NAME: &str = env!("CARGO_PKG_NAME");
pub const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");

const DEFAULT_LIMIT: u32 = 10;
Expand All @@ -34,7 +35,7 @@ pub fn instantiate(
_info: MessageInfo,
msg: InstantiateMsg,
) -> Result<Response, ContractError> {
cw2::set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?;
set_contract_version(deps.storage, format!("crates.io:{CONTRACT_NAME}"), CONTRACT_VERSION)?;

assert_valid_prefix(&msg.owner, &msg.prefix)?;

Expand Down
5 changes: 3 additions & 2 deletions contracts/incentives/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use cosmwasm_std::{
attr, to_binary, Addr, BankMsg, Binary, Coin, Coins, Decimal, Deps, DepsMut, Env, Event,
MessageInfo, Order, Response, StdError, StdResult, Uint128,
};
use cw2::set_contract_version;
use cw_storage_plus::Bound;
use mars_owner::{OwnerInit::SetInitialOwner, OwnerUpdate};
use mars_red_bank_types::{
Expand All @@ -27,7 +28,7 @@ use crate::{
},
};

pub const CONTRACT_NAME: &str = "crates.io:mars-incentives";
pub const CONTRACT_NAME: &str = env!("CARGO_PKG_NAME");
pub const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");

/// The epoch duration should be at least one week, perhaps ideally one month. This is to ensure
Expand All @@ -43,7 +44,7 @@ pub fn instantiate(
_info: MessageInfo,
msg: InstantiateMsg,
) -> Result<Response, ContractError> {
cw2::set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?;
set_contract_version(deps.storage, format!("crates.io:{CONTRACT_NAME}"), CONTRACT_VERSION)?;

OWNER.initialize(
deps.storage,
Expand Down
5 changes: 3 additions & 2 deletions contracts/oracle/osmosis/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ use crate::{OsmosisPriceSourceChecked, OsmosisPriceSourceUnchecked};
pub type OsmosisOracle<'a> =
OracleBase<'a, OsmosisPriceSourceChecked, OsmosisPriceSourceUnchecked, Empty, Empty, Empty>;

pub const CONTRACT_NAME: &str = "crates.io:mars-oracle-osmosis";
pub const CONTRACT_NAME: &str = env!("CARGO_PKG_NAME");
pub const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");

#[cfg(not(feature = "library"))]
pub mod entry {
use cosmwasm_std::{entry_point, Binary, Deps, DepsMut, Env, MessageInfo, Response};
use cw2::set_contract_version;
use mars_oracle_base::ContractResult;
use mars_red_bank_types::oracle::msg::{ExecuteMsg, InstantiateMsg, QueryMsg};

Expand All @@ -27,7 +28,7 @@ pub mod entry {
_info: MessageInfo,
msg: InstantiateMsg<Empty>,
) -> ContractResult<Response> {
cw2::set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?;
set_contract_version(deps.storage, format!("crates.io:{CONTRACT_NAME}"), CONTRACT_VERSION)?;
OsmosisOracle::default().instantiate(deps, msg)
}

Expand Down
3 changes: 2 additions & 1 deletion contracts/oracle/wasm/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pub const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");
#[cfg(not(feature = "library"))]
pub mod entry {
use cosmwasm_std::{entry_point, Binary, Decimal, Deps, DepsMut, Env, MessageInfo, Response};
use cw2::set_contract_version;
use mars_oracle_base::{ContractError, ContractResult};
use mars_red_bank_types::oracle::msg::{ExecuteMsg, InstantiateMsg, QueryMsg};

Expand All @@ -36,7 +37,7 @@ pub mod entry {
_info: MessageInfo,
msg: InstantiateMsg<WasmOracleCustomInitParams>,
) -> ContractResult<Response> {
cw2::set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?;
set_contract_version(deps.storage, format!("crates.io:{CONTRACT_NAME}"), CONTRACT_VERSION)?;

let custom_init =
msg.custom_init.as_ref().ok_or(ContractError::MissingCustomInitParams {})?;
Expand Down
6 changes: 3 additions & 3 deletions contracts/red-bank/src/instantiate.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use cosmwasm_std::{DepsMut, Response};
use cw2::set_contract_version;
use mars_owner::OwnerInit::SetInitialOwner;
use mars_red_bank_types::{
error::MarsError,
Expand All @@ -11,12 +12,11 @@ use crate::{
state::{CONFIG, OWNER},
};

pub const CONTRACT_NAME: &str = "crates.io:mars-red-bank";

pub const CONTRACT_NAME: &str = env!("CARGO_PKG_NAME");
pub const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");

pub fn instantiate(deps: DepsMut, msg: InstantiateMsg) -> Result<Response, ContractError> {
cw2::set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?;
set_contract_version(deps.storage, format!("crates.io:{CONTRACT_NAME}"), CONTRACT_VERSION)?;

// Destructuring a struct’s fields into separate variables in order to force
// compile error if we add more params
Expand Down
1 change: 1 addition & 0 deletions contracts/rewards-collector/base/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ where
channel_id: cfg.channel_id,
timeout_seconds: cfg.timeout_seconds,
slippage_tolerance: cfg.slippage_tolerance,
neutron_ibc_config: cfg.neutron_ibc_config,
})
}
}
2 changes: 1 addition & 1 deletion contracts/rewards-collector/neutron/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ backtraces = [
[dependencies]
cosmwasm-schema = { workspace = true }
cosmwasm-std = { workspace = true, features = ["stargate"] }
cw2 = { workspace = true }
cw-storage-plus = { workspace = true }
mars-owner = { workspace = true }
mars-red-bank-types = { workspace = true }
Expand All @@ -38,7 +39,6 @@ serde = { workspace = true }
thiserror = { workspace = true }
neutron-sdk = { workspace = true }


[dev-dependencies]
mars-osmosis = { workspace = true }
mars-testing = { workspace = true }
Expand Down
5 changes: 5 additions & 0 deletions contracts/rewards-collector/neutron/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,24 @@ pub mod entry {
use cosmwasm_std::{
entry_point, Binary, Deps, DepsMut, Empty, Env, MessageInfo, Response, StdResult,
};
use cw2::set_contract_version;
use mars_red_bank_types::rewards_collector::{ExecuteMsg, InstantiateMsg, QueryMsg};
use mars_rewards_collector_base::ContractResult;
use neutron_sdk::bindings::msg::NeutronMsg;

use crate::NeutronCollector;

pub const CONTRACT_NAME: &str = env!("CARGO_PKG_NAME");
pub const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");

#[entry_point]
pub fn instantiate(
deps: DepsMut,
env: Env,
info: MessageInfo,
msg: InstantiateMsg,
) -> ContractResult<Response> {
set_contract_version(deps.storage, format!("crates.io:{CONTRACT_NAME}"), CONTRACT_VERSION)?;
let collector = NeutronCollector::default();
collector.instantiate(deps, env, info, msg)
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/rewards-collector/osmosis/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ backtraces = [
[dependencies]
cosmwasm-schema = { workspace = true }
cosmwasm-std = { workspace = true, features = ["stargate"] }
cw2 = { workspace = true }
cw-storage-plus = { workspace = true }
mars-owner = { workspace = true }
mars-red-bank-types = { workspace = true }
Expand All @@ -37,7 +38,6 @@ schemars = { workspace = true }
serde = { workspace = true }
thiserror = { workspace = true }


[dev-dependencies]
mars-osmosis = { workspace = true }
mars-testing = { workspace = true }
Expand Down
5 changes: 5 additions & 0 deletions contracts/rewards-collector/osmosis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ pub mod entry {
use cosmwasm_std::{
entry_point, Binary, Deps, DepsMut, Empty, Env, MessageInfo, Response, StdResult,
};
use cw2::set_contract_version;
use mars_red_bank_types::rewards_collector::{ExecuteMsg, InstantiateMsg, QueryMsg};
use mars_rewards_collector_base::{contract::Collector, ContractResult};

pub const CONTRACT_NAME: &str = env!("CARGO_PKG_NAME");
pub const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");

pub type OsmosisCollector<'a> = Collector<'a, Empty, Empty>;

#[entry_point]
Expand All @@ -15,6 +19,7 @@ pub mod entry {
info: MessageInfo,
msg: InstantiateMsg,
) -> ContractResult<Response> {
set_contract_version(deps.storage, format!("crates.io:{CONTRACT_NAME}"), CONTRACT_VERSION)?;
let collector = OsmosisCollector::default();
collector.instantiate(deps, env, info, msg)
}
Expand Down
1 change: 1 addition & 0 deletions contracts/rewards-collector/osmosis/tests/test_admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ fn instantiating() {
channel_id: config.channel_id,
timeout_seconds: config.timeout_seconds,
slippage_tolerance: config.slippage_tolerance,
neutron_ibc_config: config.neutron_ibc_config
}
);

Expand Down
2 changes: 2 additions & 0 deletions packages/types/src/rewards_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ pub struct ConfigResponse {
pub timeout_seconds: u64,
/// Maximum percentage of price movement (minimum amount you accept to receive during swap)
pub slippage_tolerance: Decimal,
/// Neutron Ibc config
pub neutron_ibc_config: Option<NeutronIbcConfig>,
}

#[cw_serde]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,17 @@
"description": "The asset to which the fee collector share is converted",
"type": "string"
},
"neutron_ibc_config": {
"description": "Neutron Ibc config",
"anyOf": [
{
"$ref": "#/definitions/NeutronIbcConfig"
},
{
"type": "null"
}
]
},
"owner": {
"description": "The contract's owner",
"type": [
Expand Down Expand Up @@ -595,9 +606,54 @@
},
"additionalProperties": false,
"definitions": {
"Coin": {
"type": "object",
"required": [
"amount",
"denom"
],
"properties": {
"amount": {
"$ref": "#/definitions/Uint128"
},
"denom": {
"type": "string"
}
}
},
"Decimal": {
"description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)",
"type": "string"
},
"NeutronIbcConfig": {
"type": "object",
"required": [
"acc_fee",
"source_port",
"timeout_fee"
],
"properties": {
"acc_fee": {
"type": "array",
"items": {
"$ref": "#/definitions/Coin"
}
},
"source_port": {
"type": "string"
},
"timeout_fee": {
"type": "array",
"items": {
"$ref": "#/definitions/Coin"
}
}
},
"additionalProperties": false
},
"Uint128": {
"description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```",
"type": "string"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export interface ConfigResponse {
address_provider: string
channel_id: string
fee_collector_denom: string
neutron_ibc_config?: NeutronIbcConfig | null
owner?: string | null
proposed_new_owner?: string | null
safety_fund_denom: string
Expand Down