Skip to content

Add Uniswap Fee#84

Merged
Joeysantoro merged 2 commits intoReleasefrom
Pre-Release-Add-Uniswap-Fee
Mar 3, 2021
Merged

Add Uniswap Fee#84
Joeysantoro merged 2 commits intoReleasefrom
Pre-Release-Add-Uniswap-Fee

Conversation

@Joeysantoro
Copy link
Contributor

The uniswap fee wasn't included in reweights and direct incentive calculations so we needed to add it

uint256 root = radicand.sqrt();
if (root > reserveTarget) {
return root - reserveTarget;
return (root - reserveTarget).mul(1000).div(997);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

need to add in the 30bps to the amount because Uniswap will take them away during the trade

int256 signedReservesFei = reserveFei.toInt256();
uint256 adjustedReserveFei =
signedReservesFei.add(amountFei).toUint256();
int256 amountFeiWithFee = amountFei.mul(997).div(1000);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

need to take away the 30bps that uniswap will when calculating the slippage

@Joeysantoro Joeysantoro merged commit d2a386a into Release Mar 3, 2021
@xklob xklob deleted the Pre-Release-Add-Uniswap-Fee branch September 19, 2021 18:54
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.

2 participants

Comments