-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #182 from decentrio/feat/vesting-delegate-remake
feat: allow depositing vesting tokens in the vault
- Loading branch information
Showing
21 changed files
with
177 additions
and
22 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
Binary file not shown.
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
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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 +1 @@ | ||
v0.10.0-alpha.1 | ||
34284a38601ff132e8d7b5594a87794faa71bbed |
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,21 @@ | ||
package contract | ||
|
||
import wasmvmtypes "github.com/CosmWasm/wasmvm/types" | ||
|
||
type ( | ||
CustomMsg struct { | ||
Provider *ProviderMsg `json:"provider,omitempty"` | ||
} | ||
ProviderMsg struct { | ||
Bond *BondMsg `json:"bond,omitempty"` | ||
Unbond *UnbondMsg `json:"unbond,omitempty"` | ||
} | ||
BondMsg struct { | ||
Amount wasmvmtypes.Coin `json:"amount"` | ||
Delegator string `json:"delegator"` | ||
} | ||
UnbondMsg struct { | ||
Amount wasmvmtypes.Coin `json:"amount"` | ||
Delegator string `json:"delegator"` | ||
} | ||
) |
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,51 @@ | ||
package keeper | ||
|
||
import ( | ||
"encoding/json" | ||
|
||
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" | ||
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" | ||
wasmvmtypes "github.com/CosmWasm/wasmvm/types" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" | ||
|
||
"github.com/osmosis-labs/mesh-security-sdk/x/meshsecurityprovider/contract" | ||
) | ||
|
||
type CustomMessenger struct { | ||
k *Keeper | ||
} | ||
|
||
|
||
// CustomMessageDecorator returns decorator for custom CosmWasm bindings messages | ||
func CustomMessageDecorator(provKeeper *Keeper) *CustomMessenger { | ||
return &CustomMessenger{ | ||
k: provKeeper, | ||
} | ||
} | ||
|
||
var _ wasmkeeper.Messenger = (*CustomMessenger)(nil) | ||
|
||
// DispatchMsg executes on the contractMsg. | ||
func (h CustomMessenger) DispatchMsg(ctx sdk.Context, contractAddr sdk.AccAddress, _ string, msg wasmvmtypes.CosmosMsg) ([]sdk.Event, [][]byte, error) { | ||
if msg.Custom == nil { | ||
return nil, nil, wasmtypes.ErrUnknownMsg | ||
} | ||
var customMsg contract.CustomMsg | ||
if err := json.Unmarshal(msg.Custom, &customMsg); err != nil { | ||
return nil, nil, sdkerrors.ErrJSONUnmarshal.Wrap("custom message") | ||
} | ||
if customMsg.Provider == nil { | ||
// not our message type | ||
return nil, nil, wasmtypes.ErrUnknownMsg | ||
} | ||
switch { | ||
case customMsg.Provider.Bond != nil: | ||
return h.k.HandleBondMsg(ctx, contractAddr, customMsg.Provider.Bond) | ||
case customMsg.Provider.Unbond != nil: | ||
return h.k.HandleUnbondMsg(ctx, contractAddr, customMsg.Provider.Unbond) | ||
} | ||
return nil, nil, wasmtypes.ErrUnknownMsg | ||
} | ||
|
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