mirror of
				https://github.com/0glabs/0g-chain.git
				synced 2025-11-04 07:47:27 +00:00 
			
		
		
		
	Initial kava 8 migration (#985)
* add swap module, update incentive * add swapRewardPeriods to incentive * add TODOs * add text change permissions to hard, swap coms * rename variable to clarify delegation rewards * remove placeholder swp incentives Co-authored-by: karzak <kjydavis3@gmail.com>
This commit is contained in:
		
							parent
							
								
									1a90c3bec6
								
							
						
					
					
						commit
						30af22b50b
					
				@ -37,7 +37,7 @@ func Incentive(incentiveGS v0_14incentive.GenesisState) v0_15incentive.GenesisSt
 | 
			
		||||
					MonthsLockup: 12,
 | 
			
		||||
					Factor:       sdk.OneDec(),
 | 
			
		||||
				},
 | 
			
		||||
			}, // TODO set the correct multipliers
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -48,23 +48,23 @@ func Incentive(incentiveGS v0_14incentive.GenesisState) v0_15incentive.GenesisSt
 | 
			
		||||
		usdxMintingRewardPeriods = append(usdxMintingRewardPeriods, usdxMintingRewardPeriod)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	hardDelegatorRewardPeriods := v0_15incentive.MultiRewardPeriods{}
 | 
			
		||||
	delegatorRewardPeriods := v0_15incentive.MultiRewardPeriods{}
 | 
			
		||||
	for _, rp := range incentiveGS.Params.HardDelegatorRewardPeriods {
 | 
			
		||||
		rewardsPerSecond := sdk.NewCoins(rp.RewardsPerSecond, SwpRewardsPerSecond)
 | 
			
		||||
		hardDelegatorRewardPeriod := v0_15incentive.NewMultiRewardPeriod(rp.Active,
 | 
			
		||||
		rewardsPerSecond := sdk.NewCoins(rp.RewardsPerSecond, SwpDelegatorRewardsPerSecond)
 | 
			
		||||
		delegatorRewardPeriod := v0_15incentive.NewMultiRewardPeriod(rp.Active,
 | 
			
		||||
			rp.CollateralType, rp.Start, rp.End, rewardsPerSecond)
 | 
			
		||||
		hardDelegatorRewardPeriods = append(hardDelegatorRewardPeriods, hardDelegatorRewardPeriod)
 | 
			
		||||
		delegatorRewardPeriods = append(delegatorRewardPeriods, delegatorRewardPeriod)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	swapRewardPeriods := v0_15incentive.DefaultMultiRewardPeriods
 | 
			
		||||
	// TODO add expected swap reward periods
 | 
			
		||||
	// TODO: finalize swap reward pool IDs, rewards per second, start/end times. Should swap rewards start active?
 | 
			
		||||
	swapRewardPeriods := v0_15incentive.MultiRewardPeriods{}
 | 
			
		||||
 | 
			
		||||
	// Build new params from migrated values
 | 
			
		||||
	params := v0_15incentive.NewParams(
 | 
			
		||||
		usdxMintingRewardPeriods,
 | 
			
		||||
		migrateMultiRewardPeriods(incentiveGS.Params.HardSupplyRewardPeriods),
 | 
			
		||||
		migrateMultiRewardPeriods(incentiveGS.Params.HardBorrowRewardPeriods),
 | 
			
		||||
		hardDelegatorRewardPeriods,
 | 
			
		||||
		delegatorRewardPeriods,
 | 
			
		||||
		swapRewardPeriods,
 | 
			
		||||
		newMultipliers,
 | 
			
		||||
		incentiveGS.Params.ClaimEnd,
 | 
			
		||||
 | 
			
		||||
@ -28,7 +28,9 @@ var (
 | 
			
		||||
	ChainID     = "kava-8"
 | 
			
		||||
	// TODO: update SWP reward per second amount before production
 | 
			
		||||
	// TODO: add swap tokens to kavadist module account
 | 
			
		||||
	SwpRewardsPerSecond = sdk.NewCoin("swp", sdk.OneInt())
 | 
			
		||||
	// TODO: update SWP reward per second amount before production
 | 
			
		||||
	SwpDelegatorRewardsPerSecond         = sdk.NewCoin("swp", sdk.OneInt())
 | 
			
		||||
	SwpLiquidityProviderRewardsPerSecond = sdk.NewCoin("swp", sdk.OneInt())
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// Migrate translates a genesis file from kava v0.14 format to kava v0.15 format
 | 
			
		||||
@ -269,6 +271,9 @@ func Committee(genesisState v0_14committee.GenesisState) v0_15committee.GenesisS
 | 
			
		||||
	newHardSubParamPermissions.AllowedMoneyMarkets = newMoneyMarketParams
 | 
			
		||||
	newHardCommitteePermissions = append(newHardCommitteePermissions, newHardSubParamPermissions)
 | 
			
		||||
 | 
			
		||||
	// Text permissions
 | 
			
		||||
	newHardCommitteePermissions = append(newHardCommitteePermissions, v0_15committee.TextPermission{})
 | 
			
		||||
 | 
			
		||||
	// Set hard governance committee permissions
 | 
			
		||||
	permissionedHardGovCom := hardGovCom.SetPermissions(newHardCommitteePermissions)
 | 
			
		||||
	committees = append(committees, permissionedHardGovCom)
 | 
			
		||||
@ -282,7 +287,7 @@ func Committee(genesisState v0_14committee.GenesisState) v0_15committee.GenesisS
 | 
			
		||||
		[]v0_15committee.Permission{}, swpGovThreshold, swpGovDuration, v0_15committee.Deadline,
 | 
			
		||||
		swpGovQuorum, "swp")
 | 
			
		||||
 | 
			
		||||
	// Add swap money market committee permissions
 | 
			
		||||
	// Add swap committee permissions
 | 
			
		||||
	var newSwapCommitteePermissions []v0_15committee.Permission
 | 
			
		||||
	var newSwapSubParamPermissions v0_15committee.SubParamChangePermission
 | 
			
		||||
 | 
			
		||||
@ -294,8 +299,12 @@ func Committee(genesisState v0_14committee.GenesisState) v0_15committee.GenesisS
 | 
			
		||||
		v0_15committee.AllowedParam{Subspace: "incentive", Key: "SwapRewardPeriods"},
 | 
			
		||||
	}
 | 
			
		||||
	newSwapSubParamPermissions.AllowedParams = swpAllowedParams
 | 
			
		||||
 | 
			
		||||
	newSwpCommitteePermissions := append(newSwapCommitteePermissions, newSwapSubParamPermissions)
 | 
			
		||||
 | 
			
		||||
	// Text permissions
 | 
			
		||||
	newSwpCommitteePermissions = append(newSwpCommitteePermissions, v0_15committee.TextPermission{})
 | 
			
		||||
 | 
			
		||||
	// Set swap governance committee permissions
 | 
			
		||||
	permissionedSwapGovCom := swpGovCom.SetPermissions(newSwpCommitteePermissions)
 | 
			
		||||
	committees = append(committees, permissionedSwapGovCom)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user