-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from onflow/evm-updates
Updates to EVM interface
- Loading branch information
Showing
10 changed files
with
144 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
ignore: | ||
- "./cadence/contracts/example-assets/*" | ||
- "./cadence/contracts/utils/ArrayUtils.cdc" | ||
- "./cadence/contracts/utils/StringUtils.cdc" | ||
- "./cadence/contracts/utils/ScopedFTProvider.cdc" | ||
- "./cadence/contracts/standards/Burner.cdc" | ||
- "./cadence/contracts/standards/FlowStorageFees.cdc" | ||
- "./cadence/contracts/standards/FlowToken.cdc" | ||
- "./cadence/contracts/standards/FungibleToken.cdc" | ||
- "./cadence/contracts/standards/FungibleTokenMetadataViews.cdc" | ||
- "./cadence/contracts/standards/NonFungibleToken.cdc" | ||
- "./cadence/contracts/standards/ViewResolver.cdc" | ||
- "./cadence/contracts/templates/emulator/*" | ||
- "./cadence/contracts/templates/previewnet/*" | ||
- "./cadence/contracts/test/*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,4 +22,7 @@ coverage.lcov | |
|
||
# Keys | ||
*.pkey | ||
*.pem | ||
*.pem | ||
|
||
# Local configs | ||
local.flow.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
cadence/transactions/bridge/admin/claim_and_set_accessor_capability.cdc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import "EVM" | ||
|
||
import "FlowEVMBridgeAccessor" | ||
|
||
/// This transaction is intended to be run by the EVM contract account after FlowEVMBridgeAccessor.BridgeAccessor in the | ||
/// event the BridgeAccessor Capability needs to be reset within the store BridgeRouter. Within this transacion, the | ||
/// prepare block assumes a BridgeRouter is already stored at /storage/evmBridgeRouter. | ||
/// | ||
/// @param name: The name of the BridgeAccessor Capability to claim | ||
/// @param provider: The address of the account that published the BridgeAccessor Capability | ||
/// | ||
transaction(name: String, provider: Address) { | ||
|
||
let accessorCap: Capability<auth(EVM.Bridge) &FlowEVMBridgeAccessor.BridgeAccessor> | ||
let router: auth(EVM.Bridge) &{EVM.BridgeRouter} | ||
|
||
prepare(signer: auth(BorrowValue, ClaimInboxCapability, SaveValue) &Account) { | ||
// Claim the BridgeAccessor Capability | ||
self.accessorCap = signer.inbox.claim<auth(EVM.Bridge) &FlowEVMBridgeAccessor.BridgeAccessor>( | ||
name, | ||
provider: provider | ||
) ?? panic("BridgeAccessor Capability not found") | ||
|
||
// Ensure the Capability is valid | ||
assert(self.accessorCap.check() == true, message: "Invalid BridgeAccessor Capability") | ||
|
||
// Borrow the router from storage and set the BridgeAccessor Capability | ||
self.router = signer.storage.borrow<auth(EVM.Bridge) &{EVM.BridgeRouter}>(from: /storage/evmBridgeRouter) | ||
?? panic("BridgeRouter not found in storage") | ||
} | ||
|
||
execute { | ||
self.router.setBridgeAccessor(self.accessorCap) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters