-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7794c0e
commit 7b7a7ca
Showing
65 changed files
with
5,397 additions
and
3,310 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
12 | ||
16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
contracts/_interfaces/bridge-gateways/IArbitrumGateway.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
import {IBCRebaseGatewayEvents, ISCRebaseGatewayEvents, ITransferGatewayEvents} from "./IGateway.sol"; | ||
import {ITokenGateway} from "arb-bridge-peripherals/contracts/tokenbridge/libraries/gateway/ITokenGateway.sol"; | ||
|
||
// Arbitrum chains expect the cross chain transaction to "pre-pay" in eth | ||
// for execution on the other chain | ||
// https://developer.offchainlabs.com/docs/l1_l2_messages | ||
|
||
interface IArbitrumBCRebaseGateway is IBCRebaseGatewayEvents { | ||
event RebaseReportInitiated(uint256 indexed _sequenceNumber); | ||
|
||
function reportRebaseInit( | ||
uint256 _maxSubmissionCost, | ||
uint256 _maxGas, | ||
uint256 _gasPriceBid | ||
) external payable returns (bytes memory); | ||
} | ||
|
||
interface IArbitrumSCRebaseGateway is ISCRebaseGatewayEvents { | ||
event RebaseReportFinalized(uint256 indexed _exitNum); | ||
|
||
function reportRebaseCommit(uint256 globalAmpleforthEpoch, uint256 globalAMPLSupply) external; | ||
} | ||
|
||
interface IArbitrumTransferGateway is ITransferGatewayEvents, ITokenGateway { | ||
function getOutboundCalldata( | ||
address _l1Token, | ||
address _from, | ||
address _to, | ||
uint256 _amount, | ||
bytes memory _data | ||
) external view returns (bytes memory); | ||
} | ||
|
||
interface IArbitrumBCTransferGateway is IArbitrumTransferGateway { | ||
event DepositInitiated( | ||
address l1Token, | ||
address indexed _from, | ||
address indexed _to, | ||
uint256 indexed _sequenceNumber, | ||
uint256 _amount | ||
); | ||
|
||
event WithdrawalFinalized( | ||
address l1Token, | ||
address indexed _from, | ||
address indexed _to, | ||
uint256 indexed _exitNum, | ||
uint256 _amount | ||
); | ||
} | ||
|
||
interface IArbitrumSCTransferGateway is IArbitrumTransferGateway { | ||
event DepositFinalized( | ||
address indexed l1Token, | ||
address indexed _from, | ||
address indexed _to, | ||
uint256 _amount | ||
); | ||
|
||
event WithdrawalInitiated( | ||
address l1Token, | ||
address indexed _from, | ||
address indexed _to, | ||
uint256 indexed _l2ToL1Id, | ||
uint256 _exitNum, | ||
uint256 _amount | ||
); | ||
} |
43 changes: 43 additions & 0 deletions
43
contracts/_interfaces/bridge-gateways/IChainBridgeGateway.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
import {IBCRebaseGatewayEvents, ISCRebaseGatewayEvents, ITransferGatewayEvents} from "./IGateway.sol"; | ||
|
||
interface IChainBridgeBCRebaseGateway is IBCRebaseGatewayEvents { | ||
function validateRebaseReport(uint256 globalAmpleforthEpoch, uint256 globalAMPLSupply) external; | ||
} | ||
|
||
interface IChainBridgeSCRebaseGateway is ISCRebaseGatewayEvents { | ||
function reportRebase(uint256 globalAmpleforthEpoch, uint256 globalAMPLSupply) external; | ||
} | ||
|
||
interface IChainBridgeBCTransferGateway is ITransferGatewayEvents { | ||
function validateAndLock( | ||
address sender, | ||
address recipientInTargetChain, | ||
uint256 amount, | ||
uint256 globalAMPLSupply | ||
) external; | ||
|
||
function unlock( | ||
address senderInSourceChain, | ||
address recipient, | ||
uint256 amount, | ||
uint256 globalAMPLSupply | ||
) external; | ||
} | ||
|
||
interface IChainBridgeSCTransferGateway is ITransferGatewayEvents { | ||
function mint( | ||
address senderInSourceChain, | ||
address recipient, | ||
uint256 amount, | ||
uint256 globalAMPLSupply | ||
) external; | ||
|
||
function validateAndBurn( | ||
address sender, | ||
address recipientInTargetChain, | ||
uint256 amount, | ||
uint256 globalAMPLSupply | ||
) external; | ||
} |
24 changes: 24 additions & 0 deletions
24
...ridge-gateways/ITransferGatewayEvents.sol → .../_interfaces/bridge-gateways/IGateway.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
import {IBCRebaseGatewayEvents, ISCRebaseGatewayEvents, ITransferGatewayEvents} from "./IGateway.sol"; | ||
|
||
interface IMaticBCRebaseGateway is IBCRebaseGatewayEvents { | ||
function reportRebase() external; | ||
} | ||
|
||
interface IMaticSCRebaseGateway is ISCRebaseGatewayEvents {} | ||
|
||
interface IMaticTransferGateway is ITransferGatewayEvents { | ||
function transfer(address recipientInTargetChain, uint256 amount) external; | ||
} |
23 changes: 0 additions & 23 deletions
23
contracts/_interfaces/bridge-gateways/IRebaseGatewayEvents.sol
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
pragma solidity 0.6.11; | ||
pragma experimental ABIEncoderV2; | ||
|
||
import {InboxMock} from "arb-bridge-peripherals/contracts/tokenbridge/test/InboxMock.sol"; | ||
import {L1ArbitrumMessenger} from "arb-bridge-peripherals/contracts/tokenbridge/ethereum/L1ArbitrumMessenger.sol"; | ||
import {L2ArbitrumMessenger} from "arb-bridge-peripherals/contracts/tokenbridge/arbitrum/L2ArbitrumMessenger.sol"; | ||
import {L1ArbitrumTestMessenger} from "arb-bridge-peripherals/contracts/tokenbridge/test/GatewayTest.sol"; | ||
import {L2ArbitrumTestMessenger} from "arb-bridge-peripherals/contracts/tokenbridge/test/GatewayTest.sol"; | ||
import {IBridge} from "arb-bridge-peripherals/contracts/tokenbridge/test/GatewayTest.sol"; | ||
import {AMPLArbitrumGateway} from "../base-chain/bridge-gateways/AMPLArbitrumGateway.sol"; | ||
import {ArbitrumXCAmpleGateway} from "../satellite-chain/bridge-gateways/ArbitrumXCAmpleGateway.sol"; | ||
|
||
contract MockArbitrumInbox is InboxMock {} | ||
|
||
// Mocking sendTxToL2 | ||
// https://shorturl.at/dgABO | ||
contract MockAMPLArbitrumGateway is L1ArbitrumTestMessenger, AMPLArbitrumGateway { | ||
constructor( | ||
address ampl_, | ||
address policy_, | ||
address vault_ | ||
) public AMPLArbitrumGateway(ampl_, policy_, vault_) {} | ||
|
||
function sendTxToL2( | ||
address _inbox, | ||
address _to, | ||
address _user, | ||
uint256 _l1CallValue, | ||
uint256 _l2CallValue, | ||
uint256 _maxSubmissionCost, | ||
uint256 _maxGas, | ||
uint256 _gasPriceBid, | ||
bytes memory _data | ||
) internal virtual override(L1ArbitrumMessenger, L1ArbitrumTestMessenger) returns (uint256) { | ||
return | ||
L1ArbitrumTestMessenger.sendTxToL2( | ||
_inbox, | ||
_to, | ||
_user, | ||
_l1CallValue, | ||
_l2CallValue, | ||
_maxSubmissionCost, | ||
_maxGas, | ||
_gasPriceBid, | ||
_data | ||
); | ||
} | ||
|
||
function getL2ToL1Sender(address _inbox) | ||
internal | ||
view | ||
virtual | ||
override(L1ArbitrumMessenger, L1ArbitrumTestMessenger) | ||
returns (address) | ||
{ | ||
return L1ArbitrumTestMessenger.getL2ToL1Sender(_inbox); | ||
} | ||
|
||
function getBridge(address _inbox) | ||
internal | ||
view | ||
virtual | ||
override(L1ArbitrumMessenger, L1ArbitrumTestMessenger) | ||
returns (IBridge) | ||
{ | ||
return L1ArbitrumTestMessenger.getBridge(_inbox); | ||
} | ||
} | ||
|
||
contract MockArbitrumXCAmpleGateway is L2ArbitrumTestMessenger, ArbitrumXCAmpleGateway { | ||
constructor(address xcAmple_, address xcController_) | ||
public | ||
ArbitrumXCAmpleGateway(xcAmple_, xcController_) | ||
{} | ||
|
||
function sendTxToL1( | ||
uint256 _l1CallValue, | ||
address _from, | ||
address _to, | ||
bytes memory _data | ||
) internal virtual override(L2ArbitrumMessenger, L2ArbitrumTestMessenger) returns (uint256) { | ||
return L2ArbitrumTestMessenger.sendTxToL1(_l1CallValue, _from, _to, _data); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 0 additions & 21 deletions
21
contracts/base-bridge-gateways/ChainBridgeRebaseGateway.sol
This file was deleted.
Oops, something went wrong.
45 changes: 0 additions & 45 deletions
45
contracts/base-bridge-gateways/ChainBridgeTransferGateway.sol
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.