Code Monkey home page Code Monkey logo

blacksmith's Introduction

Blacksmith

Blacksmith generates a simple frontend for interacting with smart contracts.

This tool is specifically intended to be used with Foundry.

Installation

Clone the repo.

git clone https://github.com/blacksmith-eth/blacksmith.git

Quick Start

Start the Blacksmith application.

cd blacksmith
pnpm install
pnpm dev

In a second terminal window start a local testnet node.

anvil

In a third terminal window create a foundry project in a separate directory.

forge init example
cd example

From the foundry directory deploy the counter contract to your local testnet node.

forge create src/Counter.sol:Counter --verify --unlocked \
--from 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 \
--rpc-url http://localhost:8545 \
--verifier-url http://localhost:3000/api/verify \
--verifier sourcify

Note: If this command fails see the Foundry Configuration section at the bottom of the README.

Navigate to http://localhost:3000, click the connect wallet button, and choose Blacksmith.

Note: Refresh the page if the wallet modal fails to dismiss.

Select the Counter contract in the contracts sidebar and begin interacting!

Forking Mainnet

Replace the $INFURA_KEY with your personal API key.

anvil --fork-url https://mainnet.infura.io/v3/$INFURA_KEY

Navigate to the Blacksmith "Getting Started" page by clicking the "Blacksmith" heading.

In the "Contract Management" section enter the contract address for Dai 0x6b175474e89094c44da98b954eedeac495271d0f and click the import button.

Select the Dai contract in the contracts sidebar and begin interacting!

Example: Try entering 0xad0135af20fa82e106607257143d0060a7eb5cbf into the balanceOf function.

Note: In order for the contract import to succeed, the contract must be verified on Etherscan.

Advanced Usage

Create a .env.local in the root directory of Blacksmith and include your API key to avoid rate limits.

echo "ETHERSCAN_API_KEY=XXX" >> .env.local

Script Imports

An example of the CLI arguments needed to import contracts via forge script can be found below.

forge script script/Counter.s.sol:CounterScript --broadcast --verify --unlocked \
--sender 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 \
--fork-url http://localhost:8545 \
--verifier-url http://localhost:3000/api/verify \
--verifier sourcify

Hardhat

If you're working with Hardhat check out ๐Ÿ— scaffold-eth!

blacksmith's People

Contributors

clement-mikula avatar endziu avatar leovct avatar sambarnes avatar unholypanda 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  avatar  avatar  avatar  avatar

blacksmith's Issues

Blacksmith does not support interacting with a contract that support a Proxy Upgrade Pattern

Blacksmith does not support interacting with a contract that support a Proxy Upgrade Pattern.

Steps to reproduce the behavior:

Deploy contracts in a similar way that find in here: https://github.com/jordaniza/OZ-Upgradeable-Foundry/blob/main/script/DeployUUPS.s.sol

Expected behavior

As interacting with a Proxy Upgradeable Contract essentially consist of instantiate implementation contract at the address of the proxy... I believe this should be easily support by adding a input to load a interface...

Does blacksmith plan to support such contracts?

see here for more info: https://docs.openzeppelin.com/upgrades-plugins/1.x/proxies

Unable to verify contract using foundry script

Describe the bug
Running the script command in foundry with the added blacksmith variables doesnt seem to verify and imports fail. Not a bug but didnt know if anyway else ran into this issue.

To Reproduce
forge script script/Counter.s.CounterScript
--fork-url http://localhost:8545 --verifier-url http://localhost:3000/api/verify --etherscan-api-key blacksmith --broadcast --verify

Expected behavior
To mimic forge create which does verify/import

Screenshots

