This file contains 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
contract Exchange { | |
event LogError(string errorMessage); | |
function executeOrder( | |
address _buyerEOA, | |
address _sellerEOA, | |
address _tokenAddress, | |
uint _etherAmount, | |
uint _tokenAmount, | |
uint _expirationBlock |
This file contains 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
const STK = artifacts.require('./STK.sol') | |
// To access the deployed contract, truffle migrate | |
const stk = await STK.deployed() | |
// To deploy a new STK contract | |
const newStk = await STK.new(<constructor params>) | |
// These 2 addresses are NOT the same | |
assert(newStk.address != stk.address) |
This file contains 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
<h3>Active Account</h3> | |
<DropDownMenu maxHeight={300} width={500} value={this.state.defaultAccount} onChange={this.handleDropDownChange}> | |
{this.state.availableAccounts} | |
</DropDownMenu> | |
<h3>Account Balances</h3> | |
<p className="App-intro">{this.state.ethBalance / 1e18} ETH</p> | |
<p className="App-intro"> {this.state.tokenBalance} {this.state.tokenSymbol}</p> | |
<br/> |
This file contains 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
<h3>Submit an Order!</h3> | |
<p>The default exchange supports only the pairing of {this.state.tokenSymbol} / ETH</p> | |
<TextField floatingLabelText="Bid" style={{width: 75}} value={this.state.tokenSymbol} /> | |
<TextField floatingLabelText="Amount" style={{width: 75}} value={this.state.bidAmount} | |
onChange={(e, bidAmount) => this.setState({ bidAmount })} | |
/> | |
<TextField floatingLabelText="Ask" style={{width: 75}} value="ETH" /> | |
<TextField floatingLabelText="Amount" style={{width: 75}} value={this.state.askAmount} | |
onChange={(e, askAmount) => this.setState({ askAmount })} | |
/> |
This file contains 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
// Submit a new order to the order book. | |
submitOrder() { | |
const { askAmount, bidAmount, defaultAccount, exchange, token } = this.state | |
const from = this.web3.eth.accounts[defaultAccount] | |
const gas = 1e6 | |
// First give the exchange the appropriate allowance | |
token.approve(exchange.address, bidAmount, { from, gas }, | |
(err, res) => { | |
if (err) { |
This file contains 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
<h3>Order Book</h3> | |
<p>Select an order to execute!</p> | |
<RaisedButton label="Execute Order" labelPosition="after" style={{width: 300}} secondary={true} | |
onClick={() => this.executeOrder(this.selectedOrder)} | |
/> | |
<Table style={{ maxHeight: 500, overflow: "auto" }} fixedHeader={true} multiSelectable={false} | |
onRowSelection={r => { if (this.state.orderBook[r[0]]) this.selectedOrder = this.state.orderBook[r[0]].key}}> | |
<TableHeader> | |
<TableRow> | |
<TableHeaderColumn>Maker</TableHeaderColumn> |
This file contains 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
pragma solidity 0.4.24; | |
contract TicTacToe { | |
address public player1_; | |
address public player2_; | |
/** The game board itself | |
* 0, 1, 2 |
This file contains 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 logo from './blg.jpg'; | |
import './App.css'; | |
// Import the web3 library | |
import Web3 from 'web3' | |
import ipfsAPI from 'ipfs-api' | |
// Material UI | |
import MenuItem from 'material-ui/MenuItem'; |
This file contains 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
const { sendRequest } = require('../controller/src/utils/requests'); | |
const { API_PATH, SERVER_PORT } = require('../controller/src/constants'); | |
// const apiUrl = `${API_PATH}:${SERVER_PORT}`; | |
const apiUrl = 'http://23.96.29.24:3000' | |
// Pass in number of assets to add as command line arg | |
const assetsToAdd = process.argv[2] || 2; | |
const type = 'goat'; | |
const inputs = [ 'test' ]; |
This file contains 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
const { sendRequest } = require('../controller/src/utils/requests'); | |
const { API_PATH, SERVER_PORT } = require('../controller/src/constants'); | |
// const apiUrl = `${API_PATH}:${SERVER_PORT}`; | |
const apiUrl = 'http://23.96.29.24:3000' | |
// Pass in number of assets to add as command line arg | |
const assetsToAdd = process.argv[2] || 2; | |
const type = 'goat'; | |
const inputs = [ 'test' ]; |
OlderNewer