Skip to content

Commit

Permalink
Merge pull request #24 from onflow/merge-test-fix-base
Browse files Browse the repository at this point in the history
Add NFT Bridging Cadence tests
  • Loading branch information
sisyphusSmiling authored Apr 3, 2024
2 parents 1ed2dab + 97cdfcd commit 5d36089
Show file tree
Hide file tree
Showing 25 changed files with 1,160 additions and 138 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/cadence_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,24 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.20.x'
go-version: "1.20.x"
- uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install Flow CLI
run: sh -ci "$(curl -fsSL https://raw.githubusercontent.com/onflow/flow-cli/master/install.sh)" -- v1.15.0-cadence-v1.0.0-preview.12
run: sh -ci "$(curl -fsSL https://raw.githubusercontent.com/onflow/flow-cli/feature/stable-cadence/install.sh)"
- name: Flow CLI Version
run: flow version
run: flow-c1 version
- name: Update PATH
run: echo "/root/.local/bin" >> $GITHUB_PATH
- name: Run tests
run: sh local/run_cadence_tests.sh
- name: Normalize coverage report filepaths
run : sh ./local/normalize_coverage_report.sh
run: sh ./local/normalize_coverage_report.sh
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

4 changes: 2 additions & 2 deletions cadence/args/bridged-nft-code-chunks-args.json

Large diffs are not rendered by default.

8 changes: 0 additions & 8 deletions cadence/args/deploy-factory-args.json

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions cadence/contracts/bridge/FlowEVMBridgeUtils.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ contract FlowEVMBridgeUtils {
)
}

init(bridgeFactoryEVMAddress: String) {
init(bridgeFactoryBytecodeHex: String) {
self.delimiter = "_"
self.contractNamePrefixes = {
Type<@{NonFungibleToken.NFT}>(): {
Expand All @@ -700,8 +700,11 @@ contract FlowEVMBridgeUtils {
"bridged": "EVMVMBridgedToken"
}
}
let bridgeFactoryEVMAddressBytes: [UInt8] = bridgeFactoryEVMAddress.decodeHex()
self.bridgeFactoryEVMAddress = self.getEVMAddressFromHexString(address: bridgeFactoryEVMAddress)
?? panic("Invalid bridge factory EVM address")
// Deploy the FlowBridgeFactory.sol contract from provided bytecode and capture the deployed address
self.bridgeFactoryEVMAddress = self.borrowCOA().deploy(
code: bridgeFactoryBytecodeHex.decodeHex(),
gasLimit: 15000000,
value: EVM.Balance(attoflow: 0)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ access(all) contract {{CONTRACT_NAME}} : ICrossVM, IEVMBridgeNFTMinter, NonFungi

/// Pointer to the Factory deployed Solidity contract address defining the bridged asset
access(all) let evmNFTContractAddress: EVM.EVMAddress
/// Pointer to the Flow NFT contract address defining the bridged asset, this contract address in this case
access(all) let flowNFTContractAddress: Address
/// Name of the NFT collection defined in the corresponding ERC721 contract
access(all) let name: String
/// Symbol of the NFT collection defined in the corresponding ERC721 contract
Expand Down Expand Up @@ -365,7 +363,6 @@ access(all) contract {{CONTRACT_NAME}} : ICrossVM, IEVMBridgeNFTMinter, NonFungi

init(name: String, symbol: String, evmContractAddress: EVM.EVMAddress, contractURI: String?) {
self.evmNFTContractAddress = evmContractAddress
self.flowNFTContractAddress = self.account.address
self.name = name
self.symbol = symbol
self.contractURI = contractURI
Expand Down
Loading

0 comments on commit 5d36089

Please sign in to comment.