Skip to content

Global Address

Global Address enables users to easily deposit funds to a L2/L3 from any CEXs, fiat onramps, and chains, by simply sending funds to a unique deposit address on any chain.

Technically, Global Address is an address that encodes a cross-chain intent. When anyone sends funds to a global address on any chain, they are funding the intent and thereby triggering the intent on a specific destination chain. In other words, global address is source-chain agnostic, but target-chain specific.

Common Use Cases

  • Sending funds from CEXs directly to an L2/L3.
  • Using a fiat onramp with a L2/L3, even if the onramp doesn't directly support the L2/L3.
  • Depositing into a token vault with funds from another chain.
  • Cross-chain transfers.

Try Global Address

You can try using global address at the official portal.

Supported chains

You can see a list of chains Global Address supports here. If you want your chain supported, get in touch.

Installation

npm
npm i @zerodev/global-address

Usage

Global address has a beautifully simple API: just createGlobalAddress and then send funds to it. That's really it.

Code Example

We recommend that you take a look at our code example (even better if you try running it) as you follow along the docs.

Creating a global address

In the following example, we are going to create a global address that, when receiving funds on any chain, will transfer the funds to a specific address on Base. This is helpful when, for instance, you want to create a deposit address for your user, so that they can send funds to the address on any chain (possibly from a CEX), and then they will receive funds in their wallet on the chain that your app runs on.

First import some types and functions:

import {
  createGlobalAddress,
  createCall,
  ActionType,
  FLEX,
  CreateGlobalAddressParams,
} from '@zerodev/global-address'

Then set up some values (explained below):

// Replace with your own address
const owner = '0x244b33858733aab5307B0919D31f73878cAF617B'
 
// Source tokens (any ERC20 on arbitrum, ETH on mainnet, USDC on optimism)
const srcTokens: CreateGlobalAddressParams["srcTokens"] = [
  {
    tokenType: 'ERC20',
    chain: arbitrum,
  },
  {
    tokenType: 'NATIVE',
    chain: mainnet
  },
  {
    tokenType: 'USDC',
    chain: optimism
  },
]
 
const destChain = base
const slippage = 5000
 
// This is the call that will be executed on the destination chain
const call = createCall({
  target: FLEX.TOKEN_ADDRESS,  // any tokens
  value: 0n,
  abi: erc20Abi,
  functionName: 'transfer',
  args: [owner, FLEX.AMOUNT],  // any amount
  callType: CallType.CALL,
})

Finally, create a global address:

const { globalAddress } = await createGlobalAddress({
  owner,
  destChain,
  srcTokens,
  actions: {
    'USDC': {
      action: [call],
      fallBack: [],
    }
  },
  slippage,
})

The options are:

  • owner is an address that is authorized to recover funds from the global address, in case the global address fails to execute the target action for whatever reason. Typically you would set this to your user's EOA wallet, but you could also set it to your own address if you want to recover funds for users.

  • destChain is the chain on which the actions are supposed to happen. This is presumably the chain that your app runs on.

  • srcTokens is a list of tokens that the global address should be able to receive. Only tokens listed in srcTokens will trigger actions on the destination. The other tokens sent to the address will have to be manually recovered by the owner.

  • actions is a map that records which action will be triggered by which token. In the example above, we specified an action that will be triggered when the global address receives USDC.

  • slippage is the maximum slippage that the user can expect. slippage is an integer, where 1 is equal to 0.01% (so 100 would mean 1% slippage). You can skip this param if you are unsure what to set, and the SDK will estimate a reasonable slippage based on your other settings.

Once you have created a global address, you can send tokens to it on any of the chains specified in srcTokens, and the actions will happen on the destChain. It's really that simple.

Pricing

Monthly Pricing

  • Base pricing (paid by the developer)
    • $2000/month, which includes 5000 active addresses.
      • $200 for each additional 1000 active addresses.
  • Usage pricing (paid by the user with their transferred tokens):
    • 20 basis points (0.20%) for transfers below $500
    • 10 basis points (0.10%) for transfers above $500

Annual Pricing

  • Base pricing (paid by the developer)
    • $20000/year, with unlimited active addresses.
  • Usage pricing (paid by the user with their transferred tokens):
    • 15 basis points (0.15%) for transfers below $500
    • 5 basis points (0.05%) for transfers above $500

Notes

  • An "active address" is defined as a global address that was created or used during a given month.
  • Global Address integrates with bridges under the hood, so the usage pricing is on top of the underlying bridge fees.
  • Pricing can be negotiated. Feel free to reach out.