Skip to content

Latest commit

 

History

History
226 lines (158 loc) · 14.5 KB

README-CH.MD

File metadata and controls

226 lines (158 loc) · 14.5 KB

uTransmute 协议

将您的ERC20代币传送到EOS。

English Version

概述

uTransmute协议可以实现ETH和EOS跨链代币转移。

  • .ETH (ERC20) –> uTransmute –> EOS (代币)

本协议的目标是为app开发人员提供一个基础标准,来实现跨链操作代币和app。

尽请加入Join the main U.CASH Telegram group(https://t.me/ucash) 共同讨论uTransmute。同时也诚挚欢迎您为https://github.com/UdotCASH/uTransmute节点投票。

协议基础

必备条件

  • .node.js - Javascript 运行环境 (测试版本为 v8.10 和11)
  • .cmake - 包

uTransmute 概览

We believe that any token should be able to move as the developers desire or require as their apps may be best run on different chains at different times.

我们认为,任何代币都应该能如开发人员预期或要求的方式转移。在不同的链上,不同的时间条件下,app都能跨链运行。

Typically, the way this has been done is by using what we call the "snapshot" method.

通常情况下,实现上述要求我们是借助"快照"模式完成。

In the uTransmute protocol, we are providing another option for ERC20 contracts that do not have a built-in pause/expiry function but who want to move their token to another chain. We are calling this action: transmuting. To transmute a token from one chain to another, it will exist on the destination chain, but no longer exist in a fungible form on the source chain.

在uTransmute协议里,我们为没有内置暂停/到期功能且不能满足想要跨链转移代币的用户的ERC20合约提供了另一种方式。我们将此需求称为:transmuting隐形转移。链间转移一个代币,此代币将存在于目的链,但在源链上不再以可替换形式存在。

uTransmute协议有3个维度

  • . 维度** 1** 是源链,Ethereum。此处有一个uTransmute合约。
  • . 维度** 2** 是 一个Oracle。
  • . 维度** 3** 是目的链,EOS。EOS代币合约将代币分配给由代币持有者在第1层中指定的目的EOS账户。

The standard uTransmute contract has 2 functions - be authorized to receive token Y from Ethereum and then receive the EOS account info the tokens to be distributed on the destination chain via the Oracle.

标准的uTransmute合约有2个功能——授权从Ethereum接收Y个代币,然后接收EOS账户信息,通过Oracle在目的链上分配代币。

Once a user sends their tokens and destination account to the uTransmute, the ERC20 tokens will become non-fungible and the EOS tokens will be transmuted to their destination account on the EOS chain.

一旦用户向uTransmute发送他们的代币和目的账户。此部分ERC20代币将变为不可替代的,并且EOS代币将在EOS链上转移到目的账户。

The developer can choose to either send the tokens to a 0X000 address and thereby them, or hold them in the uTransmute contract.

开发人员可以选择将代币发送到0X000地址,也可以将它们保留在uTransmute合约。

uTransmute GitHub 详细目录
  • . uTransmute/uTransmute.js - Oracle 负责管理代币从ETH到EOS转移。
  • . uTransmute/ config.json - utransmute和Oracle合约的配置文件
  • . uTransmute/utransmute/** 合约 **/ - utransmute合约如下
    • . sol - utransmute合约吸收ERC20代币。
    • . sol - utransmute 合约将EOS账户作为一个输入来激活代币传输操作。
    • . sol - 将一个EOS公匙作为一个输入激活代币传输操作。(您需要使用修改后的Oracle创建账户)
    • . sol - 用于为测试部署指定 ElementToken.sol
    • . sol - 对ERC20代币的默认ElementToken合约
    • . sol - 确认EOS账户或钥匙
  • . uTransmute/utransmute/migrations/ - 部署truffle测试的脚本
  • . uTransmute/utransmute/test/ -utransmute的 truffle 测试
  • . uTransmute/eosio.token/ - 来自EOS.IO GitHub的标准EOSIO代币合约测试
  • . uTransmute/utils/ - 错误检查脚本
  • . uTransmute/package.json - 测试套件的NPM安装包

贡献

欢迎阅读 CONTRIBUTING.md

uTransmute is open-source and we encourage you to customize, fork, and use the code. We built this as a__n example case. Some of the ideas we have include:

uTransmute代码是开源的,我们鼓励所有人定制、派生和使用代码。我们建立它是作为一个基石。以下是我们的一些想法:

  • .可以修改uTransmute合约,使用注册EOS账户或钥匙来驱动快照分配。
  • .可以编写uTransmute" ttransmuter"或 " racle",从而完全在EOS链上运行(代替了 js ),并且简化的支付认证过程(SPV)也可完全在链上进行。
  • .可以修改uTransmute合约,在Oracle成功将ETH代币转移至EOS后,通过将此部分ETH代币发送到0x00地址来完成代币燃烧。
  • .可以修改uTransmute合约,允许代币在传送点ETH _↔ EOS间传送,通过使用" 2-通道"_代币,锁定代币不再是靠每条链单独的合约。
  • .uTransmute 可以在共享相同私匙的任何一个链上创建公匙。
  • .uTransmute__可以用于验证EOS与ETH交易。
  • .uTransmute 可以用于在EOS 子链 间转移代币。
  • .可以改写uTransmute合约,用于支持其它的Ethereum分支链,例如GoChain,和其他支持代币类似于 Stellar 的链。

端到端测试

For testing, we will use a local Ethereum chain via Ganache and the EOS Jungle Testnet.

为方便测试,我们将通过 Ganache EOS Jungle Testnet 来使用本地Ethereum链。

测试概览

Our scripts automate some of this process, but this is to help you understand what each step is in the process.

我们的脚本自动化了一些流程,这是为了帮助您理解流程中的每一步。

  1. Create token on Ethereum.** 在Ethereum上创建代币。** Truffle 进行此操作。(4个代币将表示为40000,Ethereum合约中有4个小数点。 —— 可在config.json完成配置_)._
  2. 向新Ethereum账户分配新代币。 Truffle 进行此操作。
  3. _ 部署utransmute合约。 _合约地址在truffle配置文件中自动更新。
  4. ** Jungle Testnet **部署标准eosio.token合约。
  5. _ 通过eosio.token合约发行EOS代币。 _参数见 config.json中配置。
  6. ** js 服务器上建立 transmute_oracle **
  7. 源Ethereum账户必须进行2个操作。
    • .授权utransmute转移一定数量的ERC20代币。
    • .发送EOS账户名来激活代币传输。
  1. Oracle将在Ethereum上捕捉事件,并发送代币到第7步中指定的EOS账户。
  2. 关闭utransmute。

Ganache / Jungle 测试必备条件

  • .Truffle - npm install -g truffle
  • .Ganache - 点击本地Ethereum区块链。
    • .Ganache 应该被配置在8545端口上进行本地运行。(您可能需要在 Ganache__首选项设置或编辑 config.json匹配端口_)_

Ganache / Jungle测试准备

步骤1:Ethereum合约的Truffle发展。(ERC20代币+uTransmute)

  • . 克隆uTransmute 资源库
  • .**编译utransmute合约**
    • .cmake .. -DEOSIO_CDT_ROOT=/usr/local/eosio.cdt && make
  • .**更改目录为根目录**
    • .cd ../../../
  • .**安装npm**
    • .npm install
  • . **安装truffle基础设施**
    • .npm install -g truffle
  • .**编译utransmute合约**
    • .cd utransmute && truffle compile
  • . **测试合约**
    • .truffle test
  • .**部署ERC20合约和在 config.json中定义utransmute合约。**
    • .truffle migrate --reset --network ganache
    • .进程还将把你新创建的ERC20代币发送到你在 Ganache 界面的第一个账户。

步骤2:部署Oracle

  • .**从uTransmute 项目的根文件开始oracle**
    • .打开另一个窗口 —— 或者更好在窗口展示命令。
    • .node ./uTransmute.js

步骤3:部署EOS代币合约

  • .**部署标准EOSIO.token合约**
  • .**通过eosio.token合约分发自定义的EOS代币,你可能需要解锁钱包首先。** cleos -u http://dev.cryptolions.io:38888 push action <EOSTokenCreatorAccount> create '["<EOSTokenCreatorAccount>","4.0000 <EOSTokenName>"]' -p <EOSTokenCreatorAccount>@active

步骤4:代币传输测试

  • .**进入ganache控制台**
    • .truffle console --network ganache
  • .**获取ERC代币合约地址**
    • .ERC20Token.deployed().then(i => erc20=i)
    • .在上述命令的结果中搜索,您将在 " from"字段中获得ERC20代币的公匙。注意到这一点,您将在1分钟内需要它。 0x52… 将会是步骤2中的 ERC20PublicKey
    • . ERC20PublicKey 例如: class_defaults: { from: '0x52410180254b53a0816e77082ec0578d7a141c5c',
  • .**使用uTransmute 合约**
    • .uTransmuteEosAccount.deployed().then(i => utransmute=i)
  • .**向uTransmute发送批准吸收代币**
    • .erc20.approve(utransmute.address, 40000, {from:'<ERC20PublicKey>'})
    • .这是 0x52… 地址,上面的例子中的地址。您的地址会是不同的。
  • .**输入目的EOS账户地址进行代币转移**
    • .utransmute.transmute("<DestinationEOSAccount>")
    • .您应该在您的oracle控制界面时刻查看账户活动。
  • .**在目的EOS账户中检查自定义EOS代币余额**

您的测试代币已经被成功转移!

主网部署

特殊说明!

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

本软件是基于"现状"提供的,没有对包括但不仅限于,可销性、特定目的适用性和非侵权性的任何形式的担保承诺、明示或暗示。在任何情况下,无论是在合约、侵权行为或其他方面,有软件或软件使用引起的索赔、损害或其他责任,作者或版权所有者都不承担责任。

_ 我们强烈的建议首先使用上面列出的 Ganache / Jungle 指南进行测试。 _

测试准备

  • .你必须在Ethereum主网上部署ERC20代币,获得钥匙能够允许将EOS代币传送到oracle运行的钱包。
  • .在config.json配置utransmute 和 eosiotoken部分到您的代币参数
    • .websocket_provider 将指向 Ethereum 节点 - 在主网上使用wss://mainnet.infura.io/ws
    • .critic_block 将是您想要到期utransmute合约在Ethereum上的块编号,如果它未到期,则将其设置为0。
    • .decimals symbol 和 tokens 是您在ERC20代币合约中定义的小数点,ERC20代币的表示符号,在ERC20合约中的最大代币数额。
    • .chain_id 是EOS链的ID - EOS主网的将是aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906
    • .http_endpoint 指向一个EOS API节点
    • .account 是具备您分发EOS代币地址权限的账户
    • .private_key 私匙是代表传输EOS代币的权利。
  • .在Ethereum主网上安装uTransmute/utransmute/contracts/uTransmuteEosAccount.sol orutransmute/contracts/uTransmuteEosPublicKey.sol
  • .开始Oracle
  • .从一个包含您想要传送的代币的Ethereum账户中,授权utransmute从您的账户中吸收代币,然后将您的EOS账户名称发送到合约 " 传送点 " 触发代币转移操作。通过非常好的UX/UI设计,可以是这个过程变得非常简单。

许可证

This software is a fork of the original EOS21 Protocol by the team at shEOS released under an MIT License. This project is made available under the same license for the community - see the LICENSE.md file for details.

本项目获得 MIT许可——查看详细细节LICENSE.md

uTransmute ** is maintained by ** https://github.com/UdotCASH/

uTransmute ** **** 由**https://github.com/UdotCASH/**维护