Skip to main content

Claiming dETH rewards for direct LSD deposits

This tutorial shows how to claim rewards for deposits made directly to the LSD pools (and not via the Giant pools)

Pre-installations

The LSD Wizard SDK is written in typescript and needs following installation for compiling.

yarn add typescript typechain @typechain/ethers-v5 @types/lodash @types/node

Installing the SDK

yarn add @blockswaplab/lsd-wizard ethers@5.7.2

ethers is used throughout LSD Wizard SDK, hence this tutorial uses ethers too. Remember to install ethers version 5, as version 6 and above are not compatible with the SDK.

Importing the SDK

const { Wizard } = require("@blockswaplab/lsd-wizard");

or

import { Wizard } from "@blockswaplab/lsd-wizard";

Now using ether's signer instance initialise the SDK.

Initialising the SDK:

const wizard = new Wizard({
signerOrProvider: "<ETHER_SIGNER_INSTANCE>", // signer or provider
liquidStakingManagerAddress: "<LIQUID_STAKING_MANAGER_ADDRESS>",
savETHPoolAddress: "<PROTECTED_STAKING_POOL_ADDRESS>",
feesAndMevPoolAddress: "<MEV_STAKING_POOL_ADDRESS>"
});

One can get the BLS public key from the LSD dApp. To get the addresses needed above, head over to mainnet or goerli LSD subgraph and run the following query:

{
lsdvalidator(id:"YOUR_BLS_PUBLIC_KEY") {
smartWallet {
liquidStakingNetwork {
id
savETHPool
feesAndMevPool
}
}
}
lptokens(where:{
blsPublicKey:"YOUR_BLS_PUBLIC_KEY"
tokenType:"PROTECTED_STAKING_LP"
}) {
id
}
}

In the lsdValidator.smartWallet.liquidStakingNetwork entity,

  • id is the liqudStakingManagerAddress,
  • savETHPool is the savETHPoolAddress and
  • feesAndMevPool is the feesAndMevPoolAddress
    needed by the SDK.

Using the SDK

Claiming dETH from Protected Staking Pool

const tx1 = await wizard.savETHPool.burnLPToken(
"LP_TOKEN_ADDRESS",
"AMOUNT_IN_WEI"
);
console.log("tx1: ", tx1);

LP_TOKEN_ADDRESS: LP Token address to be burnt. From the subgraph query shared above, use the lpToken.id.
AMOUNT_IN_WEI: String of amount of ETH (in wei) that needs to be burnt to claim dETH rewards.

This function will burn the LP token and no future dETH rewads will be earned, unless one deposits dETH back into the pool.

Claiming Fees and MEV rewards

const tx2 = await wizard.feesAndMevPool.claimRewards(
"RECIPIENT_ADDRESS",
BLS_PUBLIC_KEYS
);
console.log("tx2: ", tx2);

RECIPIENT_ADDRESS: ETH address that should receive the rewards.
BLS_PUBLIC_KEYS: 1 dimensional array of BLS public keys for which the rewards need to be claimed. If there is only a single BLS public key to claim reward from, then the BLS_PUBLIC_KEYS input param looks like ["YOUR_BLS_PUBLIC_KEY"]

This function will claim Fees and MEV rewards without burning the LP Token. This means, that one can come back and claim newly earned Fees and MEV rewards.