# FT Lottery

PaySwap enables normal users/businesses to launch and run their own lotteries. An FT lottery is a lottery that rewards its players in fungible tokens.

Here is a step-by-step guide to launching your own FT lottery:

* Go to the [lotteries page](https://payswap.org/lotteries) and click on the **Create Lottery** button

<figure><img src="https://3481829468-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbuuWgsRQF3QPmDvV7XJQ%2Fuploads%2Fgit-blob-ca745eddeadd3603344f3c8f33e67db36d5ab0ec%2Flottery5.png?alt=media" alt=""><figcaption></figcaption></figure>

* Fill in the form with the appropriate values and validate the transaction. You can read the description of each parameter by hovering your cursor over the help icon next to each parameter.\
  Make sure you pick No for the NFT prize parameter since this is an FT lottery and therefore will be no NFT prize

<figure><img src="https://3481829468-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbuuWgsRQF3QPmDvV7XJQ%2Fuploads%2Fgit-blob-26716c9f8ba48d0c8709cfde69f02096f89bd1d6%2FScreenshot%20from%202024-02-05%2010-55-11.png?alt=media" alt=""><figcaption></figcaption></figure>

You can learn more about how lotteries work by reading the documentation on the page below:

{% content-ref url="" %}
[](https://docs.payswap.org/products/lottery)
{% endcontent-ref %}

* After you've deployed your lottery, reload the page and tick the **Mine Only** button to only show your lotteries. This will enable you to find your lottery faster.

<figure><img src="https://3481829468-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbuuWgsRQF3QPmDvV7XJQ%2Fuploads%2Fgit-blob-9db1383d24cb84fa553d966a9ee050c20f8a7061%2Flottery4.png?alt=media" alt=""><figcaption></figcaption></figure>

* For a list of all the functions you have access to, to run your lottery, click on the **Control Panel** button to view its menu of functions
* The next step is to add tokens to your FT lottery, these are the fungible tokens with which your users will be purchasing your tickets. You can add as many tokens as you please but you have to also add a ticket prize for the token you are adding. To add a token, go to your lottery's control panel menu and click on the Add New Token button. Fill in the form with appropriate information and validate the transaction

<div><figure><img src="https://3481829468-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbuuWgsRQF3QPmDvV7XJQ%2Fuploads%2Fgit-blob-77d9a94a30ea4ba70142325a5e597d74419fdf82%2FScreenshot%20from%202024-02-05%2012-39-45.png?alt=media" alt=""><figcaption></figcaption></figure> <figure><img src="https://3481829468-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbuuWgsRQF3QPmDvV7XJQ%2Fuploads%2Fgit-blob-7b3fe57d76fe81d65ebb10684ae2e9e0987e51be%2FScreenshot%20from%202024-02-05%2012-40-03.png?alt=media" alt=""><figcaption></figcaption></figure></div>

* You should see your added tokens listed in the bottom left section of your lottery's panel.

## Buying Lottery Tickets

You can read about buying lottery tickets from the page below:

{% content-ref url="" %}
[](https://docs.payswap.org/products/lottery)
{% endcontent-ref %}

## Closing Lotteries

A lottery can only draw a winning number after it has been closed. Anyone can close an ongoing lottery granted at least one of these 2 conditions are met:

* The lottery has passed its specified end time
* The lottery has a first prize pot bigger than its end amount value. The first prize pot is that of the first added lottery currency.

To close a lottery, go to its control panel menu and click on the **Close Lottery** button. Make sure the correct lottery ID has been entered and validate the transaction.

<div><figure><img src="https://3481829468-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbuuWgsRQF3QPmDvV7XJQ%2Fuploads%2Fgit-blob-77d9a94a30ea4ba70142325a5e597d74419fdf82%2FScreenshot%20from%202024-02-05%2012-39-45.png?alt=media" alt=""><figcaption></figcaption></figure> <figure><img src="https://3481829468-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbuuWgsRQF3QPmDvV7XJQ%2Fuploads%2Fgit-blob-d2c731dfe7818b1c48554789f440a9fdf0c062b9%2FScreenshot%20from%202024-02-05%2013-05-05.png?alt=media" alt=""><figcaption></figcaption></figure></div>

## Draw Winning Number

Once your lottery has been closed, anyone can run it random number generator to pick a winning number. To do so, go to your lottery's control panel menu and click on the **Draw Final Number** button

<div><figure><img src="https://3481829468-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbuuWgsRQF3QPmDvV7XJQ%2Fuploads%2Fgit-blob-77d9a94a30ea4ba70142325a5e597d74419fdf82%2FScreenshot%20from%202024-02-05%2012-39-45.png?alt=media" alt=""><figcaption></figcaption></figure> <figure><img src="https://3481829468-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbuuWgsRQF3QPmDvV7XJQ%2Fuploads%2Fgit-blob-0b309c7cd59691bca82a8009c1ef979c6165da25%2FScreenshot%20from%202024-02-05%2013-09-43.png?alt=media" alt=""><figcaption></figcaption></figure></div>

Make sure the correct lottery ID has been entered and validate the transaction.

Congratulations!!! Your lottery can now distribute rewards, anyone who's purchased a ticket can check the winning number from the lottery's page and claim his/her rewards in case of a win.

## Claiming Tickets

You can either claim your ticket from the lotteries' page or your lottery's page

### Claiming Tickets Through Lotteries' Page

* Go to your lottery's control panel menu and click on the **Claim Tickets** button

  <div><figure><img src="https://3481829468-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbuuWgsRQF3QPmDvV7XJQ%2Fuploads%2Fgit-blob-eba92c5d1bf0ff854cadc58140edef23b8af288b%2FScreenshot%20from%202024-02-05%2014-31-19.png?alt=media" alt=""><figcaption></figcaption></figure> <figure><img src="https://3481829468-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbuuWgsRQF3QPmDvV7XJQ%2Fuploads%2Fgit-blob-2c9ab8f9fa656c1157dba43caf83edc120cb3694%2FScreenshot%20from%202024-02-05%2014-31-45.png?alt=media" alt=""><figcaption></figcaption></figure></div>

  Enter the appropriate parameters and validate the transaction. Claiming the tickets does not send the rewards to your wallet but instead adds it to your pending revenues in the lottery that you can withdraw later on by running the **Withdraw** function

### Claiming Tickets Through The Lottery Page

To claim your ticket through the lottery page, go to the lottery's page and click on the **Claim Tickets** button

<figure><img src="https://3481829468-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbuuWgsRQF3QPmDvV7XJQ%2Fuploads%2Fgit-blob-921cff906204f25cda398464af716b1f498bd939%2FScreenshot%20from%202024-02-05%2014-37-53.png?alt=media" alt=""><figcaption></figcaption></figure>

Enter the appropriate parameters and validate the transaction.

## Withdraw Pending Revenue

### Through The Lotteries' Page

To withdraw your revenue through the lotteries' page, go to your lottery's control panel menu and click on the **Withdraw** button

<div><figure><img src="https://3481829468-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbuuWgsRQF3QPmDvV7XJQ%2Fuploads%2Fgit-blob-eba92c5d1bf0ff854cadc58140edef23b8af288b%2FScreenshot%20from%202024-02-05%2014-31-19.png?alt=media" alt=""><figcaption></figcaption></figure> <figure><img src="https://3481829468-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbuuWgsRQF3QPmDvV7XJQ%2Fuploads%2Fgit-blob-dd7c58b3df297b280c23550b123a1807ef4c796b%2FScreenshot%20from%202024-02-05%2014-41-58.png?alt=media" alt=""><figcaption></figcaption></figure></div>

### Through The Page Of Your Lottery

Scroll down to the **Check Winnings** button and click on it.

<figure><img src="https://3481829468-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbuuWgsRQF3QPmDvV7XJQ%2Fuploads%2Fgit-blob-c86b35c3407b6544c470b418679cf8b706be1389%2FScreenshot%20from%202024-02-05%2014-44-10.png?alt=media" alt=""><figcaption></figcaption></figure>

This will reveal your pending revenue in the lottery in a pop-up form. Click on the claim button from the pop-up and validate the transaction.

## Relaunching A Lottery

After a round of a lottery, you can start that lottery again by going to your previous lottery's control panel menu and clicking on the **Start Lottery** button

<div><figure><img src="https://3481829468-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbuuWgsRQF3QPmDvV7XJQ%2Fuploads%2Fgit-blob-e348914f2d810f4fd73d5c46eb47580b177aab2d%2FScreenshot%20from%202024-02-05%2016-57-18.png?alt=media" alt=""><figcaption></figcaption></figure> <figure><img src="https://3481829468-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbuuWgsRQF3QPmDvV7XJQ%2Fuploads%2Fgit-blob-cf62ae92507528dcbf80a51ecd3d926d124f9a16%2FScreenshot%20from%202024-02-05%2016-57-49.png?alt=media" alt=""><figcaption></figcaption></figure></div>

Fill in the form and validate the transaction. This will create a new lottery with a different ID.

Check from your new lottery's parameters' section whether there are some funds left from your previous lottery under the **Amount Left To Reinject** parameter

<figure><img src="https://3481829468-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbuuWgsRQF3QPmDvV7XJQ%2Fuploads%2Fgit-blob-db281f56866c3e23568b79e4a0c4995f7f374e4d%2FScreenshot%20from%202024-02-05%2017-00-57.png?alt=media" alt=""><figcaption></figcaption></figure>

You can also check your previous lottery's parameters' section under the same parameter to check whether there are some funds left to reinject. Select each token one after the other and check that parameter for each one of them.

To reinject leftover funds into the new lottery, make sure you add the token of which funds are left over to the new lottery, then go to your new lottery's control panel menu and click on the **Inject Funds** button

<div><figure><img src="https://3481829468-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbuuWgsRQF3QPmDvV7XJQ%2Fuploads%2Fgit-blob-e348914f2d810f4fd73d5c46eb47580b177aab2d%2FScreenshot%20from%202024-02-05%2016-57-18.png?alt=media" alt=""><figcaption></figcaption></figure> <figure><img src="https://3481829468-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbuuWgsRQF3QPmDvV7XJQ%2Fuploads%2Fgit-blob-b9955ba3c619ddc07ee4eb18a35cf51e5fb4e317%2FScreenshot%20from%202024-02-05%2017-10-50.png?alt=media" alt=""><figcaption></figcaption></figure></div>

Make sure the correct lottery ID is inputted, enter 0 for the amount and Yes for the Reinject parameter. Validate the transaction. You should confirm there's no more tokens left to transfer from the lottery's parameters' section.

Do this for every token that has some amount left to reinject.

[Get further support from the community here.](https://paychat.payswap.org/#/room/%23paycom%3Amatrix.org?via=matrix.org)
