Skip to main content

Token Streams

A token stream (a.k.a. Staking) allows you to reward your NFT collectors based on certain conditions such as holding NFTs or locking NFTs instead of listing on marketplaces, as a way to show their long-term commitment to your project.

Flair provides modular extensions so you can fully customize your staking contracts if necessary.

Getting Started

To create your first token stream (i.e. staking pool), with full ownership, under 5 minutes head over to Flair dashboard "Streams" panel:

stream-presets

Tutorials

Here are step-by-step tutorials on how to create the staking experience for your collectors:

SDK Examples

Here are few ready-made examples on Github for you to get straight into the code:

Pre-built Pages

Use the link below to provide a ready-made staking page to your NFT holders:

https://app.flair.finance/public/claim/PUT_CHAIN_ID_HERE/PUT_CONTRACT_ADDRESS_HERE

Example staking page: https://app.flair.finance/public/claim/137/0xbb1cb56e057022fba8d55c8dde1d17adbd3be649





Import as iframe widget

Use iframe snippet below to render this simple-sales minting page as a widget.

<iframe
src="https://app.flair.finance/public/mint/PUT_CHAIN_ID_HERE/PUT_CONTRACT_ADDRESS_HERE"
frameborder="0"
width="800px"
height="800px"
allowtransparency="true"
/>

Customization

If you like to customize each component you can try React components and hooks below.

React Components

Here is a list of un-styled React components you can use to customize, for a full list visit GitHub repo:

NameDescriptionUsage
<StreamClaimingSection/>Renders a complete staking widget as shown in the screenshot aboveExample
<StreamClaimingProvider/>Provides a context for claiming components, it is required for customizationExample
<StreamEligibleNfts/>Shows number of NFTs current wallet owns that are eligible for this stream.Example
<StreamTotalClaimed/>Total amount current wallet has ever claimedExample
<StreamClaimableAmount/>Amount that current wallet can claim right now.Example
<StreamClaimButton/>Renders a button that allows users to claim any available rewardsExample

All components are easy to import and use:

import {
StreamClaimingSection,
StreamClaimButton,
DisconnectButton,
} from "flair-sdk";

const STREAM_CHAIN_ID = "137";
const STREAM_CONTRACT_ADDRESS = "0xbb1cb56e057022fba8d55c8dde1d17adbd3be649";

function App() {
return (
<div className="flex min-h-screen items-center justify-center">
// Render a full staking widget
<StreamClaimingSection
chainId={Number(STREAM_CHAIN_ID)}
contractAddress={STREAM_CONTRACT_ADDRESS}
/>

// OR, use custom components:
<StreamClaimButton />
<DisconnectButton className="mt-4 text-sm text-indigo-700" />
// for list of all components in real example, see https://github.com/0xflair/examples/blob/main/react/community-airdrop-reward-stream/src/App.tsx
</div>
);
}

export default App;

React Hooks

You can also use the low-level React hooks exported from Flair SDK (Typescript):

  • useTokenStream
  • useStreamTicketToken
  • useStreamTotalClaimed
  • useStreamClaimableAmount
  • useStreamClaimer
  • useStreamTotalClaimable
  • useStreamTotalSupply
  • useStreamReleasedAmountUntil
  • useStreamEmissionAmountUntil
  • useStreamEmissionRate
  • useStreamEmissionTimeUnit
  • useStreamEmissionEnd
  • useStreamEmissionStart
  • useStreamTotalShares

You can view the source code of these hooks, and ask us any questions in Discord, our developers are happy to support.

Solidity Presets

ERC721EqualEmissionStream.sol

This preset allows you to reward NFT holders for holding to their NFTs instead of selling on the open market. You will top-up this stream with any ERC20 token that you want to be distributed, and define a vesting rate and duration, and then NFT holders can claim their rewards over time.

In this specific preset holders don't need to "stake" their NFTs, as the NFTs will not leave their wallets. They are able to use them as normal, and are incentivized to not sell on the open market to receive the rewards.

Create this preset under 5 minutes by following this tutorial

View the source code.

ERC721ShareInstantStream.sol

This preset allows you distribute any sort of tokens, revenue, or rewards to your NFT holders. They will be able to claim those tokens immediately without having to wait.

View the source code.

Need a customization?

Flair is fairly flexible, as you can use available extensions and create your own stream contract, and easily import it in the dashboard, for deployment, management, analytics and insights.

Hop on our Discord, and lets talk about it.