Share
Sign In

AngelNetwork Corner

npm install @openzeppelin/contracts @truffle/hdwallet-providee truffle-plugin-verify node--version migrations/:directory for scriptable deployment files contracts/: Directory for solidity contracts test/: Directory for test files for testing your application and contracts truffle-config.js:Truffle configure file create core contracts eco>contracts/'ERC1155Token.sol' open file input: //contracts/ERC1155Token.sol //SPDX-License-Identifier:MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/string.sol";
contract AngelNetCoin is ERC1155Token, ERC1155, Ownable{ string[]public names;//string array of names uint[]public ids;// uint array of ids string public base MetadataURI;// the token metadataURI string public Name; AngelNetCoin uint public MintFee=Owei;//mintfee,0 by default only used in mint function, not batch mapping(string=>uint)public nameToId;// AngelNetworkCryptocurrency mapping(uint=>string)public idToName;//AngelNetCoin=$1000000e18ETH } constructor is executed when the factory contract calls its own deploy ERC1155 method,Note the Ownable (msg.sender)setting the deployer of the ERC1155 as the owner } constructor(string memory _contractName,string memory _uri, string[]memory _names, uint[]memory _ids)Ownable(msg.sender)ERC1155(_URI){ names= _names; ids= _ids; createMapping(); setURI(_URI); baseMetadataURI= _uri; name= _contractName; } creates a mapping of strings to ids(ie["one", "two"], [1,2] "one" maps to 1, vice versa. return string( abi.encodePacked( baseMetadataURI strings.toString(_tokenId),"json" ) ); } function getNames()public view returns(string[]memory) { return name; } } } ) )) } }