본문으로 건너뛰기
Skillpedia
테스트48k · #6162

web3-testing

하는 일

이 스킬은 암호화폐 스마트 컨트랙트를 테스트하는 데 도움을 줍니다. Hardhat과 Foundry 같은 도구를 사용해 코드가 올바르고 안전하게 작동하는지 확인합니다.

사용하는 경우

  • ✓스마트 컨트랙트 코드를 작성하고 있을 때.
  • ✓다양한 상황에서 컨트랙트가 기대대로 작동하는지 확인할 때.
  • ✓컨트랙트를 출시하기 전에 버그를 찾아 고치고 싶은 경우.

스킬 링크

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/web3-testing/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/web3-testing/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“토큰 전송이 올바르게 작동하는지 확인하려면 토큰 컨트랙트를 어떻게 테스트할 수 있나요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

이 스킬은 Hardhat과 Foundry 같은 테스트 환경을 사용해 컨트랙트의 동작을 모의합니다. 미리 정의된 테스트를 실행하고 결과가 기대와 같은지 확인하며, 문제가 있으면 보고합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Supporting material availability

This catalog copy contains the inline guidance below, but does not include the following supporting paths. They are external prerequisites, not bundled files:

  • <support-root>/references/hardhat-setup.md
  • <support-root>/references/foundry-setup.md
  • <support-root>/references/test-patterns.md
  • <support-root>/references/mainnet-forking.md
  • <support-root>/references/contract-verification.md
  • <support-root>/assets/hardhat-config.js
  • <support-root>/assets/test-suite.js
  • <support-root>/assets/foundry.toml
  • <support-root>/scripts/test-contract.sh

Ask for the original supporting material or an existing installation before using a step that depends on these paths; this catalog does not identify a verified download source for them. Resolve each path relative to that installation, inspect its contents, and verify any applicable license and execution prerequisites. Do not run a command or claim a referenced procedure was followed until its required file exists. Do not fabricate the missing scripts or treat an unrelated file with the same name as equivalent. Independent steps fully documented here can proceed within the user’s authorized scope; report any dependent step as unavailable.

Web3 Smart Contract Testing

Master comprehensive testing strategies for smart contracts using Hardhat, Foundry, and advanced testing patterns.

Do not use this skill when

  • The task is unrelated to web3 smart contract testing
  • You need a different domain or tool outside this scope

Instructions

  • Clarify goals, constraints, and required inputs.
  • Apply relevant best practices and validate outcomes.
  • Provide actionable steps and verification.

Use this skill when

  • Writing unit tests for smart contracts
  • Setting up integration test suites
  • Performing gas optimization testing
  • Fuzzing for edge cases
  • Forking mainnet for realistic testing
  • Automating test coverage reporting
  • Verifying contracts on Etherscan

Hardhat Testing Setup

// hardhat.config.js
require("@nomicfoundation/hardhat-toolbox");
require("@nomiclabs/hardhat-etherscan");
require("hardhat-gas-reporter");
require("solidity-coverage");

module.exports = {
  solidity: {
    version: "0.8.19",
    settings: {
      optimizer: {
        enabled: true,
        runs: 200,
      },
    },
  },
  networks: {
    hardhat: {
      forking: {
        url: process.env.MAINNET_RPC_URL,
        blockNumber: 15000000,
      },
    },
    goerli: {
      url: process.env.GOERLI_RPC_URL,
      accounts: [process.env.PRIVATE_KEY],
    },
  },
  gasReporter: {
    enabled: true,
    currency: "USD",
    coinmarketcap: process.env.COINMARKETCAP_API_KEY,
  },
  etherscan: {
    apiKey: process.env.ETHERSCAN_API_KEY,
  },
};

Unit Testing Patterns

const { expect } = require("chai");
const { ethers } = require("hardhat");
const {
  loadFixture,
  time,
} = require("@nomicfoundation/hardhat-network-helpers");

describe("Token Contract", function () {
  // Fixture for test setup
  async function deployTokenFixture() {
    const [owner, addr1, addr2] = await ethers.getSigners();

    const Token = await ethers.getContractFactory("Token");
    const token = await Token.deploy();

    return { token, owner, addr1, addr2 };
  }

  describe("Deployment", function () {
    it("Should set the right owner", async function () {
      const { token, owner } = await loadFixture(deployTokenFixture);
      expect(await token.owner()).to.equal(owner.address);
    });

    it("Should assign total supply to owner", async function () {
      const { token, owner } = await loadFixture(deployTokenFixture);
      const ownerBalance = await token.balanceOf(owner.address);
      expect(await token.totalSupply()).to.equal(ownerBalance);
    });
  });

  describe("Transactions", function () {
    it("Should transfer tokens between accounts", async function () {
      const { token, owner, addr1 } = await loadFixture(deployTokenFixture);

      await expect(token.transfer(addr1.address, 50)).to.changeTokenBalances(
        token,
        [owner, addr1],
        [-50, 50],
      );
    });

    it("Should fail if sender doesn't have enough tokens", async function () {
      const { token, addr1 } = await loadFixture(deployTokenFixture);
      const initialBalance = await token.balanceOf(addr1.address);

      await expect(
        token.connect(addr1).transfer(owner.address, 1),

…
자주 묻는 질문

스마트 컨트랙트란 무엇인가요?

블록체인 네트워크에서 실행되며, 특정 조건이 충족되면 암호화폐 전송처럼 작업을 자동으로 실행하는 프로그램입니다.

Hardhat과 Foundry는 무엇인가요?

개발자가 스마트 컨트랙트를 만들고, 테스트하고, 관리하는 데 도움을 주는 인기 도구입니다.

스마트 컨트랙트 테스트가 왜 중요한가요?

스마트 컨트랙트는 가치를 다루며, 배포된 후에는 바꾸기 어렵습니다. 테스트는 컨트랙트가 안전하고 의도대로 작동하도록 보장해 금전적 손실을 막습니다.

상세 정보

작성자의 원본 설명

Master comprehensive testing strategies for smart contracts using Hardhat, Foundry, and advanced testing patterns.

repo: sickn33/agentic-awesome-skills

인기도

GitHub 스타
48k
순위
#6162
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