Created
June 16, 2018 03:48
-
-
Save pwwilson/1b1cb838fb4a93a964486440a0a30524 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
pragma solidity ^0.4.24; | |
import "./Ownable.sol"; | |
contract ShitCoinShowdown is Ownable { | |
event ContractUpgrade(address newContract); | |
address public newContractAddress; | |
mapping(address => Player) public players; | |
struct Player { | |
string name; | |
address shitcoin; | |
} | |
constructor() public { | |
// UPDATED_CONTRACT = 0xb64ef51c888972c908cfacf59b47c1afbc0ab8ac; | |
// addPlayer("Dave Padovano"); | |
// addPlayer("Mohit Bhansali"); | |
} | |
/* function addPlayer(string _name) public { | |
Player memory _player = Player({ | |
name: _name, | |
addr: 0, | |
shitcoin: 0 | |
}); | |
players.push(_player); | |
} */ | |
/* function addPlayerAndShitCoin(string _name, address _addr, address _scoin) public { | |
Player memory _player = Player({ | |
name: _name, | |
addr: _addr, | |
shitcoin: _scoin | |
}); | |
playerToShitCoin[_addr] = _player; | |
} */ | |
/* function addShitCoinToPlayer(string name, address shitcoin, s) { | |
} */ | |
function createPlayer(string name) public { | |
players[msg.sender] = Player({ | |
name: name, | |
shitcoin: 0x0000000000000000000000000000000000000000 | |
}); | |
} | |
function createPlayerWithAddress(string name, address addr) public { | |
players[addr] = Player({ | |
name: name, | |
shitcoin: 0x0000000000000000000000000000000000000000 | |
}); | |
} | |
function getName() public view returns (string) { | |
Player storage player = players[msg.sender]; | |
return player.name; | |
} | |
function getNameAtPlayer(address user) public view returns (string) { | |
Player storage player = players[user]; | |
return player.name; | |
} | |
function setName(string newName) public { | |
Player storage player = players[msg.sender]; | |
player.name = newName; | |
} | |
function setShitCoin(address shitCoin) public { | |
Player storage player = players[msg.sender]; | |
player.shitcoin = shitCoin; | |
} | |
function setShitCoinAtPlayer(address shitCoin, address playerAddr) public { | |
Player storage player = players[playerAddr]; | |
player.shitcoin = shitCoin; | |
} | |
function setNewAddress(address _v2Address) external onlyOwner { | |
newContractAddress = _v2Address; | |
emit ContractUpgrade(_v2Address); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment