Description
Allow users to withdraw their staked USDC from the VotingEngine contract after a battle is finalized.
Tasks
Contract Functions Used
VotingEngine.withdraw(uint256 battleId) - Withdraw staked USDC
VotingEngine.withdrawalsEnabled(uint256) - Check if withdrawals are enabled
VotingEngine.votes(uint256, address) - Get user's vote info (amount to withdraw)
Files to Modify
frontend/app/battles/[id]/page.tsx
frontend/app/profile/page.tsx
frontend/hooks/useWithdraw.ts (new file)
Description
Allow users to withdraw their staked USDC from the
VotingEnginecontract after a battle is finalized.Tasks
useWithdraw()that callsVotingEngine.withdraw(battleId)via wagmiVotingEngine.withdrawalsEnabled(battleId)VotingEngine.votes(battleId, userAddress).amountFINALIZEDand withdrawals are enabledContract Functions Used
VotingEngine.withdraw(uint256 battleId)- Withdraw staked USDCVotingEngine.withdrawalsEnabled(uint256)- Check if withdrawals are enabledVotingEngine.votes(uint256, address)- Get user's vote info (amount to withdraw)Files to Modify
frontend/app/battles/[id]/page.tsxfrontend/app/profile/page.tsxfrontend/hooks/useWithdraw.ts(new file)