Skip to content

Commit

Permalink
Feat/earn api e2e testing (#259)
Browse files Browse the repository at this point in the history
* chore: fix wasm type spell issue

* chore: update commitment proto for cw part

* chore: add apr param

* chore: add apr and change committed and vested token struct as a pointer

* chore: fix coin unsort issue in config.yml

* chore: add usdc staking and unstaking

* chore: update config.yml

* chore: add separated pool multiplier for stable stake

* chore: implement withdraw all denom per program

* chore: fix unit test and stable stake lp token balance

* chore: fix unit test issue

* chore: add custom queries for vesting info

* chore: remove hard coded epoch counts

* chore: change the order of epoch keepr initialization to avoid kv store failure

* chore: add apr implementation except usdc apr for elys staking

* chore: use 10elys instead of 1

* chore: track dex rewards for stakers

* chore: unixmilli to unix

* resolve unit test on amm and leveragelp

* push simplification for amm, leveragelp and commitment

* chore: fix bug with cancel vesting

* chore: fix cancel vest and vesting

* chore: fix unit test with cancel vest

* chore: update remove completed vesting logic

* chore: add spot price query

* chore: add amm price by denom qwasm bindings

---------

Co-authored-by: kenta-elys <kenta@elys.enetwork>
Co-authored-by: jelysn <jun@elys.network>
  • Loading branch information
3 people authored Nov 23, 2023
1 parent 4cf6bef commit 08dc220
Show file tree
Hide file tree
Showing 102 changed files with 3,692 additions and 4,374 deletions.
42 changes: 22 additions & 20 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,11 @@ func NewElysApp(
)
assetprofileModule := assetprofilemodule.NewAppModule(appCodec, app.AssetprofileKeeper, app.AccountKeeper, app.BankKeeper)

app.EpochsKeeper = *epochsmodulekeeper.NewKeeper(
appCodec,
keys[epochsmoduletypes.StoreKey],
)

commitmentKeeper := *commitmentmodulekeeper.NewKeeper(
appCodec,
keys[commitmentmoduletypes.StoreKey],
Expand Down Expand Up @@ -737,6 +742,17 @@ func NewElysApp(
)
ammModule := ammmodule.NewAppModule(appCodec, app.AmmKeeper, app.AccountKeeper, app.BankKeeper)

app.StablestakeKeeper = *stablestakekeeper.NewKeeper(
appCodec,
keys[stablestaketypes.StoreKey],
keys[stablestaketypes.MemStoreKey],
app.GetSubspace(stablestaketypes.ModuleName),
app.BankKeeper,
&app.CommitmentKeeper,
app.AssetprofileKeeper,
)
stablestake := stablestake.NewAppModule(appCodec, app.StablestakeKeeper, app.AccountKeeper, app.BankKeeper)

app.IncentiveKeeper = *incentivemodulekeeper.NewKeeper(
appCodec,
keys[incentivemoduletypes.StoreKey],
Expand All @@ -749,6 +765,8 @@ func NewElysApp(
app.AmmKeeper,
app.OracleKeeper,
app.AssetprofileKeeper,
app.EpochsKeeper,
app.StablestakeKeeper,
authtypes.FeeCollectorName,
DexRevenueCollectorName,
)
Expand Down Expand Up @@ -782,11 +800,6 @@ func NewElysApp(
)
burnerModule := burnermodule.NewAppModule(appCodec, app.BurnerKeeper, app.AccountKeeper, app.BankKeeper)

app.EpochsKeeper = *epochsmodulekeeper.NewKeeper(
appCodec,
keys[epochsmoduletypes.StoreKey],
)

app.ParameterKeeper = *parametermodulekeeper.NewKeeper(
appCodec,
keys[parametermoduletypes.StoreKey],
Expand Down Expand Up @@ -921,17 +934,6 @@ func NewElysApp(
)
clockModule := clockmodule.NewAppModule(appCodec, app.ClockKeeper)

app.StablestakeKeeper = *stablestakekeeper.NewKeeper(
appCodec,
keys[stablestaketypes.StoreKey],
keys[stablestaketypes.MemStoreKey],
app.GetSubspace(stablestaketypes.ModuleName),
app.BankKeeper,
&app.CommitmentKeeper,
app.AssetprofileKeeper,
)
stablestake := stablestake.NewAppModule(appCodec, app.StablestakeKeeper, app.AccountKeeper, app.BankKeeper)

app.LeveragelpKeeper = *leveragelpmodulekeeper.NewKeeper(
appCodec,
keys[leveragelpmoduletypes.StoreKey],
Expand Down Expand Up @@ -1079,6 +1081,7 @@ func NewElysApp(
// Note: epochs' begin should be "real" start of epochs, we keep epochs beginblock at the beginning
epochsmoduletypes.ModuleName,
minttypes.ModuleName,
stablestaketypes.ModuleName,
incentivemoduletypes.ModuleName,
slashingtypes.ModuleName,
evidencetypes.ModuleName,
Expand Down Expand Up @@ -1109,7 +1112,6 @@ func NewElysApp(
accountedpoolmoduletypes.ModuleName,
transferhooktypes.ModuleName,
clockmoduletypes.ModuleName,
stablestaketypes.ModuleName,
leveragelpmoduletypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/beginBlockers
)
Expand All @@ -1126,6 +1128,7 @@ func NewElysApp(
capabilitytypes.ModuleName,
authtypes.ModuleName,
banktypes.ModuleName,
stablestaketypes.ModuleName,
incentivemoduletypes.ModuleName,
slashingtypes.ModuleName,
minttypes.ModuleName,
Expand All @@ -1150,7 +1153,6 @@ func NewElysApp(
accountedpoolmoduletypes.ModuleName,
transferhooktypes.ModuleName,
clockmoduletypes.ModuleName,
stablestaketypes.ModuleName,
leveragelpmoduletypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/endBlockers
)
Expand All @@ -1164,6 +1166,8 @@ func NewElysApp(
capabilitytypes.ModuleName,
authtypes.ModuleName,
banktypes.ModuleName,
epochsmoduletypes.ModuleName,
stablestaketypes.ModuleName,
incentivemoduletypes.ModuleName,
stakingtypes.ModuleName,
slashingtypes.ModuleName,
Expand All @@ -1182,7 +1186,6 @@ func NewElysApp(
upgradetypes.ModuleName,
vestingtypes.ModuleName,
consensusparamtypes.ModuleName,
epochsmoduletypes.ModuleName,
assetprofilemoduletypes.ModuleName,
oracletypes.ModuleName,
commitmentmoduletypes.ModuleName,
Expand All @@ -1195,7 +1198,6 @@ func NewElysApp(
accountedpoolmoduletypes.ModuleName,
transferhooktypes.ModuleName,
clockmoduletypes.ModuleName,
stablestaketypes.ModuleName,
leveragelpmoduletypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/initGenesis
}
Expand Down
66 changes: 37 additions & 29 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ accounts:
- 9000000000000000uelys
- name: cw
coins:
- 1000000000000uatom
- 9000000000000000uelys
- 1000000000000uusdc
- 1000000000000uusdt
mnemonic: wool diet nasty illness balcony life grunt truck verify later raise carpet describe victory snack sand struggle better smart purse miss bicycle copy orphan
build:
main: cmd/elysd
Expand Down Expand Up @@ -198,7 +201,7 @@ genesis:
transferLimit: ""
unitDenom: ""
commitEnabled: true
withdrawEnabled: false
withdrawEnabled: true
epochs:
epochs:
- identifier: week
Expand Down Expand Up @@ -232,66 +235,66 @@ genesis:
- base_denom: ueden
vesting_denom: uelys
epoch_identifier: tenseconds
num_epochs: "10"
num_epochs: "100"
vest_now_factor: "90"
num_max_vestings: "10"
commitments:
- creator: elys1v30pe777dj9mgsnlv0j2c5wh05m0ya0nlhuv7t
committed_tokens:
- amount: "10000"
denom: uusdc
- amount: "10000"
denom: ueden
- amount: "10000"
denom: uedenb
rewards_unclaimed:
- amount: "10000"
denom: uusdc
- amount: "10000"
- amount: "1000000"
denom: ueden
- amount: "10000"
- amount: "1000000"
denom: uedenb
vesting_tokens:
- denom: ueden
total_amount: "10000"
unvested_amount: "10000"
epoch_identifier: "day"
num_epochs: 100
current_epoch: 5
- amount: "1000000"
denom: uusdc
vesting_tokens: []
rewards_by_usdc_unclaimed:
- denom: ueden
amount: "2000"
amount: "200000"
- denom: uedenb
amount: "200000"
- denom: uusdc
amount: "2000"
amount: "200000"
rewards_by_elys_unclaimed:
- denom: ueden
amount: "3000"
amount: "300000"
- denom: uedenb
amount: "200000"
- denom: uusdc
amount: "3000"
amount: "300000"
rewards_by_eden_unclaimed:
- denom: ueden
amount: "3000"
amount: "300000"
- denom: uedenb
amount: "200000"
- denom: uusdc
amount: "3000"
amount: "300000"
rewards_by_edenb_unclaimed:
- denom: ueden
amount: "2000"
amount: "200000"
- denom: uedenb
amount: "200000"
- denom: uusdc
amount: "200"
amount: "200000"
incentive:
params:
lp_incentives:
- amount: "10000000"
epoch_identifier: week
- amount: "100000000000"
epoch_identifier: tenseconds
start_time: "2023-04-20T12:34:56.789Z"
num_epochs: "50"
num_epochs: "3154000"
current_epoch: "0"
eden_boost_apr: "100"
stake_incentives:
- amount: "10000000"
epoch_identifier: week
- amount: "100000000000"
epoch_identifier: tenseconds
start_time: "2023-04-20T12:34:56.789Z"
num_epochs: "50"
num_epochs: "3154000"
current_epoch: "0"
eden_boost_apr: "100"
community_tax: "0.02"
Expand Down Expand Up @@ -380,6 +383,11 @@ genesis:
bandTicker: "USDT"
elysTicker: "USDT"
decimal: 6
- denom: "uusdc"
display: "USDC"
bandTicker: "USDC"
elysTicker: "USDC"
decimal: 6
params:
ask_count: "4"
band_channel_source: "channel-0"
Expand Down
Loading

0 comments on commit 08dc220

Please sign in to comment.