-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #130 from unicornultrafoundation/test/prepare-inte…
…gration-tests Implement some basic integration tests
- Loading branch information
Showing
15 changed files
with
782 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package launcher | ||
|
||
import ( | ||
"os" | ||
) | ||
|
||
func Run() error { | ||
initApp() | ||
initAppHelp() | ||
return app.Run(os.Args) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package integrationtests | ||
|
||
import ( | ||
"crypto/ecdsa" | ||
|
||
"github.com/unicornultrafoundation/go-u2u/common" | ||
"github.com/unicornultrafoundation/go-u2u/crypto" | ||
) | ||
|
||
type Account struct { | ||
PrivateKey *ecdsa.PrivateKey | ||
} | ||
|
||
func NewAccount() *Account { | ||
key, _ := crypto.GenerateKey() | ||
return &Account{ | ||
PrivateKey: key, | ||
} | ||
} | ||
func (a *Account) Address() common.Address { | ||
return crypto.PubkeyToAddress(a.PrivateKey.PublicKey) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Test Contracts | ||
This directory contains a set of smart contracts used by integration tests. | ||
Contracts are grouped in applications, which may each consist of multiple | ||
contracts. Each application is retained in its own directory. | ||
Within each application directory, the following files should be present: | ||
- *.sol ... the Solidity code for the application | ||
- gen.go ... a go file with a generator rule producing Go bindings for the app | ||
- *.go ... the generated Go binding files (checked in in the code repo) | ||
For an example application, see the `counter` directory. | ||
## Code Generation Tools | ||
For compiling Solidity code and generating the Go bindings the following tools | ||
need to be installed on your system: | ||
- the `solc` compiler; on Ubuntu you an install it using `sudo snap install solc --edge` | ||
- the `abigen` tool; this can be installed using `go install github.com/unicornultrafoundation/go-u2u/cmd/abigen@latest` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.20; | ||
contract Counter { | ||
int private count = 0; | ||
function incrementCounter() public { | ||
count += 1; | ||
} | ||
function getCount() public view returns (int) { | ||
return count; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package counter | ||
|
||
//go:generate solc --bin counter.sol --abi counter.sol -o build --overwrite | ||
//go:generate abigen --bin=build/Counter.bin --abi=build/Counter.abi --pkg=counter --out=counter.go |
Oops, something went wrong.