Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
mcchan1 committed Mar 7, 2018
1 parent ad86e8a commit b1afb1c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 48 deletions.
27 changes: 11 additions & 16 deletions contracts/StoreHash.sol
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
pragma solidity ^0.4.17;

//0xb84b12e953f5bcf01b05f926728e855f2d4a67a9 contract address on rinkeby
//deployed using remix

contract Contract {
string ipfsHash;
address public sender;

function sendHash(string x) public {
ipfsHash = x;
}
function notary() {
sender = msg.sender;
}

function getHash() public view returns (string x) {
return ipfsHash;
}
string ipfsHash;

function sendHash(string x) public {
ipfsHash = x;
}

}
//0x2cccd6e8269f0080a094ae8ccf17db93528ca0cd contract address
function getHash() public view returns (string x) {
return ipfsHash;
}
}
2 changes: 1 addition & 1 deletion src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
.App-intro {
font-size: large;
}
/*some css to I added*/
/*some css I added*/
input[type="file"] {
display: inline-block;
}
Expand Down
5 changes: 3 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ class App extends Component {
this.setState({blockNumber:"waiting.."});
this.setState({gasUsed:"waiting..."});

//get Transaction Receipt in console on click
//See: https://web3js.readthedocs.io/en/1.0/web3-eth.html#gettransactionreceipt
// get Transaction Receipt in console on click
// See: https://web3js.readthedocs.io/en/1.0/web3-eth.html#gettransactionreceipt
await web3.eth.getTransactionReceipt(this.state.transactionHash, (err, txReceipt)=>{
console.log(err,txReceipt);
this.setState({txReceipt});
Expand All @@ -68,6 +68,7 @@ class App extends Component {
this.setState({ethAddress});

//save document to IPFS,return its hash#, and set hash# to state
//https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/FILES.md#add
await ipfs.add(this.state.buffer, (err, ipfsHash) => {
console.log(err,ipfsHash);
//setState by setting ipfsHash to ipfsHash[0].hash
Expand Down
34 changes: 5 additions & 29 deletions src/storehash.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,10 @@
import web3 from './web3';

//access our local copy to contract deployed on rinkeby
const address = '0x2cccd6e8269f0080a094ae8ccf17db93528ca0cd';

//access our local copy to contract deployed on rinkeby testnet
//use your own contract address
const address = '0xb84b12e953f5bcf01b05f926728e855f2d4a67a9';
//use the ABI from your contract
const abi = [
{
"constant": true,
"inputs": [],
"name": "sender",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
Expand All @@ -32,15 +19,6 @@ const abi = [
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [],
"name": "notary",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
Expand All @@ -56,6 +34,4 @@ const abi = [
"type": "function"
}
]

export default new web3.eth.Contract(abi, address);
//export {abi, address};
export default new web3.eth.Contract(abi, address);

0 comments on commit b1afb1c

Please sign in to comment.