NEW YORK (AP) — Sam Bankman-Fried authorized the illegal use of FTX customers’ funds and assets to plug financial gaps at an affiliated hedge fund from the exchange’s earliest days, FTX’s co-founder Gary Wang told a New York jury on Friday, as prosecutors pressed their case that Bankman-Fried was the mastermind behind one of the biggest frauds in U.S. history. Eventually, the losses at the hedge fund, Alameda Research, became so large that there was no way to hide them any longer, Wang said in his second day of testimony. Prosecutors allege that Bankman-Fried, 31, stole billions of dollars from investors and customers in order to fund a lavish lifestyle in The Bahamas and buy the influence of politicians, celebrities and the public. Wang was FTX’s chief technology officer and is part of what has been referred to as the “inner circle” of FTX executives who have agreed to testify against Bankman-Fried in exchange for leniency in their own criminal cases. Wang has pleaded guilty to wire fraud, securities and commodities fraud as part of his agreement with prosecutors. “FTX was not fine,” Wang said, referring to the now-infamous tweet that Bankman-Fried wrote only a few days before the exchange filed for bankruptcy in November 2022. Wang told the jury that, at the direction of Bankman-Fried, he inserted code into FTX’s operations that would give Alameda Research the ability to make nearly unlimited withdrawals from FTX and have a line of credit up to $65 billion. Alameda was given these privileges initially because the hedge fund was the primary market maker for FTX’s customers in the exchange’s early days. The relationship was effectively a two-way street, where the exchange could help out the hedge fund and vice versa as FTX quickly grew between 2019 and 2022. At one point, when a technical bug caused FTX to have hundreds of millions of dollars in paper losses on a particular cryptocurrency, Wang said Bankman-Fried ordered that loss to be moved onto Alameda’s balance sheet because FTX’s financial condition was more visible to the public while Alameda’s balance sheet was not. Wang is expected to continue to testify on Tuesday. Caroline Ellison, the former girlfriend of Bankman-Fried and CEO of Alameda, is expected to start testifying Tuesday after Wang.