Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use arbitrum for submissions on ethereum vaults #659

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
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
9 changes: 7 additions & 2 deletions packages/web/src/contracts/write/LogClaim.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { HATSVaultV1_abi, HATSVaultsRegistry_abi } from "@hats.finance/shared";
import { IVault } from "types";
import { IS_PROD } from "settings";
import * as wagmiChains from "@wagmi/chains";

import { switchNetworkAndValidate } from "utils/switchNetwork.utils";
import { useContractWrite, useNetwork } from "wagmi";

Expand All @@ -14,8 +17,10 @@ export class LogClaimContract {
* @param vault - The selected vault to send the claim
*/
static hook = (vault?: IVault) => {
const DEFAULT_NETWORK_TO_USE = IS_PROD ? wagmiChains.arbitrum.id as number : wagmiChains.sepolia.id as number;
let useChaninId = DEFAULT_NETWORK_TO_USE;
useChaninId = vault!.chainId !== wagmiChains.mainnet.id ? vault!.chainId:useChaninId;
const { chain } = useNetwork();

const contractAddress = vault?.master.address ?? "";
const registryAbi = vault?.version === "v1" ? HATSVaultV1_abi : HATSVaultsRegistry_abi;
const method = vault?.version === "v1" ? "claim" : "logClaim";
Expand All @@ -32,7 +37,7 @@ export class LogClaimContract {
...claim,
send: async (data: string) => {
if (!vault) return;
await switchNetworkAndValidate(chain!.id, vault!.chainId as number);
await switchNetworkAndValidate(chain!.id, useChaninId);

return claim.write!({ recklesslySetUnpreparedArgs: [data] });
},
Expand Down
Loading