Skip to content

Instantly share code, notes, and snippets.

@ianmonkuk
Last active March 31, 2018 07:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ianmonkuk/6e03e4221c4a9ee51bd95588cdc49034 to your computer and use it in GitHub Desktop.
Save ianmonkuk/6e03e4221c4a9ee51bd95588cdc49034 to your computer and use it in GitHub Desktop.
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