Skip to content
Snippets Groups Projects
Commit ecd68d42 authored by mi3u17's avatar mi3u17
Browse files

changes to Application.java and to bin file

parent c0ea7a31
No related branches found
No related tags found
No related merge requests found
/logback.xml
/org/ /org/
/solidity/
...@@ -109,6 +109,8 @@ public class Application { ...@@ -109,6 +109,8 @@ public class Application {
//Check the contract on Etherscan website //Check the contract on Etherscan website
log.info("View contract at https://ropsten.etherscan.io/address/" + contractAddress); log.info("View contract at https://ropsten.etherscan.io/address/" + contractAddress);
// Test some method provided by web3j library
// String adro = contract.getDeployedAddress("1"); // String adro = contract.getDeployedAddress("1");
// String adrt = contract.getDeployedAddress("2"); // String adrt = contract.getDeployedAddress("2");
// String adrtr = contract.getDeployedAddress("3"); // String adrtr = contract.getDeployedAddress("3");
...@@ -120,13 +122,18 @@ public class Application { ...@@ -120,13 +122,18 @@ public class Application {
// log.info("Smart Contract deployed to address: " + contractAddress); // log.info("Smart Contract deployed to address: " + contractAddress);
// log.info("View contract at https://ropsten.etherscan.io/address/" + contractAddress); // log.info("View contract at https://ropsten.etherscan.io/address/" + contractAddress);
//Add user to the access control list //Add authorized users to the access control list
TransactionReceipt userone = contract.addUser("0xFC87F1c9459A4e15731d004EbD923821f89AA007").send(); TransactionReceipt userone = contract.addUser("0xFC87F1c9459A4e15731d004EbD923821f89AA007").send();
//TransactionReceipt userthree = contract.addUser("0xcdA6722bCf8a428129007e6d3DabfDdC233a0070").send();
TransactionReceipt usertwo = contract.addUser("0xbA719536EEDeA5F0eE74469160E03CA709CD7309").send(); TransactionReceipt usertwo = contract.addUser("0xbA719536EEDeA5F0eE74469160E03CA709CD7309").send();
//TransactionReceipt userthree = contract.addUser("0xcdA6722bCf8a428129007e6d3DabfDdC233a0070").send();
//Get the owners address
log.info("Owner: " + contract.owner().send()); log.info("Owner: " + contract.owner().send());
log.info("Access:" + contract.isUser("0xbA719536EEDeA5F0eE74469160E03CA709CD7309"). send()); //See if a user address is authorized to gain access
log.info("Access:" + contract.isUser("0xcdA6722bCf8a428129007e6d3DabfDdC233a0070"). send()); log.info("Is this user authorised to gain access: " + contract.isUser("0xbA719536EEDeA5F0eE74469160E03CA709CD7309"). send());
log.info("Is this user authorised to gain access: " + contract.isUser("0xcdA6722bCf8a428129007e6d3DabfDdC233a0070"). send());
//Check how many users are now included in the baseData! At the moment must be no user in the baseData storage
log.info("Number of Users in the baseData: " + contract.getUserCount().send()); log.info("Number of Users in the baseData: " + contract.getUserCount().send());
//System.out.println(contract.owner().send()); //System.out.println(contract.owner().send());
...@@ -135,7 +142,8 @@ public class Application { ...@@ -135,7 +142,8 @@ public class Application {
// log.info("New User added to the baseData!" + "The number of users now is: " + contract.getUserCount().send() // log.info("New User added to the baseData!" + "The number of users now is: " + contract.getUserCount().send()
// + " The new user's id is: " + event.userId); } // + " The new user's id is: " + event.userId); }
//Get and Set User details //Insert data to the baseData contract storage
//Get and Insert User details
//User #1 //User #1
TransactionReceipt transactionReceipt = contract.insertUser("0xFC87F1c9459A4e15731d004EbD923821f89AA007", "thesis@uos.ac.uk", BigInteger.valueOf(20), "me", BigInteger.valueOf(1), BigInteger.valueOf(200000)).send(); TransactionReceipt transactionReceipt = contract.insertUser("0xFC87F1c9459A4e15731d004EbD923821f89AA007", "thesis@uos.ac.uk", BigInteger.valueOf(20), "me", BigInteger.valueOf(1), BigInteger.valueOf(200000)).send();
//User #2 //User #2
...@@ -151,10 +159,12 @@ public class Application { ...@@ -151,10 +159,12 @@ public class Application {
//Send the results and print them //Send the results and print them
//log.info("User Info: " + contract.getUser("0xFC87F1c9459A4e15731d004EbD923821f89AA007").send()); //log.info("User Info: " + contract.getUser("0xFC87F1c9459A4e15731d004EbD923821f89AA007").send());
//Retrieve Data if you are authorised user!
log.info("User #:" + contract.getUser("0xFC87F1c9459A4e15731d004EbD923821f89AA007").send().getValue3() + " Info: " + contract.getUser("0xFC87F1c9459A4e15731d004EbD923821f89AA007").send()); log.info("User #:" + contract.getUser("0xFC87F1c9459A4e15731d004EbD923821f89AA007").send().getValue3() + " Info: " + contract.getUser("0xFC87F1c9459A4e15731d004EbD923821f89AA007").send());
//Retrieve single field
log.info("User Email: " + contract.getUser("0xFC87F1c9459A4e15731d004EbD923821f89AA007").send().getValue1()); log.info("User Email: " + contract.getUser("0xFC87F1c9459A4e15731d004EbD923821f89AA007").send().getValue1());
log.info("User #:" + contract.getUser("0xbA719536EEDeA5F0eE74469160E03CA709CD7309").send().getValue3() + " Info: " + contract.getUser("0xbA719536EEDeA5F0eE74469160E03CA709CD7309").send()); log.info("User #:" + contract.getUser("0xbA719536EEDeA5F0eE74469160E03CA709CD7309").send().getValue3() + " Info: " + contract.getUser("0xbA719536EEDeA5F0eE74469160E03CA709CD7309").send());
//String name = contract.getUser("0xFC87F1c9459A4e15731d004EbD923821f89AA007").send().getValue0();
log.info("User Name: " + contract.getUser("0xFC87F1c9459A4e15731d004EbD923821f89AA007").send().getValue2()); log.info("User Name: " + contract.getUser("0xFC87F1c9459A4e15731d004EbD923821f89AA007").send().getValue2());
//Get number of users and print it //Get number of users and print it
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment