# How is uniswap/sushiswap distributing their fees?

As i know, Sushiswap is collecting a 0.3% fee that is then divided into two parts

• 0.25% goes to LP providers
• 0.05% goes to treasury for burn

note, 0.5% isn't indicated but I suppose that's the case after looking at code `const BASE_FEE = new Percent(JSBI.BigInt(30), JSBI.BigInt(10000))` and 0.05% has to go somewhere, pancake is burning it for example

Now, As I mentioned above, the fee is defined in frontend code, `JSBI.BigInt(30)`. But I can't find where are they splitting this 30 fee.

There is a code in the backend, a formula that is also stated in Uniswap whitepaper (v2), That might be doing job. They've mentioned 1/6 of growth in sqrt(k) that initially I didn't understand whats how is that related to formula or this fee distribution (yeh, I'm dumb at math things).

My deduction is this - 1/6 (that is roughly 1.16) multiplied by 0.3%, their initial fee and you get 0.048 that is 0.05 right? and since the treasury fee is 0.05 as well, is this the case?

For recheck, I did the same for pancakeswap, which is collecting 0.2% `JSBI.BigInt(20)` fee, doing same as above you get 0.032 that is 0.03, and their treasury distribution is 0.3%.

I know, I might be looking at big coincidence or just number play that might sound a bit stupid for experienced developer, but I will take a risk to ask - In code, Where is shushiswap or uniswap 0.3% fee is divided into LP providers and treasury.

Well, after some research I can answer my question.

I was indeed right, treasury fee is 1/6 (16.6%) of the total fee.

Precisely, the code for this formula is in the core repository:

code

``````unction _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) {
address feeTo = IShuttleFactory(factory).feeTo();
feeOn = feeTo != address(0);
uint _kLast = kLast; // gas savings
if (feeOn) {
if (_kLast != 0) {
uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1));
uint rootKLast = Math.sqrt(_kLast);
if (rootK > rootKLast) {
uint numerator = totalSupply.mul(rootK.sub(rootKLast));
uint denominator = rootK.mul(5).add(rootKLast);
uint liquidity = numerator / denominator;
if (liquidity > 0) _mint(feeTo, liquidity);
}
}
} else if (_kLast != 0) {
kLast = 0;
}
}
``````

And as I mentioned, the total fee is declared in the frontend code as a basis point (0.3%):

code

``````const BASE_FEE = new Percent(JSBI.BigInt(30), JSBI.BigInt(10000))
``````

So, in the case of Uniswap:

0.3\$ is a total fee, this multiplied by 1/6 is 0.05, their treasury fee. If this fee isn't on, LP providers are getting full 0.3%, so turning on the fee won't change anything for traders, they will still pay the same amount but in that case, LP providers will get only 0.25%

• I'm marking this answer as a solution, but I'm not giving any guarantees that I'm right, Working on smart contracts that should manage someone's money is very important and please DYOR carefully! May 19, 2021 at 11:49