Skip to content

Commit

Permalink
Revise generate script and upgrade abigen (hyperledger-labs#3)
Browse files Browse the repository at this point in the history
* bindings: Update generate.sh

Signed-off-by: Philipp-Florens Lehwalder <[email protected]>

* Update bindings with abigen v1.10.15

Signed-off-by: Philipp-Florens Lehwalder <[email protected]>

* PR Feedback: Fix import comment in generate.sh

Signed-off-by: Philipp-Florens Lehwalder <[email protected]>

* PR Feedback: Remove double quoting for variables in generate.sh

Signed-off-by: Philipp-Florens Lehwalder <[email protected]>

* CI: Generate bindings

Signed-off-by: Philipp-Florens Lehwalder <[email protected]>

* PR Feedback: Add .gitignore

Signed-off-by: Philipp-Florens Lehwalder <[email protected]>

* Move contracts -> bindings

Signed-off-by: Philipp-Florens Lehwalder <[email protected]>

* Use Docker for solc

Signed-off-by: Philipp-Florens Lehwalder <[email protected]>

* CI: Don't use alias for solc

Signed-off-by: Philipp-Florens Lehwalder <[email protected]>

* CI: Use docker for generate.sh

Signed-off-by: Matthias Geihs <[email protected]>

* Update bindings: Generated using Docker as in CI

Signed-off-by: Matthias Geihs <[email protected]>

* CI: Fix permissions of bindings

Signed-off-by: Philipp-Florens Lehwalder <[email protected]>

* Fixup: End with newline

Signed-off-by: Matthias Geihs <[email protected]>

* Update README

Signed-off-by: Matthias Geihs <[email protected]>

Co-authored-by: Matthias Geihs <[email protected]>
  • Loading branch information
cryptphil and matthiasgeihs authored Jun 17, 2022
1 parent bfeb73d commit 8fe1146
Show file tree
Hide file tree
Showing 30 changed files with 972 additions and 9,245 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,33 @@ jobs:
with:
version: v1.43

bindings:
name: Generate bindings
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: 'recursive'

- name: Set up Golang
uses: actions/setup-go@v2
with:
go-version: ${{ env.go-version }}

- name: Generate bindings
working-directory: ${{ env.repo_dir }}
run: |
cd bindings
WD=/root
export SOLC="docker run --rm -v $(pwd):$WD -w $WD ethereum/solc:0.7.6-alpine"
export ABIGEN="docker run --rm -v $(pwd):$WD -w $WD --entrypoint abigen ethereum/client-go:alltools-v1.10.18"
./generate.sh
sudo find -type f -name "*.go" -exec chmod a+r {} \;
- name: Test
run: go test -timeout 60s ./...

test:
name: Test
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/bindings/*/*.abi
/bindings/*/*.bin
/bindings/*/*.bin-runtime
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "contracts"]
path = contracts
[submodule "bindings/contracts"]
path = bindings/contracts
url = https://github.com/hyperledger-labs/perun-eth-contracts
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

<p>
<a href="https://www.apache.org/licenses/LICENSE-2.0.txt"><img src="https://img.shields.io/badge/license-Apache%202-blue" alt="License: Apache 2.0"></a>
<a href="https://github.com/perun-network/perun-eth-backend/actions/workflows/ci.yml"><img src="https://github.com/perun-network/perun-eth-backend/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI status"></a>
<a href="https://github.com/hyperledger-labs/perun-eth-backend/actions/workflows/ci.yml"><img src="https://github.com/hyperledger-labs/perun-eth-backend/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI status"></a>
<a href="https://pkg.go.dev/github.com/perun-network/perun-eth-backend"><img src="https://pkg.go.dev/badge/github.com/perun-network/perun-eth-backend.svg" alt="Go Reference"></a>
</p>

This repository provides an [Ethereum] blockchain module for the [go-perun] state channel library.
Expand All @@ -12,7 +13,6 @@ It thereby enables Perun channels for EVM-compatible networks.
* `bindings/`: Contract bindings.
* `channel/`: Channel interface implementations.
* `client/`: Client tests.
* `contracts/`: Smart contracts, imported from [perun-eth-contracts].
* `wallet/`: Wallet interface implementations.

## Development
Expand Down
22 changes: 11 additions & 11 deletions bindings/abi.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ import (
// ABI contains all the parsed ABI definitions of our contracts.
// Use it together with `bind.NewBoundContract` to create a bound contract.
var ABI = struct {
// ERC20Token is the parsed ABI definition of contract ERC20Token.
ERC20Token abi.ABI
// PerunToken is the parsed ABI definition of contract PerunToken.
PerunToken abi.ABI
// Adjudicator is the parsed ABI definition of contract Adjudicator.
Adjudicator abi.ABI
// AssetHolder is the parsed ABI definition of contract AssetHolder.
Expand All @@ -53,8 +53,8 @@ var Events = struct {
AhDeposited string
// AhWithdrawn is the Withdrawn event of the Assetholder contract.
AhWithdrawn string
// ERC20Approval is the Approval event of the ERC20Token contract.
ERC20Approval string
// PerunTokenApproval is the Approval event of the PerunToken contract.
PerunTokenApproval string
}{}

func init() {
Expand All @@ -71,12 +71,12 @@ func parseABIs() {
return abi
}

ABI.ERC20Token = parse(peruntoken.ERC20ABI)
ABI.Adjudicator = parse(adjudicator.AdjudicatorABI)
ABI.AssetHolder = parse(assetholder.AssetHolderABI)
ABI.ETHAssetHolder = parse(assetholdereth.AssetHolderETHABI)
ABI.ERC20AssetHolder = parse(assetholdererc20.AssetHolderERC20ABI)
ABI.TrivialApp = parse(trivialapp.TrivialAppABI)
ABI.PerunToken = parse(peruntoken.PeruntokenMetaData.ABI)
ABI.Adjudicator = parse(adjudicator.AdjudicatorMetaData.ABI)
ABI.AssetHolder = parse(assetholder.AssetholderMetaData.ABI)
ABI.ETHAssetHolder = parse(assetholdereth.AssetholderethMetaData.ABI)
ABI.ERC20AssetHolder = parse(assetholdererc20.Assetholdererc20MetaData.ABI)
ABI.TrivialApp = parse(trivialapp.TrivialappMetaData.ABI)
}

// extractEvents sets the event names and panics if any event does not exist.
Expand All @@ -92,5 +92,5 @@ func extractEvents() {
Events.AdjChannelUpdate = extract(ABI.Adjudicator, "ChannelUpdate")
Events.AhDeposited = extract(ABI.AssetHolder, "Deposited")
Events.AhWithdrawn = extract(ABI.AssetHolder, "Withdrawn")
Events.ERC20Approval = extract(ABI.ERC20Token, "Approval")
Events.PerunTokenApproval = extract(ABI.PerunToken, "Approval")
}
1,952 changes: 26 additions & 1,926 deletions bindings/adjudicator/Adjudicator.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bindings/adjudicator/AdjudicatorBinRuntime.go

Large diffs are not rendered by default.

Loading

0 comments on commit 8fe1146

Please sign in to comment.