From dc60e2212be01173a7223ec64d486e2a03c9f6c4 Mon Sep 17 00:00:00 2001 From: Aniket-Engg Date: Wed, 7 Sep 2022 19:12:25 +0530 Subject: [PATCH] generate Erc721 contracts --- .../ozerc721/contracts/SampleERC721.sol | 14 -------------- .../src/templates/ozerc721/index.ts | 7 ++++--- .../ozerc721/scripts/deploy_with_ethers.ts | 2 +- .../ozerc721/scripts/deploy_with_web3.ts | 2 +- .../templates/ozerc721/tests/MyToken_test.sol | 18 ++++++++++++++++++ .../ozerc721/tests/SampleERC721_test.sol | 18 ------------------ 6 files changed, 24 insertions(+), 37 deletions(-) delete mode 100644 libs/remix-ws-templates/src/templates/ozerc721/contracts/SampleERC721.sol create mode 100644 libs/remix-ws-templates/src/templates/ozerc721/tests/MyToken_test.sol delete mode 100644 libs/remix-ws-templates/src/templates/ozerc721/tests/SampleERC721_test.sol diff --git a/libs/remix-ws-templates/src/templates/ozerc721/contracts/SampleERC721.sol b/libs/remix-ws-templates/src/templates/ozerc721/contracts/SampleERC721.sol deleted file mode 100644 index 5a0d40c8e3..0000000000 --- a/libs/remix-ws-templates/src/templates/ozerc721/contracts/SampleERC721.sol +++ /dev/null @@ -1,14 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 - -pragma solidity >=0.7.0 <0.9.0; - -import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; - -/** - * @title SampleERC721 - * @dev Create a sample ERC721 standard token - */ -contract SampleERC721 is ERC721 { - - constructor(string memory tokenName, string memory tokenSymbol) ERC721(tokenName, tokenSymbol) {} -} \ No newline at end of file diff --git a/libs/remix-ws-templates/src/templates/ozerc721/index.ts b/libs/remix-ws-templates/src/templates/ozerc721/index.ts index 53b6d132e7..26a3acd59b 100644 --- a/libs/remix-ws-templates/src/templates/ozerc721/index.ts +++ b/libs/remix-ws-templates/src/templates/ozerc721/index.ts @@ -1,7 +1,8 @@ +import { erc721 } from '@openzeppelin/wizard'; + export default async () => { return { - // @ts-ignore - 'contracts/SampleERC721.sol': (await import('raw-loader!./contracts/SampleERC721.sol')).default, + 'contracts/MyToken.sol': erc721.print(), // @ts-ignore 'scripts/deploy_with_ethers.ts': (await import('!!raw-loader!./scripts/deploy_with_ethers.ts')).default, // @ts-ignore @@ -11,6 +12,6 @@ export default async () => { // @ts-ignore 'scripts/web3-lib.ts': (await import('!!raw-loader!./scripts/web3-lib.ts')).default, // @ts-ignore - 'tests/SampleERC721_test.sol': (await import('raw-loader!./tests/SampleERC721_test.sol')).default + 'tests/MyToken_test.sol': (await import('raw-loader!./tests/MyToken_test.sol')).default } } \ No newline at end of file diff --git a/libs/remix-ws-templates/src/templates/ozerc721/scripts/deploy_with_ethers.ts b/libs/remix-ws-templates/src/templates/ozerc721/scripts/deploy_with_ethers.ts index 185fd7a5fa..a6c8cf30e5 100644 --- a/libs/remix-ws-templates/src/templates/ozerc721/scripts/deploy_with_ethers.ts +++ b/libs/remix-ws-templates/src/templates/ozerc721/scripts/deploy_with_ethers.ts @@ -2,7 +2,7 @@ import { deploy } from './ethers-lib' (async () => { try { - const result = await deploy('SampleERC721', ['testNFT', 'TNFT']) + const result = await deploy('MyToken', []) console.log(`address: ${result.address}`) } catch (e) { console.log(e.message) diff --git a/libs/remix-ws-templates/src/templates/ozerc721/scripts/deploy_with_web3.ts b/libs/remix-ws-templates/src/templates/ozerc721/scripts/deploy_with_web3.ts index 2fec0c3b28..b22b119246 100644 --- a/libs/remix-ws-templates/src/templates/ozerc721/scripts/deploy_with_web3.ts +++ b/libs/remix-ws-templates/src/templates/ozerc721/scripts/deploy_with_web3.ts @@ -2,7 +2,7 @@ import { deploy } from './web3-lib' (async () => { try { - const result = await deploy('SampleERC721', ['testToken', 'TST']) + const result = await deploy('MyToken', []) console.log(`address: ${result.address}`) } catch (e) { console.log(e.message) diff --git a/libs/remix-ws-templates/src/templates/ozerc721/tests/MyToken_test.sol b/libs/remix-ws-templates/src/templates/ozerc721/tests/MyToken_test.sol new file mode 100644 index 0000000000..0fb1d12117 --- /dev/null +++ b/libs/remix-ws-templates/src/templates/ozerc721/tests/MyToken_test.sol @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-3.0 + +pragma solidity >=0.7.0 <0.9.0; +import "remix_tests.sol"; +import "../contracts/MyToken.sol"; + +contract MyTokenTest { + + MyToken s; + function beforeAll () public { + s = new MyToken(); + } + + function testTokenNameAndSymbol () public { + Assert.equal(s.name(), "MyToken", "token name did not match"); + Assert.equal(s.symbol(), "MTK", "token symbol did not match"); + } +} \ No newline at end of file diff --git a/libs/remix-ws-templates/src/templates/ozerc721/tests/SampleERC721_test.sol b/libs/remix-ws-templates/src/templates/ozerc721/tests/SampleERC721_test.sol deleted file mode 100644 index 27a4c46826..0000000000 --- a/libs/remix-ws-templates/src/templates/ozerc721/tests/SampleERC721_test.sol +++ /dev/null @@ -1,18 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 - -pragma solidity >=0.7.0 <0.9.0; -import "remix_tests.sol"; -import "../contracts/SampleERC721.sol"; - -contract SampleERC721Test { - - SampleERC721 s; - function beforeAll () public { - s = new SampleERC721("TestNFT", "TNFT"); - } - - function testTokenNameAndSymbol () public { - Assert.equal(s.name(), "TestNFT", "token name did not match"); - Assert.equal(s.symbol(), "TNFT", "token symbol did not match"); - } -} \ No newline at end of file