EIPs Explained

ERC-5313 · Final · ERC · 2022-07-22

ERC-5313: Light Contract Ownership

The smallest possible ownership interface: a contract exposes owner() so marketplaces and tools can tell who controls it.

What problem does it solve?

Third-party sites, most notably NFT marketplaces, need to know who controls a contract: for example, to let the collection's owner edit its page, set a banner or configure royalties. The established answer was EIP-173, which also standardizes transferOwnership and an OwnershipTransferred event. Many contracts expose owner() but handle transfers differently (two-step transfers, multisig-controlled, immutable owners), so they cannot claim full EIP-173 compliance.

ERC-5313 codifies the part everybody already relies on: a single owner() view function.

How it works

A compliant contract implements exactly one function:

interface EIP5313 {
    /// @notice Get the address of the owner
    function owner() external view returns (address);
}

That's all. There is no transfer function, no event, and deliberately no ERC-165 interface ID, so that the many existing contracts that already have owner() are compliant without changes. Every EIP-173 contract (including OpenZeppelin's Ownable) automatically satisfies ERC-5313.

How ownership is set, transferred or renounced is left entirely to the contract.

Sample code

A contract with a fixed owner, which EIP-173 would not cover because it cannot be transferred:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

contract FixedOwnerCollection {
    address private immutable _owner;

    constructor() { _owner = msg.sender; }

    /// ERC-5313
    function owner() external view returns (address) {
        return _owner;
    }
}

Checking control from a script (ethers v6):

import { Contract, JsonRpcProvider } from "ethers";

const provider = new JsonRpcProvider(process.env.RPC_URL);
const c = new Contract(collection, ["function owner() view returns (address)"], provider);
const owner: string = await c.owner();
const isOwner = owner.toLowerCase() === userAddress.toLowerCase();

Things to know

  • Status: Final.
  • Without ERC-165 you cannot be certain that owner() means "controller": a contract could have an unrelated function with the same signature. That is fine for low-stakes checks like "may this wallet edit the collection page", but risky for decisions such as sending valuable assets to the reported owner.
  • owner() returning the zero address conventionally means ownership has been renounced, but the spec does not require that interpretation.
  • If you need standardized transfer semantics and events, implement EIP-173 instead; you get ERC-5313 for free.

#ownership #access-control #interface #nft #marketplaces

Details

Authors
William Entriken (@fulldecent)
Status
Final
Type
Standards Track / ERC
Created
2022-07-22
Requires

Machine-readable: Markdown · JSON