-
Notifications
You must be signed in to change notification settings - Fork 25
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 #320 from scorpioborn/feature/rewards
Feature/rewards Merge with Master
- Loading branch information
Showing
6 changed files
with
87 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package v3 | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/sge-network/sge/app/upgrades" | ||
) | ||
|
||
// UpgradeName defines the on-chain upgrade name for the v1.2.0 upgrade. | ||
const UpgradeName = "v1.2.0" | ||
|
||
// Expedite governance params | ||
var ( | ||
// DefaultMinExpeditedDepositTokens is the default minimum deposit required for expedited proposals. | ||
DefaultMinExpeditedDepositTokens = sdk.NewInt(50000000000) | ||
// DefaultExpeditedQuorum is the default quorum percentage required for expedited proposals. | ||
DefaultExpeditedQuorum = sdk.NewDecWithPrec(750, 3) | ||
// DefaultExpeditedThreshold is the default voting threshold percentage required for expedited proposals. | ||
DefaultExpeditedThreshold = sdk.NewDecWithPrec(750, 3) | ||
) | ||
|
||
var Upgrade = upgrades.Upgrade{ | ||
UpgradeName: UpgradeName, | ||
CreateUpgradeHandler: CreateUpgradeHandler, | ||
} |
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,36 @@ | ||
package v3 | ||
|
||
import ( | ||
"time" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/types/module" | ||
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" | ||
"github.com/sge-network/sge/app/keepers" | ||
) | ||
|
||
const DefaultExpeditedPeriod time.Duration = time.Hour * 24 | ||
|
||
func CreateUpgradeHandler( | ||
mm *module.Manager, | ||
configurator module.Configurator, | ||
keepers *keepers.AppKeepers, | ||
) upgradetypes.UpgradeHandler { | ||
return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { | ||
depositParams := keepers.GovKeeper.GetDepositParams(ctx) | ||
depositParams.MinExpeditedDeposit = sdk.NewCoins(sdk.NewCoin("usge", DefaultMinExpeditedDepositTokens)) | ||
keepers.GovKeeper.SetDepositParams(ctx, depositParams) | ||
|
||
tallyParams := keepers.GovKeeper.GetTallyParams(ctx) | ||
tallyParams.ExpeditedThreshold = DefaultExpeditedThreshold.String() | ||
tallyParams.ExpeditedQuorum = DefaultExpeditedQuorum.String() | ||
keepers.GovKeeper.SetTallyParams(ctx, tallyParams) | ||
|
||
votingParams := keepers.GovKeeper.GetVotingParams(ctx) | ||
expeditedPeriod := DefaultExpeditedPeriod | ||
votingParams.ExpeditedVotingPeriod = &expeditedPeriod | ||
keepers.GovKeeper.SetVotingParams(ctx, votingParams) | ||
|
||
return mm.RunMigrations(ctx, configurator, fromVM) | ||
} | ||
} |
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