back to home

0xProject / 0x-settler

0x settlement contracts using Permit2

94 stars
61 forks
19 issues
SolidityShellJavaScript

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing 0xProject/0x-settler in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Source files are only loaded when you start an analysis to optimize performance.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind.in/repo/0xProject/0x-settler)
Preview:Analyzed by RepoMind

Repository Overview (README excerpt)

Crawler view

0x Settler Settlement contracts utilising Permit2 to perform swaps without any passive allowances to the contract. How do I find the most recent deployment? The 0x Settler deployer/registry contract is deployed to across all chains (unless somebody screwed up the vanity address and didn't update this document). The deployer/registry is an ERC1967 UUPS upgradeable contract that implements an ERC721-compatible NFT. To find the address of the most recent deployment, call with the set to the number of the feature that you wish to query. For taker-submitted flows, the feature number is probably 2 unless something major changed and nobody updated this document. For gasless/metatransaction flows, the feature number is probably 3. For intents, the feature number is probably 4. For bridge settler, the feature number is probably 5. A reverting response indicates that is paused and you should not interact. Do not hardcode any address in your integration. _**ALWAYS**_ query the deployer/registry for the address of the most recent contract before building or signing a transaction, metatransaction, or order. 0x API dwell time There is some lag between the deployment of a new instance of 0x Settler and when 0x API begins generating calldata targeting that instance. This allows 0x to perform extensive end-to-end testing to ensure zero downtime for integrators. During this "dwell" period, a strict comparison between the field of the API response and the result of querying will fail. For this reason, there is a fallback. If does not revert, but the return value isn't the expected value, _**YOU SHOULD ALSO**_ query the selector with the same argument. If the response from this function call does not revert and the result is the expected address, then the 0x API is in the dwell time and you may proceed as normal. Example Solidity code for checking whether Settler is genuine While the above code is the _**strongly recommended**_ approach, it is comparatively gas-expensive. A more gas-optimized approach is demonstrated below, but it does not cover the case where Settler has been paused due to a bug. AllowanceHolder addresses AllowanceHolder is deployed to the following addresses depending on the most advanced EVM hardfork supported on the chain. You can hardcode this address in your integration. • on chains supporting the Cancun hardfork (Ethereum mainnet, Ethereum Sepolia testnet, Polygon, Base, Optimism, Arbitrum, Blast, Bnb, Mode, World Chain, Gnosis, Fantom Sonic, Ink, Avalanche, Unichain, Berachain, Scroll, HyperEvm, Katana, Plasma, Monad mainnet, Abstract, Linea, Tempo) • on chains supporting the Shanghai hardfork (Mantle, Taiko) ERC2771 forwarding MultiCall address The ERC2771 forwarding is deployed to across all chains. You can hardcode this address in your integration. I have no idea why you would want to do that, but I guess it's a thing that you can do. The ERC2771 forwarding MultiCall is exclusively used by 0x's solvers for the flavor of 0x Settler. address is deployed to across all chains. You can hardcode this address in your integration. This contract is used to deploy counterfactual (submarine) addresses to faciliate swapping and other actions on foreign chains after bridging. Permit2 address Permit2 is deployed to across all chains. You can hardcode this address in your integration. Examples TypeScript (viem) Click to see TypeScript example of getting Settler addresses JavaScript (Ethers.js) Click to see JavaScript example of getting Settler addresses Note that this example uses version 5 of . The current version of is 6, which is not compatible with this snippet. Rust (Alloy) Cargo.toml Click to see Rust example of getting Settler addresses Python (web3.py) Click to see Python example of getting Settler addresses Bash (Foundry ) Click to see Bash (cast) example of getting Settler addresses `Bash #!/usr/bin/env bash set -Eeufo pipefail -o posix if ! hash cast &>/dev/null ; then echo 'foundry is not installed' >&2 exit 1 fi declare -r deployer='0x00000000000004533Fe15556B1E086BB1A72cEae' declare -A token_descriptions token_descriptions[2]='taker submitted' token_descriptions[3]='metatransaction' token_descriptions[4]='intents' token_descriptions[5]='bridge' declare -r -A token_descriptions declare -r -a function_signatures=('prev(uint128)(address)' 'ownerOf(uint256)(address)' 'next(uint128)(address)') declare -A function_descriptions function_descriptions["${function_signatures[0]%%(*}"]='previous' function_descriptions["${function_signatures[1]%%(*}"]='current' function_descriptions["${function_signatures[2]%%(*}"]='next' declare -r -A function_descriptions declare -i token_id for token_id in "${!token_descriptions[@]}" ; do declare function_signature for function_signature in "${function_signatures[@]}" ; do declare addr addr="$(cast call --rpc-url "$RPC_URL" "$deployer" "$function_signature" "$token_id")" function_signature="${function_signature%%(*}" echo "${function_descriptions["$function_signature"]}"' '"${token_descriptions[$token_id]}"' settler address '"$addr" >&2 done done output: previous bridge settler address 0x37C15fed8F78C252d272c47FaF9564d0C5350D29 current bridge settler address 0x _...truncated for preview_