Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(launch): update events format #758

Merged
merged 5 commits into from
May 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 29 additions & 14 deletions proto/launch/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ syntax = "proto3";
package tendermint.spn.launch;

import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";
import "launch/chain.proto";
import "launch/request.proto";
import "launch/genesis_account.proto";
Expand All @@ -11,15 +12,17 @@ import "launch/genesis_validator.proto";
option go_package = "github.com/tendermint/spn/x/launch/types";

message EventChainCreated {
Chain chain = 1 [(gogoproto.nullable) = false];
uint64 coordinatorID = 1;
Chain chain = 2 [(gogoproto.nullable) = false];
}

message EventChainUpdated {
Chain chain = 1 [(gogoproto.nullable) = false];
}

message EventRequestCreated {
Request request = 1 [(gogoproto.nullable) = false];
string creator = 1;
Request request = 2 [(gogoproto.nullable) = false];
}

message EventRequestSettled {
Expand All @@ -29,23 +32,33 @@ message EventRequestSettled {
}

message EventGenesisAccountAdded {
GenesisAccount genesisAccount = 1 [(gogoproto.nullable) = false];
uint64 launchID = 2;
string coordinatorAddress = 3;
uint64 launchID = 1;
string address = 2;
repeated cosmos.base.v1beta1.Coin coins = 3 [
(gogoproto.nullable) = false,
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.Coin",
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
string coordinatorAddress = 4;
}

message EventVestingAccountAdded {
VestingAccount vestingAccount = 1 [(gogoproto.nullable) = false];
uint64 launchID = 2;
string coordinatorAddress = 3;
uint64 launchID = 1;
string address = 2;
VestingOptions vestingOptions = 3 [(gogoproto.nullable) = false];
string coordinatorAddress = 4;
}

message EventValidatorAdded {
GenesisValidator genesisValidator = 1 [(gogoproto.nullable) = false];
uint64 launchID = 2;
bool hasCampaign = 3;
uint64 campaignID = 4;
string coordinatorAddress = 5;
uint64 launchID = 1;
string address = 2;
bytes genTx = 3;
bytes consPubKey = 4;
cosmos.base.v1beta1.Coin selfDelegation = 5 [(gogoproto.nullable) = false];
Peer peer = 6 [(gogoproto.nullable) = false];
bool hasCampaign = 7;
uint64 campaignID = 8;
string coordinatorAddress = 9;
}

message EventAccountRemoved {
Expand All @@ -57,7 +70,9 @@ message EventAccountRemoved {
message EventValidatorRemoved {
string genesisValidatorAccount = 1;
uint64 launchID = 2;
string coordinatorAddress = 3;
bool hasCampaign = 3;
uint64 campaignID = 4;
string coordinatorAddress = 5;
}

message EventLaunchTriggered {
Expand Down
3 changes: 2 additions & 1 deletion x/launch/keeper/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ func (k Keeper) CreateNewChain(
}

err := ctx.EventManager().EmitTypedEvent(&types.EventChainCreated{
Chain: chain,
CoordinatorID: coordinatorID,
Chain: chain,
})
return launchID, err
}
Expand Down
1 change: 1 addition & 0 deletions x/launch/keeper/msg_request_add_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ func (k msgServer) RequestAddAccount(

requestID = k.AppendRequest(ctx, request)
err = ctx.EventManager().EmitTypedEvent(&types.EventRequestCreated{
Creator: msg.Creator,
Request: request,
})

Expand Down
1 change: 1 addition & 0 deletions x/launch/keeper/msg_request_add_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func (k msgServer) RequestAddValidator(

requestID = k.AppendRequest(ctx, request)
err = ctx.EventManager().EmitTypedEvent(&types.EventRequestCreated{
Creator: msg.Creator,
Request: request,
})

Expand Down
1 change: 1 addition & 0 deletions x/launch/keeper/msg_request_add_vesting_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ func (k msgServer) RequestAddVestingAccount(

requestID = k.AppendRequest(ctx, request)
err = ctx.EventManager().EmitTypedEvent(&types.EventRequestCreated{
Creator: msg.Creator,
Request: request,
})

Expand Down
1 change: 1 addition & 0 deletions x/launch/keeper/msg_request_remove_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func (k msgServer) RequestRemoveAccount(

requestID = k.AppendRequest(ctx, request)
err := ctx.EventManager().EmitTypedEvent(&types.EventRequestCreated{
Creator: msg.Creator,
Request: request,
})

Expand Down
1 change: 1 addition & 0 deletions x/launch/keeper/msg_request_remove_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func (k msgServer) RequestRemoveValidator(

requestID = k.AppendRequest(ctx, request)
err := ctx.EventManager().EmitTypedEvent(&types.EventRequestCreated{
Creator: msg.Creator,
Request: request,
})

Expand Down
14 changes: 11 additions & 3 deletions x/launch/keeper/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ func ApplyRequest(
ga := requestContent.GenesisAccount
k.SetGenesisAccount(ctx, *ga)
err = ctx.EventManager().EmitTypedEvent(&types.EventGenesisAccountAdded{
GenesisAccount: *ga,
Address: ga.Address,
Coins: ga.Coins,
LaunchID: chain.LaunchID,
CoordinatorAddress: coord.Address,
})
Expand All @@ -171,7 +172,8 @@ func ApplyRequest(
va := requestContent.VestingAccount
k.SetVestingAccount(ctx, *va)
err = ctx.EventManager().EmitTypedEvent(&types.EventVestingAccountAdded{
VestingAccount: *va,
Address: va.Address,
VestingOptions: va.VestingOptions,
LaunchID: chain.LaunchID,
CoordinatorAddress: coord.Address,
})
Expand All @@ -190,7 +192,11 @@ func ApplyRequest(
ga := requestContent.GenesisValidator
k.SetGenesisValidator(ctx, *ga)
err = ctx.EventManager().EmitTypedEvent(&types.EventValidatorAdded{
GenesisValidator: *ga,
Address: ga.Address,
GenTx: ga.GenTx,
ConsPubKey: ga.ConsPubKey,
SelfDelegation: ga.SelfDelegation,
Peer: ga.Peer,
LaunchID: chain.LaunchID,
HasCampaign: chain.HasCampaign,
CampaignID: chain.CampaignID,
Expand All @@ -203,6 +209,8 @@ func ApplyRequest(
err = ctx.EventManager().EmitTypedEvent(&types.EventValidatorRemoved{
GenesisValidatorAccount: vr.ValAddress,
LaunchID: chain.LaunchID,
HasCampaign: chain.HasCampaign,
CampaignID: chain.CampaignID,
CoordinatorAddress: coord.Address,
})

Expand Down
Loading