### Foundry Installation Workarounds Source: https://github.com/superform-xyz/superform-core/blob/main/README.md Instructions for installing specific Foundry nightly builds to address issues with minimal RAM usage and safe signing operations. These workarounds are necessary for compatibility with certain development environments. ```Shell foundryup -v nightly-f625d0fa7c51e65b4bf1e8f7931cd1c6e2e285e9 foundryup -v nightly-ea2eff95b5c17edd3ffbdfc6daab5ce5cc80afc0 ``` -------------------------------- ### Install Submodule Dependencies Source: https://github.com/superform-xyz/superform-core/blob/main/README.md Installs necessary submodule dependencies for the project using the Forge package manager. This step is crucial before running tests or building the project. ```Shell forge install ``` -------------------------------- ### Configure RPC Variables Source: https://github.com/superform-xyz/superform-core/blob/main/README.md Set your RPC endpoint URLs for various blockchain networks in the Makefile. Ensure that any instances running off 1Password are disabled for proper operation. ```Shell POLYGON_RPC_URL= AVALANCHE_RPC_URL= FANTOM_RPC_URL= BSC_RPC_URL= ARBITRUM_RPC_URL= OPTIMISM_RPC_URL= ETHEREUM_RPC_URL= BASE_RPC_URL= FANTOM_RPC_URL= SEPOLIA_RPC_URL= ``` -------------------------------- ### Run Forge Tests Source: https://github.com/superform-xyz/superform-core/blob/main/README.md Executes all tests defined within the project's smart contracts using the Forge test runner. This command verifies the functionality and integrity of the deployed contracts. ```Shell make ftest ``` -------------------------------- ### Superform Core Contract Interactions Source: https://github.com/superform-xyz/superform-core/blob/main/README.md Details the core contract interactions for deposits and withdrawals, including cross-chain logic, state management, and user position minting/burning. ```APIDOC SuperformRouter.sol Interactions: - Manages all external actions except Superform creation. - Requires 'StateRequest' from DataTypes.sol for deposits/withdrawals. - Handles single/multiple destinations, vaults, same-chain/cross-chain operations. - Integrates swapping and bridging for token deposits. - Can utilize DstSwapper.sol for low bridge liquidity scenarios. - Withdrawals allow token redemption for a different token but funds must return directly to the user. - Ensures individual transactions are either all deposits or all withdrawals. SuperformFactory.sol Interactions: - Allows permissionless addition of vaults to Forms via createSuperform(). - Forms adapt to vault needs, primarily around the ERC-4626 Standard. - Users can wrap vaults into Superforms. - Superforms are assigned unique IDs (superForm address, formId, chainId). SuperPositions (ERC1155A): - Minted to users on successful deposits. - Burned on withdrawals. - Users can opt to retain ERC-4626 shares directly instead of holding in Superform via StateRequest. - Only SuperPositions can be withdrawn through SuperformRouter. Cross-chain Deposit Flow Specifics: - Validation in SuperformRouter.sol. - Dispatch to liquidity bridge via BridgeValidator.sol and LiquidityHandler.sol. - Creation of AMBMessage for CoreStateRegistry.sol. - Messaging uses a main AMB and configurable proof AMBs (set via setRequiredMessagingQuorum in SuperRegistry.sol). - Forwarding payments to PayMaster.sol for cross-chain transaction and relayer costs. - Destination chain CoreStateRegistry.sol receives message. - Keeper updates deposit amounts using updateDepositPayload if no DstSwapper.sol swap occurred. - Deposit fails if received tokens are below StateReq.amount * (1 - StateReq.maxSlippage). - Failed deposits must be rescued via rescueFailedDeposit. - Keeper processes message using processPayload. - Successful deposit sends acknowledgement to source and mints SuperPositions. - Failed deposit results in no message back, no SuperPositions minted, requiring rescue. Error Handling & Rescue: - rescueFailedDeposit: Function to return funds for failed deposits via an optimistic dispute process. - Deposit actions are try-catched for errors within processPayload. ``` -------------------------------- ### Superform Core Keeper Roles - WormholeSRImplementation Source: https://github.com/superform-xyz/superform-core/blob/main/security-review/README.md Outlines the WORMHOLE_VAA_RELAYER_ROLE for reading VAA's for broadcast functionality in WormholeSRImplementation.sol, integrating with the Wormhole network. ```APIDOC WORMHOLE_VAA_RELAYER_ROLE: Description: Role that will be reading VAA's for broadcast functionality in WormholeSRImplementation.sol Contract: WormholeSRImplementation.sol Permissions: Reads VAA's for broadcast functionality. ``` -------------------------------- ### AMB Adapters Source: https://github.com/superform-xyz/superform-core/blob/main/src/crosschain-data/README.md Contracts that act as adapters for different Arbitrary Message Bridges (AMBs) leveraged by Superform. Each adapter handles the specific communication protocols for its respective AMB. ```APIDOC Arbitrary Message Bridge (AMB) Adapters: AxelarImplementation.sol: - Adapter for the Axelar AMB. LayerzeroImplementation.sol: - Adapter for the Layerzero AMB. LayerzeroV2Implementation.sol: - Adapter for the Layerzero V2 AMB. HyperlaneImplementation.sol: - Adapter for the Hyperlane AMB. WormholeARImplementation.sol: - Adapter for the Wormhole Automatic Relayer AMB. WormholeSRImplementation.sol: - Adapter for the Wormhole Specialized Relayer AMB, used specifically in BroadcastRegistry.sol. ``` -------------------------------- ### Superform Core Keeper Roles - DstSwapper Source: https://github.com/superform-xyz/superform-core/blob/main/security-review/README.md Defines the DST_SWAPPER_ROLE for managing swapping operations on the DstSwapper.sol contract, facilitating cross-chain asset exchanges. ```APIDOC DST_SWAPPER_ROLE: Description: Role for managing swapping operations on DstSwapper.sol Contract: DstSwapper.sol Permissions: Manages swapping operations. ``` -------------------------------- ### CoreStateRegistry Contract Source: https://github.com/superform-xyz/superform-core/blob/main/src/crosschain-data/README.md A contract inheriting from BaseStateRegistry that enables core contracts, including routers and form implementations, to communicate with their counterparts on different networks. It contains custom logic for payload processing and updating, particularly during deposits. ```APIDOC CoreStateRegistry: - Inherits from BaseStateRegistry. - Enables communication between core contracts (routers, form implementations) across networks. - Contains custom logic for payload processing and updating, specifically for deposits. - Key Security Assumption: Updating and processing payloads can only be made by keepers with special privileges. ``` -------------------------------- ### Superform Core Keeper Roles - CoreStateRegistry Source: https://github.com/superform-xyz/superform-core/blob/main/security-review/README.md Encompasses multiple roles for the CoreStateRegistry.sol contract, including CORE_STATE_REGISTRY_PROCESSOR_ROLE, CORE_STATE_REGISTRY_UPDATER_ROLE, CORE_STATE_REGISTRY_RESCUER_ROLE, and CORE_STATE_REGISTRY_DISPUTER_ROLE, each managing specific operations. ```APIDOC CORE_STATE_REGISTRY_PROCESSOR_ROLE: Description: Role for managing processing operations in CoreStateRegistry.sol Contract: CoreStateRegistry.sol Permissions: Manages processing operations. CORE_STATE_REGISTRY_UPDATER_ROLE: Description: Role for managing updating operations in CoreStateRegistry.sol Contract: CoreStateRegistry.sol Permissions: Manages updating operations. CORE_STATE_REGISTRY_RESCUER_ROLE: Description: Role for managing rescue operations in CoreStateRegistry.sol Contract: CoreStateRegistry.sol Permissions: Manages rescue operations. CORE_STATE_REGISTRY_DISPUTER_ROLE: Description: Role for managing dispute operations in CoreStateRegistry.sol Contract: CoreStateRegistry.sol Permissions: Manages dispute operations. ``` -------------------------------- ### Superform Core Keeper Roles - BroadcastStateRegistry Source: https://github.com/superform-xyz/superform-core/blob/main/security-review/README.md Details roles associated with the BroadcastStateRegistry.sol contract, including BROADCASTER_ROLE for managing broadcasting payloads and BROADCAST_REGISTRY_PROCESSOR_ROLE for managing broadcast payload processing. ```APIDOC BROADCASTER_ROLE: Description: Role for managing broadcasting payloads in BroadcastStateRegistry.sol Contract: BroadcastStateRegistry.sol Permissions: Manages broadcasting payloads. BROADCAST_REGISTRY_PROCESSOR_ROLE: Description: Role for managing broadcast payload processing in BroadcastStateRegistry.sol Contract: BroadcastStateRegistry.sol Permissions: Manages processing of broadcast payloads. ``` -------------------------------- ### BroadcastRegistry Contract Source: https://github.com/superform-xyz/superform-core/blob/main/src/crosschain-data/README.md Proposes a unique form of communication from one chain (Chain A) to all chains Superform is deployed on, contrasting with BaseStateRegistry's assumed two-chain communication. It is used with the Wormhole Specialized Relayer. ```APIDOC BroadcastRegistry: - Facilitates communication from a source chain to all Superform-supported chains. - Contrasts with BaseStateRegistry's point-to-point communication. - Used specifically with WormholeSRImplementation.sol for specialized relaying. ``` -------------------------------- ### BaseStateRegistry Contract Source: https://github.com/superform-xyz/superform-core/blob/main/src/crosschain-data/README.md The base implementation of the state registry, exposing interfaces for sending and receiving payloads. Any cross-chain message is also referred to as a 'payload'. ```APIDOC BaseStateRegistry: - Exposes interfaces for sending and receiving cross-chain messages (payloads). - Allows any cross-chain message to be received after specific validations from approved AMB wrapper contracts. - Key Security Assumption: 'onlySender' modifier is overridden by all contracts inheriting BaseStateRegistry. ``` -------------------------------- ### Superform Core Keeper Roles - TimelockStateRegistry Source: https://github.com/superform-xyz/superform-core/blob/main/security-review/README.md Specifies the TIMELOCK_STATE_REGISTRY_PROCESSOR_ROLE for managing processing operations within the TimelockStateRegistry.sol contract, ensuring timely and secure state updates. ```APIDOC TIMELOCK_STATE_REGISTRY_PROCESSOR_ROLE: Description: Role for managing processing operations in TimelockStateRegistry.sol Contract: TimelockStateRegistry.sol Permissions: Manages processing operations. ``` -------------------------------- ### State Registry Core Operations Source: https://github.com/superform-xyz/superform-core/blob/main/src/crosschain-data/README.md Core functions for managing cross-chain payloads within the Superform Protocol's State Registry contracts. These include dispatching, broadcasting, updating, and processing payloads across different networks. ```APIDOC State Registry Methods: dispatchPayload(address destinationChain, bytes calldata payload) - Sends a payload to a single destination chain. - Parameters: - destinationChain: The address of the destination chain. - payload: The data to be sent across chains. broadcastPayload(bytes calldata payload) - Sends a payload to all supported destination chains. - Parameters: - payload: The data to be broadcast. updateDepositPayload(bytes calldata payload) - Updates payloads for cross-chain deposits. This function is required for deposits and can only be performed if the appropriate quorum on the chain was met. - Parameters: - payload: The payload data for the deposit. updateWithdrawPayload(bytes calldata payload) - Updates payloads for cross-chain withdrawals. This is optional if the user did not send liquidity data. - Parameters: - payload: The payload data for the withdrawal. processPayload(bytes calldata payload) - Triggers the execution of remote chain information contained within a cross-chain payload. The logic is overridden in different state registries to provide flexibility. - Parameters: - payload: The payload to process. - Notes: - On deposits, payloads must be processed once on the destination chain to deposit funds, and again after acknowledgement to mint SuperPositions. - On withdrawals, payloads must only be processed once on the destination chain to redeem funds. ``` -------------------------------- ### Superform Core Keeper Roles - PayMaster Source: https://github.com/superform-xyz/superform-core/blob/main/security-review/README.md Defines the PAYMENT_ADMIN_ROLE for managing payment-related actions within the PayMaster.sol contract. This role is crucial for handling financial transactions and administrative tasks related to payments. ```APIDOC PAYMENT_ADMIN_ROLE: Description: Role for managing payment-related actions in PayMaster.sol Contract: PayMaster.sol Permissions: Manages payment-related actions. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.