Skip to content

Commit

Permalink
Update wagmi config and hooks
Browse files Browse the repository at this point in the history
Why:
* The wagmi config was using the etherscan plugin to fetch contract data
  from Etherscan

How:
* Setting the deployed contract address in the Foundry
* Updating the hooks that call the contract to use the `Ctznd` prefix
  • Loading branch information
DavideSilva committed May 2, 2024
1 parent 3a702dd commit d26a2c5
Show file tree
Hide file tree
Showing 5 changed files with 9,835 additions and 10,954 deletions.
12 changes: 2 additions & 10 deletions packages/contracts/wagmi.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,14 @@ import { foundry, react, etherscan } from "@wagmi/cli/plugins";
export default defineConfig({
out: "../web-app/wagmi.generated.ts",
plugins: [
etherscan({
apiKey: process.env.ETHERSCAN_API_KEY!,
chainId: 11155111,
contracts: [
{
name: "CtzndSale",
address: "0xf2eacaa2b8374d648b2f1bab51c0e0add18ec0d1",
},
],
}),
foundry({
project: "./",
exclude: ["MockERC20.sol", "Sale.d.sol"],
namePrefix: "Ctznd",
deployments: {
Sale: {
31337: "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0",
11155111: "0xf2eacaa2b8374d648b2f1bab51c0e0add18ec0d1",
},
},
}),
Expand Down
4 changes: 2 additions & 2 deletions packages/web-app/app/_lib/actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
ctzndSaleAddress,
useReadCtzndSalePaymentToken,
useWriteCtzndSaleBuy,
useWriteErc20Approve,
useWriteCtzndErc20Approve,
} from '@/wagmi.generated';
import { sepolia } from 'viem/chains';

Expand Down Expand Up @@ -236,7 +236,7 @@ export const useSetPaymentTokenAllowance = () => {
data: allowanceTxHash,
error,
isPending,
} = useWriteErc20Approve();
} = useWriteCtzndErc20Approve();

const setAllowance = useCallback(
(amountInWei: bigint) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/web-app/app/_lib/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
ctzndSaleAddress,
useReadCtzndSalePaymentToken,
useReadCtzndSalePaymentTokenToToken,
useReadErc20Allowance,
useReadCtzndErc20Allowance,
} from '@/wagmi.generated';
import { formatEther, parseEther } from 'viem';
import { sepolia } from 'viem/chains';
Expand Down Expand Up @@ -194,7 +194,7 @@ export const useCtzndPaymentTokenAllowance = (userAddress: `0x${string}`) => {
data: allowance,
isLoading,
error,
} = useReadErc20Allowance({
} = useReadCtzndErc20Allowance({
address: paymentToken,
args: [userAddress, saleAddress],
query: {
Expand Down
1 change: 0 additions & 1 deletion packages/web-app/app/_providers/idos/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export const IdOsProvider = ({ children }: PropsWithChildren) => {

// Authenticate by signing a message
if (profile) {
// @ts-expect-error
await sdk.setSigner('EVM', ethSigner);
setHasSigner(true);
return;
Expand Down
Loading

0 comments on commit d26a2c5

Please sign in to comment.