library ResourceIdentifier {

    // IntegrationRegistry will always be resource ID 0 in the system
    uint256 constant internal INTEGRATION_REGISTRY_RESOURCE_ID = 0;
    // PriceOracle will always be resource ID 1 in the system
    uint256 constant internal PRICE_ORACLE_RESOURCE_ID = 1;
    // CKValuer resource will always be resource ID 2 in the system
    uint256 constant internal CK_VALUER_RESOURCE_ID = 2;

    /* ============ Internal ============ */

    /**
     * Gets the instance of integration registry stored on Controller. Note: IntegrationRegistry is stored as index 0 on
     * the Controller
     */
    function getIntegrationRegistry(IController _controller) internal view returns (IIntegrationRegistry) {
        return IIntegrationRegistry(_controller.resourceId(INTEGRATION_REGISTRY_RESOURCE_ID));
    }

    /**
     * Gets instance of price oracle on Controller. Note: PriceOracle is stored as index 1 on the Controller
     */
    function getPriceOracle(IController _controller) internal view returns (IPriceOracle) {
        return IPriceOracle(_controller.resourceId(PRICE_ORACLE_RESOURCE_ID));
    }

    /**
     * Gets the instance of CK valuer on Controller. Note: CKValuer is stored as index 2 on the Controller
     */
    function getCKValuer(IController _controller) internal view returns (ICKValuer) {
        return ICKValuer(_controller.resourceId(CK_VALUER_RESOURCE_ID));
    }
}
/**
 * @title ResourceIdentifier
 * @author Cook Finance
 *
 * A collection of utility functions to fetch information related to Resource contracts in the system
 */
function getPriceOracle(IController _controller) internal view returns (IPriceOracle) {
    return IPriceOracle(_controller.resourceId(PRICE_ORACLE_RESOURCE_ID));
}

/**
 * Gets instance of price oracle on Controller. Note: PriceOracle is stored as index 1 on the Controller
 */