CVS and Walgreens have agreed to pay state and local governments a combined total of more than $10 billion to settle lawsuits over the toll of opioids and now want to know by Dec. 31 whether states are accepting the deals.

States announced final details Monday of settlements that the two largest pharmacy chains in the U.S. offered last month.

The deals are among the largest in a wave of proposed and finalized settlements over opioids in recent years totaling more than $50 billion. Another big pharmacy operator, Walmart, also agreed to a settlement last month for $3.1 billion.

Although lawyers involved in the cases are in line for a cut of the payments, most of the money is to be used to fight an overdose epidemic that has only deepened in recent years.

Opioids have been linked to more than 500,000 deaths in the U.S. in the past two decades, with the most casualties in recent years. The drugs responsible for the bulk of the deaths have shifted from prescription painkillers to illicitly produced fentanyl, which is often being mixed into other street drugs.

In the 2010s, state and local governments filed thousands of lawsuits seeking to hold the drug industry accountable for the crisis. Key drugmakers and distribution companies have already agreed to settlements.

Now, pharmacies, which were subject to claims that they should have realized they were filling too many opioid prescriptions, are following suit.

Under the separate deals, states have until the end of the year to agree to drop claims over opioids against Walgreens and CVS to receive the maximum payouts.

If there aren’t enough states participating, the companies can back out.

California Attorney General Rob Bonta said in a statement Monday that California could get up to $510 million in the Walgreens settlement. He said the state is still assessing the terms of the CVS deal.

“To all those struggling with substance abuse disorders, to all those desperately in need of treatment and recovery options — help is on the way,” Bonta said.

Other states, including Massachusetts, New York, North Carolina, Oregon and Pennsylvania, have indicated they’re accepting the terms of both settlements.

If there is sufficient sign-on from states, local governments can also sign on to get shares.

The amount awarded to governments is based on their populations and the severity of the opioid crisis there. States will get bigger amounts if more of their local governments agree.

The Walgreens payments could total up to $5.52 billion over 15 years. The CVS payments could reach $4.9 billion over 10 years. Additionally, the companies have announced tentative payments to Native American tribes totaling more than $250 million.

KRON On is streaming live news now

Like other opioid settlements, the agreements call for governments that receive money to use it to fight the drug crisis.

Under the deals, about $1.2 billion would be set aside for lawyers’ fees and legal expenses.

The companies also have agreed to monitor, report and share data about suspicious activity related to opioid prescriptions.

“CVS and Walgreens flooded our cities and towns with bottles upon bottles of pills with callous disregard for the suffering their actions caused,” Connecticut Attorney General William Tong said in a statement Monday. “Our settlement mandates significant changes to their business practices, including court-ordered monitoring to ensure the checks and balances that should have been in place all along will now be aggressively enforced.”