# Register a Smart Contract

Registering a contract in the SFS means calling the <mark style="color:orange;">`register`</mark> function defined in the SFS contract and getting an SFS NFT in exchange. The call to the register function must be made from your smart contract. This means you will have to add some code and logic to your contract in order to register it to the SFS. You’ll find code to do this later on this guide.

This is the register function from the SFS:

{% code lineNumbers="true" fullWidth="true" %}

```solidity
    ///@notice Mints ownership NFT that allows the owner to collect fees earned by the smart contract.
        ///`msg.sender` is assumed to be a smart contract that earns fees. Only smart       ///contract itself can register a fee receipient.
    /// @param _recipient recipient of the ownership NFT
    /// @return tokenId of the ownership NFT that collects fees
    function register(address _recipient) public onlyUnregistered returns (uint256 tokenId) {
        address smartContract = msg.sender;

        if (_recipient == address(0)) revert InvalidRecipient();

        tokenId = _tokenIdTracker.current();
        _mint(_recipient, tokenId);
        _tokenIdTracker.increment();

        emit Register(smartContract, _recipient, tokenId);

        feeRecipient[smartContract] = NftData({
            tokenId: tokenId,
            registered: true,
            balanceUpdatedBlock: block.number
        });
    }
```

{% endcode %}

There are 2 interesting things to note from the register function:

1. The register function receives (<mark style="color:red;">`address`</mark>` `` ``_recipient `) as a parameter. This is the address where the NFT will be minted to.
2. The SFS contract looks at the <mark style="color:orange;">`msg.sender`</mark> in order to know what smart contract is being registered. This is why you need to call the register function from the contract you want to register. **You can only do this once per contract.**


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mode.network/tutorials/sfs-sequencer-fee-sharing/register-a-smart-contract.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
