diff --git a/libs/remix-ws-templates/package.json b/libs/remix-ws-templates/package.json index 3a27e44a26..16a4d66db1 100644 --- a/libs/remix-ws-templates/package.json +++ b/libs/remix-ws-templates/package.json @@ -22,8 +22,11 @@ "homepage": "https://github.com/ethereum/remix-project/tree/master/libs/remix-ws-templates#readme", "typings": "./src/index.d.ts", "dependencies": { + "@openzeppelin/contracts": "^4.7.3", + "@openzeppelin/wizard": "^0.1.1", "ethers": "^5.4.2", "web3": "^1.5.1" + }, "gitHead": "0c1957c9b2f890076a5062309bc81b41f93af57c" } \ No newline at end of file diff --git a/libs/remix-ws-templates/src/templates/ozerc20/contracts/SampleERC20.sol b/libs/remix-ws-templates/src/templates/ozerc20/contracts/SampleERC20.sol deleted file mode 100644 index 56a7708413..0000000000 --- a/libs/remix-ws-templates/src/templates/ozerc20/contracts/SampleERC20.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/ERC20/ERC20.sol"; - -/** - * @title SampleERC20 - * @dev Create a sample ERC20 standard token - */ -contract SampleERC20 is ERC20 { - - constructor(string memory tokenName, string memory tokenSymbol) ERC20(tokenName, tokenSymbol) {} -} \ No newline at end of file diff --git a/libs/remix-ws-templates/src/templates/ozerc20/index.ts b/libs/remix-ws-templates/src/templates/ozerc20/index.ts index 48ffb45341..f44f812bb2 100644 --- a/libs/remix-ws-templates/src/templates/ozerc20/index.ts +++ b/libs/remix-ws-templates/src/templates/ozerc20/index.ts @@ -1,7 +1,8 @@ +import { erc20 } from '@openzeppelin/wizard'; + export default async () => { return { - // @ts-ignore - 'contracts/SampleERC20.sol': (await import('raw-loader!./contracts/SampleERC20.sol')).default, + 'contracts/MyToken.sol': erc20.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/SampleERC20_test.sol': (await import('raw-loader!./tests/SampleERC20_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/ozerc20/scripts/deploy_with_ethers.ts b/libs/remix-ws-templates/src/templates/ozerc20/scripts/deploy_with_ethers.ts index c12ce0dfcd..a6c8cf30e5 100644 --- a/libs/remix-ws-templates/src/templates/ozerc20/scripts/deploy_with_ethers.ts +++ b/libs/remix-ws-templates/src/templates/ozerc20/scripts/deploy_with_ethers.ts @@ -2,7 +2,7 @@ import { deploy } from './ethers-lib' (async () => { try { - const result = await deploy('SampleERC20', ['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/ozerc20/scripts/deploy_with_web3.ts b/libs/remix-ws-templates/src/templates/ozerc20/scripts/deploy_with_web3.ts index 3a19d6a068..b22b119246 100644 --- a/libs/remix-ws-templates/src/templates/ozerc20/scripts/deploy_with_web3.ts +++ b/libs/remix-ws-templates/src/templates/ozerc20/scripts/deploy_with_web3.ts @@ -2,7 +2,7 @@ import { deploy } from './web3-lib' (async () => { try { - const result = await deploy('SampleERC20', ['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/ozerc20/tests/MyToken_test.sol b/libs/remix-ws-templates/src/templates/ozerc20/tests/MyToken_test.sol new file mode 100644 index 0000000000..0fb1d12117 --- /dev/null +++ b/libs/remix-ws-templates/src/templates/ozerc20/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/ozerc20/tests/SampleERC20_test.sol b/libs/remix-ws-templates/src/templates/ozerc20/tests/SampleERC20_test.sol deleted file mode 100644 index 19eb11d97d..0000000000 --- a/libs/remix-ws-templates/src/templates/ozerc20/tests/SampleERC20_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/SampleERC20.sol"; - -contract SampleERC20Test { - - SampleERC20 s; - function beforeAll () public { - s = new SampleERC20("TestToken", "TST"); - } - - function testTokenNameAndSymbol () public { - Assert.equal(s.name(), "TestToken", "token name did not match"); - Assert.equal(s.symbol(), "TST", "token symbol did not match"); - } -} \ No newline at end of file diff --git a/package.json b/package.json index b13b797c38..8399c040bc 100644 --- a/package.json +++ b/package.json @@ -154,6 +154,8 @@ "@ethersphere/bee-js": "^3.2.0", "@isomorphic-git/lightning-fs": "^4.4.1", "@monaco-editor/react": "4.4.5", + "@openzeppelin/contracts": "^4.7.3", + "@openzeppelin/wizard": "^0.1.1", "@remixproject/engine": "^0.3.31", "@remixproject/engine-web": "^0.3.31", "@remixproject/plugin": "^0.3.31", diff --git a/yarn.lock b/yarn.lock index e36042dda0..3809c46cb6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3912,6 +3912,18 @@ dependencies: "@octokit/openapi-types" "^11.2.0" +"@openzeppelin/contracts@^4.7.3": + version "4.7.3" + resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-4.7.3.tgz#939534757a81f8d69cc854c7692805684ff3111e" + integrity sha512-dGRS0agJzu8ybo44pCIf3xBaPQN/65AIXNgK8+4gzKd5kbvlqyxryUYVLJv7fK98Seyd2hDZzVEHSWAh0Bt1Yw== + +"@openzeppelin/wizard@^0.1.1": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@openzeppelin/wizard/-/wizard-0.1.1.tgz#8c183e2c5748869bc3a5317c0330aa36a9ad44fe" + integrity sha512-AGyvn3PIh1vCgAEoRKAXKhtlk4fkA8AHE7G4PyzLnYcASClYCWpSf43WLJCs6S/LORvTZADX1flvF8x2LciJIg== + dependencies: + array.prototype.flatmap "^1.2.4" + "@pmmmwh/react-refresh-webpack-plugin@^0.4.3": version "0.4.3" resolved "https://registry.yarnpkg.com/@pmmmwh/react-refresh-webpack-plugin/-/react-refresh-webpack-plugin-0.4.3.tgz#1eec460596d200c0236bf195b078a5d1df89b766"