Skip to content
Syscoin <=> Ethereum bridge smart contracts
Java JavaScript Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin test.sh: Initialize Openzeppelin Oct 16, 2019
contracts
migrations Update 2_deploy_contracts.js Oct 30, 2019
org/sysethereum/agents/contract
scripts
test strict assetBalance check remove isMinter Oct 30, 2019
.gitignore Update .gitignore Oct 30, 2019
.travis.yml travis: Use node 12.13.0 LTS Oct 22, 2019
LICENSE initial commit for sysx bridge code Feb 26, 2019
README.md Merge branch 'master' of https://github.com/syscoin/sysethereum-contr… Oct 30, 2019
package-lock.json
package.json Install latest Truffle Oct 22, 2019
truffle-config.js upgrade to solc 0.5.12 Oct 4, 2019

README.md

Sysethereum contracts

Build Status

Ethereum contracts for the Syscoin <=> Ethereum bridge.

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

Core components

  • SyscoinSuperblocks contract
    • Keeps a copy of the Syscoin Superblockchain
    • Informs SyscoinERC20Manager contract when a Syscoin transaction locked or unlocked funds.
    • It's kind of a Syscoin version of BtcRelay but using Superblocks instead of blocks.
    • 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 Ethereum).
  • SyscoinClaimManager contract
    • Manages the interactive (challenge/response) validation of Superblocks.
  • SyscoinERC20 / SyscoinERC20I
    • A class that follows ERC20 spec but is also has decimals, symbol and token name through the ERC20Detailed interface
    • 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 Ethereum's ERC20 and then send the SPT tokens to the "burn" address. When moving from Ethereum to Syscoin, funds are extracted from the "burn" address of that SPT and moved into the users address based on the Ethereum 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

You can’t perform that action at this time.