-
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.
add evm onboarding blocklist functionality
- Loading branch information
1 parent
8c83149
commit 4bca82a
Showing
3 changed files
with
103 additions
and
0 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
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
28 changes: 28 additions & 0 deletions
28
cadence/transactions/bridge/admin/blocklist/block_evm_address.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,28 @@ | ||
import "EVM" | ||
|
||
import "FlowEVMBridgeConfig" | ||
|
||
/// Blocks the given EVM contract address from onboarding. | ||
/// | ||
/// @param evmContractHex: The EVM contract address to block from onboarding | ||
/// | ||
transaction(evmContractHex: String) { | ||
|
||
let admin: auth(FlowEVMBridgeConfig.Blocklist) &FlowEVMBridgeConfig.Admin | ||
let evmAddress: EVM.EVMAddress | ||
|
||
prepare(signer: auth(BorrowValue) &Account) { | ||
self.admin = signer.storage.borrow<auth(FlowEVMBridgeConfig.Blocklist) &FlowEVMBridgeConfig.Admin>( | ||
from: FlowEVMBridgeConfig.adminStoragePath | ||
) ?? panic("Could not borrow FlowEVMBridgeConfig Admin reference") | ||
self.evmAddress = EVM.addressFromString(evmContractHex) | ||
} | ||
|
||
execute { | ||
self.admin.blockEVMAddress(self.evmAddress) | ||
} | ||
|
||
post { | ||
FlowEVMBridgeConfig.isEVMAddressBlocked(self.evmAddress): "Fee was not set correctly" | ||
} | ||
} |