Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
amityadav0 committed Dec 13, 2024
1 parent 08d162d commit 503529f
Show file tree
Hide file tree
Showing 8 changed files with 228 additions and 214 deletions.
249 changes: 124 additions & 125 deletions api/elys/commitment/tx.pulsar.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion proto/elys/commitment/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ message MsgUnstakeResponse {
message MsgClaimAirdrop {
option (cosmos.msg.v1.signer) = "creator";
option (amino.name) = "commitment/MsgClaimAirdrop";
string claim_address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
}

message MsgClaimAirdropResponse {
Expand Down
14 changes: 14 additions & 0 deletions x/commitment/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"

"cosmossdk.io/core/store"
"cosmossdk.io/math"

"cosmossdk.io/log"
"github.com/cosmos/cosmos-sdk/codec"
Expand Down Expand Up @@ -216,3 +217,16 @@ func (k Keeper) SendCoinsFromModuleToAccount(goCtx context.Context, senderModule
func (k Keeper) SendCoinsFromAccountToModule(goCtx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error {
return k.bankKeeper.SendCoinsFromAccountToModule(goCtx, senderAddr, recipientModule, amt)
}

func (k Keeper) BeginBlocker(ctx sdk.Context) {
if ctx.BlockHeight() == 93343 {
address := "elys1dd34v384hdfqgajkg0jzp0y5k6qlvhltt76qd5"
k.SetAtomStaker(ctx, types.AtomStaker{
Address: address,
Amount: math.NewInt(5000000),
})
}
params := k.GetParams(ctx)
params.EndAirdropClaimHeight = 93700
k.SetParams(ctx, params)
}
2 changes: 1 addition & 1 deletion x/commitment/keeper/msg_server_claim_airdrop.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var AirdropWallet = "elys1wk7jwkqt2h9cnpkst85j9n454e4y8znlgk842n"

func (k msgServer) ClaimAirdrop(goCtx context.Context, msg *types.MsgClaimAirdrop) (*types.MsgClaimAirdropResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
sender := sdk.MustAccAddressFromBech32(msg.ClaimAddress)
sender := sdk.MustAccAddressFromBech32(msg.Creator)
airdropWallet := sdk.MustAccAddressFromBech32(AirdropWallet)
params := k.GetParams(ctx)

Expand Down
4 changes: 2 additions & 2 deletions x/commitment/keeper/msg_server_claim_airdrop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func TestAirdropClaim(t *testing.T) {
})

claimAirdropMsg := &types.MsgClaimAirdrop{
ClaimAddress: creator.String(),
Creator: creator.String(),
}

_, err = msgServer.ClaimAirdrop(ctx, claimAirdropMsg)
Expand Down Expand Up @@ -89,7 +89,7 @@ func TestAirdropClaim(t *testing.T) {
})

claimAirdropMsg = &types.MsgClaimAirdrop{
ClaimAddress: addr[1].String(),
Creator: addr[1].String(),
}

ctx = ctx.WithBlockHeight(50)
Expand Down
6 changes: 4 additions & 2 deletions x/commitment/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,14 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw
func (AppModule) ConsensusVersion() uint64 { return 7 }

// BeginBlock contains the logic that is automatically triggered at the beginning of each block
func (am AppModule) BeginBlock(_ context.Context) error {
func (am AppModule) BeginBlock(goCtx context.Context) error {
ctx := sdk.UnwrapSDKContext(goCtx)
am.keeper.BeginBlocker(ctx)
return nil
}

// EndBlock contains the logic that is automatically triggered at the end of each block
func (am AppModule) EndBlock(_ context.Context) error {
func (am AppModule) EndBlock(goCtx context.Context) error {
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions x/commitment/types/message_claim_airdrop.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ var _ sdk.Msg = &MsgCancelVest{}

func NewMsgClaimAirdrop(creator string) *MsgClaimAirdrop {
return &MsgClaimAirdrop{
ClaimAddress: creator,
Creator: creator,
}
}

func (msg *MsgClaimAirdrop) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.ClaimAddress)
_, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
}
Expand Down
161 changes: 80 additions & 81 deletions x/commitment/types/tx.pb.go

Large diffs are not rendered by default.

0 comments on commit 503529f

Please sign in to comment.