📩Withdraw from the SFS

Let's withdraw from the SFS

There is a minimum to claim the SFS earned fees and it's 0.01 ETH

There are two ways to claim your funds:

  1. Directly from a wallet that holds the NFT.

  2. Programmatically from a smart contract that also holds the NFT (coming soon) .

The SFS contract acts as a balance sheet, tracking which contracts are linked to which SFS NFTs through mappings. All balances are stored within the contract until users withdraw them. The revenue of the SFS is calculated by an off-chain component that distributes the fees at the end of each epoch. You won't see your balance increase immediately after registering your contract because this off-chain component updates the balances on the first day of each month on the mainnet and every 24 hours on the testnet.

To withdraw, you must hold the SFS NFT; otherwise, the transaction will revert. It doesn't matter if it's an externally owned account (EOA) or a smart contract—both must have the NFT in their balance to withdraw the funds. This is the withdrawal function:

    /// @notice Withdraws earned fees to `_recipient` address. Only callable by NFT owner.
    /// @param _tokenId token Id
    /// @param _recipient recipient of fees
    /// @param _amount amount of fees to withdraw
    /// @return amount of fees withdrawn
    function withdraw(uint256 _tokenId, address payable _recipient, uint256 _amount)
        public
        onlyNftOwner(_tokenId)
        returns (uint256)
    {
        uint256 earnedFees = balances[_tokenId];

        if (earnedFees == 0 || _amount == 0) revert NothingToWithdraw();
        if (_amount > earnedFees) _amount = earnedFees;

        balances[_tokenId] = earnedFees - _amount;

        emit Withdraw(_tokenId, _recipient, _amount);

        Address.sendValue(_recipient, _amount);

        return _amount;
    }

Please note that the function includes the onlyNftOwner modifier, which will revert the transaction if the caller is not the owner of the NFT.

Last updated