Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 95 additions & 21 deletions api/layer/bridge/module/module.pulsar.go

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

4 changes: 3 additions & 1 deletion proto/layer/bridge/module/module.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ syntax = "proto3";
package layer.bridge.module;

import "cosmos/app/v1alpha1/module.proto";
import "cosmos_proto/cosmos.proto";

// Module is the config object for the module.
message Module {
option (cosmos.app.v1alpha1.module) = {go_import: "github.com/tellor-io/layer/x/bridge"};

// authority defines the custom module authority. If not set, defaults to the governance module.
string authority = 1;
}
8 changes: 7 additions & 1 deletion x/bridge/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import (
"github.com/cosmos/cosmos-sdk/telemetry"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
)

var (
Expand Down Expand Up @@ -202,6 +204,10 @@ type BridgeOutputs struct {
}

func ProvideModule(in BridgeInputs) BridgeOutputs {
authority := authtypes.NewModuleAddress(govtypes.ModuleName)
if in.Config.Authority != "" {
authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority)
}
k := keeper.NewKeeper(
in.Cdc,
in.StoreService,
Expand All @@ -210,7 +216,7 @@ func ProvideModule(in BridgeInputs) BridgeOutputs {
in.BankKeeper,
in.ReporterKeeper,
in.DisputeKeeper,
"gov",
authority.String(),
)
m := NewAppModule(
in.Cdc,
Expand Down
6 changes: 4 additions & 2 deletions x/bridge/module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import (
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/runtime"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
)

Expand Down Expand Up @@ -55,7 +57,7 @@ func SetupBridgeApp(t *testing.T) (AppModule, keeper.Keeper, sdk.Context, *mocks
bk,
rk,
dk,
"gov",
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

app := NewAppModule(
Expand Down Expand Up @@ -102,7 +104,7 @@ func SetupBridgeAppBenchmark(b *testing.B) (AppModule, keeper.Keeper, sdk.Contex
bk,
rk,
dk,
"gov",
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

app := NewAppModule(
Expand Down
Loading