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

Update package schemas; fix linting errors #306

Merged
merged 7 commits into from
Jun 29, 2021
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
8 changes: 4 additions & 4 deletions packages/controllers/src/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,16 @@ mod tests {

// ensure checks proper with owner set
control.set(deps.as_mut(), Some(owner.clone())).unwrap();
assert_eq!(true, control.is_admin(deps.as_ref(), &owner).unwrap());
assert_eq!(false, control.is_admin(deps.as_ref(), &imposter).unwrap());
assert!(control.is_admin(deps.as_ref(), &owner).unwrap());
assert!(control.is_admin(deps.as_ref(), &imposter).unwrap());
control.assert_admin(deps.as_ref(), &owner).unwrap();
let err = control.assert_admin(deps.as_ref(), &imposter).unwrap_err();
assert_eq!(AdminError::NotAdmin {}, err);

// ensure checks proper with owner None
control.set(deps.as_mut(), None).unwrap();
assert_eq!(false, control.is_admin(deps.as_ref(), &owner).unwrap());
assert_eq!(false, control.is_admin(deps.as_ref(), &imposter).unwrap());
assert!(control.is_admin(deps.as_ref(), &owner).unwrap());
assert!(control.is_admin(deps.as_ref(), &imposter).unwrap());
let err = control.assert_admin(deps.as_ref(), &owner).unwrap_err();
assert_eq!(AdminError::NotAdmin {}, err);
let err = control.assert_admin(deps.as_ref(), &imposter).unwrap_err();
Expand Down
19 changes: 7 additions & 12 deletions packages/cw0/src/expiration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,13 @@ mod test {
#[test]
fn compare_expiration() {
// matching pairs
assert_eq!(true, Expiration::AtHeight(5) < Expiration::AtHeight(10));
assert_eq!(false, Expiration::AtHeight(8) < Expiration::AtHeight(7));
assert_eq!(
true,
assert!(Expiration::AtHeight(5) < Expiration::AtHeight(10));
assert!(Expiration::AtHeight(8) < Expiration::AtHeight(7));
assert!(
Expiration::AtTime(Timestamp::from_seconds(555))
< Expiration::AtTime(Timestamp::from_seconds(777))
);
assert_eq!(
false,
assert!(
Expiration::AtTime(Timestamp::from_seconds(86))
> Expiration::AtTime(Timestamp::from_seconds(100))
);
Expand All @@ -176,16 +174,13 @@ mod test {
Expiration::AtTime(Timestamp::from_seconds(1000))
.partial_cmp(&Expiration::AtHeight(230))
);
assert_eq!(
false,
assert!(
Expiration::AtTime(Timestamp::from_seconds(1000)) < Expiration::AtHeight(230)
);
assert_eq!(
false,
assert!(
Expiration::AtTime(Timestamp::from_seconds(1000)) > Expiration::AtHeight(230)
);
assert_eq!(
false,
assert!(
Expiration::AtTime(Timestamp::from_seconds(1000)) == Expiration::AtHeight(230)
);
}
Expand Down
32 changes: 16 additions & 16 deletions packages/cw1/schema/execute_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,26 +166,26 @@
"type": "object",
"required": [
"contract_addr",
"msg",
"send"
"funds",
"msg"
],
"properties": {
"contract_addr": {
"type": "string"
},
"funds": {
"type": "array",
"items": {
"$ref": "#/definitions/Coin"
}
},
"msg": {
"description": "msg is the json-encoded ExecuteMsg struct (as raw Binary)",
"allOf": [
{
"$ref": "#/definitions/Binary"
}
]
},
"send": {
"type": "array",
"items": {
"$ref": "#/definitions/Coin"
}
}
}
}
Expand All @@ -203,9 +203,9 @@
"type": "object",
"required": [
"code_id",
"funds",
"label",
"msg",
"send"
"msg"
],
"properties": {
"admin": {
Expand All @@ -219,6 +219,12 @@
"format": "uint64",
"minimum": 0.0
},
"funds": {
"type": "array",
"items": {
"$ref": "#/definitions/Coin"
}
},
"label": {
"description": "A human-readbale label for the contract",
"type": "string"
Expand All @@ -230,12 +236,6 @@
"$ref": "#/definitions/Binary"
}
]
},
"send": {
"type": "array",
"items": {
"$ref": "#/definitions/Coin"
}
}
}
}
Expand Down
32 changes: 16 additions & 16 deletions packages/cw1/schema/query_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,26 +167,26 @@
"type": "object",
"required": [
"contract_addr",
"msg",
"send"
"funds",
"msg"
],
"properties": {
"contract_addr": {
"type": "string"
},
"funds": {
"type": "array",
"items": {
"$ref": "#/definitions/Coin"
}
},
"msg": {
"description": "msg is the json-encoded ExecuteMsg struct (as raw Binary)",
"allOf": [
{
"$ref": "#/definitions/Binary"
}
]
},
"send": {
"type": "array",
"items": {
"$ref": "#/definitions/Coin"
}
}
}
}
Expand All @@ -204,9 +204,9 @@
"type": "object",
"required": [
"code_id",
"funds",
"label",
"msg",
"send"
"msg"
],
"properties": {
"admin": {
Expand All @@ -220,6 +220,12 @@
"format": "uint64",
"minimum": 0.0
},
"funds": {
"type": "array",
"items": {
"$ref": "#/definitions/Coin"
}
},
"label": {
"description": "A human-readbale label for the contract",
"type": "string"
Expand All @@ -231,12 +237,6 @@
"$ref": "#/definitions/Binary"
}
]
},
"send": {
"type": "array",
"items": {
"$ref": "#/definitions/Coin"
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/cw1155/schema/approved_for_all_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
]
},
"Timestamp": {
"description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.",
"description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```",
"allOf": [
{
"$ref": "#/definitions/Uint64"
Expand Down
2 changes: 1 addition & 1 deletion packages/cw1155/schema/cw1155_execute_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@
]
},
"Timestamp": {
"description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.",
"description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```",
"allOf": [
{
"$ref": "#/definitions/Uint64"
Expand Down
2 changes: 1 addition & 1 deletion packages/cw20/schema/all_allowances_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
]
},
"Timestamp": {
"description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.",
"description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```",
"allOf": [
{
"$ref": "#/definitions/Uint64"
Expand Down
2 changes: 1 addition & 1 deletion packages/cw20/schema/allowance_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
]
},
"Timestamp": {
"description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.",
"description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```",
"allOf": [
{
"$ref": "#/definitions/Uint64"
Expand Down
2 changes: 1 addition & 1 deletion packages/cw20/schema/cw20_execute_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@
]
},
"Timestamp": {
"description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.",
"description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```",
"allOf": [
{
"$ref": "#/definitions/Uint64"
Expand Down
34 changes: 17 additions & 17 deletions packages/cw3/schema/execute_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@
]
},
"Timestamp": {
"description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.",
"description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```",
"allOf": [
{
"$ref": "#/definitions/Uint64"
Expand Down Expand Up @@ -330,26 +330,26 @@
"type": "object",
"required": [
"contract_addr",
"msg",
"send"
"funds",
"msg"
],
"properties": {
"contract_addr": {
"type": "string"
},
"funds": {
"type": "array",
"items": {
"$ref": "#/definitions/Coin"
}
},
"msg": {
"description": "msg is the json-encoded ExecuteMsg struct (as raw Binary)",
"allOf": [
{
"$ref": "#/definitions/Binary"
}
]
},
"send": {
"type": "array",
"items": {
"$ref": "#/definitions/Coin"
}
}
}
}
Expand All @@ -367,9 +367,9 @@
"type": "object",
"required": [
"code_id",
"funds",
"label",
"msg",
"send"
"msg"
],
"properties": {
"admin": {
Expand All @@ -383,6 +383,12 @@
"format": "uint64",
"minimum": 0.0
},
"funds": {
"type": "array",
"items": {
"$ref": "#/definitions/Coin"
}
},
"label": {
"description": "A human-readbale label for the contract",
"type": "string"
Expand All @@ -394,12 +400,6 @@
"$ref": "#/definitions/Binary"
}
]
},
"send": {
"type": "array",
"items": {
"$ref": "#/definitions/Coin"
}
}
}
}
Expand Down
Loading