Skip to content

Commit 0e33ac7

Browse files
authored
Merge pull request #58 from lidofinance/fix/repay-allowance-approve-status
Repay allowance approve status
2 parents 1d2e2ba + 642c358 commit 0e33ac7

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

features/adjustment/repay/hooks/use-burn.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,19 @@ export const useBurn = (onMutate = () => {}) => {
5858
if (needsAllowance) {
5959
setModalState({ step: SubmitStepEnum.confirming });
6060

61-
const receipt = await tokenContract.approve({
61+
const result = await tokenContract.approve({
6262
amount: maxUint256,
6363
to: activeVault.owner,
6464
callback: async (props) => {
6565
if (props.stage === 'receipt') {
66-
setModalState({
67-
step: SubmitStepEnum.submitting,
68-
tx: receipt.hash,
69-
});
66+
setModalState({ step: SubmitStepEnum.submitting });
7067
}
7168
},
7269
});
7370

74-
await publicClient.waitForTransactionReceipt({
75-
hash: receipt.hash,
76-
});
71+
if (result.receipt?.status === 'reverted') {
72+
throw new Error('Transaction was reverted');
73+
}
7774
}
7875

7976
setModalState({ step: SubmitStepEnum.confirming });

0 commit comments

Comments
 (0)