StarkGate architecture

While StarkGate is referred to as a bridge, technically, each supported token has its own bridge, each of which is defined in a corresponding pair of L1 and L2 contracts, as described in Components of a bridge for an individual token.

Table 1. Components of a bridge for an individual token

L1

  • ERC-20 contract that defines the token on Ethereum. This contract must exist before you can bridge it.

  • Bridge functionality for ERC-20 tokens is supported in StarknetTokenBridge.sol.

L2

  • StarkGate Cairo bridge contract instance of the token_bridge.cairo contract class.

  • ERC-20 Cairo token contract instance of a standard ERC-20 Cairo token contract class. Each new contract uses the hash of this class to define its inheritance. StarkGate creates this contract automatically when creating the bridge in StarkGate.

StarkGate 2.0 provides a contract that enables seamless backward compatibility with the previous version of StarkGate.

When you update the code in your contract, make sure that you use the most up-to-date versions of all StarkGate contracts.

You can check if a token is currently supported with the L1 function getBridge.

You can permissionlessly add support for ERC-20 tokens to the multi-token bridge using the enrollTokenBridge function.

The StarkGate Manager and Registry

StarkGate includes the following administration components:

The StarkGate Manager

is responsible for adding bridges

The StarkGate Registry
  • contains the addresses to all supported bridges

  • enables a bridge developer to stop servicing an existing bridge

Withdrawal limit

By default, StarkGate imposes no limit on withdrawals. However, in order to mitigate risks associated with critical vulnerabilities that could result in the loss of user funds, StarkGate can enable a withdrawal limit.

If a serious security issue arises, the security agent in the StarkGate contract can limit withdrawals to 5% of the Total Value Locked (TVL) per day for any affected token by calling the setWithdrawLimitPCT() function in the WithdrawalLimit.sol contract. A dedicated team can then investigate and resolve the issue.

Only a security admin quorum can disable the withdrawal limit. The quorum will consist of Starknet Foundation members, Starknet ecosystem contributors, and StarkWare representatives. This diverse group will ensure that decisions reflect the Starknet community’s broad interests.

This approach, blending manual oversight with automated detection, aims to minimize potential losses.

Additional resources