Skip to content

Simplify generate.sh #35

@ggwpez

Description

@ggwpez

Location: generate.sh

Description:
Use the following snippet to get rid of the awk call and simplify the script.

Snippet from @sebastianst, link:

#!/bin/bash

# SPDX-License-Identifier: Apache-2.0

set -e

# Configuration
solpath="../contracts/contracts"
bindpath="../../bindings" # reverse to solpath
solc="solc-static-linux"

# Download solc.
wget -nc "https://github.com/ethereum/solidity/releases/download/v0.8.3/${solc}"
chmod +x $solc
echo -e "⚠ Ensure that the newest version of abigen is installed"

# Compile in solpath
cd "${solpath}"
"${bindpath}/${solc}" --combined-json abi,bin,bin-runtime \
  --allow-paths '.,../node_modules/@openzeppelin' \
  --optimize --optimize-runs 10000 \
  --overwrite -o "${bindpath}" \
  "@openzeppelin=../node_modules/@openzeppelin" \
  *.sol

# Bind
cd "${bindpath}"
abigen --pkg bindings --out bindings.go --combined-json combined.json \
  --exc Address,Bytes,Context,ECDSA,ERC165,ERC20,ERC721,IERC165,IERC721Enumerable,IERC721Metadata,IERC721Receiver,Ownable,Sig,Strings

echo -e "🎉 Bindings generated"

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementImprovement of an existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions