This is the first time I write a smart contract and I'm going to use it for real application , so I hope there isn't any vulnerability or exploit since smart contract is immutable This contract able to receives transaction from any address but only the owner eligible to withdraw
pragma solidity ^0.4.17;
contract EtherTransferTo{
address public owner;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner() {
require (msg.sender == owner);
_;
}
function () payable public {
// nothing to do!
}
function getBalance() public view returns (uint256) {
return address(this).balance;
}
function withdraw(uint amount) onlyOwner returns(bool) {
require(amount <= this.balance);
owner.transfer(amount);
return true;
}
}
I know it is stupid to ask for help like this , but there isn't any friends of mine know programming , much appreciate if anyone could help