generate Erc721 contracts

pull/2784/head^2
Aniket-Engg 2 years ago committed by Aniket
parent 885682b90e
commit dc60e2212b
  1. 14
      libs/remix-ws-templates/src/templates/ozerc721/contracts/SampleERC721.sol
  2. 7
      libs/remix-ws-templates/src/templates/ozerc721/index.ts
  3. 2
      libs/remix-ws-templates/src/templates/ozerc721/scripts/deploy_with_ethers.ts
  4. 2
      libs/remix-ws-templates/src/templates/ozerc721/scripts/deploy_with_web3.ts
  5. 18
      libs/remix-ws-templates/src/templates/ozerc721/tests/MyToken_test.sol
  6. 18
      libs/remix-ws-templates/src/templates/ozerc721/tests/SampleERC721_test.sol

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

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

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

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

@ -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/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");
}
}
Loading…
Cancel
Save