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

Kwenta/smart-margin-v3-arbitrum

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