Skip to content

Commit e0a142d

Browse files
committed
reproduced small changes from PR-16
1 parent 0d30cea commit e0a142d

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/contract.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/// This contract implements SNIP-20 standard:
22
/// https://github.com/SecretFoundation/SNIPs/blob/master/SNIP-20.md
33
use cosmwasm_std::{
4-
to_binary, Api, BankMsg, Binary, CanonicalAddr, Coin, CosmosMsg, Env, Extern, HandleResponse,
5-
HumanAddr, InitResponse, Querier, QueryResult, ReadonlyStorage, StdError, StdResult, Storage,
6-
Uint128,
4+
log, to_binary, Api, BankMsg, Binary, CanonicalAddr, Coin, CosmosMsg, Env, Extern,
5+
HandleResponse, HumanAddr, InitResponse, Querier, QueryResult, ReadonlyStorage, StdError,
6+
StdResult, Storage, Uint128,
77
};
88

99
use crate::msg::{
@@ -501,7 +501,7 @@ fn try_redeem<S: Storage, A: Api, Q: Querier>(
501501
balances.set_account_balance(&sender_address, account_balance);
502502
} else {
503503
return Err(StdError::generic_err(format!(
504-
"insufficient funds to burn: balance={}, required={}",
504+
"insufficient funds to redeem: balance={}, required={}",
505505
account_balance, amount_raw
506506
)));
507507
}
@@ -638,7 +638,7 @@ fn try_register_receive<S: Storage, A: Api, Q: Querier>(
638638
set_receiver_hash(&mut deps.storage, &env.message.sender, code_hash);
639639
let res = HandleResponse {
640640
messages: vec![],
641-
log: vec![],
641+
log: vec![log("register_status", "success")],
642642
data: Some(to_binary(&HandleAnswer::RegisterReceive {
643643
status: Success,
644644
})?),
@@ -648,7 +648,7 @@ fn try_register_receive<S: Storage, A: Api, Q: Querier>(
648648

649649
fn insufficient_allowance(allowance: u128, required: u128) -> StdError {
650650
StdError::generic_err(format!(
651-
"Insufficient allowance: allowance={}, required={}",
651+
"insufficient allowance: allowance={}, required={}",
652652
allowance, required
653653
))
654654
}
@@ -1014,7 +1014,7 @@ fn perform_transfer<T: Storage>(
10141014
from_balance = new_from_balance;
10151015
} else {
10161016
return Err(StdError::generic_err(format!(
1017-
"Insufficient funds: balance={}, required={}",
1017+
"insufficient funds: balance={}, required={}",
10181018
from_balance, amount
10191019
)));
10201020
}
@@ -1263,7 +1263,7 @@ mod tests {
12631263
};
12641264
let handle_result = handle(&mut deps, mock_env("bob", &[]), handle_msg);
12651265
let error = extract_error_msg(handle_result);
1266-
assert!(error.contains("Insufficient funds"));
1266+
assert!(error.contains("insufficient funds"));
12671267
}
12681268

12691269
#[test]
@@ -1442,7 +1442,7 @@ mod tests {
14421442
};
14431443
let handle_result = handle(&mut deps, mock_env("alice", &[]), handle_msg);
14441444
let error = extract_error_msg(handle_result);
1445-
assert!(error.contains("Insufficient allowance"));
1445+
assert!(error.contains("insufficient allowance"));
14461446

14471447
// Transfer more than allowance
14481448
let handle_msg = HandleMsg::IncreaseAllowance {
@@ -1465,7 +1465,7 @@ mod tests {
14651465
};
14661466
let handle_result = handle(&mut deps, mock_env("alice", &[]), handle_msg);
14671467
let error = extract_error_msg(handle_result);
1468-
assert!(error.contains("Insufficient allowance"));
1468+
assert!(error.contains("insufficient allowance"));
14691469

14701470
// Transfer after allowance expired
14711471
let handle_msg = HandleMsg::TransferFrom {
@@ -1495,7 +1495,7 @@ mod tests {
14951495
handle_msg,
14961496
);
14971497
let error = extract_error_msg(handle_result);
1498-
assert!(error.contains("Insufficient allowance"));
1498+
assert!(error.contains("insufficient allowance"));
14991499

15001500
// Sanity check
15011501
let handle_msg = HandleMsg::TransferFrom {
@@ -1536,7 +1536,7 @@ mod tests {
15361536
};
15371537
let handle_result = handle(&mut deps, mock_env("alice", &[]), handle_msg);
15381538
let error = extract_error_msg(handle_result);
1539-
assert!(error.contains("Insufficient allowance"));
1539+
assert!(error.contains("insufficient allowance"));
15401540
}
15411541

15421542
#[test]
@@ -1561,7 +1561,7 @@ mod tests {
15611561
};
15621562
let handle_result = handle(&mut deps, mock_env("alice", &[]), handle_msg);
15631563
let error = extract_error_msg(handle_result);
1564-
assert!(error.contains("Insufficient allowance"));
1564+
assert!(error.contains("insufficient allowance"));
15651565

15661566
// Send more than allowance
15671567
let handle_msg = HandleMsg::IncreaseAllowance {
@@ -1585,7 +1585,7 @@ mod tests {
15851585
};
15861586
let handle_result = handle(&mut deps, mock_env("alice", &[]), handle_msg);
15871587
let error = extract_error_msg(handle_result);
1588-
assert!(error.contains("Insufficient allowance"));
1588+
assert!(error.contains("insufficient allowance"));
15891589

15901590
// Sanity check
15911591
let handle_msg = HandleMsg::RegisterReceive {
@@ -1650,7 +1650,7 @@ mod tests {
16501650
};
16511651
let handle_result = handle(&mut deps, mock_env("alice", &[]), handle_msg);
16521652
let error = extract_error_msg(handle_result);
1653-
assert!(error.contains("Insufficient allowance"));
1653+
assert!(error.contains("insufficient allowance"));
16541654
}
16551655

16561656
#[test]
@@ -1673,7 +1673,7 @@ mod tests {
16731673
};
16741674
let handle_result = handle(&mut deps, mock_env("alice", &[]), handle_msg);
16751675
let error = extract_error_msg(handle_result);
1676-
assert!(error.contains("Insufficient allowance"));
1676+
assert!(error.contains("insufficient allowance"));
16771677

16781678
// Burn more than allowance
16791679
let handle_msg = HandleMsg::IncreaseAllowance {
@@ -1695,7 +1695,7 @@ mod tests {
16951695
};
16961696
let handle_result = handle(&mut deps, mock_env("alice", &[]), handle_msg);
16971697
let error = extract_error_msg(handle_result);
1698-
assert!(error.contains("Insufficient allowance"));
1698+
assert!(error.contains("insufficient allowance"));
16991699

17001700
// Sanity check
17011701
let handle_msg = HandleMsg::BurnFrom {
@@ -1727,7 +1727,7 @@ mod tests {
17271727
};
17281728
let handle_result = handle(&mut deps, mock_env("alice", &[]), handle_msg);
17291729
let error = extract_error_msg(handle_result);
1730-
assert!(error.contains("Insufficient allowance"));
1730+
assert!(error.contains("insufficient allowance"));
17311731
}
17321732

17331733
#[test]

0 commit comments

Comments
 (0)