UCI Blockathon 2018
truffle console
migrate --reset
OrgBlock.deployed().then(function(instance){app = instance})
app.addUser("Organization", 0, 0, 0) [3 organizations]
app.addUser("Vendor", 0, 0, 0) [3 vendors]
app.addUser("Donor", 0, 0, 0) [4 donors]
Consider,
0 - PaymentGateway
1 - Wikimedia, 2 - Americare, 3 - Republicans
4 - AWS, 5 - Walmart, 6 - Bren Event mgmt.
7 - Batman
app.getUsers()
app.addDonation(org_id, don_id, , amount, sender_address)
app.addDonation(1, 7, "Because I am batman", 5000, {from: web3.eth.accounts[3]})
fails! only PaymentGateway can create the transaction block
app.addDonation(1, 7, "Because I am batman", 5000, {from: web3.eth.accounts[0]})
transaction with id=1 created.
app.getDonValidity( t_id )
app.getDonValidity( 1 )
transaction_id = 1, validity must be = 1
app.validateDonation(org_id, t_id)
app.validateDonation(1, 1)
Wikipedia acknowledges the transaction.
app.validateDonation(don_id, t_id)
app.validateDonation(7, 1)
Batman acknowledges the transaction.
app.getDonValidity( t_id )
app.getDonValidity( 1 )
must be 3!
app.getAmountRecieved( org_id )
app.getAmountRecieved( 1 )
app.getAmountRecieved( org_id )
app.getAmountRemaining( 1 )
app.addExpense(org_id, vend_id, message, amount)
app.addExpense(1, 4, "Wikipedia is yet to decentralize :/ ", 2000)
app.validateExpense(org_id, t_id)
app.validateExpense(1, 1)
app.validateExpense(don_id, t_id)
app.validateExpense(4, 1)
app.getDonValidity( t_id )
app.getExpValidity( 1 )
must be 3!
app.getAmountRemaining( org_id )
app.getAmountRemaining( 1 )