Skip to content

Commit

Permalink
fix: update blockchain helper to use correct contract address for tok…
Browse files Browse the repository at this point in the history
…en allowance

- Modify getNetwork to explicitly cast network to SupportedChain
- Update allowance retrieval to use BINARY_PREDICTION_CONTRACT_ADDRESS
- Ensure correct contract address is used when checking token allowance
  • Loading branch information
nicky-ru committed Feb 1, 2025
1 parent 46237f5 commit 441fd8b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/plugin-depin/src/helpers/blockchain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const getNetwork = (): SupportedChain => {
if (!chain) {
throw new Error("Invalid network");
}
return chain;
return network as SupportedChain;
};

export const resolvePrediction = async (
Expand Down Expand Up @@ -234,7 +234,7 @@ const getBetAmount = async (
address: process.env.PREDICTION_TOKEN as `0x${string}`,
abi: erc20Abi,
functionName: "allowance",
args: [bettor, account],
args: [bettor, process.env.BINARY_PREDICTION_CONTRACT_ADDRESS as `0x${string}`],
})) as bigint;

if (allowance <= BigInt(0)) {
Expand Down

0 comments on commit 441fd8b

Please sign in to comment.