diff --git a/cadence/contracts/bridge/FlowEVMBridgeNFTEscrow.cdc b/cadence/contracts/bridge/FlowEVMBridgeNFTEscrow.cdc index 83c342ed..78fde7e4 100644 --- a/cadence/contracts/bridge/FlowEVMBridgeNFTEscrow.cdc +++ b/cadence/contracts/bridge/FlowEVMBridgeNFTEscrow.cdc @@ -131,9 +131,12 @@ access(all) contract FlowEVMBridgeNFTEscrow { /// Retrieves an entitled locker for the given type or nil if it doesn't exist /// access(self) view fun borrowLocker(forType: Type): auth(NonFungibleToken.Withdraw) &Locker? { - let lockerPath = FlowEVMBridgeUtils.deriveEscrowStoragePath(fromType: forType) - ?? panic("Problem deriving locker path") - return self.account.storage.borrow(from: lockerPath) + if let lockerPath = FlowEVMBridgeUtils.deriveEscrowStoragePath(fromType: forType) { + if self.account.storage.type(at: lockerPath) == Type<@Locker>() { + return self.account.storage.borrow(from: lockerPath) + } + } + return nil } /********************* diff --git a/cadence/contracts/bridge/FlowEVMBridgeTokenEscrow.cdc b/cadence/contracts/bridge/FlowEVMBridgeTokenEscrow.cdc index b1fb6c3c..a8c9eebf 100644 --- a/cadence/contracts/bridge/FlowEVMBridgeTokenEscrow.cdc +++ b/cadence/contracts/bridge/FlowEVMBridgeTokenEscrow.cdc @@ -120,9 +120,12 @@ access(all) contract FlowEVMBridgeTokenEscrow { /// Retrieves an entitled locker for the given type or nil if it doesn't exist /// access(self) view fun borrowLocker(forType: Type): auth(FungibleToken.Withdraw) &Locker? { - let lockerPath = FlowEVMBridgeUtils.deriveEscrowStoragePath(fromType: forType) - ?? panic("Problem deriving locker path") - return self.account.storage.borrow(from: lockerPath) + if let lockerPath = FlowEVMBridgeUtils.deriveEscrowStoragePath(fromType: forType) { + if self.account.storage.type(at: lockerPath) == Type<@Locker>() { + return self.account.storage.borrow(from: lockerPath) + } + } + return nil } /*********************