-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: v2 evm contracts deploy scripts (#293)
- Loading branch information
Showing
8 changed files
with
118 additions
and
26 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 |
---|---|---|
|
@@ -37,4 +37,4 @@ crytic-export | |
|
||
out | ||
cache_forge | ||
broadcast | ||
v2/broadcast/*/31337 |
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,8 @@ | ||
# This is sample on how .env should look like. Values given here are illustration and are expected if run with anvil locally and first private key. | ||
# evm | ||
TSS_ADDRESS=0x70997970C51812dc3A010C7d01b50e0d17dc79C8 | ||
GATEWAY_ADMIN_ADDRESS_EVM=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 | ||
ERC20_CUSTODY_ADMIN_ADDRESS_EVM=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 | ||
ZETA_CONNECTOR_ADMIN_ADDRESS_EVM=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 | ||
GATEWAY_PROXY_EVM=0x9f21B726FCb84D8e92cdC678772590dce5347D0B | ||
ZETA_ERC20_EVM=0x42928581Ba60cD97B65D873151dc063F3D0619f8 |
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,29 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.26; | ||
|
||
import "forge-std/Script.sol"; | ||
import "src/evm/ERC20Custody.sol"; | ||
|
||
contract DeployERC20Custody is Script { | ||
function run() external { | ||
address payable tss = payable(vm.envAddress("TSS_ADDRESS")); | ||
address admin = vm.envAddress("ERC20_CUSTODY_ADMIN_ADDRESS_EVM"); | ||
address gateway = vm.envAddress("GATEWAY_PROXY_EVM"); | ||
|
||
bytes32 salt = keccak256("ERC20Custody"); | ||
|
||
vm.startBroadcast(); | ||
|
||
ERC20Custody custody = new ERC20Custody{salt: salt}(gateway, tss, admin); | ||
require(address(custody) != address(0), "deployment failed"); | ||
|
||
address expectedAddr = vm.computeCreate2Address( | ||
salt, | ||
hashInitCode(type(ERC20Custody).creationCode, abi.encode(gateway, tss, admin)) | ||
); | ||
|
||
require(expectedAddr == address(custody), "erc20 custody address doesn't match expected address"); | ||
|
||
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
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,26 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.26; | ||
|
||
import "forge-std/Script.sol"; | ||
import "test/utils/TestERC20.sol"; | ||
|
||
// This is just to deploy test erc20 tokens for testing deployments | ||
contract DeployTestERC20 is Script { | ||
function run() external { | ||
bytes32 erc20Salt = keccak256("TestERC20"); | ||
|
||
vm.startBroadcast(); | ||
|
||
TestERC20 zeta = new TestERC20{salt: erc20Salt}("zeta", "ZETA"); | ||
require(address(zeta) != address(0), "deployment failed"); | ||
|
||
address expectedAddr = vm.computeCreate2Address( | ||
erc20Salt, | ||
hashInitCode(type(TestERC20).creationCode, abi.encode("zeta", "ZETA")) | ||
); | ||
|
||
require(expectedAddr == address(zeta), "zeta address doesn't match expected address"); | ||
|
||
vm.stopBroadcast(); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
v2/scripts/deploy/deterministic/DeployZetaConnectorNonNative.s.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,30 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.26; | ||
|
||
import "forge-std/Script.sol"; | ||
import "src/evm/ZetaConnectorNonNative.sol"; | ||
|
||
contract DeployZetaConnectorNonNative is Script { | ||
function run() external { | ||
address payable tss = payable(vm.envAddress("TSS_ADDRESS")); | ||
address admin = vm.envAddress("ZETA_CONNECTOR_ADMIN_ADDRESS_EVM"); | ||
address gateway = vm.envAddress("GATEWAY_PROXY_EVM"); | ||
address zeta = vm.envAddress("ZETA_ERC20_EVM"); | ||
|
||
bytes32 salt = keccak256("ZetaConnectorNonNative"); | ||
|
||
vm.startBroadcast(); | ||
|
||
ZetaConnectorNonNative connector = new ZetaConnectorNonNative{salt: salt}(gateway, zeta, tss, admin); | ||
require(address(connector) != address(0), "deployment failed"); | ||
|
||
address expectedAddr = vm.computeCreate2Address( | ||
salt, | ||
hashInitCode(type(ZetaConnectorNonNative).creationCode, abi.encode(gateway, zeta, tss, admin)) | ||
); | ||
|
||
require(expectedAddr == address(connector), "zeta connector non native address doesn't match expected address"); | ||
|
||
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
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