mirror of
https://github.com/status-im/ens-usernames.git
synced 2025-02-21 06:38:09 +00:00
bump to solc 0.5.4
This commit is contained in:
parent
7842023a8d
commit
ead468714e
@ -1,22 +1,22 @@
|
||||
pragma solidity ^0.4.24;
|
||||
pragma solidity >=0.5.0 <0.6.0;
|
||||
|
||||
contract Controlled {
|
||||
/// @notice The address of the controller is the only address that can call
|
||||
/// a function with this modifier
|
||||
modifier onlyController {
|
||||
require(msg.sender == controller);
|
||||
_;
|
||||
modifier onlyController {
|
||||
require(msg.sender == controller, "Unauthorized");
|
||||
_;
|
||||
}
|
||||
|
||||
address public controller;
|
||||
address payable public controller;
|
||||
|
||||
constructor() internal {
|
||||
controller = msg.sender;
|
||||
constructor() internal {
|
||||
controller = msg.sender;
|
||||
}
|
||||
|
||||
/// @notice Changes the controller of the contract
|
||||
/// @param _newController The new controller of the contract
|
||||
function changeController(address _newController) public onlyController {
|
||||
function changeController(address payable _newController) public onlyController {
|
||||
controller = _newController;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.4.24;
|
||||
pragma solidity >=0.5.0 <0.6.0;
|
||||
|
||||
|
||||
/**
|
||||
@ -15,7 +15,7 @@ library MerkleProof {
|
||||
* @param _leaf Leaf of Merkle tree
|
||||
*/
|
||||
function verifyProof(
|
||||
bytes32[] _proof,
|
||||
bytes32[] memory _proof,
|
||||
bytes32 _root,
|
||||
bytes32 _leaf
|
||||
)
|
||||
|
@ -1,13 +1,11 @@
|
||||
pragma solidity ^0.4.24;
|
||||
pragma solidity >=0.5.0 <0.6.0;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @notice Uses ethereum signed messages
|
||||
*/
|
||||
contract MessageSigned {
|
||||
|
||||
constructor() internal {
|
||||
|
||||
}
|
||||
constructor() internal {}
|
||||
|
||||
/**
|
||||
* @notice recovers address who signed the message
|
||||
@ -15,12 +13,12 @@ contract MessageSigned {
|
||||
* @param _messageSignature message `_signHash` signature
|
||||
*/
|
||||
function recoverAddress(
|
||||
bytes32 _signHash,
|
||||
bytes _messageSignature
|
||||
bytes32 _signHash,
|
||||
bytes memory _messageSignature
|
||||
)
|
||||
internal
|
||||
pure
|
||||
returns(address)
|
||||
returns(address)
|
||||
{
|
||||
uint8 v;
|
||||
bytes32 r;
|
||||
@ -42,21 +40,22 @@ contract MessageSigned {
|
||||
function getSignHash(
|
||||
bytes32 _hash
|
||||
)
|
||||
pure
|
||||
internal
|
||||
pure
|
||||
returns (bytes32 signHash)
|
||||
{
|
||||
signHash = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", _hash));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev divides bytes signature into `uint8 v, bytes32 r, bytes32 s`
|
||||
* @dev divides bytes signature into `uint8 v, bytes32 r, bytes32 s`
|
||||
*/
|
||||
function signatureSplit(bytes _signature)
|
||||
pure
|
||||
function signatureSplit(bytes memory _signature)
|
||||
internal
|
||||
pure
|
||||
returns (uint8 v, bytes32 r, bytes32 s)
|
||||
{
|
||||
require(_signature.length == 65, "Bad signature length");
|
||||
// The signature format is a compact form of:
|
||||
// {bytes32 r}{bytes32 s}{uint8 v}
|
||||
// Compact means, uint8 is not padded to 32 bytes.
|
||||
@ -70,8 +69,10 @@ contract MessageSigned {
|
||||
// use the second best option, 'and'
|
||||
v := and(mload(add(_signature, 65)), 0xff)
|
||||
}
|
||||
|
||||
require(v == 27 || v == 28);
|
||||
if (v < 27) {
|
||||
v += 27;
|
||||
}
|
||||
require(v == 27 || v == 28, "Bad signature version");
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.4.24;
|
||||
pragma solidity >=0.5.0 <0.6.0;
|
||||
|
||||
/// @dev `Owned` is a base level contract that assigns an `owner` that can be
|
||||
/// later changed
|
||||
@ -7,23 +7,23 @@ contract Owned {
|
||||
/// @dev `owner` is the only address that can call a function with this
|
||||
/// modifier
|
||||
modifier onlyOwner() {
|
||||
require(msg.sender == owner);
|
||||
require(msg.sender == owner, "Unauthorized");
|
||||
_;
|
||||
}
|
||||
|
||||
address public owner;
|
||||
address payable public owner;
|
||||
|
||||
/// @notice The Constructor assigns the message sender to be `owner`
|
||||
constructor() internal {
|
||||
owner = msg.sender;
|
||||
}
|
||||
|
||||
address public newOwner;
|
||||
address payable public newOwner;
|
||||
|
||||
/// @notice `owner` can step down and assign some other address to this role
|
||||
/// @param _newOwner The address of the new owner. 0x0 can be used to create
|
||||
/// an unowned neutral vault, however that cannot be undone
|
||||
function changeOwner(address _newOwner) public onlyOwner {
|
||||
function changeOwner(address payable _newOwner) public onlyOwner {
|
||||
newOwner = _newOwner;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.4.24;
|
||||
pragma solidity >=0.5.0 <0.6.0;
|
||||
|
||||
/**
|
||||
* Math operations with safety checks
|
||||
|
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.4.24;
|
||||
pragma solidity >=0.5.0 <0.6.0;
|
||||
|
||||
interface ENS {
|
||||
|
||||
@ -15,12 +15,12 @@ interface ENS {
|
||||
event NewTTL(bytes32 indexed node, uint64 ttl);
|
||||
|
||||
|
||||
function setSubnodeOwner(bytes32 node, bytes32 label, address owner) public;
|
||||
function setResolver(bytes32 node, address resolver) public;
|
||||
function setOwner(bytes32 node, address owner) public;
|
||||
function setTTL(bytes32 node, uint64 ttl) public;
|
||||
function owner(bytes32 node) public view returns (address);
|
||||
function resolver(bytes32 node) public view returns (address);
|
||||
function ttl(bytes32 node) public view returns (uint64);
|
||||
function setSubnodeOwner(bytes32 node, bytes32 label, address owner) external;
|
||||
function setResolver(bytes32 node, address resolver) external;
|
||||
function setOwner(bytes32 node, address owner) external;
|
||||
function setTTL(bytes32 node, uint64 ttl) external;
|
||||
function owner(bytes32 node) external view returns (address);
|
||||
function resolver(bytes32 node) external view returns (address);
|
||||
function ttl(bytes32 node) external view returns (uint64);
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.4.24;
|
||||
pragma solidity >=0.5.0 <0.6.0;
|
||||
|
||||
import "./ENS.sol";
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.4.24;
|
||||
pragma solidity >=0.5.0 <0.6.0;
|
||||
|
||||
import "./ENS.sol";
|
||||
|
||||
@ -10,20 +10,20 @@ contract PublicResolver {
|
||||
|
||||
bytes4 constant INTERFACE_META_ID = 0x01ffc9a7;
|
||||
bytes4 constant ADDR_INTERFACE_ID = 0x3b3b57de;
|
||||
bytes4 constant CONTENT_INTERFACE_ID = 0xd8389dc5;
|
||||
bytes4 constant NAME_INTERFACE_ID = 0x691f3431;
|
||||
bytes4 constant ABI_INTERFACE_ID = 0x2203ab56;
|
||||
bytes4 constant PUBKEY_INTERFACE_ID = 0xc8690233;
|
||||
bytes4 constant TEXT_INTERFACE_ID = 0x59d1d43c;
|
||||
bytes4 constant MULTIHASH_INTERFACE_ID = 0xe89401a1;
|
||||
bytes4 constant CONTENTHASH_INTERFACE_ID = 0xbc1c58d1;
|
||||
bytes4 constant INTERFACE_INTERFACE_ID = bytes4(keccak256("interfaceImplementer(bytes32,bytes4)"));
|
||||
|
||||
event AddrChanged(bytes32 indexed node, address a);
|
||||
event ContentChanged(bytes32 indexed node, bytes32 hash);
|
||||
event NameChanged(bytes32 indexed node, string name);
|
||||
event ABIChanged(bytes32 indexed node, uint256 indexed contentType);
|
||||
event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);
|
||||
event TextChanged(bytes32 indexed node, string indexedKey, string key);
|
||||
event MultihashChanged(bytes32 indexed node, bytes hash);
|
||||
event ContenthashChanged(bytes32 indexed node, bytes hash);
|
||||
event InterfaceChanged(bytes32 indexed node, bytes4 indexed interfaceID, address implementer);
|
||||
|
||||
struct PublicKey {
|
||||
bytes32 x;
|
||||
@ -32,19 +32,19 @@ contract PublicResolver {
|
||||
|
||||
struct Record {
|
||||
address addr;
|
||||
bytes32 content;
|
||||
string name;
|
||||
PublicKey pubkey;
|
||||
mapping(string=>string) text;
|
||||
mapping(uint256=>bytes) abis;
|
||||
bytes multihash;
|
||||
bytes contenthash;
|
||||
mapping(bytes4=>address) interfaces;
|
||||
}
|
||||
|
||||
ENS ens;
|
||||
|
||||
mapping (bytes32 => Record) records;
|
||||
|
||||
modifier only_owner(bytes32 node) {
|
||||
modifier onlyOwner(bytes32 node) {
|
||||
require(ens.owner(node) == msg.sender);
|
||||
_;
|
||||
}
|
||||
@ -63,42 +63,29 @@ contract PublicResolver {
|
||||
* @param node The node to update.
|
||||
* @param addr The address to set.
|
||||
*/
|
||||
function setAddr(bytes32 node, address addr) public only_owner(node) {
|
||||
function setAddr(bytes32 node, address addr) external onlyOwner(node) {
|
||||
records[node].addr = addr;
|
||||
emit AddrChanged(node, addr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the content hash associated with an ENS node.
|
||||
* Sets the contenthash associated with an ENS node.
|
||||
* May only be called by the owner of that node in the ENS registry.
|
||||
* Note that this resource type is not standardized, and will likely change
|
||||
* in future to a resource type based on multihash.
|
||||
* @param node The node to update.
|
||||
* @param hash The content hash to set
|
||||
* @param hash The contenthash to set
|
||||
*/
|
||||
function setContent(bytes32 node, bytes32 hash) public only_owner(node) {
|
||||
records[node].content = hash;
|
||||
emit ContentChanged(node, hash);
|
||||
function setContenthash(bytes32 node, bytes calldata hash) external onlyOwner(node) {
|
||||
records[node].contenthash = hash;
|
||||
emit ContenthashChanged(node, hash);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the multihash associated with an ENS node.
|
||||
* May only be called by the owner of that node in the ENS registry.
|
||||
* @param node The node to update.
|
||||
* @param hash The multihash to set
|
||||
*/
|
||||
function setMultihash(bytes32 node, bytes hash) public only_owner(node) {
|
||||
records[node].multihash = hash;
|
||||
emit MultihashChanged(node, hash);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name associated with an ENS node, for reverse records.
|
||||
* May only be called by the owner of that node in the ENS registry.
|
||||
* @param node The node to update.
|
||||
* @param name The name to set.
|
||||
*/
|
||||
function setName(bytes32 node, string name) public only_owner(node) {
|
||||
function setName(bytes32 node, string calldata name) external onlyOwner(node) {
|
||||
records[node].name = name;
|
||||
emit NameChanged(node, name);
|
||||
}
|
||||
@ -111,21 +98,21 @@ contract PublicResolver {
|
||||
* @param contentType The content type of the ABI
|
||||
* @param data The ABI data.
|
||||
*/
|
||||
function setABI(bytes32 node, uint256 contentType, bytes data) public only_owner(node) {
|
||||
function setABI(bytes32 node, uint256 contentType, bytes calldata data) external onlyOwner(node) {
|
||||
// Content types must be powers of 2
|
||||
require(((contentType - 1) & contentType) == 0);
|
||||
|
||||
|
||||
records[node].abis[contentType] = data;
|
||||
emit ABIChanged(node, contentType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the SECP256k1 public key associated with an ENS node.
|
||||
* @param node The ENS node to query
|
||||
* @param x the X coordinate of the curve point for the public key.
|
||||
* @param y the Y coordinate of the curve point for the public key.
|
||||
*/
|
||||
function setPubkey(bytes32 node, bytes32 x, bytes32 y) public only_owner(node) {
|
||||
function setPubkey(bytes32 node, bytes32 x, bytes32 y) external onlyOwner(node) {
|
||||
records[node].pubkey = PublicKey(x, y);
|
||||
emit PubkeyChanged(node, x, y);
|
||||
}
|
||||
@ -137,18 +124,30 @@ contract PublicResolver {
|
||||
* @param key The key to set.
|
||||
* @param value The text data value to set.
|
||||
*/
|
||||
function setText(bytes32 node, string key, string value) public only_owner(node) {
|
||||
function setText(bytes32 node, string calldata key, string calldata value) external onlyOwner(node) {
|
||||
records[node].text[key] = value;
|
||||
emit TextChanged(node, key, key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an interface associated with a name.
|
||||
* Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.
|
||||
* @param node The node to update.
|
||||
* @param interfaceID The EIP 168 interface ID.
|
||||
* @param implementer The address of a contract that implements this interface for this node.
|
||||
*/
|
||||
function setInterface(bytes32 node, bytes4 interfaceID, address implementer) external onlyOwner(node) {
|
||||
records[node].interfaces[interfaceID] = implementer;
|
||||
emit InterfaceChanged(node, interfaceID, implementer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the text data associated with an ENS node and key.
|
||||
* @param node The ENS node to query.
|
||||
* @param key The text data key to query.
|
||||
* @return The associated text data.
|
||||
*/
|
||||
function text(bytes32 node, string key) public view returns (string) {
|
||||
function text(bytes32 node, string calldata key) external view returns (string memory) {
|
||||
return records[node].text[key];
|
||||
}
|
||||
|
||||
@ -158,7 +157,7 @@ contract PublicResolver {
|
||||
* @param node The ENS node to query
|
||||
* @return x, y the X and Y coordinates of the curve point for the public key.
|
||||
*/
|
||||
function pubkey(bytes32 node) public view returns (bytes32 x, bytes32 y) {
|
||||
function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y) {
|
||||
return (records[node].pubkey.x, records[node].pubkey.y);
|
||||
}
|
||||
|
||||
@ -170,15 +169,17 @@ contract PublicResolver {
|
||||
* @return contentType The content type of the return value
|
||||
* @return data The ABI data
|
||||
*/
|
||||
function ABI(bytes32 node, uint256 contentTypes) public view returns (uint256 contentType, bytes data) {
|
||||
function ABI(bytes32 node, uint256 contentTypes) external view returns (uint256, bytes memory) {
|
||||
Record storage record = records[node];
|
||||
for (contentType = 1; contentType <= contentTypes; contentType <<= 1) {
|
||||
|
||||
for (uint256 contentType = 1; contentType <= contentTypes; contentType <<= 1) {
|
||||
if ((contentType & contentTypes) != 0 && record.abis[contentType].length > 0) {
|
||||
data = record.abis[contentType];
|
||||
return;
|
||||
return (contentType, record.abis[contentType]);
|
||||
}
|
||||
}
|
||||
contentType = 0;
|
||||
|
||||
bytes memory empty;
|
||||
return (0, empty);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -187,30 +188,10 @@ contract PublicResolver {
|
||||
* @param node The ENS node to query.
|
||||
* @return The associated name.
|
||||
*/
|
||||
function name(bytes32 node) public view returns (string) {
|
||||
function name(bytes32 node) external view returns (string memory) {
|
||||
return records[node].name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the content hash associated with an ENS node.
|
||||
* Note that this resource type is not standardized, and will likely change
|
||||
* in future to a resource type based on multihash.
|
||||
* @param node The ENS node to query.
|
||||
* @return The associated content hash.
|
||||
*/
|
||||
function content(bytes32 node) public view returns (bytes32) {
|
||||
return records[node].content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the multihash associated with an ENS node.
|
||||
* @param node The ENS node to query.
|
||||
* @return The associated multihash.
|
||||
*/
|
||||
function multihash(bytes32 node) public view returns (bytes) {
|
||||
return records[node].multihash;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the address associated with an ENS node.
|
||||
* @param node The ENS node to query.
|
||||
@ -220,19 +201,64 @@ contract PublicResolver {
|
||||
return records[node].addr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the contenthash associated with an ENS node.
|
||||
* @param node The ENS node to query.
|
||||
* @return The associated contenthash.
|
||||
*/
|
||||
function contenthash(bytes32 node) external view returns (bytes memory) {
|
||||
return records[node].contenthash;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the address of a contract that implements the specified interface for this name.
|
||||
* If an implementer has not been set for this interfaceID and name, the resolver will query
|
||||
* the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that
|
||||
* contract implements EIP168 and returns `true` for the specified interfaceID, its address
|
||||
* will be returned.
|
||||
* @param node The ENS node to query.
|
||||
* @param interfaceID The EIP 168 interface ID to check for.
|
||||
* @return The address that implements this interface, or 0 if the interface is unsupported.
|
||||
*/
|
||||
function interfaceImplementer(bytes32 node, bytes4 interfaceID) external view returns (address) {
|
||||
address implementer = records[node].interfaces[interfaceID];
|
||||
if(implementer != address(0)) {
|
||||
return implementer;
|
||||
}
|
||||
|
||||
address a = addr(node);
|
||||
if(a == address(0)) {
|
||||
return address(0);
|
||||
}
|
||||
|
||||
(bool success, bytes memory returnData) = a.staticcall(abi.encodeWithSignature("supportsInterface(bytes4)", INTERFACE_META_ID));
|
||||
if(!success || returnData.length < 32 || returnData[31] == 0) {
|
||||
// EIP 168 not supported by target
|
||||
return address(0);
|
||||
}
|
||||
|
||||
(success, returnData) = a.staticcall(abi.encodeWithSignature("supportsInterface(bytes4)", interfaceID));
|
||||
if(!success || returnData.length < 32 || returnData[31] == 0) {
|
||||
// Specified interface not supported by target
|
||||
return address(0);
|
||||
}
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the resolver implements the interface specified by the provided hash.
|
||||
* @param interfaceID The ID of the interface to check for.
|
||||
* @return True if the contract implements the requested interface.
|
||||
*/
|
||||
function supportsInterface(bytes4 interfaceID) public pure returns (bool) {
|
||||
function supportsInterface(bytes4 interfaceID) external pure returns (bool) {
|
||||
return interfaceID == ADDR_INTERFACE_ID ||
|
||||
interfaceID == CONTENT_INTERFACE_ID ||
|
||||
interfaceID == NAME_INTERFACE_ID ||
|
||||
interfaceID == ABI_INTERFACE_ID ||
|
||||
interfaceID == PUBKEY_INTERFACE_ID ||
|
||||
interfaceID == TEXT_INTERFACE_ID ||
|
||||
interfaceID == MULTIHASH_INTERFACE_ID ||
|
||||
interfaceID == CONTENTHASH_INTERFACE_ID ||
|
||||
interfaceID == INTERFACE_INTERFACE_ID ||
|
||||
interfaceID == INTERFACE_META_ID;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.4.24;
|
||||
pragma solidity >=0.5.0 <0.6.0;
|
||||
|
||||
contract ResolverInterface {
|
||||
function PublicResolver(address ensAddr) public;
|
||||
|
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.4.24;
|
||||
pragma solidity >=0.5.0 <0.6.0;
|
||||
|
||||
import "../common/MerkleProof.sol";
|
||||
import "../common/Controlled.sol";
|
||||
@ -154,8 +154,8 @@ contract UsernameRegistrar is Controlled, ApproveAndCallFallBack {
|
||||
} else {
|
||||
address newOwner = ensRegistry.owner(ensNode);
|
||||
//Low level call, case dropUsername not implemented or failing, proceed release.
|
||||
//Invert (!) to supress warning, return of this call have no use.
|
||||
!newOwner.call.gas(80000)(
|
||||
//Return of this call have no use.
|
||||
newOwner.call.gas(80000)(
|
||||
abi.encodeWithSignature(
|
||||
"dropUsername(bytes32)",
|
||||
_label
|
||||
@ -198,7 +198,7 @@ contract UsernameRegistrar is Controlled, ApproveAndCallFallBack {
|
||||
* @param _username Raw value of offending username.
|
||||
*/
|
||||
function slashSmallUsername(
|
||||
string _username,
|
||||
string calldata _username,
|
||||
uint256 _reserveSecret
|
||||
)
|
||||
external
|
||||
@ -213,7 +213,7 @@ contract UsernameRegistrar is Controlled, ApproveAndCallFallBack {
|
||||
* @param _username Raw value of offending username.
|
||||
*/
|
||||
function slashAddressLikeUsername(
|
||||
string _username,
|
||||
string calldata _username,
|
||||
uint256 _reserveSecret
|
||||
)
|
||||
external
|
||||
@ -224,7 +224,7 @@ contract UsernameRegistrar is Controlled, ApproveAndCallFallBack {
|
||||
require(username[1] == byte("x"), "Second character need to be x");
|
||||
for(uint i = 2; i < 7; i++){
|
||||
byte b = username[i];
|
||||
require((b >= 48 && b <= 57) || (b >= 97 && b <= 102), "Does not look like an address");
|
||||
require((b >= 0x30 && b <= 0x39) || (b >= 0x61 && b <= 0x66), "Does not look like an address");
|
||||
}
|
||||
slashUsername(username, _reserveSecret);
|
||||
}
|
||||
@ -235,8 +235,8 @@ contract UsernameRegistrar is Controlled, ApproveAndCallFallBack {
|
||||
* @param _proof Merkle proof that name is listed on merkle tree.
|
||||
*/
|
||||
function slashReservedUsername(
|
||||
string _username,
|
||||
bytes32[] _proof,
|
||||
string calldata _username,
|
||||
bytes32[] calldata _proof,
|
||||
uint256 _reserveSecret
|
||||
)
|
||||
external
|
||||
@ -259,7 +259,7 @@ contract UsernameRegistrar is Controlled, ApproveAndCallFallBack {
|
||||
* @param _offendingPos Position of non alphanumeric character.
|
||||
*/
|
||||
function slashInvalidUsername(
|
||||
string _username,
|
||||
string calldata _username,
|
||||
uint256 _offendingPos,
|
||||
uint256 _reserveSecret
|
||||
)
|
||||
@ -269,7 +269,7 @@ contract UsernameRegistrar is Controlled, ApproveAndCallFallBack {
|
||||
require(username.length > _offendingPos, "Invalid position.");
|
||||
byte b = username[_offendingPos];
|
||||
|
||||
require(!((b >= 48 && b <= 57) || (b >= 97 && b <= 122)), "Not invalid character.");
|
||||
require(!((b >= 0x30 && b <= 0x39) || (b >= 0x61 && b <= 0x7A)), "Not invalid character.");
|
||||
|
||||
slashUsername(username, _reserveSecret);
|
||||
}
|
||||
@ -279,7 +279,7 @@ contract UsernameRegistrar is Controlled, ApproveAndCallFallBack {
|
||||
* @param _labels Sequence to erase.
|
||||
*/
|
||||
function eraseNode(
|
||||
bytes32[] _labels
|
||||
bytes32[] calldata _labels
|
||||
)
|
||||
external
|
||||
{
|
||||
@ -292,8 +292,8 @@ contract UsernameRegistrar is Controlled, ApproveAndCallFallBack {
|
||||
if(len > 1) {
|
||||
eraseNodeHierarchy(len - 2, _labels, subnode);
|
||||
}
|
||||
ensRegistry.setResolver(subnode, 0);
|
||||
ensRegistry.setOwner(subnode, 0);
|
||||
ensRegistry.setResolver(subnode, address(0));
|
||||
ensRegistry.setOwner(subnode, address(0));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -312,7 +312,7 @@ contract UsernameRegistrar is Controlled, ApproveAndCallFallBack {
|
||||
Account memory account = accounts[_label];
|
||||
delete accounts[_label];
|
||||
|
||||
token.approve(_newRegistry, account.balance);
|
||||
token.approve(address(_newRegistry), account.balance);
|
||||
_newRegistry.migrateUsername(
|
||||
_label,
|
||||
account.balance,
|
||||
@ -380,9 +380,9 @@ contract UsernameRegistrar is Controlled, ApproveAndCallFallBack {
|
||||
require(_newRegistry != this, "Cannot move to self.");
|
||||
require(ensRegistry.owner(ensNode) == address(this), "Registry not owned anymore.");
|
||||
setState(RegistrarState.Moved);
|
||||
ensRegistry.setOwner(ensNode, _newRegistry);
|
||||
ensRegistry.setOwner(ensNode, address(_newRegistry));
|
||||
_newRegistry.migrateRegistry(price);
|
||||
emit RegistryMoved(_newRegistry);
|
||||
emit RegistryMoved(address(_newRegistry));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -410,7 +410,7 @@ contract UsernameRegistrar is Controlled, ApproveAndCallFallBack {
|
||||
**/
|
||||
function withdrawExcessBalance(
|
||||
address _token,
|
||||
address _beneficiary
|
||||
address payable _beneficiary
|
||||
)
|
||||
external
|
||||
onlyController
|
||||
@ -544,7 +544,7 @@ contract UsernameRegistrar is Controlled, ApproveAndCallFallBack {
|
||||
address _from,
|
||||
uint256 _amount,
|
||||
address _token,
|
||||
bytes _data
|
||||
bytes memory _data
|
||||
)
|
||||
public
|
||||
{
|
||||
@ -654,7 +654,7 @@ contract UsernameRegistrar is Controlled, ApproveAndCallFallBack {
|
||||
if (resolvePubkey || resolveAccount) {
|
||||
//set to self the ownership to setup initial resolver
|
||||
ensRegistry.setSubnodeOwner(ensNode, _label, address(this));
|
||||
ensRegistry.setResolver(namehash, resolver); //default resolver
|
||||
ensRegistry.setResolver(namehash, address(resolver)); //default resolver
|
||||
if (resolveAccount) {
|
||||
resolver.setAddr(namehash, _account);
|
||||
}
|
||||
@ -674,7 +674,7 @@ contract UsernameRegistrar is Controlled, ApproveAndCallFallBack {
|
||||
* @param _username Username being slashed.
|
||||
*/
|
||||
function slashUsername(
|
||||
bytes _username,
|
||||
bytes memory _username,
|
||||
uint256 _reserveSecret
|
||||
)
|
||||
internal
|
||||
@ -728,7 +728,7 @@ contract UsernameRegistrar is Controlled, ApproveAndCallFallBack {
|
||||
*/
|
||||
function eraseNodeHierarchy(
|
||||
uint _idx,
|
||||
bytes32[] _labels,
|
||||
bytes32[] memory _labels,
|
||||
bytes32 _subnode
|
||||
)
|
||||
private
|
||||
@ -743,8 +743,8 @@ contract UsernameRegistrar is Controlled, ApproveAndCallFallBack {
|
||||
}
|
||||
|
||||
// Erase the resolver and owner records
|
||||
ensRegistry.setResolver(subnode, 0);
|
||||
ensRegistry.setOwner(subnode, 0);
|
||||
ensRegistry.setResolver(subnode, address(0));
|
||||
ensRegistry.setOwner(subnode, address(0));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -753,7 +753,7 @@ contract UsernameRegistrar is Controlled, ApproveAndCallFallBack {
|
||||
* @return Decoded registry call.
|
||||
*/
|
||||
function abiDecodeRegister(
|
||||
bytes _data
|
||||
bytes memory _data
|
||||
)
|
||||
private
|
||||
pure
|
||||
|
@ -1,12 +1,12 @@
|
||||
pragma solidity ^0.4.24;
|
||||
pragma solidity >=0.5.0 <0.6.0;
|
||||
|
||||
import { MerkleProof } from "../common/MerkleProof.sol";
|
||||
import "../common/MerkleProof.sol";
|
||||
|
||||
|
||||
contract MerkleProofWrapper {
|
||||
|
||||
function verifyProof(
|
||||
bytes32[] _proof,
|
||||
bytes32[] memory _proof,
|
||||
bytes32 _root,
|
||||
bytes32 _leaf
|
||||
)
|
||||
|
@ -1,5 +1,5 @@
|
||||
pragma solidity ^0.4.24;
|
||||
pragma solidity >=0.5.0 <0.6.0;
|
||||
|
||||
contract ApproveAndCallFallBack {
|
||||
function receiveApproval(address from, uint256 _amount, address _token, bytes _data) public;
|
||||
function receiveApproval(address from, uint256 _amount, address _token, bytes memory _data) public;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.4.24;
|
||||
pragma solidity >=0.5.0 <0.6.0;
|
||||
|
||||
import "./ERC20Token.sol";
|
||||
|
||||
@ -43,7 +43,7 @@ contract ERC20Receiver {
|
||||
)
|
||||
external
|
||||
{
|
||||
require(_token.allowance(msg.sender, address(this)) >= _amount);
|
||||
require(_token.allowance(msg.sender, address(this)) >= _amount, "Bad argument");
|
||||
_depositToken(msg.sender, _token, _amount);
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ contract ERC20Receiver {
|
||||
)
|
||||
private
|
||||
{
|
||||
require(_amount > 0);
|
||||
require(_amount > 0, "Bad argument");
|
||||
if (_token.transferFrom(_from, address(this), _amount)) {
|
||||
tokenBalances[address(_token)][_from] += _amount;
|
||||
emit TokenDeposited(address(_token), _from, _amount);
|
||||
@ -79,10 +79,10 @@ contract ERC20Receiver {
|
||||
)
|
||||
private
|
||||
{
|
||||
require(_amount > 0);
|
||||
require(tokenBalances[address(_token)][_from] >= _amount);
|
||||
require(_amount > 0, "Bad argument");
|
||||
require(tokenBalances[address(_token)][_from] >= _amount, "Insufficient funds");
|
||||
tokenBalances[address(_token)][_from] -= _amount;
|
||||
require(_token.transfer(_from, _amount));
|
||||
require(_token.transfer(_from, _amount), "Transfer fail");
|
||||
emit TokenWithdrawn(address(_token), _from, _amount);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.4.24;
|
||||
pragma solidity >=0.5.0 <0.6.0;
|
||||
|
||||
// Abstract contract for the full ERC 20 Token standard
|
||||
// https://github.com/ethereum/EIPs/issues/20
|
||||
|
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.4.24;
|
||||
pragma solidity >=0.5.0 <0.6.0;
|
||||
|
||||
import "./ERC20Token.sol";
|
||||
|
||||
@ -71,7 +71,7 @@ contract StandardToken is ERC20Token {
|
||||
{
|
||||
return supply;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @dev Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender.
|
||||
* @param _from The address that is approving the spend
|
||||
@ -99,7 +99,7 @@ contract StandardToken is ERC20Token {
|
||||
{
|
||||
balances[_to] += _amount;
|
||||
supply += _amount;
|
||||
emit Transfer(0x0, _to, _amount);
|
||||
emit Transfer(address(0x0), _to, _amount);
|
||||
}
|
||||
|
||||
function transfer(
|
||||
@ -116,7 +116,7 @@ contract StandardToken is ERC20Token {
|
||||
supply -= _value;
|
||||
} else {
|
||||
balances[_to] += _value;
|
||||
}
|
||||
}
|
||||
emit Transfer(_from, _to, _value);
|
||||
return true;
|
||||
} else {
|
||||
|
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.4.24;
|
||||
pragma solidity >=0.5.0 <0.6.0;
|
||||
|
||||
import "./StandardToken.sol";
|
||||
import "./ApproveAndCallFallBack.sol";
|
||||
@ -18,12 +18,13 @@ contract TestToken is StandardToken {
|
||||
mint(msg.sender, _amount);
|
||||
}
|
||||
|
||||
function approveAndCall(address _spender, uint256 _value, bytes _extraData)
|
||||
external
|
||||
|
||||
function approveAndCall(address _spender, uint256 _value, bytes calldata _extraData)
|
||||
external
|
||||
returns (bool success)
|
||||
{
|
||||
approve(msg.sender, _spender, _value);
|
||||
ApproveAndCallFallBack(_spender).receiveApproval(msg.sender, _value, this, _extraData);
|
||||
ApproveAndCallFallBack(_spender).receiveApproval(msg.sender, _value, address(this), _extraData);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
"config": "config/",
|
||||
"versions": {
|
||||
"web3": "1.0.0-beta",
|
||||
"solc": "0.4.24",
|
||||
"solc": "0.5.4",
|
||||
"ipfs-api": "17.2.4"
|
||||
},
|
||||
"plugins": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user