As the answer may vary widely depending on the kind of state we consider, I'll restrain myself to democratic institutions. I also focus on the pragmatic, social contract theory orientation required by the OP. Be aware that many other approaches can be considered.
In democratic institutions, wether direct or representative, people working for the state, from the head of state to the city office clerk are employees for the citizens. It is to say, citizens pay taxes in order to provide them salary, housing and commodities in exchange for the accomplishment of a mission. As it would be odd to employ someone against one's own interests, it follows that state employees have a contractual obligation to put the citizen's interest before others. After all, they are employed under clear understanding that they will do so.
(Wether they act like it or not is irrelevant. Although we can often see persons in position of authority behave like bosses and nobility rather than employees, it is only because they lost sight of the reality of their situation and the citizens around let them do.)
It is even more clear for elected officials, who usually have to make promise and engage their word on a program to convince electors to choose them, that they have a moral obligation to fulfill this promise to the best of their ability and of the circumstances. Again, electors will probably not vote for a candidate who promises to act against their interest, so it is safe to assume elected officials have a moral obligation to honor their promise to their constituents by working in their interest.
So far, it's pretty clear cut. The problem is, the interest of the citizens is not something that can be clearly defined. In fact, citizens have conflicting interests, which makes it difficult for the state to define and enforce the general interest. Sometimes it's obvious, like "murderers would personally benefit from a general amnesty, but everyone else would suffer from it". Sometimes less, like arbitering on the optimum value for the minimum wage.
Also, what people want and what would benefit them is not always the same. To keep on the obvious side, many a citizen in european countries was pushing for the war in 1914, yet the utter misery it plunged every one into should make obvious that it was not indeed their best interest. Yet, when we pay someone to work for us we usually don't appreciate to be answered something like "oh, you say you want A but you don't really. You want B". In fact, pretending to know better than the people what is their interest is often the starting point of tyranny. Refusal to enforce the general will should not extend beyond an advising role, and possibly a resignation in case of strong and irreconcilable disagreement.
From the two previous points, we can see that the idea of "a moral duty to enforce the general interest of the citizens" is somewhat simplistic. What can reasonably be asked of the state officials is the participation in good faith to the deliberation necessary to define the general will, advise against it if necessary within the limits of their mandate, and enforce it or leave their job to someone who will.
It should also be noted that members of the state remain citizens and humans, and might be faced with contradicting obligations. For example, it might be the general will and even considered the general interest that the neighbor country should be invaded and its occupants put into slavery. Although they are professionally obliged to enforce this will, the head of state also has a moral obligation, as a human, to oppose it (depending on the considered moral framework). One could also argue that it is very doubtful that any good will ever result of such an action in the long run, ask the Germans.
TLDR, yes, because they are offered a livelihood under the understanding they will do so, and allthemore because the contribution to this livelihood by citizens is mandatory, members of the state and particularly elected officials have a moral obligation to privilege the interest of the citizens. But, in what exactly consists this interest is not obvious, and engaging in good faith in the disputatio necessary to define this interest is part of their mission. Lastly, it is not their only source of moral obligation and internal conflicts will inevitably occur. Which duty should be given priority depends on the overarching moral framework considered. For example under moral contractualism a ruler is bound by a mutual agreement only to their constituents and not to foreigners, and has to consider foreigners' human rights only in so far as not being considered like Nazis is in the interest of their own nation. On the other hand a utilitarian ruler will have to consider penalizing their constituents in exchange of an augmentation of happiness in the age world, which might raise internal conflict.