From 5d50e09f73ce348ff2791aec93bdeed68a159e51 Mon Sep 17 00:00:00 2001 From: Giovanni Sanchez <108043524+sisyphusSmiling@users.noreply.github.com> Date: Mon, 15 Apr 2024 20:18:34 -0500 Subject: [PATCH] fix failing tests --- .../bridge/type_requires_onboarding.cdc | 9 +++------ .../type_requires_onboarding_by_identifier.cdc | 14 ++++++++++++++ cadence/tests/flow_evm_bridge_tests.cdc | 18 +++++++++--------- 3 files changed, 26 insertions(+), 15 deletions(-) create mode 100644 cadence/scripts/bridge/type_requires_onboarding_by_identifier.cdc diff --git a/cadence/scripts/bridge/type_requires_onboarding.cdc b/cadence/scripts/bridge/type_requires_onboarding.cdc index 3b14f14b..73861859 100644 --- a/cadence/scripts/bridge/type_requires_onboarding.cdc +++ b/cadence/scripts/bridge/type_requires_onboarding.cdc @@ -2,13 +2,10 @@ import "FlowEVMBridge" /// Returns whether a type needs to be onboarded to the FlowEVMBridge /// -/// @param identifier: The identifier of the Cadence Type in question +/// @param type: The Cadence Type in question /// /// @return Whether the type requires onboarding to the FlowEVMBridge if the type is bridgeable, otherwise nil /// -access(all) fun main(identifier: String): Bool? { - if let type = CompositeType(identifier) { - return FlowEVMBridge.typeRequiresOnboarding(type) - } - return nil +access(all) fun main(type: Type): Bool? { + return FlowEVMBridge.typeRequiresOnboarding(type) } diff --git a/cadence/scripts/bridge/type_requires_onboarding_by_identifier.cdc b/cadence/scripts/bridge/type_requires_onboarding_by_identifier.cdc new file mode 100644 index 00000000..3b14f14b --- /dev/null +++ b/cadence/scripts/bridge/type_requires_onboarding_by_identifier.cdc @@ -0,0 +1,14 @@ +import "FlowEVMBridge" + +/// Returns whether a type needs to be onboarded to the FlowEVMBridge +/// +/// @param identifier: The identifier of the Cadence Type in question +/// +/// @return Whether the type requires onboarding to the FlowEVMBridge if the type is bridgeable, otherwise nil +/// +access(all) fun main(identifier: String): Bool? { + if let type = CompositeType(identifier) { + return FlowEVMBridge.typeRequiresOnboarding(type) + } + return nil +} diff --git a/cadence/tests/flow_evm_bridge_tests.cdc b/cadence/tests/flow_evm_bridge_tests.cdc index c5d2ce80..59a37e60 100644 --- a/cadence/tests/flow_evm_bridge_tests.cdc +++ b/cadence/tests/flow_evm_bridge_tests.cdc @@ -440,8 +440,8 @@ fun testUpdateBridgeFeesSucceeds() { access(all) fun testOnboardNFTByTypeSucceeds() { - var onboaringRequiredResult = executeScript( - "../scripts/bridge/type_requires_onboarding.cdc", + var onboaringRequiredResult: Test.ScriptResult = executeScript( + "../scripts/bridge/type_requires_onboarding_by_identifier.cdc", [exampleNFTIdentifier] ) Test.expect(onboaringRequiredResult, Test.beSucceeded()) @@ -449,14 +449,14 @@ fun testOnboardNFTByTypeSucceeds() { Test.assertEqual(true, requiresOnboarding) var onboardingResult = executeTransaction( - "../transactions/bridge/onboarding/onboard_by_type.cdc", + "../transactions/bridge/onboarding/onboard_by_type_identifier.cdc", [exampleNFTIdentifier], alice ) Test.expect(onboardingResult, Test.beSucceeded()) onboaringRequiredResult = executeScript( - "../scripts/bridge/type_requires_onboarding.cdc", + "../scripts/bridge/type_requires_onboarding_by_identifier.cdc", [exampleNFTIdentifier] ) Test.expect(onboaringRequiredResult, Test.beSucceeded()) @@ -464,7 +464,7 @@ fun testOnboardNFTByTypeSucceeds() { Test.assertEqual(false, requiresOnboarding) onboardingResult = executeTransaction( - "../transactions/bridge/onboarding/onboard_by_type.cdc", + "../transactions/bridge/onboarding/onboard_by_type_identifier.cdc", [exampleNFTIdentifier], alice ) @@ -510,7 +510,7 @@ fun testOnboardERC721ByEVMAddressSucceeds() { access(all) fun testOnboardTokenByTypeSucceeds() { var onboaringRequiredResult = executeScript( - "../scripts/bridge/type_requires_onboarding.cdc", + "../scripts/bridge/type_requires_onboarding_by_identifier.cdc", [exampleTokenIdentifier] ) Test.expect(onboaringRequiredResult, Test.beSucceeded()) @@ -518,14 +518,14 @@ fun testOnboardTokenByTypeSucceeds() { Test.assertEqual(true, requiresOnboarding) var onboardingResult = executeTransaction( - "../transactions/bridge/onboarding/onboard_by_type.cdc", + "../transactions/bridge/onboarding/onboard_by_type_identifier.cdc", [exampleTokenIdentifier], alice ) Test.expect(onboardingResult, Test.beSucceeded()) onboaringRequiredResult = executeScript( - "../scripts/bridge/type_requires_onboarding.cdc", + "../scripts/bridge/type_requires_onboarding_by_identifier.cdc", [exampleTokenIdentifier] ) Test.expect(onboaringRequiredResult, Test.beSucceeded()) @@ -533,7 +533,7 @@ fun testOnboardTokenByTypeSucceeds() { Test.assertEqual(false, requiresOnboarding) onboardingResult = executeTransaction( - "../transactions/bridge/onboarding/onboard_by_type.cdc", + "../transactions/bridge/onboarding/onboard_by_type_identifier.cdc", [exampleTokenIdentifier], alice )