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

Helper contract doesn't respect MAX_IN_RATIO #8

Open
fleupold opened this issue Nov 4, 2024 · 1 comment
Open

Helper contract doesn't respect MAX_IN_RATIO #8

fleupold opened this issue Nov 4, 2024 · 1 comment

Comments

@fleupold
Copy link

fleupold commented Nov 4, 2024

Currently, the helper contract may suggest orders that are later on rejected by the verification logic (cf. this settlement).

This is due to certain invariants in the verify function, e.g.

uint256 buyTokenBalance = order.buyToken.balanceOf(address(this));
if (order.buyAmount > bmul(buyTokenBalance, MAX_IN_RATIO)) {
revert BPool_TokenAmountInAboveMaxRatio();
}

Expected behavior

The helper contract only suggests orders which would later on pass verification. In this case the limit amount should be scaled down to comply with MAX_IN_RATIO.

@sunce86
Copy link

sunce86 commented Nov 5, 2024

Related to cowprotocol/services#3102

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

No branches or pull requests

2 participants