Skip to content

Commit

Permalink
Formatting layer1 (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
diligentis committed Aug 10, 2022
1 parent 8d2bafc commit 6add787
Show file tree
Hide file tree
Showing 72 changed files with 583 additions and 588 deletions.
6 changes: 3 additions & 3 deletions layer1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ The layer 1 package contains all the logic for interacting with all the layer1 b

The package is mainly composed of 3 services:

* **Monitor**: responsible for monitoring and reacting to layer 1 events.
* **Executor**: responsible for scheduling and executing tasks and actions (e.g snapshots, ethdkg, accusations) against the layer 1 blockchains.
* **Transaction**: responsible for watching for layer 1 transactions done by the AliceNet node and retrieve its receipts.
- **Monitor**: responsible for monitoring and reacting to layer 1 events.
- **Executor**: responsible for scheduling and executing tasks and actions (e.g snapshots, ethdkg, accusations) against the layer 1 blockchains.
- **Transaction**: responsible for watching for layer 1 transactions done by the AliceNet node and retrieve its receipts.

## Creating new Tasks

Expand Down
20 changes: 10 additions & 10 deletions layer1/ethereum/contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@ import (
"syscall"
"time"

"github.com/ethereum/go-ethereum/common"
"github.com/sirupsen/logrus"

"github.com/alicenet/alicenet/bridge/bindings"
"github.com/alicenet/alicenet/layer1"
"github.com/alicenet/alicenet/utils"
"github.com/ethereum/go-ethereum/common"
"github.com/sirupsen/logrus"
)

var _ layer1.EthereumContracts = &Contracts{}

// Contracts contains bindings to smart contract system
// Contracts contains bindings to smart contract system.
type Contracts struct {
allAddresses map[common.Address]bool
eth *Client
Expand All @@ -42,9 +43,9 @@ type Contracts struct {
governanceAddress common.Address
}

/// Set the contractFactoryAddress and looks up for all the contracts that we
/// need that were deployed via the factory. It's only executed once. Other call
/// to this functions are no-op.
// Set the contractFactoryAddress and looks up for all the contracts that we
// need that were deployed via the factory. It's only executed once. Other call
// to this functions are no-op.
func NewContracts(eth *Client, contractFactoryAddress common.Address) *Contracts {
newContracts := &Contracts{
allAddresses: make(map[common.Address]bool),
Expand All @@ -58,9 +59,8 @@ func NewContracts(eth *Client, contractFactoryAddress common.Address) *Contracts
return newContracts
}

// LookupContracts uses the registry to lookup and create bindings for all required contracts
// LookupContracts uses the registry to lookup and create bindings for all required contracts.
func (c *Contracts) lookupContracts() error {

networkCtx, cf := context.WithCancel(context.Background())
defer cf()
signals := make(chan os.Signal, 1)
Expand Down Expand Up @@ -189,7 +189,7 @@ func (c *Contracts) lookupContracts() error {
return nil
}

// return all addresses from all contracts in the contract struct
// return all addresses from all contracts in the contract struct.
func (c *Contracts) GetAllAddresses() []common.Address {
var allAddresses []common.Address
for addr := range c.allAddresses {
Expand Down Expand Up @@ -270,7 +270,7 @@ func (c *Contracts) GovernanceAddress() common.Address {
return c.governanceAddress
}

// utils function to log an error
// utils function to log an error.
func logAndEat(logger *logrus.Logger, err error) {
if err != nil {
logger.Error(err)
Expand Down
Loading

0 comments on commit 6add787

Please sign in to comment.