Created
December 14, 2024 15:12
-
-
Save linagee/826ef48d738d69f72e8b14f3b4f959ac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* linagee was here */ | |
contract ayeAyeCoin { | |
string info; | |
mapping (address => uint) public coins; | |
address owner; | |
event CoinTransfer(address sender, address receiver, uint amount); | |
uint initialCoins = 6000000; /* There will only ever be 6 million ayeAyeCoins */ | |
/* Initializes contract with initial supply to creator */ | |
function ayeAyeCoin() { | |
owner = msg.sender; | |
coins[owner] = initialCoins; | |
} | |
/* Info about coin */ | |
function ayeAyeInfo() constant returns (string) { | |
return info; | |
} | |
/* send currency */ | |
function sendCoin(address receiver, uint amount) returns(bool sufficient) { | |
if (coins[msg.sender] < amount) return false; | |
coins[msg.sender] -= amount; | |
coins[receiver] += amount; | |
CoinTransfer(msg.sender, receiver, amount); | |
return true; | |
} | |
/* get your balance */ | |
function coinBalance() constant returns (uint amount) { | |
return coins[msg.sender]; | |
} | |
/* get the balance of another account */ | |
function coinBalanceOf(address _addr) constant returns (uint amount) { | |
return coins[_addr]; | |
} | |
/* A primitive faucet. Love your citizens! */ | |
function coinBeg() returns (string) { | |
if (coins[owner] >= 1) { | |
coins[owner]--; | |
coins[msg.sender]++; | |
return "ayeAyeCoin love! One coin for you!"; | |
} | |
return "Sorry, the faucet has entirely run dry."; | |
} | |
function setInfo(string _info) { | |
if (msg.sender != owner) return; | |
info = _info; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment