Skip to content

Commit

Permalink
integrate updated solidity contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
sisyphusSmiling committed May 6, 2024
1 parent 34665f9 commit 5977bcf
Show file tree
Hide file tree
Showing 5 changed files with 859 additions and 866 deletions.
8 changes: 4 additions & 4 deletions cadence/contracts/bridge/FlowEVMBridgeUtils.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ contract FlowEVMBridgeUtils {
fun isEVMContractBridgeOwned(evmContractAddress: EVM.EVMAddress): Bool {
// Ask the bridge factory if the given contract address was deployed by the bridge
let callResult = self.call(
signature: "isFactoryDeployed(address)",
signature: "isBridgeDeployed(address)",
targetEVMAddress: self.bridgeFactoryEVMAddress,
args: [evmContractAddress],
gasLimit: 60000,
Expand Down Expand Up @@ -1241,11 +1241,11 @@ contract FlowEVMBridgeUtils {
contractURI: String,
isERC721: Bool
): EVM.EVMAddress {
let signature = isERC721 ? "deployERC721(string,string,string,string,string)" : "deployERC20(string,string,string,string,string)"
let deployerTag = isERC721 ? "ERC721" : "ERC20"
let deployResult: EVM.Result = self.call(
signature: signature,
signature: "deploy(string,string,string,string,string,string)",
targetEVMAddress: self.bridgeFactoryEVMAddress,
args: [name, symbol, cadenceAddress.toString(), flowIdentifier, contractURI],
args: [deployerTag, name, symbol, cadenceAddress.toString(), flowIdentifier, contractURI],
gasLimit: 15000000,
value: 0.0
)
Expand Down
12 changes: 3 additions & 9 deletions cadence/tests/flow_evm_bridge_handler_tests.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,12 @@ fun setup() {
// Get the deployed contract address from the latest EVM event
let evts = Test.eventsOfType(Type<EVM.TransactionExecuted>())
Test.assertEqual(2, evts.length)
let factoryDeploymentEvent = evts[0] as! EVM.TransactionExecuted
let factoryAddressHex = factoryDeploymentEvent.contractAddress
let factoryAddressHex = getEVMAddressHexFromEvents(evts, idx: 0)

err = Test.deployContract(
name: "FlowEVMBridgeUtils",
path: "../contracts/bridge/FlowEVMBridgeUtils.cdc",
arguments: [factoryAddressHex.slice(from: 2, upTo: factoryAddressHex.length)]
arguments: [factoryAddressHex]
)
Test.expect(err, Test.beNil())
err = Test.deployContract(
Expand Down Expand Up @@ -345,12 +344,7 @@ fun testDeployERC20Succeeds() {

let evts = Test.eventsOfType(Type<EVM.TransactionExecuted>())
Test.assertEqual(7, evts.length)
let erc20DeploymentEvent = evts[6] as! EVM.TransactionExecuted
// remove 0x prefix
erc20AddressHex = erc20DeploymentEvent.contractAddress.slice(
from: 2,
upTo: erc20DeploymentEvent.contractAddress.length
).toLower()
erc20AddressHex = getEVMAddressHexFromEvents(evts, idx: 6)
}

// Set the TokenHandler's targetEVMAddress to the deployed ERC20 contract address
Expand Down
Loading

0 comments on commit 5977bcf

Please sign in to comment.