Skip to content

Repository files navigation

Cork Protocol Sandbox

A local simulation environment for the Cork Protocol using the Ape Framework.

Overview

This repository contains a development and testing environment that forks the Ethereum Mainnet state to a local sandbox. Utilizing ApeWorX (Ape Framework), this project allows developers to interact with the Cork Protocol contracts in a deterministic, risk-free environment, through simple python method calls.

It is designed to:

  1. Fork Mainnet at a specific block height to capture the real-world state of the Cork Protocol.
  2. Simulate Transactions (swaps, stakes, governance votes) against the protocol without spending gas.
  3. Impersonate Accounts (Whales/Admin/Multisig) to test privileged functions or edge cases.

User Guide

  1. Clone the Repository
git clone https://github.com/JoaoBarbara5/CorkSim.git
cd CorkSim
  1. Set environment variables in compose file

in "docker-compose.yaml" set the environment variables with personal api keys:

ETHERSCAN_API_KEY: #Insert your Etherscan API key here 
WEB3_ALCHEMY_PROJECT_ID: #Insert your Alchemy API key here
BITQUERY_API_KEY: #Insert your Bitquery API key here (free option expires after 30 days)
  1. Build the Docker Image
docker compose build #only on to build on first use
docker compose up
  1. Execute the container

in a new terminal execute the command

docker exec -it ape-test /bin/bash
  1. Run the ape console from working directory "cork_project"
ape console --network ethereum:mainnet-fork:foundry #you can add preffered block number if needed

(inside container)

  1. Execute the python scripts inside the ape-python console
exec(open("scripts/script_setup.py").read())
  1. Interact with the environment by calling the python functions with set arguemnts

Example of a live market: wallet address: 0x22a709eece6ee82293e5fcdeea7ceefdefd499cd pair id: 0xd8fe1a67a9683a3f577895ea834b1711e759b490c308d25417802eb2a50a59c9

About

A local simulation environment for the Cork Protocol in the Ethereum Mainnet using the Ape Framework.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages