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

Fix description query for credits vault #66

Merged
merged 1 commit into from
May 9, 2023
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
57 changes: 38 additions & 19 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions contracts/dao/voting/credits-vault/src/contract.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::error::ContractError;
use crate::msg::{CreditsQueryMsg, ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg};
use crate::state::{Config, TotalSupplyResponse, CONFIG, DAO, DESCRIPTION};
use crate::state::{Config, TotalSupplyResponse, CONFIG, DAO};
#[cfg(not(feature = "library"))]
use cosmwasm_std::entry_point;
use cosmwasm_std::{
Expand Down Expand Up @@ -236,8 +236,8 @@ pub fn query_name(deps: Deps) -> StdResult<Binary> {
}

pub fn query_description(deps: Deps) -> StdResult<Binary> {
let description = DESCRIPTION.load(deps.storage)?;
to_binary(&description)
let config = CONFIG.load(deps.storage)?;
to_binary(&config.description)
}

pub fn query_config(deps: Deps) -> StdResult<Binary> {
Expand Down
28 changes: 28 additions & 0 deletions contracts/dao/voting/credits-vault/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ fn get_config(app: &mut App, contract_addr: Addr) -> Config {
.unwrap()
}

fn get_description(app: &mut App, contract_addr: Addr) -> String {
app.wrap()
.query_wasm_smart(contract_addr, &QueryMsg::Description {})
.unwrap()
}

#[test]
fn test_instantiate() {
let mut app = mock_app();
Expand Down Expand Up @@ -379,6 +385,28 @@ fn test_query_get_config() {
)
}

#[test]
fn test_query_get_description() {
let mut app = mock_app();
let credits_contract = instantiate_credits_contract(&mut app);

let vault_id = app.store_code(vault_contract());
let addr = instantiate_vault(
&mut app,
vault_id,
InstantiateMsg {
credits_contract_address: credits_contract.to_string(),
airdrop_contract_address: AIRDROP_ADDR.to_string(),
name: NAME.to_string(),
description: DESCRIPTION.to_string(),
owner: DAO_ADDR.to_string(),
},
);

let description = get_description(&mut app, addr);
assert_eq!(DESCRIPTION, description)
}

#[test]
fn test_voting_power_queries() {
let mut app = mock_app();
Expand Down
24 changes: 24 additions & 0 deletions contracts/subdaos/cwd-subdao-core/schema/execute_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,30 @@
},
"additionalProperties": false
},
{
"description": "Callable by timelock modules. The DAO will execute the messages in order.",
"type": "object",
"required": [
"execute_timelocked_msgs"
],
"properties": {
"execute_timelocked_msgs": {
"type": "object",
"required": [
"msgs"
],
"properties": {
"msgs": {
"type": "array",
"items": {
"$ref": "#/definitions/CosmosMsg_for_NeutronMsg"
}
}
}
}
},
"additionalProperties": false
},
{
"description": "Removes an item from the governance contract's item map.",
"type": "object",
Expand Down
21 changes: 21 additions & 0 deletions contracts/subdaos/cwd-subdao-core/schema/query_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,27 @@
},
"additionalProperties": false
},
{
"description": "Verify timelock. Returns bool.",
"type": "object",
"required": [
"verify_timelock"
],
"properties": {
"verify_timelock": {
"type": "object",
"required": [
"timelock"
],
"properties": {
"timelock": {
"type": "string"
}
}
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
Expand Down