Skip to content

Commit c5b238e

Browse files
committed
Checkpoint 2 done
1 parent 38309e1 commit c5b238e

File tree

2 files changed

+675
-1
lines changed

2 files changed

+675
-1
lines changed

packages/hardhat/contracts/PredictionMarket.sol

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ contract PredictionMarket is Ownable {
3030
/// State Variables //////
3131
//////////////////////////
3232

33+
uint256 public s_ethCollateral;
34+
uint256 public s_lpTradingRevenue;
35+
string public s_question;
36+
37+
address public immutable i_oracle;
38+
uint256 public immutable i_initialTokenValue;
39+
uint256 public immutable i_initialYesProbability;
40+
uint256 public immutable i_percentageLocked;
41+
42+
3343
enum Outcome {
3444
YES,
3545
NO
@@ -78,6 +88,22 @@ contract PredictionMarket is Ownable {
7888
uint8 _percentageToLock
7989
) payable Ownable(_liquidityProvider) {
8090
/// Checkpoint 2 ////
91+
if (msg.value == 0) {
92+
revert PredictionMarket__MustProvideETHForInitialLiquidity();
93+
}
94+
if (_initialYesProbability >= 100 || _initialYesProbability == 0) {
95+
revert PredictionMarket__InvalidProbability();
96+
}
97+
if (_percentageToLock >= 100 || _percentageToLock == 0) {
98+
revert PredictionMarket__InvalidPercentageToLock();
99+
}
100+
101+
i_oracle = _oracle;
102+
s_question = _question;
103+
i_initialTokenValue = _initialTokenValue;
104+
i_initialYesProbability = _initialYesProbability;
105+
i_percentageLocked = _percentageToLock;
106+
s_ethCollateral = msg.value;
81107
/// Checkpoint 3 ////
82108
}
83109

0 commit comments

Comments
 (0)