Skip to content

Latest commit

 

History

History
486 lines (413 loc) · 14.2 KB

MockProcessorStoreLib.md

File metadata and controls

486 lines (413 loc) · 14.2 KB

MockProcessorStoreLib.sol

View Source: contracts/mock/claims-processor/MockProcessorStore.sol

↗ Extends: MockStore

MockProcessorStoreLib

Functions

initialize

function initialize(MockStore s, bytes32 coverKey, bytes32 productKey, address cxToken, uint256 incidentDate) external nonpayable
returns(values address[])

Arguments

Name Type Description
s MockStore
coverKey bytes32
productKey bytes32
cxToken address
incidentDate uint256
Source Code
function initialize(
    MockStore s,
    bytes32 coverKey,
    bytes32 productKey,
    address cxToken,
    uint256 incidentDate
  ) external returns (address[] memory values) {
    MockProtocol protocol = new MockProtocol();
    MockVault vault = new MockVault();
    FakePriceOracle oracle = new FakePriceOracle();

    s.setAddress(ProtoUtilV1.CNS_CORE, address(protocol));
    s.setAddress(ProtoUtilV1.CNS_COVER_STABLECOIN, cxToken);
    s.setAddress(ProtoUtilV1.CNS_NPM_PRICE_ORACLE, address(oracle));

    s.setBool(ProtoUtilV1.NS_COVER_CXTOKEN, cxToken);
    s.setBool(ProtoUtilV1.NS_MEMBERS, cxToken);
    s.setUint(keccak256(abi.encodePacked(ProtoUtilV1.NS_GOVERNANCE_REPORTING_INCIDENT_DATE, coverKey, productKey)), incidentDate);

    s.setBool(ProtoUtilV1.NS_MEMBERS, address(vault));
    s.setAddress(ProtoUtilV1.NS_CONTRACTS, "cns:cover:vault", coverKey, address(vault));

    setProductStatus(s, coverKey, productKey, incidentDate, 4);
    setClaimBeginTimestamp(s, coverKey, productKey, block.timestamp - 100 days); // solhint-disable-line
    setClaimExpiryTimestamp(s, coverKey, productKey, block.timestamp + 100 days); // solhint-disable-line

    values = new address[](2);

    values[0] = address(protocol);
    values[1] = address(vault);
  }

disassociateCxToken

function disassociateCxToken(MockStore s, address cxToken) external nonpayable

Arguments

Name Type Description
s MockStore
cxToken address
Source Code
function disassociateCxToken(MockStore s, address cxToken) external {
    s.unsetBool(ProtoUtilV1.NS_COVER_CXTOKEN, cxToken);
  }

setProductStatus

function setProductStatus(MockStore s, bytes32 coverKey, bytes32 productKey, uint256 incidentDate, uint256 value) public nonpayable

Arguments

Name Type Description
s MockStore
coverKey bytes32
productKey bytes32
incidentDate uint256
value uint256
Source Code
function setProductStatus(
    MockStore s,
    bytes32 coverKey,
    bytes32 productKey,
    uint256 incidentDate,
    uint256 value
  ) public {
    s.setUint(keccak256(abi.encodePacked(ProtoUtilV1.NS_COVER_STATUS, coverKey, productKey, incidentDate)), value);
  }

setClaimBeginTimestamp

function setClaimBeginTimestamp(MockStore s, bytes32 coverKey, bytes32 productKey, uint256 value) public nonpayable

Arguments

Name Type Description
s MockStore
coverKey bytes32
productKey bytes32
value uint256
Source Code
function setClaimBeginTimestamp(
    MockStore s,
    bytes32 coverKey,
    bytes32 productKey,
    uint256 value
  ) public {
    s.setUint(keccak256(abi.encodePacked(ProtoUtilV1.NS_CLAIM_BEGIN_TS, coverKey, productKey)), value);
  }

setClaimExpiryTimestamp

function setClaimExpiryTimestamp(MockStore s, bytes32 coverKey, bytes32 productKey, uint256 value) public nonpayable

Arguments

Name Type Description
s MockStore
coverKey bytes32
productKey bytes32
value uint256
Source Code
function setClaimExpiryTimestamp(
    MockStore s,
    bytes32 coverKey,
    bytes32 productKey,
    uint256 value
  ) public {
    s.setUint(keccak256(abi.encodePacked(ProtoUtilV1.NS_CLAIM_EXPIRY_TS, coverKey, productKey)), value);
  }

initialize

function initialize(bytes32 coverKey, bytes32 productKey, address cxToken, uint256 incidentDate) external nonpayable
returns(values address[])

Arguments

Name Type Description
coverKey bytes32
productKey bytes32
cxToken address
incidentDate uint256
Source Code
function initialize(
    bytes32 coverKey,
    bytes32 productKey,
    address cxToken,
    uint256 incidentDate
  ) external returns (address[] memory values) {
    return MockProcessorStoreLib.initialize(this, coverKey, productKey, cxToken, incidentDate);
  }

disassociateCxToken

function disassociateCxToken(address cxToken) external nonpayable

Arguments

Name Type Description
cxToken address
Source Code
function disassociateCxToken(address cxToken) external {
    MockProcessorStoreLib.disassociateCxToken(this, cxToken);
  }

setProductStatus

function setProductStatus(bytes32 coverKey, bytes32 productKey, uint256 incidentDate, uint256 value) external nonpayable

Arguments

Name Type Description
coverKey bytes32
productKey bytes32
incidentDate uint256
value uint256
Source Code
function setProductStatus(
    bytes32 coverKey,
    bytes32 productKey,
    uint256 incidentDate,
    uint256 value
  ) external {
    MockProcessorStoreLib.setProductStatus(this, coverKey, productKey, incidentDate, value);
  }

setClaimBeginTimestamp

function setClaimBeginTimestamp(bytes32 coverKey, bytes32 productKey, uint256 value) external nonpayable

Arguments

Name Type Description
coverKey bytes32
productKey bytes32
value uint256
Source Code
function setClaimBeginTimestamp(
    bytes32 coverKey,
    bytes32 productKey,
    uint256 value
  ) external {
    MockProcessorStoreLib.setClaimBeginTimestamp(this, coverKey, productKey, value);
  }

setClaimExpiryTimestamp

function setClaimExpiryTimestamp(bytes32 coverKey, bytes32 productKey, uint256 value) external nonpayable

Arguments

Name Type Description
coverKey bytes32
productKey bytes32
value uint256
Source Code
function setClaimExpiryTimestamp(
    bytes32 coverKey,
    bytes32 productKey,
    uint256 value
  ) external {
    MockProcessorStoreLib.setClaimExpiryTimestamp(this, coverKey, productKey, value);
  }

Contracts