Mr. Mark has written his will. According to his will if his son Jack successfully gets his undergrad degree then he will be entitled to get his share of money from Mr. Mark's wealth. If not, then the money will go to an NGO(that helps homeless) and Jack will get nothing.
For This purpose Mr. Mark, writes a smart contract and deploys it. Before deploying the smart contract Mr. Mark generated a password and divided it in two parts. He(Mr. Mark) gave the first part of the password to his son and another to his attorney. if Jack successfully graduates he can ask the attorney for the second part and withdraw the money. If deadline has passed, the attorney can share the password he has with the NGO and the NGO can withdraw the money and kill the contract.
The smart contract should (at least) have the following functions. Feel free to add more functions. Be innovative.
1: Constructor function
Constructor function should assign values to deadline, first and second part of the password as well as the amount of ethers to be given
2: Withdraw function:
Jack can only withdraw ethers if he has both parts of the password. He should also claim the amount before deadline
3: Cancel Withdraw:
The NGO can withdraw the money using the second part of the password after deadline and kill the contract.
Build a unit test, to test your withdraw function for two cases:
1: When both passwords are correct and deadline is not reached
2: When one or both pieces of password are incorrect and show that your function works accordingly.
Build a simple user Interface where Jack can enter both pieces of the password and the address where he wants ethers/wei to be transfered. You can use any of ten testrpc addresses for this purpose except the first account ([login to view URL]). The UI should also have a button where upon clicking the button, Withdraw() function will be called in your contract.
10 pekerja bebas membida secara purata $751 untuk pekerjaan ini
Hey, I have a lot of experience developing smart contracts and writing unit tests for them. I can develop this escrow based smart contract DApp for you. Kindly message me to take this further.