simplify contract

This commit is contained in:
Ricardo Guilherme Schmidt 2019-05-30 20:08:27 -03:00
parent d719ee40c4
commit cb61c768b7
No known key found for this signature in database
GPG Key ID: 3F95A3AD0B607030

View File

@ -1,7 +1,6 @@
pragma solidity >=0.5.0 <0.6.0;
import "../common/Controlled.sol";
import "../token/ERC20Token.sol";
import "../ens/ENS.sol";
/**
@ -13,7 +12,7 @@ contract RegistrarMigration is Controlled {
ENS public ensRegistry;
bytes32 public ensNode;
address public parentRegistry;
/**
* @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 _ensNode ensNode to be automatically transferred on migration from UsernameRegistrar to Controller
* @param _parentRegistry contract allowed to interact with this
*/
constructor(
ENS _ensRegistry,
@ -40,74 +40,13 @@ contract RegistrarMigration is Controlled {
parentRegistry = _parentRegistry;
}
/**
* @notice Transfers _domainHash ENS node to _beneficiary
* @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);
}
}
* @notice Controller can do anything.
*/
function execute(address _to, uint256 _value, bytes calldata _data) external onlyController {
_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.
**/
@ -120,5 +59,4 @@ contract RegistrarMigration is Controlled {
ensRegistry.setOwner(ensNode, controller);
}
}