Skip to content
Open
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
684 changes: 684 additions & 0 deletions contracts/l2/FuseController.sol

Large diffs are not rendered by default.

18 changes: 16 additions & 2 deletions contracts/l2/IController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
pragma solidity ^0.8.17;

interface IController {
function ownerOf(bytes calldata tokenData) external view returns (address);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of this change? Requiring controllers to implement both methods complicates them, and many will have to implement ownerOf simply by calling the registry back to fetch their data from it anywy.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It saves an external call.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In what circumstances?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

function ownerOf(bytes32 node) external view returns (address) {
        //get the tokenData
        bytes memory tokenData = registry.getData(uint256(node));
        (address owner, , , , ) = _unpack(tokenData);
        return owner;
    }

function ownerOfWithData(
bytes calldata tokenData
) external view returns (address);

function ownerOf(bytes32 node) external view returns (address);

function safeTransferFrom(
bytes calldata tokenData,
Expand All @@ -13,9 +17,19 @@ interface IController {
uint256 id,
uint256 value,
bytes calldata data,
bool operatorApproved
bool isApproved
) external returns (bytes memory);

function burn(
bytes calldata tokenData,
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data,
bool operatorApproved
) external view returns (bytes memory);

function balanceOf(
bytes calldata tokenData,
address owner,
Expand Down
9 changes: 9 additions & 0 deletions contracts/l2/IControllerUpgradeTarget.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.17;

import "./IController.sol";

interface IControllerUpgradeTarget is IController {
function upgradeFrom(bytes32 node, bytes calldata extraData) external;
}
29 changes: 29 additions & 0 deletions contracts/l2/IFuseController.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import "./IController.sol";
import "./IControllerUpgradeTarget.sol";

uint64 constant CAN_DO_EVERYTHING = 0;
uint64 constant CANNOT_BURN_NAME = 1;
uint64 constant CANNOT_BURN_FUSES = 2;
uint64 constant CANNOT_TRANSFER = 4;
uint64 constant CANNOT_SET_RESOLVER = 8;
uint64 constant CANNOT_CREATE_SUBDOMAIN = 16;
uint64 constant CANNOT_SET_RENEWAL_CONTROLLER = 32;
uint64 constant PARENT_CANNOT_SET_EXPIRY = 64;
uint64 constant PARENT_CANNOT_CONTROL = 128;

interface IFuseController is IController {
function expiryOf(bytes32 node) external view returns (uint64);

function fusesOf(bytes32 node) external view returns (uint64);

function renewalControllerOf(bytes32 node) external view returns (address);

function upgrade(bytes32 node, bytes calldata extraData) external;

function setUpgradeController(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this an upgrade target, rather than any kind of controller?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setUpgradeControllerTarget? It's a controller to upgrade to.

IControllerUpgradeTarget _upgradeController
) external;
}
Loading