Skip to content

Commit c9315b5

Browse files
authored
Upgraded code to be cosmwasm 1.0-beta.2 compatible (#923)
* Upgraded code to be cosmwasm 1.0-beta.2 compatible * [ci skip] Generate TS types Co-authored-by: jstuczyn <jstuczyn@users.noreply.github.com>
1 parent 5eeb55a commit c9315b5

File tree

24 files changed

+176
-208
lines changed

24 files changed

+176
-208
lines changed

Cargo.lock

Lines changed: 9 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

common/client-libs/validator-client/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ prost = { version = "0.9", default-features = false, optional = true }
3131
flate2 = { version = "1.0.20", optional = true }
3232
sha2 = { version = "0.9.5", optional = true }
3333
itertools = { version = "0.10", optional = true }
34-
cosmwasm-std = { git = "https://github.com/jstuczyn/cosmwasm", branch="0.14.1-updatedk256", optional = true }
34+
cosmwasm-std = { version = "1.0.0-beta2", optional = true }
3535
ts-rs = {version = "5.1", optional = true}
3636

3737
[features]

common/client-libs/validator-client/src/nymd/cosmwasm_client/logs.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub(crate) fn find_attribute<'a>(
2929
) -> Option<&'a cosmwasm_std::Attribute> {
3030
logs.iter()
3131
.flat_map(|log| log.events.iter())
32-
.find(|event| event.kind == event_type)?
32+
.find(|event| event.ty == event_type)?
3333
.attributes
3434
.iter()
3535
.find(|attr| attr.key == attribute_key)
@@ -61,7 +61,7 @@ mod tests {
6161
assert_eq!(parsed.len(), 1);
6262
assert_eq!(parsed[0].msg_index, 0);
6363
assert_eq!(parsed[0].events.len(), 1);
64-
assert_eq!(parsed[0].events[0].kind, "message");
64+
assert_eq!(parsed[0].events[0].ty, "message");
6565
assert_eq!(parsed[0].events[0].attributes[3].key, "code_id");
6666
assert_eq!(parsed[0].events[0].attributes[3].value, "1");
6767
}
@@ -76,12 +76,12 @@ mod tests {
7676
assert_eq!(parsed[2].msg_index, 2);
7777

7878
assert_eq!(parsed[0].events.len(), 1);
79-
assert_eq!(parsed[0].events[0].kind, "message");
79+
assert_eq!(parsed[0].events[0].ty, "message");
8080
assert_eq!(parsed[0].events[0].attributes[3].key, "code_id");
8181
assert_eq!(parsed[0].events[0].attributes[3].value, "9");
8282

8383
assert_eq!(parsed[2].events.len(), 1);
84-
assert_eq!(parsed[2].events[0].kind, "message");
84+
assert_eq!(parsed[2].events[0].ty, "message");
8585
assert_eq!(parsed[2].events[0].attributes[2].key, "signer");
8686
assert_eq!(
8787
parsed[2].events[0].attributes[2].value,

common/client-libs/validator-client/src/nymd/gas_price.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ impl<'a> Mul<Gas> for &'a GasPrice {
3838
// however, realistically that is impossible to happen as the resultant value
3939
// would have to be way higher than our token limit of 10^15 (1 billion of tokens * 1 million for denomination)
4040
// and max value of u128 is approximately 10^38
41-
if limit_uint128.u128() * gas_price_numerator > amount.u128() * gas_price_denominator {
41+
if limit_uint128 * gas_price_numerator > amount * gas_price_denominator {
4242
amount += Uint128::new(1);
4343
}
4444

common/mixnet-contract/Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ edition = "2018"
77
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
88

99
[dependencies]
10-
# this branch is identical to 0.14.1 with addition of updated k256 dependency required to help poor cargo choose correct version
11-
cosmwasm-std = { git = "https://github.com/jstuczyn/cosmwasm", branch = "0.14.1-updatedk256" }
12-
#cosmwasm-std = { version = "0.14.1" }
10+
cosmwasm-std = "1.0.0-beta2"
1311

1412
serde = { version = "1.0", features = ["derive"] }
1513
serde_repr = "0.1"

common/mixnet-contract/src/mixnode.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ impl NodeRewardParams {
7272
sybil_resistance_percent: u8,
7373
) -> NodeRewardParams {
7474
NodeRewardParams {
75-
period_reward_pool: Uint128(period_reward_pool),
76-
k: Uint128(k),
75+
period_reward_pool: Uint128::new(period_reward_pool),
76+
k: Uint128::new(k),
7777
reward_blockstamp,
78-
circulating_supply: Uint128(circulating_supply),
79-
uptime: Uint128(uptime),
78+
circulating_supply: Uint128::new(circulating_supply),
79+
uptime: Uint128::new(uptime),
8080
sybil_resistance_percent,
8181
}
8282
}

contracts/erc20-bridge/Cargo.lock

Lines changed: 12 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/erc20-bridge/Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ config = { path = "../../common/config"}
3131
[dependencies]
3232
erc20-bridge-contract = { path = "../../common/erc20-bridge-contract" }
3333

34-
# this branch is identical to 0.14.1 with addition of updated k256 dependency required to help poor cargo choose correct version
35-
cosmwasm-std = { git = "https://github.com/jstuczyn/cosmwasm", branch="0.14.1-updatedk256", features = ["iterator"] }
36-
cosmwasm-storage = { git = "https://github.com/jstuczyn/cosmwasm", branch="0.14.1-updatedk256", features = ["iterator"] }
34+
cosmwasm-std = "1.0.0-beta2"
35+
cosmwasm-storage = "1.0.0-beta2"
3736

3837
schemars = "0.8"
3938
serde = { version = "1.0.103", default-features = false, features = ["derive"] }

contracts/erc20-bridge/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ pub mod tests {
6868

6969
#[test]
7070
fn initialize_contract() {
71-
let mut deps = mock_dependencies(&[]);
71+
let mut deps = mock_dependencies();
7272
let env = mock_env();
7373
let msg = InstantiateMsg {};
7474
let info = mock_info("creator", &[]);

contracts/erc20-bridge/src/support/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub mod helpers {
1111
use erc20_bridge_contract::payment::Payment;
1212

1313
pub fn init_contract() -> OwnedDeps<MemoryStorage, MockApi, MockQuerier<Empty>> {
14-
let mut deps = mock_dependencies(&[]);
14+
let mut deps = mock_dependencies();
1515
let msg = InstantiateMsg {};
1616
let env = mock_env();
1717
let info = mock_info("creator", &[]);

0 commit comments

Comments
 (0)