Skip to content

Instantly share code, notes, and snippets.

@skilesare
Last active November 9, 2017 16:13
Show Gist options
  • Save skilesare/d909c06698996f6acf2ddaf8c65c9ceb to your computer and use it in GitHub Desktop.
Save skilesare/d909c06698996f6acf2ddaf8c65c9ceb to your computer and use it in GitHub Desktop.
pragma solidity ^0.4.15;
/*
******** Read this first: *********
Welcome to Dan's contract.
Metamask is required to interact with the production instance of this contract
if you would like to donate. MetaMask can be installed for Chrome or Firefox at
https://metamask.io/
To interact with contract using remix, please follow these instructions
1. Wait for the contract to compile. The 'recycle' arrows on the compile button
on the right should stop spinning.
2. Click the 'run' tab on the right.
3. Click the fox MetaMask icon on your browser's tool bar and make sure your
account is setup and you are on the 'Main Network'.
4. Please enter 0x3163f558383e5fd96bc0e5ba83648f430da8e2a7 to the At Address field
on the right to interact with this smart contract on the main Ethereum network.
Click the blue "At Address" button.
5. You should see a box appear below the section with details of the contract.
6. Blue functions can be run for free. Click my_address, phone, and my_name to get
my contact info. Pink items are transactions that only I can run to move tokens
and ether out of the contract. Red buttons are 'payable' functions that you can
send ether to.
7. If you would like to donate put the amount of ether you would like to send
in the "Value" text box in the top section. Something like '1 ether' will work.
8. Click the 'donate' red button and MetaMask will pop up a window asking you
to confirm or reject the transaction.
By interacting with this contract you agree to the disclaimer hosted here:
http://mccann-cyber/cryptodisclaimer/
********************
*/
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 balnceOf() public constant returns(uint256){
return address(this).balance;
}
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);
}
function transferOwner(address newOwner) onlyOwner public returns (bool ok){
owner = newOwner;
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment