basic linear vesting payouts (manual claim)

master
michael 2022-09-14 21:36:30 +00:00
parent edba09b124
commit 7f71e0be9e
15 changed files with 689 additions and 33 deletions

View File

@ -30827,6 +30827,8 @@ definitions:
type: object
additionalProperties:
type: string
colinear.colinearcore.MsgClaimFundsResponse:
type: object
colinear.colinearcore.MsgLockFundsResponse:
type: object
colinear.colinearcore.MsgNewAuctionResponse:

View File

@ -12,6 +12,7 @@ service Msg {
rpc LockFunds(MsgLockFunds) returns (MsgLockFundsResponse);
rpc UnlockFunds(MsgUnlockFunds) returns (MsgUnlockFundsResponse);
rpc UnlockAllFunds(MsgUnlockAllFunds) returns (MsgUnlockAllFundsResponse);
rpc ClaimFunds(MsgClaimFunds) returns (MsgClaimFundsResponse);
// this line is used by starport scaffolding # proto/tx/rpc
}
@ -63,4 +64,12 @@ message MsgUnlockAllFunds {
message MsgUnlockAllFundsResponse {
}
message MsgClaimFunds {
string creator = 1;
string auctionId = 2;
}
message MsgClaimFundsResponse {
}
// this line is used by starport scaffolding # proto/tx/message

View File

@ -35,6 +35,7 @@ func GetTxCmd() *cobra.Command {
cmd.AddCommand(CmdLockFunds())
cmd.AddCommand(CmdUnlockFunds())
cmd.AddCommand(CmdUnlockAllFunds())
cmd.AddCommand(CmdClaimFunds())
// this line is used by starport scaffolding # 1
return cmd

View File

@ -0,0 +1,42 @@
package cli
import (
"strconv"
"colinear/x/colinearcore/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/spf13/cobra"
)
var _ = strconv.Itoa(0)
func CmdClaimFunds() *cobra.Command {
cmd := &cobra.Command{
Use: "claim-funds [auction-id]",
Short: "Broadcast message claimFunds",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) (err error) {
argAuctionId := args[0]
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
msg := types.NewMsgClaimFunds(
clientCtx.GetFromAddress().String(),
argAuctionId,
)
if err := msg.ValidateBasic(); err != nil {
return err
}
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}
flags.AddTxFlagsToCmd(cmd)
return cmd
}

View File

@ -0,0 +1,72 @@
package keeper
import (
"context"
"errors"
"fmt"
"math/big"
"time"
colinearmath "colinear/x/colinearcore/math"
"colinear/x/colinearcore/types"
sdk "github.com/cosmos/cosmos-sdk/types"
)
func (k msgServer) ClaimFunds(goCtx context.Context, msg *types.MsgClaimFunds) (*types.MsgClaimFundsResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
// check that auction exists
auction, found := k.Keeper.GetAuction(ctx, msg.AuctionId)
if !found {
return nil, fmt.Errorf("auction %s not found", msg.AuctionId)
}
// check that auction is finalized
if auction.Best == nil {
return nil, fmt.Errorf("auction %s is not finalized", msg.AuctionId)
}
// check that auction has remaining funds to pay out
if auction.Remaining == "0" {
return nil, fmt.Errorf("auction %s has no payable CLR remaining", msg.AuctionId)
}
// check that sender is the selected provider for the auction
if auction.Best.Owner != msg.Creator {
return nil, fmt.Errorf("lease reward is only claimable by selected provider (%s) (got %s)", auction.Best.Owner, msg.Creator)
}
// parse address to send to
sendTo, err := sdk.AccAddressFromBech32(auction.Best.Owner)
if err != nil {
return nil, fmt.Errorf("failed to parse address %s: %s", auction.Best.Owner, err)
}
// calculate payable amount
total := new(big.Int)
total.SetString(auction.Best.Amount, 10)
remaining := new(big.Int)
remaining.SetString(auction.Remaining, 10)
leaseBegin := time.Unix(int64(auction.LeaseStart), 0)
leaseEnd := time.Unix(int64(auction.LeaseEnd), 0)
now := ctx.BlockTime()
subAmt, err := colinearmath.CalcAmountVestableLinear(total, remaining, now, leaseBegin, leaseEnd)
if err != nil {
return nil, errors.New("unable to calculate vestable amount")
}
// pay from module to user account
coins := sdk.NewCoins(sdk.NewCoin("uclr", sdk.NewIntFromBigInt(subAmt)))
if err := k.bank.SendCoinsFromModuleToAccount(ctx, types.ModuleName, sendTo, coins); err != nil {
return nil, fmt.Errorf("failed to send %s uCLR from module %s", subAmt.String(), types.ModuleName)
}
// subtract paid amount off of remaining payout tally & commit to chain state
newRemaining := new(big.Int)
newRemaining.Sub(remaining, subAmt)
auction.Remaining = subAmt.String()
k.Keeper.SetAuction(ctx, auction)
return &types.MsgClaimFundsResponse{}, nil
}

View File

@ -1,4 +1,4 @@
package math
package colinearmath
import (
"math/big"

View File

@ -1,4 +1,4 @@
package math
package colinearmath
import (
"fmt"

View File

@ -45,6 +45,10 @@ const (
// TODO: Determine the simulation weight value
defaultWeightMsgUnlockAllFunds int = 100
opWeightMsgClaimFunds = "op_weight_msg_claim_funds"
// TODO: Determine the simulation weight value
defaultWeightMsgClaimFunds int = 100
// this line is used by starport scaffolding # simapp/module/const
)
@ -134,6 +138,17 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp
colinearcoresimulation.SimulateMsgUnlockAllFunds(am.accountKeeper, am.bankKeeper, am.keeper),
))
var weightMsgClaimFunds int
simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgClaimFunds, &weightMsgClaimFunds, nil,
func(_ *rand.Rand) {
weightMsgClaimFunds = defaultWeightMsgClaimFunds
},
)
operations = append(operations, simulation.NewWeightedOperation(
weightMsgClaimFunds,
colinearcoresimulation.SimulateMsgClaimFunds(am.accountKeeper, am.bankKeeper, am.keeper),
))
// this line is used by starport scaffolding # simapp/module/operation
return operations

View File

@ -0,0 +1,29 @@
package simulation
import (
"math/rand"
"colinear/x/colinearcore/keeper"
"colinear/x/colinearcore/types"
"github.com/cosmos/cosmos-sdk/baseapp"
sdk "github.com/cosmos/cosmos-sdk/types"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
)
func SimulateMsgClaimFunds(
ak types.AccountKeeper,
bk types.BankKeeper,
k keeper.Keeper,
) simtypes.Operation {
return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
simAccount, _ := simtypes.RandomAcc(r, accs)
msg := &types.MsgClaimFunds{
Creator: simAccount.Address.String(),
}
// TODO: Handling the ClaimFunds simulation
return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "ClaimFunds simulation not implemented"), nil, nil
}
}

