Skip to content

Commit

Permalink
fix: add gravity proposals so they can be decoded (#1213)
Browse files Browse the repository at this point in the history
# Related Github tickets

- Closes #1832

# Background

We already have gov proposals from the gravity module on chain, so we
need to register them in order for them to be decoded.

We need to add them in the `gravity` proto directory, so the proto file
names match the proto package, otherwise we get warnings on the command
line.

The resulting gravity types reside within the `skyway/types` dir.

# 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
maharifu authored Jul 5, 2024
1 parent 592fa85 commit d4a54f7
Show file tree
Hide file tree
Showing 8 changed files with 1,778 additions and 0 deletions.
14 changes: 14 additions & 0 deletions proto/palomachain/paloma/gravity/bridge_tax_proposal.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
syntax = "proto3";
package palomachain.paloma.gravity;

import "cosmos_proto/cosmos.proto";

option go_package = "github.com/palomachain/paloma/x/skyway/types/gravity";

message SetBridgeTaxProposal {
string title = 1;
string description = 2;
string rate = 3 [ (cosmos_proto.scalar) = "cosmos.Dec" ];
repeated string excluded_tokens = 4;
repeated string exempt_addresses = 5;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
syntax = "proto3";
package palomachain.paloma.gravity;

import "gogoproto/gogo.proto";

option go_package = "github.com/palomachain/paloma/x/skyway/types/gravity";

enum LimitPeriod {
NONE = 0;
DAILY = 1;
WEEKLY = 2;
MONTHLY = 3;
YEARLY = 4;
}

message SetBridgeTransferLimitProposal {
string title = 1;
string description = 2;
string token = 3;
string limit = 4 [
(gogoproto.customtype) = "cosmossdk.io/math.Int",
(gogoproto.nullable) = false
];
LimitPeriod limit_period = 5;
repeated string exempt_addresses = 6;
}
14 changes: 14 additions & 0 deletions proto/palomachain/paloma/gravity/erc20_to_denom_proposal.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
syntax = "proto3";
package palomachain.paloma.gravity;

import "cosmos_proto/cosmos.proto";

option go_package = "github.com/palomachain/paloma/x/skyway/types/gravity";

message SetERC20ToDenomProposal {
string title = 1;
string description = 2;
string chain_reference_id = 3;
string erc20 = 4;
string denom = 5;
}
5 changes: 5 additions & 0 deletions x/skyway/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
"github.com/palomachain/paloma/x/skyway/types/gravity"
)

// ModuleCdc is the codec for the module
Expand Down Expand Up @@ -36,6 +37,10 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {

registry.RegisterImplementations(
(*govtypes.Content)(nil),
// Register the legacy gravity proposals
&gravity.SetERC20ToDenomProposal{},
&gravity.SetBridgeTaxProposal{},
&gravity.SetBridgeTransferLimitProposal{},
&SetERC20ToDenomProposal{},
&SetBridgeTaxProposal{},
&SetBridgeTransferLimitProposal{},
Expand Down
Loading

0 comments on commit d4a54f7

Please sign in to comment.