Git Product home page Git Product logo

optimism-ton-bridge's Introduction

optimism-ton-bridge

Optimism TON and upgradable TON bridge (forked from makerdao/optimism-dai-bridge)

Upgrade guide

Deploying new token bridge

This bridge stores funds in an external escrow account rather than on the bridge address itself. To upgrade, deploy new bridge independently and connect to the same escrow. Thanks to this, no bridge will ever run out of funds.

Closing bridge

After deploying a new bridge you might consider closing the old one. The procedure is slightly complicated due to async messages like finalizeDeposit and finalizeWithdraw that can be in progress.

An owner calls L2Gateway.close() and L1Gateway.close() so no new async messages can be sent to the other part of the bridge. After all async messages are done processing (can take up to 1 week) bridge is effectively closed. Now, you can consider revoking approval to access funds from escrow on L1 and token minting rights on L2.

Contracts

  • L1Gateway.sol - L1 side of the bridge. Escrows L1 TON in L1Escrow contract. Unlocks L1 TON upon withdrawal message from L2Gateway.
  • L2Gateway.sol - L2 side of the bridge. Mints new L2 TON after receiving a message from L1Gateway. Burns L2 TON tokens when withdrawals happen.
  • L1Escrow - Holds funds on L1. Allows having many bridges coexist on L1 and share liquidity.
  • L1GatewayRegistry - Manages l1 gateway and l2 gateway pair.

Scrips

These scrips require valid .env file. Copy .env.example as .env and fill it out.

  • scripts/deployKovan.js - deploys a full solution to kovan and optimism testnet on kovan. Run with npm run deploy:kovan

Running

npm install
npm run test

Deployments

Mainnet

Rinkeby

Kovan

optimism-ton-bridge's People

Contributors

shingonu avatar

Watchers

James Cloos avatar Harry Oh avatar Kevin Jeong avatar  avatar  avatar

optimism-ton-bridge's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.