@@ -132,15 +132,16 @@ access(all) contract ERC4626SinkConnectors {
132132 // approve the ERC4626 vault to spend the assets on deposit
133133 let uintAmount = FlowEVMBridgeUtils .convertCadenceAmountToERC20Amount (amount , erc20Address : self .assetEVMAddress )
134134 let approveRes = self ._call (
135- to : self .assetEVMAddress ,
136- signature : " approve(address,uint256)" ,
137- args : [self .vault , uintAmount ],
138- gasLimit : 500_000
139- )!
140- if approveRes .status ! = EVM .Status .successful {
141- // Cadence panic reverts all EVM state changes in this transaction, so no need to bridge token back.
142- panic (self ._approveErrorMessage (ufixAmount : amount , uintAmount : uintAmount , approveRes : approveRes ))
143- }
135+ to : self .assetEVMAddress ,
136+ signature : " approve(address,uint256)" ,
137+ args : [self .vault , uintAmount ],
138+ gasLimit : 500_000
139+ )!
140+ // Cadence panic reverts all EVM state changes in this transaction, so no need to bridge token back.
141+ assert (
142+ approveRes .status == EVM .Status .successful ,
143+ message : self ._approveErrorMessage (ufixAmount : amount , uintAmount : uintAmount , approveRes : approveRes )
144+ )
144145
145146 // deposit the assets to the ERC4626 vault
146147 let depositRes = self ._call (
@@ -149,11 +150,12 @@ access(all) contract ERC4626SinkConnectors {
149150 args : [uintAmount , self .coa .borrow ()! .address ()],
150151 gasLimit : 1_000_000
151152 )!
152- if depositRes .status ! = EVM .Status .successful {
153- // No need to revoke the approval: a Cadence panic atomically reverts all EVM
154- // state changes made in this transaction, including the approve() call above.
155- panic (self ._depositErrorMessage (ufixAmount : amount , uintAmount : uintAmount , depositRes : depositRes ))
156- }
153+ // No need to revoke the approval: a Cadence panic atomically reverts all EVM
154+ // state changes made in this transaction, including the approve() call above.
155+ assert (
156+ depositRes .status == EVM .Status .successful ,
157+ message : self ._depositErrorMessage (ufixAmount : amount , uintAmount : uintAmount , depositRes : depositRes )
158+ )
157159 }
158160 /// Returns a ComponentInfo struct containing information about this component and a list of ComponentInfo for
159161 /// each inner component in the stack.
0 commit comments