Skip to content

Instantly share code, notes, and snippets.

@skilesare
Created November 7, 2017 22:09
Show Gist options
  • Save skilesare/fec1454a657c4913292efa31b5c46438 to your computer and use it in GitHub Desktop.
Save skilesare/fec1454a657c4913292efa31b5c46438 to your computer and use it in GitHub Desktop.
pragma solidity ^0.4.15;
contract Dan {
address public owner;
uint256 public donated;
string public phone;
string public my_address;
string public my_name;
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner == msg.sender);
_;
}
function () public payable{
require(1==0);
}
function Dan(string _name, string _phone, string _address) public{
//the owner will start as the address creating the contract
owner = msg.sender;
phone = _phone;
my_address = _address;
my_name = _name;
}
function donate() public payable returns (bool){
donated = donated + msg.value;
return true;
}
function withdraw(uint256 amount) onlyOwner public returns(bool){
require(address(this).balance >= amount);
address(owner).transfer(amount);
}
function safetyTransferToken(address Token, address _to, uint _value) onlyOwner public returns (bool ok){
bytes4 sig = bytes4(keccak256("transfer(address,uint256)"));
return Token.call(sig, _to, _value);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment