SBF on trial: The Python code that allegedly let Alameda hedge fund spend people's FTX deposits

And Caroline Ellison says she was told by Bankman-Fried to take $10B from customer accounts

At the fraud trial of former FTX head Sam Bankman-Fried, prosecutors presented the jury with Python code for the FTX backend that allowed flagged client accounts to spend money they didn't have on the cryptocurrency exchange.

Multiple accounts associated with Alameda Research, the hedge fund controlled by Bankman-Fried that allegedly used billions of dollars of customer deposits in FTX as a slush fund, were flagged thus, according to reported accounts of the testimony of FTX co-founder Gary Wang.

This contradicts Bankman-Fried's July 31, 2019 statement that Alameda and its accounts were treated the same as any other customer on FTX. That is to say, Alameda Research, which bankrolled startups and other ventures, had a normal account on FTX, according to SBF, but it's now alleged the hedge fund was able to spend as it wanted, with the funds coming from a pool of customer assets.

It is claimed SBF therefore not only used hundreds of millions of dollars of people's money to fund his super-luxury lifestyle, he used money held in FTX to cover Alameda, especially when it made bad bets.

FTX Trading, a cryptocurrency exchange once fancifully valued at $32 billion, declared bankruptcy last November, along with 134 affiliate companies. Bankman-Fried was subsequently charged by US federal prosecutors with fraud, money laundering, and campaign finance offenses. He faces two trials, one covering seven counts that began last week in New York City, the other covering six counts that's scheduled for March next year.

The code

At the current trial, prosecutors presented a screenshot of the FTX codebase that showed the function of the allow_negative flag, which when set to true enabled spending when the account balance was zero or less.

The code was revealed by Molly White, a software engineer and an online publisher, in her newsletter.

if not account.allow_negative:
  if (balance.available_ignoring_colleteral if ignore_collateral else balance_available) <0:
    Raise BadRequest('Account does not have enough balances')

Basically, the top line allows the balance check only when allow_negative is false.

Wang, who has already pleaded guilty to four charges, reportedly said that the code let Alameda Research's accounts on FTX avoid overdraft checks, demonstrating the cryptocurrency investment biz was not treated the same as other customers. This is essentially the alleged backdoor in FTX that allowed Alameda Research to obtain $65 billion in credit and to wind up with $8 billion in liability upon bankruptcy.

This code change was made, according to Wang, at the behest of Bankman-Fried.

The defense's explanation for this, according to White, is that Alameda was responsible for converting US dollars to stablecoins (digital tokens pegged to the dollar) and used the flag to borrow funds from FTX before returning them as stablecoins.

Another code snippet presented to the jury covers the FTX insurance fund, a figure that the bankrupt exchange published to indicate the amount of money set aside to protect bad investments.

At trial, Wang told the government prosecutor the number was fake. As documented by White, the function that calculated the insurance fund looked like this:

return f2d(numpy.random.normal(7500, 3000)) * daily_volume / Decimal('1e9')

In this Python line, the purported insurance value was calculated by generating a random number somewhere around 7,500 using the numpy.random.normal function, multiplying the number times the daily trading volume (~$13 billion to ~$26 billion about a year ago) and then dividing the total by one billion (1e9 or 10^9).

On Tuesday, Caroline Ellison, former CEO of Alameda Research and Bankman-Fried's former romantic partner, testified that Bankman-Fried had told her to take about $10 billion in customer funds from FTX to repay loans made to Alameda.

According to Reuters, Bankman-Fried told Ellison to provide lenders with a misleading balance sheet to play down the financial risk.

Ellison, like Wang, has already pleaded guilty and is cooperating with prosecutors.

Bankman-Fried was jailed in August prior to the trial for witness intimidation and has pleaded not guilty on all charges. ®

 

More about

TIP US OFF

Send us news


Other stories you might like