Skip to content

Commit

Permalink
fix(upgrade): fix upgrade constants, add liquidstake restriction
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-Ixo committed Nov 28, 2024
1 parent 529158d commit 2bdbc33
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 27 deletions.
20 changes: 8 additions & 12 deletions app/upgrades/v4/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,37 +41,33 @@ const (
// IsSmartAccountActive is used for the smart account circuit breaker, smartaccounts are activated for v4
IsSmartAccountActive = true
// CircuitBreakerController is a DAODAO address, used only to deactivate the smart account module
// https://daodao.zone/dao/osmo1wn58hxkv0869ua7qmz3gvek3sz773l89a778fjqvenl6anwuhgnq6ks7kl/home
CircuitBreakerController = "ixo1kqmtxkggcqa9u34lnr6shy0euvclgatw4f9zz5"
CircuitBreakerController = "ixo15rwc9v3jfvypve8zemdr7y68dydsrh9m2urvjn"
)

var (
// LIQUID STAKE PARAMS
// -------------------------------------------------
// total weights must be 10000
WhitelistedValidators = []liquidstaketypes.WhitelistedValidator{
// Launchpad Validator to start with
{
ValidatorAddress: "ixovaloper1n8yrmeatsk74dw0zs95ess9sgzptd6thzncf20",
TargetWeight: math.NewIntFromUint64(5000),
},
{
ValidatorAddress: "ixovaloper1n8yrmeatsk74dw0zs95ess9sgzptd6thzncf20",
TargetWeight: math.NewIntFromUint64(5000),
ValidatorAddress: "ixovaloper1kr8v9qt46ysltgmzcrtgyw5ckke83up673u2lu",
TargetWeight: math.NewIntFromUint64(10000),
},
}
// LSMUnstakeFeeRate is the Unstake Fee Rate. (note the fee amount stays as staked amount in proxy account, it is not
// instaked and transferred to the FeeAccountAddress)
LSMUnstakeFeeRate = math.LegacyNewDecWithPrec(3333, 4) // "0.333300000000000000"
LSMUnstakeFeeRate = math.LegacyZeroDec()
// LSMAutocompoundFeeRate is the fee rate for auto redelegating the stake rewards.
LSMAutocompoundFeeRate = math.LegacyNewDecWithPrec(3333, 4) // "0.333300000000000000"
LSMAutocompoundFeeRate = math.LegacyZeroDec()
// LSMWhitelistAdminAddress is the address of the whitelist admin, who is allowed to add/remove whitelisted validators,
// pause/unpause the liquid stake module, and set the weighted rewards receivers.
LSMWhitelistAdminAddress = "ixo1kqmtxkggcqa9u34lnr6shy0euvclgatw4f9zz5"
LSMWhitelistAdminAddress = "ixo15rwc9v3jfvypve8zemdr7y68dydsrh9m2urvjn"
// LSMWeightedRewardsReceivers is the list of weighted rewards receivers who will recieve the staking rewards based
// on their weights.
LSMWeightedRewardsReceivers = []liquidstaketypes.WeightedAddress{}
// LSMFeeAccountAddress is the address of the fee account, which will receive the autocompound fees.
LSMFeeAccountAddress = "ixo1kqmtxkggcqa9u34lnr6shy0euvclgatw4f9zz5"
LSMFeeAccountAddress = "ixo15rwc9v3jfvypve8zemdr7y68dydsrh9m2urvjn"

// STAKING PARAMS
// -------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions x/epochs/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ func NewGenesisState(epochs []EpochInfo) *GenesisState {
// DefaultGenesis returns the default Capability genesis state.
func DefaultGenesis() *GenesisState {
epochs := []EpochInfo{
// TODO: comment out 2min, used for testing
NewGenesisEpochInfo("2min", time.Minute*2), // alphabetical order
// TODO: comment out 2min, used for local testing
// NewGenesisEpochInfo("2min", time.Minute*2), // alphabetical order
NewGenesisEpochInfo("day", time.Hour*24),
NewGenesisEpochInfo("hour", time.Hour),
NewGenesisEpochInfo("week", time.Hour*24*7),
Expand Down
5 changes: 5 additions & 0 deletions x/liquidstake/keeper/liquidstake.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ func (k Keeper) LiquidStake(
) (stkIXOMintAmount math.Int, err error) {
params := k.GetParams(ctx)

// only allow the whitelistedAdminAddress to do liquid staking, this might be removed later
if params.WhitelistAdminAddress != liquidStaker.String() {
return math.ZeroInt(), types.ErrRestrictedToWhitelistedAdminAddress
}

if params.ModulePaused {
return math.ZeroInt(), types.ErrModulePaused
}
Expand Down
1 change: 0 additions & 1 deletion x/liquidstake/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ func NewMsgServerImpl(keeper Keeper) types.MsgServer {
return &msgServer{Keeper: keeper}
}

// TODO: only zero dao should be able to liquid stake
// --------------------------
// LIQUID STAKE
// --------------------------
Expand Down
2 changes: 1 addition & 1 deletion x/liquidstake/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw
}

// BeginBlock executes all ABCI BeginBlock logic respective to the capability module.
func (am AppModule) BeginBlock(context sdk.Context) error {
func (am AppModule) BeginBlock(context context.Context) error {
ctx := sdk.UnwrapSDKContext(context)
BeginBlock(ctx, am.keeper)
return nil
Expand Down
1 change: 1 addition & 0 deletions x/liquidstake/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ var (
ErrUnstakeFailed = errors.Register(ModuleName, 18, "Unstaking failed")
ErrRedelegateFailed = errors.Register(ModuleName, 19, "Redelegate failed")
ErrRatioMoreThanOne = errors.Register(ModuleName, 20, "ratio should be less than or equal to 1")
ErrRestrictedToWhitelistedAdminAddress = errors.Register(ModuleName, 21, "this action is restricted to only the whitelisted admin address")
)
10 changes: 5 additions & 5 deletions x/liquidstake/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ const (
StoreKey = ModuleName

// Epoch identifiers
// TODO: comment out 2min it is for local testing
AutocompoundEpoch = "2min"
RebalanceEpoch = "2min"
// AutocompoundEpoch = "hour"
// RebalanceEpoch = "day"
// TODO: comment out 2min, used for local testing
// AutocompoundEpoch = "2min"
// RebalanceEpoch = "2min"
AutocompoundEpoch = "hour"
RebalanceEpoch = "day"
)

var (
Expand Down
12 changes: 6 additions & 6 deletions x/mint/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ func DefaultParams() Params {
return Params{
MintDenom: ixo.IxoNativeToken,
GenesisEpochProvisions: ixomath.NewDec(43_500_000_000), // 43_500 IXO
// TODO: comment out 2min and uncomment day, 2min is for local testing
EpochIdentifier: "2min", // 2 min
ReductionPeriodInEpochs: 1000000, // 14 min
// EpochIdentifier: "day", // 1 day
// ReductionPeriodInEpochs: 365, // 1 years
ReductionFactor: ixomath.NewDecWithPrec(666666666666666666, 18), // 0.666666666666666666
// TODO: comment out 2min, used for local testing
// EpochIdentifier: "2min", // 2 min
// ReductionPeriodInEpochs: 1000000, // 14 min
EpochIdentifier: "day", // 1 day
ReductionPeriodInEpochs: 365, // 1 years
ReductionFactor: ixomath.NewDecWithPrec(666666666666666666, 18), // 0.666666666666666666
DistributionProportions: DistributionProportions{
Staking: ixomath.NewDecWithPrec(1, 0), // 1.0
ImpactRewards: ixomath.NewDecWithPrec(0, 1), // 0.0
Expand Down

0 comments on commit 2bdbc33

Please sign in to comment.