Factory Blueprint Deployment

Contracts Deployment

Deploy Token or Connector contracts on all desired chains (ensure there is an existing UTS Router on these chains).

If our blueprint Token or Connector satisfies your requirements, you can deploy token with our Factory.

Single chain deploy through UTS Factory

If you want to deploy UTS Token using our blueprint, you can call the function below on UTS Factory contract:

/**
 * @notice Deploys a new {UTSToken} using the provided deployment parameters.
 * @param deployData the {DeployTokenData} struct containing deployment parameters.
 * @dev See the {UTSERC20DataTypes.DeployTokenData} for details.
 *
 * @return success call result.
 * @return newToken a newly deployed {UTSToken} contract address.
 */
function deployToken(DeployTokenData calldata deployData)

Use DeployTokenData :

struct DeployTokenData {
    bytes     owner;
    string    name;
    string    symbol;
    uint8     decimals;
    uint256   initialSupply;
    uint256   mintedAmountToOwner;
    bool      pureToken;
    bool      mintable;
    bool      globalBurnable;
    bool      onlyRoleBurnable;
    bool      feeModule;
    bytes     router;
    uint256[] allowedChainIds;
    ChainConfig[] chainConfigs;
    bytes32   salt;
}
Field
Meaning

Address encoded here will be setted as the owner of the token

The name of new token

The symbol of new token

The decimals of new token

Token initial supply, that will be minted

Token supply, that will be minted to owner (must be less than or equal initialSupply)

True/false flag is token should be without any extensions (non-mintable, non-burnable, without fee, working by lock/unlock scheme). If true, other flags should be false

True/false flag is token mintable by owner (owner can mint arbitrary token amount)

True/false flag is token burnable (everyone can burn his tokens)

True/false flag is token burnable by BURNER_ROLE role only

True/false flag is token will supports fee extracting for bridging(currently unsupported, should be false by default)

UTSRouter address on the deployment chain

Array of initial destination chain IDs that token binded to

Array of ChainConfig structs, initial settings

Salt to deploy new token to specified address, you can specify it, if you want specific address

If PureToken is set to true, then initialSupply should be equal or more than mintedAmountToOwner.

If PureToken is set to false, then initialSupply should be equal to mintedAmountToOwner

If you want to deploy UTS Connector, you should use function below:

/**
 * @notice Deploys a new {UTSConnector} using the provided deployment parameters.
 * @param deployData the {DeployConnectorData} struct containing deployment parameters.
 * @dev See the {UTSERC20DataTypes.DeployConnectorData} for details.
 *
 * @return success call result.
 * @return newConnector a newly deployed {UTSConnector} contract address.
 */
function deployConnector(DeployConnectorData calldata deployData)

Using struct DeployConnectorData

struct DeployConnectorData {
    bytes     owner;
    bytes     underlyingToken;
    bool      feeModule;
    bytes     router;
    uint256[] allowedChainIds;
    ChainConfig[] chainConfigs;
    bytes32   salt;
}

Field
Meaning

owner

UTSConnector owner's address, encoded in bytes

underlyingToken

Address of the ERC20 token on top of which is UTSConnector built

feeModule

True/false flag is connector will supports fee extracting for bridging(currently unsupported, should be false by default)

router

UTSRouter address

allowedChainIds

Array of initial destination chain IDs that connector binded to

chainConfigs

Array of ChainConfig structs, initial settings

salt

Provided salt to deploy new connector to specified address

Chain Config struct should be built using struct below:

struct ChainConfig {
    bytes   peerAddress;
    uint32  minGasLimit;
    uint8   decimals;
    bool    paused;
}

Ensure the chain configurations are properly set up to allow all your smart contracts to communicate with each other.

Name
Meaning

peerAddress

Destination peer address, that can bridge or receive tokens to/from source chain. Normally it should be address of token/connector on destination chain

minGasLimit

Minimal gas amount that can be provided as function's input and will be used at redeem function

decimals

Destination peer token decimals

paused

True/false flag is destination peer paused

owner, router ,chainConfigs.peerAddressand underlyingToken are addresses, but since UTS is omnichain, we designed our protocol to be ready for non evm blockchains like Solana, Ton and others. So, to pass address like data use abi.encodePacked(address), on evm chains

You may configure minGasLimit parameter to take more gas for transfer execution on destination chain if you need so. Please do your own calculations.

You can set this minGasLimit as 0, so, minGasLimit will be set from UTSRouter. You can find more information in Estimations

Cross-chain deploy using UTS Deployment Router

You can use our Deployment Router to do a cross-chain deploy, this means that with calling only one function you can deploy and set up the whole cluster.

To do it, you need to call a function below on UTSDeploymentRouter

/**
 * @notice Sends UTSToken and UTSConnector deployment crosschain requests via UTS protocol V1.
 * @param deployMetadata array of {DeployMetadata} structs, containing destination chain Ids and deploy parameters:
 *        dstChainId: destination chain Id
 *        isConnector: flag indicating whether is request for deploy connector(true) or token(false)
 *        params: abi.encoded {DeployTokenData} struct or abi.encoded {DeployConnectorData} struct
 * @dev See the {UTSERC20DataTypes.DeployTokenData} and {UTSERC20DataTypes.DeployConnectorData} for details.
 *
 * @param paymentToken address of the token used for payment.
 * @dev Any {paymentToken} address different from the {PAYMENT_TOKEN} is identified as a payment in native currency.
 *
 * @return paymentAmount total payment required for send deployment requests.
 * @return currentChainDeployment deployment address on the current chain (if a relevant request was provided).
 */
function sendDeployRequest(
    DeployMetadata[] calldata deployMetadata,
    address paymentToken
) external payable whenNotPaused() returns(
    uint256 paymentAmount, 
    address currentChainDeployment
)

To do this you need to provide deployMetadata:

Name
Meaning

dstChainId

Destination chain Id (or current)

isConnector

True/false flag is specified params for deploy UTSConnector

params

encoded deployData (encoded DeployTokenData struct or encoded DeployConnectorData struct)

If you want to pay in ERC-20 token you can do it with PAYMENT_TOKEN in UTSDeploymentRouter. You also have a possibility to pay in native. Currently it is NGL

If you want to estimate deployment fee we have functions for that reason on UTSDeploymentRouter. You can find this information in Estimations section

That's it, now you are ready to make your first cross-chain token transfer!

Last updated