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

[Bug]: referral program taker fee discounts on trade event where referrer below min stake #9775

Closed
Sohill-Patel opened this issue Oct 13, 2023 · 3 comments · Fixed by #9779
Closed

Comments

@Sohill-Patel
Copy link
Contributor

Problem encountered

referee taker fee discount showing on trade when referrer has no stake

If a referrer removes sufficient stake to not meet the required tokens, the referral set should not be eligible for the following referral benefits:
- the referrer should not be rewarded for any referee taker fees (0083-RFPR-018).
- all referees should not receive any discount on their taker fees (0083-RFPR-019).

Observed behaviour

taker fee discount showing on BUS_EVENT_TYPE_TRADE

{"id":"331-19","block":"F99A9664639E9818AD68F816805485F5D1CD6F603F52BF3AB936CF64186FB354","type":"BUS_EVENT_TYPE_TRADE","trade":{"id":"e4b28f5ecb65cac7b09a38be1d29bd32a66fd7411516aa3f047ac6ecfebcaed4","marketId":"bcd520534a681052235c1dd44c2d266a70accf4a8b680e753e8d1ac5dd3e25c6","price":"100000000","size":"5000000","buyer":"14cfcc3571fa6425f4dc0b6112595d6e6f13cd390c7028c9799eaa9c805368e1","seller":"a8fe5ebc9d8aa68de87e37bac20f38d85297de1ab421456fcd35727ad0c1dcc6","aggressor":"SIDE_SELL","buyOrder":"1c467375309cd6080aef927cb80878bba1cf6f2ffa08b31ce34b331de1753d03","sellOrder":"41162b6f29c5dbde7ffe0d81f6e68bf1f673f70111d6ed7c678a5778578e291f","timestamp":"1697192450878512569","type":"TYPE_DEFAULT","buyerFee":{"makerFee":"0","infrastructureFee":"0","liquidityFee":"0","makerFeeVolumeDiscount":"0","infrastructureFeeVolumeDiscount":"0","liquidityFeeVolumeDiscount":"0","makerFeeReferrerDiscount":"0","infrastructureFeeReferrerDiscount":"0","liquidityFeeReferrerDiscount":"0"},"sellerFee":{"makerFee":"199600000000000000000","infrastructureFee":"49900000000000000000","liquidityFee":"14970000000000000000000","makerFeeVolumeDiscount":"0","infrastructureFeeVolumeDiscount":"0","liquidityFeeVolumeDiscount":"0","makerFeeReferrerDiscount":"400000000000000000","infrastructureFeeReferrerDiscount":"100000000000000000","liquidityFeeReferrerDiscount":"30000000000000000000"}},"version":1,"chainId":"testnet-001","txHash":"9A0736165C01FBF8E6FDC911D887EC64977FAE7EC537B5779CF918AE15D22369"}

Expected behaviour

i would expect the BUS_EVENT_TYPE_TRADE to show taker fee discounts of 0

Steps to reproduce

1. run system-test `test_referral_set_referrer_bug`

Software version

dev branch

Failing test

test_referral_set_referrer_bug

Jenkins run

https://jenkins.vega.rocks/job/common/job/system-tests-wrapper/23171/

Configuration used

No response

Relevant log output

No response

@ze97286
Copy link
Contributor

ze97286 commented Oct 13, 2023

but the discount factor will only be updated for the following epoch - i.e. if some party withdraws their stake during an epoch, they will still be eligible for the discount until the epoch ends. This could be changed is required cc @cdummett

@Sohill-Patel
Copy link
Contributor Author

The test scenario is like this:

referral set created with referrer(with stake) and referee
referral program is created
remove stake from referrer
wait an epoch
check referrer has no stake

trade1 - referee is taker
wait an epoch
trade2 again - referee is taker
wait for epoch <- added this so I can check ledger for referrer rewards (there is none as expected)
check trade2 for taker fees <- the test fails here because it expects no taker fee discount here

@gordsport gordsport moved this to In Progress in Core Kanban Oct 13, 2023
@gordsport gordsport added this to the ☄️ Cosmic Elevator milestone Oct 13, 2023
@ze97286
Copy link
Contributor

ze97286 commented Oct 13, 2023

thanks @Sohill-Patell, fix on the way.

@vega-issues vega-issues moved this from In Progress to Waiting Review in Core Kanban Oct 13, 2023
@vega-issues vega-issues moved this from Waiting Review to In Review in Core Kanban Oct 13, 2023
@vega-issues vega-issues moved this from In Review to Approved in Core Kanban Oct 13, 2023
@github-project-automation github-project-automation bot moved this from Approved to Merged in Core Kanban Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants