Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: more incentive test flows #2124

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
994d52d
scenario test: no bonded users at program end
toteki Jun 30, 2023
85fbc77
Merge branch 'main' into adam/test
toteki Jun 30, 2023
101eba9
additional scenario tests
toteki Jun 30, 2023
166ba4b
add test flow 3
Jul 6, 2023
ce9773e
add TestPartialWithdraw and TestUserSupplyBeforeAndDuring test scenarios
Jul 6, 2023
e893041
Merge branch 'main' into adam/test
toteki Jul 6, 2023
190161a
suggestion for TestZeroBondedAtProgramEnd
toteki Jul 6, 2023
70bcd4b
Update x/incentive/keeper/scenario_test.go
toteki Jul 6, 2023
a6a5204
spacing
toteki Jul 6, 2023
1810126
suggestions implemented for TestZeroBonded
toteki Jul 6, 2023
9d18203
adjust whitespace and shorted sdk.Coins vars
toteki Jul 7, 2023
18e9a5d
godoc all test scenarios
toteki Jul 7, 2023
0178c9e
Merge branch 'main' into adam/test
toteki Jul 7, 2023
98500d0
Update util/coin/fixtures.go
toteki Jul 7, 2023
fe35840
comment++
toteki Jul 7, 2023
1bc86a0
Update x/incentive/keeper/scenario_test.go
toteki Jul 7, 2023
65efef3
final scenario
toteki Jul 7, 2023
6b8394c
readme++
toteki Jul 7, 2023
afc5b5d
Merge branch 'main' into adam/test
toteki Jul 7, 2023
234c0d7
Merge branch 'main' into adam/test
toteki Jul 11, 2023
5c70b20
zeroCoins
toteki Jul 11, 2023
0c0cf21
readme
toteki Jul 11, 2023
85c5406
suggestions lines 283-344 and test fix
toteki Jul 11, 2023
091e060
defaultSetup
toteki Jul 11, 2023
b571459
move function
toteki Jul 11, 2023
647b38a
comment++
toteki Jul 11, 2023
92a1c57
Update x/incentive/keeper/scenario_test.go
toteki Jul 11, 2023
a8b175b
fix
toteki Jul 11, 2023
d1dddf5
check bob rewards
toteki Jul 11, 2023
866ad31
calculations
toteki Jul 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions util/coin/fixtures.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ var (
Dollar = "dollar"
)

// UmeeCoins creates an Umee (uumee) sdk.Coins with given amount
func UmeeCoins(amount int64) sdk.Coins {
return sdk.NewCoins(sdk.NewInt64Coin(umee, amount))
}

// UmeeDec creates a Umee (uumee) DecCoin with given amount
func UmeeDec(amount string) sdk.DecCoin {
return Dec(appparams.BondDenom, amount)
Expand Down
8 changes: 7 additions & 1 deletion x/incentive/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ A user can bond their `x/leverage` collaterized `uTokens` in a `x/incentive` mod

Bonding prevents the user from using any `leverage.MsgDecollateralize` or `leverage.MsgWithdraw` which would reduce the user's collateral below the bonded amount.

**Example:** a user has `100 u/UMEE` and `50 u/UMEE` collateral in the leverage module. `40 u/UMEE` from that `50 u/UMEE` is bonded in the incentive module. Their maximum `leverage.MsgDecollateralize` allowed by their bond is `10 u/UMEE` and their maximum `leverage.MsgWithdraw` is `110u/UMEE`.
**Example:** a user has `100 u/UMEE` in their wallet and `50 u/UMEE` collateral in the leverage module. `40 u/UMEE` from that `50 u/UMEE` is bonded in the incentive module. Their maximum `leverage.MsgDecollateralize` allowed by their bond is `10 u/UMEE` and their maximum `leverage.MsgWithdraw` is `110u/UMEE`.

Bonded collateral is eligible for incentive program rewards as long as it is not currently unbonding.

Expand Down Expand Up @@ -67,6 +67,12 @@ Reward distribution math is

When multiple incentive programs are active simultaneously, they compute their rewards independently.

Additionally, if no users are bonded while it is active, a program refrains from distributing any rewards until bonded users exist.

For example, an incentive program which saw no bonded users for the first 25% of its duration would distribute 100% of its rewards over the remaining 75% duration.

If no users are bonded at the end of an incentive program, it will end with nonzero `RemainingRewards` and those rewards will stay in the module balance.

### Claiming Rewards

A user can claim rewards for all of their bonded uTokens at once using `MsgClaim`. When a user claims rewards, an appropriate amount of tokens are sent from the `x/incentive` module account to their wallet.
Expand Down
Loading