Skip to content

Commit

Permalink
add EVM.BridgeRouter initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
sisyphusSmiling committed Apr 30, 2024
1 parent fdf26e1 commit 2c7c1c2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions fvm/evm/stdlib/contract.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,14 @@ contract EVM {
}
}

/// Initializes the BridgeRouter resource. Can only be executed if there is not already a BridgeRouter resource.
access(all) fun initBridgeRouter() {
pre {
self.account.type(at: /storage/evmBridgeRouter) == nil: "BridgeRouter has already been initialized"
}
self.account.save(<-create BridgeRouter(), to: /storage/evmBridgeRouter)
}

/// Returns a reference to the BridgeAccessor designated for internal bridge requests
access(self)
view fun borrowBridgeAccessor(): &{BridgeAccessor} {
Expand Down

0 comments on commit 2c7c1c2

Please sign in to comment.