[
  {
    "path": ".gitignore",
    "content": "/dist\n\n/.idea\n*.tsbuildinfo\n\n.DS_Store\n\n# Logs\nlogs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n\nnode_modules/\n.env*\n!.env*.default\n.vscode/*\n!.vscode/settings.json.default\n\ncache/\nartifacts/\n\n.yalc\nyalc.lock\n\n# Logs\nlogs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\nlerna-debug.log*\n.pnpm-debug.log*\n\n# Diagnostic reports (https://nodejs.org/api/report.html)\nreport.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json\n\n# Runtime data\npids\n*.pid\n*.seed\n*.pid.lock\n\n# Directory for instrumented libs generated by jscoverage/JSCover\nlib-cov\n\n# Coverage directory used by tools like istanbul\ncoverage\n*.lcov\n\n# nyc test coverage\n.nyc_output\n\n# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)\n.grunt\n\n# Bower dependency directory (https://bower.io/)\nbower_components\n\n# node-waf configuration\n.lock-wscript\n\n# Compiled binary addons (https://nodejs.org/api/addons.html)\nbuild/Release\n\n# Dependency directories\nnode_modules/\njspm_packages/\n\n# Snowpack dependency directory (https://snowpack.dev/)\nweb_modules/\n\n# TypeScript cache\n*.tsbuildinfo\n\n# Optional npm cache directory\n.npm\n\n# Optional eslint cache\n.eslintcache\n\n# Microbundle cache\n.rpt2_cache/\n.rts2_cache_cjs/\n.rts2_cache_es/\n.rts2_cache_umd/\n\n# Optional REPL history\n.node_repl_history\n\n# Output of 'npm pack'\n*.tgz\n\n# Yarn Integrity file\n.yarn-integrity\n\n# dotenv environment variables file\n.env\n.env.test\n.env.production\n\n# parcel-bundler cache (https://parceljs.org/)\n.cache\n.parcel-cache\n\n# Next.js build output\n.next\nout\n\n# Nuxt.js build / generate output\n.nuxt\ndist\n\n# Gatsby files\n.cache/\n# Comment in the public line in if your project uses Gatsby and not Next.js\n# https://nextjs.org/blog/next-9-1#public-directory-support\n# public\n\n# vuepress build output\n.vuepress/dist\n\n# Serverless directories\n.serverless/\n\n# FuseBox cache\n.fusebox/\n\n# DynamoDB Local files\n.dynamodb/\n\n# TernJS port file\n.tern-port\n\n# Stores VSCode versions used for testing VSCode extensions\n.vscode-test\n\n# yarn v2\n.yarn/cache\n.yarn/unplugged\n.yarn/build-state.yml\n.yarn/install-state.gz\n.pnp.*\n"
  },
  {
    "path": "LICENSE",
    "content": "BSD 3-Clause License\n\nCopyright (c) 2020, Ava Labs, Inc.\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this\n   list of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice,\n   this list of conditions and the following disclaimer in the documentation\n   and/or other materials provided with the distribution.\n\n3. Neither the name of the copyright holder nor the names of its\n   contributors may be used to endorse or promote products derived from\n   this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
  },
  {
    "path": "README.md",
    "content": "## Introduction\n\nAvalanche is an open-source platform for launching decentralized applications and enterprise blockchain deployments in one interoperable, highly scalable ecosystem. Avalanche gives you complete control on both the network and application layers&mdash;helping you build anything you can imagine.\n\nThe Avalanche Network is composed of many blockchains. One of these blockchains is the C-Chain (Contract Chain), which is an Ethereum Virtual Machine instance. The C-Chain's API is almost identical to an Ethereum node's API. Avalanche offers the same interface as Ethereum but with higher speed, higher throughput, lower fees and lower transaction confirmation times. These properties considerably improve the performance of DApps and the user experience of smart contracts.\n\nThe goal of this guide is to lay out best practices regarding writing, testing and deployment of smart contracts to Avalanche's C-Chain. We'll be building smart contracts with development environment [Hardhat](https://hardhat.org).\n\n## Prerequisites\n\n### NodeJS and Yarn\n\nFirst, install the LTS (long-term support) version of [nodejs](https://nodejs.org/en). This is `14.17.0` at the time of writing. NodeJS bundles `npm`.\n\nNext, install [yarn](https://yarnpkg.com):\n\n```zsh\nnpm install -g yarn\n```\n\n### AvalancheGo and Avash\n\n[AvalancheGo](https://github.com/ava-labs/avalanchego) is an Avalanche node implementation written in Go. [Avash](https://docs.avax.network/build/tools/avash) is a tool to quickly deploy local test networks. Together, you can deploy local test networks and run tests on them.\n\n### Solidity and Avalanche\n\nIt is also helpful to have a basic understanding of [Solidity](https://docs.soliditylang.org) and [Avalanche](https://docs.avax.network).\n\n## Dependencies\n\nClone the [quickstart repository](https://github.com/ava-labs/avalanche-smart-contract-quickstart) and install the necessary packages via `yarn`.\n\n```zsh\n$ git clone https://github.com/ava-labs/avalanche-smart-contract-quickstart.git\n$ cd avalanche-smart-contract-quickstart\n$ yarn\n```\n\n## Write Contracts\n\nEdit the `Coin.sol` contract in `contracts/`. `Coin.sol` is an [Open Zeppelin](https://openzeppelin.com) [ERC20](https://eips.ethereum.org/EIPS/eip-20) contract. ERC20 is a popular smart contract interface. You can also add your own contracts.\n\n## Hardhat Config\n\nHardhat uses `hardhat.config.js` as the configuration file. You can define tasks, networks, compilers and more in that file. For more information see [here](https://hardhat.org/config/).\n\nIn our repository we use a pre-configured file [hardhat.config.ts](https://github.com/ava-labs/avalanche-smart-contract-quickstart/blob/main/hardhat.config.ts). This file configures necessary network information to provide smooth interaction with Avalanche. There are also some pre-defined private keys for testing on a local test network.\n\n## Hardhat Tasks\n\nYou can define custom hardhat tasks in [hardhat.config.ts](https://github.com/ava-labs/avalanche-smart-contract-quickstart/blob/main/hardhat.config.ts).\n\n## Documentation\n\nThere is a documentation under the Avalanche's official documentation repository:\n[Using Hardhat with the Avalanche C-Chain](https://docs.avax.network/build/tutorials/smart-contracts/using-hardhat-with-the-avalanche-c-chain)"
  },
  {
    "path": "contracts/ExampleERC20.sol",
    "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.6.2;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract ExampleERC20 is ERC20, Ownable {\n  string private TOKEN_NAME = \"Example ERC20 Token\";\n  string private TOKEN_SYMBOL = \"XMPL\";\n\n  uint256 private constant TOTAL_SUPPLY = 123456789;\n\n  constructor()ERC20(TOKEN_NAME, TOKEN_SYMBOL) {\n    _mint(msg.sender, TOTAL_SUPPLY);\n  }\n\n  function mint(address to, uint256 amount) public onlyOwner {\n    _mint(to, amount);\n  }\n\n  function burn(address from, uint256 amount) public onlyOwner {\n    _burn(from, amount);\n  }\n}\n"
  },
  {
    "path": "contracts/MockContract.sol",
    "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.6.4;\n\n///////////////////////////////////////////////\n// This contract is taken from Gnosis and is\n// used to facilitate unit testing. It should\n// not be deployed in production.\n///////////////////////////////////////////////\n\ninterface MockInterface {\n  /**\n   * @dev After calling this method, the mock will return `response` when it is called\n   * with any calldata that is not mocked more specifically below\n   * (e.g. using givenMethodReturn).\n   * @param response ABI encoded response that will be returned if method is invoked\n   */\n  function givenAnyReturn(bytes calldata response) external;\n\n  function givenAnyReturnBool(bool response) external;\n\n  function givenAnyReturnUint(uint256 response) external;\n\n  function givenAnyReturnAddress(address response) external;\n\n  function givenAnyRevert() external;\n\n  function givenAnyRevertWithMessage(string calldata message) external;\n\n  function givenAnyRunOutOfGas() external;\n\n  /**\n   * @dev After calling this method, the mock will return `response` when the given\n   * methodId is called regardless of arguments. If the methodId and arguments\n   * are mocked more specifically (using `givenMethodAndArguments`) the latter\n   * will take precedence.\n   * @param method ABI encoded methodId. It is valid to pass full calldata (including arguments). The mock will extract the methodId from it\n   * @param response ABI encoded response that will be returned if method is invoked\n   */\n  function givenMethodReturn(bytes calldata method, bytes calldata response)\n    external;\n\n  function givenMethodReturnBool(bytes calldata method, bool response) external;\n\n  function givenMethodReturnUint(bytes calldata method, uint256 response)\n    external;\n\n  function givenMethodReturnAddress(bytes calldata method, address response)\n    external;\n\n  function givenMethodRevert(bytes calldata method) external;\n\n  function givenMethodRevertWithMessage(\n    bytes calldata method,\n    string calldata message\n  ) external;\n\n  function givenMethodRunOutOfGas(bytes calldata method) external;\n\n  /**\n   * @dev After calling this method, the mock will return `response` when the given\n   * methodId is called with matching arguments. These exact calldataMocks will take\n   * precedence over all other calldataMocks.\n   * @param call ABI encoded calldata (methodId and arguments)\n   * @param response ABI encoded response that will be returned if contract is invoked with calldata\n   */\n  function givenCalldataReturn(bytes calldata call, bytes calldata response)\n    external;\n\n  function givenCalldataReturnBool(bytes calldata call, bool response) external;\n\n  function givenCalldataReturnUint(bytes calldata call, uint256 response)\n    external;\n\n  function givenCalldataReturnAddress(bytes calldata call, address response)\n    external;\n\n  function givenCalldataRevert(bytes calldata call) external;\n\n  function givenCalldataRevertWithMessage(\n    bytes calldata call,\n    string calldata message\n  ) external;\n\n  function givenCalldataRunOutOfGas(bytes calldata call) external;\n\n  /**\n   * @dev Returns the number of times anything has been called on this mock since last reset\n   */\n  function invocationCount() external returns (uint256);\n\n  /**\n   * @dev Returns the number of times the given method has been called on this mock since last reset\n   * @param method ABI encoded methodId. It is valid to pass full calldata (including arguments). The mock will extract the methodId from it\n   */\n  function invocationCountForMethod(bytes calldata method)\n    external\n    returns (uint256);\n\n  /**\n   * @dev Returns the number of times this mock has been called with the exact calldata since last reset.\n   * @param call ABI encoded calldata (methodId and arguments)\n   */\n  function invocationCountForCalldata(bytes calldata call)\n    external\n    returns (uint256);\n\n  /**\n   * @dev Resets all mocked methods and invocation counts.\n   */\n  function reset() external;\n}\n\n/**\n * Implementation of the MockInterface.\n */\ncontract MockContract is MockInterface {\n  enum MockType {\n    Return,\n    Revert,\n    OutOfGas\n  }\n\n  bytes32 public constant MOCKS_LIST_START = hex\"01\";\n  bytes public constant MOCKS_LIST_END = \"0xff\";\n  bytes32 public constant MOCKS_LIST_END_HASH = keccak256(MOCKS_LIST_END);\n  bytes4 public constant SENTINEL_ANY_MOCKS = hex\"01\";\n  bytes public constant DEFAULT_FALLBACK_VALUE = abi.encode(false);\n\n  // A linked list allows easy iteration and inclusion checks\n  mapping(bytes32 => bytes) calldataMocks;\n  mapping(bytes => MockType) calldataMockTypes;\n  mapping(bytes => bytes) calldataExpectations;\n  mapping(bytes => string) calldataRevertMessage;\n  mapping(bytes32 => uint256) calldataInvocations;\n\n  mapping(bytes4 => bytes4) methodIdMocks;\n  mapping(bytes4 => MockType) methodIdMockTypes;\n  mapping(bytes4 => bytes) methodIdExpectations;\n  mapping(bytes4 => string) methodIdRevertMessages;\n  mapping(bytes32 => uint256) methodIdInvocations;\n\n  MockType fallbackMockType;\n  bytes fallbackExpectation = DEFAULT_FALLBACK_VALUE;\n  string fallbackRevertMessage;\n  uint256 invocations;\n  uint256 resetCount;\n\n  constructor() public {\n    calldataMocks[MOCKS_LIST_START] = MOCKS_LIST_END;\n    methodIdMocks[SENTINEL_ANY_MOCKS] = SENTINEL_ANY_MOCKS;\n  }\n\n  function trackCalldataMock(bytes memory call) private {\n    bytes32 callHash = keccak256(call);\n    if (calldataMocks[callHash].length == 0) {\n      calldataMocks[callHash] = calldataMocks[MOCKS_LIST_START];\n      calldataMocks[MOCKS_LIST_START] = call;\n    }\n  }\n\n  function trackMethodIdMock(bytes4 methodId) private {\n    if (methodIdMocks[methodId] == 0x0) {\n      methodIdMocks[methodId] = methodIdMocks[SENTINEL_ANY_MOCKS];\n      methodIdMocks[SENTINEL_ANY_MOCKS] = methodId;\n    }\n  }\n\n  function _givenAnyReturn(bytes memory response) internal {\n    fallbackMockType = MockType.Return;\n    fallbackExpectation = response;\n  }\n\n  function givenAnyReturn(bytes calldata response) external override {\n    _givenAnyReturn(response);\n  }\n\n  function givenAnyReturnBool(bool response) external override {\n    uint256 flag = response ? 1 : 0;\n    _givenAnyReturn(uintToBytes(flag));\n  }\n\n  function givenAnyReturnUint(uint256 response) external override {\n    _givenAnyReturn(uintToBytes(response));\n  }\n\n  function givenAnyReturnAddress(address response) external override {\n    _givenAnyReturn(uintToBytes(uint256(response)));\n  }\n\n  function givenAnyRevert() external override {\n    fallbackMockType = MockType.Revert;\n    fallbackRevertMessage = \"\";\n  }\n\n  function givenAnyRevertWithMessage(string calldata message)\n    external\n    override\n  {\n    fallbackMockType = MockType.Revert;\n    fallbackRevertMessage = message;\n  }\n\n  function givenAnyRunOutOfGas() external override {\n    fallbackMockType = MockType.OutOfGas;\n  }\n\n  function _givenCalldataReturn(bytes memory call, bytes memory response)\n    private\n  {\n    calldataMockTypes[call] = MockType.Return;\n    calldataExpectations[call] = response;\n    trackCalldataMock(call);\n  }\n\n  function givenCalldataReturn(bytes calldata call, bytes calldata response)\n    external\n    override\n  {\n    _givenCalldataReturn(call, response);\n  }\n\n  function givenCalldataReturnBool(bytes calldata call, bool response)\n    external\n    override\n  {\n    uint256 flag = response ? 1 : 0;\n    _givenCalldataReturn(call, uintToBytes(flag));\n  }\n\n  function givenCalldataReturnUint(bytes calldata call, uint256 response)\n    external\n    override\n  {\n    _givenCalldataReturn(call, uintToBytes(response));\n  }\n\n  function givenCalldataReturnAddress(bytes calldata call, address response)\n    external\n    override\n  {\n    _givenCalldataReturn(call, uintToBytes(uint256(response)));\n  }\n\n  function _givenMethodReturn(bytes memory call, bytes memory response)\n    private\n  {\n    bytes4 method = bytesToBytes4(call);\n    methodIdMockTypes[method] = MockType.Return;\n    methodIdExpectations[method] = response;\n    trackMethodIdMock(method);\n  }\n\n  function givenMethodReturn(bytes calldata call, bytes calldata response)\n    external\n    override\n  {\n    _givenMethodReturn(call, response);\n  }\n\n  function givenMethodReturnBool(bytes calldata call, bool response)\n    external\n    override\n  {\n    uint256 flag = response ? 1 : 0;\n    _givenMethodReturn(call, uintToBytes(flag));\n  }\n\n  function givenMethodReturnUint(bytes calldata call, uint256 response)\n    external\n    override\n  {\n    _givenMethodReturn(call, uintToBytes(response));\n  }\n\n  function givenMethodReturnAddress(bytes calldata call, address response)\n    external\n    override\n  {\n    _givenMethodReturn(call, uintToBytes(uint256(response)));\n  }\n\n  function givenCalldataRevert(bytes calldata call) external override {\n    calldataMockTypes[call] = MockType.Revert;\n    calldataRevertMessage[call] = \"\";\n    trackCalldataMock(call);\n  }\n\n  function givenMethodRevert(bytes calldata call) external override {\n    bytes4 method = bytesToBytes4(call);\n    methodIdMockTypes[method] = MockType.Revert;\n    trackMethodIdMock(method);\n  }\n\n  function givenCalldataRevertWithMessage(\n    bytes calldata call,\n    string calldata message\n  ) external override {\n    calldataMockTypes[call] = MockType.Revert;\n    calldataRevertMessage[call] = message;\n    trackCalldataMock(call);\n  }\n\n  function givenMethodRevertWithMessage(\n    bytes calldata call,\n    string calldata message\n  ) external override {\n    bytes4 method = bytesToBytes4(call);\n    methodIdMockTypes[method] = MockType.Revert;\n    methodIdRevertMessages[method] = message;\n    trackMethodIdMock(method);\n  }\n\n  function givenCalldataRunOutOfGas(bytes calldata call) external override {\n    calldataMockTypes[call] = MockType.OutOfGas;\n    trackCalldataMock(call);\n  }\n\n  function givenMethodRunOutOfGas(bytes calldata call) external override {\n    bytes4 method = bytesToBytes4(call);\n    methodIdMockTypes[method] = MockType.OutOfGas;\n    trackMethodIdMock(method);\n  }\n\n  function invocationCount() external override returns (uint256) {\n    return invocations;\n  }\n\n  function invocationCountForMethod(bytes calldata call)\n    external\n    override\n    returns (uint256)\n  {\n    bytes4 method = bytesToBytes4(call);\n    return methodIdInvocations[keccak256(abi.encodePacked(resetCount, method))];\n  }\n\n  function invocationCountForCalldata(bytes calldata call)\n    external\n    override\n    returns (uint256)\n  {\n    return calldataInvocations[keccak256(abi.encodePacked(resetCount, call))];\n  }\n\n  function reset() external override {\n    // Reset all exact calldataMocks\n    bytes memory nextMock = calldataMocks[MOCKS_LIST_START];\n    bytes32 mockHash = keccak256(nextMock);\n    // We cannot compary bytes\n    while (mockHash != MOCKS_LIST_END_HASH) {\n      // Reset all mock maps\n      calldataMockTypes[nextMock] = MockType.Return;\n      calldataExpectations[nextMock] = hex\"\";\n      calldataRevertMessage[nextMock] = \"\";\n      // Set next mock to remove\n      nextMock = calldataMocks[mockHash];\n      // Remove from linked list\n      calldataMocks[mockHash] = \"\";\n      // Update mock hash\n      mockHash = keccak256(nextMock);\n    }\n    // Clear list\n    calldataMocks[MOCKS_LIST_START] = MOCKS_LIST_END;\n\n    // Reset all any calldataMocks\n    bytes4 nextAnyMock = methodIdMocks[SENTINEL_ANY_MOCKS];\n    while (nextAnyMock != SENTINEL_ANY_MOCKS) {\n      bytes4 currentAnyMock = nextAnyMock;\n      methodIdMockTypes[currentAnyMock] = MockType.Return;\n      methodIdExpectations[currentAnyMock] = hex\"\";\n      methodIdRevertMessages[currentAnyMock] = \"\";\n      nextAnyMock = methodIdMocks[currentAnyMock];\n      // Remove from linked list\n      methodIdMocks[currentAnyMock] = 0x0;\n    }\n    // Clear list\n    methodIdMocks[SENTINEL_ANY_MOCKS] = SENTINEL_ANY_MOCKS;\n\n    fallbackExpectation = DEFAULT_FALLBACK_VALUE;\n    fallbackMockType = MockType.Return;\n    invocations = 0;\n    resetCount += 1;\n  }\n\n  function useAllGas() private {\n    while (true) {\n      bool s;\n      assembly {\n        //expensive call to EC multiply contract\n        s := call(sub(gas(), 2000), 6, 0, 0x0, 0xc0, 0x0, 0x60)\n      }\n    }\n  }\n\n  function bytesToBytes4(bytes memory b) private pure returns (bytes4) {\n    bytes4 out;\n    for (uint256 i = 0; i < 4; i++) {\n      out |= bytes4(b[i] & 0xFF) >> (i * 8);\n    }\n    return out;\n  }\n\n  function uintToBytes(uint256 x) private pure returns (bytes memory b) {\n    b = new bytes(32);\n    assembly {\n      mstore(add(b, 32), x)\n    }\n  }\n\n  function updateInvocationCount(bytes4 methodId, bytes memory originalMsgData)\n    public\n  {\n    require(\n      msg.sender == address(this),\n      \"Can only be called from the contract itself\"\n    );\n    invocations += 1;\n    methodIdInvocations[keccak256(abi.encodePacked(resetCount, methodId))] += 1;\n    calldataInvocations[\n      keccak256(abi.encodePacked(resetCount, originalMsgData))\n    ] += 1;\n  }\n\n  fallback() external payable {\n    bytes4 methodId;\n    assembly {\n      methodId := calldataload(0)\n    }\n\n    // First, check exact matching overrides\n    if (calldataMockTypes[msg.data] == MockType.Revert) {\n      revert(calldataRevertMessage[msg.data]);\n    }\n    if (calldataMockTypes[msg.data] == MockType.OutOfGas) {\n      useAllGas();\n    }\n    bytes memory result = calldataExpectations[msg.data];\n\n    // Then check method Id overrides\n    if (result.length == 0) {\n      if (methodIdMockTypes[methodId] == MockType.Revert) {\n        revert(methodIdRevertMessages[methodId]);\n      }\n      if (methodIdMockTypes[methodId] == MockType.OutOfGas) {\n        useAllGas();\n      }\n      result = methodIdExpectations[methodId];\n    }\n\n    // Last, use the fallback override\n    if (result.length == 0) {\n      if (fallbackMockType == MockType.Revert) {\n        revert(fallbackRevertMessage);\n      }\n      if (fallbackMockType == MockType.OutOfGas) {\n        useAllGas();\n      }\n      result = fallbackExpectation;\n    }\n\n    // Record invocation as separate call so we don't rollback in case we are called with STATICCALL\n    (, bytes memory r) = address(this).call{ gas: 100000 }(\n      abi.encodeWithSignature(\n        \"updateInvocationCount(bytes4,bytes)\",\n        methodId,\n        msg.data\n      )\n    );\n    assert(r.length == 0);\n\n    assembly {\n      return(add(0x20, result), mload(result))\n    }\n  }\n}\n"
  },
  {
    "path": "contracts/NFT.sol",
    "content": "//SPDX-License-Identifier: MIT\n// contracts/ERC721.sol\n\npragma solidity >=0.6.2;\n\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/utils/Counters.sol\";\n\ncontract NFT is ERC721 {\n  using Counters for Counters.Counter;\n  Counters.Counter private _tokenIds;\n\n  constructor() ERC721(\"GameItem\", \"ITM\") {}\n\n  // commented out unused variable\n  // function awardItem(address player, string memory tokenURI)\n  function awardItem(address player)\n    public\n    returns (uint256)\n  {\n    _tokenIds.increment();\n\n    uint256 newItemId = _tokenIds.current();\n    _mint(player, newItemId);\n    // _setTokenURI(newItemId, tokenURI);\n\n    return newItemId;\n  }\n}\n"
  },
  {
    "path": "contracts/Storage.sol",
    "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.6.0 <0.8.0;\n\ncontract Storage {\n  uint256 number;\n\n  function store(uint256 num) public {\n    number = num;\n  }\n\n  function retrieve() public view returns (uint256) {\n    return number;\n  }\n}\n"
  },
  {
    "path": "hardhat.config.ts",
    "content": "import { task } from \"hardhat/config\"\nimport { SignerWithAddress } from \"@nomiclabs/hardhat-ethers/signers\"\nimport { BigNumber } from \"ethers\"\nimport \"@nomiclabs/hardhat-waffle\"\n\n// When using the hardhat network, you may choose to fork Fuji or Avalanche Mainnet\n// This will allow you to debug contracts using the hardhat network while keeping the current network state\n// To enable forking, turn one of these booleans on, and then run your tasks/scripts using ``--network hardhat``\n// For more information go to the hardhat guide\n// https://hardhat.org/hardhat-network/\n// https://hardhat.org/guides/mainnet-forking.html\nconst FORK_FUJI = false\nconst FORK_MAINNET = false\nconst forkingData = FORK_FUJI ? {\n  url: 'https://api.avax-test.network/ext/bc/C/rpc',\n} : FORK_MAINNET ? {\n  url: 'https://api.avax.network/ext/bc/C/rpc'\n} : undefined\n\ntask(\"accounts\", \"Prints the list of accounts\", async (args, hre): Promise<void> => {\n  const accounts: SignerWithAddress[] = await hre.ethers.getSigners()\n  accounts.forEach((account: SignerWithAddress): void => {\n    console.log(account.address)\n  })\n})\n\ntask(\"balances\", \"Prints the list of AVAX account balances\", async (args, hre): Promise<void> => {\n  const accounts: SignerWithAddress[] = await hre.ethers.getSigners()\n  for(const account of accounts){\n    const balance: BigNumber = await hre.ethers.provider.getBalance(\n      account.address\n    );\n    console.log(`${account.address} has balance ${balance.toString()}`);\n  }\n})\n\nexport default {\n  solidity: {\n    compilers: [\n      {\n        version: \"0.5.16\"\n      },\n      {\n        version: \"0.6.2\"\n      },\n      {\n        version: \"0.6.4\"\n      },\n      {\n        version: \"0.7.0\"\n      },\n      {\n        version: \"0.8.0\"\n      }\n    ]\n  },\n  networks: {\n    hardhat: {\n      gasPrice: 225000000000,\n      chainId: !forkingData ? 43112 : undefined, //Only specify a chainId if we are not forking\n      forking: forkingData\n    },\n    local: {\n      url: 'http://localhost:9650/ext/bc/C/rpc',\n      gasPrice: 225000000000,\n      chainId: 43112,\n      accounts: [\n        \"0x56289e99c94b6912bfc12adc093c9b51124f0dc54ac7a766b2bc5ccf558d8027\",\n        \"0x7b4198529994b0dc604278c99d153cfd069d594753d471171a1d102a10438e07\",\n        \"0x15614556be13730e9e8d6eacc1603143e7b96987429df8726384c2ec4502ef6e\",\n        \"0x31b571bf6894a248831ff937bb49f7754509fe93bbd2517c9c73c4144c0e97dc\",\n        \"0x6934bef917e01692b789da754a0eae31a8536eb465e7bff752ea291dad88c675\",\n        \"0xe700bdbdbc279b808b1ec45f8c2370e4616d3a02c336e68d85d4668e08f53cff\",\n        \"0xbbc2865b76ba28016bc2255c7504d000e046ae01934b04c694592a6276988630\",\n        \"0xcdbfd34f687ced8c6968854f8a99ae47712c4f4183b78dcc4a903d1bfe8cbf60\",\n        \"0x86f78c5416151fe3546dece84fda4b4b1e36089f2dbc48496faf3a950f16157c\",\n        \"0x750839e9dbbd2a0910efe40f50b2f3b2f2f59f5580bb4b83bd8c1201cf9a010a\"\n      ]\n    },\n    fuji: {\n      url: 'https://api.avax-test.network/ext/bc/C/rpc',\n      gasPrice: 225000000000,\n      chainId: 43113,\n      accounts: []\n    },\n    mainnet: {\n      url: 'https://api.avax.network/ext/bc/C/rpc',\n      gasPrice: 225000000000,\n      chainId: 43114,\n      accounts: []\n    }\n  }\n}"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"avalanche-smart-contract-quickstart\",\n  \"devDependencies\": {\n    \"@nomiclabs/hardhat-ethers\": \"^2.0.2\",\n    \"@nomiclabs/hardhat-waffle\": \"^2.0.1\",\n    \"@openzeppelin/contracts\": \"^4.3.0\",\n    \"@types/chai\": \"^4.2.21\",\n    \"@types/mocha\": \"^9.0.0\",\n    \"@types/node\": \"^16.7.1\",\n    \"avalanche\": \"3.8.5\",\n    \"chai\": \"^4.3.4\",\n    \"ethereum-waffle\": \"^3.4.0\",\n    \"ethereumjs-tx\": \"^2.1.2\",\n    \"ethers\": \"^5.4.5\",\n    \"hardhat\": \"2.6.1\",\n    \"ts-node\": \"^10.2.1\",\n    \"web3\": \"^1.5.2\"\n  },\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"index.js\",\n  \"repository\": \"https://github.com/ava-labs/avalanche-smart-contract-quickstart\",\n  \"author\": \"Connor Daly <connor.daly@avalabs.org>\",\n  \"contributors\": [\n    \"Gabriel Cardona <gabriel@avalabs.org>\"\n  ],\n  \"license\": \"BSD-3-Clause\",\n  \"scripts\": {\n    \"precompile\": \"rimraf ./build/\",\n    \"compile\": \"npx hardhat compile\",\n    \"console\": \"npx hardhat console\",\n    \"pretest\": \"yarn compile\",\n    \"test\": \"npx hardhat test\",\n    \"deploy\": \"npx hardhat run scripts/deploy.ts\",\n    \"erc20\": \"npx hardhat run scripts/erc20.ts\",\n    \"nft\": \"npx hardhat run scripts/nft.ts --network mainnet\",\n    \"storage\": \"npx hardhat run scripts/storage.ts\",\n    \"send-avax-wallet-signer\": \"npx hardhat run scripts/sendAvaxWalletSigner.ts\",\n    \"send-avax-json-provider\": \"npx hardhat run scripts/sendAvaxJSONProvider.ts\",\n    \"lint\": \"prettier ./test/**/*.ts --check\",\n    \"prepublishOnly\": \"yarn test\",\n    \"hardhat\": \"npx hardhat\",\n    \"accounts\": \"npx hardhat accounts\",\n    \"balances\": \"npx hardhat balances\",\n    \"fund-cchain-addresses\": \"npx hardhat run scripts/fund-cchain-addresses.js\"\n  },\n  \"dependencies\": {\n    \"typescript\": \"^4.5.4\"\n  },\n  \"engines\": {\n    \"node\": \">=14.17.0\"\n  }\n}\n"
  },
  {
    "path": "scripts/deploy.ts",
    "content": "import { \n  Contract, \n  ContractFactory \n} from \"ethers\"\nimport { ethers } from \"hardhat\"\n\nconst main = async(): Promise<any> => {\n  const Coin: ContractFactory = await ethers.getContractFactory(\"ExampleERC20\")\n  const coin: Contract = await Coin.deploy()\n\n  await coin.deployed()\n  console.log(`Coin deployed to: ${coin.address}`)\n}\n\nmain()\n.then(() => process.exit(0))\n.catch(error => {\n  console.error(error)\n  process.exit(1)\n})\n"
  },
  {
    "path": "scripts/erc20.ts",
    "content": "import {\n  BigNumber,\n  Contract\n} from \"ethers\"\nimport { ethers } from \"hardhat\"\n\nconst coinName: string = \"\"\nconst coinAddr: string = \"\"\nconst walletAddress: string = \"\"\n\nconst main = async (): Promise<any> => {\n  const contract: Contract = await ethers.getContractAt(coinName, coinAddr)\n  const contractAddress: string = contract.address\n  console.log(`Address: ${contractAddress}`)\n\n  const name: string = await contract.name()\n  console.log(`Name: ${name}`)\n\n  const symbol: string = await contract.symbol()\n  console.log(`Symbol: ${symbol}`)\n\n  const decimals: string = await contract.decimals()\n  console.log(`Decimals: ${decimals}`)\n\n  const balance: BigNumber = await contract.balanceOf(walletAddress)\n  console.log(`Balance of ${walletAddress}: ${balance.toString()}`)\n\n  let totalSupply: BigNumber = await contract.totalSupply()\n  console.log(`Total supply: ${totalSupply.toString()}`)\n\n  console.log(`-----MINTING-----`)\n  await contract.mint(walletAddress, totalSupply)\n\n  totalSupply = await contract.totalSupply()\n  console.log(`Total supply: ${totalSupply.toString()}`)\n\n  console.log(`-----BURNING-----`)\n  await contract.burn(walletAddress, totalSupply)\n\n  totalSupply = await contract.totalSupply()\n  console.log(`Total supply: ${totalSupply.toString()}`)\n\n  const tx = await contract.transfer(walletAddress, balance)\n  console.log(\"--TX--\")\n  console.log(tx)\n\n  const txReceipt = await tx.wait()\n  console.log(\"--TX RECEIPT--\")\n  console.log(txReceipt)\n}\n\nmain()\n  .then(() => process.exit(0))\n  .catch(error => {\n    console.error(error)\n    process.exit(1)\n  })"
  },
  {
    "path": "scripts/example.js",
    "content": "const { Contract } = require(\"ethers\");\nconst hre = require(\"hardhat\");\n\n// TODO: Enter your deployed contract address\nconst COIN_ADDR = \"0x0000000000000000000000000000000000000000\";\n\n/**\n * Empty. Try calling some functions here.\n */\nasync function main() {\n\n}\n\n/**\n * Takes a transaction response and calculates the amount of gas used and converts \n * it to AVAX. Prints results to console.\n * \n * @param {TransactionResponse} tx transactionn to extract gas info from\n * @param {string} methodName Name of method to print\n */\nasync function calculateGasFee(tx, methodName) {\n    const gasPrice = 470000000000;\n    const weiPerAvax = Number('1000000000000000000');\n\n    const txReceipt = await tx.wait();\n    const gasUsed = txReceipt.gasUsed.toString()\n    const avax = gasUsed * gasPrice / weiPerAvax;\n    console.log(methodName, \"gas used:\", gasUsed);\n    console.log(methodName, \"AVAX cost:\", avax);\n}\n\n/**\n * Calls transfer on the provided contract. Transfers the ERC20 from the from signer \n * to the to signer for the amount of amount.\n * \n * @param {Signer} from signer to send from\n * @param {Signer} to signer to send to\n * @param {number} amount amount to send\n * @param {Contract} coinContract ERC20 contract to call\n */\nasync function sendERC20(from, to, amount, coinContract) {\n    const coin = coinContract.connect(from);\n    tx = await coin.transfer(to.getAddress(), amount);\n    \n    await calculateGasFee(tx, \"Transfer\");\n    \n}\n\n// We recommend this pattern to be able to use async/await everywhere\n// and properly handle errors.\nmain()\n  .then(() => process.exit(0))\n  .catch(error => {\n    console.error(error);\n    process.exit(1);\n  });"
  },
  {
    "path": "scripts/fund-cchain-addresses.js",
    "content": "'use strict';\nObject.defineProperty(exports, '__esModule', { value: true });\nconst avalanche_1 = require('avalanche');\nconst avm_1 = require('avalanche/dist/apis/avm');\nconst evm_1 = require('avalanche/dist/apis/evm');\nconst utils_1 = require('avalanche/dist/utils');\nconst sleep = (ms) => {\n  return new Promise((resolve) => setTimeout(resolve, ms));\n};\nconst ip = 'localhost';\nconst port = 9650;\nconst protocol = 'http';\nconst networkID = 12345;\nconst avalanche = new avalanche_1.Avalanche(ip, port, protocol, networkID);\nconst mstimeout = 3000;\nconst xchain = avalanche.XChain();\nconst cchain = avalanche.CChain();\nconst bintools = avalanche_1.BinTools.getInstance();\nconst xKeychain = xchain.keyChain();\nconst cKeychain = cchain.keyChain();\nconst privKeys = [\n  'PrivateKey-ewoqjP7PxY4yr3iLTpLisriqt94hdyDFNgchSxGGztUrTXtNN',\n  'PrivateKey-wHR4zmr9am94KVYnV2aRR4QXt78cuGebt1GpYNwJYEbfAGonj',\n  'PrivateKey-AR874kuHtHpDk7ntffuEQ9cwiQLL2dz1DmJankW1EyXnz5fc7',\n  'PrivateKey-Ntk8vV7zaWzAot2wuDXK4e9ZGFUnU49AYTDew5XUyYaNz2u9d',\n  'PrivateKey-oLM8XbXxXmBHVbdKm2tRYQ1WdMj3b2NggftQpvDUXWSMtdY4i',\n  'PrivateKey-2kjfDc9RVUQJnu3HQDGiVdxvhM9BmR3UTx7Aq8AJ82G2MspATy',\n  'PrivateKey-2Rh5Gtu28ca7PS6rLfN6uou9ext8Y5xhoAJDdWPU7GESBLHtv6',\n  'PrivateKey-2ZcbEPKkXjswsNRBGViGzruReAtTAxW9hsGeMc2GgppnJnDgne',\n  'PrivateKey-22SYvqaRgFtPJfiZmswrCyE57UcssLVnNPDJ48PYAiCjKVAGy7',\n  'PrivateKey-tYRsRPijLo6KD2azMLzkcB2ZUndU3a2dJ8kEqBtqesa85pWhB'\n];\nprivKeys.forEach((privKey) => {\n  xKeychain.importKey(privKey);\n  cKeychain.importKey(privKey);\n});\nconst xAddresses = xchain.keyChain().getAddresses();\nconst xAddressStrings = xchain.keyChain().getAddressStrings();\nconst cAddressStrings = cchain.keyChain().getAddressStrings();\nconst cAddresses = cchain.keyChain().getAddresses();\nconst cHexAddresses = [\n  '0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC',\n  '0x9632a79656af553f58738b0fb750320158495942',\n  '0x55ee05df718f1a5c1441e76190eb1a19ee2c9430',\n  '0x4cf2ed3665f6bfa95ce6a11cfdb7a2ef5fc1c7e4',\n  '0x0b891db1901d4875056896f28b6665083935c7a8',\n  '0x01f253be2ebf0bd64649fa468bf7b95ca933bde2',\n  '0x78A23300E04FB5d5D2820E23cc679738982e1fd5',\n  '0x3c7dae394bbf8e9ee1359ad14c1c47003bd06293',\n  '0x61e0b3cd93f36847abbd5d40d6f00a8ec6f3cffb',\n  '0x0fa8ea536be85f32724d57a37758761b86416123'\n];\nconst cChainBlockchainID = utils_1.Defaults.network['12345'].C.blockchainID;\nconst cChainBlockchainIdBuf = bintools.cb58Decode(cChainBlockchainID);\nconst xChainBlockchainID = utils_1.Defaults.network['12345'].X.blockchainID;\nconst xChainBlockchainIdBuf = bintools.cb58Decode(xChainBlockchainID);\nconst exportedOuts = [];\nconst outputs = [];\nconst inputs = [];\nconst importedIns = [];\nconst evmOutputs = [];\nconst fee = xchain.getDefaultTxFee();\nconst locktime = new avalanche_1.BN(0);\nconst threshold = 1;\nconst memo = bintools.stringToBuffer(\n  'AVM utility method buildExportTx to export AVAX to the C-Chain from the X-Chain'\n);\n\nconst waitForUtxo = async () => {\n  const u = await cchain.getUTXOs(cAddressStrings[0], 'X');\n\n  if (u.utxos.getAllUTXOs().length) {\n    return u.utxos.getAllUTXOs();\n  } else {\n    await sleep(mstimeout);\n    return waitForUtxo();\n  }\n};\n\nconst main = async () => {\n  const avaxAssetID = await xchain.getAVAXAssetID();\n  const getBalanceResponse = await xchain.getBalance(\n    xAddressStrings[0],\n    bintools.cb58Encode(avaxAssetID)\n  );\n  const balance = new avalanche_1.BN(getBalanceResponse.balance);\n  const avmUTXOResponse = await xchain.getUTXOs(xAddressStrings);\n  const avmUTXOSet = avmUTXOResponse.utxos;\n  const avmUTXOs = avmUTXOSet.getAllUTXOs();\n  // 1,000 AVAX\n  const amount = new avalanche_1.BN(1000000000000);\n  console.log('Exporting 1000 AVAX to each address on the C-Chain...');\n  let secpTransferOutput = new avm_1.SECPTransferOutput(\n    amount.mul(new avalanche_1.BN(10)),\n    [cAddresses[0]],\n    locktime,\n    threshold\n  );\n  let transferableOutput = new avm_1.TransferableOutput(\n    avaxAssetID,\n    secpTransferOutput\n  );\n  exportedOuts.push(transferableOutput);\n  secpTransferOutput = new avm_1.SECPTransferOutput(\n    balance.sub(amount.mul(new avalanche_1.BN(10))).sub(fee),\n    xAddresses,\n    locktime,\n    threshold\n  );\n  transferableOutput = new avm_1.TransferableOutput(\n    avaxAssetID,\n    secpTransferOutput\n  );\n  outputs.push(transferableOutput);\n  avmUTXOs.forEach((utxo) => {\n    const amountOutput = utxo.getOutput();\n    const amt = amountOutput.getAmount().clone();\n    const txid = utxo.getTxID();\n    const outputidx = utxo.getOutputIdx();\n    const secpTransferInput = new avm_1.SECPTransferInput(amt);\n    secpTransferInput.addSignatureIdx(0, xAddresses[0]);\n    const input = new avm_1.TransferableInput(\n      txid,\n      outputidx,\n      avaxAssetID,\n      secpTransferInput\n    );\n    inputs.push(input);\n  });\n\n  const exportTx = new avm_1.ExportTx(\n    networkID,\n    bintools.cb58Decode(xChainBlockchainID),\n    outputs,\n    inputs,\n    memo,\n    bintools.cb58Decode(cChainBlockchainID),\n    exportedOuts\n  );\n  const avmUnsignedTx = new avm_1.UnsignedTx(exportTx);\n  const avmTx = avmUnsignedTx.sign(xKeychain);\n  const avmTXID = await xchain.issueTx(avmTx);\n  console.log(avmTXID);\n  await sleep(mstimeout);\n  console.log('Importing AVAX to the C-Chain...');\n  console.log('Please wait');\n  const utxos = await waitForUtxo();\n\n  utxos.forEach((utxo, index) => {\n    const assetID = utxo.getAssetID();\n    const txid = utxo.getTxID();\n    const outputidx = utxo.getOutputIdx();\n    const output = utxo.getOutput();\n    const amt = output.getAmount().clone();\n    const input = new evm_1.SECPTransferInput(amt);\n    input.addSignatureIdx(0, cAddresses[0]);\n    const xferin = new evm_1.TransferableInput(txid, outputidx, assetID, input);\n    importedIns.push(xferin);\n\n    cHexAddresses.forEach((cHexAddress) => {\n      const evmOutput = new evm_1.EVMOutput(\n        cHexAddress,\n        new avalanche_1.BN(1000000000),\n        assetID\n      );\n      evmOutputs.push(evmOutput);\n    });\n  });\n\n  const importTx = new evm_1.ImportTx(\n    networkID,\n    cChainBlockchainIdBuf,\n    xChainBlockchainIdBuf,\n    importedIns,\n    evmOutputs\n  );\n  const evmUnsignedTx = new evm_1.UnsignedTx(importTx);\n\n  const evmTx = evmUnsignedTx.sign(cKeychain);\n  const evmTXID = await cchain.issueTx(evmTx);\n  console.log(evmTXID);\n};\nmain();\n"
  },
  {
    "path": "scripts/nft.ts",
    "content": "import { Contract } from \"ethers\"\nimport { ethers } from \"hardhat\"\nimport { abi } from \"../artifacts/contracts/NFT.sol/NFT.json\"\n\nconst coinAddr: string = \"0xe304EDd5C4e590e2b8ce08b9625597FF38192D71\"\nconst main = async (): Promise<any> => {\n  const contract: Contract = new Contract(coinAddr, abi, ethers.provider)\n  const tokenID: number = 395\n  const tokenURI = await contract.tokenURI(tokenID)\n  console.log(tokenURI)\n}\n\nmain()\n  .then(() => process.exit(0))\n  .catch(error => {\n    console.error(error)\n    process.exit(1)\n  })"
  },
  {
    "path": "scripts/sendAvaxJSONProvider.ts",
    "content": "import { utils } from \"ethers\"\nimport { ethers } from \"hardhat\"\ninterface Param {\n  from: string\n  to: string \n  value: string\n}\n\nconst main = async(): Promise<any> => {\n  const from: string = \"0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC\"\n  const to: string = \"0xDd1749831fbF70d88AB7bB07ef7CD9c53D054a57\"\n  const amount: string = \"0.01\"\n  const params: Param[] = [{\n    from: from,\n    to: to,\n    value: utils.parseUnits(amount, \"ether\").toHexString()\n  }]\n  const tx: any = await ethers.provider.send(\"eth_sendTransaction\", params)\n  console.log(tx)\n}\n\nmain()\n.then(() => process.exit(0))\n.catch(error => {\n  console.error(error)\n  process.exit(1)\n})"
  },
  {
    "path": "scripts/sendAvaxWalletSigner.ts",
    "content": "import { \n  BigNumber,\n  providers,\n  utils,\n  Wallet\n} from \"ethers\"\n\nconst walletAddress: string = \"0xDd1749831fbF70d88AB7bB07ef7CD9c53D054a57\"\nconst pk: string = \"0x56289e99c94b6912bfc12adc093c9b51124f0dc54ac7a766b2bc5ccf558d8027\"\nconst protocol: string = \"http\"\nconst host: string = \"localhost\"\nconst port: number = 9650\n\nconst main = async(): Promise<any> => {\n  const provider: providers.JsonRpcProvider = new providers.JsonRpcProvider(`${protocol}://${host}:${port}/ext/bc/C/rpc`)\n  const num: number = await provider.getBlockNumber()\n  console.log(num)\n\n  const balance: BigNumber = await provider.getBalance(walletAddress)\n  console.log(balance)\n\n  const formatted: string = utils.formatEther(balance)\n  console.log(formatted)\n\n  const parsed: BigNumber = utils.parseEther(\"1.0\")\n  console.log(parsed)\n\n  const wallet: Wallet = new Wallet(pk, provider)\n  const tx: providers.TransactionResponse = await wallet.sendTransaction({ \n    to: walletAddress, \n    value: parsed\n  });\n  console.log(tx)\n}\n\nmain()\n.then(() => process.exit(0))\n.catch(error => {\n  console.error(error)\n  process.exit(1)\n})"
  },
  {
    "path": "scripts/storage.ts",
    "content": "import { \n  BigNumber,\n  Contract\n} from \"ethers\"\nimport { ethers } from \"hardhat\"\n\nconst contractName: string = \"Storage\"\nconst contractAddress: string = \"0xE3573540ab8A1C4c754Fd958Dc1db39BBE81b208\"\n\nconst main = async(): Promise<any> => {\n  const contract: Contract = await ethers.getContractAt(contractName, contractAddress)\n  const num: BigNumber = await contract.retrieve()\n  console.log(`Number: ${num.toString()}`)\n  const tx = await contract.store(507)\n  console.log(tx)\n}\n\nmain()"
  },
  {
    "path": "setup.js",
    "content": "const hardhat = require(\"hardhat\")\nconst Web3 = require(\"web3\")\n"
  },
  {
    "path": "test/Coin.js",
    "content": "// test/Airdrop.js\n// Load dependencies\nconst { expect } = require('chai');\nconst { BigNumber } = require('ethers');\nconst { ethers } = require('hardhat');\nconst Web3 = require('web3');\n\nconst OWNER_ADDRESS = ethers.utils.getAddress(\"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266\");\n\nconst DECIMALS = 2;\n\nconst AMT = 150\n\n///////////////////////////////////////////////////////////\n// SEE https://hardhat.org/tutorial/testing-contracts.html\n// FOR HELP WRITING TESTS\n// USE https://github.com/gnosis/mock-contract FOR HELP\n// WITH MOCK CONTRACT\n///////////////////////////////////////////////////////////\n\n// Start test block\ndescribe('Coin', function () {\n    before(async function () {\n        this.Coin = await ethers.getContractFactory(\"ExampleERC20\");\n        this.MockContract = await ethers.getContractFactory(\"contracts/MockContract.sol:MockContract\");\n    });\n\n    beforeEach(async function () {\n        this.coin = await this.Coin.deploy()\n        await this.coin.deployed()\n        this.mock = await this.MockContract.deploy()\n        await this.mock.deployed()\n    });\n\n    // Test cases\n\n    //////////////////////////////\n    //       Constructor \n    //////////////////////////////\n    describe(\"Constructor\", function () {\n        it('mock test', async function () {\n            // If another contract calls balanceOf on the mock contract, return AMT\n            const balanceOf = Web3.utils.sha3('balanceOf(address)').slice(0,10);\n            await this.mock.givenMethodReturnUint(balanceOf, AMT);\n        });\n    });\n\n    //////////////////////////////\n    //  setRemainderDestination \n    //////////////////////////////\n    describe(\"otherMethod\", function () {\n\n    });\n});"
  },
  {
    "path": "tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"resolveJsonModule\": true\n  }\n}"
  }
]