# Deploying TL Contracts

## Overview

As mentioned, all of our creator contracts are deployed via [ERC-1167](https://eips.ethereum.org/EIPS/eip-1167) immutable proxies. In addition, T.R.A.C.E. and BlockListRegistry contracts are also deployed in this manner.

All of this is accomplished with our Universal Deployer contract factory. We've developed this as a public good and our primary contract deployment method.&#x20;

You can simply deploy contracts by encoding some initialization code and calling a single on-chain function. the `CREATE2` opcode is used in order to predetermine contract addresses and deploy the same exact contract across EVM chains to the same address (pretty neat huh?).

Enjoy!

## Deployed Address&#x20;

The Universal Deployer is deployed to all [supported chains](/miscellaneous/supported-blockchains.md) at `0x7c24805454F7972d36BEE9D139BD93423AA29f3f`

## Available Contract Types

* ERC721TL
* ERC1155TL
* ERC7160TL
* ERC7160TLEditions
* TRACE

## Generating Initialization Code

Whenever you deploy with this universal deployer, you need to pass calldata as bytes for intialization code of the contract. You can encode the parameters with the function signature using many different tools, including web3py, web3js, etherjs, viem, and foundry (cast). The following example shows how to accomplish this for an ERC721TL contract with cast.

### web3py

```python
# omitted imports and creating a contract
# for more, visit https://web3py.readthedocs.io/en/stable/quickstart.html

contract_address = "" # can use any address
erc721tl_abi = '' # can get from etherscan
contract = web3.eth.contract(address=contract_address, abi=erc721tl_abi)

init_code = contract.encodeABI(
    fn_name="initialize",
    args=[
        "Test 721",
        "T721",
        "personalization",
        "0x0000000000000000000000000000000000C0FFEE",
        1000,
        "0x0000000000000000000000000000000000C0FFEE",
        [],
        "0x0000000000000000000000000000000000000000",
        "0x0000000000000000000000000000000000000000"
    ]
)

print(init_code)
```

### web3js

```javascript
// see more here: https://web3js.readthedocs.io/en/v1.10.0/web3-eth-contract.html#methods-mymethod-encodeabi

console.log(contract.methods.initialize(
  "Test 721",
  "T721",
  "personalization",
  "0x0000000000000000000000000000000000C0FFEE",
  1000,
  "0x0000000000000000000000000000000000C0FFEE",
  [],
  "0x0000000000000000000000000000000000000000",
  "0x0000000000000000000000000000000000000000"
).encodeABI());
```

### ethersjs

```javascript
// see more here: https://docs.ethers.org/v5/api/utils/abi/interface/#Interface--encoding
import { ethers } from "ethers";

const iFace = new ethers.utils.Interface([
  "function initialize(string,string,string,address,uint256,address,address[],bool,address,address)"
]);

console.log(iFace.encodeFunctionData("initialize", [
  "Test 721",
  "T721",
  "personalization",
  "0x0000000000000000000000000000000000C0FFEE",
  1000,
  "0x0000000000000000000000000000000000C0FFEE",
  [],
  "0x0000000000000000000000000000000000000000",
  "0x0000000000000000000000000000000000000000"
]);
```

### Viem

```javascript
// see more here: https://viem.sh/docs/contract/encodeFunctionData

import { parseAbi, encodeFunctionData } from 'viem';

const abi = parseAbi([
  "function initialize(string,string,string,address,uint256,address,address[],bool,address,address)"
]);
const initCode = encodeFunctionData({
  abi,
  functionName: "initialize",
  args: [
    "Test 721",
    "T721",
    "personalization",
    "0x0000000000000000000000000000000000C0FFEE",
    BigInt(1000),
    "0x0000000000000000000000000000000000C0FFEE",
    [],
    "0x0000000000000000000000000000000000000000",
    "0x0000000000000000000000000000000000000000"
  ]
});
console.log(initCode);
```

### Cast

{% code overflow="wrap" %}

```sh
cast calldata "initialize(string,string,string,address,uint256,address,address[],bool,address,address)" "Test 721" "T721" "personalization" 0x0000000000000000000000000000000000C0FFEE 1000 0x0000000000000000000000000000000000C0FFEE "[]" true 0x0000000000000000000000000000000000000000 0x0000000000000000000000000000000000000000 
```

{% endcode %}

## General Clone Deployer

Additionally, we have deployed a general clone deployer for anyone to use for deploying minimal proxies to any implementation contract.\
\
Deployed to all chains at `0x3b3b425b96286c86dcb7bb8585dbf4642c7fea2e`

## Github Repo

<https://github.com/Transient-Labs/tl-universal-deployer>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.transientlabs.xyz/integrations/deploying-tl-contracts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
