Distribute Freebets
First, deploy the FreeBet contract and specify the token. Bind the contract with the LP
and transfer liquidity to the deployed contract. Use setManager
to add a manager who will manage freebets and withdrawals.
Use the mint
or mintBatch
function to distribute freebets.
Provide Liquidity
The liquidity balance can be obtained by calling the balanceOf(freebetAddress)
function on the token contract.
List Freebets
Use the FreeBetMinted
/ FreeBetMintedBatch
events to list the NFT IDs of the distributed freebets. To filter active
freebets, exclude those that have been redeemed, canceled, or withdrawn.
The freebet status is not stored on the contract but can be obtained from the events. There are four possible statuses:
Created
, Reissued
, Redeemed
, and Withdrawn
.
Users should call the withdrawPayout
function to claim their winnings or refunds if the condition was canceled. The
BettorWin
event indicates a user's bet has won, while the FreeBetReissued
event is invoked if the condition was canceled.
Withdraw Liquidity
Finally, to withdraw liquidity from the contract, call the withdrawReserve(amount)
function. Only tokens that are
free from freebets can be withdrawn. To unlock reserved tokens, call the resolveExpired
function when freebets expire.
Use the lockedReserve
function on the freebet contract to determine the amount of locked tokens that cannot be withdrawn.
We recommend limiting the IDs provided to the resolveExpired
function parameters to avoid errors during transaction
execution.