-
Notifications
You must be signed in to change notification settings - Fork 8
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 #127 from smartcontractkit/develop
Release v0.1.0 (contracts version) take #2
- Loading branch information
Showing
44 changed files
with
24,310 additions
and
664 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
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
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,45 @@ | ||
# Terra on-chain monitor | ||
|
||
## Example of running the monitor locally | ||
|
||
```bash | ||
TERRA_TENDERMINT_URL="<some terra url>" \ | ||
TERRA_FCD_URL="https://fcd.terra.dev/" \ | ||
TERRA_NETWORK_NAME="terra-devnet" \ | ||
TERRA_NETWORK_ID="terra-devnet" \ | ||
TERRA_CHAIN_ID="1" \ | ||
TERRA_READ_TIMEOUT="15s" \ | ||
TERRA_POLL_INTERVAL="5s" \ | ||
TERRA_LINK_TOKEN_ADDRESS="terra1eq0xqc88ceuvw2ztz2a08200he8lrgvnplrcst" \ | ||
KAFKA_BROKERS="localhost:29092" \ | ||
KAFKA_CLIENT_ID=“terra” \ | ||
KAFKA_SECURITY_PROTOCOL="PLAINTEXT" \ | ||
KAFKA_SASL_MECHANISM="PLAIN" \ | ||
KAFKA_SASL_USERNAME="" \ | ||
KAFKA_SASL_PASSWORD="" \ | ||
KAFKA_TRANSMISSION_TOPIC="transmission_topic" \ | ||
KAFKA_CONFIG_SET_SIMPLIFIED_TOPIC="config_set_simplified" \ | ||
SCHEMA_REGISTRY_URL="http://localhost:8989" \ | ||
SCHEMA_REGISTRY_USERNAME="" \ | ||
SCHEMA_REGISTRY_PASSWORD="" \ | ||
HTTP_ADDRESS="localhost:3000" \ | ||
FEEDS_URL="http://localhost:4000/feeds.json" \ | ||
go run ./cmd/monitoring/main.go | ||
``` | ||
|
||
## Example of feed configurations returned by weiwatchers.com | ||
|
||
```json | ||
[ | ||
{ | ||
"name": "UST/USD", | ||
"path": "ust-usd", | ||
"symbol": "$", | ||
"heartbeat": 50, | ||
"contract_type": "", | ||
"status": "live", | ||
"contract_address_bech32": "terra1dre5vgujqex83kc4kw3jr6fc6z8erdsqxlsvhk" , | ||
"multiply": "100000000" | ||
} | ||
] | ||
``` |
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 |
---|---|---|
@@ -1,37 +1,67 @@ | ||
package main | ||
|
||
import ( | ||
// "context" | ||
"context" | ||
|
||
// relayMonitoring "github.com/smartcontractkit/chainlink-relay/pkg/monitoring" | ||
// "github.com/smartcontractkit/chainlink-terra/pkg/monitoring" | ||
relayMonitoring "github.com/smartcontractkit/chainlink-relay/pkg/monitoring" | ||
"github.com/smartcontractkit/chainlink-terra/pkg/monitoring" | ||
pkgClient "github.com/smartcontractkit/chainlink-terra/pkg/terra/client" | ||
"github.com/smartcontractkit/chainlink/core/logger" | ||
) | ||
|
||
func main() { | ||
// ctx := context.Background() | ||
ctx := context.Background() | ||
|
||
log := logger.NewLogger().With("project", "terra") | ||
|
||
// terraConfig, err := monitoring.ParseTerraConfig() | ||
// if err != nil { | ||
// log.Fatalw("failed to parse terra specific configuration", "error", err) | ||
// } | ||
|
||
// terraSourceFactory, err := monitoring.NewTerraSourceFactory(terraConfig, log.With("component", "source")) | ||
// if err != nil { | ||
// log.Fatalw("failed to initialize Terra source", "error", err) | ||
// } | ||
|
||
// relayMonitoring.Entrypoint( | ||
// ctx, | ||
// log, | ||
// terraConfig, | ||
// terraSourceFactory, | ||
// monitoring.TerraFeedParser, | ||
// []relayMonitoring.SourceFactory{}, | ||
// []relayMonitoring.ExporterFactory{}, | ||
// ) | ||
terraConfig, err := monitoring.ParseTerraConfig() | ||
if err != nil { | ||
log.Fatalw("failed to parse terra specific configuration", "error", err) | ||
return | ||
} | ||
|
||
client, err := pkgClient.NewClient( | ||
terraConfig.ChainID, | ||
terraConfig.TendermintURL, | ||
terraConfig.ReadTimeout, | ||
log, | ||
) | ||
if err != nil { | ||
log.Fatalw("failed to create a terra client", "error", err) | ||
return | ||
} | ||
|
||
envelopeSourceFactory := monitoring.NewEnvelopeSourceFactory( | ||
client, | ||
log.With("component", "source-envelope"), | ||
) | ||
txResultsFactory := monitoring.NewTxResultsSourceFactory( | ||
log.With("component", "source-txresults"), | ||
) | ||
|
||
entrypoint, err := relayMonitoring.NewEntrypoint( | ||
ctx, | ||
logWrapper{log}, | ||
terraConfig, | ||
envelopeSourceFactory, | ||
txResultsFactory, | ||
monitoring.TerraFeedParser, | ||
) | ||
if err != nil { | ||
log.Fatalw("failed to build entrypoint", "error", err) | ||
return | ||
} | ||
|
||
entrypoint.Run() | ||
log.Info("monitor stopped") | ||
} | ||
|
||
// adapt core/logger.Logger to monitoring logger. | ||
|
||
type logWrapper struct { | ||
logger.Logger | ||
} | ||
|
||
func (l logWrapper) With(values ...interface{}) relayMonitoring.Logger { | ||
return logWrapper{l.Logger.With(values...)} | ||
} |
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
Oops, something went wrong.