Coder Social home page Coder Social logo

dlxcoin / cross-chain-ample Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ampleforth/cross-chain-ample

0.0 0.0 0.0 4.44 MB

Solidity smart contracts to enable cross-chain Ample

License: GNU General Public License v3.0

JavaScript 79.61% Solidity 19.33% Shell 1.06%

cross-chain-ample's Introduction

Cross Chain Ample

Build Statusย Coverage Status

Solidity contracts for cross-chain AMPL through bridges.

It supports integration with any cross chain bridge which supports generic data transfer. To integrate with a new bridge, custom bridge specific 'bridge-gateway' contracts need to be implemented which deals with bridge specific ABIs and data parsing.

Get up to speed.

Live Deployments

# Ethereum Mainnet

# core protocol (controlled by Ampleforth Governance)
token: 0xD46bA6D942050d489DBd938a2C909A5d5039A161
policy: 0x1B228a749077b8e307C5856cE62Ef35d96Dca2ea
orchestrator: 0x6FB00a180781E75F87E2B690Af0196bAa77C7e7C

# bridge contracts (controlled by Ampleforth Bridge DAO on Ethereum)
owner: 0x57981B1EaFe4b18EC97f8B10859B40207b364662
# reports rebase to every bridge in the list
batchRebaseReporter: 0x25fbC7D475B5013f631E5BB7f9Da57A8d1522179
vaults:
  - bridge: meter-passport
    vault: 0x805c7Ecba41f9321bb098ec1cf31d86d9407de2F
  - bridge: matic
    vault: 0xCFedb6b85283fBBD0f5F30c5F75324A4B91819c5

# additional utility contracts
meterPassportBatcher: 0x454de9c544fcae74eb09c57a042349d3ead07e29

# BSC (controlled by Ampleforth Bridge DAO on BSC)
owner: 0x1501FBc20d3D0C1FEF146B528e7Cd9a003aBf281
token: 0xDB021b1B247fe2F1fa57e0A87C748Cc1E321F07F
controller: 0x17F084dFF8a71e38521BCBD3Da871753Dc67aa81
rebaseRelayer: 0x0c0144D04594AB99F4C02691B6684e3d871B589e

# Matic / Polygon (controlled by Ampleforth Bridge DAO on Matic)
owner: 0x5d96A65E51A78C511C545a0247eb2d006912b636
token: 0xc67238827da94B15F6bA10F3d35f690809919F75
controller: 0x0AF32F7B0733DBFe59E52712c3fBF2d1B4ebd00f
rebaseRelayer: 0x4960382cA3151Df595b944731304F71Df7eDb35A

Working Bridges

Contracts

  1. Base Chain

  2. Satellite Chain

End to end architecture is described here.

Getting Started

# Compile contracts
yarn compile

# Lint code
yarn lint

# Format code
yarn format

# Run solidity coverage report (compatible with node v12)
yarn coverage

# Run solidity gas usage report
yarn profile

Contract Integration Tests

This test suite (/test/intgration) deploys 1 instance of the base chain contracts and 2 instances of satellite chain contracts with the same configuration as the final deployment on the same ganache instance. Off-chain service interactions are mocked through testing scripts. ie) Contracts think they are talking to other contracts from a different blockchain but all of them lie on the same ganache instance and off-chain calls are mocked.

  1. 1 instance of the Ampleforth Protocol (base chain)
  2. 3 instances the bridge protocol contracts; (1 base and 2 satellite chains)
  3. 1 instance of the AMPL-Bridge gateway contract (base chain)
  4. 2 instances of the Bridge-XCAmple gateway contract (2 satellite chains)

Test cases

Each new bridge integration should check for the following cases.

Rebases:

  • +ve, -ve and neutral rebase is propagated from the base chain to multiple satellite chains, it should update balances in the satellite chains correctly
  • When +ve, -ve and neutral rebases on the base chain are missed by the bridge, then next rebase should update balances correctly on the satellite chains

Transfers:

  • User transfers from base to satellite chain and back

  • User transfers from base to satellite chain and back around rebases, where transfers are before, after and in-between rebase propagation to the target chain.

  • User transfers from satellite to another satellite chain and back

  • User transfers from satellite to another satellite chain and back around rebases, where transfers are before, after and in-between rebase propagation to the target chain.

Deployments

Testnet

Production

cross-chain-ample's People

Contributors

aalavandhan avatar brandoniles avatar

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.