forked from 0xPolygonHermez/zkevm-contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
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
93525be
commit e0404cc
Showing
19 changed files
with
587 additions
and
1,927 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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
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
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,24 +1,64 @@ | ||
// SPDX-License-Identifier: AGPL-3.0 | ||
pragma solidity 0.8.15; | ||
import "../Bridge.sol"; | ||
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; | ||
|
||
/** | ||
* Bridge that will be deployed on both networks Ethereum and Polygon zkEVM | ||
* Contract responsible to manage the token interactions with other networks | ||
*/ | ||
contract BridgeMock is Bridge { | ||
contract BridgeMock is Bridge, OwnableUpgradeable { | ||
uint256 public maxEtherBridge; | ||
|
||
/** | ||
* @param _networkID networkID | ||
* @param _globalExitRootManager global exit root manager address | ||
*/ | ||
constructor( | ||
function initialize( | ||
uint32 _networkID, | ||
IGlobalExitRootManager _globalExitRootManager | ||
) { | ||
initialize(_networkID, _globalExitRootManager); | ||
) public override initializer { | ||
networkID = _networkID; | ||
globalExitRootManager = _globalExitRootManager; | ||
tokenImplementation = address(new TokenWrapped()); | ||
__DepositContract_init(); | ||
__Ownable_init(); | ||
maxEtherBridge = 0.25 ether; | ||
} | ||
|
||
function setNetworkID(uint32 _networkID) public { | ||
function setNetworkID(uint32 _networkID) public onlyOwner { | ||
networkID = _networkID; | ||
} | ||
|
||
function setMaxEtherBridge(uint256 _maxEtherBridge) public onlyOwner { | ||
maxEtherBridge = _maxEtherBridge; | ||
} | ||
|
||
/** | ||
* @notice Deposit add a new leaf to the merkle tree | ||
* @param token Token address, 0 address is reserved for ether | ||
* @param destinationNetwork Network destination | ||
* @param destinationAddress Address destination | ||
* @param amount Amount of tokens | ||
* @param permitData Raw data of the call `permit` of the token | ||
*/ | ||
function bridge( | ||
address token, | ||
uint32 destinationNetwork, | ||
address destinationAddress, | ||
uint256 amount, | ||
bytes calldata permitData | ||
) public payable override { | ||
require( | ||
msg.value <= maxEtherBridge, | ||
"Bridge::bridge: Cannot bridge more than maxEtherBridge in internal testnet" | ||
); | ||
super.bridge( | ||
token, | ||
destinationNetwork, | ||
destinationAddress, | ||
amount, | ||
permitData | ||
); | ||
} | ||
} |
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
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,64 @@ | ||
|
||
{ | ||
"defaultChainId": 1000, | ||
"sequencerAddress": "0xC949254d682D8c9ad5682521675b8F43b102aec4", | ||
"genesis": [ | ||
{ | ||
"address": "0x9D98DeAbC42dd696Deb9e40b4f1CAB7dDBF55988", | ||
"pvtKey": "0x00", | ||
"balance": "100000000000000000000000", | ||
"nonce": "0" | ||
}, | ||
{ | ||
"address": "0xC949254d682D8c9ad5682521675b8F43b102aec4", | ||
"pvtKey": "0xdfd01798f92667dbf91df722434e8fbe96af0211d4d1b82bbbbc8f1def7a814f", | ||
"balance": "0", | ||
"nonce": "0" | ||
} | ||
], | ||
"txs": [ | ||
{ | ||
"from": "0xC949254d682D8c9ad5682521675b8F43b102aec4", | ||
"nonce": 0, | ||
"value": "0", | ||
"gasLimit": 10000000, | ||
"gasPrice": "0", | ||
"chainId": 1000, | ||
"paramsDeploy": { | ||
"types": [ | ||
"address" | ||
], | ||
"values": [ | ||
"0x9D98DeAbC42dd696Deb9e40b4f1CAB7dDBF55988" | ||
] | ||
}, | ||
"contractName": "GlobalExitRootManagerL2", | ||
"reason": "" | ||
}, | ||
{ | ||
"from": "0xC949254d682D8c9ad5682521675b8F43b102aec4", | ||
"nonce": 1, | ||
"value": "0", | ||
"gasLimit": 10000000, | ||
"gasPrice": "0", | ||
"chainId": 1000, | ||
"contractName": "Bridge" | ||
}, | ||
{ | ||
"from": "0xC949254d682D8c9ad5682521675b8F43b102aec4", | ||
"to": "0x9D98DeAbC42dd696Deb9e40b4f1CAB7dDBF55988", | ||
"nonce": 2, | ||
"value": "0", | ||
"gasLimit": 10000000, | ||
"gasPrice": "0", | ||
"chainId": 1000, | ||
"function": "initialize", | ||
"paramsFunction": [ | ||
1, | ||
"0xAE4bB80bE56B819606589DE61d5ec3b522EEB032" | ||
], | ||
"contractName": "Bridge" | ||
} | ||
], | ||
"timestamp": 1944498031 | ||
} |
Oops, something went wrong.