-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add relayer fee settings (#1197)
# Related Github tickets - VolumeFi#1710 # Background > This change adds the concept of individual > relayer fees that may be set by any active > validator for any supported target chain. # Testing completed - [x] test coverage exists or has been added/updated - [x] tested in a private testnet # Breaking changes - [x] I have checked my code for breaking changes - [x] If there are breaking changes, there is a supporting migration.
- Loading branch information
1 parent
d3bc02e
commit 4ff05b3
Showing
30 changed files
with
2,504 additions
and
142 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,25 @@ | ||
syntax = "proto3"; | ||
package palomachain.paloma.treasury; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "cosmos/msg/v1/msg.proto"; | ||
|
||
import "palomachain/paloma/valset/common.proto"; | ||
import "palomachain/paloma/treasury/fees.proto"; | ||
|
||
option go_package = "github.com/palomachain/paloma/x/treasury/types"; | ||
|
||
// Msg defines the Msg service. | ||
service Msg {} | ||
service Msg { | ||
rpc UpsertRelayerFee(MsgUpsertRelayerFee) | ||
returns (Empty); | ||
} | ||
|
||
message MsgUpsertRelayerFee { | ||
option (cosmos.msg.v1.signer) = "metadata"; | ||
|
||
palomachain.paloma.valset.MsgMetadata metadata = 1 | ||
[ (gogoproto.nullable) = false ]; | ||
|
||
RelayerFeeSetting fee_setting = 2; | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,34 +1,54 @@ | ||
package keeper | ||
|
||
import ( | ||
"github.com/cosmos/cosmos-sdk/codec" | ||
"context" | ||
|
||
corestore "cosmossdk.io/core/store" | ||
"cosmossdk.io/store/prefix" | ||
storetypes "cosmossdk.io/store/types" | ||
"github.com/cosmos/cosmos-sdk/runtime" | ||
"github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/gogoproto/proto" | ||
) | ||
|
||
type Byter interface { | ||
Bytes() []byte | ||
} | ||
|
||
func NewKvStoreWrapper[T codec.ProtoMarshaler](s StoreGetterFn, ps ProtoSerializer) *KVStoreWrapper[T] { | ||
return &KVStoreWrapper[T]{ | ||
func NewKvStoreWrapper[T proto.Message](s StoreGetterFn, ps ProtoSerializer) *kvStoreWrapper[T] { | ||
return &kvStoreWrapper[T]{ | ||
sg: s, | ||
ps: ps, | ||
} | ||
} | ||
|
||
type KVStoreWrapper[T codec.ProtoMarshaler] struct { | ||
//go:generate mockery --name=KVStoreWrapper | ||
type KVStoreWrapper[T proto.Message] interface { | ||
Get(ctx types.Context, key Byter) (T, error) | ||
Set(ctx types.Context, key Byter, value T) error | ||
Iterate(ctx types.Context, fn func([]byte, T) bool) error | ||
} | ||
|
||
type kvStoreWrapper[T proto.Message] struct { | ||
sg StoreGetterFn | ||
ps ProtoSerializer | ||
} | ||
|
||
func (v *KVStoreWrapper[T]) Get(ctx types.Context, key Byter) (T, error) { | ||
func (v *kvStoreWrapper[T]) Get(ctx types.Context, key Byter) (T, error) { | ||
return Load[T](v.sg(ctx), v.ps, key.Bytes()) | ||
} | ||
|
||
func (v *KVStoreWrapper[T]) Set(ctx types.Context, key Byter, value T) error { | ||
func (v *kvStoreWrapper[T]) Set(ctx types.Context, key Byter, value T) error { | ||
return Save(v.sg(ctx), v.ps, key.Bytes(), value) | ||
} | ||
|
||
func (v *KVStoreWrapper[T]) Iterate(ctx types.Context, fn func([]byte, T) bool) error { | ||
return IterAllFnc[T](v.sg(ctx), v.ps, fn) | ||
func (v *kvStoreWrapper[T]) Iterate(ctx types.Context, fn func([]byte, T) bool) error { | ||
return IterAllFnc(v.sg(ctx), v.ps, fn) | ||
} | ||
|
||
func StoreFactory(storeKey corestore.KVStoreService, p string) func(ctx context.Context) storetypes.KVStore { | ||
return func(ctx context.Context) storetypes.KVStore { | ||
s := runtime.KVStoreAdapter(storeKey.OpenKVStore(ctx)) | ||
return prefix.NewStore(s, []byte(p)) | ||
} | ||
} |
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.