interface MarginCallDelegator {

    // ============ Public Interface functions ============

    /**
     * Function a contract must implement in order to let other addresses call marginCall().
     *
     * NOTE: If not returning zero (or not reverting), this contract must assume that Margin will
     * either revert the entire transaction or that the loan was successfully margin-called.
     *
     * @param  caller         Address of the caller of the marginCall function
     * @param  positionId     Unique ID of the position
     * @param  depositAmount  Amount of heldToken deposit that will be required to cancel the call
     * @return                This address to accept, a different address to ask that contract
     */
    function marginCallOnBehalfOf(
        address caller,
        bytes32 positionId,
        uint256 depositAmount
    )
        external
        /* onlyMargin */
        returns (address);
}
/**
 * @title MarginCallDelegator
 * @author dYdX
 *
 * Interface that smart contracts must implement in order to let other addresses margin-call a loan
 * owned by the smart contract.
 *
 * NOTE: Any contract implementing this interface should also use OnlyMargin to control access
 *       to these functions
 */
function marginCallOnBehalfOf(
    address caller,
    bytes32 positionId,
    uint256 depositAmount
)
    external
    /* onlyMargin */
    returns (address);

/**
 * Function a contract must implement in order to let other addresses call marginCall().
 *
 * NOTE: If not returning zero (or not reverting), this contract must assume that Margin will
 * either revert the entire transaction or that the loan was successfully margin-called.
 *
 * @param  caller         Address of the caller of the marginCall function
 * @param  positionId     Unique ID of the position
 * @param  depositAmount  Amount of heldToken deposit that will be required to cancel the call
 * @return                This address to accept, a different address to ask that contract
 */