2020-05-02 02:39:17 +00:00
|
|
|
pragma solidity ^0.6.0;
|
|
|
|
|
2020-05-03 00:27:07 +00:00
|
|
|
interface MemoryInterface {
|
|
|
|
function getUint(uint id) external returns (uint num);
|
|
|
|
function setUint(uint id, uint val) external;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface EventInterface {
|
|
|
|
function emitEvent(uint connectorType, uint connectorID, bytes32 eventCode, bytes calldata eventData) external;
|
|
|
|
}
|
2020-05-02 02:39:17 +00:00
|
|
|
|
2020-05-02 09:40:50 +00:00
|
|
|
contract Stores {
|
2020-05-02 02:39:17 +00:00
|
|
|
|
|
|
|
/**
|
2020-05-02 09:40:50 +00:00
|
|
|
* @dev Return ethereum address
|
2020-05-02 02:39:17 +00:00
|
|
|
*/
|
2020-05-02 11:52:06 +00:00
|
|
|
function getEthAddr() internal pure returns (address) {
|
2020-05-02 09:40:50 +00:00
|
|
|
return 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; // ETH Address
|
2020-05-02 02:39:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-05-02 11:52:06 +00:00
|
|
|
* @dev Return memory variable address
|
2020-05-02 02:39:17 +00:00
|
|
|
*/
|
2020-05-02 09:40:50 +00:00
|
|
|
function getMemoryAddr() internal pure returns (address) {
|
2020-05-02 02:39:17 +00:00
|
|
|
return 0x8a5419CfC711B2343c17a6ABf4B2bAFaBb06957F; // InstaMemory Address
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dev Return InstaEvent Address.
|
|
|
|
*/
|
2020-05-02 09:40:50 +00:00
|
|
|
function getEventAddr() internal pure returns (address) {
|
2020-05-02 02:39:17 +00:00
|
|
|
return 0x2af7ea6Cb911035f3eb1ED895Cb6692C39ecbA97; // InstaEvent Address
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-05-02 09:40:50 +00:00
|
|
|
* @dev Get Uint value from InstaMemory Contract.
|
2020-05-02 11:52:06 +00:00
|
|
|
*/
|
2020-05-02 02:39:17 +00:00
|
|
|
function getUint(uint getId, uint val) internal returns (uint returnVal) {
|
|
|
|
returnVal = getId == 0 ? val : MemoryInterface(getMemoryAddr()).getUint(getId);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-05-02 09:40:50 +00:00
|
|
|
* @dev Set Uint value in InstaMemory Contract.
|
2020-05-02 11:52:06 +00:00
|
|
|
*/
|
2020-05-02 02:39:17 +00:00
|
|
|
function setUint(uint setId, uint val) internal {
|
|
|
|
if (setId != 0) MemoryInterface(getMemoryAddr()).setUint(setId, val);
|
|
|
|
}
|
|
|
|
|
2020-05-02 11:52:06 +00:00
|
|
|
/**
|
|
|
|
* @dev emit event on event contract
|
|
|
|
*/
|
|
|
|
function emitEvent(bytes32 eventCode, bytes memory eventData) internal {
|
|
|
|
(uint model, uint id) = connectorID();
|
|
|
|
EventInterface(getEventAddr()).emitEvent(model, id, eventCode, eventData);
|
2020-05-02 02:39:17 +00:00
|
|
|
}
|
|
|
|
|
2020-05-03 00:58:45 +00:00
|
|
|
/**
|
|
|
|
* @dev Connector Details - needs to be changed before deployment
|
|
|
|
*/
|
|
|
|
function connectorID() public pure returns(uint model, uint id) {
|
|
|
|
(model, id) = (0, 0);
|
|
|
|
}
|
|
|
|
|
2020-05-02 02:39:17 +00:00
|
|
|
}
|