contracts – 合同区块链毕设代写

区块链毕设代写本文提供国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,contracts – 合同区块链毕设代写 是一篇很好的国外资料

contracts

TODO: description

Usage

const contracts = require('contracts');  // TODO: DEMONSTRATE API 

Contract Addresses

Optimism Hop Testnet

Contract Name Layer Hop Protocol Contract Address
L1 DAI 1 No 0x7d669A64deb8a4A51eEa755bb0E19FD39CE25Ae9
L1 Messenger 1 No 0x77eeDe6CC8B46C76e50979Ce3b4163253979c519
L1 Bridge 1 Yes 0xe74EFb19BBC46DbE28b7BaB1F14af6eB7158B4BE
L1 Messenger Wrapper 1 Yes 0x2673a37B287b9896fbc9fB8E29Ed1d899BD4281E
L2 DAI 2 No 0x57eaeE3D9C99b93D8FD1b50EF274579bFEC8e14B
L2 Messenger 2 No 0x61cBe9766fe7392A4DE03A54b2069c103AE674eb
L2 Bridge 2 Yes 0x6d2f304CFF4e0B67dA4ab38C6A5C8184a2424D05
L2 Uniswap Factory 2 Yes 0x3e4CFaa8730092552d9425575E49bB542e329981
L2 Uniswap Router 2 Yes 0x3C67B82D67B4f31A54C0A516dE8d3e93D010EDb3
L2 Uniswap Exchange 2 Yes 0x65F72DF8a668BC6272B059BB7F53ADc91066540C

Arbitrum Testnet 3

Contract Name Layer Hop Protocol Contract Address
L1 DAI 1 No 0x7d669A64deb8a4A51eEa755bb0E19FD39CE25Ae9
L1 Messenger 1 No 0xE681857DEfE8b454244e701BA63EfAa078d7eA85
L1 Bridge 1 Yes 0xe74EFb19BBC46DbE28b7BaB1F14af6eB7158B4BE
L1 Messenger Wrapper 1 Yes 0x36501dcD0007aA4DB373667d730C5AE91a7b3cc8
L2 DAI 2 No 0x7d669A64deb8a4A51eEa755bb0E19FD39CE25Ae9
L2 Messenger 2 No 0x0000000000000000000000000000000000000064
L2 Bridge 2 Yes 0xf3af9B1Edc17c1FcA2b85dd64595F914fE2D3Dde
L2 Uniswap Factory 2 Yes 0xd28B241aB439220b85b8B90B912799DefECA8CCe
L2 Uniswap Router 2 Yes 0x2B6812d2282CF676044cBdE2D0222c08e6E1bdb2
L2 Uniswap Exchange 2 Yes 0xD637bf04dF4FDFDf951C06e3c87f7801c85b161f

Arbitrum Testnet 2

Contract Name Layer Hop Protocol Contract Address
L1 DAI 1 No 0x7d669A64deb8a4A51eEa755bb0E19FD39CE25Ae9
L1 Messenger 1 No 0xE681857DEfE8b454244e701BA63EfAa078d7eA85
L1 Bridge 1 Yes 0xC9898E162b6a43dc665B033F1EF6b2bc7B0157B4
L1 Messenger Wrapper 1 Yes 0xb5cAC377180fcE007664Cc65ff044d685e0F1A3b
L2 DAI 2 No 0x7d669A64deb8a4A51eEa755bb0E19FD39CE25Ae9
L2 Messenger 2 No 0x0000000000000000000000000000000000000064
L2 Bridge 2 Yes 0xf8E96392b1Ba3B2FD88041894a93e089E93C0dcd
L2 Uniswap Factory 2 Yes 0xEaAec7a29B6ccE9e831C8d07e989fa4163026177
L2 Uniswap Router 2 Yes 0xBae19197DFa25105E832b8fAfeAB88aCa275385F
L2 Uniswap Exchange 2 Yes 0xea535dF09be62d5542161D1a4A429A831d329638

Scripts

Deploy and setup arbitrum

  • npx hardhat run scripts/arbitrum/deployArbitrumL1.ts –network kovan
  • npx hardhat run scripts/arbitrum/deployArbitrumL2.ts –network arbitrum
  • npx hardhat run scripts/arbitrum/setupArbitrumL1.ts –network kovan
  • npx hardhat run scripts/arbitrum/setupArbitrumL2.ts –network arbitrum

Definitions

  • Transfer – The data for a transfer from one chain to another.
  • TransferHash – The hash of a single transfer’s data.
  • TransferRoot – The merkle root of a tree of TransferHashes and associated metadata such as the destination chainIds and totals for each chain.
  • Bridge – A hop bridge contracts on L1 or L2 (“L1 Bridge”, “Hop Bridge”, “Arbitrum Bridge”, “Optimism Bridge”)
  • Canonical Token Bridge – A Rollup’s own token bridge. (“Canonical Arbitrum Bridge”, “Canonical Optimism Bridge”)

Tokens

  • Canonical L1 Token – The layer 1 token that is being bridged. (“Canonical L1 ETH”, “Canonical L1 DAI”, “DAI”, “ETH”)
  • hToken – Exists on L2 and represents the right to 1 Token deposited in the L1 bridge. hToken’s can be converted to their Canonical L1 Token or vice versa at a 1:1 rate. (“hDAI”, “hETH”)
  • Canonical L2 Token – The primary L2 representation of a Canonical L1 Token. This is the token you get from depositing into a rollup’s Canonical Token Bridge.

Token Path

On Hop, tokens are always converted along the following path. To convert DAI to Arbitrum DAI, DAI (on L1) is first converted to hDAI (on L2) using the L1 Hop Bridge. Then the hDAI is swapped for Arbitrum DAI through the Uniswap market. This can be done in one transaction by calling sendToL2AndAttemptSwap.

      Layer 1          |      Layer 2                        | Canonical L1 Token <---|---> hToken <--(Uniswap)--> Canonical L2 Token                        | 

e.g.

      Layer 1          |      Layer 2                        | DAI <--------------<---|---> hDAI <----(Uniswap)--> Arbitrum DAI                        | 

Steps to Integrate a New L2

The following steps are to add a new L2 (Xyz, for example) to the Hop System:

  • Contract updates

    • Add the Xyz messenger interface in ./contracts/interfaces/xyz/messengers/IXyz.sol
    • Add a wrapper for the Xyz messenger in ./contracts/wrappers/XyzMessengerWrapper.sol
    • Add messenger logic for Xyz to the L1 mock messenger in ./contracts/test/L1_MockMessenger.sol
    • Add messenger logic for Xyz to the L2 mock messenger in ./contracts/test/L2_MockMessenger.sol
    • Add an L2 Bridge for Xyz to ./contracts/bridges/L2_XyzBridge.sol
    • Add a mock L2 Bridge for Xyz to ./contracts/test/Mock_L2_XyzBridge.sol
  • Testing updates

    • Add Xyz to L2_NAMES in ./test/shared/constants.ts
    • Add XYZ_CHAIN_ID in ./test/shared/constants.ts
    • Add Xyz contract artifacts to getL2SpecificArtifact() in ./test/shared/fixtures.ts
    • Add Xyz to getChainIdFromName() in ./test/shared/utils.ts
    • Add setXyzMessengerWrapperDefaults() to ./test/shared/utils.ts
    • Add Xyz to setMessengerWrapperDefaults() in ./test/shared/utils.ts
  • Config updates

    • Add the L2 and its URL to ./hardhat.config.ts
  • Other updates

    • If necessary, write a script to deploy the contracts on Xyz chain in ./scripts/deployment/Xyz

FAQ

  • What are the relevant messageIds?

    • Arbitrum = 0x9186606d55c571b43a756333453d90ab5653c483deb4980cda697bfa36fba5de Optimism = 0x09d0f27659ee556a8134fa56941e42400e672aecc2d4cfc61cdb0fcea4590e05
  • How can I verify the contracts on Etherscan?

    • To do it manually:
      1. Flatten the contract with npx hardhat flatten ./contracts/bridges/L1_Bridge.sol > flat.txt
      2. Keep one SPDX license at the top of the file. Remove all the others.
      3. Keep one Solidity pragma and ABIEncoder definition at the top of the file. Remove all others.
      4. Verify on Etherscan.

