📝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:
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:
Define either: a.
--erc20
the address of the token backing the AVS b.--eth
to use native ETH to back the AVS--l1-initial-deposit
and--l2-initial-deposit
is the initial deposit for messaging tokens from layers 1 & 2 (in wei)--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)--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:
Example using native ETH:
Example using rewards on L2:
After execution, the deployment output will be stored in the file:
Included contracts
Layer-1 components
The following contracts are deployed:
AvsGovernance
is the governance contract of the AVS, for registering and managing memberships and paymentsVault
is a support contract forAvsGovernance
that focus on payment management processes including delayed payments, deposits, etcl1MessageHandler
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:
AttestationCenter
contract on Layer 2 manages the tasks of the AVS validators. Only tasks attested with enough voting power are recorded on-chainOBLS
is the contract that implements Multisig operationsBN256G2
is a cryptographic logical contract used byOBLS
l2MessageHandler
contract is complementary tol1MessageHandler
mentioned above, which is used for communicating with Layer-1 components
Last updated