Skip to content

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

License

Notifications You must be signed in to change notification settings

gmh5225/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
│   ├── oracles
│   │   └── IPyth.sol
│   ├── synthetix
│   │   ├── IERC7412.sol
│   │   ├── IPerpsMarketProxy.sol
│   │   └── ISpotMarketProxy.sol
│   └── tokens
│       └── IERC20.sol
├── libraries
│   ├── ConditionalOrderHashLib.sol
│   ├── MathLib.sol
│   └── SignatureCheckerLib.sol
└── utils
    ├── EIP712.sol
    └── EIP7412.sol

Tests

  1. Follow the Foundry guide to working on an existing project

  2. Build project

npm run compile
  1. Execute tests (requires rpc url(s) to be set in .env)
npm run test
  1. Run specific test

    OPTIMISM_GOERLI_RPC_URL can be replaced with OPTIMISM_RPC_URL if a mainnet fork is desired

forge test --fork-url $(grep OPTIMISM_GOERLI_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...>

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

Languages

  • Solidity 99.9%
  • Other 0.1%