Skip to content

Commit

Permalink
add type assertion to onboarding Vault
Browse files Browse the repository at this point in the history
  • Loading branch information
sisyphusSmiling committed Sep 4, 2024
1 parent ca95d45 commit fa5f613
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cadence/contracts/bridge/FlowEVMBridge.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,13 @@ contract FlowEVMBridge : IFlowEVMNFTBridge, IFlowEVMTokenBridge {
} else if type.isSubtype(of: Type<@{FungibleToken.Vault}>()) {
let createVaultFunction = FlowEVMBridgeUtils.getCreateEmptyVaultFunction(forType: type)
?? panic("Could not retrieve createEmptyVault function for the given type")
let vault <-createVaultFunction(type)
assert(
vault.getType() == type,
message: "Requested to onboard type=".concat(type.identifier).concat( "but contract returned type=").concat(vault.getType().identifier)
)
FlowEVMBridgeTokenEscrow.initializeEscrow(
with: <-createVaultFunction(type),
with: <-vault,
name: onboardingValues.name,
symbol: onboardingValues.symbol,
decimals: onboardingValues.decimals!,
Expand Down

0 comments on commit fa5f613

Please sign in to comment.