Skip to content

Commit

Permalink
staking report total claimed rewards
Browse files Browse the repository at this point in the history
  • Loading branch information
mrq1911 committed Jan 10, 2024
1 parent d1f2216 commit 9f9cf11
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/handlers/staking.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ async function stakeHandler({event: {data: {who, stake}}}) {
broadcast(`${formatAccount(who, false, emojify(who))} staked **${formatAmount(hdx(stake))}**`);
}

async function unstakeHandler({event, siblings}) {
async function unstakeHandler({event}) {
const {data: {who, unlockedStake}} = event;
broadcast(`${formatAccount(who, false, emojify(who))} unstaked **${formatAmount(hdx(unlockedStake))}** <:cheems:989553853785587723>`);
}

async function rewardsClaimedHandler({event: {data: {who, paidRewards, slashedUnpaidRewards}}}) {
if (Number(paidRewards) > 0) {
const message = `${formatAccount(who, false, emojify(who))} claimed **${formatAmount(hdx(paidRewards))}** and forfeited **${formatAmount(hdx(slashedUnpaidRewards))}**`;
async function rewardsClaimedHandler({event: {data: {who, paidRewards, unlockedRewards, slashedUnpaidRewards}}}) {
const totalRewards = Number(paidRewards) + Number(unlockedRewards);
if (totalRewards > 0) {
const message = `${formatAccount(who, false, emojify(who))} claimed **${formatAmount(hdx(totalRewards))}** and forfeited **${formatAmount(hdx(slashedUnpaidRewards))}**`;
broadcast(message);
}
}

0 comments on commit 9f9cf11

Please sign in to comment.