contracts – 合同区块链毕设代写

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

contracts

The smart contracts that power the Hop Exchange.

Protocol Design

For a detailed description of the protocol, please see the whitepaper.

Overview

The Hop protocol provides a scalable rollup-to-rollup General Token Bridge using a two-pronged approach:

  1. Create a cross-network bridge token that can be quickly and economically moved from rollup to rollup or claimed on layer-1 for its underlying asset.
  2. Use Automated Market Makers to swap between each bridge token and its corresponding Canonical Tokens on each rollup in order to dynamically price liquidity and incentivize the rebalancing of liquidity across the network.

The combined approach allows users to quickly and trustlessly swap between layer-2 Canonical Tokens using the specialized bridge token as an intermediary asset.

A bonder posts their funds as collateral for the system, which effectively fronts liquidity for users to easily transfer throughout each layer. All transferred funds are tracked and and the system will always have funds that account for all assets within the Hop ecosystem. Transfers are fully settled and bonders credits restored when the sending layer-2 checkpoints their state onto layer-1.

Transfers can be challenged by anyone. Challenges require a challenger to put up stake and wait until the challenged transfer is fully settled. If the challenge is won, the challenger is paid out their initial stake plus some. If it is lost, the challenge stake gets credited to the system.

Contracts

Bridges

Accounting.sol – Abstract contract that is responsible for the accounting of the layer-1 and layer-2 bridges. A bonder can stake or unstake their funds using functions in this contract. All credits and debits are accounted accounted for and updated in this contract.

Bridge.sol – Abstract contract that inherits Accounting.sol and has the base, shared functionality for L1_Bridge.sol and L2_Bridge.sol. This contract’s main functionality is to handle user withdrawals on any chain. It is also responsible for settling withdrawals and updating a bonder’s credit. This contract has helper functions to retrieve data related to transfers.

L1_Bridge.sol – Abstract contract that inherits Bridge.sol. There are four main entities that will use this contract and four main functionalities within it. A user can use this contract to send tokens to a layer-2. A bonder can use this contract to bond transfer roots. An off-chain node will use this contract to confirm transfer roots. Anyone can challenge and resolve a transfer bond.

L1_ERC20_Bridge.sol – Contract that inherits L1_Bridge.sol. This contract implements ERC20 transfers that are used throughout the other L1_Bridge contracts.

L1_ETH_Bridge.sol – Contract that inherits L1_Bridge.sol. This contract implements ETH transfers that are used throughout the other L1_Bridge contracts.

L2_Bridge.sol – This abstract contract inherits Bridge.sol. Similar to L1_Bridge.sol, there are four entities that will use this contract with four main functionalities within in. A user can use this contract to send tokens to either a layer-1 or another layer-2. . A bonder can bond a withdrawal on behalf of a user. An off-chain node will use this contract to mint new h Tokens. The governance entity can set various parameters.

HopBridgeToken.sol – An ERC20 implementation that is controlled by L2_Bridge.sol. Each mainnet token is represented 1:1 by an h token (e.g., 1 mainnet DAI has a corresponding hDAI). L2_Bridge.sol handles the minting/burning of these tokens. The bridge contract also performs some transfers, however, transfers can also be made by calling this contract directly.

L2_ArbitrumBridge.sol / L2_OptimismBridge.sol / L2_XDaiBridge.sol – These contracts inherit L2_Bridge.sol and add layer-2 specific implementation details. These are the contracts that will be deployed on each layer-2.

