Referral Operations
Methods for tracking referrals and distributing rewards.recordAction
Records a user action that triggers referral rewards (partner-only method).Parameters
| Name | Type | Description |
|---|---|---|
| userAddress | Address | Address of the user performing the action |
| actionValue | bigint | Value of the action in wei (e.g., 100 * 10^18 for 1 cUSD) |
Returns
Hex - Transaction hash of the action recording.
Example
Requirements
- Only authorized partners can call this method
- The caller must be registered as a partner with a valid subscription
getRewardRates
Gets the reward rates for a user based on their badge tier.Parameters
| Name | Type | Description |
|---|---|---|
| userAddress | Address | Address of the user |
Returns
RewardRates object containing reward percentages in basis points.Example
bpsToPercentage
Converts basis points to percentage.Parameters
| Name | Type | Description |
|---|---|---|
| bps | bigint | Value in basis points |
Returns
number - Percentage value.
Example
getCUSDBalance
Gets the cUSD balance of an address.Parameters
| Name | Type | Description |
|---|---|---|
| address | Address | Address to check balance for |
Returns
bigint - Balance in wei.
Example
approveCUSDCustom
Approves a custom amount of cUSD for spending.Parameters
| Name | Type | Description |
|---|---|---|
| amount | bigint | Amount to approve in wei |
Returns
Hex - Transaction hash of the approval.