unchain-tech/UNCHAIN-projects

コンテンツに不明記なテストケースあり

Closed this issue · 0 comments

提案内容

NEAR-MulPay Section1 Lesson3

swap.test.ts に書かれていないテストコードが説明の箇所にございます。
そちらのコードを書いてテストしましたが、listUpTokenAddress がswap.solに定義されていないとのことでエラーがでました。
コンテンツ内に記されているテスト結果と一致しませんので、説明の部分を省いてもよいかもしれません。

以下明記されていないコード

it("List up token address with that of symbol", async function () {
      const {
        DaiToken,
        EthToken,
        AoaToken,
        ShibToken,
        SolToken,
        UsdtToken,
        UniToken,
        MaticToken,
        SwapContract,
      } = await loadFixture(deployTokenFixture);
      const DAI = ethers.utils.formatBytes32String("DAI");
      const ETH = ethers.utils.formatBytes32String("ETH");
      const AOA = ethers.utils.formatBytes32String("AOA");
      const SHIB = ethers.utils.formatBytes32String("SHIB");
      const SOL = ethers.utils.formatBytes32String("SOL");
      const USDT = ethers.utils.formatBytes32String("USDT");
      const UNI = ethers.utils.formatBytes32String("UNI");
      const MATIC = ethers.utils.formatBytes32String("MATIC");

      const tokenSymbolList = [DAI, ETH, AOA, SHIB, SOL, USDT, UNI, MATIC];
      const tokenAddressList = [
        DaiToken.address,
        EthToken.address,
        AoaToken.address,
        ShibToken.address,
        SolToken.address,
        UsdtToken.address,
        UniToken.address,
        MaticToken.address,
      ];

      for (let i = 0; i < tokenSymbolList.length; i++) {
        await SwapContract.listUpTokenAddress(
          tokenSymbolList[i],
          tokenAddressList[i]
        );
        const tokenAddress = await SwapContract.returnTokenAddress(
          tokenSymbolList[i]
        );
        const tokenSymbol = ethers.utils.parseBytes32String(tokenSymbolList[i]);
        console.log(`${tokenSymbol} token address :${tokenAddress}`);
      }
    });