-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
60 changed files
with
5,366 additions
and
571 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
syntax = "proto3"; | ||
package stride.stakeibc; | ||
|
||
import "cosmos/base/v1beta1/coin.proto"; | ||
import "gogoproto/gogo.proto"; | ||
|
||
option go_package = "github.com/Stride-Labs/stride/v8/x/stakeibc/types"; | ||
|
||
enum LSMDepositStatus { | ||
option (gogoproto.goproto_enum_prefix) = false; | ||
|
||
TRANSFER_IN_PROGRESS = 0; | ||
TRANSFER_FAILED = 1; | ||
DETOKENIZATION_QUEUE = 2; | ||
DETOKENIZATION_IN_PROGRESS = 3; | ||
DETOKENIZATION_FAILED = 4; | ||
} | ||
|
||
message LSMTokenDeposit { | ||
string denom = 1; | ||
string chain_id = 2; | ||
string validator_address = 3; | ||
string amount = 4 [ | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", | ||
(gogoproto.nullable) = false | ||
]; | ||
LSMDepositStatus status = 5; | ||
} | ||
|
||
message LSMLiquidStake { | ||
string staker = 1; | ||
cosmos.base.v1beta1.Coin lsm_token = 2 [ | ||
(gogoproto.nullable) = false, | ||
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coin" | ||
]; | ||
} |
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,27 @@ | ||
package keeper | ||
|
||
import ( | ||
"github.com/Stride-Labs/stride/v8/utils" | ||
icacallbackstypes "github.com/Stride-Labs/stride/v8/x/icacallbacks/types" | ||
"github.com/Stride-Labs/stride/v8/x/records/types" | ||
stakeibctypes "github.com/Stride-Labs/stride/v8/x/stakeibc/types" | ||
|
||
errorsmod "cosmossdk.io/errors" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
channeltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types" | ||
"github.com/golang/protobuf/proto" //nolint:staticcheck | ||
) | ||
|
||
func LSMTransferCallback(k Keeper, ctx sdk.Context, packet channeltypes.Packet, ackResponse *icacallbackstypes.AcknowledgementResponse, args []byte) error { | ||
// Fetch callback args | ||
transferCallback := stakeibctypes.TransferLSMTokenCallback{} | ||
if err := proto.Unmarshal(args, &transferCallback); err != nil { | ||
return errorsmod.Wrapf(types.ErrUnmarshalFailure, "unable to unmarshal LSM transfer callback: %s", err.Error()) | ||
} | ||
chainId := transferCallback.Deposit.ChainId | ||
k.Logger(ctx).Info(utils.LogICACallbackWithHostZone(chainId, IBCCallbacksID_LSMTransfer, "Starting LSM transfer callback")) | ||
|
||
// TODO [LSM] | ||
|
||
return nil | ||
} |
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package cli | ||
|
||
import ( | ||
"github.com/cosmos/cosmos-sdk/client" | ||
"github.com/cosmos/cosmos-sdk/client/flags" | ||
"github.com/cosmos/cosmos-sdk/client/tx" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
|
||
errorsmod "cosmossdk.io/errors" | ||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" | ||
"github.com/spf13/cobra" | ||
|
||
"github.com/Stride-Labs/stride/v8/x/stakeibc/types" | ||
) | ||
|
||
func CmdLSMLiquidStake() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "lsm-liquid-stake [amount] [lsm-token-denom]", | ||
Short: "Broadcast message lsm-liquid-stake", | ||
Args: cobra.ExactArgs(2), | ||
RunE: func(cmd *cobra.Command, args []string) (err error) { | ||
amount, found := sdk.NewIntFromString(args[0]) | ||
if !found { | ||
return errorsmod.Wrap(sdkerrors.ErrInvalidType, "can not convert string to int") | ||
} | ||
denom := args[1] | ||
|
||
clientCtx, err := client.GetClientTxContext(cmd) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
msg := types.NewMsgLSMLiquidStake( | ||
clientCtx.GetFromAddress().String(), | ||
amount, | ||
denom, | ||
) | ||
if err := msg.ValidateBasic(); err != nil { | ||
return err | ||
} | ||
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) | ||
}, | ||
} | ||
|
||
flags.AddTxFlagsToCmd(cmd) | ||
|
||
return cmd | ||
} |
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.