# Track Wei : Week 3

By [lizgeorge](https://paragraph.com/@lizgeorge) · 2023-02-24

---

EIF Fellowship challenges for the week :

1.  **Challenge : Build a Dex**
    
    The challenge was to build a simple decentralized exchange with one token pair (ERC20 and ETH). It helped to understand the concept of Reserves , Automated Market Makers (AMM) where reserves will provide liquidity to swap between the tokens. Tutorial also helped to explore into the Constant formulae (x \* y = K) used in Uniswap v2.
    
    x \* y = k, Where x and y are the balance of the assets in the pool.
    
    Given Δx (Input value), to swap Δx for Δy, Uniswap V2 will perform the following calculation:
    
    \*\*     (x + Δx ) \* (y + Δy) = k\*\*
    
    \*\*     Δy = y - k/(x + Δx )\*\*
    
    We wrote two functions for swapping from each asset to other, `ethToToken()` and `tokenToEth().`
    
    **Deployed App** : [DEX Contract](https://null-kittens.surge.sh/)
    
    **Verified contract address** : [Contract](https://goerli.etherscan.io/address/0x7D8c6F22b53C6Ea89a6451BB288587610cCa84cB)
    
2.  **Challenge : State Channel Application**
    
    State channels is a scaling solution in cases where a fixed set of participants want to exchange value-for-service at high frequency.
    
    For the challenge, the service provider is a `Guru` who provides wisdom to each client `Rube` through a one-way chat box. Each character of text that is delivered is expected to be compensated with a payment in ETH. The **Guru** provides the service in exchange for signed vouchers which can later be redeemed on-chain.
    
    The challenge helped in understanding the signature and its onchain verification using ecrecover function.
    

**Deployed App** : [State Channel Application](https://ashamed-feather.surge.sh/)

**Verified contract address** : [Contract](https://goerli.etherscan.io/address/0x5E2521B70ced0e2244E6EA24135B8FA76528A9E4)

---

*Originally published on [lizgeorge](https://paragraph.com/@lizgeorge/track-wei-week-3)*
