Verified contractPartial
Usernames
Address0x1ef5cc1a76bf3558bfe209a2ea8122e8b4f5ff80
- Balance
0 ETH
- Transactions
47
- Compiler
solc 0.4.18
- Same code
Only this contract
Details
- Compiler
- solc 0.4.18+commit.9cf6e910
- Language
- solidity
- Optimization
- No
- License
- Not stated
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 5,130,147
- Creation transaction
- 0x765a91a070…3d94d7ba59
Usernames.sol
pragma solidity ^0.4.18;
contract Usernames {
mapping(address => string) private usernames;
mapping(string => int) private dedupeList;
event NewUsername(address indexed _user, string indexed _username);
function Usernames() public {
}
function getUsername(address _user) public view returns (string) {
return usernames[_user];
}
function checkDupe(string _userName) public constant returns (int) {
return dedupeList[_userName];
}
function createUsername(string _userName) external returns (bool) {
require(bytes(usernames[msg.sender]).length == 0);
require(dedupeList[_userName] == 0);
require(bytes(_userName).length >= 3 && bytes(_userName).length <= 16);
usernames[msg.sender] = _userName;
dedupeList[_userName] = 1;
NewUsername(msg.sender, _userName);
return true;
}
}Compiler settingsShow
{
"optimizer": {
"runs": 0,
"enabled": false
}
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.