Skip to content

Commit

Permalink
remove redundant test case
Browse files Browse the repository at this point in the history
  • Loading branch information
sisyphusSmiling committed Dec 6, 2024
1 parent 7fb155c commit 9708f10
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 146 deletions.
35 changes: 0 additions & 35 deletions cadence/tests/flow_evm_bridge_tests.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -467,41 +467,6 @@ fun testCreateCOASucceeds() {
let bobCOAAddress = getCOAAddressHex(atFlowAddress: bob.address)
}

access(all)
fun testBridgeFlowToEVMSucceeds() {
// Get $FLOW balances before, making assertions based on values from previous case
let cadenceBalanceBefore = getBalance(ownerAddr: alice.address, storagePathIdentifier: "flowTokenVault")
?? panic("Problem getting $FLOW balance")
Test.assertEqual(900.0, cadenceBalanceBefore)

// Get EVM $FLOW balance before
var aliceCOAAddressHex = getCOAAddressHex(atFlowAddress: alice.address)

let evmBalanceBefore = getEVMFlowBalance(of: aliceCOAAddressHex)
Test.assertEqual(100.0, evmBalanceBefore)

// Execute bridge to EVM
let bridgeAmount = 100.0
bridgeTokensToEVM(
signer: alice,
vaultIdentifier: buildTypeIdentifier(
address: Address(0x03),
contractName: "FlowToken",
resourceName: "Vault"
), amount: bridgeAmount,
beFailed: false
)

// Confirm Alice's token balance is now 0.0
let cadenceBalanceAfter = getBalance(ownerAddr: alice.address, storagePathIdentifier: "flowTokenVault")
?? panic("Problem getting $FLOW balance")
Test.assertEqual(cadenceBalanceBefore - bridgeAmount, cadenceBalanceAfter)

// Confirm balance on EVM side has been updated
let evmBalanceAfter = getEVMFlowBalance(of: aliceCOAAddressHex)
Test.assertEqual(evmBalanceBefore + bridgeAmount, evmBalanceAfter)
}

