Skip to content

Commit

Permalink
Merge pull request #171 from lidofinance/fix/wrap-steth-allowance
Browse files Browse the repository at this point in the history
Fix: check allowance during stETH wrapping
  • Loading branch information
alx-khramov committed Sep 20, 2024
2 parents 4548fde + 6420578 commit 26876a9
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 26876a9

Please sign in to comment.