-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement legacy msg interface for liquid vesting (#297)
* implement legacy msg interface * change msg namespace * chore: bump app version, add upgrade handler --------- Co-authored-by: Petr Ivanov <[email protected]> Co-authored-by: Yuri Surbashev <[email protected]>
- Loading branch information
1 parent
8372d3d
commit a4acbbe
Showing
6 changed files
with
74 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package v173 | ||
|
||
const ( | ||
// UpgradeName is the shared upgrade plan name for mainnet and testnet | ||
UpgradeName = "v1.7.3" | ||
) |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package v173 | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/types/module" | ||
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" | ||
) | ||
|
||
// CreateUpgradeHandler creates an SDK upgrade handler for v1.7.3 | ||
func CreateUpgradeHandler( | ||
mm *module.Manager, | ||
configurator module.Configurator, | ||
) upgradetypes.UpgradeHandler { | ||
return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { | ||
logger := ctx.Logger() | ||
logger.Info("run migration v1.7.3") | ||
|
||
return mm.RunMigrations(ctx, configurator, vm) | ||
} | ||
} |
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,15 +1,45 @@ | ||
package types | ||
|
||
import ( | ||
"github.com/cosmos/cosmos-sdk/codec" | ||
cdctypes "github.com/cosmos/cosmos-sdk/codec/types" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/types/msgservice" | ||
) | ||
|
||
var ( | ||
amino = codec.NewLegacyAmino() | ||
// AminoCdc is a amino codec created to support amino JSON compatible msgs. | ||
AminoCdc = codec.NewAminoCodec(amino) | ||
) | ||
|
||
const ( | ||
// Amino names | ||
liquidate = "haqq/MsgLiquidate" | ||
redeem = "haqq/MsgRedeem" | ||
) | ||
|
||
// NOTE: This is required for the GetSignBytes function | ||
func init() { | ||
RegisterLegacyAminoCodec(amino) | ||
amino.Seal() | ||
} | ||
|
||
// RegisterInterfaces associates protoName with AccountI and VestingAccount | ||
// Interfaces and creates a registry of it's concrete implementations | ||
func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { | ||
registry.RegisterImplementations((*sdk.Msg)(nil), | ||
&MsgLiquidate{}, | ||
&MsgRedeem{}, | ||
) | ||
|
||
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) | ||
} | ||
|
||
// RegisterLegacyAminoCodec registers the necessary x/erc20 interfaces and | ||
// concrete types on the provided LegacyAmino codec. These types are used for | ||
// Amino JSON serialization and EIP-712 compatibility. | ||
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { | ||
cdc.RegisterConcrete(&MsgLiquidate{}, liquidate, nil) | ||
cdc.RegisterConcrete(&MsgRedeem{}, redeem, nil) | ||
} |
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