This repository introduces some critical building blocks Decentralized Finance (DeFi) by creating some simple tests and asking the reader to write code to pass the tests.
Uniswap was the first unicorn protocol on the Ethereum Blockchain. Uniswap was a revolutionary idea that allowed anyone to create a market for any two tokens on the ethereum blockchain. Anyone can swap between two tokens in a contract holding two reserves of each token. The algorithm to calculate a swap uses the invariant
The invariant
- Implement
computeExpectedSwapOut
in computeExpected.js. - Write new tests for a function that does not yet exist
computeExpectedSwapIn
. - Add tests that include a fee of 0.3% being taken in the swap.