Developer Hub
🧩 For blockchains
PayMaster functions

Partners (affiliates) can sponsor bettor's transaction fees and bet amounts (freebets). To use this option for their respective bettors fee vault and freebet vault must be funded. Partner (affiliate) manage its vaults by themselves - deposite, withdraw from own vaults.

Affiliate funds

Partner funds mapped with the affiliate address.

// fees provided
mapping(address => uint256) public feeFund;
 
// freeBets provided
mapping(address => uint256) public freeBetsFund;

In bet parameters ClientData.affiliate is affiliate address mapped to it's vaults

Affiliate funds uses to sponsor transaction fees and freebets.
Bet parameter ClientData.affiliate is affiliate address to be mapped to its funds.

struct ClientData {
    string attention;
    address affiliate;
    address core;
    uint256 expiresAt;
    uint256 chainId;
    uint256 relayerFeeAmount;
    bool isFeeSponsored;
    bool isBetSponsored;
    bool isSponsoredBetReturnable;
}

If ClientData.isFeeSponsored = true affiliate's feeFund will be used to pay fee (relayerFeeAmount) and bettor not charged for the transaction fee.

If ClientData.isBetSponsored = true affiliate's freeBetsFund will be used to provide bet amount and bettor not charged for bet amount.

isSponsoredBetReturnable extended parameter for isBetSponsored = true:

  • true, provided freebet funds not returns to affiliate freebet fund (in case of winning payout)
  • false, provided freebet funds will be returned to affiliate freebet fund (in case of winning payout)

Deposite funds

To deposite affiliate funds used permissionless function depositFor()

function depositFor(address account,uint256 freeBetAmount,uint256 feeAmount)

After successful execution emitted

event DepositedFunds(address indexed affiliate, uint256 freebetAmount, uint256 feeAmount)

Withdraw funds

Withdraw affiliate funds can be executed only by affiliate wallet, executing withdraw()

function withdraw(uint256 freeBetAmount, uint256 feeAmount)

After successful execution emitted

event WithdrawnFunds(address indexed affiliate, uint256 freebetAmount, uint256 feeAmount)

Payout winning freebets

For winning freebets payouts use permissionless function

function withdrawPayouts(uint256[] calldata freeBetIds) 

Winning payouts will be transfered to bet owners, if freebet is "returnable", payout value will be reduced by sponsored freebet amount, freebet returned to freebet fund and reduced payout transfered to bettor