System (please complete the following information):

  • Browser [e.g. brave, chrome]
  • firefox
  • Blacksmith Short SHA [e.g. a06328c]
  • Anvil Version [e.g. anvil 0.1.0 (e9f274d 2022-12-11T00:08:46.560086Z)]
  • 0.1.0 (d8f2434 2023-01-20T00:09:44.342972052Z)
  • Forge Version [e.g. forge 0.2.0 (e9f274d 2022-12-11T00:08:13.093857Z)]
  • forge 0.2.0 (d8f2434 2023-01-20T00:09:17.907613959Z)

Additional context
Tried a couple different flags but nothing seems to actually verify/import. Everything else works great!

Contract removal fails to remove the contract

Describe the bug

The contract removal by address feature in the contract management section is failing to remove contracts.

To Reproduce
Steps to reproduce the behavior:

  1. Verify/import a contract (follow the README quick start section)
  2. Enter the address in the contract management input field
  3. Click remove
  4. Notice that the contract is not removed

Expected behavior
The contract should be removed when a valid contract address is provided (including checksummed addresses).

Transaction Presets or History

Describe the bug feature

Don't know if this would be out of scope or not, but your tweet a while back made me think about the difference between the two styles:

image

In general, I like the structured & strongly typed inputs much more. However a solid benefit in Etherscan style is being able to easily store presets in a text file and paste in the whole thing in one go. Something that's a lot more manual in blacksmith rn

I was thinking some sort of presets/bookmarks for recent calls made. Thoughts?

Curious if the "postman-for-contract-dev" is the route you're aiming for with the project? Or if it's more trying to target the scaffold-eth style of being a template/foundation to build your dapp off of? I imagine the functionality could be useful in either, but implementation different depending on usecase.

Error: expected value at line 1 column 1

I am running an Anvil mainnet fork with Blacksmith but the contract verification seems to fail with the error "expected value at line 1 column 1"

On the interface it says "Import failed" .

Do I need to do the verification in order to get the contract into Blacksmith?

Contract "import failed" on BSC/BSC Testnet fork

Abstract
I was trying to use blacksmith to test contracts on BSC/BSC Testnet fork. But when I tried to import contracts on blacksmith's local website it shows "import failed", tested several times, both BSC/BSC Testnet won't work.

What I did

  1. Following the instruction, I cloned blacksmith and run it with yarn dev
  2. Then I forked the BSC mainnet via anvil, using anvil --fork-url https://bsc-dataseed1.binance.org/. The network was forked successfully and wallets are generated. I also saw the "Chain 56" instruction at the blacksmith web (http://localhost:3000/)
  3. I found a random contract on bscscan.com, let's say PancakeSwap MasterChef (0x73feaa1ee314f8c655e354234017be2193c9e24e), when I tried to import it in the via "Contact Management" in blacksmith, it shows "Import Failed".
  4. I tried with ETH network and it works fine. So I guess there's some configuration wrong with networks outside of ETH?

Screenshots
Initial State:
image
image

After I tried to import a contract via blacksmith:
image
image

System (please complete the following information):

  • Browser: Chrome
  • Blacksmith Short SHA: f23b2dd
  • Anvil Version: anvil 0.1.0 (2ff9902 2023-01-11T00:22:04.738793Z)
  • Forge Version: forge 0.2.0 (2ff9902 2023-01-11T00:22:04.500579Z)

Additional context
Please let me know if there is any way to fix it. I am happy to learn and help. Thanks.

Sidebar scroll behavior with certain contracts

Description

Some contracts seem to allow the user to scroll below the application when hovering over the sidebar.

Steps to Reproduce

  1. Import the Seaport contract 0x00000000006c3852cbEf3e08E8dF289169EdE581
  2. Import the Dai contract 0x6b175474e89094c44da98b954eedeac495271d0f
  3. Select the Seaport contract
  4. Hover over the sidebar and scroll down
  5. Select the Dai contract
  6. Hover over the sidebar and attempt to scroll down

Expected Result

Both contracts should not allow the user to scroll below the content of the application.

Actual Result

The user is able to scroll beyond the application content onto a blank screen.

Example

scroll.mov

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.