Skip to content

Commit

Permalink
fix: not being able to claim from V1 staking (#739)
Browse files Browse the repository at this point in the history
* fix: not being able to claim from V1 staking

* chore: clarify TX param

* fix: error when reloading the app at /stake/rewards
  • Loading branch information
danielattilasimon authored Jan 22, 2025
1 parent 5b908fb commit f08e4fd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions frontend/app/src/screens/StakeScreen/PanelRewards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { useTransactionFlow } from "@/src/services/TransactionFlow";
import { css } from "@/styled-system/css";
import { Button, HFlex, TokenIcon, VFlex } from "@liquity2/uikit";
import * as dn from "dnum";
import { encodeFunctionData } from "viem";
import { encodeFunctionData, zeroAddress } from "viem";
import { useEstimateGas, useGasPrice } from "wagmi";

export function PanelRewards() {
Expand All @@ -26,16 +26,16 @@ export function PanelRewards() {
const ethPrice = usePrice("ETH");

const stakePosition = useStakePosition(account.address ?? null);
const LqtyStaking = getProtocolContract("LqtyStaking");
const Governance = getProtocolContract("Governance");

const gasEstimate = useEstimateGas({
account: account.address,
data: encodeFunctionData({
abi: LqtyStaking.abi,
functionName: "unstake",
args: [0n],
abi: Governance.abi,
functionName: "claimFromStakingV1",
args: [account.address ?? zeroAddress], // address to receive the payout
}),
to: LqtyStaking.address,
to: Governance.address,
});

const gasPrice = useGasPrice();
Expand Down
8 changes: 4 additions & 4 deletions frontend/app/src/tx-flows/stakeClaimRewards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ export const stakeClaimRewards: FlowDeclaration<StakeClaimRewardsRequest> = {
name: () => "Claim rewards",
Status: TransactionStatus,

async commit({ contracts, wagmiConfig }) {
async commit({ contracts, wagmiConfig, request }) {
return writeContract(wagmiConfig, {
...contracts.LqtyStaking,
functionName: "unstake",
args: [0n],
...contracts.Governance,
functionName: "claimFromStakingV1",
args: [request.stakePosition.owner], // address to receive the payout
});
},

Expand Down

0 comments on commit f08e4fd

Please sign in to comment.