From ed6c8bb02969777aa4f3e9f371eb03fc0469de19 Mon Sep 17 00:00:00 2001 From: scheuclu Date: Wed, 23 Feb 2022 19:24:29 +0100 Subject: [PATCH] Added deployment config for Rinkeby --- README.md | 3 --- project-6/src/js/app.js | 4 ++-- project-6/truffle.js | 14 +++++++++++++- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 5d12f6349..e4f6def59 100755 --- a/README.md +++ b/README.md @@ -307,6 +307,3 @@ truffle compile truffle migrate --reset --network rinkeby ``` The contract address is [0x4e9757b26374b166c69eb5443952560b6a18d93b](https://rinkeby.etherscan.io/address/0x4e9757b26374b166c69eb5443952560b6a18d93b) - -### IPFS -The website itself will be hosted on IPFS, making this a truly decentralized service. diff --git a/project-6/src/js/app.js b/project-6/src/js/app.js index a103075df..3fe3f5ead 100755 --- a/project-6/src/js/app.js +++ b/project-6/src/js/app.js @@ -220,7 +220,7 @@ App = { var processId = parseInt($(event.target).data('id')); App.contracts.SupplyChain.deployed().then(function(instance) { - const productPrice = web3.toWei(1, "ether"); + const productPrice = web3.toWei(0.0001, "ether"); console.log('productPrice',productPrice); return instance.sellItem(App.upc, App.productPrice, {from: App.metamaskAccountID}); }).then(function(result) { @@ -236,7 +236,7 @@ App = { var processId = parseInt($(event.target).data('id')); App.contracts.SupplyChain.deployed().then(function(instance) { - const walletValue = web3.toWei(3, "ether"); + const walletValue = web3.toWei(0.002, "ether"); return instance.buyItem(App.upc, {from: App.metamaskAccountID, value: walletValue}); }).then(function(result) { $("#ftc-item").text(result); diff --git a/project-6/truffle.js b/project-6/truffle.js index 4301a1732..756d3b96d 100755 --- a/project-6/truffle.js +++ b/project-6/truffle.js @@ -1,3 +1,9 @@ +const HDWalletProvider = require('truffle-hdwallet-provider'); +const infuraKey = ""; +// +// const fs = require('fs'); +const mnemonic = "mnemonic>"; + module.exports = { // contracts_directory: "./contracts/coffeeaccesscontrol/", networks: { @@ -5,7 +11,13 @@ module.exports = { host: "127.0.0.1", port: 8545, network_id: "*" // Match any network id - } + }, + rinkeby: { + provider: () => new HDWalletProvider(mnemonic, `https://rinkeby.infura.io/v3/${infuraKey}`), + network_id: 4, // rinkeby's id + gas: 4500000, // rinkeby has a lower block limit than mainnet + gasPrice: 10000000000 + }, }, compilers: { solc: {