Skip to main content

Forwarder Addresses

What does the Forwarder Address do?​

The forwarder address is essentially a proxy contract that:

  1. Receives cross-chain messages through the SOCKET protocol.
  2. Forwards the calls to the correct chain and address.

Since each forwarder is tied to a specific (chainSlug, address) pair, it knows exactly where to forward the call when triggered.

SOCKET uses these forwarder contracts that are automatically deployed alongside your onchain contracts when you deploy. Each forwarder contract is immutable and is specifically tied to a unique (chain, address) pair. This ensures that when a forwarder contract is called, it knows exactly which chain and which address to forward the call to.

forwarder addresses

Creating and Accessing Forwarder Addresses​

Using the Deployer contract constructor to deploy the Forwarder Address​

When your Deployer contract is deployed, the constructor can automatically create a forwarder for your onchain contract. Here's the relevant code from the constructor:

IAddressResolver(addressResolver).deployForwarderContract(
address(this), // The address of the current deploying contract
onchainAddress, // The address of the onchain contract (e.g. token)
chainSlug // The chain identifier for the target chain
);
  • address(this) — Refers to the current AppDeployer contract.
  • onchainTokenAddress — The address of the onchain contract (such as a token or other smart contract) that needs a forwarder.
  • chainSlug — A unique identifier for the target blockchain (e.g., 1- Ethereum, 8453 - Base, etc).

This call ensures that a forwarder contract is deployed and linked to the specified (chainSlug, onchainTokenAddress) pair.

Accessing Forwarder Addresses​

Once deployed, you can access the forwarder addresses through the forwarderAddresses mapping in the Deployer contract:

address forwarderAddress = forwarderAddresses[contractAddress][chainSlug];

This mapping allows you to retrieve the forwarder address for any contract and chain combination. For example:

address superTokenVaultForwarder = forwarderAddresses[superTokenVault][chainSlug];

See how this example usage here.