diff --git a/x/commitment/types/message_stake.go b/x/commitment/types/message_stake.go index fe8ac4666..431bc53f6 100644 --- a/x/commitment/types/message_stake.go +++ b/x/commitment/types/message_stake.go @@ -9,9 +9,10 @@ const TypeMsgStake = "stake" var _ sdk.Msg = &MsgStake{} -func NewMsgStake(creator string, amount sdk.Int, asset string, validatorAddress string) *MsgStake { +func NewMsgStake(address string, amount sdk.Int, asset string, validatorAddress string) *MsgStake { return &MsgStake{ - Creator: creator, + Creator: address, + Address: address, Amount: amount, Asset: asset, ValidatorAddress: validatorAddress, diff --git a/x/commitment/types/message_unstake.go b/x/commitment/types/message_unstake.go index 9bb21219a..1303faac4 100644 --- a/x/commitment/types/message_unstake.go +++ b/x/commitment/types/message_unstake.go @@ -9,9 +9,10 @@ const TypeMsgUnstake = "unstake" var _ sdk.Msg = &MsgUnstake{} -func NewMsgUnstake(creator string, amount sdk.Int, asset string, validatorAddress string) *MsgUnstake { +func NewMsgUnstake(address string, amount sdk.Int, asset string, validatorAddress string) *MsgUnstake { return &MsgUnstake{ - Creator: creator, + Creator: address, + Address: address, Amount: amount, Asset: asset, ValidatorAddress: validatorAddress, diff --git a/x/incentive/keeper/apr.go b/x/incentive/keeper/apr.go index 8f794e953..806d338f4 100644 --- a/x/incentive/keeper/apr.go +++ b/x/incentive/keeper/apr.go @@ -118,7 +118,10 @@ func (k Keeper) CalculateApr(ctx sdk.Context, query *types.QueryAprRequest) (sdk // Calc Eden price in usdc // We put Elys as denom as Eden won't be avaialble in amm pool and has the same value as Elys - edenPrice := k.EstimatePrice(ctx, sdk.NewCoin(ptypes.Elys, sdk.NewInt(10)), baseCurrency) + edenPrice := k.EstimatePrice(ctx, sdk.NewCoin(ptypes.Elys, sdk.NewInt(1000000)), baseCurrency) + if edenPrice.IsZero() { + return sdk.ZeroInt(), nil + } // Update total committed states k.UpdateTotalCommitmentInfo(ctx, baseCurrency) @@ -131,7 +134,7 @@ func (k Keeper) CalculateApr(ctx sdk.Context, query *types.QueryAprRequest) (sdk // Usdc apr for elys staking = (24 hour dex rewards in USDC generated for stakers) * 365*100/ {price ( elys/usdc)*( sum of (elys staked, Eden committed, Eden boost committed))} // we multiply 10 as we have use 10elys as input in the price estimation - apr := amtDexRewardPerDay.MulInt(sdk.NewInt(ptypes.DaysPerYear)).MulInt(sdk.NewInt(100)).MulInt(sdk.NewInt(10)).QuoInt(edenPrice).QuoInt(totalStakedSnapshot) + apr := amtDexRewardPerDay.MulInt(sdk.NewInt(ptypes.DaysPerYear)).MulInt(sdk.NewInt(100)).MulInt(sdk.NewInt(1000000)).QuoInt(edenPrice).QuoInt(totalStakedSnapshot) return apr.TruncateInt(), nil }