contract Permission is
    State
{
    // ============ Events ============

    event LogOperatorSet(
        address indexed owner,
        address operator,
        bool trusted
    );

    // ============ Structs ============

    struct OperatorArg {
        address operator;
        bool trusted;
    }

    // ============ Public Functions ============

    /**
     * Approves/disapproves any number of operators. An operator is an external address that has the
     * same permissions to manipulate an account as the owner of the account. Operators are simply
     * addresses and therefore may either be externally-owned Ethereum accounts OR smart contracts.
     *
     * Operators are also able to act as AutoTrader contracts on behalf of the account owner if the
     * operator is a smart contract and implements the IAutoTrader interface.
     *
     * @param  args  A list of OperatorArgs which have an address and a boolean. The boolean value
     *               denotes whether to approve (true) or revoke approval (false) for that address.
     */
    function setOperators(
        OperatorArg[] memory args
    )
        public
    {
        for (uint256 i = 0; i < args.length; i++) {
            address operator = args[i].operator;
            bool trusted = args[i].trusted;
            g_state.operators[msg.sender][operator] = trusted;
            emit LogOperatorSet(msg.sender, operator, trusted);
        }
    }
}
/**
 * @title Permission
 * @author dYdX
 *
 * Public function that allows other addresses to manage accounts
 */
function setOperators(
    OperatorArg[] memory args
)
    public
{
    for (uint256 i = 0; i < args.length; i++) {
        address operator = args[i].operator;
        bool trusted = args[i].trusted;
        g_state.operators[msg.sender][operator] = trusted;
        emit LogOperatorSet(msg.sender, operator, trusted);
    }
}

/**
 * Approves/disapproves any number of operators. An operator is an external address that has the
 * same permissions to manipulate an account as the owner of the account. Operators are simply
 * addresses and therefore may either be externally-owned Ethereum accounts OR smart contracts.
 *
 * Operators are also able to act as AutoTrader contracts on behalf of the account owner if the
 * operator is a smart contract and implements the IAutoTrader interface.
 *
 * @param  args  A list of OperatorArgs which have an address and a boolean. The boolean value
 *               denotes whether to approve (true) or revoke approval (false) for that address.
 */