Decentralized Application on Ethereum Network
- Assign contract publisher as shelter owner
- Add new animals to shelter
- Anyone can donate ether
- Adopt animal (results in adopter's address published by the animal's ID)
- Frontend
This is not a real animal shelter! All Ether sent will be permanently lost!
Project is done only for fun and to learn more about Ethereum. Any suggestions are highly encouraged!
This part is mainly for me (and other newbies).
- Install testrpc & truffle:
https://github.com/trufflesuite/ganache-cli
https://github.com/trufflesuite/truffle
- Create new truffle project or clone this repository:
truffle init
- Run testrpc:
testrpc -p 7545
- Compile and deploy project to blockchain:
truffle compile
truffle migrate
If any changes are made be sure to reset:
truffle migrate --reset
- Run truffle console to interact:
truffle console
Or run automated test script:
truffle test test/shelter.js
AnimalShelter.deployed().then(inst => { app = inst })
app.addAnimal("dog", 35, 4, true)
app.addAnimal("cat", 6, 3, false)
app.animals_count.call()
app.donate({ from: web3.eth.accounts[1], value: web3.toWei(10,"ether") })
app.adopt(0)
app.getInfo(0)
app.getInfo(1)