Skip to content

Commit

Permalink
Merge pull request #119 from onflow/add-onboarding-type-assertion
Browse files Browse the repository at this point in the history
Add type assertion to onboarding Vault
  • Loading branch information
sisyphusSmiling authored Sep 4, 2024
2 parents ca95d45 + fa5f613 commit 7d4a2ff
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 7d4a2ff

Please sign in to comment.