Skip to content

Commit

Permalink
update slinky => connect/v2 (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 authored Sep 25, 2024
1 parent 91978d4 commit a0c1dbd
Show file tree
Hide file tree
Showing 24 changed files with 1,183 additions and 314 deletions.
10 changes: 5 additions & 5 deletions app/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ import (
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
ibctypes "github.com/cosmos/ibc-go/v8/modules/core/types"

l2slinky "github.com/initia-labs/OPinit/x/opchild/l2slinky"
l2connect "github.com/initia-labs/OPinit/x/opchild/l2connect"
opchildtypes "github.com/initia-labs/OPinit/x/opchild/types"
"github.com/initia-labs/initia/app/genesis_markets"

auctiontypes "github.com/skip-mev/block-sdk/v2/x/auction/types"
slinkytypes "github.com/skip-mev/slinky/pkg/types"
marketmaptypes "github.com/skip-mev/slinky/x/marketmap/types"
oracletypes "github.com/skip-mev/slinky/x/oracle/types"
connecttypes "github.com/skip-mev/connect/v2/pkg/types"
marketmaptypes "github.com/skip-mev/connect/v2/x/marketmap/types"
oracletypes "github.com/skip-mev/connect/v2/x/oracle/types"
)

// GenesisState - The genesis state of the blockchain is represented here as a map of raw json
Expand Down Expand Up @@ -75,7 +75,7 @@ func (genState GenesisState) AddMarketData(cdc codec.JSONCodec, ac address.Codec

// Initialize all markets plus ReservedCPTimestamp
currencyPairGenesis := make([]oracletypes.CurrencyPairGenesis, len(markets)+1)
cp, err := slinkytypes.CurrencyPairFromString(l2slinky.ReservedCPTimestamp)
cp, err := connecttypes.CurrencyPairFromString(l2connect.ReservedCPTimestamp)
if err != nil {
panic(err)
}
Expand Down
18 changes: 9 additions & 9 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ import (

auctionkeeper "github.com/skip-mev/block-sdk/v2/x/auction/keeper"
auctiontypes "github.com/skip-mev/block-sdk/v2/x/auction/types"
marketmapkeeper "github.com/skip-mev/slinky/x/marketmap/keeper"
marketmaptypes "github.com/skip-mev/slinky/x/marketmap/types"
oraclekeeper "github.com/skip-mev/slinky/x/oracle/keeper"
oracletypes "github.com/skip-mev/slinky/x/oracle/types"
marketmapkeeper "github.com/skip-mev/connect/v2/x/marketmap/keeper"
marketmaptypes "github.com/skip-mev/connect/v2/x/marketmap/types"
oraclekeeper "github.com/skip-mev/connect/v2/x/oracle/keeper"
oracletypes "github.com/skip-mev/connect/v2/x/oracle/types"

// CosmWasm imports
"github.com/CosmWasm/wasmd/x/wasm"
Expand Down Expand Up @@ -128,7 +128,7 @@ type AppKeepers struct {
OPChildKeeper *opchildkeeper.Keeper
AuctionKeeper *auctionkeeper.Keeper // x/auction keeper used to process bids for POB auctions
PacketForwardKeeper *packetforwardkeeper.Keeper
OracleKeeper *oraclekeeper.Keeper // x/oracle keeper used for the slinky oracle
OracleKeeper *oraclekeeper.Keeper // x/oracle keeper used for the connect oracle
MarketMapKeeper *marketmapkeeper.Keeper
TokenFactoryKeeper *tokenfactorykeeper.Keeper
IBCHooksKeeper *ibchookskeeper.Keeper
Expand Down Expand Up @@ -549,11 +549,11 @@ func NewAppKeeper(
//////////////////////////////
wasmDir := filepath.Join(homePath, "wasm")

// allow slinky queries
// allow connect queries
queryAllowlist := make(map[string]proto.Message)
queryAllowlist["/slinky.oracle.v1.Query/GetAllCurrencyPairs"] = &oracletypes.GetAllCurrencyPairsResponse{}
queryAllowlist["/slinky.oracle.v1.Query/GetPrice"] = &oracletypes.GetPriceResponse{}
queryAllowlist["/slinky.oracle.v1.Query/GetPrices"] = &oracletypes.GetPricesResponse{}
queryAllowlist["/connect.oracle.v2.Query/GetAllCurrencyPairs"] = &oracletypes.GetAllCurrencyPairsResponse{}
queryAllowlist["/connect.oracle.v2.Query/GetPrice"] = &oracletypes.GetPriceResponse{}
queryAllowlist["/connect.oracle.v2.Query/GetPrices"] = &oracletypes.GetPricesResponse{}

// use accept list stargate querier
wasmOpts = append(wasmOpts, wasmkeeper.WithQueryPlugins(&wasmkeeper.QueryPlugins{
Expand Down
4 changes: 2 additions & 2 deletions app/keepers/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import (

// skip imports
auctiontypes "github.com/skip-mev/block-sdk/v2/x/auction/types"
marketmaptypes "github.com/skip-mev/slinky/x/marketmap/types"
oracletypes "github.com/skip-mev/slinky/x/oracle/types"
marketmaptypes "github.com/skip-mev/connect/v2/x/marketmap/types"
oracletypes "github.com/skip-mev/connect/v2/x/oracle/types"

// CosmWasm imports
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
Expand Down
12 changes: 6 additions & 6 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ import (
// skip imports
"github.com/skip-mev/block-sdk/v2/x/auction"
auctiontypes "github.com/skip-mev/block-sdk/v2/x/auction/types"
marketmap "github.com/skip-mev/slinky/x/marketmap"
marketmaptypes "github.com/skip-mev/slinky/x/marketmap/types"
"github.com/skip-mev/slinky/x/oracle"
oracletypes "github.com/skip-mev/slinky/x/oracle/types"
marketmap "github.com/skip-mev/connect/v2/x/marketmap"
marketmaptypes "github.com/skip-mev/connect/v2/x/marketmap/types"
"github.com/skip-mev/connect/v2/x/oracle"
oracletypes "github.com/skip-mev/connect/v2/x/oracle/types"

// CosmWasm imports
"github.com/CosmWasm/wasmd/x/wasm"
Expand Down Expand Up @@ -81,7 +81,7 @@ var maccPerms = map[string][]string{
opchildtypes.ModuleName: {authtypes.Minter, authtypes.Burner},
tokenfactorytypes.ModuleName: {authtypes.Minter, authtypes.Burner},

// slinky oracle permissions
// connect oracle permissions
oracletypes.ModuleName: nil,

// this is only for testing
Expand Down Expand Up @@ -117,7 +117,7 @@ func appModules(
packetforward.NewAppModule(app.PacketForwardKeeper, nil),
ibchooks.NewAppModule(app.appCodec, *app.IBCHooksKeeper),
forwarding.NewAppModule(app.ForwardingKeeper),
// slinky modules
// connect modules
oracle.NewAppModule(app.appCodec, *app.OracleKeeper),
marketmap.NewAppModule(app.appCodec, app.MarketMapKeeper),
}
Expand Down
12 changes: 6 additions & 6 deletions app/wasmtesting/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ import (
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"

"github.com/skip-mev/slinky/x/oracle"
oraclekeeper "github.com/skip-mev/slinky/x/oracle/keeper"
oracletypes "github.com/skip-mev/slinky/x/oracle/types"
"github.com/skip-mev/connect/v2/x/oracle"
oraclekeeper "github.com/skip-mev/connect/v2/x/oracle/keeper"
oracletypes "github.com/skip-mev/connect/v2/x/oracle/types"
)

var ModuleBasics = module.NewBasicManager(
Expand Down Expand Up @@ -278,9 +278,9 @@ func _createTestInput(
queryRouter.SetInterfaceRegistry(encodingConfig.InterfaceRegistry)

queryAllowlist := make(map[string]proto.Message)
queryAllowlist["/slinky.oracle.v1.Query/GetAllCurrencyPairs"] = &oracletypes.GetAllCurrencyPairsResponse{}
queryAllowlist["/slinky.oracle.v1.Query/GetPrice"] = &oracletypes.GetPriceResponse{}
queryAllowlist["/slinky.oracle.v1.Query/GetPrices"] = &oracletypes.GetPricesResponse{}
queryAllowlist["/connect.oracle.v2.Query/GetAllCurrencyPairs"] = &oracletypes.GetAllCurrencyPairsResponse{}
queryAllowlist["/connect.oracle.v2.Query/GetPrice"] = &oracletypes.GetPriceResponse{}
queryAllowlist["/connect.oracle.v2.Query/GetPrices"] = &oracletypes.GetPricesResponse{}

// use accept list stargate querier
wasmOpts := []wasmkeeper.Option{}
Expand Down
28 changes: 14 additions & 14 deletions app/wasmtesting/contracts/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/wasmtesting/contracts/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "slinky"
name = "connect"
version = "0.0.1"
authors = ["alapc"]
edition = "2021"
Expand Down
Binary file added app/wasmtesting/contracts/artifacts/connect.wasm
Binary file not shown.
Binary file removed app/wasmtesting/contracts/artifacts/slinky.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion app/wasmtesting/contracts/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fn main() {
// All inputs and imports from the inputs must reside in `includes` directories.
.includes(&["src/protos"])
// Inputs must reside in some of include paths.
.input("src/protos/slinky.proto")
.input("src/protos/connect.proto")
// Specify output directory relative to Cargo output directory.
.out_dir("src/")
.customize_callback(GenSerde)
Expand Down
2 changes: 1 addition & 1 deletion app/wasmtesting/contracts/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// @generated

pub mod slinky;
pub mod connect;
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#![allow(unused_results)]
#![allow(unused_mut)]

//! Generated file from `slinky.proto`
//! Generated file from `connect.proto`
/// Generated files are compatible only with the same version
/// of protobuf runtime.
Expand Down Expand Up @@ -398,11 +398,11 @@ impl ::protobuf::reflect::ProtobufValue for CurrencyPair {
}

static file_descriptor_proto_data: &'static [u8] = b"\
\n\x0cslinky.proto\"\x1c\n\x1aGetAllCurrencyPairsRequest\"S\n\x1bGetAllC\
urrencyPairsResponse\x124\n\x0ecurrency_pairs\x18\x01\x20\x03(\x0b2\r.Cu\
rrencyPairR\rcurrencyPairs\"8\n\x0cCurrencyPair\x12\x12\n\x04Base\x18\
\x01\x20\x01(\tR\x04Base\x12\x14\n\x05Quote\x18\x02\x20\x01(\tR\x05Quote\
b\x06proto3\
\n\rconnect.proto\"\x1c\n\x1aGetAllCurrencyPairsRequest\"S\n\x1bGetAllCu\
rrencyPairsResponse\x124\n\x0ecurrency_pairs\x18\x01\x20\x03(\x0b2\r.Cur\
rencyPairR\rcurrencyPairs\"8\n\x0cCurrencyPair\x12\x12\n\x04Base\x18\x01\
\x20\x01(\tR\x04Base\x12\x14\n\x05Quote\x18\x02\x20\x01(\tR\x05Quoteb\
\x06proto3\
";

/// `FileDescriptorProto` object which was a source for this generated file
Expand Down
2 changes: 1 addition & 1 deletion app/wasmtesting/contracts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ mod execute;
mod state;
mod msgs;
mod query;
mod slinky;
mod connect;

use crate::msgs::{InstantiateMsg, ExecuteMsg,
// QueryMsg, MigrateMsg
Expand Down
2 changes: 1 addition & 1 deletion app/wasmtesting/contracts/src/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// @generated

pub mod slinky;
pub mod connect;
4 changes: 2 additions & 2 deletions app/wasmtesting/contracts/src/query.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use cosmwasm_std::{to_json_binary, Binary, Deps, Empty, Env, QueryRequest, StdResult};

use crate::msgs::QueryMsg;
use crate::slinky::{GetAllCurrencyPairsRequest, GetAllCurrencyPairsResponse};
use crate::connect::{GetAllCurrencyPairsRequest, GetAllCurrencyPairsResponse};
use crate::state::Contract;
use protobuf::Message;

Expand All @@ -18,7 +18,7 @@ impl<'a> Contract {

let data = Binary::from(bytes);
let request = QueryRequest::<Empty>::Stargate {
path: "/slinky.oracle.v1.Query/GetAllCurrencyPairs".to_string(),
path: "/connect.oracle.v2.Query/GetAllCurrencyPairs".to_string(),
data,
};
let response: GetAllCurrencyPairsResponse = deps.querier.query(&request)?;
Expand Down
8 changes: 4 additions & 4 deletions app/wasmtesting/stargate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import (

"github.com/stretchr/testify/require"

slinkytypes "github.com/skip-mev/slinky/pkg/types"
connecttypes "github.com/skip-mev/connect/v2/pkg/types"
)

func Test_StargateQuery(t *testing.T) {
ctx, input := createDefaultTestInput(t)
_, _, addr := keyPubAddr()

code, err := os.ReadFile("./contracts/artifacts/slinky.wasm")
code, err := os.ReadFile("./contracts/artifacts/connect.wasm")
require.NoError(t, err)

wasmMsgServer := wasmkeeper.NewMsgServerImpl(&input.WasmKeeper)
Expand All @@ -32,7 +32,7 @@ func Test_StargateQuery(t *testing.T) {
Sender: addr.String(),
Admin: addr.String(),
CodeID: storeRes.CodeID,
Label: "Slinky",
Label: "connect",
Msg: []byte("{}"),
Funds: nil,
})
Expand All @@ -42,7 +42,7 @@ func Test_StargateQuery(t *testing.T) {
contractAddr, err := sdk.AccAddressFromBech32(contractAddrBech32)
require.NoError(t, err)

err = input.OracleKeeper.CreateCurrencyPair(ctx, slinkytypes.CurrencyPair{
err = input.OracleKeeper.CreateCurrencyPair(ctx, connecttypes.CurrencyPair{
Base: "BITCOIN",
Quote: "USD",
})
Expand Down
4 changes: 2 additions & 2 deletions client/docs/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,10 @@
"url": "./tmp-swagger-gen/indexer/pair/v1/query.swagger.json"
},
{
"url": "./tmp-swagger-gen/slinky/oracle/v1/query.swagger.json"
"url": "./tmp-swagger-gen/connect/oracle/v2/query.swagger.json"
},
{
"url": "./tmp-swagger-gen/slinky/marketmap/v1/query.swagger.json",
"url": "./tmp-swagger-gen/connect/marketmap/v2/query.swagger.json",
"operationIds": {
"rename": {
"Params": "MarketMapParams"
Expand Down
2 changes: 1 addition & 1 deletion client/docs/statik/statik.go

Large diffs are not rendered by default.

Loading

0 comments on commit a0c1dbd

Please sign in to comment.