Add script to setup L2


合同

TODO:说明

使用

const contracts = require('contracts');  // TODO: DEMONSTRATE API 

合同地址

测试网

Contract Name Layer Hop Protocol Contract Address
L1 DAI 1 L1信使
1 L1桥 0x77eeDe6CC8B46C76e50979Ce3b4163253979c519
1 L1信使包装器
0x36501dcd0007aa4db37367d730c5ae91a7b3cc8 L2 DAI 2
0x7d669a64deb8a4a51ea755bb0e19fd39ce25ae9 L2信使0x00000000000000000000064 L2桥 2
0xF3AF9B1EDC17C1FCA2B85DD64595F914FE2D3DE L2 Uniswap工厂 2
L2 Uniswap Exchange 2
0xD637BF04DF4FDF951C06E3C87F7801C85B161F L1 DAI 1
0x7D669A64DEB8A4A51EA755BB0E19FD39CE25AE9 L1信使 1 No
L1桥 1是0x7d669A64deb8a4A51eEa755bb0E19FD39CE25Ae9 L2信使 2

仲裁测试网3

Contract Name Layer Hop Protocol Contract Address
No 0x0000000000000000000064 L2桥 2
0xf8e96392b1ba3b2fd88041894a93e89e93c0dcd L2 Uniswap工厂0xEaAec7a29B6ccE9e831C8d07e989fa4163026177 L2 Uniswap路由器 2
L2 Uniswap交换 2 0xea535dF09be62d5542161D1a4A429A831d329638 0xe74EFb19BBC46DbE28b7BaB1F14af6eB7158B4BE
L1 Messenger Wrapper 1 Yes 0x36501dcD0007aA4DB373667d730C5AE91a7b3cc8
L2 DAI 2 No 0x7d669A64deb8a4A51eEa755bb0E19FD39CE25Ae9
L2 Messenger 2 No 0x0000000000000000000000000000000000000064
L2 Bridge 2 Yes 0xf3af9B1Edc17c1FcA2b85dd64595F914fE2D3Dde
L2 Uniswap Factory 2 Yes 0xd28B241aB439220b85b8B90B912799DefECA8CCe
L2 Uniswap Router 2 Yes 0x2B6812d2282CF676044cBdE2D0222c08e6E1bdb2
L2 Uniswap Exchange 2 Yes 0xD637bf04dF4FDFDf951C06e3c87f7801c85b161f

仲裁测试网2

Contract Name Layer Hop Protocol Contract Address
L1 DAI 1 No 0x7d669A64deb8a4A51eEa755bb0E19FD39CE25Ae9
L1 Messenger 1 No 0xE681857DEfE8b454244e701BA63EfAa078d7eA85
L1 Bridge 1 Yes 0xC9898E162b6a43dc665B033F1EF6b2bc7B0157B4
L1 Messenger Wrapper 1 Yes 0xb5cAC377180fcE007664Cc65ff044d685e0F1A3b
L2 DAI 2 No 0x7d669A64deb8a4A51eEa755bb0E19FD39CE25Ae9
L2 Messenger 2 No 0x0000000000000000000000000000000000000064
L2 Bridge 2 Yes 0xf8E96392b1Ba3B2FD88041894a93e089E93C0dcd
L2 Uniswap Factory 2 Yes 0xEaAec7a29B6ccE9e831C8d07e989fa4163026177
L2 Uniswap Router 2 Yes 0xBae19197DFa25105E832b8fAfeAB88aCa275385F
L2 Uniswap Exchange 2 Yes 0xea535dF09be62d5542161D1a4A429A831d329638

部署和设置仲裁

定义

  • npx hardhat run scripts/arbitrum/deployArbitrumL1.ts–网络kovan
  • npx hardhat run scripts/arbitrum/deployArbitrumL2.ts–网络arbitrum
  • npx hardhat run scripts/arbitrum/setupArbitrumL1.ts–网络kovan
  • npx hardhat run scripts/arbitrum/setupArbitrumL2.ts–网络arbitrum

