Builders have two methods available to generate revenue for their integration with Myriad:
- Charging a frontend fee at their discretion, using the built-in helpers in the API (requires whitelisted API keys), or using their own means.
- Using builder codes and the on-chain capabilities built into the smart contract.
Front-end feesBuilder codesHow to apply for custom builder codesHow to integrateHow to verifyHow to claim
Front-end fees
Front-end fees can be charged on top of any fees that may be charged by the Myriad smart contract, on a market-per-market basis.
The API provides a
POST /markets/quote_with_fee endpoint (requires API Key whitelisting) that returns the exact calldata needed to implement this feature easily. It is compatible with wallets that support EIP-5792.Builder codes
- Eligible markets: all markets that have a non-zero
distributor_feeproperty.
- Referral amount: a portion determined by the Myriad team based on direct agreements or at the team’s discretion. The maximum amount is the value of the
distributor_fee— typically 1% — multiplied by the value of the trade.
- Eligible trades: only
buyactions are eligible —sell,claim_winningsandclaim_voidedare not eligible.
- Eligible builders: Builders using the referral code provided to them in their Myriad Account or organizations who can apply for whitelisting using their custom builder code.
How to apply for custom builder codes
- Request whitelisting: Contact the Myriad team to request approval. Whitelisting is granted and canceled at Myriad’s discretion.
- Builder code: Provide a short ASCII string that will identify your app or organization.
- Wallet: Provide an EVM wallet address in which you’ll receive your rewards.
How to integrate
- To check whether a market is eligible:
- Check wether the market information returned by the API includes a non-zero value for the
fees.distributor_feeproperty. - When the third element of the
buyFeestuple is non-zero, in the result of callinggetMarketFees(marketId)on the smart contract.
- Call the
referralBuyfunction instead of calling thebuyfunction of the smart contract.
- In addition to the normal call data you’d pass when calling
buy, also pass your whitelisted builder code.
- You can call
referralBuyeven on non-eligible markets. In those cases, the referral simply won’t yield any rewards.
- This logic applies to all chains in which the Myriad Protocol is available.
How to verify
You can verify that the revenue sharing is correctly implemented directly on-chain.
- The smart contract emits a
Referralevent whenreferralBuyis used.
- The event contains the following information:
- Topics
0:0xc993f9a8447446a00c879dadbeefa69111000411f1a1a9f67cf75a12ec08a3ec1:user: the trader’s wallet address2:marketId: the ID of the market in which the trade occurred- Data
code: the builder codeaction:0for buysoutcomeId: the ID of the outcome boughtvalue: the amount of the trade (market token denomination decimals apply)timestamp: the UNIX timestamp of the trade
- In the case of eligible trades, the smart contract also transfers the corresponding reward to the Distributor Fees address, which is also specified in the API responses and by calling the
getMarketFees(marketId)function on the smart contract.
- Example transaction: ‣
How to claim
- The Myriad Foundation pays out rewards in the first Monday of each month to builders who earned $500 or more up until the end of the previous month.
- Payout amounts are reset once a payment is made. Builders who don’t reach the minimum threshold of $500 keep accumulating until the next payout period, and so on.
- Payouts are made to the builder’s Myriad Account or their whitelisted wallet address.
- Direct agreements may have different payout terms.