Skip to content

Kwenta/smart-margin-v3

Repository files navigation

🧱 Smart Margin v3

Github Actions Foundry License: GPL-3.0

Docs

Please refer to the project wiki for all documentation.

Contracts

tree src/

src/
├── Engine.sol
├── interfaces
│   ├── IEngine.sol
│   ├── synthetix
│   │   ├── IERC7412.sol
│   │   ├── IPerpsMarketProxy.sol
│   │   └── ISpotMarketProxy.sol
│   └── tokens
│       └── IERC20.sol
├── libraries
│   ├── ConditionalOrderHashLib.sol
│   ├── MathLib.sol
│   └── SignatureCheckerLib.sol
└── utils
    ├── EIP712.sol
    ├── EIP7412.sol
    └── MulticallablePayable.sol

Tests

  1. Install dependencies
npm i
  1. Follow the Foundry guide to working on an existing project

  2. Build project

npm run compile
  1. Execute forge tests (requires rpc url(s) to be set in .env)
npm run test
  1. Run specific forge test
forge test --fork-url $(grep BASE_RPC_URL .env | cut -d '=' -f2) --match-test TEST_NAME -vvv
  1. Decode a custom error defined by Synthetix v3

    ex: npm run decode-custom-error -- 0x01de5522...

npm run decode-custom-error -- <error hash 0x...>
  1. Run hardhat tests

project must be compiled first (see step 2)

npm run test:hh

Deployment Addresses

See deployments/ folder

  1. Optimism deployments found in deployments/Optimism.json
  2. Optimism Goerli deployments found in deployments/OptimismGoerli.json
  3. Base deployments found in deployments/Base.json
  4. Base Goerli deployments found in deployments/BaseGoerli.json

Audits

See audits/ folder

  1. Internal audits found in audits/internal/
  2. External audits found in audits/external/

About

SMv3 is Kwenta's proprietary margin engine for interacting with and trading on-chain derivatives

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published