-
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
b81010a
commit e5f4262
Showing
9 changed files
with
123 additions
and
14 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
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 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,53 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity >=0.8.25 <0.9.0; | ||
|
||
import { Script } from "forge-std/Script.sol"; | ||
import { L1XERC20Gateway } from "src/L1XERC20Gateway.sol"; | ||
import {CREATE3} from 'solmate/utils/CREATE3.sol'; | ||
|
||
/// @title Factory for deploying contracts to deterministic addresses via CREATE3 | ||
/// @author zefram.eth | ||
/// @notice Enables deploying contracts using CREATE3. Each deployer (msg.sender) has | ||
/// its own namespace for deployed addresses. | ||
interface ICREATE3Factory { | ||
/// @notice Deploys a contract using CREATE3 | ||
/// @dev The provided salt is hashed together with msg.sender to generate the final salt | ||
/// @param salt The deployer-specific salt for determining the deployed contract's address | ||
/// @param creationCode The creation code of the contract to deploy | ||
/// @return deployed The address of the deployed contract | ||
function deploy(bytes32 salt, bytes memory creationCode) | ||
external | ||
payable | ||
returns (address deployed); | ||
|
||
/// @notice Predicts the address of a deployed contract | ||
/// @dev The provided salt is hashed together with the deployer address to generate the final salt | ||
/// @param deployer The deployer account that will call deploy() | ||
/// @param salt The deployer-specific salt for determining the deployed contract's address | ||
/// @return deployed The address of the contract that will be deployed | ||
function getDeployed(address deployer, bytes32 salt) | ||
external | ||
view | ||
returns (address deployed); | ||
} | ||
|
||
contract L1GatewayDeploy is Script { | ||
string public constant SALT = 'XERC20Gateway-v0.2'; | ||
function run() public { | ||
uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PK"); | ||
address owner = vm.envAddress("L1_GATEWAY_OWNER"); | ||
address router = vm.envAddress("L1_ARBITRUM_ROUTER"); | ||
address inbox = vm.envAddress("L1_ARBITRUM_INBOX"); | ||
|
||
vm.startBroadcast(deployerPrivateKey); | ||
|
||
bytes32 _salt = keccak256(abi.encodePacked(SALT, msg.sender)); | ||
|
||
bytes memory _creation = type(L1XERC20Gateway).creationCode; | ||
bytes memory _bytecode = abi.encodePacked(_creation, abi.encode(owner, router, inbox)); | ||
|
||
ICREATE3Factory(0x93FEC2C00BfE902F733B57c5a6CeeD7CD1384AE1).deploy(_salt, _bytecode); | ||
|
||
vm.stopBroadcast(); | ||
} | ||
} |
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,24 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity >=0.8.25 <0.9.0; | ||
|
||
import { Script } from "forge-std/Script.sol"; | ||
import { XERC20Factory } from "xerc20/contracts/XERC20Factory.sol"; | ||
|
||
contract XERC20Deploy is Script { | ||
function run() public { | ||
uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PK"); | ||
|
||
address factoryAdrress = vm.envAddress("XERC20_FACTORY"); | ||
string memory name = vm.envString("XERC20_NAME"); | ||
string memory symbol = vm.envString("XERC20_SYMBOL"); | ||
|
||
uint256[] memory limits = vm.envOr("XERC20_BURN_MINT_LIMITS", ',', new uint256[](0)); | ||
address[] memory bridges = vm.envOr("XERC20_BRIDGES", ',', new address[](0)); | ||
|
||
vm.startBroadcast(deployerPrivateKey); | ||
|
||
XERC20Factory(factoryAdrress).deployXERC20(name, symbol, limits, limits, bridges); | ||
|
||
vm.stopBroadcast(); | ||
} | ||
} |
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,21 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity >=0.8.25 <0.9.0; | ||
|
||
import { Script } from "forge-std/Script.sol"; | ||
import { XERC20Factory } from "xerc20/contracts/XERC20Factory.sol"; | ||
|
||
contract XERC20FactoryDeploy is Script { | ||
string public constant SALT = 'xERC20-v1.5'; | ||
|
||
function run() public { | ||
uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PK"); | ||
|
||
vm.startBroadcast(deployerPrivateKey); | ||
|
||
bytes32 _salt = keccak256(abi.encodePacked(SALT, msg.sender)); | ||
|
||
new XERC20Factory{salt: _salt}(); | ||
|
||
vm.stopBroadcast(); | ||
} | ||
} |