-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feat/mint-devfund' of github.com:tendermint/spn into fe…
…at/mint-devfund
- Loading branch information
Showing
12 changed files
with
522 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
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,9 @@ | ||
syntax = "proto3"; | ||
package tendermint.spn.claim; | ||
|
||
option go_package = "github.com/tendermint/spn/x/claim/types"; | ||
|
||
message EventMissionCompleted { | ||
uint64 missionID = 1; | ||
string claimer = 2; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package keeper | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" | ||
) | ||
|
||
type MissionDelegationHooks struct { | ||
k Keeper | ||
missionID uint64 | ||
} | ||
|
||
// NewMissionDelegationHooks returns a StakingHooks that triggers mission completion on delegation for an account | ||
func (k Keeper) NewMissionDelegationHooks(missionID uint64) MissionDelegationHooks { | ||
return MissionDelegationHooks{k, missionID} | ||
} | ||
|
||
var _ stakingtypes.StakingHooks = MissionDelegationHooks{} | ||
|
||
// BeforeDelegationCreated completes mission when a delegation is performed | ||
func (h MissionDelegationHooks) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, _ sdk.ValAddress) { | ||
// TODO: error handling | ||
_ = h.k.CompleteMission(ctx, h.missionID, delAddr.String()) | ||
} | ||
|
||
// AfterValidatorCreated implements StakingHooks | ||
func (h MissionDelegationHooks) AfterValidatorCreated(_ sdk.Context, _ sdk.ValAddress) { | ||
} | ||
|
||
// AfterValidatorRemoved implements StakingHooks | ||
func (h MissionDelegationHooks) AfterValidatorRemoved(_ sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress) { | ||
} | ||
|
||
// BeforeDelegationSharesModified implements StakingHooks | ||
func (h MissionDelegationHooks) BeforeDelegationSharesModified(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) { | ||
} | ||
|
||
// AfterDelegationModified implements StakingHooks | ||
func (h MissionDelegationHooks) AfterDelegationModified(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) { | ||
} | ||
|
||
// BeforeValidatorSlashed implements StakingHooks | ||
func (h MissionDelegationHooks) BeforeValidatorSlashed(_ sdk.Context, _ sdk.ValAddress, _ sdk.Dec) { | ||
} | ||
|
||
// BeforeValidatorModified implements StakingHooks | ||
func (h MissionDelegationHooks) BeforeValidatorModified(_ sdk.Context, _ sdk.ValAddress) { | ||
} | ||
|
||
// AfterValidatorBonded implements StakingHooks | ||
func (h MissionDelegationHooks) AfterValidatorBonded(_ sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress) { | ||
} | ||
|
||
// AfterValidatorBeginUnbonding implements StakingHooks | ||
func (h MissionDelegationHooks) AfterValidatorBeginUnbonding(_ sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress) { | ||
} | ||
|
||
// BeforeDelegationRemoved implements StakingHooks | ||
func (h MissionDelegationHooks) BeforeDelegationRemoved(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) { | ||
} |
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,40 @@ | ||
package keeper | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" | ||
) | ||
|
||
type MissionVoteHooks struct { | ||
k Keeper | ||
missionID uint64 | ||
} | ||
|
||
// NewMissionVoteHooks returns a GovHooks that triggers mission completion on voting for a proposal | ||
func (k Keeper) NewMissionVoteHooks(missionID uint64) MissionVoteHooks { | ||
return MissionVoteHooks{k, missionID} | ||
} | ||
|
||
var _ govtypes.GovHooks = MissionVoteHooks{} | ||
|
||
// AfterProposalVote completes mission when a vote is cast | ||
func (h MissionVoteHooks) AfterProposalVote(ctx sdk.Context, _ uint64, voterAddr sdk.AccAddress) { | ||
// TODO: error handling | ||
_ = h.k.CompleteMission(ctx, h.missionID, voterAddr.String()) | ||
} | ||
|
||
// AfterProposalSubmission implements GovHooks | ||
func (h MissionVoteHooks) AfterProposalSubmission(_ sdk.Context, _ uint64) { | ||
} | ||
|
||
// AfterProposalDeposit implements GovHooks | ||
func (h MissionVoteHooks) AfterProposalDeposit(_ sdk.Context, _ uint64, _ sdk.AccAddress) { | ||
} | ||
|
||
// AfterProposalFailedMinDeposit implements GovHooks | ||
func (h MissionVoteHooks) AfterProposalFailedMinDeposit(_ sdk.Context, _ uint64) { | ||
} | ||
|
||
// AfterProposalVotingPeriodEnded implements GovHooks | ||
func (h MissionVoteHooks) AfterProposalVotingPeriodEnded(_ sdk.Context, _ uint64) { | ||
} |
Oops, something went wrong.