FraxNet
Stablecoins as a Service (SaaS)
Branded Factory

BrandedFactory

Overview

BrandedFactory handles the deployment of branded stablecoin tokens, their custodian contracts, and cross-chain routers. On Fraxtal, deployments are initiated directly via deployBrandedToken. On all other chains, deployments are triggered by LayerZero compose messages via lzCompose.

Key Features

  • Deterministic CREATE2 deployment of branded stablecoins, custodians, and routers
  • Cross-chain deployment coordination via LayerZero compose messages
  • Unified brandedTokenToUtils mapping for looking up custodian and router addresses
  • Beacon proxy pattern for upgradeable custodian and router implementations
  • Support for isolated backing configurations with siloed custodians

Initialization

function initialize(
  address _owner,
  address _l0Endpoint,
  address _frxUSDLocal,
  address _localRemoteHop,
  address _dollarImplementationLocal,
  address _brandedCustodianBeaconLocal,
  address _routerBeaconLocal
) external

Constants & Roles

NameTypeDescription
MINTER_ROLEbytes32Role required for minting operations
LOCAL_DEPLOYERbytes32Role required for local deployment on Fraxtal

State Variables

NameTypeDescription
endpointaddressLayerZero EndpointV2 address
frxUSDLocaladdressLocal frxUSD OFT address
dollarImplementationLocaladdressBranded stablecoin implementation address
brandedCustodianBeaconaddressBeacon for custodian proxy deployments
routerBeaconaddressBeacon for router proxy deployments
fraxtalFactoryaddressMaster factory address on Fraxtal
localRemoteHopaddressLocal RemoteHopV2 address
owneraddressOwner address
brandedTokenToUtilsmapping(address => AssetUtils)Maps branded token to its custodian, router, and siloed custodian
custodianRegistryBrandedCustodianRegistryRegistry for isolated backing validation

Functions

Deployment

function deployBrandedToken(
  string memory name,
  string memory symbol,
  bytes32 salt
) external onlyRole(LOCAL_DEPLOYER) returns (address coin, address custodian, address router)
  • Deploys a branded stablecoin and its periphery contracts on Fraxtal.
  • Only callable on Fraxtal (chainid 252) by addresses with LOCAL_DEPLOYER role.
  • Returns the addresses of the deployed token, custodian, and router.

Cross-Chain Deployment

function lzCompose(
  address _oft,
  bytes32,
  bytes calldata _message,
  address,
  bytes calldata
) external payable
  • Called by the LayerZero endpoint when a compose message arrives from the Fraxtal factory.
  • Decodes the token name, symbol, and salt from the message and deploys the branded token locally.
  • Includes duplicate message protection.

Lookup

function brandedTokenToUtils(address token) external view returns (address custodian, address router, address siloed)
  • Returns the custodian, router, and siloed custodian addresses for a branded token.

Address Computation

function computeProxyAddress(
  string memory _name,
  string memory _symbol,
  bytes32 _salt
) public view returns (address predicted)
  • Computes the deterministic address for a branded stablecoin before deployment.

Admin Functions

function setEndpoint(address _endpoint) external onlyRole(DEFAULT_ADMIN_ROLE)
function setFrxUSDLocal(address _frxUSDLocal) external onlyRole(DEFAULT_ADMIN_ROLE)
function setLocalRemoteHop(address _newHop) external onlyRole(DEFAULT_ADMIN_ROLE)
function setFraxtalFactory(address _fraxtalFactory) external onlyRole(DEFAULT_ADMIN_ROLE)
function setOwner(address _owner) external onlyRole(DEFAULT_ADMIN_ROLE)
function setDollarImplementation(address newDollarImplementation) external onlyRole(DEFAULT_ADMIN_ROLE)
function setBrandedCustodianRegistry(address _custodianRegistry) external onlyRole(DEFAULT_ADMIN_ROLE)
function setMessageProcessed(address oft, uint32 srcEid, uint64 nonce, bytes32 composeFrom) external onlyRole(DEFAULT_ADMIN_ROLE)

Custom Errors

ErrorDescription
AlreadyInitializedContract already initialized
NotEndpointCaller is not the LayerZero endpoint
InvalidOFTOFT address does not match local frxUSD
InvalidSrcEidSource EID is not Fraxtal (30255)
NotFromFactoryCompose message did not originate from the Fraxtal factory
OnlyFraxtalFunction is only callable on Fraxtal
Create2FailedCREATE2 deployment failed
InvalidIsolatedBackingInvalid backing asset for isolated custodian

Events

NameDescription
LocalStablecoinDeploymentEmitted when a branded token, custodian, router, and siloed custodian are deployed
DollarImplementationSetEmitted when the dollar implementation address is updated
MessageHashEmitted when a compose message is processed

Author: Frax Finance License: AGPL-3.0-only