-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,27 @@ contract Splitter is Ownable { | |
address public carolAddress; | ||
uint aliceContribution; | ||
|
||
function Splitter(address _bob, address _carol) | ||
This comment has been minimized.
Sorry, something went wrong. |
||
public | ||
{ | ||
bobAddress = _bob; | ||
carolAddress = _carol; | ||
} | ||
|
||
function setBobAddress(address _address) | ||
external | ||
onlyOwner | ||
{ | ||
This comment has been minimized.
Sorry, something went wrong.
rob-Hitchens
|
||
bobAddress = _address; | ||
} | ||
This comment has been minimized.
Sorry, something went wrong.
rob-Hitchens
|
||
|
||
function setCarolAddress(address _address) | ||
external | ||
onlyOwner | ||
{ | ||
carolAddress = _address; | ||
} | ||
|
||
function splitFunds(uint _aliceContribution) | ||
This comment has been minimized.
Sorry, something went wrong.
rob-Hitchens
|
||
public | ||
payable | ||
|
@@ -29,4 +50,12 @@ contract Splitter is Ownable { | |
return (aliceContribution == this.balance); | ||
This comment has been minimized.
Sorry, something went wrong.
rob-Hitchens
|
||
} | ||
|
||
function kill() | ||
public | ||
{ | ||
if (msg.sender == owner) { | ||
selfdestruct(owner); | ||
This comment has been minimized.
Sorry, something went wrong.
rob-Hitchens
|
||
} | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet'> | ||
<title>Splitter Contract</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
|
||
<script src="build.js"></script> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
body{ | ||
font-family: 'open sans'; | ||
margin: 0; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import * as React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import Web3 from 'web3'; | ||
import './../css/index.css'; | ||
|
||
class App extends React.Component { | ||
|
||
render() { | ||
<div>Hello Splitter</div> | ||
} | ||
} | ||
|
||
ReactDOM.render( | ||
<App />, | ||
document.getElementById('root') | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,13 +2,15 @@ var Splitter = artifacts.require("./Splitter.sol"); | |
|
||
contract("Splitter contract", (accounts) => { | ||
let ownerAlice = accounts[0]; | ||
let Bob = accounts[2]; | ||
let Carol = accounts[3]; | ||
let _bob = accounts[1]; | ||
let _carol = accounts[2]; | ||
|
||
beforeEach(() => { | ||
return Splitter.new({ from: owner }) | ||
return Splitter.new(_bob, _carol, { from: owner }) | ||
.then(instance => { | ||
contract = instance; | ||
bobAddress = _bob; | ||
carolAddress = _carol; | ||
This comment has been minimized.
Sorry, something went wrong.
xavierlepretre
|
||
}); | ||
}); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const path = require('path') | ||
module.exports = { | ||
entry: path.join(__dirname, 'src/js', 'index.js'), // Our frontend will be inside the src folder | ||
output: { | ||
path: path.join(__dirname, 'dist'), | ||
filename: 'build.js' // The final file will be created in dist/build.js | ||
}, | ||
module: { | ||
loaders: [{ | ||
test: /\.css$/, // To load the css in react | ||
use: ['style-loader', 'css-loader'], | ||
include: /src/ | ||
}, { | ||
test: /\.jsx?$/, // To load the js and jsx files | ||
loader: 'babel-loader', | ||
exclude: /node_modules/, | ||
query: { | ||
presets: ['es2015', 'react', 'stage-2'] | ||
} | ||
}, { | ||
test: /\.json$/, // To load the json files | ||
loader: 'json-loader' | ||
}] | ||
} | ||
} |
Due to how the EVM works, a missing parameter is in fact
0
. Are you comfortable with your addresses being 0?