WorkflowCredmark Logo

DeFi Treasury Management Part II

The Execution

Paul Murphy

2022/03/08

A few months ago I wrote about the difficulties of DeFi treasury management from a planning perspective. It was called “DeFi Treasury Management - A Halloween Special” because managing money in DeFi is a horror show. Normal DeFi risks, like losing all of your money when you type a single incorrect number in a 42 character Eth address, become really scary when you’re moving around tens (if not hundreds) of thousands of dollars. Add in a half dozen protocols, 3 chains, a series of incompatible tools and you can start to see why I had a horror show on my hands.

Fortunately, my colleague Asan, who is responsible for Credmark’s treasury management strategy, had put together a very clear asset allocation plan. He’s an experienced asset manager and crypto trader. He knows what he’s doing.

You can find the plan for our first cycle here.

It was published in mid-December. We planned to execute it by January 1st.

The Execution

Asan’s treasury management strategy is relatively traditional, but on the aggressive side. We decided to keep the execution dead-simple:

  1. Asan publishes an asset allocation plan.
  2. Someone executes the plan.
  3. We analyze the plan's performance at the end of the month.

Rinse and repeat.

Getting this done was my problem, so I was stuck executing. Because all of Credmark’s treasury is managed through multi-sigs, I also needed a volunteer. It was getting close to Christmas and everyone had something better to do, but my colleague Collier felt sorry for me and offered to help. It’s possible he’ll never forgive me.

We read through the plan together and said: “Two hours, max.” We scheduled a two and a half hour meeting, just in case.

Reality Bites

We thought the first phase of our asset allocation was dead simple: diversify our stablecoin holdings. Our treasury was primarily USDC, with some USDT. Asan wanted a more diverse portfolio: more USDT, some TUSD, some DAI, and some PAX.

No problem.

We store our treasury assets in a Gnosis safe, and we use CoinShift to make our lives easier. We executed our first swap on Gnosis: USDC for DAI. Collier set it up and I confirmed it.

20 minutes later, it failed. We tried again. Same result.
So we tried using CoinShift. Same problem, over and over.

Two and a half hours after starting, we still had 0 (ZERO!) DAI in our treasury. And that was only the first of many transactions.

At that point we called one of our in-house Ethereum experts and asked him what he thought was happening. After some digging, he reported that swaps from Gnosis (or tools built on Gnosis) requires the price for the swap to remain the same between multiple signers. If the price changes in between initiation and confirmation of the second signer, the transaction fails.

Even though the swap is initiated, the order put in may no longer be valid based on the new market price.

Further complicating things, if a swap isn’t executed within ~5 minutes of initiation, it fails. When you’re dealing with crazy gas fluctuations and coordinating across multiple continents, this time window is more constraining than you’d think.

Of course, all of this is configurable, but the usability isn’t even close to what we needed to get through our strategy during this decade. Collier and I settled on transferring the USDC to a Trezor, executing the swap, and then sending the DAI back to the treasury safe.

The next day I had to fly from Texas to Italy, so Collier and I couldn’t continue working together. We decided to clone a Trezor so that we could check each other. Not exactly multisig, but safer than putting all the responsibility on a single person.

Home Alone

When I got home, we scheduled our next meeting. Three hours, just to be safe.

If you’ve ever seen the movie “Home Alone” you probably remember the hapless robbers being foiled at every turn by the imaginative kid. Well, that’s exactly what my next few sessions with Collier felt like.

Every session we were sure we’d reach our goal. Session after session, we failed. In the end we spent 44 hours executing Asan’s plan.

Swap Swap Swap

Once we moved the USDC to our Trezors, swapping them for other stablecoins was easy. We used Uniswap and Sushiswap. We would have used 1inch, but Collier couldn’t get to the site because he was in the US. Thank you SEC.

ERC-20s were easy.

But then Asan wanted us to buy some ADA, some SOL, some MATIC, and some BTC. 😱

The Texas Crosschainsaw Massacre

One thing I forgot to mention earlier was that our core team members didn’t want us to use a central exchange. “Keep it DeFi” he said. We tried.

We had a bunch of ERC-20 tokens. How were we going to get our hands on tokens from other chains without an exchange? And once we had them, where were we going to put them? Even though Gnosis is on multiple chains, it isn’t really multichain yet. If you are on a non-Eth chain and try to send assets to your Eth Gnosis safe, POOF, you’ve just lit those assets on fire with no chance of recovery.

We started with SOL and came up with a cunning plan.

  1. Use Wormhole Bridge to wrap ETH to move it to Solana.
  2. Use a Solana DEX to Swap wrapped ETH for SOL.
  3. Use Wormhole Bridge to wrap SOL to move it to Ethereum.
  4. Send the wrapped SOL to our Treasury.

Easy.

