Skip to content

Conversation

@grasphoper
Copy link
Contributor

@grasphoper grasphoper commented Oct 3, 2025

Updates to ProfitClient logic

We should treat aux fees as a part of gross capital outlay for relayer, otherwise values like grossFeeUsd(the fee relayer is receiving from user directly, but before relayer gas expenditure) and totalFeePct(total fee pct paid by user into the system: relayer + lps) don't make sense

Tests for ProfitClient (SVM-destined deposits only):

  • aux fee = 0 when message is empty
  • when aux fee + gas fee < profit -> check that ProfitClient deems fill profitable
  • when aux fee + gas fee > profit -> check that ProfitClient deems fill unprofitable
  • when aux fee exuberant -> check that ProfitClient deems fill unprofitable

+ sdk bump

Closes ACX-4497

Signed-off-by: Ihor Farion <ihor@umaproject.org>
Signed-off-by: Ihor Farion <ihor@umaproject.org>
Signed-off-by: Ihor Farion <ihor@umaproject.org>
Signed-off-by: Ihor Farion <ihor@umaproject.org>
Signed-off-by: Ihor Farion <ihor@umaproject.org>
Signed-off-by: Ihor Farion <ihor@umaproject.org>
Signed-off-by: Ihor Farion <ihor@umaproject.org>
Signed-off-by: Ihor Farion <ihor@umaproject.org>
Signed-off-by: Ihor Farion <ihor@umaproject.org>
Signed-off-by: Ihor Farion <ihor@umaproject.org>
Signed-off-by: Ihor Farion <ihor@umaproject.org>
@linear
Copy link

linear bot commented Oct 3, 2025

@grasphoper grasphoper marked this pull request as ready for review October 3, 2025 02:15
grasphoper and others added 4 commits October 3, 2025 15:19
…epool.ts

Signed-off-by: Ihor Farion <ihor@umaproject.org>
Signed-off-by: Ihor Farion <ihor@umaproject.org>
Signed-off-by: Ihor Farion <ihor@umaproject.org>
const grossRelayerFeeUsd = inputAmountUsd.sub(outputAmountUsd).sub(lpFeeUsd).sub(auxiliaryNativeTokenCostUsd);
const grossRelayerFeePct = grossRelayerFeeUsd.gt(bnZero)
? grossRelayerFeeUsd.mul(fixedPoint).div(inputAmountUsd)
: bnZero;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cap grossRelayerFeePct at 0 min, and not reporting negative values, whereas we do report negative values netRelayerFeePct (which is also crucial for our min profitability caps because if we drop the minRelayerProfitability to e.g. 0, then we don't want to be filling relays with profitability -100%, which is giving away all of our money).

So should we report negatives for grossRelayerFeePct? We don't really use grossRelayerFeePct anywhere other than in logs, so it's not that mission critical for now.

Also, grossRelayerFeePct is from user POV, whereas netRelayerFeePct is from relayer POV. A bit confusing

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To me it makes sense to have this value go negative. It seems that in cases where auxiliaryNativeTokenCostUsd is nonzero, there are chances for grossRelayerFeeUsd to be negative and that information would just be lost when we floor to 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants