Dopex SSOV backtesting tool built with Foundry for testing SSOV V3 contracts.
- Install Foundry.
- Configure Foundry for fork testing by ensuring you have a suitable
rpc_endpoint
set up (guide). Two RPC providers: Alchemy and Infura.
This project is an extension of this project where I aimed to simplify the process for running backtests. The process to run a collection of backtests now involves:
- Prepare a CSV containing transaction details (
epoch
,blockNumber
,strikeIndex
,amount
andtxType
), save it to the analysis folder here. Note: deposit and purchase transactions set viatxType
equal to 0 and 1, respectively. - In the command line, run:
forge test --match-test test_runStrategies --ffi
- This requires the use of the Foundry ffi cheatcode. Read about it here.
- After successfully running the test, the simulated ouptuts are saved in an
output.csv
file in the analysis folder. Here is an example output file.
The error rate of this tool was assessed by comparing real SSOV transactions against simulated ones. This was conducted for:
- DPX weekly calls SSOV V3 (contract:
0x10FD85ec522C245a63239b9FC64434F58520bd1f
). - Epochs: 1-9.
- Writer transactions (deposit -> withdraw).
Results for the collateral token withdrawn and amount of DPX rewards are summarised in diagrams below.