Giter VIP home page Giter VIP logo

Comments (4)

0xKitsune avatar 0xKitsune commented on September 26, 2024 3

Hey, yeah I would be more than happy to integrate this into the Vyperlang org. Thats actually what we did for the Huff language org as well.

Enabling installation with forge install is a great idea, I'm open to anything that makes the repo more accessible/easy to use.

I checked out your fork and the readme looks solid. I would be happy to merge your fork and work together on it. If the Vyperlang org would like it under their account, I am more than happy to port to a version over there or migrate this repo over.

from foundry-vyper.

0xClandestine avatar 0xClandestine commented on September 26, 2024 1

Sort of just leaving notes here, sorry.

Let me know if you like some of the changes: https://github.com/PatrickAlphaC/foundry-vyper

Hey after taking a look I've got a few suggestions, first I think we should change the name of VyperDeployer.sol -> VyperTest.sol and rewrite the file to look something like this:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "forge-std/Test.sol";

abstract contract VyperTest is Test {

    function compileVyper(
        string memory fileLocation
    ) public returns (bytes memory byteCode) {
        string[] memory cmds = new string[](2);
        cmds[0] = "vyper";
        cmds[1] = fileLocation;
        return vm.ffi(cmds);
    }

    function compileVyper(
        string memory fileLocation, 
        bytes memory args
    ) public returns (bytes memory byteCodeWithArgs) {
        string[] memory cmds = new string[](2);
        cmds[0] = "vyper";
        cmds[1] = fileLocation;
        return abi.encodePacked(vm.ffi(cmds), args);
    }

    function deployByteCode(
        bytes memory vyperByteCode
    ) public returns (address contractAddr) {
        assembly {
            contractAddr := create(0, add(vyperByteCode, 0x20), mload(vyperByteCode))
        }
        require(
            contractAddr != address(0) && contractAddr.code.length > 0,
            "Vyper contract deployment failed"
        );
    }

    function deployContract(
        string memory fileLocation
    ) public returns (address contractAddr) {
        return deployByteCode(compileVyper(fileLocation));
    }

    function deployContract(
        string memory fileLocation, 
        bytes memory args
    ) public returns (address contractAddr) {
        return deployByteCode(compileVyper(fileLocation, args));
    }
}

This would let users import and inherit VyperTest.sol that inherits forge-std/Test.sol which would give easy access to both Vyper deployment functionality and the regular test methods/cheats.

from foundry-vyper.

PatrickAlphaC avatar PatrickAlphaC commented on September 26, 2024

And maybe change the name to foundry-vyper

In any case, let me know if you want some help supporting this, happy to help

from foundry-vyper.

PatrickAlphaC avatar PatrickAlphaC commented on September 26, 2024

Sort of just leaving notes here, sorry.

Let me know if you like some of the changes: https://github.com/PatrickAlphaC/foundry-vyper

from foundry-vyper.

Related Issues (5)

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.