Unfortunately, everything that could go wrong went wrong.

  • Wormhole Bridge didn’t work with a Trezor connected to Metamask, so we had to move tokens to Metamask.
  • Solflare no longer allowed my Ledger to sign transactions. No idea why that stopped working. So I had to move SOL directly to a Solflare native wallet.
  • Later I had to destroy the Solflare native wallet to re-attach my ledger. No problem, I had the seed phrase. But when I recreated the wallet using the seed phrase, I got different addresses. An address that held USD 30K of SOL was inaccessible to me.
  • I spent two hours trying to come up with a story that explained how I’d lost thirty thousand dollars without making me sound like a complete idiot. My dog was puzzled by my pacing until I asked myself if maybe this was a wallet bug. Time for a Hail Mary 🙏🏻. I created a Solet wallet with the seed phrase and lo, it worked! The wallet contained the original address, and I could access our SOL.

As one of my colleagues likes to say: “We’re so early.”

Getting wrapped ADA was easy thanks to Occam.fi's swap. Very elegant. As I type, the service seems to have disappeared, so now I wonder if we’ll ever be able to unwrap our ADA! Sigh.

Lending and Borrowing

Next, Asan wanted us to lend some tokens and borrow others. He showed us a lot of math to justify all this activity, but Collier and I didn’t care by that point. We were the executioners, the brawn of the operation. Whatever the brain wanted, we were going to deliver, even if it killed us.

Luckily all of the borrowing and lending only involved ERC-20 tokens. That’s not quite true. Some BTC was required, but by that point we knew he really meant wBTC 😉

So we headed over to Aave and got to work. Incredibly, (almost) nothing went wrong. Everything worked as planned, at least on my computer. On Collier's, nothing worked. We don’t know why. Having a cloned Trezor saved the day.

A Few Failures

We left a few token buys for last: QRDO and BLOK. We looked for them on every DEX we knew, but couldn’t find them. Time to break the rules.

We found a centralized exchange in Asia that allowed us to signup with only an email address. Lack of KYC made it feel almost DEXish. After a few tests we decided it wasn’t a scam, and bought some QRDO and BLOK. BLOK lives on the Polygon network. Using a centralized exchange insulated us from the pain of moving things on and off of Polygon.

OK, almost done.

The very last thing on our list was staking the BLOK. We found the app to do that, but it had taken so long for us to get through our treasury management plan we found that all the BLOK staking pools were closed. Our BLOK remains unstaked.

What’s Next?

We survived. What’s next?

Our treasury management strategy has two very specific goals:

  1. Earn a small profit on our assets without taking too much risk.
  2. Guaranty enough liquidity to fund operations.

At the end of this month our risk team will analyze how their strategy performed. We’re all looking forward to reading the results.

In the meantime we need to figure out how to make this process more efficient. Executing Asan’s strategy was not cheap. We spent about USD 3,000 in gas fees. As I mentioned earlier, Collier and I spent approximately 44 hours. Assuming our time is worth USD 100 per hour, that’s an additional cost of USD 4,400. Before we earn anything, we’re starting USD 7,400 in the hole.

Lessons Learned

And finally, a few lessons learned.

  1. Keep it simple.
  2. Purity is a luxury.
  3. Speed matters.

Knowing what we now know, Collier and I believe that we could repeat this work in half the time. That’s still a lot. We will be talking to Asan about reducing the complexity of the strategy. Cross chain operations and exotic tokens were the most time-consuming aspects of our work. Eliminate those and everything will go much faster.

Sticking to DeFi was a great goal. Unfortunately, it’s not always possible. We could have saved some time and money if we’d acknowledged that from the start. Sometimes it’s OK to get a little dirty.

As I mentioned earlier, we planned to finish our asset allocation work by January 1st. We finished on the 23rd. By that time we should have been near the end of our first cycle. Market sentiment had changed dramatically. Asan’s second cycle plan would have taken that into account. Instead, he is going to have to deal with an additional month of mostly negative activity. Luckily, he’s a pretty conservative guy who understands the ins and outs of treasury management. The portfolio he had us build was carefully analyzed to minimize risk. That kind of planning is the difference between life and rekt.

copy to clipboard

Sign up for our newsletter for the latest product updates, partnerships, and more.

Ready to get started?

Sign up for our free Token API

Get the latest news

Footer

Credmark logo
DiscordDiscord iconTwitterTelegramTelegram iconYoutubeYouTube iconGitHub

© 2023 Credmark Labs, Inc. All rights reserved.

Products

  • All Products
  • Token API
  • Portfolio API
  • DeFi API
  • Raw Data

Documentation

  • Token API Reference
  • Portfolio API Reference
  • DeFi API Reference
  • Transformation Reference
  • Framework Reference

Resources

  • FAQ
  • Blog
  • Reports
  • Media

About

  • Careers
  • About us
  • Community

Support

  • Status
  • Contact us