This product allows users to place orders that will be executed at a specified limit price. Orders are placed gaslessly via signed EIP-712 data, and support multiple inputs and multiple outputs.
- Check if msg.sender is allowed
- Check if order still valid
- Check tokens, amounts
- Get order hash
- Recover order owner account [and validate the signature]
- Extract previously filled amounts for order from storage, or create
- Check if fill possible:
- If partiallyFillable, total amount do not exceed
- If not partiallyFillable - it was not filled previously
- Transfer tokens from order owner
- Update order filled amounts in storage
- Get output token balances before
- Execute path with the OdosExecutor
- Get output token balances difference
- Calculate and transfer referral fee if any
- Check slippage, adjust amountOut
- Check surplus
- Transfer tokens to order owner account
- Emit LimitOrderFilled (MultiLimitOrderFilled) event
Chain | Limit Order Router Address |
---|---|
Ethereum |
0x0F26B03961eb5D625BD6001278F0DB13f3e583d8 |
Optimism |
0xafF142fBc8FA5B1885FE54E4C889985F8a579b24 |
BNB |
0xFA198dF5167dc5fb7DDA2Ad413310Be67394bF3d |
Polygon |
0xBefe4BC7f39771CF7C2CcCE6E4e7Ef393deb6704 |
Fantom |
0x275278CEA8d36b879917B51d250F04Be95F905Ed |
Fraxtal |
0x926fAAfcE6148884CD5cF98Cd1878f865E8911Bf |
zkSync Era |
0xa688F1d16b44b9A3110C3b4413b6081F271A643B |
Mantle |
0x51Ea3db8b67462b0A66b3F1fF50cA87C076Acc7a |
Base |
0x8c8c3E8465B911186aDeC83a53C7De8c587eDDaB |
Mode |
0x65005f4Bea4005D48eE9Bdaae960832c6CECC557 |
Arbitrum |
0x83564b903c0311877accEE8f99e6BEb712AD8E43 |
Avalanche |
0xD10634297961fEa132ac7b6e7451BC4E5B17359b |
Linea |
0x5Ab73021e0648f46Da303cE7f5a0F2F15a3944c6 |
Scroll |
0x014F335e0161B4EdDf3fF5b297BA6A31004Ca528 |
forge build
forge test
Test the EIP-712 hash generation to ensure that the Solidity hash is generated correctly.
cd test/eip712test
chmod +x ./runTest.sh
./runTest.sh
forge test --gas-report
npm install -g solhint
solhint 'contracts/*.sol' 'interfaces/*.sol'
forge coverage --report lcov
genhtml -o report lcov.info
Then open the report/index.html
in the browser.
Install Mythril
solc-select install 0.8.19
export SOLC_VERSION=0.8.19
myth analyze contracts/OdosLimitOrderRouter.sol --solc-json ./mythril.config.json
This contract was audited by Halborn in April 2024. A link to the report can be found on the Halborn Website. A copy of the report is included on this page.