Definitions

  • Transfer – The data for a transfer from one chain to another.
  • TransferId – The hash of a single transfer’s data.
  • TransferRoot – The merkle root of a tree of TransferIds and associated metadata such as the destination chainIds and totals for each chain.
  • TransferRootId – The hash of a TransferRoot’s hash and total amount.
  • Bridge – A hop bridge contracts on layer-1 or layer-2 (“L1 Bridge”, “Hop Bridge”, “Arbitrum Bridge”, “Optimism Bridge”)
  • Canonical Token Bridge – A Rollup’s own token bridge. (“Canonical Arbitrum Bridge”, “Canonical Optimism Bridge”)
  • Challenge – A staked claim that a transfer is invalid. Anyone can challenge a transfer and will be rewarded or punished accordingly.
  • h Tokens – Hop Bridge Tokens (e.g., ”Hop ETH”, ”Hop DAI” with symbols ”hETH”, ”hDAI” respectively) are specialized L2 tokens that can be transferred rollup-to-rollup in batches and act as intermediary assets in the Hop protocol.
  • Rescue – A TransferRoot that was incorrectly bonded can be rescued (refunded) to the governance address after a certain amount of time.

Diagrams

  • For detailed diagrams of the system, please see here
    • Detailed Transaction Diagrams
    • Contract Inheritance

Expected Usage

In the happy path case, a user will send tokens from one layer to another and receive the tokens on the receiving chain within seconds. The Bonder (an off-chain node) will be running and will facilitate the transfers by calling bonded withdrawal functions on the receiving chain.

In the non-happy path, the Bonder will be offline. In this case, users will still send tokens from one layer to another, however, they will be unable to withdraw on the receiving chain until the sending chain relays the transfer to layer-1 via the sending chain’s messenger.

Many transfers can be made from a given layer-2 before they are confirmed on layer-1 as a single bundle called a TransferRoot. After a certain number of transactions or a certain amount of time, a Bonder will bond a Transfer Root via a transaction on the layer-1 chain. This consists of bonding 110% of the Transfer Root’s amount and sends the Transfer Roots to each layer-2.

The system keeps track of the Bonder’s credit and debit. Credit and debit only increment, and debit can never exceed credit. Credit is added to the Bonder’s credit account each time funds are staked. Debit is added to the Bonder’s debit account each time staked funds are unstaked. Credit is added to the Bonder’s credit account each time transactions (from/to any chain) are successfully confirmed on layer-1. Debit is added to the Bonder’s debit account each time transactions are sent (from/to any chain) but not yet confirmed on layer-1. A bonder stakes on each supported chain and the accounting system for each layer is independent of each other layer.

Transfer Roots can be challenged by anyone. When a Transfer Root is bonded, the Bonder puts up a challenger bounty equal to 10% of the Transfer Root bond. A challenge consists of a challenger putting up an equal stake and waiting until the challenged Transfer Root is fully confirmed. If the challenge is won, the challenger’s stake is returned on top of 75% of the Bonder’s challenger bounty. The remaining 25% of the bounty is burned. If the challenge is lost, the challenger’s stake is credited to the Bonder.

TransferRoots can be rescued if they are created in error. In the case where a TransferRoot is incorrectly created, the funds will be locked. After a certain amount of time, the TransferRoot and its associated funds can be rescued by the governance account.

Expected Contract Invocation

Transfers

These are the expected, happy-path cases for users to send and receive funds on each layer.

  • L1 -> L2

    • User calls L1_Bridge.sendToL2()
      • Funds will show up on the appropriate layer-2 through the canonical layer-2 messenger
  • L2 -> L1

    • User calls L2_Bridge.swapAndSend()
    • Bonder calls L1_Bridge.bondWithdrawal()
  • L2 -> L2

    • User calls L2_Bridge.swapAndSend() on the sending layer-2
    • Bonder calls L2_Bridge.bondWithdrawalAndDistribute() on the receiving layer-2

If the bonder is offline, the system relies on the canonical layer-2 bridge to settle transactions on layer-1.

  • L2 -> L1 (bonder offline)

    • User calls L2_Bridge.swapAndSend()
    • L2_Bridge.commitTransfer() is called by anyone after 100 txs or after 4 hours
    • Wait for the sending layer-2 to be confirmed on layer-1 (approximately 7 days)
    • User or Relayer calls L1_Bridge.withdraw()
  • L2 -> L2 (bonder offline)

    • User calls L2_Bridge.swapAndSend() on the sending layer-2
    • L2_Bridge.commitTransfer() is called on the sending layer-2 by anyone after 100 txs or after 4 hours
    • Wait for the sending layer-2 to be confirmed on layer-1 (approximately 7 days)
    • User or Relayer calls L2_Bridge.withdraw() on the receiving layer-2

