Giter Club home page Giter Club logo

sysethereum-contracts's Introduction

Sysethereum contracts

Build Status

NEVM contracts for the Syscoin <=> NEVM bridge.

If you are new to the Syscoin <=> NEVM bridge, please check the docs repository first.

Core components

  • SyscoinRelay contract
    • Informs SyscoinERC20Manager contract when a Syscoin transaction locked or unlocked funds.
    • Parsing/working with Syscoin blocks, txs and merkle trees
  • SyscoinERC20Manager contract
    • An ERC20 manager contract to hold deposits or and transfer funds on unlock
    • Tokens are minted or transferred (for existing ERC20) when coins are locked on the Syscoin blockchain.
    • Tokens are destroyed when coins should go back to the Syscoin blockchain (balances are saved for when moving back to NEVM).
    • Only ERC20's that are derived from ERC20Detailed are able to work with the bridge as we need access to decimals() (99.99% of ERC20's are compatible). If you originate from Syscoin and are creating a new ERC20 to accompany the Syscoin SPT, then you should mint, approve ERC20 Manager and then call freezeBurnERC20 (pass in a dummy syscoinAddress such as "0x1" and not a real syscoinAddress here) on ERC20 Manager to lock funds to a specific asset guid (the Syscoin SPT). The amount locked is the amount that is transactable over the bridge, usually this is the total supply. If you originate from Ethereum as an existing ERC20 and wish to move to Syscoin for fast, cheap, secure transactions and settling on Syscoin blockchain, you may create a Syscoin SPT with a supply equivalent to the total supply of your NEVM's ERC20 and then send the SPT tokens to the "burn" address. When moving from NEVM to Syscoin, funds are extracted from the "burn" address of that SPT and moved into the users address based on the NEVM proof-of-burn transaction (calling freezeBurnERC20).

Running the Tests

  • Install prerequisites

  • Clone this repo.

  • Install npm dependencies.

    • cd to the directory where the repo is cloned.
      npm install
    
  • Compile contracts

      # compile contracts
      npx truffle compile --all
    
  • Run tests:

      # first start ganache-cli - and do this again once your gas ran out
      npx ganache-cli --gasLimit 4000000000000 -e 1000000
    
      # run tests
      npx truffle test
    

Deployment

To deploy the contracts

Requirements

  • A Rinkeby/Mainnet client running with rpc enabled

Deployment

  • Run ./scripts/exportAndInit.sh

License

MIT License
Copyright (c) 2019 Blockchain Foundry Inc
License

sysethereum-contracts's People

Contributors

sidhujag avatar tommyz7 avatar atoulme avatar dependabot[bot] avatar willyko 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.