mirror of
https://github.com/status-im/ens-usernames.git
synced 2025-02-22 15:18:14 +00:00
simplify contract
This commit is contained in:
parent
d719ee40c4
commit
cb61c768b7
@ -1,7 +1,6 @@
|
|||||||
pragma solidity >=0.5.0 <0.6.0;
|
pragma solidity >=0.5.0 <0.6.0;
|
||||||
|
|
||||||
import "../common/Controlled.sol";
|
import "../common/Controlled.sol";
|
||||||
import "../token/ERC20Token.sol";
|
|
||||||
import "../ens/ENS.sol";
|
import "../ens/ENS.sol";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -13,7 +12,7 @@ contract RegistrarMigration is Controlled {
|
|||||||
ENS public ensRegistry;
|
ENS public ensRegistry;
|
||||||
bytes32 public ensNode;
|
bytes32 public ensNode;
|
||||||
address public parentRegistry;
|
address public parentRegistry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notice Callable only by `parentRegistry()` to continue migration of ENSSubdomainRegistry.
|
* @notice Callable only by `parentRegistry()` to continue migration of ENSSubdomainRegistry.
|
||||||
*/
|
*/
|
||||||
@ -25,6 +24,7 @@ contract RegistrarMigration is Controlled {
|
|||||||
/**
|
/**
|
||||||
* @param _ensRegistry Ethereum Name Service root contract address.
|
* @param _ensRegistry Ethereum Name Service root contract address.
|
||||||
* @param _ensNode ensNode to be automatically transferred on migration from UsernameRegistrar to Controller
|
* @param _ensNode ensNode to be automatically transferred on migration from UsernameRegistrar to Controller
|
||||||
|
* @param _parentRegistry contract allowed to interact with this
|
||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
ENS _ensRegistry,
|
ENS _ensRegistry,
|
||||||
@ -40,74 +40,13 @@ contract RegistrarMigration is Controlled {
|
|||||||
parentRegistry = _parentRegistry;
|
parentRegistry = _parentRegistry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notice Transfers _domainHash ENS node to _beneficiary
|
* @notice Controller can do anything.
|
||||||
* @param _domainHash Ens node namehash.
|
*/
|
||||||
* @param _beneficiary New owner of ens node.
|
|
||||||
**/
|
|
||||||
function transferENSNode(
|
|
||||||
bytes32 _domainHash,
|
|
||||||
address _beneficiary
|
|
||||||
)
|
|
||||||
external
|
|
||||||
onlyController
|
|
||||||
{
|
|
||||||
require(_beneficiary != address(0), "Cannot burn node");
|
|
||||||
ensRegistry.setOwner(_domainHash, _beneficiary);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @notice Withdraw tokens
|
|
||||||
* @param _token Address of ERC20 withdrawing excess, or address(0) if want ETH.
|
|
||||||
* @param _beneficiary Address to send the funds.
|
|
||||||
**/
|
|
||||||
function transferTokens(
|
|
||||||
address _token,
|
|
||||||
address payable _beneficiary
|
|
||||||
)
|
|
||||||
external
|
|
||||||
onlyController
|
|
||||||
{
|
|
||||||
require(_beneficiary != address(0), "Cannot burn token");
|
|
||||||
if (_token == address(0)) {
|
|
||||||
_beneficiary.transfer(address(this).balance);
|
|
||||||
} else {
|
|
||||||
ERC20Token excessToken = ERC20Token(_token);
|
|
||||||
uint256 amount = excessToken.balanceOf(address(this));
|
|
||||||
require(amount > 0, "No balance");
|
|
||||||
excessToken.transfer(_beneficiary, amount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function execute(address _to, uint256 _value, bytes calldata _data) external onlyController {
|
function execute(address _to, uint256 _value, bytes calldata _data) external onlyController {
|
||||||
_to.call.value(_value)(_data);
|
_to.call.value(_value)(_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @notice Opt-out migration of username from `parentRegistry()`.
|
|
||||||
*/
|
|
||||||
function dropUsername(
|
|
||||||
bytes32
|
|
||||||
)
|
|
||||||
external
|
|
||||||
onlyParentRegistry
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
function migrateUsername(
|
|
||||||
bytes32,
|
|
||||||
uint256,
|
|
||||||
uint256,
|
|
||||||
address
|
|
||||||
)
|
|
||||||
external
|
|
||||||
onlyParentRegistry
|
|
||||||
{
|
|
||||||
revert("Disabled");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev callable only by parent registry to continue migration.
|
* @dev callable only by parent registry to continue migration.
|
||||||
**/
|
**/
|
||||||
@ -120,5 +59,4 @@ contract RegistrarMigration is Controlled {
|
|||||||
ensRegistry.setOwner(ensNode, controller);
|
ensRegistry.setOwner(ensNode, controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user