Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions lib/price.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,19 @@ export const mcv2BondAbi = [
name: "getRoyaltyInfo",
stateMutability: "view",
inputs: [
{ name: "token", type: "address" },
{ name: "beneficiary", type: "address" },
{ name: "wallet", type: "address" },
{ name: "reserveToken", type: "address" },
],
outputs: [
{ name: "balance", type: "uint256" },
{ name: "claimed", type: "uint256" },
],
outputs: [{ name: "unclaimed", type: "uint256" }],
},
{
type: "function",
name: "claimRoyalties",
stateMutability: "nonpayable",
inputs: [{ name: "token", type: "address" }],
inputs: [{ name: "reserveToken", type: "address" }],
outputs: [],
},
priceForNextMintFunction,
Expand Down
10 changes: 5 additions & 5 deletions src/components/ClaimRoyalties.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { formatUnits, type Address } from "viem";
import { publicClient } from "../../lib/rpc";
import { mcv2BondAbi, getTokenTVL } from "../../lib/price";
import { MCV2_BOND, IS_TESTNET, EXPLORER_URL } from "../../lib/contracts/constants";
import { MCV2_BOND, IS_TESTNET, EXPLORER_URL, PLOT_TOKEN } from "../../lib/contracts/constants";

function formatTruncated(value: bigint, decimals: number, digits = 10): string {
const raw = formatUnits(value, decimals);
Expand Down Expand Up @@ -39,13 +39,13 @@
const { data: royaltyInfo, refetch } = useQuery({
queryKey: ["royalty-info", tokenAddress, beneficiary],
queryFn: async () => {
const unclaimed = await publicClient.readContract({
const [balance] = await publicClient.readContract({
address: MCV2_BOND,
abi: mcv2BondAbi,
functionName: "getRoyaltyInfo",
args: [tokenAddress, beneficiary],
args: [beneficiary, PLOT_TOKEN],
});
return { unclaimed };
return { unclaimed: balance };
},
refetchInterval: 30000,
});
Expand All @@ -71,7 +71,7 @@
address: MCV2_BOND,
abi: mcv2BondAbi,
functionName: "claimRoyalties",
args: [tokenAddress],
args: [PLOT_TOKEN],
});
setTxHash(hash);

Expand All @@ -84,7 +84,7 @@
setError(err instanceof Error ? err.message : "Claim failed");
setTxState("error");
}
}, [tokenAddress, unclaimed, writeContractAsync, refetch]);

Check warning on line 87 in src/components/ClaimRoyalties.tsx

View workflow job for this annotation

GitHub Actions / lint-and-typecheck

React Hook useCallback has an unnecessary dependency: 'tokenAddress'. Either exclude it or remove the dependency array

const reset = useCallback(() => {
setTxState("idle");
Expand Down
Loading