Optimistic Rollups: Contracts - lukso-network/network-optimism-integration-test GitHub Wiki

Repository

https://github.com/silesiacoin/optimism-contracts-v2/tree/main/contracts/optimistic-ethereum

  • OVM - main contracts directory
  • iOVM - is the interface definition directory

Deployment

READ HERE

General knowledge

First, all the smart contracts currently operating on Ethereum will be able to move very easily to the second, optymastic layer. Just recompile the existing code. No changes needed. After a few seconds, we have a version of the smart contract that we can place on the second layer based on the Optimistic Rollup.

Second, for the emergence of new smart contracts natively operating on the second, optimistic tier, you will be able to use exactly the same tools that are currently used by Ethereum smart contract developers. The whole ecosystem works the old way. No tools need to be changed. You do not need to change for anything.

  • OVM is written in solidity. It's a smart contract that is a virtual machine for transpiled smart contracts;

Chronicle of the life of an optimistic rollup smart contract:

  1. Developer writes a Solidity contract named Fred. Hello Fred!
  2. Developer sends transaction off-chain to a bonded aggregator (a layer 2 block producer) which deploys the contract.
    • Fees are paid however the aggregator wants (account abstraction / meta transactions).
    • There are multiple aggregators on the same chain.
    • Developer gets an instant guarantee that the transaction will be included or else the aggregator loses their bond.
  3. Aggregator locally applies the transaction & computes the new state root.
  4. Aggregator submits an Ethereum transaction (paying gas) which contains the transaction & state root (an optimistic rollup block).
  5. If anyone downloads the block & finds that it is invalid, they may prove the invalidity with verify_state_transition(prev_state, block, witness) which:
    • Slashes the malicious aggregator & any aggregator who built on top of the invalid block.
    • Rewards the prover with the aggregator bond.
  6. Fred the smart contract is safe, happy & secure knowing her deployment transaction is now a part of every valid future optimistic rollup state. Plus Fred can be sent mainnet ERC20's deposited into L2!

OVM on the L1

OVM is written in solidity (which is trivial) . It's a smart contract that is a virtual machine for transpiled smart contracts.