contract P1Proxy {
    using SafeERC20 for IERC20;

    /**
     * @notice Sets the maximum allowance on the Perpetual contract. Must be called at least once
     *  on a given Perpetual before deposits can be made.
     * @dev Cannot be run in the constructor due to technical restrictions in Solidity.
     */
    function approveMaximumOnPerpetual(
        address perpetual
    )
        external
    {
        IERC20 tokenContract = IERC20(I_PerpetualV1(perpetual).getTokenContract());

        // safeApprove requires unsetting the allowance first.
        tokenContract.safeApprove(perpetual, 0);

        // Set the allowance to the highest possible value.
        tokenContract.safeApprove(perpetual, uint256(-1));
    }
}
/**
 * @title P1Proxy
 * @author dYdX
 *
 * @notice Base contract for proxy contracts, which can be used to provide additional functionality
 *  or restrictions when making calls to a Perpetual contract on behalf of a user.
 */
function approveMaximumOnPerpetual(
        address perpetual
    )
        external
    {
        IERC20 tokenContract = IERC20(I_PerpetualV1(perpetual).getTokenContract());

        // safeApprove requires unsetting the allowance first.
        tokenContract.safeApprove(perpetual, 0);

        // Set the allowance to the highest possible value.
        tokenContract.safeApprove(perpetual, uint256(-1));
    }
/**
 * @notice Sets the maximum allowance on the Perpetual contract. Must be called at least once
 *  on a given Perpetual before deposits can be made.
 * @dev Cannot be run in the constructor due to technical restrictions in Solidity.
 */