GithubHelp home page GithubHelp logo

pbshgthm / blacksmith Goto Github PK

View Code? Open in Web Editor NEW
102.0 102.0 4.0 27 KB

Create Blacksmiths to use the Foundry. Blacksmith is a 'User Contract' generator. User contracts can interface with the test contracts in OOP style and simplify complex boilerplate setup.

JavaScript 29.61% Solidity 70.39%

blacksmith's People

Contributors

giovannidisiena avatar pbshgthm avatar stevennevins avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

blacksmith's Issues

Input issues: payable target input param and Contract[] memory or calldata

Noticed these while doing some testing today:

wrapping a proxy contract with a blacksmith where the target input param needs to be payable also doesn't work. Not sure about an elegant way to detect if an address input param needs to be payable or not :/
Screen Shot 2022-03-07 at 12 40 55 PM

Think this one probably goes along with the contract fix added recently
The memory/calldata location doesn't populate for the input param when it's a list of a contract type
Screen Shot 2022-03-07 at 12 38 38 PM

Can make a demo repo / try to create a fix in the script later. Just wanted to raise it up

Couldn't install per docs

Steps to repo:

 ~/dev $ mkdir test
 ~/dev $ cd test
 ~/dev/test $ forge init
Initializing /Users/devtooligan/dev/test...
{...}
Done.
 ~/dev/test  master $ forge build
success.
 ~/dev/test  master $ curl -O https://raw.githubusercontent.com/pbshgthm/blacksmith/main/blacksmith.js
node blacksmith.js create #in foundry project's root directory
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  6917  100  6917    0     0  17788      0 --:--:-- --:--:-- --:--:-- 18060
running :: forge build
build   :: failed
found   :: 1 contracts

node:internal/fs/utils:344
    throw err;
    ^

Error: ENOENT: no such file or directory, open './out/Contract.sol/0.json'
    at Object.openSync (node:fs:585:3)
    at Object.readFileSync (node:fs:453:35)
    at getABI (/Users/devtooligan/dev/test/blacksmith.js:36:26)
    at /Users/devtooligan/dev/test/blacksmith.js:234:21
    at Array.forEach (<anonymous>)
    at createBlacksmiths (/Users/devtooligan/dev/test/blacksmith.js:233:11)
    at /Users/devtooligan/dev/test/blacksmith.js:19:17
    at ChildProcess.exithandler (node:child_process:388:7)
    at ChildProcess.emit (node:events:390:28)
    at maybeClose (node:internal/child_process:1064:16) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: './out/Contract.sol/0.json'
}

fwiw I got the same error on an existing repo as well...

Storage variables of type "contract" cannot be compiled in .bs.sol files

Saving storage variables as imported contracts has blacksmith add type "contract" within the .bs.sol file, which fails to compile.

Minimum Example Contract

pragma solidity 0.8.11;

import './Contract.sol';

contract Setup { 
  Contract public instance;

  constructor() payable {
    instance = new Contract();
  }
}

Command Log

$ node blacksmith.js create
running :: forge build
build   :: completed
found   :: 2 contracts

created :: Contract.bs.sol
created :: Setup.bs.sol
$ forge build
compiling...
Compiling 3 files with 0.8.11
Compilation finished successfully
Error: 
   0: Compiler run failed
      ParserError: Expected type name
        --> /src/test/blacksmith/Setup.bs.sol:24:47:
         |
      24 |     function instance() public prank returns (contract Contract) {
         |                                               ^^^^^^^^

      
   0: 

Location:
   cli/src/cmd/mod.rs:87

Backtrace omitted.
Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

Potential Fix

Remove the "contract" type key word from spawning into new .bs.sol contracts

function instance() public prank returns (**contract** Contract) {
        return Setup(target).instance();
    }

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.