View File

@ -0,0 +1,18 @@
package simulation
import (
sdk "github.com/cosmos/cosmos-sdk/types"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
)
// FindAccount find a specific address from an account list
func FindAccount(accs []simtypes.Account, address string) (simtypes.Account, bool) {
creator, err := sdk.AccAddressFromBech32(address)
if err != nil {
panic(err)
}
return simtypes.FindAccount(accs, creator)
}
// New version of Ignite auto-generated helpers.go, which seems to be
// a duplicate of this. Back it up for now.

View File

@ -13,6 +13,7 @@ func RegisterCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(&MsgLockFunds{}, "colinearcore/LockFunds", nil)
cdc.RegisterConcrete(&MsgUnlockFunds{}, "colinearcore/UnlockFunds", nil)
cdc.RegisterConcrete(&MsgUnlockAllFunds{}, "colinearcore/UnlockAllFunds", nil)
cdc.RegisterConcrete(&MsgClaimFunds{}, "colinearcore/ClaimFunds", nil)
// this line is used by starport scaffolding # 2
}
@ -32,6 +33,9 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
registry.RegisterImplementations((*sdk.Msg)(nil),
&MsgUnlockAllFunds{},
)
registry.RegisterImplementations((*sdk.Msg)(nil),
&MsgClaimFunds{},
)
// this line is used by starport scaffolding # 3
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)

