Skip to content

Commit

Permalink
Merge pull request #90 from onflow/cross-vm-transfer
Browse files Browse the repository at this point in the history
Add cross-VM transfer NFT/FT to and from EVM
  • Loading branch information
sisyphusSmiling authored Jun 27, 2024
2 parents 01691c9 + dbd804d commit 1a7f269
Show file tree
Hide file tree
Showing 14 changed files with 873 additions and 93 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ coverage.lcov
local.flow.json

# Local
.DS_Store
.DS_Store
.vscode/
43 changes: 30 additions & 13 deletions cadence/tests/flow_evm_bridge_handler_tests.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,11 @@ fun testBridgeHandledCadenceNativeTokenToEVMFails() {
// Execute bridge to EVM - should fail since Handler is not enabled
bridgeTokensToEVM(
signer: alice,
contractAddr: exampleHandledTokenAccount.address,
contractName: "ExampleHandledToken",
vaultIdentifier: buildTypeIdentifier(
address: exampleHandledTokenAccount.address,
contractName: "ExampleHandledToken",
resourceName: "Vault"
),
amount: cadenceBalance,
beFailed: true
)
Expand All @@ -474,8 +477,11 @@ fun testBridgeHandledCadenceNativeTokenFromEVMFails() {
// Execute bridge from EVM
bridgeTokensFromEVM(
signer: alice,
contractAddr: exampleHandledTokenAccount.address,
contractName: "ExampleHandledToken",
vaultIdentifier: buildTypeIdentifier(
address: exampleHandledTokenAccount.address,
contractName: "ExampleHandledToken",
resourceName: "Vault"
),
amount: evmBalance,
beFailed: true
)
Expand Down Expand Up @@ -518,8 +524,11 @@ fun testBridgeHandledCadenceNativeTokenToEVMFirstSucceeds() {
// Execute bridge to EVM
bridgeTokensToEVM(
signer: alice,
contractAddr: exampleHandledTokenAccount.address,
contractName: "ExampleHandledToken",
vaultIdentifier: buildTypeIdentifier(
address: exampleHandledTokenAccount.address,
contractName: "ExampleHandledToken",
resourceName: "Vault"
),
amount: cadenceBalance,
beFailed: false
)
Expand Down Expand Up @@ -557,8 +566,11 @@ fun testBridgeHandledCadenceNativeTokenFromEVMSecondSucceeds() {
let ufixEVMbalance = uint256ToUFix64(evmBalance, decimals: defaultDecimals)
bridgeTokensFromEVM(
signer: alice,
contractAddr: exampleHandledTokenAccount.address,
contractName: "ExampleHandledToken",
vaultIdentifier: buildTypeIdentifier(
address: exampleHandledTokenAccount.address,
contractName: "ExampleHandledToken",
resourceName: "Vault"
),
amount: evmBalance,
beFailed: false
)
Expand Down Expand Up @@ -617,8 +629,11 @@ fun testBridgeHandledCadenceNativeTokenFromEVMFirstSucceeds() {
// Execute bridge from EVM
bridgeTokensFromEVM(
signer: alice,
contractAddr: exampleHandledTokenAccount.address,
contractName: "ExampleHandledToken",
vaultIdentifier: buildTypeIdentifier(
address: exampleHandledTokenAccount.address,
contractName: "ExampleHandledToken",
resourceName: "Vault"
),
amount: aliceEVMBalanceBefore,
beFailed: false
)
Expand Down Expand Up @@ -666,9 +681,11 @@ fun testBridgeHandledCadenceNativeTokenToEVMSecondSucceeds() {
// Execute bridge to EVM
bridgeTokensToEVM(
signer: alice,
contractAddr: exampleHandledTokenAccount.address,
contractName: "ExampleHandledToken",
amount: aliceCadenceBalanceBefore,
vaultIdentifier: buildTypeIdentifier(
address: exampleHandledTokenAccount.address,
contractName: "ExampleHandledToken",
resourceName: "Vault"
), amount: aliceCadenceBalanceBefore,
beFailed: false
)

Expand Down
Loading

0 comments on commit 1a7f269

Please sign in to comment.