Skip to content

Commit

Permalink
Schemas and clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ismellike committed May 8, 2024
1 parent a86f0dc commit a76127f
Show file tree
Hide file tree
Showing 14 changed files with 239 additions and 12 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion ci/bootstrap-env/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ fn main() -> Result<()> {
);

// Persist contract code_ids in local.yaml so we can use SKIP_CONTRACT_STORE locally to avoid having to re-store them again
cfg.contract_deploy_info = orc.contract_map.deploy_info().clone();
cfg.contract_deploy_info
.clone_from(orc.contract_map.deploy_info());
fs::write(
"ci/configs/cosm-orc/local.yaml",
serde_yaml::to_string(&cfg)?,
Expand Down
3 changes: 2 additions & 1 deletion ci/integration-tests/src/helpers/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ fn global_setup() -> Cfg {
.unwrap();
save_gas_report(&orc, &gas_report_dir);
// persist stored code_ids in CONFIG, so we can reuse for all tests
cfg.contract_deploy_info = orc.contract_map.deploy_info().clone();
cfg.contract_deploy_info
.clone_from(orc.contract_map.deploy_info());
}

Cfg {
Expand Down
69 changes: 69 additions & 0 deletions contracts/dao-dao-core/schema/dao-dao-core.json
Original file line number Diff line number Diff line change
Expand Up @@ -1796,6 +1796,27 @@
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"proposal_module"
],
"properties": {
"proposal_module": {
"type": "object",
"required": [
"address"
],
"properties": {
"address": {
"type": "string"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"description": "Gets the active proposal modules associated with the contract.",
"type": "object",
Expand Down Expand Up @@ -3033,6 +3054,54 @@
}
}
},
"proposal_module": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "ProposalModule",
"description": "Top level type describing a proposal module.",
"type": "object",
"required": [
"address",
"prefix",
"status"
],
"properties": {
"address": {
"description": "The address of the proposal module.",
"allOf": [
{
"$ref": "#/definitions/Addr"
}
]
},
"prefix": {
"description": "The URL prefix of this proposal module as derived from the module ID. Prefixes are mapped to letters, e.g. 0 is 'A', and 26 is 'AA'.",
"type": "string"
},
"status": {
"description": "The status of the proposal module, e.g. 'Enabled' or 'Disabled.'",
"allOf": [
{
"$ref": "#/definitions/ProposalModuleStatus"
}
]
}
},
"additionalProperties": false,
"definitions": {
"Addr": {
"description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.",
"type": "string"
},
"ProposalModuleStatus": {
"description": "The status of a proposal module.",
"type": "string",
"enum": [
"enabled",
"disabled"
]
}
}
},
"proposal_module_count": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "ProposalModuleCountResponse",
Expand Down
4 changes: 2 additions & 2 deletions contracts/external/cw721-roles/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ pub fn execute_update_token_role(
let mut token = contract.tokens.load(deps.storage, &token_id)?;

// Update role with new value
token.extension.role = role.clone();
token.extension.role.clone_from(&role);
contract.tokens.save(deps.storage, &token_id, &token)?;

Ok(Response::default()
Expand All @@ -341,7 +341,7 @@ pub fn execute_update_token_uri(
let mut token = contract.tokens.load(deps.storage, &token_id)?;

// Set new token URI
token.token_uri = token_uri.clone();
token.token_uri.clone_from(&token_uri);
contract.tokens.save(deps.storage, &token_id, &token)?;

Ok(Response::new()
Expand Down
2 changes: 1 addition & 1 deletion contracts/external/dao-proposal-incentives/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name ="dao-proposal-incentives"
authors = ["Jake Hartnell <[email protected]>", "ismellike"]
authors = ["Jake Hartnell <[email protected]>", "Gabe Lopez <ismellike@users.noreply.github.com>"]
description = "A contract that implements incentives for voting in a DAO."
edition = { workspace = true }
license = { workspace = true }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"contract_name": "dao-proposal-incentives",
"contract_version": "2.4.0",
"contract_version": "2.4.2",
"idl_version": "1.0.0",
"instantiate": {
"$schema": "http://json-schema.org/draft-07/schema#",
Expand Down
3 changes: 3 additions & 0 deletions contracts/external/dao-proposal-incentives/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ pub fn test_hook() {
funds: vec![],
})],
proposer: None,
vote: None,
}),
&[],
);
Expand Down Expand Up @@ -390,6 +391,7 @@ pub fn test_hook() {
description: "Testing".to_string(),
msgs: vec![],
proposer: None,
vote: None,
}),
&[],
)
Expand Down Expand Up @@ -418,6 +420,7 @@ pub fn test_hook() {
description: "Testing".to_string(),
msgs: vec![],
proposer: None,
vote: None,
}),
&[],
)
Expand Down
2 changes: 1 addition & 1 deletion contracts/external/dao-voting-incentives/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name ="dao-voting-incentives"
authors = ["Jake Hartnell <[email protected]>", "ismellike"]
authors = ["Jake Hartnell <[email protected]>", "Gabe Lopez <ismellike@users.noreply.github.com>"]
description = "A contract that implements incentives for voting in a DAO."
edition = { workspace = true }
license = { workspace = true }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"contract_name": "dao-voting-incentives",
"contract_version": "2.4.0",
"contract_version": "2.4.2",
"idl_version": "1.0.0",
"instantiate": {
"$schema": "http://json-schema.org/draft-07/schema#",
Expand Down
3 changes: 3 additions & 0 deletions contracts/external/dao-voting-incentives/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ pub fn test_hooks() {
}),
],
proposer: None,
vote: None,
}),
&[],
);
Expand Down Expand Up @@ -358,6 +359,7 @@ pub fn test_hooks() {
description: "Testing".to_string(),
msgs: vec![],
proposer: None,
vote: None,
}),
&[],
)
Expand Down Expand Up @@ -435,6 +437,7 @@ pub fn test_hooks() {
description: "Testing".to_string(),
msgs: vec![],
proposer: None,
vote: None,
}),
&[],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1140,6 +1140,30 @@
}
},
"additionalProperties": false
},
{
"description": "Returns generic proposal information",
"type": "object",
"required": [
"generic_proposal_info"
],
"properties": {
"generic_proposal_info": {
"type": "object",
"required": [
"proposal_id"
],
"properties": {
"proposal_id": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}
]
},
Expand Down Expand Up @@ -1256,6 +1280,32 @@
"description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.",
"type": "string"
},
"generic_proposal_info": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "GenericProposalInfo",
"type": "object",
"required": [
"proposer",
"start_height"
],
"properties": {
"proposer": {
"$ref": "#/definitions/Addr"
},
"start_height": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
}
},
"additionalProperties": false,
"definitions": {
"Addr": {
"description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.",
"type": "string"
}
}
},
"info": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "InfoResponse",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2078,6 +2078,30 @@
}
},
"additionalProperties": false
},
{
"description": "Returns generic proposal information",
"type": "object",
"required": [
"generic_proposal_info"
],
"properties": {
"generic_proposal_info": {
"type": "object",
"required": [
"proposal_id"
],
"properties": {
"proposal_id": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}
]
},
Expand Down Expand Up @@ -2580,6 +2604,32 @@
"description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.",
"type": "string"
},
"generic_proposal_info": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "GenericProposalInfo",
"type": "object",
"required": [
"proposer",
"start_height"
],
"properties": {
"proposer": {
"$ref": "#/definitions/Addr"
},
"start_height": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
}
},
"additionalProperties": false,
"definitions": {
"Addr": {
"description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.",
"type": "string"
}
}
},
"get_vote": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "VoteResponse",
Expand Down
Loading

0 comments on commit a76127f

Please sign in to comment.