View File

@ -0,0 +1,46 @@
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)
const TypeMsgClaimFunds = "claim_funds"
var _ sdk.Msg = &MsgClaimFunds{}
func NewMsgClaimFunds(creator string, auctionId string) *MsgClaimFunds {
return &MsgClaimFunds{
Creator: creator,
AuctionId: auctionId,
}
}
func (msg *MsgClaimFunds) Route() string {
return RouterKey
}
func (msg *MsgClaimFunds) Type() string {
return TypeMsgClaimFunds
}
func (msg *MsgClaimFunds) GetSigners() []sdk.AccAddress {
creator, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
panic(err)
}
return []sdk.AccAddress{creator}
}
func (msg *MsgClaimFunds) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(msg)
return sdk.MustSortJSON(bz)
}
func (msg *MsgClaimFunds) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
}
return nil
}

View File

@ -0,0 +1,40 @@
package types
import (
"testing"
"colinear/testutil/sample"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/stretchr/testify/require"
)
func TestMsgClaimFunds_ValidateBasic(t *testing.T) {
tests := []struct {
name string
msg MsgClaimFunds
err error
}{
{
name: "invalid address",
msg: MsgClaimFunds{
Creator: "invalid_address",
},
err: sdkerrors.ErrInvalidAddress,
}, {
name: "valid address",
msg: MsgClaimFunds{
Creator: sample.AccAddress(),
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
err := tt.msg.ValidateBasic()
if tt.err != nil {
require.ErrorIs(t, err, tt.err)
return
}
require.NoError(t, err)
})
}
}

View File