令牌路径

  • -从一个链传输到另一个链的数据。
  • TransferHash-单个传输数据的哈希。
  • TransferRoot-transferHash树的merkle根和相关元数据,如每个链的目标chainID和总数。
  • 桥接器-在L1或L2上收缩的跃点桥接器(“L1桥接器”、“跃点桥接器”、“仲裁桥接器”、“乐观桥接器”)
  • 规范令牌桥接器-汇总器自己的令牌桥接器。(“规范仲裁桥”,“规范乐观桥”)

集成新L2的步骤

  • 规范L1令牌-正在桥接的第1层令牌。(“Canonical L1 ETH”,“Canonical L1 DAI”,“DAI”,“ETH”)
  • hToken-存在于L2上,代表存放在L1桥中的1个令牌的权利。hToken可以以1:1的速率转换为规范L1标记,反之亦然。(“hDAI”,“hETH”)
  • 规范L2标记-规范L1标记的主要L2表示。这是您从存放到汇总的规范令牌桥中获得的令牌。

常见问题解答

在跃点上,令牌总是沿着以下路径转换。要将DAI转换为仲裁DAI,首先使用L1跳桥将DAI(L1上)转换为hDAI(L2上)。然后通过Uniswap市场将hDAI换成Arbitrum DAI。这可以通过调用sendtoL2andTestSwap在一个事务中完成。

      Layer 1          |      Layer 2                        | Canonical L1 Token <---|---> hToken <--(Uniswap)--> Canonical L2 Token                        | 

例如,

      Layer 1          |      Layer 2                        | DAI <--------------<---|---> hDAI <----(Uniswap)--> Arbitrum DAI                        | 

Steps to Integrate a New L2

以下步骤是向跃点系统添加新的L2(例如Xyz):

  • 合同更新在./contracts/interfaces/Xyz/messengers中添加Xyz messenger接口/IXyz.sol公司在./contracts/wrappers中为Xyz messenger添加包装/XyzMessengerWrapper.sol文件将Xyz的信使逻辑添加到./contracts/test/L1中的L1模拟信使_模拟信使.sol将Xyz的信使逻辑添加到中的L2模拟信使/合同/测试/L2_模拟信使.sol将Xyz的L2桥添加到./contracts/bridges/L2_XyzBridge.sol公司将Xyz的模拟L2桥添加到./contracts/test/mocku L2_XyzBridge.sol公司
  • 测试更新将Xyz添加到./test/shared中的L2u名称/常数.ts在./test/shared中添加XYZu链u ID/常数.ts将Xyz协定项目添加到./test/shared中的getl2specificatifact()/固定装置.ts将Xyz添加到./test/shared中的getChainIdFromName()中/实用工具添加setXyzMessengerWrapperDefaults()到./test/shared/实用工具将Xyz添加到./test/shared中的setMessengerWrapperDefaults()/实用工具
  • 配置更新将L2及其URL添加到/安全帽.config.ts
  • 其他更新如果需要,请编写一个脚本以在中的Xyz链上部署契约。/scripts/deployment/Xyz

FAQ

  • 相关的消息ID是什么?仲裁员=0x9186606d55c571b43a756333453d90ab5653c483deb4980cda697bfa36fba5de乐观主义=0x09d0f27659ee556a8134fa56941e42400e672aecc2d4cfc61cdb0fcea4590e05在Etherscan上验证合同?手动执行:使用npx hardhat Flatten./contracts/bridges/L1展平合同_桥梁.sol&燃气轮机;平面.txt在文件顶部保留一个SPDX许可证。把其他的都拿走。在文件顶部保留一个Solidity pragma和ABIEncoder定义。移除所有其他。以太扫描验证。
  • 使用npx hardhat Flatten展开合同。/contracts/bridges/L1_桥梁.sol&燃气轮机;平面.txt

Add script to setup L2

部分转自网络,侵权联系删除区块链源码网

www.interchains.cc

https://www.interchains.cc/20098.html

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 ! QQ3039046426
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » contracts – 合同区块链毕设代写

提供最优质的资源集合

立即查看 了解详情