Automate Staking Rewards Claiming using Gelato - Guide

Currently THALES staking rewards need to be claimed manually by users on a weekly basis or the weekly reward is forfeited. The rewards do not roll over to next week automatically!
With the recent implementation of claimOnBehalf method in the THALES staking contract, it is finally possible for individual stakers to explore automating their award claiming and thus improve their UX significantly.
This page will guide you through the steps of setting up a Gelato weekly task for auto-claiming your weekly staking rewards.

Step 1: Create a new automation task on Gelato dapp

Navigate to the Gelato dapp:​
Connect your wallet to the dapp.
If you want to automate staking on
Optimism Network, make sure your wallet is connected to Optimism.
If you want to automate staking on
Arbitrum Network, make sure your wallet is connected to Arbitrum.
Before you are able to create a task, you need to fund your Gelato account with ETH that is needed as gas for the claim transactions that you are trying to automate.
Click on the Funds button on the top left of the page, input the amount of ETH you wish to fund the contract with, click on the Deposit button and confirm the transaction.
When it comes to choosing the amount of ETH sufficient for funding the contract, keep in mind that it should probably never spend more than ~$0.50 worth of ETH per week of claiming.
Now that you funded your account, it is time to create the automated task itself.
Go back to the Gelato dapp home page and click on the Create Task button.
In the New Task page, input the following THALES staking contract address in the the Contract address input field:



After inputting the contract address, choose the claimRewardOnBehalf function and input your wallet address that you use for staking THALES in the (address account) input field.
After inputting your staking address in (address account), a card for choosing a frequency of execution should appear below it.
Since THALES staking rewards are claimable from a weekly snapshot, the Interval should be chosen to be 7 days+0 hours+0 min.
By default, the claiming will execute from the moment you create a task and will continue using that timestamp for every week. If you want to input a different day and time of the week for when the claiming executes on a weekly basis, you can do so by unchecking the Start immediately checkbox and choosing a day using Start time date and time picker.
On the next card called Pay With choose Gelato Balance (should be chosen as default already).
And finally, give your automated task a name of your choice in the Task name input field, after which a Create Task button should become visible.

Click on the Create Task button and confirm the transaction!

Step 2: Copy your Gelato Executing Address

To allow Gelato automation to trigger the reward claim on your behalf, you have to whitelist your personal Gelato contract address.
First you need to find your Gelato Executing Address which is visible on the page of your newly created task. Enter the task page by clicking on your task on the https://app.gelato.netwo main page:
On the bottom part of your Task Page, you should see your Executing Address in the Executing Address tab.
Copy your unique Executing Address (msg.sender) so you can input it in the Thales dapp!

Step 2: Whitelist your executing address for the claimOnBehalf method

Navigate to the THALES token Staking page:​
Make sure your wallet used for staking THALES is connected to the dapp.
After the "Claim on behalf" pop-up window opens, in the address input field make sure to input your Gelato Executing Address that you copied in the previous step!
After inputting the Gelato contract address, click on the Enable button and confirm the transaction.

Congratulations! You successfully automated your weekly THALES Staking Rewards claim!