diff --git a/package-lock.json b/package-lock.json index 3f2f310..5b9b194 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "hardhat-awesome-cli", - "version": "0.1.0", + "version": "0.1.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "hardhat-awesome-cli", - "version": "0.1.0", + "version": "0.1.1", "license": "MIT", "dependencies": { "dotenv": "^16.0.3", @@ -6771,7 +6771,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", - "requires": { "graceful-fs": "^4.1.6" } diff --git a/package.json b/package.json index ea87396..21d9df1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hardhat-awesome-cli", - "version": "0.1.0", + "version": "0.1.1", "description": "Hardhat made awesome with a flexible CLI to help run test, deploy and more.", "repository": "https://github.com/marc-aurele-besner/hardhat-awesome-cli.git", "author": "Marc-Aurele Besner <82244926+marc-aurele-besner@users.noreply.github.com>", diff --git a/src/buildFoundrySetting.ts b/src/buildFoundrySetting.ts index dcf12fa..a544427 100644 --- a/src/buildFoundrySetting.ts +++ b/src/buildFoundrySetting.ts @@ -7,7 +7,7 @@ const buildFoundrySetting = async () => { if (!fs.existsSync('foundry.toml')) { fs.writeFileSync( 'foundry.toml', - `[default] + `[profile.default] src = 'contracts/test' # the source directory test = 'contracts/test' # the test directory out = 'artifacts/contracts' # the output directory (for artifacts) @@ -54,6 +54,10 @@ block_difficulty = 0 # the value of blo if (!fs.existsSync('contracts/test/utils')) { fs.mkdirSync('contracts/test/utils') } + } else { + if (!fs.existsSync('contracts/test/utils')) { + fs.mkdirSync('contracts/test/utils') + } } } else { fs.mkdirSync('contracts') diff --git a/src/mockContracts/scripts/deploy-Mock-ERC1155Upgradeable.ts b/src/mockContracts/scripts/deploy-Mock-ERC1155Upgradeable.ts index 3be044f..8361498 100644 --- a/src/mockContracts/scripts/deploy-Mock-ERC1155Upgradeable.ts +++ b/src/mockContracts/scripts/deploy-Mock-ERC1155Upgradeable.ts @@ -4,7 +4,7 @@ import { addressBook, ethers, network } from 'hardhat' async function main() { const [deployer] = await ethers.getSigners() - const MockERC1155Upgradeable = await ethers.getContractFactory('MockERC1155') + const MockERC1155Upgradeable = await ethers.getContractFactory('MockERC1155Upgradeable') const mockERC1155Upgradeable = await MockERC1155Upgradeable.deploy() await mockERC1155Upgradeable.deployed() @@ -14,7 +14,7 @@ async function main() { network.name, deployer.address ) - await mockERC1155Upgradeable.initialize('MockERC1155', 'MOCK', 'https://google.com') + await mockERC1155Upgradeable.initialize('MockERC1155Upgradeable', 'MOCK', 'https://google.com') console.log('MockERC1155Upgradeable deployed to:', mockERC1155Upgradeable.address) } diff --git a/src/mockContracts/testForge/MockERC1155.t.sol b/src/mockContracts/testForge/MockERC1155.t.sol index af9d9ce..add9429 100644 --- a/src/mockContracts/testForge/MockERC1155.t.sol +++ b/src/mockContracts/testForge/MockERC1155.t.sol @@ -39,7 +39,7 @@ contract MockERC1155Test is DSTest { uint256 tokenId_, uint256 amount_ ) public { - vm.assume(to_ != address(0)); + vm.assume(to_ != address(0) && to_.code.length == 0); vm.assume(tokenId_ > 0); vm.assume(amount_ > 0); @@ -55,7 +55,7 @@ contract MockERC1155Test is DSTest { uint256 tokenId_, uint256 amount_ ) public { - vm.assume(to_ != address(0)); + vm.assume(to_ != address(0) && to_.code.length == 0); vm.assume(tokenId_ > 0); vm.assume(amount_ > 0); @@ -77,7 +77,7 @@ contract MockERC1155Test is DSTest { uint256 tokenId_, uint256 amount_ ) public { - vm.assume(to_ != address(0)); + vm.assume(to_ != address(0) && to_.code.length == 0); vm.assume(tokenId_ > 0); vm.assume(amount_ > 0); diff --git a/src/mockContracts/testForge/MockERC1155Upgradeable.t.sol b/src/mockContracts/testForge/MockERC1155Upgradeable.t.sol index d498183..f8f9a5c 100644 --- a/src/mockContracts/testForge/MockERC1155Upgradeable.t.sol +++ b/src/mockContracts/testForge/MockERC1155Upgradeable.t.sol @@ -41,7 +41,7 @@ contract MockERC1155UpgradeableTest is DSTest { uint256 tokenId_, uint256 amount_ ) public { - vm.assume(to_ != address(0)); + vm.assume(to_ != address(0) && to_.code.length == 0); vm.assume(tokenId_ > 0); vm.assume(amount_ > 0); @@ -57,7 +57,7 @@ contract MockERC1155UpgradeableTest is DSTest { uint256 tokenId_, uint256 amount_ ) public { - vm.assume(to_ != address(0)); + vm.assume(to_ != address(0) && to_.code.length == 0); vm.assume(tokenId_ > 0); vm.assume(amount_ > 0); @@ -79,7 +79,7 @@ contract MockERC1155UpgradeableTest is DSTest { uint256 tokenId_, uint256 amount_ ) public { - vm.assume(to_ != address(0)); + vm.assume(to_ != address(0) && to_.code.length == 0); vm.assume(tokenId_ > 0); vm.assume(amount_ > 0); diff --git a/src/mockContracts/testForge/MockERC721.t.sol b/src/mockContracts/testForge/MockERC721.t.sol index 0252b2b..1b1df44 100644 --- a/src/mockContracts/testForge/MockERC721.t.sol +++ b/src/mockContracts/testForge/MockERC721.t.sol @@ -38,7 +38,7 @@ contract MockERC721Test is DSTest { address to_, uint256 tokenId_ ) public { - vm.assume(to_ != address(0)); + vm.assume(to_ != address(0) && to_.code.length == 0); vm.assume(tokenId_ > 0); assertEq(mockERC721.balanceOf(to_), 0); @@ -53,7 +53,7 @@ contract MockERC721Test is DSTest { address to_, uint256 tokenId_ ) public { - vm.assume(to_ != address(0)); + vm.assume(to_ != address(0) && to_.code.length == 0); vm.assume(tokenId_ > 0); assertEq(mockERC721.balanceOf(to_), 0); diff --git a/src/mockContracts/testForge/MockERC721Upgradeable.t.sol b/src/mockContracts/testForge/MockERC721Upgradeable.t.sol index 4cd40e0..033ec9e 100644 --- a/src/mockContracts/testForge/MockERC721Upgradeable.t.sol +++ b/src/mockContracts/testForge/MockERC721Upgradeable.t.sol @@ -39,7 +39,7 @@ contract MockERC721UpgradeableTest is DSTest { address to_, uint256 tokenId_ ) public { - vm.assume(to_ != address(0)); + vm.assume(to_ != address(0) && to_.code.length == 0); vm.assume(tokenId_ > 0); assertEq(mockERC721Upgradeable.balanceOf(to_), 0); @@ -54,7 +54,7 @@ contract MockERC721UpgradeableTest is DSTest { address to_, uint256 tokenId_ ) public { - vm.assume(to_ != address(0)); + vm.assume(to_ != address(0) && to_.code.length == 0); vm.assume(tokenId_ > 0); assertEq(mockERC721Upgradeable.balanceOf(to_), 0);