From 9bf725c1e6ab40ffc5bb144e190b87498163e651 Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Fri, 9 Aug 2024 14:54:37 -0700 Subject: [PATCH 1/6] adds docs for app config --- docs/developers/integration.mdx | 71 ++++++++++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 2 deletions(-) diff --git a/docs/developers/integration.mdx b/docs/developers/integration.mdx index f8f79de7c..bed6f12cf 100644 --- a/docs/developers/integration.mdx +++ b/docs/developers/integration.mdx @@ -20,8 +20,11 @@ This document will guide you through integrating Connect in your application. Integrating Connect into your Cosmos SDK application requires a few simple steps. + + Add the oracle configuration to your application. + - Add the `x/marketmap` and `x/oracle` Modules to your app. + Import and add the `x/marketmap` and `x/oracle` Modules to your app. Set up the Oracle client the application will use to get prices from the Connect oracle. @@ -34,9 +37,73 @@ Integrating Connect into your Cosmos SDK application requires a few simple steps +## Application Configuration + +We need to extend the template for the application node's `app.toml`, so the oracle configuration can be read into the node. + +Your application should contain a custom configuration struct with a `"github.com/cosmos/cosmos-sdk/server/config"` embedded. + +```go config.go +// CustomAppConfig defines the configuration for the app. +type CustomAppConfig struct { + serverconfig.Config + // ... other configurations + Oracle oracleconfig.AppConfig `mapstructure:"oracle" json:"oracle"` +} +``` + +Next, append the Oracle's default config template to your custom application template. + +```go config.go +func CustomConfigTemplate() string { + return serverconfig.DefaultConfigTemplate + oracleconfig.DefaultConfigTemplate +} +``` + +Finally, add a default configuration. + +```go config.go +func DefaultConfig() (string, CustomAppConfig) { + serverConfig := serverconfig.DefaultConfig() + // edit serverConfig as needed + + oracleCfg := oracleconfig.AppConfig{ + Enabled: false, + OracleAddress: "localhost:8080", + ClientTimeout: time.Second * 2, + MetricsEnabled: false, + } + customConfig := CustomAppConfig{ + Config: *serverConfig, + Oracle: oracleCfg, + } + + return CustomConfigTemplate(), customConfig +} +``` + +The template and default configuration should be passed into `server.InterceptConfigsPreRunHandler` in the application's root command. + +Example: + +```go root.go +package cmd + +import ( + // ... + "github.com/cosmos/cosmos-sdk/server" +) +func NewRootCmd() *cobra.Command { + // .... + + customAppTemplate, customAppConfig := DefaultConfig() // call function from previous step + return server.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, cometConfig) +} +``` + ## Keepers -First, add the [x/marketmap](https://github.com/skip-mev/slinky/blob/main/x/marketmap/README.md) and [x/oracle](https://github.com/skip-mev/slinky/tree/main/x/oracle) keepers to the application. +Add [x/marketmap](https://github.com/skip-mev/slinky/blob/main/x/marketmap/README.md) and [x/oracle](https://github.com/skip-mev/slinky/tree/main/x/oracle) keepers to the application. ```go app.go package app From 3bfe6e91be08f6e2aa440f0427ced349c7f8851f Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Fri, 9 Aug 2024 14:56:36 -0700 Subject: [PATCH 2/6] reword format --- docs/developers/integration.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/developers/integration.mdx b/docs/developers/integration.mdx index bed6f12cf..f80309d5a 100644 --- a/docs/developers/integration.mdx +++ b/docs/developers/integration.mdx @@ -39,7 +39,7 @@ Integrating Connect into your Cosmos SDK application requires a few simple steps ## Application Configuration -We need to extend the template for the application node's `app.toml`, so the oracle configuration can be read into the node. +We need to extend the configuration for the application node, so the oracle configuration can be read into the node through `app.toml`. Your application should contain a custom configuration struct with a `"github.com/cosmos/cosmos-sdk/server/config"` embedded. @@ -96,7 +96,7 @@ import ( func NewRootCmd() *cobra.Command { // .... - customAppTemplate, customAppConfig := DefaultConfig() // call function from previous step + customAppTemplate, customAppConfig := DefaultConfig() // call function from previous step return server.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, cometConfig) } ``` From 5f55b16e544c79fc2699850c6e9b4bad87fa7669 Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Fri, 9 Aug 2024 14:59:16 -0700 Subject: [PATCH 3/6] reword --- docs/developers/integration.mdx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/developers/integration.mdx b/docs/developers/integration.mdx index f80309d5a..b538fb374 100644 --- a/docs/developers/integration.mdx +++ b/docs/developers/integration.mdx @@ -39,9 +39,11 @@ Integrating Connect into your Cosmos SDK application requires a few simple steps ## Application Configuration -We need to extend the configuration for the application node, so the oracle configuration can be read into the node through `app.toml`. +The application node's configuration must be extended, so the oracle configuration can be read into the node through `app.toml`. -Your application should contain a custom configuration struct with a `"github.com/cosmos/cosmos-sdk/server/config"` embedded. +The application should contain a custom configuration struct with a `"github.com/cosmos/cosmos-sdk/server/config"` embedded. + +Note: application function and type names may vary. The names in the following steps are arbitrary for example purposes only. ```go config.go // CustomAppConfig defines the configuration for the app. @@ -52,7 +54,7 @@ type CustomAppConfig struct { } ``` -Next, append the Oracle's default config template to your custom application template. +Next, append the Oracle's default config template to the custom application template. ```go config.go func CustomConfigTemplate() string { From f4a6dcd8ff9297508bf966b9a25495be9e639142 Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Fri, 9 Aug 2024 17:20:51 -0700 Subject: [PATCH 4/6] add polymarket_api to provider.mdx --- docs/developers/providers.mdx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/developers/providers.mdx b/docs/developers/providers.mdx index ca5b5ad17..9e73f9890 100644 --- a/docs/developers/providers.mdx +++ b/docs/developers/providers.mdx @@ -13,6 +13,7 @@ Connect pulls data from `Providers`. `Providers` utilize public REST APIs, RPCs, - bitstamp_api - coinbase_api - kraken_api +- polymarket_api ### Websocket @@ -36,4 +37,4 @@ Connect pulls data from `Providers`. `Providers` utilize public REST APIs, RPCs, - uniswapv3_api-ethereum - uniswapv3_api-base -- raydium_api \ No newline at end of file +- raydium_api From e042ab1c5d08bc6dbab13ee116dc513db28f4ad3 Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Mon, 12 Aug 2024 09:50:49 -0700 Subject: [PATCH 5/6] switch to true --- docs/developers/integration.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/developers/integration.mdx b/docs/developers/integration.mdx index b538fb374..b47c10d04 100644 --- a/docs/developers/integration.mdx +++ b/docs/developers/integration.mdx @@ -70,10 +70,10 @@ func DefaultConfig() (string, CustomAppConfig) { // edit serverConfig as needed oracleCfg := oracleconfig.AppConfig{ - Enabled: false, + Enabled: true, OracleAddress: "localhost:8080", ClientTimeout: time.Second * 2, - MetricsEnabled: false, + MetricsEnabled: true, } customConfig := CustomAppConfig{ Config: *serverConfig, From 2090445b077be60146e1e223c97ca922418615f1 Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Thu, 15 Aug 2024 10:43:38 -0700 Subject: [PATCH 6/6] Update docs/developers/integration.mdx Co-authored-by: Alex Johnson --- docs/developers/integration.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/developers/integration.mdx b/docs/developers/integration.mdx index b47c10d04..64c35a8ef 100644 --- a/docs/developers/integration.mdx +++ b/docs/developers/integration.mdx @@ -39,7 +39,7 @@ Integrating Connect into your Cosmos SDK application requires a few simple steps ## Application Configuration -The application node's configuration must be extended, so the oracle configuration can be read into the node through `app.toml`. +The application node's configuration must be extended so the oracle configuration can be read into the node through `app.toml`. The application should contain a custom configuration struct with a `"github.com/cosmos/cosmos-sdk/server/config"` embedded.