Utility Functions
Helper functions for common operations.generateReferralLink
Generates a referral link for sharing.Parameters
| Name | Type | Description |
|---|---|---|
| referralCode | string | Referral code to include in the link |
Returns
string - Complete referral link.
Example
getBadgeInfo
Gets information about a specific badge tier.Parameters
| Name | Type | Description |
|---|---|---|
| tier | number | Badge tier (0-3) |
Returns
BadgeInfo object containing badge details.Example
bpsToPercentage
Converts basis points to percentage.Parameters
| Name | Type | Description |
|---|---|---|
| bps | bigint | Value in basis points |
Returns
number - Percentage value.
Example
getContractStats
Gets contract statistics.Returns
ContractStats object containing contract statistics.Example
generateBadgeSVG
Generates an SVG badge for display.Parameters
| Name | Type | Description |
|---|---|---|
| tier | number | Badge tier |
| referrals | number | Number of referrals |
| earnings | bigint | Total earnings in wei |
| rank | number | User’s rank |
Returns
string - Data URI of the SVG badge.