This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function submitNumber(uint _number) public payable isState(LotteryState.Open) { | |
require(msg.value >= entryFee, "Minimum entry fee required"); | |
require(entries[_number].add(msg.sender), "Cannot submit the same number more than once"); | |
numbers.push(_number); | |
numberOfEntries++; | |
payable(owner()).transfer(ownerCut); | |
emit NewEntry(msg.sender, _number); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const topupWallet = async (dispatch, account) => { | |
const ramp = new RampInstantSDK({ | |
hostAppName: 'Easy Ether', | |
hostLogoUrl: 'https://alexroan.github.io/easy-ether/static/media/logo-white.86143c9b.png', | |
variant: 'auto', | |
userAddress: account | |
}) | |
.show(); | |
dispatch(rampOpened()); | |
subscribeToRampEvents(dispatch, ramp); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {Component} from 'react'; | |
import {connect} from 'react-redux'; | |
import {Container, Row, Col, Button, Alert} from 'react-bootstrap'; | |
import { loadWeb3 } from './redux/interactions'; | |
import FadeIn from 'react-fade-in'; | |
import { loggingInErrorSelector, loggingInSelector } from './redux/selectors'; | |
class Login extends Component { | |
render() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const loadWeb3 = async (dispatch) => { | |
dispatch(loggingIn()); | |
let web3 = null; | |
try{ | |
web3 = await getWeb3(); | |
dispatch(loggedIn(web3)); | |
loadAccount(dispatch, web3); | |
} | |
catch(error) { | |
dispatch(loginFailed(error)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Web3 from 'web3'; | |
export const getWeb3 = () => | |
new Promise( async (resolve, reject) => { | |
// Modern dapp browsers... | |
if (window.ethereum) { | |
const web3 = new Web3(window.ethereum); | |
try { | |
// Request account access if needed | |
await window.ethereum.enable(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { RampInstantSDK } from '@ramp-network/ramp-instant-sdk'; | |
new RampInstantSDK({hostAppName: 'My DApp', hostLogoUrl: logoUrl, variant: 'auto'}).show(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { loadOwnedPlayers, loadWalletDetails, unselectPlayer, loadSelectedPlayer, checkIfPlayerEnlisted } from "./interactions"; | |
import { playerFinishedResting, playerFinishedTraining, playerCreated, matchFinished } from "./actions"; | |
export const subscribeToTransferEvents = async (dispatch, tennisPlayer, tennisPlayerSocket, account) => { | |
tennisPlayerSocket.events.Transfer({filter: {to: account}}) | |
.on('data', async function(event){ | |
await loadOwnedPlayers(dispatch, tennisPlayer, account); | |
dispatch(playerCreated()); | |
}) | |
.on('error', console.error); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {Component} from 'react'; | |
import {connect} from 'react-redux'; | |
import {Container, Row, Col, Tabs, Tab} from 'react-bootstrap'; | |
import Connections from './Connections'; | |
import PlayerList from "./PlayerList"; | |
import PlayerDetails from "./PlayerDetails"; | |
import PlayerAttributes from './PlayerAttributes'; | |
import Train from './Train'; | |
import Compete from './Compete'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const subscribeToTransferEvents = async (dispatch, tennisPlayer, tennisPlayerSocket, account) => { | |
tennisPlayerSocket.events.Transfer({filter: {to: account}}) | |
.on('data', async function(event){ | |
await loadOwnedPlayers(dispatch, tennisPlayer, account); | |
dispatch(playerCreated()); | |
}) | |
.on('error', console.error); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const loadTennisPlayerContract = async (dispatch, web3, address) => { | |
const instance = new web3.eth.Contract(TennisPlayer.abi, address); | |
dispatch(tennisPlayerLoaded(instance)); | |
return instance; | |
} | |
export const loadTennisPlayerSocket = async (dispatch, web3Socket, address) => { | |
const socketInstance = new web3Socket.eth.Contract(TennisPlayer.abi, address); | |
dispatch(tennisPlayerSocketLoaded(socketInstance)); | |
return socketInstance; |