Last active
March 31, 2018 07:54
-
-
Save ianmonkuk/6e03e4221c4a9ee51bd95588cdc49034 to your computer and use it in GitHub Desktop.
This file contains 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.8; | |
contract Underlying { | |
string public name; | |
string public symbol; | |
address public owner; | |
string public category; | |
struct KPILink { | |
address KPI; | |
bool isLive; | |
} | |
KPILink[] public KPIs; | |
event RequestedKPI(address KPI, string str); | |
event AddedKPI(address KPI, string str); | |
modifier onlyBy(address _account) | |
{ | |
if (msg.sender != _account) | |
throw; | |
_; | |
} | |
function Underlying( string _name, string _symbol, string _category ) | |
{ | |
owner = msg.sender; | |
name = _name; | |
symbol = _symbol; | |
category= _category; | |
} | |
function addKPI( address _KPI, string _str) public | |
onlyBy( owner ) returns (bool success) | |
{ | |
// Need to check it doesnt exist already | |
KPIs.push( KPILink(_KPI, true) ); | |
//AddedKPI( _KPI, _str ); | |
AddedKPI( KPIs[0].KPI, "test2" ); | |
return true; | |
} | |
function removeKPI( address _KPI ) | |
onlyBy( owner ) | |
{ | |
// Remove the contract | |
} | |
function changeSymbol( string _symbol ) | |
onlyBy( owner ) | |
{ | |
symbol = _symbol; | |
} | |
function getKPI( uint _index ) public constant returns (address KPI, bool isLive ) { | |
RequestedKPI(KPIs[ _index ].KPI,"testing"); | |
return (KPIs[ _index ].KPI, KPIs[ _index ].isLive); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment