project screenshot 1
project screenshot 2
project screenshot 3

FeFe

Ethereum flash loans written in Fe, tested with Fe, using Foundry cheatcodes

FeFe

Created At

ETHGlobal Istanbul

Winner of

trophy

Ethereum Foundation - Build something with Fe

Project Description

FeFe is a proof-of-concept for testing EVM smart contracts written in Fe with tests also written in Fe, similar to how Solidity contracts are tested with Solidity in Foundry. It leverages Foundry cheat codes to manipulate the chain into its desired state during testing. The reference smart contract in this proof-of-concept allows users to take flash loans in native ETH, which they must return in the same transaction with interest.

How it's Made

I implemented a minimal flash loan contract in FeFe and reimplemented a subset of Foundry's VM interface in the same language. Then I wrote a test in Fe that leverages the "prank" cheat code to set msg.sender to a specific address during testing. I ran the Fe test with Foundry by deploying its raw compiled bytecode directly from boilerplate Solidity code. I wrote a simple bash script that makes the bytecode easily available from Solidity for this purpose.

background image mobile

Join the mailing list

Get the latest news and updates