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
1 change: 1 addition & 0 deletions contracts/incentives/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,7 @@ pub fn query_config(deps: Deps) -> StdResult<ConfigResponse> {
address_provider: config.address_provider,
max_whitelisted_denoms: config.max_whitelisted_denoms,
epoch_duration: EPOCH_DURATION.load(deps.storage)?,
whitelist_count: WHITELIST_COUNT.may_load(deps.storage)?.unwrap_or_default(),
})
}

Expand Down
5 changes: 5 additions & 0 deletions contracts/incentives/tests/tests/test_admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ fn proper_initialization() {
assert_eq!(config.owner, Some("owner".to_string()));
assert_eq!(config.proposed_new_owner, None);
assert_eq!(config.address_provider, "address_provider".to_string());
assert_eq!(config.epoch_duration, 604800);
assert_eq!(config.max_whitelisted_denoms, 10);
assert_eq!(config.whitelist_count, 0);
}

#[test]
Expand Down Expand Up @@ -87,5 +90,7 @@ fn update_config() {
assert_eq!(new_config.owner, Some("owner".to_string()));
assert_eq!(new_config.proposed_new_owner, None);
assert_eq!(new_config.address_provider, Addr::unchecked("new_addr_provider"));
assert_eq!(new_config.epoch_duration, 604800);
assert_eq!(new_config.whitelist_count, 0);
assert_eq!(new_config.max_whitelisted_denoms, 20);
}
6 changes: 3 additions & 3 deletions contracts/incentives/tests/tests/test_whitelist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use mars_incentives::{
};
use mars_owner::OwnerError::NotOwner;
use mars_red_bank_types::{
incentives::{ExecuteMsg, QueryMsg, WhitelistEntry},
incentives::{ConfigResponse, ExecuteMsg, QueryMsg, WhitelistEntry},
red_bank::{Market, UserCollateralResponse},
};
use mars_testing::MockEnvParams;
Expand Down Expand Up @@ -356,8 +356,8 @@ fn cannot_whitelist_more_than_max_limit() {
execute(deps.as_mut(), mock_env(), mock_info(owner, &[]), add_whitelist_msg).unwrap();

// Check whitelist count. Should still be 10.
let whitelist_count = WHITELIST_COUNT.load(&deps.storage).unwrap();
assert_eq!(whitelist_count, 10);
let config: ConfigResponse = th_query(deps.as_ref(), QueryMsg::Config {});
assert_eq!(config.max_whitelisted_denoms, 10);
}

#[test]
Expand Down
2 changes: 2 additions & 0 deletions packages/types/src/incentives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,4 +303,6 @@ pub struct ConfigResponse {
pub max_whitelisted_denoms: u8,
/// The epoch duration in seconds
pub epoch_duration: u64,
/// The count of the number of whitelisted incentive denoms
pub whitelist_count: u8,
}
9 changes: 8 additions & 1 deletion schemas/mars-incentives/mars-incentives.json
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,8 @@
"required": [
"address_provider",
"epoch_duration",
"max_whitelisted_denoms"
"max_whitelisted_denoms",
"whitelist_count"
],
"properties": {
"address_provider": {
Expand Down Expand Up @@ -724,6 +725,12 @@
"string",
"null"
]
},
"whitelist_count": {
"description": "The count of the number of whitelisted incentive denoms",
"type": "integer",
"format": "uint8",
"minimum": 0.0
}
},
"additionalProperties": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export interface ConfigResponse {
max_whitelisted_denoms: number
owner?: string | null
proposed_new_owner?: string | null
whitelist_count: number
}
export type ArrayOfEmissionResponse = EmissionResponse[]
export interface EmissionResponse {
Expand Down