Transfer Ownership
This section assumes that you have already gone through the setup part.
See the Access Control guide for an overview of who is allowed to transfer ownership.
You may remember from the NFT guide that every Sablier stream is wrapped in an ERC-721 non-fungible token (NFT). One of the key benefits of this design is that the recipient of the stream has the ability to transfer the NFT to a different address, effectively redirecting the streaming of assets to that new address.
To transfer ownership of a stream, it is recommended to invoke the withdrawMaxAndTransfer
function, which withdraws
all the unclaimed funds to the current recipient prior to transferring ownership to the new recipient:
loading...
The withdrawal will be skipped if there are no unclaimed funds.
If you want to transfer ownership without withdrawing the funds, you can use the transferFrom
function:
loading...
Be careful with transferFrom
. All remaining funds, including the already streamed portion, will enter into the
possession of the new recipient. Consider using withdrawMaxAndTransfer
instead.
Finally, note that in the examples above, the new recipient is hard-coded for demonstration purposes. However, in a production environment, the new recipient would definitely be an adjustable parameter provided by the user.