Replicate Solidity code math results in JS

Hi everyone,
I am trying to replicate the result Uniswap provides (for ETH/DAI) with this Tx ( knowing that the last Tx was (, this is where I got the reserves from (communicated above).
I replicated the getAmountOut() function in Uni v2 (Solidity) and adapted it to JS using FixedNumber and/or BigNumber with ethers.js)

BUT I always find 160522461258881396040 instead of 160523449249855866787 :frowning:
Same results in Python…

Could someone confirm it is a lib issue and/or explain to me how to replicate the Solidity code behavior in JS?

Thanks a lot for your help!

1 Like

Hi @ibox,

You may want to check with the Uniswap community on the calculation differences.

will do, thanks @abcoathup