Skip to content

Commit e0daf51

Browse files
committed
fix(docs): update rewarding pages
1 parent fb829af commit e0daf51

File tree

2 files changed

+56
-2
lines changed

2 files changed

+56
-2
lines changed

docs/network/fsp/2-rewarding.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@ We refer to the [Weights and Signing](/network/fsp/weights-and-signing) page for
7575

7676
### Calculation process
7777

78+
:::tip[Calculating or verifying rewards data]
79+
80+
All rewards scripts are publicly available, and data providers are encouraged to calculate verify the rewards data for themselves.
81+
The data for the rewards is published on [flare-foundation/fsp-rewards](https://github.com/flare-foundation/fsp-rewards) and the instructions for how to calculate them are [here](https://github.com/flare-foundation/FTSO-Scaling/blob/main/scripts/rewards/README.md#public-reward-data).
82+
83+
:::
84+
7885
Each sub-protocol is responsible for calculating its **partial reward claims** for each reward epoch by:
7986

8087
1. **Data Input**: Determining the relevant data sources (indexers).

docs/network/fsp/guides/claiming-rewards.mdx

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import TabItem from "@theme/TabItem";
1111
Claiming rewards directly via smart contracts follows this flow:
1212

1313
1. **Discover claimable reward epochs** (onchain reads via `RewardManager` + `FlareSystemsManager`).
14-
2. **Fetch the reward distribution data** for each claimable epoch (`reward-distribution-data-tuples.json`) from GitHub or GitLab.
14+
2. **Fetch the reward distribution data** for each claimable epoch (`reward-distribution-data-tuples.json`) from public repositories.
1515
3. **Extract your claim tuple + Merkle proof** for the correct `beneficiary` and `claimType`.
1616
4. **Submit a single onchain transaction** calling `RewardManager.claim(...)` with one or more claim structs.
1717

@@ -33,10 +33,39 @@ Learn more about how [signing](/network/fsp/weights-and-signing) and [rewards](/
3333
4. **Contracts:** Addresses can be found in the [Flare Contract Registry](/network/guides/flare-contracts-registry):
3434
- [`FlareSystemsManager`](/network/fsp/solidity-reference/IFlareSystemsManager)
3535
- [`RewardManager`](/network/fsp/solidity-reference/IRewardManager)
36+
- [`ClaimSetupManager`](/network/solidity-reference/IClaimSetupManager)
3637
5. **Recipient address:** The address that will receive the rewards (`recipient`).
3738
6. **Reward distribution data access:** You must be able to fetch per-epoch `reward-distribution-data-tuples.json` from the official distribution locations on GitHub or GitLab.
3839
7. **Wrap option:** `wrapRewards` is `true` unless explicitly set to `false`.
3940

41+
### Recommended: Configure a claim executor and claim recipient
42+
43+
For improved security, set up a **claim executor** (an account authorized to claim on your behalf) and an **allowed claim recipient** (an address permitted to receive rewards).
44+
45+
1. Create and fund a new account with sufficient native tokens
46+
2. Authorize this account as a claim executor, which can be done using the [`setClaimExecutors`](/network/solidity-reference/IClaimSetupManager#setclaimexecutors) method.
47+
- For **DIRECT (0)** claims: Use your signing policy account to authorize the executor.
48+
- For **FEE (1)** claims: Use your identity account to authorize the executor.
49+
3. Setup a **Claim Recipient** account, this can be done through the [`setAllowedClaimRecipient`](/network/solidity-reference/IClaimSetupManager#setallowedclaimrecipients) method.
50+
51+
```ts
52+
import { Contract } from "ethers";
53+
54+
const claimSetupManager = new Contract(
55+
process.env.CLAIM_SETUP_MANAGER_ADDRESS!, // from contract registry
56+
CLAIM_SETUP_MANAGER_ABI,
57+
beneficiarySigner, // IMPORTANT: signer must be the signing policy address (`DIRECT`) or identity address (`FEE`)
58+
);
59+
60+
// 1) Authorize the executor that will submit RewardManager.claim(...)
61+
await (await claimSetupManager.setClaimExecutors([executorAddress])).wait();
62+
63+
// 2) Allowlist a recipient address that is permitted to receive rewards
64+
await (
65+
await claimSetupManager.setAllowedClaimRecipients([recipientAddress])
66+
).wait();
67+
```
68+
4069
## Step-by-step
4170

4271
### 1. Connect to the contracts
@@ -112,6 +141,13 @@ for (let epochId = start; epochId <= end; epochId++) {
112141

113142
### 4. Fetch reward distribution tuples
114143

144+
:::tip[Calculating or verifying rewards data]
145+
146+
All rewards scripts are publicly available, and you are encouraged to calculate verify the rewards data yourself.
147+
The data for the rewards is published on [flare-foundation/fsp-rewards](https://github.com/flare-foundation/fsp-rewards) and the instructions for how to calculate them are [here](https://github.com/flare-foundation/FTSO-Scaling/blob/main/scripts/rewards/README.md#public-reward-data).
148+
149+
:::
150+
115151
For each signed epoch, fetch `reward-distribution-data-tuples.json`.
116152
You fetch **one JSON file per epoch**, using the epoch id in the path.
117153
If the JSON cannot be fetched or validated, you cannot build a valid Merkle proof for that epoch.
@@ -203,7 +239,7 @@ Each matching entry provides:
203239
- `merkleProof`: array of hex strings
204240
- tuple `[id, address, sum, claimType]`
205241

206-
:::note
242+
:::info
207243

208244
You do **not** submit the JSON onchain.
209245
You only extract your `merkleProof` and tuple from `rewardClaims` to build the `claims[]` argument passed to `RewardManager.claim(...)`.
@@ -294,6 +330,17 @@ console.log("Confirmed:", tx.hash);
294330

295331
## Troubleshooting
296332

333+
<details>
334+
<summary>T0. Authorization failure: executor not allowed or recipient not allowlisted</summary>
335+
336+
- If the signer sending `RewardManager.claim(...)` is not the beneficiary, ensure it is configured as a **claim executor** via `setClaimExecutors(...)`.
337+
- If the transaction reverts when using a `recipient` address, ensure the recipient is allowlisted via `setAllowedClaimRecipients(...)`.
338+
- Ensure you set these using the correct controlling account:
339+
- **DIRECT**: signing policy account
340+
- **FEE**: identity account
341+
342+
</details>
343+
297344
<details>
298345
<summary>T1. No matching tuple found for my address</summary>
299346

0 commit comments

Comments
 (0)