use oz wizard npm package

pull/2784/head^2
Aniket-Engg 2 years ago committed by Aniket
parent d7fe4e66ec
commit 1c8f928618
  1. 3
      libs/remix-ws-templates/package.json
  2. 14
      libs/remix-ws-templates/src/templates/ozerc20/contracts/SampleERC20.sol
  3. 7
      libs/remix-ws-templates/src/templates/ozerc20/index.ts
  4. 2
      libs/remix-ws-templates/src/templates/ozerc20/scripts/deploy_with_ethers.ts
  5. 2
      libs/remix-ws-templates/src/templates/ozerc20/scripts/deploy_with_web3.ts
  6. 18
      libs/remix-ws-templates/src/templates/ozerc20/tests/MyToken_test.sol
  7. 18
      libs/remix-ws-templates/src/templates/ozerc20/tests/SampleERC20_test.sol
  8. 2
      package.json
  9. 12
      yarn.lock

@ -22,8 +22,11 @@
"homepage": "https://github.com/ethereum/remix-project/tree/master/libs/remix-ws-templates#readme", "homepage": "https://github.com/ethereum/remix-project/tree/master/libs/remix-ws-templates#readme",
"typings": "./src/index.d.ts", "typings": "./src/index.d.ts",
"dependencies": { "dependencies": {
"@openzeppelin/contracts": "^4.7.3",
"@openzeppelin/wizard": "^0.1.1",
"ethers": "^5.4.2", "ethers": "^5.4.2",
"web3": "^1.5.1" "web3": "^1.5.1"
}, },
"gitHead": "0c1957c9b2f890076a5062309bc81b41f93af57c" "gitHead": "0c1957c9b2f890076a5062309bc81b41f93af57c"
} }

@ -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) {}
}

@ -1,7 +1,8 @@
import { erc20 } from '@openzeppelin/wizard';
export default async () => { export default async () => {
return { return {
// @ts-ignore 'contracts/MyToken.sol': erc20.print(),
'contracts/SampleERC20.sol': (await import('raw-loader!./contracts/SampleERC20.sol')).default,
// @ts-ignore // @ts-ignore
'scripts/deploy_with_ethers.ts': (await import('!!raw-loader!./scripts/deploy_with_ethers.ts')).default, 'scripts/deploy_with_ethers.ts': (await import('!!raw-loader!./scripts/deploy_with_ethers.ts')).default,
// @ts-ignore // @ts-ignore
@ -11,6 +12,6 @@ export default async () => {
// @ts-ignore // @ts-ignore
'scripts/web3-lib.ts': (await import('!!raw-loader!./scripts/web3-lib.ts')).default, 'scripts/web3-lib.ts': (await import('!!raw-loader!./scripts/web3-lib.ts')).default,
// @ts-ignore // @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
} }
} }

@ -2,7 +2,7 @@ import { deploy } from './ethers-lib'
(async () => { (async () => {
try { try {
const result = await deploy('SampleERC20', ['testToken', 'TST']) const result = await deploy('MyToken', [])
console.log(`address: ${result.address}`) console.log(`address: ${result.address}`)
} catch (e) { } catch (e) {
console.log(e.message) console.log(e.message)

@ -2,7 +2,7 @@ import { deploy } from './web3-lib'
(async () => { (async () => {
try { try {
const result = await deploy('SampleERC20', ['testToken', 'TST']) const result = await deploy('MyToken', [])
console.log(`address: ${result.address}`) console.log(`address: ${result.address}`)
} catch (e) { } catch (e) {
console.log(e.message) console.log(e.message)

@ -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");
}
}

@ -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");
}
}

@ -154,6 +154,8 @@
"@ethersphere/bee-js": "^3.2.0", "@ethersphere/bee-js": "^3.2.0",
"@isomorphic-git/lightning-fs": "^4.4.1", "@isomorphic-git/lightning-fs": "^4.4.1",
"@monaco-editor/react": "4.4.5", "@monaco-editor/react": "4.4.5",
"@openzeppelin/contracts": "^4.7.3",
"@openzeppelin/wizard": "^0.1.1",
"@remixproject/engine": "^0.3.31", "@remixproject/engine": "^0.3.31",
"@remixproject/engine-web": "^0.3.31", "@remixproject/engine-web": "^0.3.31",
"@remixproject/plugin": "^0.3.31", "@remixproject/plugin": "^0.3.31",

@ -3912,6 +3912,18 @@
dependencies: dependencies:
"@octokit/openapi-types" "^11.2.0" "@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": "@pmmmwh/react-refresh-webpack-plugin@^0.4.3":
version "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" resolved "https://registry.yarnpkg.com/@pmmmwh/react-refresh-webpack-plugin/-/react-refresh-webpack-plugin-0.4.3.tgz#1eec460596d200c0236bf195b078a5d1df89b766"

Loading…
Cancel
Save