-
Discord user IDdefi4n+ Describe your question in detail.Hi, I'm looking for information on how to track staking rewards paid out to delegators of a delegated staking pool (in a specific epoch). I see that there is a DistributeRewardsEvent in the final transaction of an epoch and this contains the pool_address and the rewards_amount. Thanks 🙏 What error, if any, are you getting?No response What have you tried or looked at? Or how can we reproduce the error?I've been looking at transactions with reward payouts in an explorer. For example: Which operating system are you using?Linux (Ubuntu, Fedora, Windows WSL, etc.) Which SDK or tool are you using? (if any)N/A Describe your environment or tooling in detailNo response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I found this doc, it might give you some ideas. I don't have a good solution right now, and i'm asking around. This thread might also be helpful. A pretty complex solution I can think of. import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({
network: Network.MAINNET,
});
export const aptos = new Aptos(config);
export const calculateReward = async () =>
{
const delegatorAddr =
"0x42b7cd08d63005d04c8dd0ed5e7e1acab3cf20bf77dab114ba5a2806d0b97be2";
const poolAddress =
"0x9bfd93ebaa1efd65515642942a607eeca53a0188c04c21ced646d2f0b9f551e8";
const [activeStake, inactiveStake, pendingInactiveStake] = await aptos.view(
{
payload: {
function: "0x1::delegation_pool::get_stake",
typeArguments: [],
functionArguments: [poolAddress, delegatorAddr],
},
options: {
ledgerVersion: 0, // last ledger version of the epoch
},
}
);
// find how much APT users staked during each epoch. subtraction gives you reward at each epoch
}; |
Beta Was this translation helpful? Give feedback.
I found this doc, it might give you some ideas.
I don't have a good solution right now, and i'm asking around.
This thread might also be helpful.
A pretty complex solution I can think of.