Skip to content

ScopeLift/optimizoors-perpetual-protocol

Repository files navigation

Perpetual Protocol Optimizoors

⚠️ This code is not audited. Use at your own risk.

About

Perpetual Optimizoors provides a calldata-optimized router for Perpetual Protocol, providing significant gas savings to users. This work was funded by an Ethereum Foundation grant. Read our blog post to learn more about how we optimize protocols on L2.

Development

Instructions

To get started, clone this repo, then follow the below instructions:

# run these commands from the workspace root!
cp .env.example .env

# Run tests
forge test

# Build smart contracts
forge build

Contracts

Documentation for the contracts can he found here.

Addresses

Name Address
Perpetual Router Factory 0xbF2870611603b2f02B8616E0fE65C60f7657a0f4

How it works

We have a router factory which deploys calldata optimized routers for specific functionality within Perpetual Protocol. Currently, we have two types of routers. One that has the functionality for opening and closing positions which we call the PositionRouter, and another to deposit ERC20 or Ethereum into a Perpetual vault which we call the DepositRouter.

There will be one PositionRouter contract per position token. For example if a user is opening a vETH position they will have to call the vETH position router. The same is also true for a DepositRouter. There will a DepositRouter contract per token.

License

This project is available under the MIT license.

Copyright (c) 2023 ScopeLift