Skip to content

Commit

Permalink
fix issues after testing through cli command
Browse files Browse the repository at this point in the history
  • Loading branch information
jelysn committed Apr 11, 2024
1 parent 4ada16a commit 660eaf8
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 95 deletions.
65 changes: 38 additions & 27 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ accounts:
- name: treasury
coins:
- 1000000000000uatom
- 1000000000000uinc
- 1000000000000uusdc
- 1000000000000uusdt
- 9000000000000000uelys
Expand Down Expand Up @@ -333,61 +334,61 @@ genesis:
tokenomics:
airdropList:
- intent: AtomStakers
amount: 9999999
amount: 9999999000000
authority: elys10d07y265gmmuvt4z0w9aw880jnsr700j6z2zm3
- intent: RowanStakersLP
amount: 9999999
amount: 9999999000000
authority: elys10d07y265gmmuvt4z0w9aw880jnsr700j6z2zm3
- intent: Juno
amount: 9999999
amount: 9999999000000
authority: elys10d07y265gmmuvt4z0w9aw880jnsr700j6z2zm3
- intent: Osmo
amount: 9999999
amount: 9999999000000
authority: elys10d07y265gmmuvt4z0w9aw880jnsr700j6z2zm3
- intent: Evmos
amount: 9999999
amount: 9999999000000
authority: elys10d07y265gmmuvt4z0w9aw880jnsr700j6z2zm3
genesisInflation:
inflation:
lmRewards: 9999999
icsStakingRewards: 9999999
communityFund: 9999999
strategicReserve: 9999999
teamTokensVested: 9999999
seedVesting: 9999999
strategicSalesVesting: 9999999
lmRewards: 9999999000000
icsStakingRewards: 9999999000000
communityFund: 9999999000000
strategicReserve: 9999999000000
teamTokensVested: 9999999000000
seedVesting: 9999999000000
strategicSalesVesting: 9999999000000
authority: elys10d07y265gmmuvt4z0w9aw880jnsr700j6z2zm3
timeBasedInflationList:
- startBlockHeight: 1
endBlockHeight: 6307200
description: 1st Year Inflation
authority: elys10d07y265gmmuvt4z0w9aw880jnsr700j6z2zm3
inflation:
lmRewards: 9999999
icsStakingRewards: 9999999
communityFund: 9999999
strategicReserve: 9999999
teamTokensVested: 9999999
lmRewards: 9999999000000
icsStakingRewards: 9999999000000
communityFund: 9999999000000
strategicReserve: 9999999000000
teamTokensVested: 9999999000000
- startBlockHeight: 6307201
endBlockHeight: 12614401
description: 2nd Year Inflation
authority: elys10d07y265gmmuvt4z0w9aw880jnsr700j6z2zm3
inflation:
lmRewards: 9999999
icsStakingRewards: 9999999
communityFund: 9999999
strategicReserve: 9999999
teamTokensVested: 9999999
lmRewards: 9999999000000
icsStakingRewards: 9999999000000
communityFund: 9999999000000
strategicReserve: 9999999000000
teamTokensVested: 9999999000000
- startBlockHeight: 12614402
endBlockHeight: 18921602
description: 3rd Year Inflation
authority: elys10d07y265gmmuvt4z0w9aw880jnsr700j6z2zm3
inflation:
lmRewards: 9999999
icsStakingRewards: 9999999
communityFund: 9999999
strategicReserve: 9999999
teamTokensVested: 9999999
lmRewards: 9999999000000
icsStakingRewards: 9999999000000
communityFund: 9999999000000
strategicReserve: 9999999000000
teamTokensVested: 9999999000000
oracle:
assetInfos:
- denom: "satoshi"
Expand Down Expand Up @@ -497,4 +498,14 @@ genesis:
params:
deposit_denom: "uusdc"
redemption_rate: "1.000000000000000000"
masterchef:
params:
supported_reward_denoms:
- denom: "uinc"
min_amount: "1000000"
reward_portion_for_lps: "0.6"
dex_rewards_lps:
num_blocks: "1"
amount: "0"
max_eden_reward_apr_lps: "0.5"
chain_id: elystestnet-1
26 changes: 13 additions & 13 deletions scripts/examples/masterchef/masterchef.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,31 @@

TREASURY=$(elysd keys show -a treasury --keyring-backend=test)

elysd tx amm create-pool elysd tx amm create-pool 10uatom,10uusdt 10000uatom,10000uusdt --swap-fee=0.00 --exit-fee=0.00 --use-oracle=false --from=treasury --keyring-backend=test --chain-id=elystestnet-1 --yes --gas=1000000
elysd tx amm create-pool 10uatom,10uusdt 20000000000uatom,20000000000uusdt --swap-fee=0.00 --exit-fee=0.00 --use-oracle=false --from=treasury --keyring-backend=test --chain-id=elystestnet-1 --yes --gas=1000000

# single asset add-liquidity
elysd tx amm join-pool 1 2000uatom 90000000000000000 true --from=treasury --keyring-backend=test --chain-id=elystestnet-1 --yes --gas=1000000
elysd tx amm join-pool 1 2000uatom 90000000000000000 --from=treasury --keyring-backend=test --chain-id=elystestnet-1 --yes --gas=1000000
# multiple asset add-liquidity
elysd tx amm join-pool 1 2000uatom,2000uusdt 200000000000000000 true --from=treasury --keyring-backend=test --chain-id=elystestnet-1 --yes --gas=1000000
elysd tx amm join-pool 1 20000000000uatom,20000000000uusdt 1000000000000000000 --from=treasury --keyring-backend=test --chain-id=elystestnet-1 --yes --gas=1000000

# swap
elysd tx amm swap-exact-amount-in 10uatom 1 1 uusdt --from=treasury --keyring-backend=test --chain-id=elystestnet-1 --yes --gas=1000000

elysd query commitment show-commitments $TREASURY
elysd query bank balances $TREASURY
elysd query amm show-pool 1

# query amm swap estimation 5000 ATOM
ATOM=ibc/E2D2F6ADCC68AA3384B2F5DFACCA437923D137C14E86FB8A10207CF3BED0C8D4
USDC=ibc/2180E84E20F5679FCC760D8C165B60F42065DEF7F46A72B447CFF1B7DC6C0A65
elysd q amm swap-estimation-by-denom 5000000000$ATOM $ATOM $USDC
elysd q amm swap-estimation-by-denom 40000000000$USDC $USDC $ATOM
elysd q amm swap-estimation-by-denom 4000000000uelys uelys $USDC
elysd q amm swap-estimation-by-denom 10000000000$USDC $USDC uelys
elysd q amm swap-estimation-by-denom 5000000000$ATOM $ATOM $USDC --node=https://rpc.testnet.elys.network:443
elysd query masterchef pool-info 1
elysd query masterchef params

elysd query amm show-pool 2
# Add external incentive
elysd tx masterchef add-external-incentive uinc 1 41 1041 1000000 --from=treasury --keyring-backend=test --chain-id=elystestnet-1 --yes --gas=1000000
elysd query masterchef external-incentive 0

# Query pending rewards
elysd query masterchef user-pending-reward $TREASURY

# Claim rewards
elysd tx masterchef claim-rewards --pool-ids=1 --from=treasury --keyring-backend=test --chain-id=elystestnet-1 --yes --gas=1000000

# Test flow
# - oracle setup without lifetime
Expand Down
2 changes: 1 addition & 1 deletion x/incentive/types/incentive.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 21 additions & 1 deletion x/incentive/types/query.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions x/masterchef/client/cli/query_cmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,9 @@ func CmdQueryUserRewardInfo() *cobra.Command {

func CmdQueryUserPendingReward() *cobra.Command {
cmd := &cobra.Command{
Use: "user-reward-info",
Short: "shows user reward info",
Example: "elysd q incentive user-reward-info [user]",
Use: "user-pending-reward",
Short: "shows user pending reward",
Example: "elysd q incentive user-pending-reward [user]",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
Expand Down
52 changes: 3 additions & 49 deletions x/masterchef/client/cli/tx_cmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,6 @@ func CmdAddExternalIncentive() *cobra.Command {
return err
}

title, err := cmd.Flags().GetString(cli.FlagTitle)
if err != nil {
return err
}

summary, err := cmd.Flags().GetString(cli.FlagSummary)
if err != nil {
return err
}

metadata, err := cmd.Flags().GetString(cli.FlagMetadata)
if err != nil {
return err
}

signer := clientCtx.GetFromAddress()
if signer == nil {
return errors.New("signer address is missing")
Expand All @@ -68,53 +53,22 @@ func CmdAddExternalIncentive() *cobra.Command {
return errors.New("invalid amount per block")
}

govAddress := sdk.AccAddress(address.Module("gov"))
msg := &types.MsgAddExternalIncentive{
Sender: govAddress.String(),
Sender: signer.String(),
RewardDenom: rewardDenom,
PoolId: poolId,
FromBlock: fromBlock,
ToBlock: toBlock,
AmountPerBlock: amountPerBlock,
}
if err := msg.ValidateBasic(); err != nil {
return err
}

depositStr, err := cmd.Flags().GetString(cli.FlagDeposit)
if err != nil {
return err
}

deposit, err := sdk.ParseCoinsNormalized(depositStr)
if err != nil {
return err
}

govMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{msg}, deposit, signer.String(), metadata, title, summary)
if err != nil {
return err
}

err = tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), govMsg)
if err != nil {
if err := msg.ValidateBasic(); err != nil {
return err
}

return nil
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}

cmd.Flags().String(cli.FlagTitle, "", "title of proposal")
cmd.Flags().String(cli.FlagSummary, "", "summary of proposal")
cmd.Flags().String(cli.FlagMetadata, "", "metadata of proposal")
cmd.Flags().String(cli.FlagDeposit, "", "deposit of proposal")

_ = cmd.MarkFlagRequired(cli.FlagTitle)
_ = cmd.MarkFlagRequired(cli.FlagSummary)
_ = cmd.MarkFlagRequired(cli.FlagMetadata)
_ = cmd.MarkFlagRequired(cli.FlagDeposit)

flags.AddTxFlagsToCmd(cmd)

return cmd
Expand Down
Loading

0 comments on commit 660eaf8

Please sign in to comment.