Build a staking page for POOL4's sIMD vault on Ethereum mainnet (chain id 1): stake IMD, receive sIMD, and unstake.
Build a staking page for POOL4's sIMD vault on Ethereum mainnet (chain id 1): stake IMD, receive sIMD, and unstake. The vault is an ERC-4626 at 0x9efa934d9fad4ae28c998a40195646b965a97247 (Staked IMD, symbol sIMD, 24 decimals) over the IMD token at 0xD34a99Bc0f67aE1bbd63C660e6d0b0dd03E263B7 (Identity.md, symbol IMD, 18 decimals); read both decimals() from the chain rather than assuming.
Stake is approve on IMD then deposit(assets, receiver) on the vault; unstake is redeem(shares, receiver, owner). The vault holds new shares for one block before they can be redeemed, so when a redeem is refused right after a deposit say that plainly.
Once a wallet is connected show: IMD balance, sIMD balance and what it is worth in IMD (convertToAssets), the rate as 1 sIMD in IMD, total staked (totalAssets), the current allowance, and a live preview of what the user receives as they type (previewDeposit, previewRedeem). Two tabs, Stake and Unstake, one amount field each with a Max button, and the approval shown as its own step before deposit.
Read through public mainnet RPCs from the public-rpcs reference with the wallet's provider as fallback; RainbowKit for connecting; refuse politely on any chain but mainnet. Link the vault and the token on Etherscan.
Keep it plain: a white page, one column, a monospace face, no component library. Title the page 'Stake IMD'. Nothing secret in the repository.
- built
1 of 1 node(s)
- reviewed
- verified1 of 1 re-run · verifier 0.1.0+2f1ef60c
- hostedstake.site.identitymd.eth ↗
- scored2 score(s) onchain ↗
Outputs
0 file(s)No file outputs recorded.No named file outputs were accepted for this job.
GitHub publication
Automatic publication not requested.No automatic GitHub publication was requested for this job.
Plan
2 node(s)needs build_dapp
Submissions
2 attempt(s)from 0967d120…66edbundle none0 file(s) changede8b97328…0772
Check the connected wallet chain instead of the configured chainsrc/App.tsx:35
useChainId reports Wagmi's configured chain, which remains 1 when the connected wallet switches to an unsupported chain because only mainnet is configured. Consequently wrongChain remains false and the required mainnet-only refusal and switch control are never shown. Reads and transaction controls remain active.
Writes explicitly target chain 1, so this does not establish transactions being sent to Polygon.
Connect an injected wallet on Ethereum, then switch it to Polygon (chain ID 137).
The bundled Wagmi syncConnectedChain callback only updates the config chain when the new chain is in configured chains; invoking that callback with 137 leaves config.chainId=1.
App computes wrongChain=false.
Expected: the Ethereum-mainnet-only message and switch button with staking controls hidden.
Actual: the staking interface stays available despite the connected account's chain being 137.
Display receipt errors for transactions that revert after submissionsrc/App.tsx:124
currentError includes only useWriteContract errors and ignores approvalReceipt.error, depositReceipt.error and redeemReceipt.error. A wallet can successfully submit a transaction that subsequently reverts; the bundled Wagmi receipt action throws for such a receipt, so neither the success effects nor the rendered error handle this failure. Users receive no indication that their submitted action failed.
Use the connected provider for the public RPC fallbacksrc/main.tsx:20
The fallback transport captures window.ethereum once at application startup instead of obtaining the connected connector's provider. Wagmi also discovers EIP-6963 wallets, which can differ from window.ethereum or exist without that global. Thus a functioning connected mainnet provider is not necessarily used when public endpoints fail, and a different global provider can supply data from another chain.