Skip to content

Commit

Permalink
Merge pull request #299 from CosmWasm/longer-ids-for-cw20-base
Browse files Browse the repository at this point in the history
Extend the allowed names and symbols for cw20-base
  • Loading branch information
ethanfrey authored Jun 23, 2021
2 parents 65649f7 + 840ffc6 commit ceb6259
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions contracts/cw20-base/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ impl InstantiateMsg {
// Check name, symbol, decimals
if !is_valid_name(&self.name) {
return Err(StdError::generic_err(
"Name is not in the expected format (3-30 UTF-8 bytes)",
"Name is not in the expected format (3-50 UTF-8 bytes)",
));
}
if !is_valid_symbol(&self.symbol) {
return Err(StdError::generic_err(
"Ticker symbol is not in expected format [A-Z]{3,6}",
"Ticker symbol is not in expected format [a-zA-Z\\-]{3,12}",
));
}
if self.decimals > 18 {
Expand All @@ -38,19 +38,19 @@ impl InstantiateMsg {

fn is_valid_name(name: &str) -> bool {
let bytes = name.as_bytes();
if bytes.len() < 3 || bytes.len() > 30 {
if bytes.len() < 3 || bytes.len() > 50 {
return false;
}
true
}

fn is_valid_symbol(symbol: &str) -> bool {
let bytes = symbol.as_bytes();
if bytes.len() < 3 || bytes.len() > 6 {
if bytes.len() < 3 || bytes.len() > 12 {
return false;
}
for byte in bytes.iter() {
if *byte < 65 || *byte > 90 {
if (*byte != 45) && (*byte < 65 || *byte > 90) && (*byte < 97 || *byte > 122) {
return false;
}
}
Expand Down

0 comments on commit ceb6259

Please sign in to comment.