Implement a smart contract for shared wealth management for families.
Alice and Bob create a contract with 10 ether initial balance, setting their daughter, Claire, as their heir. Every time they receive their salary, they transfer it to the contract. Every time they need money, they withdraw money from the contract, knowing that they can only withdraw 1 ether at a time.
Unfortunately, Alice and Bob both lose access to their private keys. After one year, but not before, Claire is able to withdraw all the ether from the contract.
constructor: function WealthManager(address partner, address heir) payable
msg.sender
) is the first owner.partner
is the second owner.heir
is the heir.withdraw: function withdraw(uint256 amount)
amount
wei to the sender of the transaction.amount
is not over the withdraw limit.inherit: function inherit()
selfdestruct
).fallback: function () payable
pragma solidity ^0.4.21;
contract WealthManager {
// <contract_variables>
// </contract_variables>
function WealthManager(address partner, address heir) public payable {
// TODO
}
function withdraw(uint256 amount) public {
// TODO
}
function inherit() public {
// TODO
}
function () public payable {
// TODO
}
}