Transfer Roots

The bonder settles transactions and accounting with the following functions:

  • Bonder calls L2_Bridge.commitTransfers()
  • Bonder calls L1_Bridge.bondTransferRoot()
  • Bonder calls settleBondedWithdrawals() on every chain
  • Wait 7 days and L1_Bridge.confirmTransferRoot() is triggered and settles all accounting

Challenges

Anyone can challenge transactions:

  • Anyone calls L1_Bridge.challengeTransferBond()
  • After the challenge resolution period has ended, anyone calls L1_Bridge.resolveChallenge()

Contract Addresses

Please see ./config/addresses.ts for all deployed contract addresses.

Tokens

  • Canonical L1 Token – The layer-1 token that is being bridged. (“Canonical L1 ETH”, “Canonical L1 DAI”, “DAI”, “ETH”)
  • hToken – Exists on layer-2 and represents the right to 1 Token deposited in the layer-1 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 layer-2 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 layer-1) is first converted to hDAI (on layer-2) using the layer-1 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 layer-2 (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 contract artifacts to getL2SpecificArtifact() in ./test/shared/fixtures.ts
    • Add Xyz to CHAIN_IDS in ./config/constants.ts
    • Add getMessengerWrapperDefaults() to ./config/utils.ts
    • Add isChainIdXyz() to ./config/utils.ts
    • Add Xyz to sendChainSpecificBridgeDeposit() to ./scripts/shared/utils.ts
  • Config updates

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

FAQ

  • 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.
  • Why can I not interact with a contract I just deployed?

    • It takes a few blocks for transactions to traverse from L1 to other chains. If your contract was deployed on an L2 via an L1 call, you may have to wait a few blocks.
  • What is the l2ethers object from hardhat?

    • It is an ethers.js object that is used when creating a contract factory for the OVM. It use OVM bytecode.
  • Why are my Optimism contracts not working?

    • Optimism adds additional bytecode to your contracts when they are compiled. This may push your contract over the contract size limit. When this happens, your contract deployment mail fail silently (the transaction will succeed but there will be no code at the address). Try removing unused functions from your contracts.
  • Why can I not interact with contracts on xDai?

    • Interacting with xDai contracts sends a negative default gasLimit. To resolve this issue, add overrides with a defined gasLimit with each contract invocation.
  • Why do my Optimism contract interactions appear to work but do not update state?

    • If overrides are added to Optimism contract invocations, the code will say the tx has succeeded, but no state will be updated.
  • Why do my Optimism deployments and transactions sometimes hang?

    • Optimism seems to have introduced a denylist for some addresses on their public chain. Addresses that have interacted with their old public chain have seemingly been denylisted on their newest one.

Add non-happy path tests for L2 Bridge


合同

智能合约为跳转交换提供动力。

协议设计

有关协议的详细说明,请参阅白皮书。

概述

Hop协议提供了一个可伸缩的rollup-to-rollup通用令牌桥,使用一种双管齐下的方法:

  1. 使用自动做市商在每次汇总时在每个桥接代币与其对应的规范代币之间进行交换,以便动态定价流动性并激励整个网络的流动性重新平衡。
  2. 传输-从一个链传输到另一个链的数据。

组合方法允许用户使用专门的桥令牌作为中间资产,在第2层规范令牌之间快速、可靠地交换。

债券商将其资金作为系统的抵押品,有效地为用户提供流动性,以便在每一层中轻松转移。所有转移的资金都会被跟踪,并且系统将始终拥有占Hop生态系统内所有资产的资金。当发送层2将其状态检查点置于层1上时,传输被完全结算,并且绑定者信用恢复。

任何人都可以对转让提出质疑。挑战要求挑战者拿出股份,等待被挑战的转让完全解决。如果挑战获胜,挑战者将获得他们最初的股份加上一些。如果它丢失了,挑战赌注将被记入系统。

合同

桥梁

会计.sol-负责一层和二层桥梁核算的抽象合同。债券持有人可以使用本合同中的功能来持有或收回其资金。所有贷项和借项均在本合同中记账和更新。

桥梁.sol-继承的抽象契约会计.sol并且具有L1的基本共享功能_桥梁.sol和L2_桥梁.sol. 此合同的主要功能是处理任何链上的用户取款。它还负责结算提款和更新债券人的信用。此协定具有辅助函数来检索与传输相关的数据。

L1级_桥梁.sol-继承的抽象契约桥梁.sol. 有四个主要实体将使用本合同和其中的四个主要功能。用户可以使用此契约向第2层发送令牌。担保人可以使用此合同担保转让根。链外节点将使用此契约确认转移根。任何人都可以挑战和解决转让债券。

L1u ERC20_桥梁.sol-继承L1的合同_桥梁.sol. 本合同执行ERC20传输,这些传输在其他L1èU桥接合同中使用。

L1u以太_桥梁.sol-继承L1的合同_桥梁.sol. 本合同执行ETH传输,这些传输在其他L1戡U桥接合同中使用。

L2级_桥梁.sol-这个抽象合同继承了桥梁.sol. 与L1类似_桥梁.sol,有四个实体将使用本合同,在中有四个主要功能。用户可以使用此约定将令牌发送到第1层或第2层。担保人可以代表用户担保提款。一个链外节点将使用这个契约来制造新的h代币。治理实体可以设置各种参数。

霍普布里奇托克.sol-由L2控制的ERC20实现_桥梁.sol. 每个主网令牌由h令牌1:1表示(例如,1个主网DAI具有相应的hDAI)。L2级_桥梁.sol处理这些代币的铸造/燃烧。桥接契约也执行一些传输,但是,也可以通过直接调用此契约来进行传输。

L2级_ArbitrumBridge.sol公司/L2级_优化桥.sol/L2级_XDaiBridge.sol公司-这些契约继承L2_桥梁.sol并添加第二层的具体实现细节。这些是将部署在每个第2层上的契约。

定义

  • TransferId-单个传输数据的哈希。
  • TransferRoot-transferID树的merkle根和相关元数据,例如每个链的目标chainID和总数。
  • TransferRootId-TransferRoot的哈希和总量的哈希。
  • 桥接器-在第1层或第2层上收缩的跃点桥接器(“L1桥接器”、“跃点桥接器”、“仲裁桥接器”、“乐观桥接器”)
  • 规范令牌桥接器-汇总器自己的令牌桥接器。(“规范的仲裁桥”,“规范的乐观主义桥”)
  • 挑战-一个关于转让无效的赌注声明。任何人都可以对转会提出异议,并将受到相应的奖惩。
  • h令牌-跳桥令牌(例如,分别带有符号“hETH”、“hDAI”的“Hop ETH”、“Hop DAI”)是专用的二级令牌,可以批量传输到rollup,并在跳协议中充当中间资产。
  • 解救-一段时间后,可以将未正确绑定的TransferRoot解救(退款)到治理地址。
  • 有关系统的详细图表,请参阅这里的详细事务图表契约继承

图表

  • 详细事务图表契约继承

预期使用

在happy path情况下,用户将从一层向另一层发送令牌,并在几秒钟内在接收链上接收令牌。绑定器(链外节点)将运行,并通过调用接收链上的绑定取款功能来促进转移。

在非快乐路径中,绑定器将脱机。在这种情况下,用户仍将令牌从一层发送到另一层,但是,在发送链通过发送链的信使将传输中继到第1层之前,他们将无法在接收链上撤回令牌。

在第1层确认为一个称为TransferRoot的包之前,可以从给定的第2层进行多次传输。在一定数量的事务或一定时间之后,绑定者将通过第1层链上的事务绑定传输根。这包括粘合转移根量的110%,并将转移根发送到每个第2层。

系统跟踪债券人的借贷情况。借贷只能增加,借贷不能超过借贷。每次资金下注时,债券持有人的信用账户都会增加信用。每次未定金时,借方都会加到债券人的借方账户中。每次在第1层成功确认交易(从/到任何链)时,信用都会添加到担保人的信用账户。每次交易发送(从/到任何链)但尚未在第1层确认时,借方都会添加到债券人的借方账户。每个支撑链上都有一个键合器,每个层的会计系统相互独立。

任何人都可以挑战转移根。当转移根键合时,键合者提供相当于转移根键10%的挑战者赏金。一个挑战包括一个挑战者提出一个平等的股份,并等待,直到被质疑的转让根被完全确认。如果挑战获胜,挑战者的股份将在债券持有人挑战者奖金75%的基础上返还。剩下的25%的赏金被烧掉了。如果挑战失败,挑战者的股份将记入债券人。

如果TransferRoots创建错误,则可以对其进行解救。如果TransferRoot创建不正确,资金将被锁定。经过一段时间后,TransferRoot及其关联资金可以由治理帐户进行解救。

预期合同调用

传输

这些是用户在每一层上发送和接收资金的预期的、愉快的路径案例。

  • 资金将通过规范的第二层信使出现在相应的第二层上
  • 键合器ca
  • L2-&gt;L2

    • User calls L2_Bridge.swapAndSend() on the sending layer-2
    • Bonder calls L2_Bridge.bondWithdrawalAndDistribute() on the receiving layer-2

如果绑定者离线,系统依赖规范的第2层网桥来结算第1层上的交易。

  • L2-&gt;L1(债券商离线)

    • User calls L2_Bridge.swapAndSend()
    • L2_Bridge.commitTransfer() is called by anyone after 100 txs or after 4 hours
    • Wait for the sending layer-2 to be confirmed on layer-1 (approximately 7 days)
    • User or Relayer calls L1_Bridge.withdraw()
  • L2-&gt;L2(债券商离线)

    • User calls L2_Bridge.swapAndSend() on the sending layer-2
    • L2_Bridge.commitTransfer() is called on the sending layer-2 by anyone after 100 txs or after 4 hours
    • Wait for the sending layer-2 to be confirmed on layer-1 (approximately 7 days)
    • User or Relayer calls L2_Bridge.withdraw() on the receiving layer-2

合同地址

债券商通过以下功能结算交易和会计:

  • Bonder calls L2_Bridge.commitTransfers()
  • Bonder calls L1_Bridge.bondTransferRoot()
  • Bonder calls settleBondedWithdrawals() on every chain
  • Wait 7 days and L1_Bridge.confirmTransferRoot() is triggered and settles all accounting

令牌

任何人都可以质疑交易:

  • Anyone calls L1_Bridge.challengeTransferBond()
  • After the challenge resolution period has ended, anyone calls L1_Bridge.resolveChallenge()

令牌路径

请参阅./config/地址.ts对于所有部署的协定地址。

集成新L2的步骤。
  • 使用自动做市商在每次汇总时在每个桥接代币与其对应的规范代币之间进行交换,以便动态定价流动性并激励整个网络的流动性重新平衡。
  • 传输-从一个链传输到另一个链的数据。
  • TransferId-单个传输数据的哈希。
  • TransferRoot-transferID树的merkle根和相关元数据,例如每个链的目标chainID和总数。
  • TransferRootId-TransferRoot的哈希和总量的哈希。
  • 桥接器-在第1层或第2层上收缩的跃点桥接器(“L1桥接器”、“跃点桥接器”、“仲裁桥接器”、“乐观桥接器”)
  • 规范令牌桥接器-汇总器自己的令牌桥接器。(“规范的仲裁桥”,“规范的乐观主义桥”)
  • 挑战-一个关于转让无效的赌注声明。任何人都可以对转会提出异议,并将受到相应的奖惩。
  • h令牌-跳桥令牌(例如,分别带有符号“hETH”、“hDAI”的“Hop ETH”、“Hop DAI”)是专用的二级令牌,可以批量传输到rollup,并在跳协议中充当中间资产。
  • 解救-一段时间后,可以将未正确绑定的TransferRoot解救(退款)到治理地址。
  • 有关系统的详细图表,请参阅这里的详细事务图表契约继承
  • 详细事务图表契约继承
  • L1-&gt;L2用户调用L1_桥.sendToL2()资金将通过规范的第二层信使出现在相应的第二层上
  • 用户呼叫L1_桥.sendToL2()资金将通过规范的第二层信使出现在相应的第二层上
  • 资金将通过规范的第二层信使出现在相应的第二层上
  • L2-&gt;L1用户呼叫L2_桥.swapAndSend()键合器呼叫L1_桥接器.BondRetraction()
  • 用户调用L2_桥.swapAndSend()
  • 键合器ca
    • Canonical L1 Token – The layer-1 token that is being bridged. (“Canonical L1 ETH”, “Canonical L1 DAI”, “DAI”, “ETH”)
    • hToken – Exists on layer-2 and represents the right to 1 Token deposited in the layer-1 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 layer-2 representation of a Canonical L1 Token. This is the token you get from depositing into a rollup’s Canonical Token Bridge.

    Token Path

    在跃点上,令牌总是沿着以下路径转换。要将DAI转换为仲裁DAI,首先使用第1层跳桥将DAI(第1层)转换为hDAI(第2层)。然后通过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

    以下步骤是将新的第2层(例如Xyz)添加到跃点系统:

    • 契约更新

      • 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
    • 测试更新

      • Add Xyz contract artifacts to getL2SpecificArtifact() in ./test/shared/fixtures.ts
      • Add Xyz to CHAIN_IDS in ./config/constants.ts
      • Add getMessengerWrapperDefaults() to ./config/utils.ts
      • Add isChainIdXyz() to ./config/utils.ts
      • Add Xyz to sendChainSpecificBridgeDeposit() to ./scripts/shared/utils.ts
    • 配置更新

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

    FAQ

    • 如何在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.
    • 为什么我不能与刚刚部署的契约交互?

      • It takes a few blocks for transactions to traverse from L1 to other chains. If your contract was deployed on an L2 via an L1 call, you may have to wait a few blocks.
    • 安全帽的l2ethers对象是什么?为什么我的乐观主义合同不起作用?

      • It is an ethers.js object that is used when creating a contract factory for the OVM. It use OVM bytecode.
    • 为什么我不能与xDai上的合同交互?

      • Optimism adds additional bytecode to your contracts when they are compiled. This may push your contract over the contract size limit. When this happens, your contract deployment mail fail silently (the transaction will succeed but there will be no code at the address). Try removing unused functions from your contracts.
    • 为什么我的乐观契约交互看起来有效,但不更新状态?

      • Interacting with xDai contracts sends a negative default gasLimit. To resolve this issue, add overrides with a defined gasLimit with each contract invocation.
    • 为什么我的部署和事务有时会挂起?

      • If overrides are added to Optimism contract invocations, the code will say the tx has succeeded, but no state will be updated.
    • Why do my Optimism deployments and transactions sometimes hang?

      • Optimism seems to have introduced a denylist for some addresses on their public chain. Addresses that have interacted with their old public chain have seemingly been denylisted on their newest one.

    Add non-happy path tests for L2 Bridge

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

    www.interchains.cc

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

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

    提供最优质的资源集合

    立即查看 了解详情