access(all)
fun testMintExampleNFTSucceeds() {
let setupCollectionResult = executeTransaction(
Expand Down
111 changes: 0 additions & 111 deletions cadence/tests/flow_evm_wflow_handler_tests.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -477,114 +477,3 @@ fun testBridgeWFLOWTokenFromEVMSecondSucceeds() {
let escrowBalance = balanceOf(evmAddressHex: getBridgeCOAAddressHex(), erc20AddressHex: wflowAddressHex)
Test.assertEqual(wflowTotalSupplyAfter, escrowBalance)
}

// // Now test bridging with liquidity flow moving entirely from EVM to Cadence and back
// access(all)
// fun testBridgeWFLOWTokenFromEVMFirstSucceeds() {
// // Reset to snapshot before bridging between VMs
// Test.reset(to: snapshot)

// var erc20TotalSupplyBefore = getEVMTotalSupply(erc20AddressHex: wflowAddressHex)
// let cadenceTotalSupplyBefore = getCadenceTotalSupply(
// contractAddress: flowTokenAccountAddress,
// contractName: "FlowToken",
// vaultIdentifier: flowTokenIdentifier
// ) ?? panic("Problem getting total supply of Cadence tokens")
// let uintCadenceTotalSupplyBefore = ufix64ToUInt256(cadenceTotalSupplyBefore, decimals: defaultDecimals)
// Test.assertEqual(uintCadenceTotalSupplyBefore + erc20MintAmount, erc20TotalSupplyBefore)
// // Alice should start with amount previously minted
// let aliceEVMBalanceBefore = balanceOf(evmAddressHex: aliceCOAAddressHex, erc20AddressHex: wflowAddressHex)
// Test.assertEqual(erc20MintAmount, aliceEVMBalanceBefore)
// // Cadence total supply should match the amount in escrow
// let escrowBalanceBefore = balanceOf(evmAddressHex: getBridgeCOAAddressHex(), erc20AddressHex: wflowAddressHex)
// Test.assertEqual(uintCadenceTotalSupplyBefore, escrowBalanceBefore)
// // Alice was the only one minted Cadence tokens, so should have the total supply in Cadence
// let aliceCadenceBalanceBefore = getBalance(ownerAddr: alice.address, storagePathIdentifier: "flowTokenVault")
// ?? panic("Problem getting FlowToken balance")
// Test.assertEqual(flowTokenMintAmount, aliceCadenceBalanceBefore)
// Test.assertEqual(cadenceTotalSupplyBefore, aliceCadenceBalanceBefore)
// // Convert the bridge amount to UFix64 for Cadence balance comparison
// let ufixBridgeAmount = uint256ToUFix64(erc20MintAmount, decimals: defaultDecimals)
// // Execute bridge from EVM
// bridgeTokensFromEVM(
// signer: alice,
// vaultIdentifier: buildTypeIdentifier(
// address: flowTokenAccountAddress,
// contractName: "FlowToken",
// resourceName: "Vault"
// ),
// amount: aliceEVMBalanceBefore,
// beFailed: false
// )
// // Confirm that Alice's balance is now the total supply, having incremented by the amount bridged into Cadence
// let aliceCadenceBalanceAfter = getBalance(ownerAddr: alice.address, storagePathIdentifier: "flowTokenVault")
// ?? panic("Problem getting FlowToken balance")
// let cadenceTotalSupplyAfter = getCadenceTotalSupply(
// contractAddress: flowTokenAccountAddress,
// contractName: "FlowToken",
// vaultIdentifier: flowTokenIdentifier
// ) ?? panic("Problem getting total supply of Cadence tokens")
// Test.assertEqual(cadenceTotalSupplyAfter, aliceCadenceBalanceAfter)
// Test.assertEqual(cadenceTotalSupplyAfter, cadenceTotalSupplyBefore + ufixBridgeAmount)
// // Confirm Alice's EVM balance is now 0
// let aliceEVMBalanceAfter = balanceOf(evmAddressHex: aliceCOAAddressHex, erc20AddressHex: wflowAddressHex)
// Test.assertEqual(UInt256(0), aliceEVMBalanceAfter)
// // Confirm that the amount in escrow incremented
// let escrowBalanceAfter = balanceOf(evmAddressHex: getBridgeCOAAddressHex(), erc20AddressHex: wflowAddressHex)
// Test.assertEqual(escrowBalanceBefore + aliceEVMBalanceBefore, escrowBalanceAfter)
// // Ensure the ERC20 balance in circulation remained the same
// let erc20TotalSupplyAfter = getEVMTotalSupply(erc20AddressHex: wflowAddressHex)
// Test.assertEqual(erc20TotalSupplyBefore, erc20TotalSupplyAfter)
// }
// // Now return all liquidity back to EVM
// access(all)
// fun testBridgeFLOWTokenToEVMSecondSucceeds() {
// let erc20TotalSupplyBefore = getEVMTotalSupply(erc20AddressHex: wflowAddressHex)
// // Alice should start with amount previously minted
// let aliceEVMBalanceBefore = balanceOf(evmAddressHex: aliceCOAAddressHex, erc20AddressHex: wflowAddressHex)
// Test.assertEqual(UInt256(0), aliceEVMBalanceBefore)
// let aliceCadenceBalanceBefore = getBalance(ownerAddr: alice.address, storagePathIdentifier: "flowTokenVault")
// ?? panic("Problem getting FlowToken balance")
// // Convert the bridge amount to UInt256 for EVM balance comparison
// let uintBridgeAmount = ufix64ToUInt256(aliceCadenceBalanceBefore, decimals: defaultDecimals)
// // Execute bridge to EVM
// bridgeTokensToEVM(
// signer: alice,
// vaultIdentifier: buildTypeIdentifier(
// address: flowTokenAccountAddress,
// contractName: "FlowToken",
// resourceName: "Vault"
// ), amount: aliceCadenceBalanceBefore,
// beFailed: false
// )
// let aliceCadenceBalanceAfter = getBalance(ownerAddr: alice.address, storagePathIdentifier: "flowTokenVault")
// ?? panic("Problem getting FlowToken balance")
// Test.assertEqual(0.0, aliceCadenceBalanceAfter)
// // Confirm ownership on EVM side with Alice COA as owner of ERC721 representation
// let aliceEVMBalanceAfter = balanceOf(evmAddressHex: aliceCOAAddressHex, erc20AddressHex: wflowAddressHex)
// Test.assertEqual(uintBridgeAmount, aliceEVMBalanceAfter)
// // Confirm that the ERC20 balance in circulation remained the same
// let erc20TotalSupplyAfter = getEVMTotalSupply(erc20AddressHex: wflowAddressHex)
// Test.assertEqual(erc20TotalSupplyBefore, erc20TotalSupplyAfter)
// // Confirm escrow balance is now 0
// let escrowBalance = balanceOf(evmAddressHex: getBridgeCOAAddressHex(), erc20AddressHex: wflowAddressHex)
// Test.assertEqual(UInt256(0), escrowBalance)
// }

0 comments on commit 9708f10

Please sign in to comment.