Skip to content

Commit

Permalink
Update cw1-subkeys with new Expires, no cw20 dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanfrey committed Aug 21, 2020
1 parent 748a6b8 commit 464c6f2
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 54 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion contracts/cw1-subkeys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ library = []
[dependencies]
cosmwasm-std = { version = "0.10.0", features = ["iterator"] }
cosmwasm-storage = { version = "0.10.0", features = ["iterator"] }
cw0 = { path = "../../packages/cw0", version = "0.1.1" }
cw2 = { path = "../../packages/cw2", version = "0.1.1" }
cw20 = { path = "../../packages/cw20", version = "0.1.1" }
cw1-whitelist = { path = "../cw1-whitelist", version = "0.1.1", features = ["library"] }
schemars = "0.7"
serde = { version = "1.0.103", default-features = false, features = ["derive"] }
Expand Down
30 changes: 7 additions & 23 deletions contracts/cw1-subkeys/schema/allowance.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,9 @@
],
"properties": {
"at_height": {
"type": "object",
"required": [
"height"
],
"properties": {
"height": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
}
}
"type": "integer",
"format": "uint64",
"minimum": 0.0
}
}
},
Expand All @@ -68,22 +60,14 @@
],
"properties": {
"at_time": {
"type": "object",
"required": [
"time"
],
"properties": {
"time": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
}
}
"type": "integer",
"format": "uint64",
"minimum": 0.0
}
}
},
{
"description": "Never will never expire. Used to distinguish None from Some(Expiration::Never)",
"description": "Never will never expire. Used to express the empty variant",
"type": "object",
"required": [
"never"
Expand Down
30 changes: 7 additions & 23 deletions contracts/cw1-subkeys/schema/handle_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -245,17 +245,9 @@
],
"properties": {
"at_height": {
"type": "object",
"required": [
"height"
],
"properties": {
"height": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
}
}
"type": "integer",
"format": "uint64",
"minimum": 0.0
}
}
},
Expand All @@ -267,22 +259,14 @@
],
"properties": {
"at_time": {
"type": "object",
"required": [
"time"
],
"properties": {
"time": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
}
}
"type": "integer",
"format": "uint64",
"minimum": 0.0
}
}
},
{
"description": "Never will never expire. Used to distinguish None from Some(Expiration::Never)",
"description": "Never will never expire. Used to express the empty variant",
"type": "object",
"required": [
"never"
Expand Down
8 changes: 4 additions & 4 deletions contracts/cw1-subkeys/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ use cosmwasm_std::{
log, to_binary, Api, BankMsg, Binary, Coin, CosmosMsg, Empty, Env, Extern, HandleResponse,
HumanAddr, InitResponse, Querier, StdError, StdResult, Storage,
};
use cw0::Expiration;
use cw1_whitelist::{
contract::{handle_freeze, handle_update_admins, init as whitelist_init, query_admin_list},
msg::InitMsg,
state::admin_list_read,
};
use cw2::{set_contract_version, ContractVersion};
use cw20::Expiration;

use crate::msg::{HandleMsg, QueryMsg};
use crate::state::{allowances, allowances_read, Allowance};
Expand Down Expand Up @@ -427,9 +427,9 @@ mod tests {
let allow3 = coin(amount3, denom3);
let initial_allowances = vec![allow1.clone(), allow2.clone()];

let expires_height = Expiration::AtHeight { height: 5432 };
let expires_height = Expiration::AtHeight(5432);
let expires_never = Expiration::Never {};
let expires_time = Expiration::AtTime { time: 1234567890 };
let expires_time = Expiration::AtTime(1234567890);
// Initially set first spender allowance with height expiration, the second with no expiration
let initial_expirations = vec![expires_height.clone(), expires_never.clone()];

Expand Down Expand Up @@ -541,7 +541,7 @@ mod tests {

let initial_allowances = vec![coin(amount1, denom1), coin(amount2, denom2)];

let expires_height = Expiration::AtHeight { height: 5432 };
let expires_height = Expiration::AtHeight(5432);
let expires_never = Expiration::Never {};
// Initially set first spender allowance with height expiration, the second with no expiration
let initial_expirations = vec![expires_height.clone(), expires_never.clone()];
Expand Down
2 changes: 1 addition & 1 deletion contracts/cw1-subkeys/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
use std::fmt;

use cosmwasm_std::{Coin, CosmosMsg, Empty, HumanAddr};
use cw20::Expiration;
use cw0::Expiration;

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
Expand Down
2 changes: 1 addition & 1 deletion contracts/cw1-subkeys/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};

use cosmwasm_std::{ReadonlyStorage, Storage};
use cosmwasm_storage::{bucket, bucket_read, Bucket, ReadonlyBucket};
use cw20::Expiration;
use cw0::Expiration;

use crate::balance::Balance;

Expand Down

0 comments on commit 464c6f2

Please sign in to comment.