interface IncreasePositionDelegator {

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

    /**
     * Function a contract must implement in order to allow additional value to be added onto
     * an owned position. Margin will call this on the owner of a position during increasePosition()
     *
     * NOTE: If not returning zero (or not reverting), this contract must assume that Margin will
     * either revert the entire transaction or that the position size was successfully increased.
     *
     * @param  trader          Address initiating the addition of funds to the position
     * @param  positionId      Unique ID of the position
     * @param  principalAdded  Amount of principal to be added to the position
     * @return                 This address to accept, a different address to ask that contract
     */
    function increasePositionOnBehalfOf(
        address trader,
        bytes32 positionId,
        uint256 principalAdded
    )
        external
        /* onlyMargin */
        returns (address);
}
/**
 * @title IncreasePositionDelegator
 * @author dYdX
 *
 * Interface that smart contracts must implement in order to own position on behalf of other
 * accounts
 *
 * NOTE: Any contract implementing this interface should also use OnlyMargin to control access
 *       to these functions
 */
function increasePositionOnBehalfOf(
    address trader,
    bytes32 positionId,
    uint256 principalAdded
)
    external
    /* onlyMargin */
    returns (address);

/**
 * Function a contract must implement in order to allow additional value to be added onto
 * an owned position. Margin will call this on the owner of a position during increasePosition()
 *
 * NOTE: If not returning zero (or not reverting), this contract must assume that Margin will
 * either revert the entire transaction or that the position size was successfully increased.
 *
 * @param  trader          Address initiating the addition of funds to the position
 * @param  positionId      Unique ID of the position
 * @param  principalAdded  Amount of principal to be added to the position
 * @return                 This address to accept, a different address to ask that contract
 */