Implement a smart contract for supporting an artist.
Alice creates a contract with 52 ether initial balance to support Bob, the artist. For the next 52 weeks, Bob can make a single withdrawal of at most 1 ether every week.
constructor: function Patreon(address artist) payable
msg.sender
) is the contributor.artist
is the artist.withdraw: function withdraw(uint256 amount)
amount
wei to the sender of the transaction.fallback: function () payable
selfdestruct
with our contract's address. You do not need to handle this case here.)pragma solidity ^0.4.21;
contract Patreon {
// <contract_variables>
// </contract_variables>
function Patreon(address artist) public payable {
// TODO
}
function withdraw(uint256 amount) public {
// TODO
}
function () public payable {
// TODO
}
}