Code Monkey home page Code Monkey logo

vulcan's Introduction

Vulcan

Development framework for Foundry projects, with a focus on developer experience and readability.

Built on top of forge-std ❤️

Initially, Vulcan will provide functionality similar to what is already included in forge's VM and forge-std.

Over time, Vulcan will grow to include more functionality and utilities, eventually becoming a feature-rich development framework.

Warning This library should be treated as highly experimental, its API WILL change, and there might be bugs in it. Don't use in production yet.

Installation

$ forge install nomoixyz/vulcan@alpha-1

Usage

See the Vulcan Book for detailed usage information.

Why Vulcan?

Our goal is to provide:

  • Better naming for VM functionality (no more prank, roll, warp, ...)
  • A testing framework with better readability and a familiar syntax
  • Improved ergonomics
  • ...

Vulcan test example:

import { Test, expect, accounts, any, commands, Command,  watchers } from "vulcan/test.sol";

contract TestSomething is Test {
    using accounts for *;
    using watchers for *;

    function testSomething() external {
        // Create an address from a string, set the ETH balance and impersonate calls
        address alice = accounts.create("Alice").setBalance(123).impersonate();

        MyContract mc = new MyContract();

        // This will watch all contract calls and record their execution
        address(mc).watch().captureReverts();

        mc.doSomething();

        // Check that `doSomething()` reverted
        expect(address(mc).lastCall()).toHaveRevertedWith("Something went wrong");

        mc.doSomethingElse();

        // Check event emissions
        expect(address(mc).lastCall()).toHaveEmitted(
            "SomeEvent(address,bytes32,uint256)",
            [address(1).topic(), any()], // Event topics
            abi.encode(123) // Event data
        );

        // Expect style assertions!
        expect(true).toBeTrue();
        expect(true).toEqual(true);
        expect(123).toBeGreaterThanOrEqual(123);
        expect(123).not.toEqual(321);
        expect("Hello world!").toContain("Hello");

        // Nice external command API!
        Command memory ping = commands.create("ping").args(["-c", "1"]);
        res = ping.arg("etherscan.io").run();
        res = ping.arg("arbiscan.io").run();

        // And much more!
    }
}

Planned Features

  • Huff language support out of the box
  • Mocking framework
  • Deployment management framework

Contributing

At this stage we are looking for all kinds of feedback, as the general direction of the project is not fully defined yet. If you have any ideas to improve naming, ergonomics, or anything else, please open an issue or a PR.

vulcan's People

Contributors

gnkz avatar vdrg avatar jtriley-eth avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.