-
Notifications
You must be signed in to change notification settings - Fork 0
/
LiquidityPool.h
39 lines (29 loc) · 930 Bytes
/
LiquidityPool.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef LIQUIDITY_POOL_H
#define LIQUIDITY_POOL_H
#include <mutex>
class LiquidityPool {
private:
double dai;
double eth;
protected:
void addDai(double amount);
void addEth(double amount);
void removeDai(double amount);
void removeEth(double amount);
void setDai(double amount);
void setEth(double amount);
public:
LiquidityPool(double initialDai, double initialEth);
double getDai() const;
double getEth() const;
double getK() const;
virtual double swapDaiToEth(double daiAmount) = 0;
virtual double swapEthToDai(double ethAmount) = 0;
virtual bool addLiquidity(double daiAmount, double ethAmount) = 0;
virtual bool removeLiquidity(double daiAmount, double ethAmount) = 0;
virtual double getSwapFee() const = 0;
virtual void setSwapFee(double fee) = 0;
virtual std::mutex& getMutex() = 0;
virtual ~LiquidityPool() = default;
};
#endif