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

[3.22] Added 0 length name validation #695

Merged
merged 1 commit into from
Jun 12, 2019
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
1 change: 1 addition & 0 deletions contracts/tokens/SecurityToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ contract SecurityToken is ERC20, ReentrancyGuard, SecurityTokenStorage, IERC1594
*/
function changeName(string calldata _name) external {
_onlyOwner();
require(bytes(_name).length > 0);
emit UpdateTokenName(name, _name);
name = _name;
}
Expand Down
4 changes: 4 additions & 0 deletions test/o_security_token.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ contract("SecurityToken", async (accounts) => {
await catchRevert(I_SecurityToken.changeName("new token name"));
});

it("Should not allow 0 length name", async() => {
await catchRevert(I_SecurityToken.changeName("", { from: token_owner }));
});

it("Should allow authorized address to change name", async() => {
let snapId = await takeSnapshot();
await I_SecurityToken.changeName("new token name", { from: token_owner });
Expand Down