📝Contracts Deployment

Creating a new AVS requires deploying contracts on-chain.

Overview

Othentic CLI enables AVS developers to focus on unique business logic while ignoring error-prone infrastructure details, allowing AVS developers to implement only "Performer" and "Attester" logic.

How does AVS Network work?

In Othentic Stack, developers focus on the logic of "Tasks" that are executed by the AVS' operators. Performers execute a certain task and Attesters vote to approve or reject the task.

The network's governance is implemented by AvsGovernance , the endpoint for network members' management and deposits. The network can control the restake tokens, depending on the performance of tasks, and vote against bad acting (even days later). The votes are managed by the AttestationCenter.

To minimize costs and availability associated with running your AVS, AvsGovernance and AttestationCenter are being deployed on L1 and L2 (respectively). The Othentic Stack utilizes LayerZero protocol for exchanging messages between the layers. L1MessageHandler interacts directly with AvsGovernance and L2MessageHandler interacts directly with AttestationCenter. You can propagate messages from L2 to L1 via: L2MessageHandler.sendMessage(payload) -> L1MessageHandler.receive(payload) and the other way around.

Prerequisites


To deploy an AVS, first you must create an ERC-20 token that will back the network. If you already have an ERC-20 token you can use it for the AVS.

In addition, you must have othentic-cli installed. See Quick Start.

Only networks supported by Foundry can be used for deployment.

Configuration


Othentic CLI uses .env files for configuration.

For the deployment, you only need a PRIVATE_KEY in your env file:

PRIVATE_KEY=...

The private key should be in the form of 64 hex characters without the "0x" prefix.

Deploy AVS Contracts


Deploy command

The contract cloning process uses SSH to clone a private github repository. Make sure your SSH keys are configured properly on Github before running the deployment process.

Define the following properties:

  1. Define either: a. --erc20 the address of the token backing the AVS b. --eth to use native ETH to back the AVS

  2. --l1-initial-deposit and --l2-initial-deposit is the initial deposit for messaging tokens from layers 1 & 2 (in wei)

  3. --avs-governance-multisig-owner the address of the AVS Governance multi-sig role (if you don't pass this flag then the deployer is set as AVS Governance multisig owner by default)

  4. --l2-rewards rewards distribution to operators on L2 instead of L1 (Optional)

To deploy AVS Contracts on mainnet add: --l1-chain mainnet --l2-chain polygon OR --l2-chain mainnet-l2

Example using ERC-20 token:

othentic-cli network deploy \
    --erc20 0x94373a4919B3240D86eA41593D5eBa789FEF3848 \
    --l1-initial-deposit 1500000000000000000 \
    --l2-initial-deposit 2500000000000000000 \
    --avs-governance-multisig-owner <OWNER_ADDRESS> \
    --name test-avs-name

Example using native ETH:

othentic-cli network deploy \
    --eth \
    --l1-initial-deposit 1500000000000000000 \
    --l2-initial-deposit 2500000000000000000 \
    --avs-governance-multisig-owner <OWNER_ADDRESS> \
    --name test-avs-name

Example using rewards on L2:

othentic-cli network deploy \
    --eth \
    --l1-initial-deposit 1500000000000000000 \
    --l2-initial-deposit 2500000000000000000 \
    --avs-governance-multisig-owner <OWNER_ADDRESS> \
    --name test-avs-name 
    --l2-rewards

After execution, the deployment output will be stored in the file:

cat .othentic/contracts/script/data/state.output.json

Included contracts

Layer-1 components

The following contracts are deployed:

  1. AvsGovernance is the governance contract of the AVS, for registering and managing memberships and payments

  2. Vault is a support contract for AvsGovernance that focus on payment management processes including delayed payments, deposits, etc

  3. l1MessageHandler is an endpoint for communicating with the Layer 2 components. It broadcasts messages to the L2 contracts

Layer-2 components

The following contracts are deployed:

  1. AttestationCenter contract on Layer 2 manages the tasks of the AVS validators. Only tasks attested with enough voting power are recorded on-chain

  2. OBLS is the contract that implements Multisig operations

  3. BN256G2 is a cryptographic logical contract used by OBLS

  4. l2MessageHandler contract is complementary to l1MessageHandler mentioned above, which is used for communicating with Layer-1 components

Last updated