@ -517,6 +517,94 @@ func (m *MsgUnlockAllFundsResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgUnlockAllFundsResponse proto.InternalMessageInfo
type MsgClaimFunds struct {
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
AuctionId string `protobuf:"bytes,2,opt,name=auctionId,proto3" json:"auctionId,omitempty"`
}
func (m *MsgClaimFunds) Reset() { *m = MsgClaimFunds{} }
func (m *MsgClaimFunds) String() string { return proto.CompactTextString(m) }
func (*MsgClaimFunds) ProtoMessage() {}
func (*MsgClaimFunds) Descriptor() ([]byte, []int) {
return fileDescriptor_0c3854a2a9bba3b4, []int{10}
}
func (m *MsgClaimFunds) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgClaimFunds) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgClaimFunds.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgClaimFunds) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgClaimFunds.Merge(m, src)
}
func (m *MsgClaimFunds) XXX_Size() int {
return m.Size()
}
func (m *MsgClaimFunds) XXX_DiscardUnknown() {
xxx_messageInfo_MsgClaimFunds.DiscardUnknown(m)
}
var xxx_messageInfo_MsgClaimFunds proto.InternalMessageInfo
func (m *MsgClaimFunds) GetCreator() string {
if m != nil {
return m.Creator
}
return ""
}
func (m *MsgClaimFunds) GetAuctionId() string {
if m != nil {
return m.AuctionId
}
return ""
}
type MsgClaimFundsResponse struct {
}
func (m *MsgClaimFundsResponse) Reset() { *m = MsgClaimFundsResponse{} }
func (m *MsgClaimFundsResponse) String() string { return proto.CompactTextString(m) }
func (*MsgClaimFundsResponse) ProtoMessage() {}
func (*MsgClaimFundsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_0c3854a2a9bba3b4, []int{11}
}
func (m *MsgClaimFundsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgClaimFundsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgClaimFundsResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgClaimFundsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgClaimFundsResponse.Merge(m, src)
}
func (m *MsgClaimFundsResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgClaimFundsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgClaimFundsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgClaimFundsResponse proto.InternalMessageInfo
func init() {
proto.RegisterType((*MsgNewAuction)(nil), "colinear.colinearcore.MsgNewAuction")
proto.RegisterType((*MsgNewAuctionResponse)(nil), "colinear.colinearcore.MsgNewAuctionResponse")
@ -528,42 +616,46 @@ func init() {
proto.RegisterType((*MsgUnlockFundsResponse)(nil), "colinear.colinearcore.MsgUnlockFundsResponse")
proto.RegisterType((*MsgUnlockAllFunds)(nil), "colinear.colinearcore.MsgUnlockAllFunds")
proto.RegisterType((*MsgUnlockAllFundsResponse)(nil), "colinear.colinearcore.MsgUnlockAllFundsResponse")
proto.RegisterType((*MsgClaimFunds)(nil), "colinear.colinearcore.MsgClaimFunds")
proto.RegisterType((*MsgClaimFundsResponse)(nil), "colinear.colinearcore.MsgClaimFundsResponse")
}
func init() { proto.RegisterFile("colinearcore/tx.proto", fileDescriptor_0c3854a2a9bba3b4) }
var fileDescriptor_0c3854a2a9bba3b4 = []byte{
// 476 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x94, 0xdf, 0x8a, 0xd3, 0x40,
0x14, 0xc6, 0x9b, 0x6d, 0xb7, 0x6b, 0xce, 0xae, 0x0b, 0x3b, 0xee, 0x96, 0x31, 0x6a, 0x08, 0x51,
0x21, 0xe0, 0x6e, 0x2b, 0x8a, 0x78, 0xeb, 0x16, 0x14, 0x04, 0x2b, 0x52, 0xf4, 0x46, 0x10, 0x8c,
0x99, 0x63, 0x18, 0x4c, 0x67, 0xca, 0x4c, 0xba, 0xd6, 0xb7, 0xf0, 0xb1, 0xbc, 0xdc, 0x4b, 0xbd,
0x93, 0xf6, 0x01, 0x7c, 0x05, 0x31, 0x7f, 0xa6, 0x89, 0xeb, 0xb6, 0x01, 0xef, 0x72, 0xbe, 0xf3,
0x9d, 0xdf, 0xc9, 0xcc, 0x39, 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 0x4d, 0xfb, 0x32, 0x45, 0xfd, 0xa1, 0x9b, 0xbd, 0x6b, 0x0f, 0x7f, 0x07,
0x00, 0x00, 0xff, 0xff, 0xdf, 0x9d, 0x09, 0x8c, 0xf0, 0x04, 0x00, 0x00,
// 512 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x94, 0x51, 0x8b, 0xd3, 0x40,
0x10, 0xc7, 0x9b, 0xb6, 0xd7, 0x33, 0x73, 0xe7, 0xc1, 0xad, 0x77, 0x35, 0x46, 0x0d, 0x21, 0x2a,
0x04, 0xbc, 0x6b, 0x45, 0x11, 0x5f, 0xbd, 0x8a, 0x8a, 0x60, 0x45, 0x8a, 0xbe, 0x08, 0xc2, 0xc5,
0xec, 0x1a, 0x16, 0xd3, 0xdd, 0xb2, 0x9b, 0x9e, 0xf5, 0x5b, 0xf8, 0xb1, 0x7c, 0x3c, 0xdf, 0xf4,
0x4d, 0xda, 0x2f, 0x22, 0x6e, 0x92, 0x4d, 0x72, 0xb5, 0x69, 0xe1, 0xde, 0x3a, 0x33, 0xff, 0xf9,
0x4d, 0x76, 0xe7, 0xdf, 0x85, 0xc3, 0x90, 0xc7, 0x94, 0x91, 0x40, 0x84, 0x5c, 0x90, 0x7e, 0x32,
0xeb, 0x4d, 0x04, 0x4f, 0x38, 0xd2, 0xe9, 0x5e, 0xb9, 0xee, 0xfd, 0x36, 0xe0, 0xea, 0x50, 0x46,
0x6f, 0xc8, 0xd7, 0x93, 0x69, 0x98, 0x50, 0xce, 0x90, 0x05, 0xdb, 0xa1, 0x20, 0x41, 0xc2, 0x85,
0x65, 0xb8, 0x86, 0x6f, 0x8e, 0xf2, 0x10, 0x21, 0x68, 0xb3, 0x60, 0x4c, 0xac, 0xa6, 0x4a, 0xab,
0xdf, 0xc8, 0x85, 0x1d, 0x4c, 0x64, 0x28, 0xe8, 0xe4, 0x5f, 0xb3, 0xd5, 0x52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, 0xf1, 0xba, 0x0f, 0xad, 0x2c, 0xb1, 0x79, 0x71, 0x89,
0xd7, 0xd5, 0xee, 0x0b, 0x50, 0x3e, 0xe1, 0xe1, 0xcf, 0x36, 0xb4, 0x86, 0x32, 0x42, 0xa7, 0x00,
0x25, 0xd3, 0xdf, 0xed, 0xfd, 0xf7, 0xef, 0xd1, 0xab, 0xf8, 0xc7, 0x3e, 0xda, 0x44, 0xa5, 0x5d,
0xf6, 0x0e, 0x3a, 0x99, 0x89, 0xdc, 0xda, 0xbe, 0x01, 0xc5, 0xb6, 0xbf, 0x4e, 0xa1, 0xa9, 0x1f,
0xc1, 0x2c, 0x2c, 0x72, 0x67, 0x75, 0x9b, 0x16, 0xd9, 0xf7, 0x37, 0x10, 0x69, 0x7c, 0x08, 0x3b,
0x65, 0x9f, 0xdc, 0x5b, 0xdd, 0x5b, 0x92, 0xd9, 0xc7, 0x1b, 0xc9, 0xf4, 0x90, 0x18, 0xf6, 0x2e,
0xd8, 0xc5, 0x5f, 0x07, 0xc8, 0x95, 0xf6, 0x83, 0x4d, 0x95, 0x7a, 0xda, 0x29, 0x40, 0xc9, 0x50,
0x35, 0x9b, 0x2e, 0x54, 0x75, 0x9b, 0x5e, 0xf6, 0xd4, 0xe0, 0xc9, 0x8f, 0xb9, 0x63, 0x9c, 0xcf,
0x1d, 0xe3, 0xcf, 0xdc, 0x31, 0xbe, 0x2f, 0x9c, 0xc6, 0xf9, 0xc2, 0x69, 0xfc, 0x5a, 0x38, 0x8d,
0x0f, 0xb7, 0xf3, 0xee, 0xfe, 0xac, 0x5f, 0x7d, 0x97, 0xbf, 0x4d, 0x88, 0xfc, 0xd4, 0x51, 0x6f,
0xf3, 0xa3, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x6d, 0x40, 0xff, 0x13, 0xb4, 0x05, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -583,6 +675,7 @@ type MsgClient interface {
LockFunds(ctx context.Context, in *MsgLockFunds, opts ...grpc.CallOption) (*MsgLockFundsResponse, error)
UnlockFunds(ctx context.Context, in *MsgUnlockFunds, opts ...grpc.CallOption) (*MsgUnlockFundsResponse, error)
UnlockAllFunds(ctx context.Context, in *MsgUnlockAllFunds, opts ...grpc.CallOption) (*MsgUnlockAllFundsResponse, error)
ClaimFunds(ctx context.Context, in *MsgClaimFunds, opts ...grpc.CallOption) (*MsgClaimFundsResponse, error)
}
type msgClient struct {
@ -638,6 +731,15 @@ func (c *msgClient) UnlockAllFunds(ctx context.Context, in *MsgUnlockAllFunds, o
return out, nil
}
func (c *msgClient) ClaimFunds(ctx context.Context, in *MsgClaimFunds, opts ...grpc.CallOption) (*MsgClaimFundsResponse, error) {
out := new(MsgClaimFundsResponse)
err := c.cc.Invoke(ctx, "/colinear.colinearcore.Msg/ClaimFunds", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MsgServer is the server API for Msg service.
type MsgServer interface {
NewAuction(context.Context, *MsgNewAuction) (*MsgNewAuctionResponse, error)
@ -645,6 +747,7 @@ type MsgServer interface {
LockFunds(context.Context, *MsgLockFunds) (*MsgLockFundsResponse, error)
UnlockFunds(context.Context, *MsgUnlockFunds) (*MsgUnlockFundsResponse, error)
UnlockAllFunds(context.Context, *MsgUnlockAllFunds) (*MsgUnlockAllFundsResponse, error)
ClaimFunds(context.Context, *MsgClaimFunds) (*MsgClaimFundsResponse, error)
}
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
@ -666,6 +769,9 @@ func (*UnimplementedMsgServer) UnlockFunds(ctx context.Context, req *MsgUnlockFu
func (*UnimplementedMsgServer) UnlockAllFunds(ctx context.Context, req *MsgUnlockAllFunds) (*MsgUnlockAllFundsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UnlockAllFunds not implemented")
}
func (*UnimplementedMsgServer) ClaimFunds(ctx context.Context, req *MsgClaimFunds) (*MsgClaimFundsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ClaimFunds not implemented")
}
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
s.RegisterService(&_Msg_serviceDesc, srv)
@ -761,6 +867,24 @@ func _Msg_UnlockAllFunds_Handler(srv interface{}, ctx context.Context, dec func(
return interceptor(ctx, in, info, handler)
}
func _Msg_ClaimFunds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgClaimFunds)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).ClaimFunds(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/colinear.colinearcore.Msg/ClaimFunds",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).ClaimFunds(ctx, req.(*MsgClaimFunds))
}
return interceptor(ctx, in, info, handler)
}
var _Msg_serviceDesc = grpc.ServiceDesc{
ServiceName: "colinear.colinearcore.Msg",
HandlerType: (*MsgServer)(nil),
@ -785,6 +909,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
MethodName: "UnlockAllFunds",
Handler: _Msg_UnlockAllFunds_Handler,
},
{
MethodName: "ClaimFunds",
Handler: _Msg_ClaimFunds_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "colinearcore/tx.proto",
@ -1132,6 +1260,66 @@ func (m *MsgUnlockAllFundsResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro
return len(dAtA) - i, nil
}
func (m *MsgClaimFunds) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgClaimFunds) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgClaimFunds) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.AuctionId) > 0 {
i -= len(m.AuctionId)
copy(dAtA[i:], m.AuctionId)
i = encodeVarintTx(dAtA, i, uint64(len(m.AuctionId)))
i--
dAtA[i] = 0x12
}
if len(m.Creator) > 0 {
i -= len(m.Creator)
copy(dAtA[i:], m.Creator)
i = encodeVarintTx(dAtA, i, uint64(len(m.Creator)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgClaimFundsResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgClaimFundsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgClaimFundsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
offset -= sovTx(v)
base := offset
@ -1298,6 +1486,32 @@ func (m *MsgUnlockAllFundsResponse) Size() (n int) {
return n
}
func (m *MsgClaimFunds) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Creator)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = len(m.AuctionId)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
return n
}
func (m *MsgClaimFundsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func sovTx(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
@ -2303,6 +2517,170 @@ func (m *MsgUnlockAllFundsResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *MsgClaimFunds) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgClaimFunds: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgClaimFunds: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Creator = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field AuctionId", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.AuctionId = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgClaimFundsResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgClaimFundsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgClaimFundsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipTx(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0