Skip to content

Commit

Permalink
Merge branch 'main' of github.com:itssunny322/crypto-bet into main
Browse files Browse the repository at this point in the history
  • Loading branch information
itssunny322 committed Apr 18, 2022
2 parents cf69b01 + 4a71980 commit f80eb1c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
15 changes: 15 additions & 0 deletions contracts/Bet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,18 @@ contract Bet is Ownable, ReentrancyGuard {
int8 _chosenWinner,
uint256 _amount
) public payable notAddress0(msg.sender) nonReentrant {
uint blockNum = block.number;
(
bytes32 id,
string memory name,
string memory teamAname,
string memory teamBname,
uint256 date,
OracleInterface.EventOutcome outcome,
int8 winner
) = getEvent((_eventId));
require(blockNum< date,"Too late to bet");

// At least a minimum amout is required to bet
// require(msg.value >= minimumBet, "Bet amount must be >= minimum bet");

Expand Down Expand Up @@ -556,6 +568,9 @@ contract Bet is Ownable, ReentrancyGuard {
userTokenBal[msg.sender].balanceAvailable = userTokenBal[msg.sender]
.balanceAvailable
.sub(amount);
userTokenBal[msg.sender].balancewithdrawn = userTokenBal[msg.sender]
.balancewithdrawn
.add(amount);
allTokenBalance[tokenAddress] = allTokenBalance[tokenAddress].sub(
amount
);
Expand Down
3 changes: 2 additions & 1 deletion src/components/MatchDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ export default function MatchDetail(props) {
const realvalB = b / 100;
setOddB(realvalB);
const event = await betOracleContract.getEvent(eventId);
console.log(event);
console.table(event);
setevent(event);

};
showbetOdds(id.id);
}, []);
Expand Down

0 comments on commit f80eb1c

Please sign in to comment.