Case Study

How Arcadia Finance Integrates Virtual TestNets at Each Stage of Development

Organization: Arcadia Finance

Website: arcadia.finance

Industry: DeFi

How Arcadia Finance Integrates Virtual TestNets at Each Stage of Development

"Having the ability to work with Tenderly and all the tools it offers was essential to get the whole test suite up and running and continue with the expansion."

Jasper Van Pee

CTO at Arcadia Finance

Arcadia Finance was developed as a solution to the non-homogeneous state of collateral management in DeFi. Designed as a single infrastructure layer for collateral management, Arcadia Finance allows you to interact with any DeFi protocol, using combined collateral value from Arcadia accounts.

Arcadia Finance consists of two distinct components: the protocol and the product. The Arcadia Protocol is open-source, allowing developers to build on top of it and use Arcadia accounts as collaterals. On the other hand, the Arcadia product is user-facing, enabling different use cases for collateral management on-chain. 

Arcadia’s strategies are based on levered yield farming and built on top of the core protocol. Ranging from delta-neutral ETH strategies to more complex, high-leverage strategies, Arcadia Finance allows users to leverage the assets in their accounts as collateral and interact with all of DeFi in a single click. 

How Virtual TestNets eliminate the overhead of running Anvil nodes 

Writing extensive Solidity tests was one of the key focus areas for the Arcadia team from the early days. Their test suit consists of complete unit and fuzzing tests written using Foundry Forge scripts. While the protocol consists of around 4,000 lines of Solidity code, the tests comprise 50,000 lines of code. 

However, the initial testing process was quite a hassle for the Arcadia team. They launched a local Anvil node that created a fork of the public RPC they were working on. The Anvil node was running on a single RPC, forcing all team members to use the same RPC for testing.

However, without the Anvil node, directing all RPC calls to the public RPC would take too long, requiring the team to wait up to an hour for a single test. Yet, running and maintaining such infrastructure created overhead for the Arcadia team, taking their focus away from building the product itself.

Our goal was to build Arcadia and not make a side product to host Anvil nodes. It was completely out of the scope of what we were building with the company, so we didn’t want to spend too much time on it. – Jasper Van Pee, CTO at Arcadia Finance

How Virtual TestNets replaced Anvil nodes

While already using Tenderly transaction simulations, the Arcadia Finance team started exploring alternatives for their testing infrastructure. They quickly transitioned from local Anvil nodes to Virtual TestNets, collaborative development and testing infrastructure

As zero-setup virtually running networks, Virtual TestNets are the exact replica of production networks. By switching to Virtual TestNets, the Arcadia team can now use a single Virtual TestNet RPC in Foundry to run fork tests both in local environments and using GitHub Actions.

Aside from running Foundry fork tests, the Arcadia team can also deploy and test smart contracts on Virtual TestNets during later stages of development. They can deploy new contracts and integrations to ensure everything works as expected, with a significant test throughput.

How Arcadia Finance uses Virtual TestNets for smart contract development
How Arcadia Finance uses Virtual TestNets for smart contract development

How Virtual TestNets replace public testnets

Before introducing Virtual TestNets as a replacement for public testnets, Arcadia Finance used Goerli and then Base Sepolia. Testing in production brought numerous challenges, including no mainnet data, begging for test ETH, and slow redeployments. Additionally, confirmation times were slow, requiring 30 seconds to run a single test, let alone multiple ones. 

With the Arcadia Protocol requiring around 410 transactions just to set everything up, the ability to quickly and seamlessly redeploy contracts on Virtual TestNets was a major benefit for the team. When redeploying smart contracts on public testnets, the Arcadia Finance developers would have to update 10-15 contract addresses everywhere. Now, with Virtual TestNets, they can just switch the RPC and all the contract addresses remain the same. 

Setting up Virtual TestNets is easy, but for me, it’s not even the main win. Being able to test your protocol on a full copy of an existing network where you can just redeploy everything and that you can spin up whenever you make some changes is really powerful. – Jasper Van Pee, CTO at Arcadia Finance

Using Virtual TestNets as the main testing infrastructure

The Arcadia team uses Virtual TestNets to run frontend, backend, and Solidity tests. With complete mainnet data, fast confirmation times, and an unlimited faucet for test tokens, they can facilitate and accelerate testing significantly.

How Arcadia Finance uses Virtual TestNets as a staging environment
How Arcadia Finance uses Virtual TestNets as a staging environment

The Arcadia Finance developers now have dedicated development infrastructure for different purposes: 

  • Smart contract development and testing together with Foundry, replacing local Anvil nodes. 
  • Frontend testing using Virtual TestNets as staging environments to interact with the dapp without deploying to a live chain.
  • Realistic call data generation for collateral prices thanks to Virtual TestNets syncing with the latest state of a production chain, ensuring that Oracle prices are up-to-date. 
  • Reverting the state of Virtual TestNets to initial values whenever the team needs to redeploy contracts and start testing from scratch.
  • Updating yield for all LP positions in Arcadia accounts using Virtual TestNets as staging environments, with extremely fast loading times. 
A syncing fork running parallel to the Mainnet is just superb, especially for us since we have to work with the current prices and the current state of DEXs. – Jasper Van Pee, CTO at Arcadia Finance

Expanding Arcadia Finance together with Tenderly

As the Arcadia Finance team continued expanding their product and building the protocol, they integrated different Tenderly products and features. 

Having the ability to work with Tenderly and all the tools it offers was essential to get the whole test suite up and running and continue with the expansion. – Jasper Van Pee, CTO at Arcadia Finance

While starting with industry-recognized transaction simulations, they now run their dapp and protocol on the entire Tenderly full-stack infrastructure, including the high-performance Node RPC, next-gen Virtual TestNets, and powerful Web3 Actions. 

How Arcadia Finance uses Tenderly's production infrastructure
How Arcadia Finance uses Tenderly's production infrastructure

Arcadia Finance intends to continue exploring Tenderly’s products to support the entire lifecycle of their product on-chain. This way, they can focus on building the core product and facilitating collateral management in DeFi while leaving infrastructure setup and management to a trusted partner. 

🔗
Want to try out a Virtual TestNet with Arcadia Finance contracts? Fork this public Virtual TestNet and start experimenting:
https://virtual.base.rpc.tenderly.co/3f245ae8-41d9-4cca-84a7-206b1a87a418