Skip to content

Commit

Permalink
fix: wrap stETH – check allowance
Browse files Browse the repository at this point in the history
  • Loading branch information
alx-khramov committed Sep 20, 2024
1 parent 4548fde commit 6420578
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apps/demo-react/features/wrap-unwrap/wrap-unwrap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ export const WrapUnwrap: FC = () => {

const handleWrapSteth = useCallback(
async (callData: WrapProps) => {
await wrap.getStethForWrapAllowance(account); // get existing allowance
await wrap.approveStethForWrap(callData); // if value is more than allowance perform approve
const allowance = await wrap.getStethForWrapAllowance(account);
if (BigInt(callData.value) > allowance) {
await wrap.approveStethForWrap(callData);
}
return wrap.wrapSteth(callData);
},
[account, wrap],
Expand Down

0 comments on commit 6420578

Please sign in to comment.