contract ExternallyFundedOSM is OSM {
    // --- Variables ---
    FSMWrapperLike public fsmWrapper;

    // --- Evemts ---
    event FailRenumerateCaller(address wrapper, address caller);

    constructor (address priceSource_) public OSM(priceSource_) {}

    // --- Administration ---
    /*
    * @notify Modify an address parameter
    * @param parameter The parameter name
    * @param val The new value for the parameter
    */
    function modifyParameters(bytes32 parameter, address val) external isAuthorized {
        if (parameter == "fsmWrapper") {
          require(val != address(0), "ExternallyFundedOSM/invalid-fsm-wrapper");
          fsmWrapper = FSMWrapperLike(val);
        }
        else revert("ExternallyFundedOSM/modify-unrecognized-param");
        emit ModifyParameters(parameter, val);
    }

    /*
    * @notify Update the price feeds inside the OSM
    */
    function updateResult() override external stoppable {
        // Check if the delay passed
        require(passedDelay(), "ExternallyFundedOSM/not-passed");
        // Check that the wrapper is set
        require(address(fsmWrapper) != address(0), "ExternallyFundedOSM/null-wrapper");
        // Read the price from the median
        (uint256 priceFeedValue, bool hasValidValue) = getPriceSourceUpdate();
        // If the value is valid, update storage
        if (hasValidValue) {
            // Update state
            currentFeed    = nextFeed;
            nextFeed       = Feed(uint128(uint(priceFeedValue)), 1);
            lastUpdateTime = latestUpdateTime(currentTime());
            // Emit event
            emit UpdateResult(uint(currentFeed.value), lastUpdateTime);
            // Pay the caller
            try fsmWrapper.renumerateCaller(msg.sender) {}
            catch(bytes memory revertReason) {
              emit FailRenumerateCaller(address(fsmWrapper), msg.sender);
            }
        }
    }
}
function modifyParameters(bytes32 parameter, address val) external isAuthorized {
        if (parameter == "fsmWrapper") {
          require(val != address(0), "ExternallyFundedOSM/invalid-fsm-wrapper");
          fsmWrapper = FSMWrapperLike(val);
        }
        else revert("ExternallyFundedOSM/modify-unrecognized-param");
        emit ModifyParameters(parameter, val);
    }
/*
 * @notify Modify an address parameter
 * @param parameter The parameter name
 * @param val The new value for the parameter
 */