dsa-connectors/contracts/mainnet/connectors_old/mock.sol

34 lines
1.0 KiB
Solidity
Raw Normal View History

2021-02-07 16:40:28 +00:00
pragma solidity ^0.7.0;
// import files from common directory
2021-02-07 16:40:28 +00:00
import { TokenInterface , MemoryInterface } from "../common/interfaces.sol";
import { Stores } from "../common/stores.sol";
import { DSMath } from "../common/math.sol";
2021-02-05 18:51:11 +00:00
abstract contract MockProtocol is Stores, DSMath {
event LogMock(uint mockOne, uint mockTwo, uint getId, uint setId);
// added two additional parameter (getId & setId) for external public facing functions
function mockFunction(uint mockNumber, uint getId, uint setId) external payable {
// protocol specific logics goes here
// fetch value of specific id
uint mockBalance = getUint(getId, mockNumber);
// uses uint(-1)
mockBalance = mockBalance == uint(-1) ? address(this).balance : mockNumber;
// store new value for specific id
setUint(setId, mockNumber);
// common event standard
emit LogMock(mockNumber, mockBalance, getId, setId);
}
}
contract ConnectMock is MockProtocol {
string public name = "Mock-v1";
}